fern-api 2.13.0 → 2.14.0

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
@@ -1152,7 +1152,7 @@ ${WUp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&S9s(th
1152
1152
  `+xHi.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?xHi.default.cyan(ZUp(t,this.opt.mask)):xHi.default.italic(xHi.default.dim("[hidden]")):this.opt.mask?ZUp(t,this.opt.mask):xHi.default.italic(xHi.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 v0o=ae(b1(),1);var Z4p=ae(sGs(),1),y0o=require("child_process"),nTn=require("fs"),h0o=ae(require("path"),1),k4p=ae(require("os"),1),e3p=require("crypto"),HGs=ae(Y4p(),1);var d0o=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var Xga=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var p0o=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var _0o=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function b0o(e="",t,r){let i=new KGs(e,r);i.runAsync((n,a)=>{if(n)setImmediate(t,n,void 0);else try{i.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function X4p(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function wgS(e){let t=[],r="";for(let i=0;i<e.length;i++){let n=e.charAt(i);i>0&&n===" "&&e[i-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${n}`}return r.length>0&&t.push(r),t}var KGs=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=wgS(t).map(n=>n.replace("\\ "," ")),i=r.shift();this.editor={args:r,bin:i}}createTemporaryFile(){try{let t=this.fileOptions.dir??k4p.default.tmpdir(),r=(0,e3p.randomUUID)(),i=X4p(this.fileOptions.prefix),n=X4p(this.fileOptions.postfix),a=`${i}${r}${n}`,o=h0o.default.resolve(t,a),c=h0o.default.resolve(t)+h0o.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,nTn.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new d0o(t)}}readTemporaryFile(){try{let t=(0,nTn.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,Z4p.detect)(t)??"utf8";HGs.default.encodingExists(r)||(r="utf8"),this.text=HGs.default.decode(t,r)}}catch(t){throw new p0o(t)}}removeTemporaryFile(){try{(0,nTn.unlinkSync)(this.tempFile)}catch(t){throw new _0o(t)}}launchEditor(){try{let t=(0,y0o.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new Xga(t)}}launchEditorAsync(t){try{(0,y0o.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",i=>{this.lastExitStatus=i,setImmediate(t)})}catch(r){throw new Xga(r)}}};var t3p=ae(Z_e(),1);var Zga=class extends v1{_run(t){this.done=t,this.editorResult=new t3p.Subject;let r=qQ(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"?v0o.default.dim("Received"):v0o.default.dim("Press <enter> to launch your preferred editor."),t&&(r=v0o.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),b0o(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 o3p=require("stream");var n3p=ae(require("readline"),1),a3p=ae(i3p(),1),JHi=class{constructor(t){this.rl||=n3p.default.createInterface(SgS(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 SgS(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 a3p.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var kga=class extends JHi{constructor(t={}){super(t),this.log=new o3p.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return zga(this.rl,this.bottomBar.split(`
1153
1153
  `).length),this}updateBottomBar(t){return zga(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+`
1154
1154
  `}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&&Umo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var dO=ae(Z_e(),1),c3p=ae(iga(),1);var g0o=ae(Z_e(),1),u3p=ae(iga(),1),O0o=function(e,t,r){return typeof e[t]!="function"?(0,g0o.of)(e):(0,g0o.from)((0,u3p.default)(e[t])(r).then(i=>(e[t]=i,e)))};var s3p={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,o)=>{n==="__proto__"||n==="constructor"||(a===o.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((o,c)=>o!=null?o[c]:o,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},aTn=class extends JHi{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,dO.from)(t):(0,dO.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,dO.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,dO.from)([t]),this.process=i.pipe((0,dO.concatMap)(this.processQuestion.bind(this)),(0,dO.publish)()),this.process.connect(),this.process.pipe((0,dO.reduce)((n,a)=>(s3p.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,dO.defer)(()=>(0,dO.of)(t).pipe((0,dO.concatMap)(this.setDefaultType.bind(this)),(0,dO.concatMap)(this.filterIfRunnable.bind(this)),(0,dO.concatMap)(()=>O0o(t,"message",this.answers)),(0,dO.concatMap)(()=>O0o(t,"default",this.answers)),(0,dO.concatMap)(()=>O0o(t,"choices",this.answers)),(0,dO.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,dO.defer)(()=>(0,dO.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,dO.defer)(()=>(0,dO.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&s3p.get(this.answers,t.name)!==void 0)return dO.EMPTY;if(t.when===!1)return dO.EMPTY;if(typeof t.when!="function")return(0,dO.of)(t);let{answers:r}=this;return(0,dO.defer)(()=>(0,dO.from)((0,c3p.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,dO.filter)(i=>i!=null)))}};function l3p(e){let t=function(r,i){let n;try{n=new aTn(t.prompts,e)}catch(o){return Promise.reject(o)}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",Fga),this.registerPrompt("input",WHi),this.registerPrompt("number",Qga),this.registerPrompt("confirm",Uga),this.registerPrompt("rawlist",Lga),this.registerPrompt("expand",Vga),this.registerPrompt("checkbox",Wga),this.registerPrompt("password",xga),this.registerPrompt("editor",Zga)},t.restoreDefaultPrompts(),t}var $Gs=l3p();function DgS(e,t){$Gs.registerPrompt(e,t)}function BgS(){$Gs.restoreDefaultPrompts()}var IgS={prompt:$Gs,ui:{BottomBar:kga,Prompt:aTn},createPromptModule:l3p,registerPrompt:DgS,restoreDefaultPrompts:BgS,Separator:w6},A0o=IgS;var vTn=require("path"),WLp=require("fs"),xLp=require("readline"),_Lp="posthog-node";function nmS(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[L0o.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=s;let u=a.exception?.values||[],l=u.map(_=>({..._,stacktrace:_.stacktrace?{..._.stacktrace,type:"raw",frames:(_.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),p={$exception_message:u[0]?.value||a.message,$exception_type:u[0]?.type,$exception_personURL:s,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:u[0]?.value||a.message,$sentry_exception_type:u[0]?.type,$sentry_tags:a.tags};return t&&r&&(p.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:p}),a}}var L0o=class{constructor(t,r,i,n){this.name=_Lp,this.name=_Lp,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(nmS(t,{organization:r,projectId:c,prefix:i,severityAllowList:n}))}}};L0o.POSTHOG_ID_TAG="posthog_distinct_id";var z0o="0123456789abcdef",V0o=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+=z0o.charAt(this.bytes[r]>>>4),t+=z0o.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+=z0o.charAt(this.bytes[r]>>>4),t+=z0o.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}},q7s=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??amS()}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 V0o.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,V0o.ofInner(t)}},amS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),hLp,T7s=()=>omS().toString(),omS=()=>(hLp||(hLp=new q7s)).generate();function umS(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function smS(e,t){global.process.on("uncaughtException",umS(e,t))}function cmS(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var N0o,yLp,F0o;function lmS(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return F0o&&r.length===yLp||(yLp=r.length,F0o=r.reduce((i,n)=>{N0o||(N0o={});let a=N0o[n];if(a)i[a[0]]=a[1];else{let o=e(n);for(let c=o.length-1;c>=0;c--){let s=o[c]?.filename,u=t[n];if(s&&u){i[s]=u,N0o[n]=[s,u];break}}}return i},{})),F0o}function fmS(e){return typeof Event<"u"&&GLp(e,Event)}function dmS(e){return HLp(e,"Object")}function V7s(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return GLp(e,Error)}}function GLp(e,t){try{return e instanceof t}catch{return!1}}function pmS(e){return HLp(e,"ErrorEvent")}function HLp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function _mS(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},o=KLp(a,r,i);return{$exception_list:await Promise.all(o.map(async s=>{let u=await AmS(e,t,s);return u.value=u.value||"",u.type=u.type||"Error",u.mechanism=a,u}))}}function KLp(e,t,r){let i=hmS(e,t,r);return i.cause?[i,...KLp(e,i.cause,r)]:[i]}function hmS(e,t,r){if(V7s(t))return t;if(e.synthetic=!0,dmS(t)){let n=ymS(t);if(n)return n;let a=bmS(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let i=r?.syntheticException||new Error(t);return i.message=`${t}`,i}function ymS(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(V7s(r))return r}}function bmS(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=gmS(e);if(pmS(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=vmS(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function vmS(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function gmS(e,t=40){let r=Object.keys(OmS(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return bLp(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:bLp(a,t)}return""}function bLp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function OmS(e){return V7s(e)?{message:e.message,name:e.name,stack:e.stack,...vLp(e)}:fmS(e)?{type:e.type,target:gLp(e.target),currentTarget:gLp(e.currentTarget),...vLp(e)}:e}function vLp(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 gLp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function AmS(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=mmS(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function mmS(e,t){return PmS(e(t.stack||"",1),e)}function PmS(e,t){let r=lmS(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var jmS=2e3,hTn=class e{static async captureException(t,r,i,n,a){let o={...a};n||(o.$process_person_profile=!1);let c=await _mS(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||T7s(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(smS(this.onException.bind(this),this.onFatalError.bind(this)),cmS(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(jmS)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function wmS(e=process.argv[1]?(0,vTn.dirname)(process.argv[1]):process.cwd(),t=vTn.sep==="\\"){let r=t?OLp(e):e;return i=>{if(!i)return;let n=t?OLp(i):i,{dir:a,base:o,ext:c}=vTn.posix.parse(n);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let u=a.slice(r.length+1).replace(/\//g,".");return u?`${u}:${f}`:f}return f}}function OLp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var W0o=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)}}},U0o=new W0o(25),JLp=new W0o(20),W7s=7,EmS=1e3,SmS=1e4;async function MmS(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||CmS(o)||qmS(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(JLp.get(n))continue;let a=t[n];if(!a)continue;a.sort((f,s)=>f-s);let o=RmS(a);if(o.every(f=>TmS(n,f)))continue;let c=zmS(U0o,n,{});i.push(DmS(n,o,c))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&BmS(e,U0o),U0o.reduce(),e}function DmS(e,t,r){return new Promise(i=>{let n=(0,WLp.createReadStream)(e),a=(0,xLp.createInterface)({input:n});function o(){n.destroy(),i()}let c=0,f=0,s=t[f];if(s===void 0){o();return}let u=s[0],l=s[1];function p(){JLp.set(e,1),a.close(),a.removeAllListeners(),o()}n.on("error",p),a.on("error",p),a.on("close",o),a.on("line",_=>{if(c++,!(c<u)&&(r[c]=NmS(_,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let h=t[f];if(h===void 0){a.close(),a.removeAllListeners();return}u=h[0],l=h[1]}})})}function BmS(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;ImS(r.lineno,r,i)}}function ImS(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=$Lp(e);n<e;n++){let a=r[n];if(a===void 0){ALp(t);return}t.pre_context.push(a)}if(r[e]===void 0){ALp(t);return}t.context_line=r[e];let i=YLp(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 ALp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function CmS(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function qmS(e){return e.lineno!==void 0&&e.lineno>SmS||e.colno!==void 0&&e.colno>EmS}function TmS(e,t){let r=U0o.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 RmS(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=mLp(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+W7s:(n.push(i),i=mLp(a)),t++}return n}function mLp(e){return[$Lp(e),YLp(e)]}function $Lp(e){return Math.max(1,e-W7s)}function YLp(e){return e+W7s}function zmS(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function NmS(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 FmS="4.18.0",B6;(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"})(B6||(B6={}));var PLp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(PLp||(PLp={}));var jLp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(jLp||(jLp={}));var wLp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(wLp||(wLp={}));var ELp;(function(e){e.Html="html",e.Text="text"})(ELp||(ELp={}));var SLp;(function(e){e.Number="number",e.Emoji="emoji"})(SLp||(SLp={}));var MLp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(MLp||(MLp={}));var DLp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(DLp||(DLp={}));var BLp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(BLp||(BLp={}));var ILp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(ILp||(ILp={}));var QmS=e=>{if("flags"in e){let t=LmS(e.flags),r=VmS(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,XLp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,UmS(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function UmS(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 LmS=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,x7s(r)]).filter(([,t])=>t!==void 0)),VmS=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?XLp(i):void 0]}))},x7s=e=>e===void 0?void 0:e.variant??e.enabled,XLp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},WmS=1,xmS=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"]),GmS="utf8";function HmS(e,t){if(!e||typeof e!="string"||KmS(e))throw new Error(t)}function KmS(e){return e.trim().length===0}function JmS(e){return e?.replace(/\/+$/,"")}async function $mS(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 CLp(){return new Date().getTime()}function I7s(){return new Date().toISOString()}function x0o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function YmS(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function XmS(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 ZmS(e,t=0,r){let i=XmS(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function qLp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var cOa=String.fromCharCode,TLp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Q0o={};function kmS(e,t){if(!Q0o[e]){Q0o[e]={};for(let r=0;r<e.length;r++)Q0o[e][e.charAt(r)]=r}return Q0o[e][t]}var pTn={compressToBase64:function(e){if(e==null)return"";let t=pTn._compress(e,6,function(r){return TLp.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:pTn._decompress(e.length,32,function(t){return kmS(TLp,e.charAt(t))})},compress:function(e){return pTn._compress(e,16,function(t){return cOa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],o,c,f="",s="",u="",l=2,p=3,_=2,h=0,y=0,b;for(b=0;b<e.length;b+=1)if(f=e.charAt(b),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=p++,n[f]=!0),s=u+f,Object.prototype.hasOwnProperty.call(i,s))u=s;else{if(Object.prototype.hasOwnProperty.call(n,u)){if(u.charCodeAt(0)<256){for(o=0;o<_;o++)h=h<<1,y==t-1?(y=0,a.push(r(h)),h=0):y++;for(c=u.charCodeAt(0),o=0;o<8;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}else{for(c=1,o=0;o<_;o++)h=h<<1|c,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}l--,l==0&&(l=Math.pow(2,_),_++),delete n[u]}else for(c=i[u],o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;l--,l==0&&(l=Math.pow(2,_),_++),i[s]=p++,u=String(f)}if(u!==""){if(Object.prototype.hasOwnProperty.call(n,u)){if(u.charCodeAt(0)<256){for(o=0;o<_;o++)h=h<<1,y==t-1?(y=0,a.push(r(h)),h=0):y++;for(c=u.charCodeAt(0),o=0;o<8;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}else{for(c=1,o=0;o<_;o++)h=h<<1|c,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}l--,l==0&&(l=Math.pow(2,_),_++),delete n[u]}else for(c=i[u],o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;l--,l==0&&(l=Math.pow(2,_),_++)}for(c=2,o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;for(;;)if(h=h<<1,y==t-1){a.push(r(h));break}else y++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:pTn._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},o=4,c=4,f=3,s="",u,l,p,_,h,y,b;for(u=0;u<3;u+=1)i[u]=u;for(p=0,h=Math.pow(2,2),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;switch(p){case 0:for(p=0,h=Math.pow(2,8),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;b=cOa(p);break;case 1:for(p=0,h=Math.pow(2,16),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;b=cOa(p);break;case 2:return""}for(i[3]=b,l=b,n.push(b);;){if(a.index>e)return"";for(p=0,h=Math.pow(2,f),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;switch(b=p){case 0:for(p=0,h=Math.pow(2,8),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;i[c++]=cOa(p),b=c-1,o--;break;case 1:for(p=0,h=Math.pow(2,16),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;i[c++]=cOa(p),b=c-1,o--;break;case 2:return n.join("")}if(o==0&&(o=Math.pow(2,f),f++),i[b])s=i[b];else if(b===c)s=l+l.charAt(0);else return null;n.push(s),i[c++]=l+s.charAt(0),o--,l=s,o==0&&(o=Math.pow(2,f),f++)}}},R7s=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)}},yTn=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()}},lOa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function RLp(e){if(e instanceof yTn){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 C7s(e){return typeof e=="object"&&(e instanceof yTn||e instanceof lOa)}function zLp(e){return typeof e=="object"&&e instanceof yTn&&e.status===413}var z7s;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(z7s||(z7s={}));var N7s=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new R7s,this._isInitialized=!1,HmS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=JmS(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:C7s},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(B6.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(B6.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(B6.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=T7s();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,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...o||{}}});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=ZmS(this.apiKey,WmS,xmS)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>QmS(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,i,n,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=x7s(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,i,n,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,i,n,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,i,n,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(z7s.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return n&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(n))),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(B6.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(B6.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(B6.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(B6.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(B6.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=x0o(()=>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:I7s()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${CLp()}&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(pTn.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:I7s(),uuid:i?.uuid?i.uuid:T7s()};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 RLp(t)})}async flush(){let t=qLp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),qLp([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(B6.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(p=>p.message),o=()=>{let _=(this.getPersistedProperty(B6.Queue)||[]).slice(n.length);this.setPersistedProperty(B6.Queue,_),t=_},c={api_key:this.apiKey,batch:a,sent_at:I7s()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${CLp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,u=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(pTn.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:p=>zLp(p)?!1:C7s(p)};try{await this.fetchWithRetry(s,u,l)}catch(p){if(zLp(p)&&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 p instanceof lOa||o(),this._events.emit("error",p),p}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let u=new AbortController;return setTimeout(()=>u.abort(),s),u.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,GmS)}catch{c=new TextEncoder().encode(o).length}return await $mS(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(u){throw new lOa(u)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new yTn(f,c);return f},{...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(B6.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!C7s(n))throw n;await RLp(n)}};return Promise.race([new Promise((n,a)=>{x0o(()=>{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}},F7s=YmS();if(!F7s){let e=pLp();F7s=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 ZLp=F7s,G0o=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()}},kLp=new G0o(async()=>{try{return await import("crypto")}catch{return}});async function e0S(){return await kLp.getValue()}var t0S=new G0o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await kLp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function r0S(){return await t0S.getValue()}async function i0S(e){let t=await e0S();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await r0S();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 n0S=60*1e3,a0S=1152921504606847e3,o0S=["is_not"],_Tn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},g1=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Q7s=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=c.fetch||ZLp,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof g1?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let 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={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let s=await this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let u=await this.computeFeatureFlagPayloadLocally(f.key,s);u&&(o[f.key]=u)}catch(s){s instanceof g1||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new g1("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new g1("Flag has unknown group type index");if(!(f in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[f];return await this.matchFeatureFlagProperties(t,i[f],s)}else return await this.matchFeatureFlagProperties(t,r,n)}async matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],o=!1,c,f=[...a].sort((s,u)=>{let l=!!s.variant,p=!!u.variant;return l&&p?0:l?-1:p?1:0});for(let s of f)try{if(await this.isConditionMatch(t,r,s,i)){let u=s.variant,l=n.multivariate?.variants||[];u&&l.some(p=>p.key===u)?c=u:c=await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof g1)o=!0;else throw u}if(c!==void 0)return c;if(o)throw new g1("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,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((i.properties||[]).length>0){for(let c of i.properties){let f=c.type,s=!1;if(f==="cohort"?s=t8p(c,n,this.cohorts,this.debugMode):s=e8p(c,n,o),!s)return!1}if(a==null)return!0}return!(a!=null&&await NLp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await NLp(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(n0S,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 _Tn(`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 _Tn(`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 _Tn(`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 _Tn&&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=x0o(()=>{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=x0o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function NLp(e,t,r=""){let i=await i0S(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/a0S}function e8p(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 g1("Operator is_not_set is not supported")}else throw new g1(`Property ${i} not found in propertyValues`);let o=t[i];if(o==null&&!o0S.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,u){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(u).toLowerCase()):String(s).toLowerCase()===String(u).toLowerCase()}function f(s,u,l){if(l==="gt")return s>u;if(l==="gte")return s>=u;if(l==="lt")return s<u;if(l==="lte")return s<=u;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(n,o);case"is_not":return!c(n,o);case"is_set":return i in t;case"icontains":return String(o).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(n).toLowerCase());case"regex":return FLp(String(n))&&String(o).match(String(n))!==null;case"not_regex":return FLp(String(n))&&String(o).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&&o!=null?typeof o=="string"?f(o,String(n),a):f(o,s,a):f(String(o),String(n),a)}case"is_date_after":case"is_date_before":{let s=u0S(String(n));if(s==null&&(s=QLp(n)),s==null)throw new g1(`Invalid date: ${n}`);let u=QLp(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new g1(`Unknown operator: ${a}`)}}function t8p(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new g1("can't match cohort without a given cohort property value");let a=r[n];return r8p(a,t,r,i)}function r8p(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=r8p(c,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof g1)i&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new g1("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=t8p(c,t,r,i):f=e8p(c,t);let s=c.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof g1)i&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new g1("can't match cohort without a given cohort property value");return n==="AND"}}function FLp(e){try{return new RegExp(e),!0}catch{return!1}}function QLp(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 g1(`${e} is in an invalid date format`)}else throw new g1(`The date provided ${e} must be a string, number, or date object`)}function u0S(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 U7s=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},s0S=100,ULp=30*1e3,c0S=50*1e3,L7s=class extends N7s{constructor(t,r={}){if(super(t,r),this._memoryStorage=new U7s,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,s0S):ULp,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 Q7s({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 hTn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||c0S}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):ZLp(t,r)}getLibraryVersion(){return FmS}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:o,timestamp:c,disableGeoip:f,uuid:s}=t,u=_=>{super.captureStateless(r,i,_,{timestamp:c,disableGeoip:f,uuid:s})},l=async(_,h,y)=>(await super.getFeatureFlagsStateless(_,h,void 0,void 0,y)).flags,p=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let _={};for(let[h,y]of Object.entries(a||{}))_[h]=String(y);return await this.getAllFlags(r,{groups:_,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(_=>{let h={};if(_)for(let[b,v]of Object.entries(_))h[`$feature/${b}`]=v;let y=Object.keys(_||{}).filter(b=>_?.[b]!==!1).sort();return y.length>0&&(h.$active_feature_flags=y),h}).catch(()=>({})).then(_=>{u({..._,...n,$groups:a})});this.addPendingPromise(p)}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:o,timestamp:c,disableGeoip:f,uuid:s}=t,u=_=>super.captureStatelessImmediate(r,i,_,{timestamp:c,disableGeoip:f,uuid:s}),l=async(_,h,y)=>(await super.getFeatureFlagsStateless(_,h,void 0,void 0,y)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let _={};for(let[h,y]of Object.entries(a||{}))_[h]=String(y);return await this.getAllFlags(r,{groups:_,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(_=>{let h={};if(_)for(let[b,v]of Object.entries(_))h[`$feature/${b}`]=v;let y=Object.keys(_||{}).filter(b=>_?.[b]!==!1).sort();return y.length>0&&(h.$active_feature_flags=y),h}).catch(()=>({})).then(_=>{u({..._,...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=ULp){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:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:s}=i||{},u=this.addLocalPersonAndGroupProperties(r,n,f,s);f=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),p=l!==void 0,_,h;if(!p&&!o){let b=await super.getFeatureFlagDetailStateless(t,r,n,f,s,a);if(b===void 0)return;h=b.response,l=x7s(h),_=b?.requestId}let y=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(y))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(y):this.distinctIdHasSentFlagCalls[r]=[y],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:h?.metadata?.id,$feature_flag_version:h?.metadata?.version,$feature_flag_reason:h?.reason?.description??h?.reason?.code,locally_evaluated:p,[`$feature/${t}`]:l,$feature_flag_request_id:_},groups:n,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:o}=n||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:s,groupProperties:u}=n||{},l=this.addLocalPersonAndGroupProperties(r,a,s,u);s=l.allPersonProperties,u=l.allGroupProperties;let p;return this.featureFlagsPoller!==void 0&&(i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),i&&(p=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(p!==void 0)&&!c&&(p=await super.getFeatureFlagPayloadStateless(t,r,a,s,u,o)),p}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:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,i,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,o,c),u={},l={},p=!0;if(s&&(u=s.response,l=s.payloads,p=s.fallbackToDecide),p&&!a){let _=await super.getFeatureFlagsAndPayloadsStateless(t,i,o,c,n);u={...u,..._.flags||{}},l={...l,..._.payloads||{}}}return{featureFlags:u,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||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...n?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,i){let n=new Error("PostHog syntheticException");hTn.captureException(this,t,{syntheticException:n},r,i)}},LLp=/\(error: (.*)\)/,i8p=50,n8p="?";function l0S(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return i=>{let n=i.match(r);if(n){let a,o,c,f,s;if(n[1]){c=n[1];let p=c.lastIndexOf(".");if(c[p-1]==="."&&p--,p>0){a=c.slice(0,p),o=c.slice(p+1);let _=a.indexOf(".Module");_>0&&(c=c.slice(_+1),a=a.slice(0,_))}f=void 0}o&&(f=a,s=o),o==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||n8p,c=f?`${f}.${s}`:s);let u=n[2]?.startsWith("file://")?n[2].slice(7):n[2],l=n[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&n[5]&&!l&&(u=n[5]),{filename:u?decodeURI(u):void 0,module:e?e(u):void 0,function:c,lineno:VLp(n[3]),colno:VLp(n[4]),in_app:f0S(u||"",l),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function f0S(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 VLp(e){return parseInt(e||"",10)||void 0}function d0S(e){return[90,l0S(e)]}function p0S(e){let r=[d0S(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],o=i.split(`
1155
- `);for(let c=n;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let s=LLp.test(f)?f.replace(LLp,"$1"):f;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=i8p)break}}return _0S(a)}}function _0S(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,i8p).map(r=>({...r,filename:r.filename||h0S(t).filename,function:r.function||n8p}))}function h0S(e){return e[e.length-1]||{}}hTn.stackParser=p0S(wmS());hTn.frameModifiers=[MmS];var bTn=class extends L7s{getLibraryId(){return"posthog-node"}};var H0o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new bTn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"2.13.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var fOa=class{async sendEvent(){}async identify(){}async flush(){}};var gTn=require("fs/promises"),s8p=require("os"),c8p=require("path");var a8p=ae(require("crypto")),J0o=new Uint8Array(256),K0o=J0o.length;function G7s(){return K0o>J0o.length-16&&(a8p.default.randomFillSync(J0o),K0o=0),J0o.slice(K0o,K0o+=16)}var RQ=[];for(let e=0;e<256;++e)RQ.push((e+256).toString(16).slice(1));function o8p(e,t=0){return RQ[e[t+0]]+RQ[e[t+1]]+RQ[e[t+2]]+RQ[e[t+3]]+"-"+RQ[e[t+4]]+RQ[e[t+5]]+"-"+RQ[e[t+6]]+RQ[e[t+7]]+"-"+RQ[e[t+8]]+RQ[e[t+9]]+"-"+RQ[e[t+10]]+RQ[e[t+11]]+RQ[e[t+12]]+RQ[e[t+13]]+RQ[e[t+14]]+RQ[e[t+15]]}var u8p=ae(require("crypto")),H7s={randomUUID:u8p.default.randomUUID};function y0S(e,t,r){if(H7s.randomUUID&&!t&&!e)return H7s.randomUUID();e=e||{};let i=e.random||(e.rng||G7s)();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 o8p(i)}var ehe=y0S;var b0S="id",v0S=".fern",dOa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new bTn(r),this.userId=t==null?void 0:p8s(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:"2.13.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ft(Lr.of((0,s8p.homedir)()),Ze.of(v0S),Ze.of(b0S));await Ri(t)||(await(0,gTn.mkdir)((0,c8p.dirname)(t),{recursive:!0}),await(0,gTn.writeFile)(t,ehe())),this.persistedDistinctId=(await(0,gTn.readFile)(t)).toString()}return this.persistedDistinctId}};var K7s;async function OTn(){return K7s==null&&(K7s=await g0S()),K7s}async function g0S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new fOa;let r=await fbo();return r!=null?new dOa({token:r,posthogApiKey:e}):await Pqn()!=null?new H0o({posthogApiKey:e}):new dOa({token:void 0,posthogApiKey:e})}catch{return new fOa}}function pOa(e,t){return function(){return e.apply(t,arguments)}}var{toString:O0S}=Object.prototype,{getPrototypeOf:$7s}=Object,{iterator:Y0o,toStringTag:f8p}=Symbol,X0o=(e=>t=>{let r=O0S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),zNt=e=>(e=e.toLowerCase(),t=>X0o(t)===e),Z0o=e=>t=>typeof t===e,{isArray:mTn}=Array,ATn=Z0o("undefined");function _Oa(e){return e!==null&&!ATn(e)&&e.constructor!==null&&!ATn(e.constructor)&&I6(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var d8p=zNt("ArrayBuffer");function A0S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&d8p(e.buffer),t}var m0S=Z0o("string"),I6=Z0o("function"),p8p=Z0o("number"),hOa=e=>e!==null&&typeof e=="object",P0S=e=>e===!0||e===!1,$0o=e=>{if(X0o(e)!=="object")return!1;let t=$7s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(f8p in e)&&!(Y0o in e)},j0S=e=>{if(!hOa(e)||_Oa(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},w0S=zNt("Date"),E0S=zNt("File"),S0S=zNt("Blob"),M0S=zNt("FileList"),D0S=e=>hOa(e)&&I6(e.pipe),B0S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||I6(e.append)&&((t=X0o(e))==="formdata"||t==="object"&&I6(e.toString)&&e.toString()==="[object FormData]"))},I0S=zNt("URLSearchParams"),[C0S,q0S,T0S,R0S]=["ReadableStream","Request","Response","Headers"].map(zNt),z0S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yOa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),mTn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(_Oa(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function _8p(e,t){if(_Oa(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 e6i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,h8p=e=>!ATn(e)&&e!==e6i;function J7s(){let{caseless:e,skipUndefined:t}=h8p(this)&&this||{},r={},i=(n,a)=>{let o=e&&_8p(r,a)||a;$0o(r[o])&&$0o(n)?r[o]=J7s(r[o],n):$0o(n)?r[o]=J7s({},n):mTn(n)?r[o]=n.slice():(!t||!ATn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&yOa(arguments[n],i);return r}var N0S=(e,t,r,{allOwnKeys:i}={})=>(yOa(t,(n,a)=>{r&&I6(n)?e[a]=pOa(n,r):e[a]=n},{allOwnKeys:i}),e),F0S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Q0S=(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)},U0S=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&$7s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},L0S=(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},V0S=e=>{if(!e)return null;if(mTn(e))return e;let t=e.length;if(!p8p(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},W0S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&$7s(Uint8Array)),x0S=(e,t)=>{let i=(e&&e[Y0o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},G0S=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},H0S=zNt("HTMLFormElement"),K0S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),l8p=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),J0S=zNt("RegExp"),y8p=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};yOa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},$0S=e=>{y8p(e,(t,r)=>{if(I6(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(I6(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+"'")})}})},Y0S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return mTn(e)?i(e):i(String(e).split(t)),r},X0S=()=>{},Z0S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function k0S(e){return!!(e&&I6(e.append)&&e[f8p]==="FormData"&&e[Y0o])}var ePS=e=>{let t=new Array(10),r=(i,n)=>{if(hOa(i)){if(t.indexOf(i)>=0)return;if(_Oa(i))return i;if(!("toJSON"in i)){t[n]=i;let a=mTn(i)?[]:{};return yOa(i,(o,c)=>{let f=r(o,n+1);!ATn(f)&&(a[c]=f)}),t[n]=void 0,a}}return i};return r(e,0)},tPS=zNt("AsyncFunction"),rPS=e=>e&&(hOa(e)||I6(e))&&I6(e.then)&&I6(e.catch),b8p=((e,t)=>e?setImmediate:t?((r,i)=>(e6i.addEventListener("message",({source:n,data:a})=>{n===e6i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),e6i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",I6(e6i.postMessage)),iPS=typeof queueMicrotask<"u"?queueMicrotask.bind(e6i):typeof process<"u"&&process.nextTick||b8p,nPS=e=>e!=null&&I6(e[Y0o]),kt={isArray:mTn,isArrayBuffer:d8p,isBuffer:_Oa,isFormData:B0S,isArrayBufferView:A0S,isString:m0S,isNumber:p8p,isBoolean:P0S,isObject:hOa,isPlainObject:$0o,isEmptyObject:j0S,isReadableStream:C0S,isRequest:q0S,isResponse:T0S,isHeaders:R0S,isUndefined:ATn,isDate:w0S,isFile:E0S,isBlob:S0S,isRegExp:J0S,isFunction:I6,isStream:D0S,isURLSearchParams:I0S,isTypedArray:W0S,isFileList:M0S,forEach:yOa,merge:J7s,extend:N0S,trim:z0S,stripBOM:F0S,inherits:Q0S,toFlatObject:U0S,kindOf:X0o,kindOfTest:zNt,endsWith:L0S,toArray:V0S,forEachEntry:x0S,matchAll:G0S,isHTMLForm:H0S,hasOwnProperty:l8p,hasOwnProp:l8p,reduceDescriptors:y8p,freezeMethods:$0S,toObjectSet:Y0S,toCamelCase:K0S,noop:X0S,toFiniteNumber:Z0S,findKey:_8p,global:e6i,isContextDefined:h8p,isSpecCompliantForm:k0S,toJSONObject:ePS,isAsyncFn:tPS,isThenable:rPS,setImmediate:b8p,asap:iPS,isIterable:nPS};function PTn(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)}kt.inherits(PTn,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:kt.toJSONObject(this.config),code:this.code,status:this.status}}});var v8p=PTn.prototype,g8p={};["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=>{g8p[e]={value:e}});Object.defineProperties(PTn,g8p);Object.defineProperty(v8p,"isAxiosError",{value:!0});PTn.from=(e,t,r,i,n,a)=>{let o=Object.create(v8p);kt.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return PTn.call(o,c,f,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var ya=PTn;var O8p=ae(F7i(),1),k0o=O8p.default;function Y7s(e){return kt.isPlainObject(e)||kt.isArray(e)}function m8p(e){return kt.endsWith(e,"[]")?e.slice(0,-2):e}function A8p(e,t,r){return e?e.concat(t).map(function(n,a){return n=m8p(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function aPS(e){return kt.isArray(e)&&!e.some(Y7s)}var oPS=kt.toFlatObject(kt,{},null,function(t){return/^is[A-Z]/.test(t)});function uPS(e,t,r){if(!kt.isObject(e))throw new TypeError("target must be an object");t=t||new(k0o||FormData),r=kt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!kt.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&kt.isSpecCompliantForm(t);if(!kt.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(kt.isDate(h))return h.toISOString();if(kt.isBoolean(h))return h.toString();if(!f&&kt.isBlob(h))throw new ya("Blob is not supported. Use a Buffer instead.");return kt.isArrayBuffer(h)||kt.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(kt.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(kt.isArray(h)&&aPS(h)||(kt.isFileList(h)||kt.endsWith(y,"[]"))&&(v=kt.toArray(h)))return y=m8p(y),v.forEach(function(A,g){!(kt.isUndefined(A)||A===null)&&t.append(o===!0?A8p([y],g,a):o===null?y:y+"[]",s(A))}),!1}return Y7s(h)?!0:(t.append(A8p(b,y,a),s(h)),!1)}let l=[],p=Object.assign(oPS,{defaultVisitor:u,convertValue:s,isVisitable:Y7s});function _(h,y){if(!kt.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),kt.forEach(h,function(v,O){(!(kt.isUndefined(v)||v===null)&&n.call(t,v,kt.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!kt.isObject(e))throw new TypeError("data must be an object");return _(e),t}var zBi=uPS;function P8p(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function j8p(e,t){this._pairs=[],e&&zBi(e,this,t)}var w8p=j8p.prototype;w8p.append=function(t,r){this._pairs.push([t,r])};w8p.toString=function(t){let r=t?function(i){return t.call(this,i,P8p)}:P8p;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var E8p=j8p;function sPS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t6i(e,t,r){if(!t)return e;let i=r&&r.encode||sPS;kt.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=kt.isURLSearchParams(t)?t.toString():new E8p(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var X7s=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){kt.forEach(this.handlers,function(i){i!==null&&t(i)})}},Z7s=X7s;var jTn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var B8p=ae(require("crypto"),1);var S8p=ae(require("url"),1),M8p=S8p.default.URLSearchParams;var k7s="abcdefghijklmnopqrstuvwxyz",D8p="0123456789",I8p={DIGIT:D8p,ALPHA:k7s,ALPHA_DIGIT:k7s+k7s.toUpperCase()+D8p},cPS=(e=16,t=I8p.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);B8p.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},C8p={isNode:!0,classes:{URLSearchParams:M8p,FormData:k0o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:I8p,generateString:cPS,protocols:["http","https","file","data"]};var rHs={};Kt(rHs,{hasBrowserEnv:()=>tHs,hasStandardBrowserEnv:()=>lPS,hasStandardBrowserWebWorkerEnv:()=>fPS,navigator:()=>eHs,origin:()=>dPS});var tHs=typeof window<"u"&&typeof document<"u",eHs=typeof navigator=="object"&&navigator||void 0,lPS=tHs&&(!eHs||["ReactNative","NativeScript","NS"].indexOf(eHs.product)<0),fPS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",dPS=tHs&&window.location.href||"http://localhost";var OA={...rHs,...C8p};function iHs(e,t){return zBi(e,new OA.classes.URLSearchParams,{visitor:function(r,i,n,a){return OA.isNode&&kt.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function pPS(e){return kt.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function _PS(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 hPS(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&kt.isArray(n)?n.length:o,f?(kt.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!kt.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&kt.isArray(n[o])&&(n[o]=_PS(n[o])),!c)}if(kt.isFormData(e)&&kt.isFunction(e.entries)){let r={};return kt.forEachEntry(e,(i,n)=>{t(pPS(i),n,r,0)}),r}return null}var ePo=hPS;function yPS(e,t,r){if(kt.isString(e))try{return(t||JSON.parse)(e),kt.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var nHs={transitional:jTn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=kt.isObject(t);if(a&&kt.isHTMLForm(t)&&(t=new FormData(t)),kt.isFormData(t))return n?JSON.stringify(ePo(t)):t;if(kt.isArrayBuffer(t)||kt.isBuffer(t)||kt.isStream(t)||kt.isFile(t)||kt.isBlob(t)||kt.isReadableStream(t))return t;if(kt.isArrayBufferView(t))return t.buffer;if(kt.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 iHs(t,this.formSerializer).toString();if((c=kt.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return zBi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),yPS(t)):t}],transformResponse:[function(t){let r=this.transitional||nHs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(kt.isResponse(t)||kt.isReadableStream(t))return t;if(t&&kt.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?ya.from(c,ya.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:OA.classes.FormData,Blob:OA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};kt.forEach(["delete","get","head","post","put","patch"],e=>{nHs.headers[e]={}});var wTn=nHs;var bPS=kt.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"]),q8p=e=>{let t={},r,i,n;return e&&e.split(`
1155
+ `);for(let c=n;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let s=LLp.test(f)?f.replace(LLp,"$1"):f;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=i8p)break}}return _0S(a)}}function _0S(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,i8p).map(r=>({...r,filename:r.filename||h0S(t).filename,function:r.function||n8p}))}function h0S(e){return e[e.length-1]||{}}hTn.stackParser=p0S(wmS());hTn.frameModifiers=[MmS];var bTn=class extends L7s{getLibraryId(){return"posthog-node"}};var H0o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new bTn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"2.14.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var fOa=class{async sendEvent(){}async identify(){}async flush(){}};var gTn=require("fs/promises"),s8p=require("os"),c8p=require("path");var a8p=ae(require("crypto")),J0o=new Uint8Array(256),K0o=J0o.length;function G7s(){return K0o>J0o.length-16&&(a8p.default.randomFillSync(J0o),K0o=0),J0o.slice(K0o,K0o+=16)}var RQ=[];for(let e=0;e<256;++e)RQ.push((e+256).toString(16).slice(1));function o8p(e,t=0){return RQ[e[t+0]]+RQ[e[t+1]]+RQ[e[t+2]]+RQ[e[t+3]]+"-"+RQ[e[t+4]]+RQ[e[t+5]]+"-"+RQ[e[t+6]]+RQ[e[t+7]]+"-"+RQ[e[t+8]]+RQ[e[t+9]]+"-"+RQ[e[t+10]]+RQ[e[t+11]]+RQ[e[t+12]]+RQ[e[t+13]]+RQ[e[t+14]]+RQ[e[t+15]]}var u8p=ae(require("crypto")),H7s={randomUUID:u8p.default.randomUUID};function y0S(e,t,r){if(H7s.randomUUID&&!t&&!e)return H7s.randomUUID();e=e||{};let i=e.random||(e.rng||G7s)();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 o8p(i)}var ehe=y0S;var b0S="id",v0S=".fern",dOa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new bTn(r),this.userId=t==null?void 0:p8s(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:"2.14.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ft(Lr.of((0,s8p.homedir)()),Ze.of(v0S),Ze.of(b0S));await Ri(t)||(await(0,gTn.mkdir)((0,c8p.dirname)(t),{recursive:!0}),await(0,gTn.writeFile)(t,ehe())),this.persistedDistinctId=(await(0,gTn.readFile)(t)).toString()}return this.persistedDistinctId}};var K7s;async function OTn(){return K7s==null&&(K7s=await g0S()),K7s}async function g0S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new fOa;let r=await fbo();return r!=null?new dOa({token:r,posthogApiKey:e}):await Pqn()!=null?new H0o({posthogApiKey:e}):new dOa({token:void 0,posthogApiKey:e})}catch{return new fOa}}function pOa(e,t){return function(){return e.apply(t,arguments)}}var{toString:O0S}=Object.prototype,{getPrototypeOf:$7s}=Object,{iterator:Y0o,toStringTag:f8p}=Symbol,X0o=(e=>t=>{let r=O0S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),zNt=e=>(e=e.toLowerCase(),t=>X0o(t)===e),Z0o=e=>t=>typeof t===e,{isArray:mTn}=Array,ATn=Z0o("undefined");function _Oa(e){return e!==null&&!ATn(e)&&e.constructor!==null&&!ATn(e.constructor)&&I6(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var d8p=zNt("ArrayBuffer");function A0S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&d8p(e.buffer),t}var m0S=Z0o("string"),I6=Z0o("function"),p8p=Z0o("number"),hOa=e=>e!==null&&typeof e=="object",P0S=e=>e===!0||e===!1,$0o=e=>{if(X0o(e)!=="object")return!1;let t=$7s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(f8p in e)&&!(Y0o in e)},j0S=e=>{if(!hOa(e)||_Oa(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},w0S=zNt("Date"),E0S=zNt("File"),S0S=zNt("Blob"),M0S=zNt("FileList"),D0S=e=>hOa(e)&&I6(e.pipe),B0S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||I6(e.append)&&((t=X0o(e))==="formdata"||t==="object"&&I6(e.toString)&&e.toString()==="[object FormData]"))},I0S=zNt("URLSearchParams"),[C0S,q0S,T0S,R0S]=["ReadableStream","Request","Response","Headers"].map(zNt),z0S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yOa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),mTn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(_Oa(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function _8p(e,t){if(_Oa(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 e6i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,h8p=e=>!ATn(e)&&e!==e6i;function J7s(){let{caseless:e,skipUndefined:t}=h8p(this)&&this||{},r={},i=(n,a)=>{let o=e&&_8p(r,a)||a;$0o(r[o])&&$0o(n)?r[o]=J7s(r[o],n):$0o(n)?r[o]=J7s({},n):mTn(n)?r[o]=n.slice():(!t||!ATn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&yOa(arguments[n],i);return r}var N0S=(e,t,r,{allOwnKeys:i}={})=>(yOa(t,(n,a)=>{r&&I6(n)?e[a]=pOa(n,r):e[a]=n},{allOwnKeys:i}),e),F0S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Q0S=(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)},U0S=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&$7s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},L0S=(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},V0S=e=>{if(!e)return null;if(mTn(e))return e;let t=e.length;if(!p8p(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},W0S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&$7s(Uint8Array)),x0S=(e,t)=>{let i=(e&&e[Y0o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},G0S=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},H0S=zNt("HTMLFormElement"),K0S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),l8p=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),J0S=zNt("RegExp"),y8p=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};yOa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},$0S=e=>{y8p(e,(t,r)=>{if(I6(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(I6(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+"'")})}})},Y0S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return mTn(e)?i(e):i(String(e).split(t)),r},X0S=()=>{},Z0S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function k0S(e){return!!(e&&I6(e.append)&&e[f8p]==="FormData"&&e[Y0o])}var ePS=e=>{let t=new Array(10),r=(i,n)=>{if(hOa(i)){if(t.indexOf(i)>=0)return;if(_Oa(i))return i;if(!("toJSON"in i)){t[n]=i;let a=mTn(i)?[]:{};return yOa(i,(o,c)=>{let f=r(o,n+1);!ATn(f)&&(a[c]=f)}),t[n]=void 0,a}}return i};return r(e,0)},tPS=zNt("AsyncFunction"),rPS=e=>e&&(hOa(e)||I6(e))&&I6(e.then)&&I6(e.catch),b8p=((e,t)=>e?setImmediate:t?((r,i)=>(e6i.addEventListener("message",({source:n,data:a})=>{n===e6i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),e6i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",I6(e6i.postMessage)),iPS=typeof queueMicrotask<"u"?queueMicrotask.bind(e6i):typeof process<"u"&&process.nextTick||b8p,nPS=e=>e!=null&&I6(e[Y0o]),kt={isArray:mTn,isArrayBuffer:d8p,isBuffer:_Oa,isFormData:B0S,isArrayBufferView:A0S,isString:m0S,isNumber:p8p,isBoolean:P0S,isObject:hOa,isPlainObject:$0o,isEmptyObject:j0S,isReadableStream:C0S,isRequest:q0S,isResponse:T0S,isHeaders:R0S,isUndefined:ATn,isDate:w0S,isFile:E0S,isBlob:S0S,isRegExp:J0S,isFunction:I6,isStream:D0S,isURLSearchParams:I0S,isTypedArray:W0S,isFileList:M0S,forEach:yOa,merge:J7s,extend:N0S,trim:z0S,stripBOM:F0S,inherits:Q0S,toFlatObject:U0S,kindOf:X0o,kindOfTest:zNt,endsWith:L0S,toArray:V0S,forEachEntry:x0S,matchAll:G0S,isHTMLForm:H0S,hasOwnProperty:l8p,hasOwnProp:l8p,reduceDescriptors:y8p,freezeMethods:$0S,toObjectSet:Y0S,toCamelCase:K0S,noop:X0S,toFiniteNumber:Z0S,findKey:_8p,global:e6i,isContextDefined:h8p,isSpecCompliantForm:k0S,toJSONObject:ePS,isAsyncFn:tPS,isThenable:rPS,setImmediate:b8p,asap:iPS,isIterable:nPS};function PTn(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)}kt.inherits(PTn,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:kt.toJSONObject(this.config),code:this.code,status:this.status}}});var v8p=PTn.prototype,g8p={};["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=>{g8p[e]={value:e}});Object.defineProperties(PTn,g8p);Object.defineProperty(v8p,"isAxiosError",{value:!0});PTn.from=(e,t,r,i,n,a)=>{let o=Object.create(v8p);kt.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return PTn.call(o,c,f,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var ya=PTn;var O8p=ae(F7i(),1),k0o=O8p.default;function Y7s(e){return kt.isPlainObject(e)||kt.isArray(e)}function m8p(e){return kt.endsWith(e,"[]")?e.slice(0,-2):e}function A8p(e,t,r){return e?e.concat(t).map(function(n,a){return n=m8p(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function aPS(e){return kt.isArray(e)&&!e.some(Y7s)}var oPS=kt.toFlatObject(kt,{},null,function(t){return/^is[A-Z]/.test(t)});function uPS(e,t,r){if(!kt.isObject(e))throw new TypeError("target must be an object");t=t||new(k0o||FormData),r=kt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!kt.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&kt.isSpecCompliantForm(t);if(!kt.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(kt.isDate(h))return h.toISOString();if(kt.isBoolean(h))return h.toString();if(!f&&kt.isBlob(h))throw new ya("Blob is not supported. Use a Buffer instead.");return kt.isArrayBuffer(h)||kt.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(kt.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(kt.isArray(h)&&aPS(h)||(kt.isFileList(h)||kt.endsWith(y,"[]"))&&(v=kt.toArray(h)))return y=m8p(y),v.forEach(function(A,g){!(kt.isUndefined(A)||A===null)&&t.append(o===!0?A8p([y],g,a):o===null?y:y+"[]",s(A))}),!1}return Y7s(h)?!0:(t.append(A8p(b,y,a),s(h)),!1)}let l=[],p=Object.assign(oPS,{defaultVisitor:u,convertValue:s,isVisitable:Y7s});function _(h,y){if(!kt.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),kt.forEach(h,function(v,O){(!(kt.isUndefined(v)||v===null)&&n.call(t,v,kt.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!kt.isObject(e))throw new TypeError("data must be an object");return _(e),t}var zBi=uPS;function P8p(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function j8p(e,t){this._pairs=[],e&&zBi(e,this,t)}var w8p=j8p.prototype;w8p.append=function(t,r){this._pairs.push([t,r])};w8p.toString=function(t){let r=t?function(i){return t.call(this,i,P8p)}:P8p;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var E8p=j8p;function sPS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t6i(e,t,r){if(!t)return e;let i=r&&r.encode||sPS;kt.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=kt.isURLSearchParams(t)?t.toString():new E8p(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var X7s=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){kt.forEach(this.handlers,function(i){i!==null&&t(i)})}},Z7s=X7s;var jTn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var B8p=ae(require("crypto"),1);var S8p=ae(require("url"),1),M8p=S8p.default.URLSearchParams;var k7s="abcdefghijklmnopqrstuvwxyz",D8p="0123456789",I8p={DIGIT:D8p,ALPHA:k7s,ALPHA_DIGIT:k7s+k7s.toUpperCase()+D8p},cPS=(e=16,t=I8p.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);B8p.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},C8p={isNode:!0,classes:{URLSearchParams:M8p,FormData:k0o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:I8p,generateString:cPS,protocols:["http","https","file","data"]};var rHs={};Kt(rHs,{hasBrowserEnv:()=>tHs,hasStandardBrowserEnv:()=>lPS,hasStandardBrowserWebWorkerEnv:()=>fPS,navigator:()=>eHs,origin:()=>dPS});var tHs=typeof window<"u"&&typeof document<"u",eHs=typeof navigator=="object"&&navigator||void 0,lPS=tHs&&(!eHs||["ReactNative","NativeScript","NS"].indexOf(eHs.product)<0),fPS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",dPS=tHs&&window.location.href||"http://localhost";var OA={...rHs,...C8p};function iHs(e,t){return zBi(e,new OA.classes.URLSearchParams,{visitor:function(r,i,n,a){return OA.isNode&&kt.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function pPS(e){return kt.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function _PS(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 hPS(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&kt.isArray(n)?n.length:o,f?(kt.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!kt.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&kt.isArray(n[o])&&(n[o]=_PS(n[o])),!c)}if(kt.isFormData(e)&&kt.isFunction(e.entries)){let r={};return kt.forEachEntry(e,(i,n)=>{t(pPS(i),n,r,0)}),r}return null}var ePo=hPS;function yPS(e,t,r){if(kt.isString(e))try{return(t||JSON.parse)(e),kt.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var nHs={transitional:jTn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=kt.isObject(t);if(a&&kt.isHTMLForm(t)&&(t=new FormData(t)),kt.isFormData(t))return n?JSON.stringify(ePo(t)):t;if(kt.isArrayBuffer(t)||kt.isBuffer(t)||kt.isStream(t)||kt.isFile(t)||kt.isBlob(t)||kt.isReadableStream(t))return t;if(kt.isArrayBufferView(t))return t.buffer;if(kt.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 iHs(t,this.formSerializer).toString();if((c=kt.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return zBi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),yPS(t)):t}],transformResponse:[function(t){let r=this.transitional||nHs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(kt.isResponse(t)||kt.isReadableStream(t))return t;if(t&&kt.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?ya.from(c,ya.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:OA.classes.FormData,Blob:OA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};kt.forEach(["delete","get","head","post","put","patch"],e=>{nHs.headers[e]={}});var wTn=nHs;var bPS=kt.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"]),q8p=e=>{let t={},r,i,n;return e&&e.split(`
1156
1156
  `).forEach(function(o){n=o.indexOf(":"),r=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!r||t[r]&&bPS[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var T8p=Symbol("internals");function bOa(e){return e&&String(e).trim().toLowerCase()}function tPo(e){return e===!1||e==null?e:kt.isArray(e)?e.map(tPo):String(e)}function vPS(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 gPS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function aHs(e,t,r,i,n){if(kt.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!kt.isString(t)){if(kt.isString(i))return t.indexOf(i)!==-1;if(kt.isRegExp(i))return i.test(t)}}function OPS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function APS(e,t){let r=kt.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,o){return this[i].call(this,t,n,a,o)},configurable:!0})})}var ETn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(c,f,s){let u=bOa(f);if(!u)throw new Error("header name must be a non-empty string");let l=kt.findKey(n,u);(!l||n[l]===void 0||s===!0||s===void 0&&n[l]!==!1)&&(n[l||f]=tPo(c))}let o=(c,f)=>kt.forEach(c,(s,u)=>a(s,u,f));if(kt.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(kt.isString(t)&&(t=t.trim())&&!gPS(t))o(q8p(t),r);else if(kt.isObject(t)&&kt.isIterable(t)){let c={},f,s;for(let u of t){if(!kt.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[s=u[0]]=(f=c[s])?kt.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(c,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=bOa(t),t){let i=kt.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return vPS(n);if(kt.isFunction(r))return r.call(this,n,i);if(kt.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=bOa(t),t){let i=kt.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||aHs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(o){if(o=bOa(o),o){let c=kt.findKey(i,o);c&&(!r||aHs(i,i[c],c,r))&&(delete i[c],n=!0)}}return kt.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||aHs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return kt.forEach(this,(n,a)=>{let o=kt.findKey(i,a);if(o){r[o]=tPo(n),delete r[a];return}let c=t?OPS(a):String(a).trim();c!==a&&delete r[a],r[c]=tPo(n),i[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return kt.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&kt.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(`
1157
1157
  `)}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[T8p]=this[T8p]={accessors:{}}).accessors,n=this.prototype;function a(o){let c=bOa(o);i[c]||(APS(n,o),i[c]=!0)}return kt.isArray(t)?t.forEach(a):a(t),this}};ETn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);kt.reduceDescriptors(ETn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});kt.freezeMethods(ETn);var US=ETn;function vOa(e,t){let r=this||wTn,i=t||r,n=US.from(i.headers),a=i.data;return kt.forEach(e,function(c){a=c.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function gOa(e){return!!(e&&e.__CANCEL__)}function R8p(e,t,r){ya.call(this,e??"canceled",ya.ERR_CANCELED,t,r),this.name="CanceledError"}kt.inherits(R8p,ya,{__CANCEL__:!0});var the=R8p;function a9t(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new ya("Request failed with status code "+r.status,[ya.ERR_BAD_REQUEST,ya.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function oHs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function uHs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function r6i(e,t,r){let i=!oHs(t);return e&&(i||r==!1)?uHs(e,t):t}var X8p=ae(m0o(),1),Z8p=ae(require("http"),1),k8p=ae(require("https"),1),eVp=ae(require("util"),1),tVp=ae(s7s(),1),xbi=ae(require("zlib"),1);var i6i="1.12.2";function OOa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var mPS=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function sHs(e,t,r){let i=r&&r.Blob||OA.classes.Blob,n=OOa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=mPS.exec(e);if(!a)throw new ya("Invalid URL",ya.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],s=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!i)throw new ya("Blob is not supported",ya.ERR_NOT_SUPPORT);return new i([s],{type:o})}return s}throw new ya("Unsupported protocol "+n,ya.ERR_NOT_SUPPORT)}var a6i=ae(require("stream"),1);var z8p=ae(require("stream"),1);var cHs=Symbol("internals"),lHs=class extends z8p.default.Transform{constructor(t){t=kt.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!kt.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[cHs]={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[cHs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[cHs],a=n.maxRate,o=this.readableHighWaterMark,c=n.timeWindow,f=1e3/c,s=a/f,u=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,l=(_,h)=>{let y=Buffer.byteLength(_);n.bytesSeen+=y,n.bytes+=y,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(_)?process.nextTick(h):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(h)}},p=(_,h)=>{let y=Buffer.byteLength(_),b=null,v=o,O,A=0;if(a){let g=Date.now();(!n.ts||(A=g-n.ts)>=c)&&(n.ts=g,O=s-n.bytes,n.bytes=O<0?-O:0,A=0),O=s-n.bytes}if(a){if(O<=0)return setTimeout(()=>{h(null,_)},c-A);O<v&&(v=O)}v&&y>v&&y-v>u&&(b=_.subarray(v),_=_.subarray(0,v)),l(_,b?()=>{process.nextTick(h,null,b)}:h)};p(t,function _(h,y){if(h)return i(h);y?p(y,_):i(null)})}},fHs=lHs;var rVp=require("events");var F8p=ae(require("util"),1),Q8p=require("stream");var{asyncIterator:N8p}=Symbol,PPS=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[N8p]?yield*e[N8p]():yield e},rPo=PPS;var jPS=OA.ALPHABET.ALPHA_DIGIT+"-_",AOa=typeof TextEncoder=="function"?new TextEncoder:new F8p.default.TextEncoder,n6i=`\r
1158
1158
  `,wPS=AOa.encode(n6i),EPS=2,dHs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=kt.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${n6i}`;n?r=AOa.encode(String(r).replace(/\r?\n|\r\n?/g,n6i)):a+=`Content-Type: ${r.type||"application/octet-stream"}${n6i}`,this.headers=AOa.encode(a+n6i),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+EPS,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;kt.isTypedArray(t)?yield t:yield*rPo(t),yield wPS}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},SPS=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+OA.generateString(n,jPS)}=r||{};if(!kt.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=AOa.encode("--"+a+n6i),c=AOa.encode("--"+a+"--"+n6i),f=c.byteLength,s=Array.from(e.entries()).map(([l,p])=>{let _=new dHs(l,p);return f+=_.size,_});f+=o.byteLength*s.length,f=kt.toFiniteNumber(f);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(u["Content-Length"]=f),t&&t(u),Q8p.Readable.from((async function*(){for(let l of s)yield o,yield*l.encode();yield c})())},U8p=SPS;var L8p=ae(require("stream"),1),pHs=class extends L8p.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)}},V8p=pHs;var MPS=(e,t)=>kt.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,W8p=MPS;function DPS(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let s=Date.now(),u=i[a];o||(o=s),r[n]=f,i[n]=s;let l=a,p=0;for(;l!==n;)p+=r[l++],l=l%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-o<t)return;let _=u&&s-u;return _?Math.round(p*1e3/_):void 0}}var x8p=DPS;function BPS(e,t){let r=0,i=1e3/t,n,a,o=(s,u=Date.now())=>{r=u,n=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let u=Date.now(),l=u-r;l>=i?o(s,u):(n=s,a||(a=setTimeout(()=>{a=null,o(n)},i-l)))},()=>n&&o(n)]}var G8p=BPS;var Wbi=(e,t,r=3)=>{let i=0,n=x8p(50,250);return G8p(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-i,s=n(f),u=o<=c;i=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:s||void 0,estimated:s&&c&&u?(c-o)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},STn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},MTn=e=>(...t)=>kt.asap(()=>e(...t));function _Hs(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,o=i.length;for(let p=0;p<o;p++)if(i.charCodeAt(p)===37&&p+2<o){let _=i.charCodeAt(p+1),h=i.charCodeAt(p+2);(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(a-=2,p+=2)}let c=0,f=o-1,s=p=>p>=2&&i.charCodeAt(p-2)===37&&i.charCodeAt(p-1)===51&&(i.charCodeAt(p)===68||i.charCodeAt(p)===100);f>=0&&(i.charCodeAt(f)===61?(c++,f--):s(f)&&(c++,f-=3)),c===1&&f>=0&&(i.charCodeAt(f)===61||s(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(i,"utf8")}var H8p={flush:xbi.default.constants.Z_SYNC_FLUSH,finishFlush:xbi.default.constants.Z_SYNC_FLUSH},IPS={flush:xbi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:xbi.default.constants.BROTLI_OPERATION_FLUSH},K8p=kt.isFunction(xbi.default.createBrotliDecompress),{http:CPS,https:qPS}=tVp.default,TPS=/https:?/,J8p=OA.protocols.map(e=>e+":"),$8p=(e,[t,r])=>(e.on("end",r).on("error",r),t);function RPS(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function iVp(e,t,r){let i=t;if(!i&&i!==!1){let n=X8p.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){iVp(a,t,a.href)}}var zPS=typeof process<"u"&&kt.kindOf(process)==="process",NPS=e=>new Promise((t,r)=>{let i,n,a=(f,s)=>{n||(n=!0,i&&i(f,s))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>i=f).catch(c)}),FPS=({address:e,family:t})=>{if(!kt.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},Y8p=(e,t)=>FPS(kt.isObject(e)?e:{address:e,family:t}),nVp=zPS&&function(t){return NPS(async function(i,n,a){let{data:o,lookup:c,family:f}=t,{responseType:s,responseEncoding:u}=t,l=t.method.toUpperCase(),p,_=!1,h;if(c){let H=W8p(c,ue=>kt.isArray(ue)?ue:[ue]);c=(ue,se,x)=>{H(ue,se,(G,Pe,ne)=>{if(G)return x(G);let Ee=kt.isArray(Pe)?Pe.map(Qe=>Y8p(Qe)):[Y8p(Pe,ne)];se.all?x(G,Ee):x(G,Ee[0].address,Ee[0].family)})}}let y=new rVp.EventEmitter,b=()=>{t.cancelToken&&t.cancelToken.unsubscribe(v),t.signal&&t.signal.removeEventListener("abort",v),y.removeAllListeners()};a((H,ue)=>{p=!0,ue&&(_=!0,b())});function v(H){y.emit("abort",!H||H.type?new the(null,t,h):H)}y.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(v),t.signal&&(t.signal.aborted?v():t.signal.addEventListener("abort",v)));let O=r6i(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(O,OA.hasBrowserEnv?OA.origin:void 0),g=A.protocol||J8p[0];if(g==="data:"){if(t.maxContentLength>-1){let ue=String(t.url||O||"");if(_Hs(ue)>t.maxContentLength)return n(new ya("maxContentLength size of "+t.maxContentLength+" exceeded",ya.ERR_BAD_RESPONSE,t))}let H;if(l!=="GET")return a9t(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{H=sHs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(ue){throw ya.from(ue,ya.ERR_BAD_REQUEST,t)}return s==="text"?(H=H.toString(u),(!u||u==="utf8")&&(H=kt.stripBOM(H))):s==="stream"&&(H=a6i.default.Readable.from(H)),a9t(i,n,{data:H,status:200,statusText:"OK",headers:new US,config:t})}if(J8p.indexOf(g)===-1)return n(new ya("Unsupported protocol "+g,ya.ERR_BAD_REQUEST,t));let m=US.from(t.headers).normalize();m.set("User-Agent","axios/"+i6i,!1);let{onUploadProgress:j,onDownloadProgress:M}=t,E=t.maxRate,D,B;if(kt.isSpecCompliantForm(o)){let H=m.getContentType(/boundary=([-_\w\d]{10,70})/i);o=U8p(o,ue=>{m.set(ue)},{tag:`axios-${i6i}-boundary`,boundary:H&&H[1]||void 0})}else if(kt.isFormData(o)&&kt.isFunction(o.getHeaders)){if(m.set(o.getHeaders()),!m.hasContentLength())try{let H=await eVp.default.promisify(o.getLength).call(o);Number.isFinite(H)&&H>=0&&m.setContentLength(H)}catch{}}else if(kt.isBlob(o)||kt.isFile(o))o.size&&m.setContentType(o.type||"application/octet-stream"),m.setContentLength(o.size||0),o=a6i.default.Readable.from(rPo(o));else if(o&&!kt.isStream(o)){if(!Buffer.isBuffer(o))if(kt.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(kt.isString(o))o=Buffer.from(o,"utf-8");else return n(new ya("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ya.ERR_BAD_REQUEST,t));if(m.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return n(new ya("Request body larger than maxBodyLength limit",ya.ERR_BAD_REQUEST,t))}let F=kt.toFiniteNumber(m.getContentLength());kt.isArray(E)?(D=E[0],B=E[1]):D=B=E,o&&(j||D)&&(kt.isStream(o)||(o=a6i.default.Readable.from(o,{objectMode:!1})),o=a6i.default.pipeline([o,new fHs({maxRate:kt.toFiniteNumber(D)})],kt.noop),j&&o.on("progress",$8p(o,STn(F,Wbi(MTn(j),!1,3)))));let N;if(t.auth){let H=t.auth.username||"",ue=t.auth.password||"";N=H+":"+ue}if(!N&&A.username){let H=A.username,ue=A.password;N=H+":"+ue}N&&m.delete("authorization");let T;try{T=t6i(A.pathname+A.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(H){let ue=new Error(H.message);return ue.config=t,ue.url=t.url,ue.exists=!0,n(ue)}m.set("Accept-Encoding","gzip, compress, deflate"+(K8p?", br":""),!1);let R={path:T,method:l,headers:m.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:N,protocol:g,family:f,beforeRedirect:RPS,beforeRedirects:{}};!kt.isUndefined(c)&&(R.lookup=c),t.socketPath?R.socketPath=t.socketPath:(R.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,R.port=A.port,iVp(R,t.proxy,g+"//"+A.hostname+(A.port?":"+A.port:"")+R.path));let Q,U=TPS.test(R.protocol);if(R.agent=U?t.httpsAgent:t.httpAgent,t.transport?Q=t.transport:t.maxRedirects===0?Q=U?k8p.default:Z8p.default:(t.maxRedirects&&(R.maxRedirects=t.maxRedirects),t.beforeRedirect&&(R.beforeRedirects.config=t.beforeRedirect),Q=U?qPS:CPS),t.maxBodyLength>-1?R.maxBodyLength=t.maxBodyLength:R.maxBodyLength=1/0,t.insecureHTTPParser&&(R.insecureHTTPParser=t.insecureHTTPParser),h=Q.request(R,function(ue){if(h.destroyed)return;let se=[ue],x=+ue.headers["content-length"];if(M||B){let Qe=new fHs({maxRate:kt.toFiniteNumber(B)});M&&Qe.on("progress",$8p(Qe,STn(x,Wbi(MTn(M),!0,3)))),se.push(Qe)}let G=ue,Pe=ue.req||h;if(t.decompress!==!1&&ue.headers["content-encoding"])switch((l==="HEAD"||ue.statusCode===204)&&delete ue.headers["content-encoding"],(ue.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":se.push(xbi.default.createUnzip(H8p)),delete ue.headers["content-encoding"];break;case"deflate":se.push(new V8p),se.push(xbi.default.createUnzip(H8p)),delete ue.headers["content-encoding"];break;case"br":K8p&&(se.push(xbi.default.createBrotliDecompress(IPS)),delete ue.headers["content-encoding"])}G=se.length>1?a6i.default.pipeline(se,kt.noop):se[0];let ne=a6i.default.finished(G,()=>{ne(),b()}),Ee={status:ue.statusCode,statusText:ue.statusMessage,headers:new US(ue.headers),config:t,request:Pe};if(s==="stream")Ee.data=G,a9t(i,n,Ee);else{let Qe=[],re=0;G.on("data",function(Ve){Qe.push(Ve),re+=Ve.length,t.maxContentLength>-1&&re>t.maxContentLength&&(_=!0,G.destroy(),n(new ya("maxContentLength size of "+t.maxContentLength+" exceeded",ya.ERR_BAD_RESPONSE,t,Pe)))}),G.on("aborted",function(){if(_)return;let Ve=new ya("stream has been aborted",ya.ERR_BAD_RESPONSE,t,Pe);G.destroy(Ve),n(Ve)}),G.on("error",function(Ve){h.destroyed||n(ya.from(Ve,null,t,Pe))}),G.on("end",function(){try{let Ve=Qe.length===1?Qe[0]:Buffer.concat(Qe);s!=="arraybuffer"&&(Ve=Ve.toString(u),(!u||u==="utf8")&&(Ve=kt.stripBOM(Ve))),Ee.data=Ve}catch(Ve){return n(ya.from(Ve,null,t,Ee.request,Ee))}a9t(i,n,Ee)})}y.once("abort",Qe=>{G.destroyed||(G.emit("error",Qe),G.destroy())})}),y.once("abort",H=>{n(H),h.destroy(H)}),h.on("error",function(ue){n(ya.from(ue,null,t,h))}),h.on("socket",function(ue){ue.setKeepAlive(!0,1e3*60)}),t.timeout){let H=parseInt(t.timeout,10);if(Number.isNaN(H)){n(new ya("error trying to parse `config.timeout` to int",ya.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(H,function(){if(p)return;let se=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",x=t.transitional||jTn;t.timeoutErrorMessage&&(se=t.timeoutErrorMessage),n(new ya(se,x.clarifyTimeoutError?ya.ETIMEDOUT:ya.ECONNABORTED,t,h)),v()})}if(kt.isStream(o)){let H=!1,ue=!1;o.on("end",()=>{H=!0}),o.once("error",se=>{ue=!0,h.destroy(se)}),o.on("close",()=>{!H&&!ue&&v(new the("Request stream has been aborted",t,h))}),o.pipe(h)}else h.end(o)})};var aVp=OA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,OA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(OA.origin),OA.navigator&&/(msie|trident)/i.test(OA.navigator.userAgent)):()=>!0;var oVp=OA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let o=[e+"="+encodeURIComponent(t)];kt.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),kt.isString(i)&&o.push("path="+i),kt.isString(n)&&o.push("domain="+n),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var uVp=e=>e instanceof US?{...e}:e;function NNt(e,t){t=t||{};let r={};function i(s,u,l,p){return kt.isPlainObject(s)&&kt.isPlainObject(u)?kt.merge.call({caseless:p},s,u):kt.isPlainObject(u)?kt.merge({},u):kt.isArray(u)?u.slice():u}function n(s,u,l,p){if(kt.isUndefined(u)){if(!kt.isUndefined(s))return i(void 0,s,l,p)}else return i(s,u,l,p)}function a(s,u){if(!kt.isUndefined(u))return i(void 0,u)}function o(s,u){if(kt.isUndefined(u)){if(!kt.isUndefined(s))return i(void 0,s)}else return i(void 0,u)}function c(s,u,l){if(l in t)return i(s,u);if(l in e)return i(void 0,s)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(s,u,l)=>n(uVp(s),uVp(u),l,!0)};return kt.forEach(Object.keys({...e,...t}),function(u){let l=f[u]||n,p=l(e[u],t[u],u);kt.isUndefined(p)&&l!==c||(r[u]=p)}),r}var iPo=e=>{let t=NNt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=US.from(o),t.url=t6i(r6i(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),kt.isFormData(r)){if(OA.hasStandardBrowserEnv||OA.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(kt.isFunction(r.getHeaders)){let f=r.getHeaders(),s=["content-type","content-length"];Object.entries(f).forEach(([u,l])=>{s.includes(u.toLowerCase())&&o.set(u,l)})}}if(OA.hasStandardBrowserEnv&&(i&&kt.isFunction(i)&&(i=i(t)),i||i!==!1&&aVp(t.url))){let f=n&&a&&oVp.read(a);f&&o.set(n,f)}return t};var QPS=typeof XMLHttpRequest<"u",sVp=QPS&&function(e){return new Promise(function(r,i){let n=iPo(e),a=n.data,o=US.from(n.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:s}=n,u,l,p,_,h;function y(){_&&_(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(n.method.toUpperCase(),n.url,!0),b.timeout=n.timeout;function v(){if(!b)return;let A=US.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),m={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:A,config:e,request:b};a9t(function(M){r(M),y()},function(M){i(M),y()},m),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(i(new ya("Request aborted",ya.ECONNABORTED,e,b)),b=null)},b.onerror=function(g){let m=g&&g.message?g.message:"Network Error",j=new ya(m,ya.ERR_NETWORK,e,b);j.event=g||null,i(j),b=null},b.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",m=n.transitional||jTn;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),i(new ya(g,m.clarifyTimeoutError?ya.ETIMEDOUT:ya.ECONNABORTED,e,b)),b=null},a===void 0&&o.setContentType(null),"setRequestHeader"in b&&kt.forEach(o.toJSON(),function(g,m){b.setRequestHeader(m,g)}),kt.isUndefined(n.withCredentials)||(b.withCredentials=!!n.withCredentials),c&&c!=="json"&&(b.responseType=n.responseType),s&&([p,h]=Wbi(s,!0),b.addEventListener("progress",p)),f&&b.upload&&([l,_]=Wbi(f),b.upload.addEventListener("progress",l),b.upload.addEventListener("loadend",_)),(n.cancelToken||n.signal)&&(u=A=>{b&&(i(!A||A.type?new the(null,e,b):A),b.abort(),b=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let O=OOa(n.url);if(O&&OA.protocols.indexOf(O)===-1){i(new ya("Unsupported protocol "+O+":",ya.ERR_BAD_REQUEST,e));return}b.send(a||null)})};var UPS=(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 u=s instanceof Error?s:this.reason;i.abort(u instanceof ya?u:new the(u instanceof Error?u.message:u))}},o=t&&setTimeout(()=>{o=null,a(new ya(`timeout ${t} of ms exceeded`,ya.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:f}=i;return f.unsubscribe=()=>kt.asap(c),f}},cVp=UPS;var LPS=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},VPS=async function*(e,t){for await(let r of WPS(e))yield*LPS(r,t)},WPS=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()}},hHs=(e,t,r,i)=>{let n=VPS(e,t),a=0,o,c=f=>{o||(o=!0,i&&i(f))};return new ReadableStream({async pull(f){try{let{done:s,value:u}=await n.next();if(s){c(),f.close();return}let l=u.byteLength;if(r){let p=a+=l;r(p)}f.enqueue(new Uint8Array(u))}catch(s){throw c(s),s}},cancel(f){return c(f),n.return()}},{highWaterMark:2})};var lVp=64*1024,{isFunction:nPo}=kt,xPS=(({Request:e,Response:t})=>({Request:e,Response:t}))(kt.global),{ReadableStream:fVp,TextEncoder:dVp}=kt.global,pVp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},GPS=e=>{e=kt.merge.call({skipUndefined:!0},xPS,e);let{fetch:t,Request:r,Response:i}=e,n=t?nPo(t):typeof fetch=="function",a=nPo(r),o=nPo(i);if(!n)return!1;let c=n&&nPo(fVp),f=n&&(typeof dVp=="function"?(h=>y=>h.encode(y))(new dVp):async h=>new Uint8Array(await new r(h).arrayBuffer())),s=a&&c&&pVp(()=>{let h=!1,y=new r(OA.origin,{body:new fVp,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!y}),u=o&&c&&pVp(()=>kt.isReadableStream(new i("").body)),l={stream:u&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!l[h]&&(l[h]=(y,b)=>{let v=y&&y[h];if(v)return v.call(y);throw new ya(`Response type '${h}' is not supported`,ya.ERR_NOT_SUPPORT,b)})});let p=async h=>{if(h==null)return 0;if(kt.isBlob(h))return h.size;if(kt.isSpecCompliantForm(h))return(await new r(OA.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(kt.isArrayBufferView(h)||kt.isArrayBuffer(h))return h.byteLength;if(kt.isURLSearchParams(h)&&(h=h+""),kt.isString(h))return(await f(h)).byteLength},_=async(h,y)=>{let b=kt.toFiniteNumber(h.getContentLength());return b??p(y)};return async h=>{let{url:y,method:b,data:v,signal:O,cancelToken:A,timeout:g,onDownloadProgress:m,onUploadProgress:j,responseType:M,headers:E,withCredentials:D="same-origin",fetchOptions:B}=iPo(h),F=t||fetch;M=M?(M+"").toLowerCase():"text";let N=cVp([O,A&&A.toAbortSignal()],g),T=null,R=N&&N.unsubscribe&&(()=>{N.unsubscribe()}),Q;try{if(j&&s&&b!=="get"&&b!=="head"&&(Q=await _(E,v))!==0){let G=new r(y,{method:"POST",body:v,duplex:"half"}),Pe;if(kt.isFormData(v)&&(Pe=G.headers.get("content-type"))&&E.setContentType(Pe),G.body){let[ne,Ee]=STn(Q,Wbi(MTn(j)));v=hHs(G.body,lVp,ne,Ee)}}kt.isString(D)||(D=D?"include":"omit");let U=a&&"credentials"in r.prototype,H={...B,signal:N,method:b.toUpperCase(),headers:E.normalize().toJSON(),body:v,duplex:"half",credentials:U?D:void 0};T=a&&new r(y,H);let ue=await(a?F(T,B):F(y,H)),se=u&&(M==="stream"||M==="response");if(u&&(m||se&&R)){let G={};["status","statusText","headers"].forEach(Qe=>{G[Qe]=ue[Qe]});let Pe=kt.toFiniteNumber(ue.headers.get("content-length")),[ne,Ee]=m&&STn(Pe,Wbi(MTn(m),!0))||[];ue=new i(hHs(ue.body,lVp,ne,()=>{Ee&&Ee(),R&&R()}),G)}M=M||"text";let x=await l[kt.findKey(l,M)||"text"](ue,h);return!se&&R&&R(),await new Promise((G,Pe)=>{a9t(G,Pe,{data:x,headers:US.from(ue.headers),status:ue.status,statusText:ue.statusText,config:h,request:T})})}catch(U){throw R&&R(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new ya("Network Error",ya.ERR_NETWORK,h,T),{cause:U.cause||U}):ya.from(U,U&&U.code,h,T)}}},HPS=new Map,yHs=e=>{let t=e?e.env:{},{fetch:r,Request:i,Response:n}=t,a=[i,n,r],o=a.length,c=o,f,s,u=HPS;for(;c--;)f=a[c],s=u.get(f),s===void 0&&u.set(f,s=c?new Map:GPS(t)),u=s;return s},Uv5=yHs();var bHs={http:nVp,xhr:sVp,fetch:{get:yHs}};kt.forEach(bHs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var _Vp=e=>`- ${e}`,JPS=e=>kt.isFunction(e)||e===null||e===!1,aPo={getAdapter:(e,t)=>{e=kt.isArray(e)?e:[e];let{length:r}=e,i,n,a={};for(let o=0;o<r;o++){i=e[o];let c;if(n=i,!JPS(i)&&(n=bHs[(c=String(i)).toLowerCase()],n===void 0))throw new ya(`Unknown adapter '${c}'`);if(n&&(kt.isFunction(n)||(n=n.get(t))))break;a[c||"#"+o]=n}if(!n){let o=Object.entries(a).map(([f,s])=>`adapter ${f} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
@@ -1396,7 +1396,7 @@ ${g}${O}${m}${OQn}`});function $Qo({message:e,error:t,logger:r,logLevel:i=$s.Err
1396
1396
  Run ${Lt.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1397
1397
  Run ${Lt.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),QBi(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function koc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!ad_(e))return;let n=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)n+=`
1398
1398
  ${await BZS(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Lt.dim(c.currentVersion)+Lt.reset(" \u2192 ")+Lt.green(c.latestVersion);return n+=`
1399
- `,i?QBi(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function BZS(e){let r=await new nd_.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 IZS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=NMi(u.name,l),_=await dNt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=NMi(s.name,u),p=await dNt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][f][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await $_e({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,o)}})}))}function sd_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let f=k6(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function kQo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await IZS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[f,s]of Object.entries(c.versions))o.push(...sd_(s,f,t.logger));else o.push(...sd_(c.versions,void 0,t.logger))}return o}var RPa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var jQn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var euc=(()=>{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})(),cd_=typeof globalThis.AbortController=="function",ld_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",fd_=typeof globalThis.ReadableStream=="function",dd_=typeof globalThis.FormData=="function",eUo=["get","post","put","patch","head","delete"],CZS=()=>{};CZS();var pd_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},tUo=2147483647,_d_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,rUo=Symbol("stop"),hd_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},yd_={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 qZS=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=_d_,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},bd_=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},vd_=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(bd_(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},gd_=(e,t,r)=>{if(!e.body)return e;let i=qZS(r??e.body);return new Request(e,{duplex:"half",body:bd_(e.body,i,t)})};var wQn=e=>e!==null&&typeof e=="object";var zPa=(...e)=>{for(let t of e)if((!wQn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return iuc({},...e)},tuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function iUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:iuc(e[r]??[],t[r]??[])}var ruc=(e={},t={})=>({beforeRequest:iUo(e,t,"beforeRequest"),beforeRetry:iUo(e,t,"beforeRetry"),afterResponse:iUo(e,t,"afterResponse"),beforeError:iUo(e,t,"beforeError")}),iuc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(wQn(n)){for(let[a,o]of Object.entries(n))wQn(o)&&a in t&&(o=iuc(t[a],o)),t={...t,[a]:o};wQn(n.hooks)&&(i=ruc(i,n.hooks),t.hooks=i),wQn(n.headers)&&(r=tuc(r,n.headers),t.headers=r)}return t};var Ad_=e=>eUo.includes(e)?e.toUpperCase():e,TZS=["get","put","head","delete","options","trace"],RZS=[408,413,429,500,502,503,504],zZS=[413,429,503],Od_={limit:2,methods:TZS,statusCodes:RZS,afterStatusCodes:zZS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},md_=(e={})=>{if(typeof e=="number")return{...Od_,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{...Od_,...e}};async function nuc(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jQn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function auc(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 Pd_=(e,t)=>{let r={};for(let i in t)!(i in yd_)&&!(i in hd_)&&!(i in e)&&(r[i]=t[i]);return r},jd_=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 NPa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>tUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${tUo}`);await Promise.resolve();let c=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let f=new RPa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!fd_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return vd_(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),i.request.bodyUsed||f.push(i.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(pd_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:tuc(this._input.headers,r.headers),hooks:ruc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Ad_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:md_(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(cd_&&ld_){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(euc&&(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),jd_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(dd_&&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(!euc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=gd_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jQn)throw t;if(t instanceof RPa){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),tUo);if(this._retryCount<1)throw r;await auc(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})===rUo)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Pd_(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):nuc(this._originalRequest,t,this.abortController,this._options)}};var ouc=e=>{let t=(r,i)=>NPa.create(r,zPa(e,i));for(let r of eUo)t[r]=(i,n)=>NPa.create(i,zPa(e,n,{method:r}));return t.create=r=>ouc(zPa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),ouc(zPa(e,r))),t.stop=rUo,t},NZS=ouc(),wd_=NZS;var Jd_=ae(Kd_(),1);function fuc(e){let t=(0,Jd_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Vp_=ae(Lp_(),1),Wp_=ae(A_e(),1),juc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},wuc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Euc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??fuc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Vp_.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let s;try{s=await wd_(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new juc(e):l}if(t.allVersions)return s;let u=new wuc(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[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=Wp_.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function WPa(e,t){let{version:r}=await Euc(e.toLowerCase(),t);return r}async function CCi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:WPa(e.packageName,{version:t?"prerelease":"latest"})}var xp_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],hUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=$s.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new ZQo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"2.13.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Lt.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new qE}failWithoutThrowing(t,r){this.didSucceed=!1,$Qo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await OTn()).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 od_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1399
+ `,i?QBi(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function BZS(e){let r=await new nd_.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 IZS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=NMi(u.name,l),_=await dNt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=NMi(s.name,u),p=await dNt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][f][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function ud_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await $_e({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,o)}})}))}function sd_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let f=k6(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function kQo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await IZS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[f,s]of Object.entries(c.versions))o.push(...sd_(s,f,t.logger));else o.push(...sd_(c.versions,void 0,t.logger))}return o}var RPa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var jQn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var euc=(()=>{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})(),cd_=typeof globalThis.AbortController=="function",ld_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",fd_=typeof globalThis.ReadableStream=="function",dd_=typeof globalThis.FormData=="function",eUo=["get","post","put","patch","head","delete"],CZS=()=>{};CZS();var pd_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},tUo=2147483647,_d_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,rUo=Symbol("stop"),hd_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},yd_={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 qZS=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=_d_,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},bd_=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},vd_=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(bd_(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},gd_=(e,t,r)=>{if(!e.body)return e;let i=qZS(r??e.body);return new Request(e,{duplex:"half",body:bd_(e.body,i,t)})};var wQn=e=>e!==null&&typeof e=="object";var zPa=(...e)=>{for(let t of e)if((!wQn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return iuc({},...e)},tuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function iUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:iuc(e[r]??[],t[r]??[])}var ruc=(e={},t={})=>({beforeRequest:iUo(e,t,"beforeRequest"),beforeRetry:iUo(e,t,"beforeRetry"),afterResponse:iUo(e,t,"afterResponse"),beforeError:iUo(e,t,"beforeError")}),iuc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(wQn(n)){for(let[a,o]of Object.entries(n))wQn(o)&&a in t&&(o=iuc(t[a],o)),t={...t,[a]:o};wQn(n.hooks)&&(i=ruc(i,n.hooks),t.hooks=i),wQn(n.headers)&&(r=tuc(r,n.headers),t.headers=r)}return t};var Ad_=e=>eUo.includes(e)?e.toUpperCase():e,TZS=["get","put","head","delete","options","trace"],RZS=[408,413,429,500,502,503,504],zZS=[413,429,503],Od_={limit:2,methods:TZS,statusCodes:RZS,afterStatusCodes:zZS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},md_=(e={})=>{if(typeof e=="number")return{...Od_,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{...Od_,...e}};async function nuc(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jQn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function auc(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 Pd_=(e,t)=>{let r={};for(let i in t)!(i in yd_)&&!(i in hd_)&&!(i in e)&&(r[i]=t[i]);return r},jd_=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 NPa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>tUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${tUo}`);await Promise.resolve();let c=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let f=new RPa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!fd_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return vd_(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),i.request.bodyUsed||f.push(i.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(pd_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:tuc(this._input.headers,r.headers),hooks:ruc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Ad_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:md_(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(cd_&&ld_){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(euc&&(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),jd_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(dd_&&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(!euc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=gd_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jQn)throw t;if(t instanceof RPa){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),tUo);if(this._retryCount<1)throw r;await auc(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})===rUo)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Pd_(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):nuc(this._originalRequest,t,this.abortController,this._options)}};var ouc=e=>{let t=(r,i)=>NPa.create(r,zPa(e,i));for(let r of eUo)t[r]=(i,n)=>NPa.create(i,zPa(e,n,{method:r}));return t.create=r=>ouc(zPa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),ouc(zPa(e,r))),t.stop=rUo,t},NZS=ouc(),wd_=NZS;var Jd_=ae(Kd_(),1);function fuc(e){let t=(0,Jd_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Vp_=ae(Lp_(),1),Wp_=ae(A_e(),1),juc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},wuc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Euc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??fuc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Vp_.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let s;try{s=await wd_(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new juc(e):l}if(t.allVersions)return s;let u=new wuc(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[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=Wp_.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function WPa(e,t){let{version:r}=await Euc(e.toLowerCase(),t);return r}async function CCi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:WPa(e.packageName,{version:t?"prerelease":"latest"})}var xp_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],hUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=$s.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new ZQo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"2.14.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Lt.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new qE}failWithoutThrowing(t,r){this.didSucceed=!1,$Qo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await OTn()).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 od_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1400
1400
  `)||(r+=`
1401
1401
  `),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=Ows(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 DPa(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 qE}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await OTn()).sendEvent(t)}logger=x8t((t,...r)=>this.log(t,...r));stderr=x8t((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=Gp_(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Gp_(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=xp_[this.numTasks++%xp_.length],o=Lt.hex(a)(n);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===gj.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=>uMi.indexOf(n.level)>=uMi.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===$s.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 CCi({cliEnvironment:this.environment,includePreReleases:t}),i=k6(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await kQo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await Loc({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Lt.yellow("?"),style:{answer:n=>Lt.cyan(n),message:n=>Lt.bold(n),highlight:n=>Lt.cyan(n)}}})}catch(i){throw i?.name==="ExitPromptError"?(this.logger.info(`
1402
1402
  Cancelled by user.`),new qE):i}}async getInput(t){return await Noc({message:t.message,default:t.default})}};function Gp_(e){return`[${e}]:`}var _Ft=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}};function yUo(e,t,r,i){if(typeof r!="function")throw new Error("method for before hook must be a function");return i||(i={}),Array.isArray(t)?t.reverse().reduce((n,a)=>yUo.bind(null,e,a,n,i),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((n,a)=>a.hook.bind(null,n,i),r)():r(i))}function Hp_(e,t,r,i){let n=i;e.registry[r]||(e.registry[r]=[]),t==="before"&&(i=(a,o)=>Promise.resolve().then(n.bind(null,o)).then(a.bind(null,o))),t==="after"&&(i=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(f=>(c=f,n(c,o))).then(()=>c)}),t==="error"&&(i=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>n(c,o))),e.registry[r].push({hook:i,orig:n})}function Kp_(e,t,r){if(!e.registry[t])return;let i=e.registry[t].map(n=>n.orig).indexOf(r);i!==-1&&e.registry[t].splice(i,1)}var Jp_=Function.bind,$p_=Jp_.bind(Jp_);function Yp_(e,t,r){let i=$p_(Kp_,null).apply(null,r?[t,r]:[t]);e.api={remove:i},e.remove=i,["before","error","after","wrap"].forEach(n=>{let a=r?[t,n,r]:[t,n];e[n]=e.api[n]=$p_(Hp_,null).apply(null,a)})}function W2S(){let e=Symbol("Singular"),t={registry:{}},r=yUo.bind(null,t,e);return Yp_(r,t,e),r}function x2S(){let e={registry:{}},t=yUo.bind(null,e);return Yp_(t,e),t}var Xp_={Singular:W2S,Collection:x2S};var G2S="0.0.0-development",H2S=`octokit-endpoint.js/${G2S} ${TR()}`,K2S={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":H2S},mediaType:{format:""}};function J2S(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function $2S(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function e__(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(i=>{$2S(t[i])?i in e?r[i]=e__(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})}),r}function Zp_(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Muc(e,t,r){if(typeof t=="string"){let[n,a]=t.split(" ");r=Object.assign(a?{method:n,url:a}:{url:n},r)}else r=Object.assign({},t);r.headers=J2S(r.headers),Zp_(r),Zp_(r.headers);let i=e__(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(i.mediaType.previews=e.mediaType.previews.filter(n=>!i.mediaType.previews.includes(n)).concat(i.mediaType.previews)),i.mediaType.previews=(i.mediaType.previews||[]).map(n=>n.replace(/-preview/,""))),i}function Y2S(e,t){let r=/\?/.test(e)?"&":"?",i=Object.keys(t);return i.length===0?e:e+r+i.map(n=>n==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${n}=${encodeURIComponent(t[n])}`).join("&")}var X2S=/\{[^{}}]+\}/g;function Z2S(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function k2S(e){let t=e.match(X2S);return t?t.map(Z2S).reduce((r,i)=>r.concat(i),[]):[]}function kp_(e,t){let r={__proto__:null};for(let i of Object.keys(e))t.indexOf(i)===-1&&(r[i]=e[i]);return r}function t__(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function qQn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function xPa(e,t,r){return t=e==="+"||e==="#"?t__(t):qQn(t),r?qQn(r)+"="+t:t}function CQn(e){return e!=null}function Suc(e){return e===";"||e==="&"||e==="?"}function ekS(e,t,r,i){var n=e[r],a=[];if(CQn(n)&&n!=="")if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")n=n.toString(),i&&i!=="*"&&(n=n.substring(0,parseInt(i,10))),a.push(xPa(t,n,Suc(t)?r:""));else if(i==="*")Array.isArray(n)?n.filter(CQn).forEach(function(o){a.push(xPa(t,o,Suc(t)?r:""))}):Object.keys(n).forEach(function(o){CQn(n[o])&&a.push(xPa(t,n[o],o))});else{let o=[];Array.isArray(n)?n.filter(CQn).forEach(function(c){o.push(xPa(t,c))}):Object.keys(n).forEach(function(c){CQn(n[c])&&(o.push(qQn(c)),o.push(xPa(t,n[c].toString())))}),Suc(t)?a.push(qQn(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?CQn(n)&&a.push(qQn(r)):n===""&&(t==="&"||t==="?")?a.push(qQn(r)+"="):n===""&&a.push("");return a}function tkS(e){return{expand:rkS.bind(null,e)}}function rkS(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(i,n,a){if(n){let c="",f=[];if(r.indexOf(n.charAt(0))!==-1&&(c=n.charAt(0),n=n.substr(1)),n.split(/,/g).forEach(function(s){var u=/([^:\*]*)(?::(\d+)|(\*))?/.exec(s);f.push(ekS(t,c,u[1],u[2]||u[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(f.length!==0?c:"")+f.join(o)}else return f.join(",")}else return t__(a)}),e==="/"?e:e.replace(/\/$/,"")}function r__(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),i=Object.assign({},e.headers),n,a=kp_(e,["method","baseUrl","url","headers","request","mediaType"]),o=k2S(r);r=tkS(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(u=>o.includes(u)).concat("baseUrl"),f=kp_(a,c);if(!/application\/octet-stream/i.test(i.accept)&&(e.mediaType.format&&(i.accept=i.accept.split(/,/).map(u=>u.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let u=i.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];i.accept=u.concat(e.mediaType.previews).map(l=>{let p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?r=Y2S(r,f):"data"in f?n=f.data:Object.keys(f).length&&(n=f),!i["content-type"]&&typeof n<"u"&&(i["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof n>"u"&&(n=""),Object.assign({method:t,url:r,headers:i},typeof n<"u"?{body:n}:null,e.request?{request:e.request}:null)}function ikS(e,t,r){return r__(Muc(e,t,r))}function i__(e,t){let r=Muc(e,t),i=ikS.bind(null,r);return Object.assign(i,{DEFAULTS:r,defaults:i__.bind(null,r),merge:Muc.bind(null,r),parse:r__})}var n__=i__(null,K2S);var l__=ae(s__(),1);var hFt=class extends Error{name;status;request;response;constructor(t,r,i){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in i&&(this.response=i.response);let n=Object.assign({},i.request);i.request.headers.authorization&&(n.headers=Object.assign({},i.request.headers,{authorization:i.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),n.url=n.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=n}};var nkS="10.0.6",akS={headers:{"user-agent":`octokit-request.js/${nkS} ${TR()}`}};function okS(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function c__(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,i=e.request?.parseSuccessResponseBody!==!1,n=okS(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,p])=>[l,String(p)])),o;try{o=await t(e.url,{method:e.method,body:n,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let p="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;p=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?p=l.cause.message:typeof l.cause=="string"&&(p=l.cause))}let _=new hFt(p,500,{request:e});throw _.cause=l,_}let c=o.status,f=o.url,s={};for(let[l,p]of o.headers)s[l]=p;let u={url:f,status:c,headers:s,data:""};if("deprecation"in s){let l=s.link&&s.link.match(/<([^<>]+)>; rel="deprecation"/),p=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${s.sunset}${p?`. See ${p}`:""}`)}if(c===204||c===205)return u;if(e.method==="HEAD"){if(c<400)return u;throw new hFt(o.statusText,c,{response:u,request:e})}if(c===304)throw u.data=await Duc(o),new hFt("Not modified",c,{response:u,request:e});if(c>=400)throw u.data=await Duc(o),new hFt(skS(u.data),c,{response:u,request:e});return u.data=i?await Duc(o):o.body,u}async function Duc(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,l__.safeParse)(t);if(ukS(r)){let i="";try{return i=await e.text(),JSON.parse(i)}catch{return i}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function ukS(e){return e.type==="application/json"||e.type==="application/scim+json"}function skS(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function Buc(e,t){let r=e.defaults(t);return Object.assign(function(n,a){let o=r.merge(n,a);if(!o.request||!o.request.hook)return c__(r.parse(o));let c=(f,s)=>c__(r.parse(r.merge(f,s)));return Object.assign(c,{endpoint:r,defaults:Buc.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:Buc.bind(null,r)})}var WO=Buc(n__,akS);var ckS="0.0.0-development";function lkS(e){return`Request failed due to following response errors:
@@ -1421,7 +1421,7 @@ Cancelled by user.`),new qE):i}}async getInput(t){return await Noc({message:t.me
1421
1421
  `+o.stack:"")}return i}function ZiM({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??qy_.naming}}function vLo(e){let t=String(e.description||e.name||e["x-fern-server-name"]||"default").trim(),r=t.toUpperCase();return r==="PRODUCTION"||r==="PRD"||r==="PROD"?"PRD":r==="SANDBOX"||r==="SBX"?"SBX":r==="STAGING"||r==="STG"?"STG":r==="PERFORMANCE"||r==="PRF"||r==="PERF"?"PRF":r==="E2E"||r==="E_2_E"?"E2E":r==="QAL"||r==="QUALITY"?"QAL":t}function kiM(e){try{let i=new URL(e).hostname.split("."),n=new Set(["api","www","service","services","example","com","org","net","io"]);for(let o of i){let c=o.split("-")[0];if(c&&!n.has(c.toLowerCase())&&c.length>2)return c.toLowerCase()}let a=i[0]?.split("-")[0];return a?a.toLowerCase():"api"}catch{let t=e.match(/https?:\/\/([^./-]+)/);return t&&t[1]?t[1].toLowerCase():"api"}}function Lsc(e,t){let r=e??[],i=t??[];if(r.length===0&&i.length===0)return;let n=new Map;for(let a of[...r,...i]){let o=Object.keys(a).sort(),c={};for(let s of o)c[s]=a[s]??[];let f=JSON.stringify(c);n.has(f)||n.set(f,a)}return Array.from(n.values())}function enM(e,t){if(e.length===0||t.length===0||e.length!==t.length)return!1;let r=new Map;for(let a of e){let o=vLo(a);r.set(o,a.url)}let i=!0,n=!0;for(let a of t){let o=vLo(a),c=r.get(o);c?c===a.url&&(n=!1):i=!1}return i&&n}function bv_(e){if(e.length===0||!e[0])return"api";let t=e[0].url;return kiM(t)}function tnM(e,t,r){if(!(r?.groupMultiApiEnvironments===!0))return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:bLo(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:Lsc(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}};if(enM(e.servers,t.servers)){let a=[],o=[],c=bv_(e.servers),f=bv_(t.servers),s=new Map;for(let p of e.servers){let _=vLo(p);s.has(_)||s.set(_,{});let h=s.get(_);h&&(h[c]={url:p.url,audiences:p.audiences})}for(let p of t.servers){let _=vLo(p);s.has(_)||s.set(_,{});let h=s.get(_);h&&(h[f]={url:p.url,audiences:p.audiences})}for(let[p,_]of s.entries()){let h={type:"grouped",name:p,description:`${p} environment`,urls:_};a.push(h)}let u=e.endpoints.map(p=>({...p,type:"multi-api",apiName:c,servers:[{name:c,url:void 0,audiences:void 0}]})),l=t.endpoints.map(p=>({...p,type:"multi-api",apiName:f,servers:[{name:f,url:void 0,audiences:void 0}]}));return o=[...u,...l],{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:a.map(p=>(p.type==="single",p)),websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:o.map(p=>{if(p.type==="multi-api"){let{type:y,apiName:b,servers:v,...O}=p;return{...O,__apiName:b,servers:v}}let{type:_,...h}=p;return h}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:bLo(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:Lsc(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:bLo(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:Lsc(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}function bLo(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,i]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...i}:e.namespacedSchemas[r]=i;return e}var ME_=ae(fWo(),1),dWo={config:new ME_.Config({apis:{},styleguide:{plugins:[wsc],rules:{struct:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!1};function f$i({options:e,overrides:t}={}){return{...Y0e({options:e,overrides:t}),...MJi({options:e,overrides:t})}}var WEM={shouldUseTitleAsName:"useTitlesAsName",shouldUseUndiscriminatedUnionsWithLiterals:["shouldUseUndiscriminatedUnionsWithLiterals","discriminatedUnionV2"],shouldUseIdiomaticRequestNames:"shouldUseIdiomaticRequestNames",asyncApiMessageNaming:"asyncApiNaming",shouldUseOptionalAdditionalProperties:"optionalAdditionalProperties",coerceEnumsToLiterals:"coerceEnumsToLiterals",objectQueryParameters:"objectQueryParameters",respectReadonlySchemas:"respectReadonlySchemas",respectNullableSchemas:"respectNullableSchemas",onlyIncludeReferencedSchemas:"onlyIncludeReferencedSchemas",inlinePathParameters:"inlinePathParameters",useBytesForBinaryResponse:"useBytesForBinaryResponse",respectForwardCompatibleEnums:"respectForwardCompatibleEnums",filter:"filter",defaultFormParameterEncoding:"defaultFormParameterEncoding",exampleGeneration:"exampleGeneration",additionalPropertiesDefaultsTo:"additionalPropertiesDefaultsTo",typeDatesAsStrings:"typeDatesAsStrings",preserveSingleSchemaOneOf:"preserveSingleSchemaOneOf",inlineAllOfSchemas:"inlineAllOfSchemas",resolveAliases:"resolveAliases",groupMultiApiEnvironments:"groupMultiApiEnvironments",groupEnvironmentsByHost:"groupEnvironmentsByHost",wrapReferencesToNullableInOptional:"wrapReferencesToNullableInOptional",coerceOptionalSchemasToNullable:"coerceOptionalSchemasToNullable",removeDiscriminantsFromSchemas:"removeDiscriminantsFromSchemas"};function xEM(e,t,r){r!==void 0&&(e[t]=r)}function pWo(e){let t={};if(e!=null)for(let[r,i]of Object.entries(WEM)){let n=e[r],a=Array.isArray(i)?i:[i];for(let o of a)xEM(t,o,n)}return f$i({options:t})}function v4n(e){if(e.settings==null&&e.apiOverride?.auth==null&&e.apiOverride?.["auth-schemes"]==null)return;let t={detectGlobalHeaders:!0};return e.settings?.unions==="v1"&&(t.discriminatedUnionV2=!0),e.apiOverride?.auth!=null&&(t.auth=e.apiOverride.auth),e.apiOverride?.["auth-schemes"]!=null&&(t.authSchemes=e.apiOverride["auth-schemes"]),t}function Pwa(e){return e.swagger!=null}function kpc(e){return e.openapi!=null}function wqi(e,t={}){return{...Object.fromEntries(KD(e.namedDefinitionFiles).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...KD(e.importedDefinitions).reduce((r,[i,n])=>({...r,...Xfa(wqi(n.definition,{defaultURL:n.url}),(a,o)=>iD(i,Tu.of(o)))}),{})}}function jwa(e,t={}){return{...Object.fromEntries(KD(e.packageMarkers).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...KD(e.importedDefinitions).reduce((r,[i,n])=>({...r,...Xfa(jwa(n.definition,{defaultURL:n.url}),(a,o)=>iD(i,Tu.of(o)))}),{})}}function pgi(e){return{...jwa(e),...wqi(e)}}function aPe(e,t){return pgi(e.definition)[t]?.contents}function TB(e,t){for(let[r,i]of KD(pgi(e.definition)))t(r,i.contents,{isPackageMarker:b9i(r)===ob,defaultUrl:i.defaultUrl})}function d$i(e,t){for(let[r,i]of KD(jwa(e.definition)))t(r,i.contents)}function oPe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Lt.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Lt.dim(r)),i.join(`
1422
1422
  `)}var DE_={None:"none",Header:"header"};var zWo={};Kt(zWo,{ConjureAliasDeclaration:()=>OWo,ConjureArgument:()=>qWo,ConjureArgumentWithParamType:()=>CWo,ConjureAuthDefinition:()=>m4n,ConjureAuthDefinitionType:()=>BWo,ConjureDefinitions:()=>MWo,ConjureEndpointDefinition:()=>TWo,ConjureEnumDeclaration:()=>EWo,ConjureEnumVariant:()=>wWo,ConjureEnumWithDocs:()=>jWo,ConjureObjectDeclaration:()=>PWo,ConjureParamType:()=>IWo,ConjurePrimitive:()=>gWo,ConjureService:()=>RWo,ConjureServiceName:()=>vWo,ConjureType:()=>Mqi,ConjureTypeDeclaration:()=>SWo,ConjureTypeReference:()=>Dqi,ConjureTypeWithDocs:()=>AWo,ConjureTypes:()=>DWo,ConjureUnionDeclaration:()=>mWo,DefinitionFile:()=>iS_,WithDocs:()=>BGt,commons:()=>n_c,conjure:()=>a_c,services:()=>o_c,types:()=>u_c});var n_c={};Kt(n_c,{WithDocs:()=>BGt});var Vn={};Kt(Vn,{JsonError:()=>g4n,ParseError:()=>O4n,any:()=>xE_,bigint:()=>IE_,boolean:()=>GE_,booleanLiteral:()=>WE_,date:()=>CE_,discriminant:()=>eS_,enum_:()=>hWo,getObjectLikeUtils:()=>MFt,getObjectUtils:()=>p$i,getSchemaUtils:()=>Zm,isProperty:()=>Sqi,lazy:()=>qE_,lazyObject:()=>UE_,list:()=>bWo,number:()=>HE_,object:()=>yWo,objectWithoutOptionalProperties:()=>QE_,optional:()=>e_c,property:()=>RE_,record:()=>YE_,set:()=>XE_,string:()=>KE_,stringLiteral:()=>VE_,transform:()=>t_c,undiscriminatedUnion:()=>kE_,union:()=>rS_,unknown:()=>JE_,withParsedProperties:()=>i_c});var sh={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 DA(e,t){return`Expected ${t}. Received ${GEM(e)}.`}function GEM(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 Pz(e){return{...e,json:BE_(e.json),parse:BE_(e.parse)}}function BE_(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(`
1423
1423
  `)),{ok:!0,value:t}):i}}function _Wo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var g4n=class e extends Error{errors;constructor(t){super(t.map(_Wo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var O4n=class e extends Error{errors;constructor(t){super(t.map(_Wo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Zm(e){return{optional:()=>e_c(e),transform:t=>t_c(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new O4n(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new g4n(i.errors)}}}function e_c(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:()=>sh.OPTIONAL};return{...t,...Zm(t)}}function t_c(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,...Zm(r)}}function IE_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DA(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:DA(t,"bigint")}]},getType:()=>sh.BIGINT};return{...Pz(e),...Zm(e)}}var HEM=/^([+-]?\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 CE_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DA(t,"string")}]}:HEM.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:DA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:DA(t,"Date object")}]},getType:()=>sh.DATE};return{...Pz(e),...Zm(e)}}function kL(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Pz(r),...Zm(r)}}}function hWo(e){let t=new Set(e);return kL(sh.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:DA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:DA(i,"enum")}]}:{ok:!0,value:i})()}function qE_(e){let t=r_c(e);return{...t,...Zm(t)}}function r_c(e){return{parse:(t,r)=>A4n(e).parse(t,r),json:(t,r)=>A4n(e).json(t,r),getType:()=>A4n(e).getType()}}function A4n(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function wwa(e){return Object.entries(e)}function Ewa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function Eqi(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 Swa(e){return Object.keys(e)}function TE_(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function MFt(e){return{withParsedProperties:t=>i_c(e,t)}}function i_c(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,s])=>({...c,[f]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(i,n)=>{if(!Eqi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:DA(i,"object")}]};let a=new Set(Object.keys(t)),o=Ewa(i,Object.keys(i).filter(c=>!a.has(c)));return e.json(o,n)},getType:()=>e.getType()};return{...r,...Zm(r),...MFt(r)}}function RE_(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Sqi(e){return e.isProperty}function yWo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>Sqi(i)?i.rawKey:r),_getParsedProperties:()=>Swa(e),parse:(r,i)=>{let n={},a=[];for(let[o,c]of wwa(e)){let f=Sqi(c)?c.rawKey:o,s=Sqi(c)?c.valueSchema:c,u={rawKey:f,parsedKey:o,valueSchema:s};n[f]=u,FE_(s)&&a.push(f)}return zE_({value:r,requiredKeys:a,getProperty:o=>{let c=n[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,o]of wwa(e)){let c=Sqi(o)?o.valueSchema:o;FE_(c)&&n.push(a)}return zE_({value:r,requiredKeys:n,getProperty:a=>{let o=e[a];if(o!=null)return Sqi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>sh.OBJECT};return{...Pz(t),...Zm(t),...MFt(t),...p$i(t)}}function zE_({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!Eqi(e))return{ok:!1,errors:[{path:a,message:DA(e,"object")}]};let o=new Set(t),c=[],f={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let p=l.transform(u);p.ok?f[l.transformedKey]=p.value:(f[s]=u,c.push(...p.errors))}else switch(i){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":f[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||n?{ok:!0,value:f}:{ok:!1,errors:c}}function p$i(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>NE_({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>NE_({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>sh.OBJECT};return{...r,...Zm(r),...MFt(r),...p$i(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:()=>sh.OBJECT};return{...t,...Zm(t),...MFt(t),...p$i(t)}}}}function NE_({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,o]=TE_(Swa(t),s=>n.has(s)),c=r(Ewa(t,o)),f=i(Ewa(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function FE_(e){return!KEM(e)}function KEM(e){switch(e.getType()){case sh.ANY:case sh.UNKNOWN:case sh.OPTIONAL:return!0;default:return!1}}function QE_(e){return yWo(e)}function UE_(e){let t={...r_c(e),_getRawProperties:()=>A4n(e)._getRawProperties(),_getParsedProperties:()=>A4n(e)._getParsedProperties()};return{...t,...Zm(t),...MFt(t),...p$i(t)}}function bWo(e){let t={parse:(r,i)=>LE_(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>LE_(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>sh.LIST};return{...Pz(t),...Zm(t)}}function LE_(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:DA(e,"list"),path:[]}]}}function VE_(e){return kL(sh.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DA(r,`"${e}"`)}]})()}function WE_(e){return kL(sh.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DA(r,`${e.toString()}`)}]})()}var xE_=kL(sh.ANY,e=>({ok:!0,value:e}));var GE_=kL(sh.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DA(e,"boolean")}]});var HE_=kL(sh.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DA(e,"number")}]});var KE_=kL(sh.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DA(e,"string")}]});var JE_=kL(sh.UNKNOWN,e=>({ok:!0,value:e}));function YE_(e,t){let r={parse:(i,n)=>$E_({value:i,isKeyNumeric:e.getType()===sh.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>$E_({value:i,isKeyNumeric:e.getType()===sh.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>sh.RECORD};return{...Pz(r),...Zm(r)}}function $E_({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return Eqi(e)?wwa(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,s=o;if(t){let _=o.length>0?Number(o):NaN;isNaN(_)||(s=_)}let u=r(s),l=i(c,s);if(f.ok&&u.ok&&l.ok)return{ok:!0,value:{...f.value,[u.value]:l.value}};let p=[];return f.ok||p.push(...f.errors),u.ok||p.push(...u.errors),l.ok||p.push(...l.errors),{ok:!1,errors:p}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:DA(e,"object")}]}}function XE_(e){let t=bWo(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:DA(i,"Set")}]},getType:()=>sh.SET};return{...Pz(r),...Zm(r)}}function kE_(e){let t={parse:(r,i)=>ZE_((n,a)=>n.parse(r,a),e,i),json:(r,i)=>ZE_((n,a)=>n.json(r,a),e,i),getType:()=>sh.UNDISCRIMINATED_UNION};return{...Pz(t),...Zm(t)}}function ZE_(e,t,r){let i=[];for(let[n,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)i.push({path:c.path,message:`[Variant ${n}] ${c.message}`})}return{ok:!1,errors:i}}function eS_(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function rS_(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=hWo(Swa(t)),a={parse:(o,c)=>tS_({value:o,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:f=>n.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>tS_({value:o,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:f=>n.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>sh.UNION};return{...Pz(a),...Zm(a),...MFt(a)}}function tS_({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!Eqi(e))return{ok:!1,errors:[{path:c,message:DA(e,"object")}]};let{[t]:f,...s}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=i(f);if(!u.ok)return{ok:!1,errors:u.errors};let l=n(u.value);if(l==null)return a?{ok:!0,value:{[r]:u.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let p=o(s,l);return p.ok?{ok:!0,value:{[r]:f,...p.value}}:p}var BGt=Vn.objectWithoutOptionalProperties({docs:Vn.string().optional()});var a_c={};Kt(a_c,{ConjureServiceName:()=>vWo,DefinitionFile:()=>iS_});var vWo=Vn.string();var gWo=Vn.enum_(["rid","string","safelong","integer","double","boolean","binary"]);var Mqi=Vn.undiscriminatedUnion([gWo,Vn.string()]);var OWo=Vn.objectWithoutOptionalProperties({alias:Mqi,docs:Vn.string().optional()});var AWo=Vn.objectWithoutOptionalProperties({type:Mqi,docs:Vn.string().optional()});var Dqi=Vn.undiscriminatedUnion([Mqi,AWo]);var mWo=Vn.objectWithoutOptionalProperties({union:Vn.record(Vn.string(),Dqi)});var PWo=Vn.objectWithoutOptionalProperties({fields:Vn.record(Vn.string(),Dqi)});var jWo=Vn.objectWithoutOptionalProperties({value:Vn.string()}).extend(BGt);var wWo=Vn.undiscriminatedUnion([Vn.string(),jWo]);var EWo=Vn.objectWithoutOptionalProperties({values:Vn.list(wWo)});var SWo=Vn.undiscriminatedUnion([OWo,mWo,PWo,EWo]);var MWo=Vn.objectWithoutOptionalProperties({objects:Vn.record(Vn.string(),SWo).optional()});var DWo=Vn.objectWithoutOptionalProperties({conjureImports:Vn.property("conjure-imports",Vn.record(Vn.string(),Vn.string()).optional()),definitions:MWo.optional()});var BWo=Vn.enum_(["none","header"]);var m4n=Vn.undiscriminatedUnion([BWo,Vn.string()]);var IWo=Vn.enum_(["path","query","body"]);var CWo=Vn.objectWithoutOptionalProperties({paramType:Vn.property("param-type",IWo),type:Vn.string()}).extend(BGt);var qWo=Vn.undiscriminatedUnion([Vn.string(),CWo]);var TWo=Vn.objectWithoutOptionalProperties({http:Vn.string(),auth:m4n.optional(),args:Vn.record(Vn.string(),qWo).optional(),returns:Dqi.optional()}).extend(BGt);var RWo=Vn.objectWithoutOptionalProperties({name:Vn.string().optional(),package:Vn.string().optional(),basePath:Vn.property("base-path",Vn.string().optional()),defaultAuth:Vn.property("default-auth",m4n.optional()),endpoints:Vn.record(Vn.string(),TWo).optional()}).extend(BGt);var iS_=Vn.objectWithoutOptionalProperties({types:DWo.optional(),services:Vn.record(vWo,RWo).optional()});var o_c={};Kt(o_c,{ConjureArgument:()=>qWo,ConjureArgumentWithParamType:()=>CWo,ConjureAuthDefinition:()=>m4n,ConjureAuthDefinitionType:()=>BWo,ConjureEndpointDefinition:()=>TWo,ConjureParamType:()=>IWo,ConjureService:()=>RWo});var u_c={};Kt(u_c,{ConjureAliasDeclaration:()=>OWo,ConjureDefinitions:()=>MWo,ConjureEnumDeclaration:()=>EWo,ConjureEnumVariant:()=>wWo,ConjureEnumWithDocs:()=>jWo,ConjureObjectDeclaration:()=>PWo,ConjurePrimitive:()=>gWo,ConjureType:()=>Mqi,ConjureTypeDeclaration:()=>SWo,ConjureTypeReference:()=>Dqi,ConjureTypeWithDocs:()=>AWo,ConjureTypes:()=>DWo,ConjureUnionDeclaration:()=>mWo});var nS_=require("fs/promises");async function aS_(e,t){let r=[];for(let i of await eQ(e,t))r.push(await JEM({relativeFilepath:Ev(e,i),absoluteFilepath:i}));return r}async function JEM({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,nS_.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
1424
- `).replaceAll("<rid>","<string>").replaceAll("rid>","string>").replaceAll(": safelong",": long").replaceAll("<safelong>","<long>").replaceAll("safelong>","long>").replaceAll(": any",": unknown").replaceAll("<any>","<unknown>").replaceAll("any>","unknown>");return{relativeFilepath:e,absoluteFilepath:t,fileContents:zWo.conjure.DefinitionFile.parseOrThrow(Fi.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function oS_(e,t){if($EM(e))return t.alias(e);if(YEM(e))return t.enum(e);if(XEM(e))return t.object(e);if(ZEM(e))return t.union(e);vt(e)}function $EM(e){return e?.alias!=null}function YEM(e){return e?.values!=null}function XEM(e){return e?.fields!=null}function ZEM(e){return e?.union!=null}var Mwa=class extends cja{fernDefinitionBuilder=new qJi(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:i,globalHeaderOverrides:n}){if(r!=null){for(let[a,o]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:o});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(i!=null){for(let[a,o]of Object.entries(i.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:o});i["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(i["default-environment"]),i["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(i["default-url"])}return await uS_(t,(a,o,c)=>{for(let[u,l]of Object.entries(c.services??{})){let p=zro({value:u,suffix:"Service"});this.conjureFilepathToFernFilepath[o]=Ze.of(`${p}/__package__.yml`);return}let s=v9i(o)?.split(".")[0];s!=null&&(this.conjureFilepathToFernFilepath[o]=Ze.of(`${s}/__package__.yml`))}),await uS_(t,(a,o,c)=>{if(c.services==null||Object.keys(c.services??{}).length===0){let f=this.conjureFilepathToFernFilepath[o];if(f==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${o}`);for(let[s,u]of Object.entries(c.types?.conjureImports??{})){let l=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Ze.of(u)});this.fernDefinitionBuilder.addImport({file:f,fileToImport:Ze.of(l),alias:s})}this.importAllTypes({conjureFile:c,fernFilePath:f});return}for(let[f,s]of Object.entries(c.services)){let u=zro({value:f,suffix:"Service"}),l=Ze.of(`${u}/__package__.yml`),p={};s.basePath!=null&&(p["base-path"]=s.basePath),s.docs!=null&&(p.docs=s.docs),this.fernDefinitionBuilder.setServiceInfo(l,p),this.importAllTypes({conjureFile:c,fernFilePath:l});for(let[_,h]of Object.entries(c.types?.conjureImports??{})){let y=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Ze.of(h)});this.fernDefinitionBuilder.addImport({file:l,fileToImport:Ze.of(y),alias:_})}for(let[_,h]of Object.entries(s.endpoints??{})){let y=Bws(h.http);if(y.type==="failure"){this.context?.logger.error(`Failed to parse ${h.http}. Skipping.`);continue}let v={auth:(h.auth??s.defaultAuth)!==DE_.None,path:y.path,method:y.method,response:h.returns==="binary"?"file":h.returns};h.docs!=null&&(v.docs=h.docs);let O={};if(h.args!=null)for(let A of y.pathParameters){let g=h.args[A];if(g==null)throw new Error(`Failed to find path parameter ${A} in ${h.http}`);O[A]=typeof g=="string"?g:{type:g.type}}Object.entries(O).length>0&&(v["path-parameters"]=O);for(let[A,g]of Object.entries(h.args??{}))if(O[A]==null)if(typeof g=="string")v.request?typeof v.request=="string"&&(v.request={body:v.request}):v.request={},v.request.body=g==="binary"?"bytes":g;else switch(g.paramType){case"body":v.request={body:g.type==="binary"?"bytes":g.type};break;case"query":v.request==null?v.request={"query-parameters":{[A]:g.type}}:typeof v.request!="string"&&v.request?.["query-parameters"]==null?v.request["query-parameters"]={[A]:g.type}:typeof v.request!="string"&&v.request?.["query-parameters"]!=null&&(v.request["query-parameters"][A]=g.type)}v.request!=null&&typeof v.request!="string"&&v.request?.["query-parameters"]!=null&&(v.request.name=`${_}Request`),this.fernDefinitionBuilder.addEndpoint(l,{name:_,schema:v,source:void 0})}}}),this.fernDefinitionBuilder.build()}convertBinaryType(t){return typeof t=="string"?t==="binary"?{type:"string",validation:{format:"binary"}}:t:t.type==="binary"?{...t,type:"string",validation:{format:"binary"}}:t}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[i,n]of Object.entries(t.types?.definitions?.objects??{}))oS_(n,{alias:a=>{let o=a.alias==="binary"?{type:"string",validation:{format:"binary"}}:a.alias;this.fernDefinitionBuilder.addType(r,{name:i,schema:typeof o=="string"?{type:o,docs:a.docs}:{...o,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{properties:Object.fromEntries(Object.entries(a.fields).map(([o,c])=>[o,this.convertBinaryType(c)]))}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{union:Object.fromEntries(Object.entries(a.union).map(([o,c])=>{let f=this.convertBinaryType(c);return[o,{type:typeof f=="string"?f:f.type,docs:typeof f=="string"?void 0:f.docs,key:o}]}))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:i}){let n=Ft(hn(t),Ze.of(r)),a=mH(i,n),o=this.conjureFilepathToFernFilepath[a];if(o==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return o}};async function uS_(e,t){for(let r of await aS_(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function sS_(e,t){return bn(e,t)}var NWo=class extends _Ft{type="conjure";absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=Ft(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new rK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let n=await new Mwa(t).import({absolutePathToConjureFolder:this.absolutePathToConjureFolder,authOverrides:this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0,environmentOverrides:this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:Lr.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:n.rootApiFile["default-url"],contents:n.rootApiFile,rawContents:Fi.dump(n.rootApiFile)},namedDefinitionFiles:{...sS_(n.definitionFiles,a=>({absoluteFilepath:Lr.of("/DUMMY_PATH"),rawContents:Fi.dump(a),contents:a})),[Ze.of(ob)]:{absoluteFilepath:Lr.of("/DUMMY_PATH"),rawContents:Fi.dump(n.packageMarkerFile),contents:n.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};var MB_=ae(_S_(),1);var b_;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(b_||(b_={}));function hS_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function FWo(e,t){for(let[r,i]of KD(e))eSM({relativeFilepath:r,failure:i,logger:t})}function eSM({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case b_.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case b_.FILE_READ:r.error("Failed to open file: "+e);break;case b_.FILE_MISSING:r.error("Missing file: "+e);break;case b_.FILE_PARSE:t.error instanceof Fpa?r.error(oPe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case b_.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of tSM(i))r.error(oPe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case b_.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case b_.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${qio}: `+t.dependencyName);break;case b_.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case b_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case b_.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let i=t.error.error.instancePath.split("/").filter(n=>n!=="").map(hS_);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?i.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&i.push(t.error.error.params.additionalProperty),r.error(oPe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...i]}))}for(let i of t.error.allErrors)if(i!==t.error.error){let n=i.instancePath.split("/").filter(a=>a!=="").map(hS_);i.keyword==="required"&&i.params?.missingProperty?n.push(i.params.missingProperty):i.keyword==="additionalProperties"&&i.params?.additionalProperty&&n.push(i.params.additionalProperty),r.debug(oPe({title:i.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:vt(t)}}function tSM(e){switch(e.code){case Oi.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Lt.underline(e.expected)} but received ${Lt.underline(e.received)}`}];case Oi.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Lt.underline(t)}`}));case Oi.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Lt.underline(t)).join(", ")}`}];case Oi.invalid_union:case Oi.invalid_arguments:case Oi.invalid_return_type:case Oi.invalid_date:case Oi.invalid_string:case Oi.too_small:case Oi.too_big:case Oi.invalid_intersection_types:case Oi.not_multiple_of:case Oi.custom:default:return[{title:e.message}]}}var yS_=require("fs/promises");async function bS_(e,t){let r=[];for(let i of await eQ(e,t))r.push(await rSM({relativeFilepath:Ev(e,i),absoluteFilepath:i}));return r}async function rSM({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,yS_.readFile)(t)).toString()}}async function vS_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Fi.load(n.fileContents,{schema:Fi.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:b_.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}var Zhc=ae(TDi(),1);var bB_=require("fs"),K4n=require("fs/promises");var vB_=require("os"),gB_=ae(require("path"),1),OB_=require("stream/promises"),AB_=ae(Xhc(),1),mB_=ae(MW(),1);var CDM=Sbi();async function PB_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:o}){let c,f={type:b_.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?f={type:b_.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${QDM(s)}`},async u=>{switch(s.type){case"version":c=await NDM({context:u,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:o});return;case"local":c=await zDM({context:u,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:o});return;default:vt(s)}}),c!=null?{didSucceed:!0,definition:c}:{didSucceed:!1,failure:f}}var jB_="dependencies";var qDM="metadata.json",TDM=".fern";function RDM(e){return Ft(Lr.of((0,vB_.homedir)()),Ze.of(TDM),Ze.of(jB_),Ze.of(e.organization),Ze.of(e.apiName),Ze.of(e.version))}async function zDM({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let o=await a.workspace.getDefinition({context:t,relativePathToDependency:Ze.of(e.path)},i);return t.logger.info("Loaded..."),o}async function NDM({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=RDM(e),o=Ft(a,Ze.of(jB_)),c=Ft(a,Ze.of(qDM)),f;if(!await Ri(o)||!await Ri(c)){t.logger.info("Downloading manifest...");let l=await CDM.definitionRegistry.get(Zhc.FernFiddle.OrganizationId(e.organization),Zhc.FernFiddle.ApiId(e.apiName),e.version);if(!l.ok){l.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:y=>{t.failWithoutThrowing("Failed to download API manifest",y)}});return}let p=l.body.yamlSchemaVersion!=null?parseInt(l.body.yamlSchemaVersion):void 0,_=sJi(r),h=sJi(l.body.cliVersion);if(p!=null){if(p>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${l.body.cliVersion}`);return}else if(p<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(_.major!==h.major||_.minor!==h.minor){t.failWithoutThrowing(`CLI version is ${l.body.cliVersion}. Expected ${_.major}.${_.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+l.body.definitionS3DownloadUrl),await(0,K4n.mkdir)(o,{recursive:!0});try{await FDM({s3PreSignedReadUrl:l.body.definitionS3DownloadUrl,absolutePathToLocalOutput:o})}catch(y){t.failWithoutThrowing("Failed to download API",y);return}f=l.body,await(0,K4n.writeFile)(c,JSON.stringify(f))}else f=JSON.parse((await(0,K4n.readFile)(c)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:o,context:t,cliVersion:f.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function FDM({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await pB.get(e,{responseType:"stream"}),i=await mB_.default.dir(),n=gB_.default.join(i.path,"api.tgz");await(0,OB_.pipeline)(r.data,(0,bB_.createWriteStream)(n)),await(0,AB_.extract)({file:n,cwd:t})}function QDM(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:vt(e)}}async function wB_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let o={},c={},f={};return await Promise.all(KD(t.packageMarkers).map(async([s,u])=>{if(u.contents.export==null)o[s]=u;else{let{export:l,...p}=u.contents;if(VA(p)>0)f[s]={type:b_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let _=hn(s);if(XRt(t.namedDefinitionFiles).some(y=>y!==s&&y.startsWith(_)))f[s]={type:b_.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:_};else{let y=await PB_({dependencyName:typeof u.contents.export=="string"?u.contents.export:u.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});y.didSucceed?c[hn(s)]={definition:y.definition,url:typeof u.contents.export=="object"?u.contents.export.url:void 0}:f[s]=y.failure}}}})),VA(f)>0?{didSucceed:!1,failures:f}:{didSucceed:!0,packageMarkers:o,importedDefinitions:c}}var EB_=ae(require("path"),1);var khc={};Kt(khc,{additionalProperties:()=>WDM,default:()=>GDM,definitions:()=>xDM,properties:()=>LDM,required:()=>VDM,type:()=>UDM});var UDM="object",LDM={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},VDM=["name"],WDM=!1,xDM={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.AuthScope":{type:"string"},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.TokenBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},GDM={type:UDM,properties:LDM,required:VDM,additionalProperties:WDM,definitions:xDM};var eyc={};Kt(eyc,{additionalProperties:()=>JDM,default:()=>YDM,definitions:()=>$DM,properties:()=>KDM,type:()=>HDM});var HDM="object",KDM={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},JDM=!1,$DM={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},YDM={type:HDM,properties:KDM,additionalProperties:JDM,definitions:$DM};var tyc={};Kt(tyc,{additionalProperties:()=>kDM,default:()=>tBM,definitions:()=>eBM,properties:()=>ZDM,type:()=>XDM});var XDM="object",ZDM={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},kDM=!1,eBM={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},tBM={type:XDM,properties:ZDM,additionalProperties:kDM,definitions:eBM};function SB_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[o,c]of KD(e)){let f=c.contents,s=u=>{a[o]={type:b_.JSONSCHEMA_VALIDATION,error:u}};if(o===n1){let u=rzt(f,khc);if(u.success){let l=AD.serialization.RootApiFileSchema.parseOrThrow(f);r={defaultUrl:l["default-url"],contents:l,rawContents:c.rawContents}}else s(u)}else if(EB_.default.basename(o)===ob){let u=rzt(f,tyc);if(u.success){let l=AD.serialization.PackageMarkerFileSchema.parseOrThrow(f);n[o]={defaultUrl:typeof l.export=="object"?l.export.url:void 0,contents:l,rawContents:c.rawContents}}else s(u)}else{let u=rzt(f,eyc);if(u.success){let l=AD.serialization.DefinitionFileSchema.parseOrThrow(f);i[o]={defaultUrl:void 0,contents:l,rawContents:c.rawContents,absoluteFilePath:Ft(t,o)}}else s(u)}}return r==null?{didSucceed:!1,failures:{[Ze.of(n1)]:{type:b_.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var FGt=class extends _Ft{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,MB_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,o=Ft(this.absoluteFilePath,Ze.of(pR)),c=await vBs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),f=await bS_(o,"{yml,yaml}"),s=await vS_(f);if(!s.didSucceed)return FWo(s.failures,a.logger),a.failAndThrow();let u=SB_({files:s.files,absolutePathToDefinition:o});if(!u.didSucceed)return FWo(u.failures,a.logger),a.failAndThrow();let l=await wB_({dependenciesConfiguration:c,structuralValidationResult:u,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!l.didSucceed)return FWo(l.failures,a.logger),a.failAndThrow();let p={absoluteFilePath:o,rootApiFile:u.rootApiFile,namedDefinitionFiles:u.namedDefinitionFiles,packageMarkers:l.packageMarkers,importedDefinitions:l.importedDefinitions};r?.auth!=null&&(p={...p,rootApiFile:{...p.rootApiFile,contents:{...p.rootApiFile.contents,auth:r?.auth}}}),n=new rK({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:c,workspaceName:this.workspaceName,definition:p,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var nC_=require("fs/promises");var kI_=ae(ZI_(),1);async function pEa(e){return(await(0,kI_.convertObj)(e,{})).openapi}var tC_=require("fs/promises");var eC_=require("fs/promises");async function t3n({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:i}){let n=null;try{let a=(await(0,eC_.readFile)(e,"utf8")).toString();try{n=JSON.parse(a)}catch{n=Fi.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return Ews({data:t,overrides:n,allowNullKeys:i})}async function jyc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,tC_.readFile)(t)).toString(),n=await Fi.load(i);return r!=null?await t3n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var iC_=require("fs/promises");var hEa=ae(fWo(),1);var rC_=ae(fWo(),1),wyc=ae(require("path"),1),_Ea=class extends rC_.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let i=super.resolveExternalRef(t,r);return i.startsWith("http://")||i.startsWith("https://")||uzt(Lr.of(i))?i:this.absolutePathToOpenAPIOverrides!=null?wyc.default.resolve(wyc.default.dirname(this.absolutePathToOpenAPIOverrides),r):i}};async function Eyc({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,hEa.bundle)({...dWo,doc:{source:new hEa.Source(e,"<openapi>"),parsed:r},externalRefResolver:new _Ea(t)}):await(0,hEa.bundle)({...dWo,ref:e,externalRefResolver:new _Ea(t)})).bundle.parsed}function xIM(e,t){if(t.includes(e))return e;for(let r of t){let i=r.replace(/\{[^}]+\}/g,"([^/]+)");if(new RegExp(`^${i}$`).test(e))return r}}var GIM=["examples","example",Gi.EXAMPLES,JQ.REDOCLY_CODE_SAMPLES_CAMEL,JQ.REDOCLY_CODE_SAMPLES_KEBAB];async function yEa({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let i=await Eyc({absolutePathToOpenAPI:t}),n;r!=null?n=r:typeof i=="object"&&i[Gi.OPENAPI_OVERIDES_FILEPATH]!=null&&(n=Ft(hn(t),Ze.of(i[Gi.OPENAPI_OVERIDES_FILEPATH])));let a=i;n!=null&&(a=await t3n({absoluteFilePathToOverrides:n,context:e,data:a,allowNullKeys:GIM}));let o=Ft(hn(t),Ze.of("ai_examples_override.yml"));try{let c=await(0,iC_.readFile)(o,"utf-8"),f=Fi.load(c);if(f?.paths&&a.paths){for(let[s,u]of Object.entries(f.paths))if(u&&typeof u=="object")for(let[l,p]of Object.entries(u)){let _=l.toLowerCase(),h=a.paths[s];if(!h&&a.paths){let y=xIM(s,Object.keys(a.paths));y&&(h=a.paths[y],e.logger.debug(`Matched override path "${s}" to OpenAPI path "${y}" using pattern matching`))}if(h&&typeof h=="object"){let b=h[_];if(b&&typeof b=="object"){let v=b;!v["x-fern-examples"]&&p["x-fern-examples"]&&(v["x-fern-examples"]=p["x-fern-examples"],e.logger.debug(`Added AI examples for ${l.toUpperCase()} ${s} from override file`))}}}}e.logger.debug(`Processed AI examples from ${o}`)}catch{}return n!=null||a!==i?await Eyc({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a}):a}var CFt=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let i=[];for(let n of r)try{let a=(await(0,nC_.readFile)(n.absoluteFilepath)).toString(),o=Ev(this.absoluteFilePath,n.source.file);n.source.relativePathToDependency!=null&&(o=Ft(n.source.relativePathToDependency,o));let c=n.source.type==="protobuf"?xL.protobuf({file:o}):xL.openapi({file:o});if(a.includes("openapi")||a.includes("swagger"))try{let f=await yEa({absolutePathToOpenAPI:n.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:n.absoluteFilepathToOverrides});if(kpc(f)){i.push({type:"openapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}else if(Pwa(f)){(!f.schemes||f.schemes.length===0)&&(f.schemes=["https"]);let s=await pEa(f);i.push({type:"openapi",value:s,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}}catch(f){t.logger.debug(`Failed to parse OpenAPI document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("asyncapi"))try{let f=await jyc({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}catch(f){t.logger.error(`Failed to parse AsyncAPI document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("openrpc"))try{let f=await jyc({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}catch(f){t.logger.error(`Failed to parse OpenRPC document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}t.logger.warn(`${n.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`)}catch(a){t.logger.error(`Failed to read or process file ${n.absoluteFilepath}: ${a}. Skipping...`);continue}return i}};var HIM=Tt.object({type:Tt.string(),channelId:Tt.string().optional(),messageId:Tt.string(),value:Tt.any()}),KIM=Tt.object({summary:Tt.string().optional(),description:Tt.string().optional(),"query-parameters":Tt.record(Tt.string()).optional(),headers:Tt.record(Tt.string()).optional(),messages:Tt.array(HIM)}),aC_=Tt.array(KIM);var u9o=class extends kc{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:i,baseDir:n}){super({breadcrumbs:t??[],context:i}),this.channel=r,this.baseDir=n}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=aC_.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(i=>({summary:i.summary,description:i.description,queryParameters:i["query-parameters"],headers:i.headers,messages:i.messages.map(n=>({type:n.type,channelId:n.channelId,messageId:n.messageId,value:n.value}))}))}};var r3n=class extends Ra{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=i,this.channel=n,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:i}){let a=new u9o({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return a==null?{}:Object.fromEntries(a.map((o,c)=>[c.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:o.queryParameters,headers:o.headers,messages:o.messages.map(f=>({type:i==="v2"?f.type:f.messageId,body:f.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var Xqi=class extends VO.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:i,parameterNamePrefix:n}){super({context:t,breadcrumbs:r,parameter:i}),this.parameterNamePrefix=n}convert(){let t,r={},n=new I1.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},c=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:n}).convert();return c!=null&&(t=c.type,r=c.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var s9o=class extends kc{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var i3n=class extends kc{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var c9o=class extends r3n{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a})}convert(){let t=[],r=[],i=[],a=new i3n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:i}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let o;this.channel.subscribe!=null&&(o=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let c;this.channel.publish!=null&&(c=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let f=[];o!=null&&f.push(o),c!=null&&f.push(c);let u=new s9o({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),l=this.transformToValidPath(u??this.channelPath),p=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],_=mD(l),h=No(this.channelPath),y=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(h),displayName:a,baseUrl:p,path:_,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:f,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:l,baseUrl:p,asyncApiVersion:"v2"})}},audiences:y,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:i}){let n,a=i==="server"?"subscribe":"publish",o=[...this.breadcrumbs,a],c=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:o});c!=null&&(r.message=c);let f=Txi(No(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let u=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:r.message,schemaIdOverride:f}).convert();u!=null&&u.schema!=null&&(n=u.schema,this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let s=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:o});if(s!=null){let l=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:s,schemaIdOverride:f}).convert();l!=null&&l.schema!=null&&(n=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}}if(n!=null){let s=n,u=ni.named({fernFilepath:t.createFernFilepath(),name:s.typeDeclaration.name.name,typeId:s.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),l=uz.reference({bodyType:u,docs:r.description}),p=i==="server"?"subscribe":"publish";return{type:p,displayName:p,origin:i,body:l,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[i,n]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(a==null)continue;let c=new Xqi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:i,in:"path",description:a.description,required:a.required??!0}}).convert();c!=null&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type==="path"&&r.push(c.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let i=this.channel.bindings.ws.headers.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(o==null)continue;let f=new Xqi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"header",required:i.includes(n),schema:o,description:"description"in o?o.description:void 0}}).convert();f!=null&&f.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let i=this.channel.bindings.ws.query.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(o==null)continue;let f=new Xqi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"query",required:i.includes(n),schema:o,description:"description"in o?o.description:void 0,deprecated:o.deprecated??!1}}).convert();f!=null&&f.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}};var n3n=class extends Ra{servers;constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r}),this.servers=i}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[i,n]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,i,n);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:JE.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var l9o=class extends n3n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.url),docs:void 0}}};var Syc="$message.",oC_="#/channels/",uC_="#/servers/",f9o=class extends r3n{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a,operations:o}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}),this.operations=o}convert(){let t=[],r=[],i=[],a=new i3n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:this.channelPath});let o=Object.entries(this.operations).reduce((p,[_,h])=>{try{this.getChannelPathFromOperation(h)===this.channelPath&&(p[_]=h)}catch{}return p},{}),c=[];for(let[p,_]of Object.entries(o))for(let h of _.messages){let y=this.context.convertReferenceToTypeReference({reference:h});if(y.ok){let b=uz.reference({bodyType:y.reference,docs:_.description});c.push({type:p,displayName:p,origin:_.action==="send"?"client":"server",body:b,availability:this.context.getAvailability({node:_,breadcrumbs:this.breadcrumbs}),docs:_.description})}}let f=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],s=this.transformToValidPath(this.channel.address??this.channelPath),u=mD(s),l=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:f,path:u,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:s,baseUrl:f,asyncApiVersion:"v3"})}},audiences:l,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:n}){for(let a of Object.values(this.channel.parameters??{})){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(o==null)continue;let c=this.convertChannelParameterLocation(o.location);if(c==null)continue;let{type:f,parameterKey:s}=c,l=new Xqi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:s,in:f},parameterNamePrefix:this.channelPath}).convert();if(l!=null)switch(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type){case"path":t.push(l.parameter);break;case"query":r.push(l.parameter);break;case"header":i.push(l.parameter);break}}}convertChannelParameterLocation(t){try{let[r,i]=t.split("#/");if(r==null||i==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(Syc)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${Syc} prefix`,path:this.breadcrumbs});return}let n=r.substring(Syc.length);if(n!=="header"&&n!=="path"&&n!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${n}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return n==="payload"?{type:"query",parameterKey:i}:{type:n,parameterKey:i}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(uC_)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let i=r.$ref.substring(uC_.length);if(i==null){this.context.errorCollector.collect({message:`Failed to find server with name ${i}`,path:this.breadcrumbs});return}return i}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(oC_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(oC_.length)}};var d9o=class extends n3n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.host),docs:void 0}}};var bEa=class extends oFt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,i]of Object.entries(t.channels??{}))for(let[n,a]of Object.entries(i.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let o=["channels",r,"messages",n],c=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:o});if(!this.context.isMessageWithPayload(c))continue;let f=this.context.resolveMaybeReference({schemaOrReference:c.payload,breadcrumbs:o});if(f==null)continue;let s=`${r}_${n}`;this.convertSchema({id:s,breadcrumbs:o,schema:f})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let i=["components","messages",t],n=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:i});n!=null&&this.convertSchema({id:t,breadcrumbs:i,schema:n})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:i}){let a=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:i}).convert();a!=null&&this.addSchemaOutputToIr(t,a)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new d9o({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new l9o({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let n=new I1.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let c=this.context.spec.operations??{};a=new f9o({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t,operations:c}).convert()}else a=new c9o({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:n}),this.addTypesToIr(a.inlinedTypes))}}};var vEa=class extends wB{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a,o=t.$ref.match(/^.*\/schemas\/(.+)$/),c=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),f=t.$ref.match(/^.*\/messages\/(.+)$/);if(o&&o[1])return a=o[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a});if(c&&c[2]){let s=c[1],u=c[2];return a=`${s}_${u}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})}else return f&&f[1]?(a=f[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.title??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.name??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.messageId??o.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.messageId??o.value.name??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var _C_=ae(p9o(),1);var _9o=class extends kc{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};function sC_({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?Ra.OPTIONAL_STRING:Ra.STRING,env:r.env,v2Examples:r.optional?void 0:YIM({header:r,context:t}),availability:void 0,docs:void 0}))}function YIM({header:e,context:t}){let r=new R0e({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:i}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:i}}}var h9o=class extends VO.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var y9o=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:i,mediaType:n,description:a,required:o,group:c,method:f,streamingExtension:s,queryParameters:u}){super({context:t,breadcrumbs:r,group:c,method:f}),this.contentType=i,this.mediaType=n,this.description=a,this.required=o,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=s,this.queryParameters=u??[]}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(LA.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=LA.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=LA.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;return n?.type==="object"?this.hasBodyQueryParameterOverlap(n.properties)?{requestBody:LO.reference({contentType:t,docs:this.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}:{requestBody:LO.inlinedRequestBody({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:n.extendedProperties,extends:n.extends,properties:n.properties,extraProperties:n.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes})}:{requestBody:LO.reference({contentType:t,docs:this.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;if(n?.type==="object")return{requestBody:LO.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:n.properties.map(a=>{let o=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:o})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes}),examples:i.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:LO.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:i}){let{isFile:n,isOptional:a,isArray:o}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return n?o?CC.file($6.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):CC.file($6.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):CC.bodyProperty({...t,contentType:i?.contentType??r,style:ZIM({encoding:i}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(i==null)return;let n=i.properties?.[this.streamingExtension.streamConditionProperty];if(n==null||this.context.isReferenceObject(n))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!0,contentType:t,mediaTypeObject:r}),o=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||o==null))return{requestBody:o.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...o.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:i,contentType:n,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let o={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:i,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},c={...a,schema:o},f=this.parseMediaTypeObject({mediaTypeObject:c,schemaId:this.schemaId,contentType:n});if(f==null)return;let s=f.schema?.typeDeclaration.shape;if(s?.type==="object")return{requestBody:LO.inlinedRequestBody({contentType:n,docs:void 0,name:this.context.casingsGenerator.generateName(i?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:s.extendedProperties,extends:s.extends,properties:s.properties,extraProperties:s.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:c,exampleGenerationStrategy:"request"})}),inlinedTypes:f.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:i}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:i}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:i}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:i??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(i=>i.name.wireValue.toLowerCase()));return t.some(i=>r.has(i.name.wireValue.toLowerCase()))}},XIM={"application/json":"json"};function ZIM({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return XIM[e.contentType]}}var kIM=/{([^}]+)}/g,eCM=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),a3n=class extends Ra{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r}),this.operation=i,this.method=n,this.path=a}convertHttpMethod(){switch(this.method){case"get":return KP.Get;case"post":return KP.Post;case"put":return KP.Put;case"delete":return KP.Delete;case"patch":return KP.Patch;case"head":return KP.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],i=[],n=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n};for(let a of this.operation.parameters){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(o==null)continue;let f=new h9o({context:this.context,breadcrumbs:t,parameter:o}).convert();if(f!=null)switch(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},f.type){case"path":r.push(f.parameter);break;case"query":i.push(f.parameter);break;case"header":{let s=f.parameter.name.name.originalName,u=f.parameter.name.wireValue,l=!1,p=this.context.authOverrides?.["auth-schemes"];if(p!=null){for(let h of Object.values(p))if(nCM(h)&&h.header.toLowerCase()===u.toLowerCase()){l=!0;break}}let _=this.context.globalHeaderNames;if(_!=null){for(let h of _)if(h.toLowerCase()===u.toLowerCase()){l=!0;break}}!eCM.has(s.toLowerCase())&&!l&&n.push(f.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n}}checkMissingPathParameters(t){let i=[...this.path.matchAll(kIM)].map(n=>n[1]).filter(n=>!t.some(a=>a.name.originalName===n));for(let n of i){if(n==null)continue;let a=`${n}_example`;t.push({name:this.context.casingsGenerator.generateName(n),valueType:Ra.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:n})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:i,streamingExtension:n,queryParameters:a}){if(this.operation.requestBody==null)return;let o=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(o==null)return null;let c=[];for(let[f,s]of Object.entries(o.content)){let l=new y9o({context:this.context,breadcrumbs:t,contentType:f,mediaType:s,description:o.description,required:o.required,group:r??[],method:i,streamingExtension:n,queryParameters:a}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},c.push({requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}))}return c}computeGroupNameAndLocationFromExtensions(){let r=new I1.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,n=new I1.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:n,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?No(this.operation.summary):No(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let i=cC_(t),n=cC_(r);return r1(i,n)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:n})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:i,methodNameTokens:n}){if(r.some((c,f)=>c!==n[f]))return{group:[t],method:i};let o=n.slice(r.length);return{group:[t],method:No(o.join("_"))}}generateStringParameterExample({example:t}){let r=new VO.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:i}=r.convert();return i}};function cC_(e){let t=tCM(e)?rCM(e):iCM(e);return t=t.map(r=>r.toLowerCase()),t=$Oe(t),t}function tCM(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function rCM(e){return e.split(/(?=[A-Z])/)}function iCM(e){return e.split(/[^a-zA-Z0-9]+/)}function nCM(e){return e?.header!=null}var o3n=class extends a3n{constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=[...this.breadcrumbs,"Payload"],{headers:a,queryParameters:o}=this.convertParameters({breadcrumbs:n}),c=this.convertRequestBody({breadcrumbs:n,group:r,method:i,streamingExtension:void 0,queryParameters:o});if(c==null)return;let f=c[0]?.requestBody;if(f==null)return;let s;if(f.type==="inlinedRequestBody")s=VQ.inlinedPayload({name:f.name,extends:f.extends,properties:f.properties});else if(f.type==="reference")s=VQ.reference({payloadType:f.requestBodyType,docs:f.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${i}`,name:this.context.casingsGenerator.generateName(i),displayName:this.operation.summary,method:t,headers:a,payload:s,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,{name:r,payload:i}]))}};var Byc=ae(p9o(),1);var lC_=["get","post","put","delete","patch","head"];var b9o=class extends kc{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var aCM=Tt.object({cursor:Tt.string(),next_cursor:Tt.string(),results:Tt.string()}),oCM=Tt.object({offset:Tt.string(),results:Tt.string(),step:Tt.string().optional(),"has-next-page":Tt.string().optional()}),Myc=Tt.union([Tt.boolean(),aCM,oCM]);var Dyc="$request.",v9o="$response.",g9o=class extends kc{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i,context:n}){super({breadcrumbs:t,context:n}),this.operation=r,this.document=i}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Myc.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let i=this.getExtensionValue(this.document);if(i==null)return;if(typeof i=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let n=Myc.safeParse(i);if(!n.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:n.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:wB.maybeTrimPrefix(r.cursor,Dyc),nextCursor:wB.maybeTrimPrefix(r.next_cursor,v9o),results:wB.maybeTrimPrefix(r.results,v9o)};let i=t;return{type:"offset",offset:wB.maybeTrimPrefix(i.offset,Dyc),results:wB.maybeTrimPrefix(i.results,v9o),step:i.step!=null?wB.maybeTrimPrefix(i.step,Dyc):void 0,hasNextPage:i["has-next-page"]!=null?wB.maybeTrimPrefix(i["has-next-page"],v9o):void 0}}};var uCM="$request.",sCM=Tt.object({"stream-condition":Tt.string().optional(),format:Tt.enum(["sse","json"]).optional(),"stream-description":Tt.string().optional(),"response-stream":Tt.any(),response:Tt.any()}),cCM=Tt.union([Tt.boolean(),sCM]),O9o=class extends kc{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=cCM.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:wB.maybeTrimPrefix(r.data["stream-condition"],uCM),responseStream:r.data["response-stream"],response:r.data.response}}};var A9o=class extends kc{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var P9o=require("fs"),fC_=require("path");function lCM(e){return Xc(e)&&typeof e.$ref=="string"}function fCM(e,t){if(e!=null){if(typeof e=="string")return e;if(lCM(e)){let r=(0,fC_.resolve)(t??process.cwd(),e.$ref);if((0,P9o.existsSync)(r))try{return(0,P9o.readFileSync)(r,"utf-8")}catch{return}}}}var m9o=class extends kc{operation;baseDir;key="x-codeSamples";constructor({context:t,breadcrumbs:r,operation:i,baseDir:n}){super({breadcrumbs:r,context:t}),this.operation=i,this.baseDir=n}convert(){let t=Xc(this.operation)?this.operation:{},r=t["x-codeSamples"],i=t["x-code-samples"],n=Array.isArray(r)?r:[],a=Array.isArray(i)?i:[],o=[...n,...a];if(o.length===0)return;let c=[];for(let f of o){if(!Xc(f))continue;let s=f,u=s.lang,l=s.label,p=s.source;if(typeof u!="string")continue;let _=fCM(p,this.baseDir);_!=null&&c.push({name:typeof l=="string"?l:u,language:u,code:_,install:void 0,docs:void 0})}if(c.length!==0)return[{"code-samples":c}]}};var w9o=require("fs"),dC_=require("path");function dCM(e){return Xc(e)&&typeof e.$ref=="string"}function pCM(e,t){if(e!=null){if(typeof e=="string")return e;if(dCM(e)){let r=(0,dC_.resolve)(t??process.cwd(),e.$ref);if((0,w9o.existsSync)(r))try{return(0,w9o.readFileSync)(r,"utf-8")}catch{return}}}}function _CM(e,t){if(!Array.isArray(e))return[];let r=[];for(let i of e){if(!Xc(i))continue;let a=pCM(i.code,t);a!=null&&r.push({...i,code:a})}return r}var j9o=class extends kc{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:i,baseDir:n}){super({breadcrumbs:r,context:t}),this.operation=i,this.baseDir=n}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(a=>{if(!Xc(a))return a;let c=a["code-samples"];if(c!=null){let f=_CM(c,this.baseDir);return{...a,"code-samples":f}}return a}).filter(a=>{let o=AD.serialization.ExampleEndpointCallSchema.parse(a);return o.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),o.ok})}};var gEa=class extends kc{document;key="x-fern-explorer";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}};var OEa=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:i,group:n,method:a,statusCode:o,streamingExtension:c}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseBody=i,this.statusCode=o,this.streamingExtension=c}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,i=[...this.group,this.method,"Response",this.statusCode].join("_"),n=`${i}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:n}),o=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:i});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:o})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let i of r){let n=this.responseBody.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:n,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(a=>a.includes("json"));for(let a of r){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null&&this.shouldReturnJsonResponse(a))return this.returnJsonResponse({mediaTypeObject:o,convertedSchema:c})}let i=Object.keys(this.responseBody.content??{}).filter(a=>!a.includes("json"));for(let a of i){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null){if(this.isBinarySchema(c))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:o}):this.returnFileDownloadResponse({mediaTypeObject:o});if(this.shouldReturnTextResponse(a))return this.returnTextResponse({mediaTypeObject:o})}}let n=parseInt(this.statusCode);if(!isNaN(n)&&n>=200&&n<300){let a={schema:{type:"object",description:"Empty response body"}},o=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:"application/json",resolveSchema:!0});if(o!=null)return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:o})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let i=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(i=this.streamingExtension.streamDescription),{responseBody:cy.json(iz.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:cy.streaming(nz.json({docs:i,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:cy.streaming(nz.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:cy.streaming(nz.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:cy.json(iz.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:cy.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:cy.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:cy.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return LA.parse(t)?.isText()??!1}};var E9o=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;isWildcardStatusCode;constructor({context:t,breadcrumbs:r,responseError:i,group:n,method:a,methodName:o,statusCode:c,isWildcardStatusCode:f}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseError=i,this.statusCode=c,this.methodName=o,this.isWildcardStatusCode=f}convert(){if(!this.responseError.content){let i=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(i==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let n=this.getErrorIdFromErrorName(i);return{error:{error:{name:this.context.casingsGenerator.generateName(n),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:n},docs:this.responseError.description},errorType:ni.unknown(),displayName:i,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(i=>i.includes("json")),r=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let i of[...t]){let n=this.responseError.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:pC_(`${this.methodName}Request${r}`),contentType:i});if(a==null)continue;let o=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:i,convertedSchema:n}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:i,errorId:r},docs:this.responseError.description},errorType:n.type,displayName:t,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:n.inlinedTypes,examples:n.examples}}getErrorNameForStatusCode(t,r){if(r){if(t===400)return"ClientRequestError";if(t===500)return"ServerError"}return nQo[t]}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?pC_(`${this.methodName}Request${t}`):t}};function pC_(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var S9o=class e extends a3n{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a,idempotent:o,idToAuthScheme:c,topLevelServers:f,streamingExtension:s}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a}),this.idempotent=o,this.idToAuthScheme=c,this.topLevelServers=f,this.streamingExtension=s}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=this.getGroupDisplayName(r),{headers:a,pathParameters:o,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),f=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:i,streamingExtension:this.streamingExtension,queryParameters:c}),s=f?.[0]?.requestBody,u=f?.[0]?.streamRequestBody,l={requestBodies:f?.map(H=>H.requestBody)},p=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:i,streamingExtension:this.streamingExtension}),_=p?.response,h=p?.streamResponse,y=p!=null?p.errors:[],b={},v=y.map(H=>H.error),O=mD(this.path),A=this.getEndpointBaseUrl(),g=this.getEndpointBaseUrls(),m=this.convertExamples({httpPath:O,httpMethod:t,baseUrl:A}),j=new Set(this.operation.security?.flatMap(H=>Object.keys(H))??[]),M=this.authSchemeToHeaders(Array.from(j));M.length>0&&a.push(...M);for(let H of y){let ue=H.error,se=H.errorType,x=ue.error.errorId,G=H.examples;b[x]={name:ue.error,displayName:H.displayName,discriminantValue:{name:ue.error.name,wireValue:x},type:se,statusCode:H.statusCode,isWildcardStatusCode:H.isWildcardStatusCode,docs:ue.docs,examples:[],v2Examples:{userSpecifiedExamples:G??{},autogeneratedExamples:{}}}}let E=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],B=new gEa({context:this.context,breadcrumbs:this.breadcrumbs,document:this.context.spec}).convert(),T=new gEa({context:this.context,breadcrumbs:this.breadcrumbs,document:this.operation}).convert()??B,R={displayName:this.operation.summary,method:t,baseUrl:A,v2BaseUrls:g,path:O,pathParameters:o,queryParameters:c,headers:a.filter((H,ue,se)=>ue===se.findIndex(x=>x.name.wireValue===H.name.wireValue)),sdkRequest:void 0,errors:v,auth:this.operation.security!=null||this.context.spec.security!=null,security:this.operation.security??this.context.spec.security,availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:O,allPathParameters:o,pagination:void 0,transport:void 0,source:CL.openapi(),audiences:E,retries:void 0,apiPlayground:T},Q=this.context.namespace!=null?[this.context.namespace]:[],U=r?.map(H=>No(H));return Q.push(...U??[]),{audiences:E,group:r,groupDisplayName:n,errors:b,endpoint:{...R,id:`endpoint_${Q.join("/")}.${i}`,name:this.context.casingsGenerator.generateName(i),requestBody:s,v2RequestBodies:l,response:_,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:m.examples},v2Responses:{responses:p?.v2Responses}},streamEndpoint:h!=null&&h.body!=null?{...R,id:`endpoint_${Q.join("/")}.${i}_stream`,name:this.context.casingsGenerator.generateName(`${i}_stream`),requestBody:u,v2RequestBodies:void 0,response:h,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:m.streamExamples},v2Responses:{responses:[{statusCode:200,isWildcardStatusCode:void 0,body:h.body}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.responses==null)return;let a,o=!1;for(let[c,f]of Object.entries(this.operation.responses)){let s=/^[45]XX$/i.test(c),u,l=!1;if(s)u=parseInt(c.charAt(0))*100,l=!0;else{if(u=parseInt(c),isNaN(u)||u<200||u>=300&&u<400)continue;l=u>=400&&u<600}if(a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}}),u>=200&&u<300){let p=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(p==null)continue;let h=new OEa({context:this.context,breadcrumbs:[...t,c],responseBody:p,group:r??[],method:i,statusCode:c,streamingExtension:n}).convert();h!=null&&(this.inlinedTypes={...this.inlinedTypes,...h.inlinedTypes},o||(o=!0,a.response={statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.responseBody},a.streamResponse={statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.streamResponseBody}),a.v2Responses=[...a.v2Responses??[],{statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.responseBody}])}if(l){let p=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(p==null)continue;let h=new E9o({context:this.context,breadcrumbs:[...t,c],responseError:p,group:r??[],method:i,methodName:this.evaluateMethodNameFromOperation(),statusCode:u,isWildcardStatusCode:s?!0:void 0}).convert();h!=null&&(this.inlinedTypes={...this.inlinedTypes,...h.inlinedTypes},a.errors.push(h))}}if(this.streamingExtension!=null){a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}});let f=new OEa({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:i,statusCode:"stream",streamingExtension:n}).convert();f!=null&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},a.response={statusCode:200,isWildcardStatusCode:void 0,body:f.responseBody},a.streamResponse={statusCode:200,isWildcardStatusCode:void 0,body:f.streamResponseBody},a.v2Responses=[{statusCode:200,isWildcardStatusCode:void 0,body:f.responseBody}])}return a}authSchemeToHeaders(t){let r=[];for(let i of t){let n=this.idToAuthScheme?.[i];if(n==null)continue;let a={valueType:Ra.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(n.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:n.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:i}){let a=new j9o({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],c=new m9o({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],s=a.some(u=>Array.isArray(u["code-samples"])&&u["code-samples"].length>0)?a:[...a,...c];return s.length===0?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:s}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:s}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){let a=n.filter(s=>!(s.response!=null&&"stream"in s.response)),o=n.filter(s=>s.response!=null&&"stream"in s.response),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),f=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:o});return{examples:c,streamExamples:f}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){return Object.fromEntries(n.map((a,o)=>[this.getExampleName({example:a,exampleIndex:o}),{displayName:void 0,request:a.request!=null||a["path-parameters"]!=null||a["query-parameters"]!=null||a.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request??void 0}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(c=>{let f=("language"in c?c.language:c.sdk)??void 0;return{name:c.name,docs:void 0,language:f,code:c.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return br.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return br.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new I1.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${Gi.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let i=this.operation.servers?.[0];if(i==null)return;let a=this.topLevelServers?.find(o=>o.url===i.url)??i;return Ahe.getServerName({server:a,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(i=>{let a=this.topLevelServers?.find(o=>o.url===i.url)??i;return Ahe.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(i=>`${r[i.pathParameter]?.toString()??i.pathParameter}${i.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(i=>i.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let i=t?.[t.length-1];if(i!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===i?r:void 0}};var M9o=class extends Ra{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:i,path:n,idToAuthScheme:a,topLevelServers:o}){super({context:t,breadcrumbs:r}),this.pathItem=i,this.path=n,this.idToAuthScheme=a,this.topLevelServers=o}convert(){let t=[],r=[],i={};for(let n of lC_){let a=this.pathItem[n];if(a==null)continue;let o=[...this.breadcrumbs,n],c=this.tryParseAsWebhook({operationBreadcrumbs:o,operation:a,method:n,context:this.context});if(c!=null){r.push(c),Object.assign(i,c.inlinedTypes);continue}let s=new O9o({breadcrumbs:o,operation:a,context:this.context}).convert(),u=this.tryParseAsHttpEndpoint({operationBreadcrumbs:o,operation:a,method:n,streamingExtension:s});u!=null&&(t.push(u),Object.assign(i,u.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:i}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n}){return new A9o({breadcrumbs:i,operation:t,context:n}).convert()?new o3n({context:this.context,breadcrumbs:i,operation:t,method:Byc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,streamingExtension:n}){new g9o({breadcrumbs:i,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let f=new b9o({breadcrumbs:i,operation:t,context:this.context}).convert();return new S9o({context:this.context,breadcrumbs:i,operation:t,method:Byc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:f,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:n}).convert()}};var D9o=class extends Ra{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:i,schemeId:n}){super({context:t,breadcrumbs:r}),this.securityScheme=i,this.schemeId=n}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return wA.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return wA.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return wA.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:Ra.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return wA.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var AEa=class extends oFt{constructor({breadcrumbs:t,context:r,audiences:i}){super({breadcrumbs:t,context:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:i}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(i),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new _9o({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let i=sC_({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(i),this.context.setGlobalHeaders(i)}}convertSecuritySchemes(){if(this.context.authOverrides){this.addAuthToIR(cac({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator}));return}let t=[];for(let[r,i]of Object.entries(this.context.spec.components?.securitySchemes??{})){let n=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:["components","securitySchemes",r]});if(n==null)continue;let o=new D9o({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:n,schemeId:r}).convert();o!=null&&t.push(o)}t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let n=oPa({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return n!=null&&this.addEnvironmentsToIr({environmentConfig:n.environmentsConfig,audiences:n.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let i=new Ahe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&this.addSchemaOutputToIr(t,n)}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,n=new o3n({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:_C_.OpenAPIV3.HttpMethods.POST,path:r}).convert();n!=null&&(this.addWebhookToIr({webhook:n.webhook,operationId:r,audiences:n.audiences,group:n.group}),this.addTypesToIr(n.inlinedTypes))}}convertPaths(){let t=[],r={};for(let[i,n]of Object.entries(this.context.spec.paths??{})){if(n==null)continue;let o=new M9o({context:this.context,breadcrumbs:["paths",i],topLevelServers:this.context.spec.servers,pathItem:n,path:i}).convert();if(o!=null){for(let c of o.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),c.servers)for(let f of c.servers)this.shouldAddServerToCollectedServers({server:f,currentServers:t})&&t.push(f);if(c.errors)for(let[f,s]of Object.entries(c.errors))r[f]=s}for(let c of o.webhooks){let f=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:f.join("."),group:f,audiences:c.audiences})}this.addTypesToIr(o.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}};var B9o=class extends kc{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:i}){super({breadcrumbs:t,context:i}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var mEa=class extends wB{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;n==="reference_identifier"?c=i??o.value.title:n==="discriminator_key"?c=o.value.title??i:n==="schema_identifier"&&(c=o.value.title);let f;if(a.includes("/")){let u=new VO.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:o.value,id:a}).convert();u!=null&&(f={[a]:u.convertedSchema})}return{ok:!0,reference:ni.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:c}),inlinedTypes:f}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let n=new B9o({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=n}return this.tagToDisplayName[t]??t}};var hCM=Tt.object({description:Tt.string().optional(),required:Tt.boolean().optional(),deprecated:Tt.boolean().optional(),allowEmptyValue:Tt.boolean().optional(),style:Tt.string().optional(),explode:Tt.boolean().optional(),allowReserved:Tt.boolean().optional(),schema:Tt.any().optional(),example:Tt.any().optional(),examples:Tt.record(Tt.string(),Tt.any()).optional(),content:Tt.record(Tt.string(),Tt.any()).optional()}),yCM=hCM.extend({name:Tt.string(),in:Tt.string()}),bCM=Tt.array(yCM),I9o=class extends kc{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return bCM.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var C9o=class extends Ra{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:i,pathParameters:n=[],queryParameters:a=[],headers:o=[],topLevelServers:c=[]}){super({context:t,breadcrumbs:r}),this.method=i,this.pathParameters=n,this.queryParameters=a,this.headers=o,this.topLevelServers=c}convert(){let t={},r="";for(let s of this.pathParameters)r+=`/{${s.name.originalName}}`;let i=mD(r),n=[];for(let[s,u]of this.method.params.entries()){let l;if(this.context.isReferenceObject(u)){let y=this.context.resolveReference({reference:u});if(y.resolved)l=y.value;else continue}else l=u;let p=[this.method.name,"Param",l.name].join("_"),h=new VO.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",l.name],schemaIdOverride:p,context:this.context,schemaOrReference:l.schema,wrapAsOptional:!l.required}).convert();h!=null&&(n.push({docs:l.description,availability:this.context.getAvailability({node:u,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:l.name,wireValue:l.name}),valueType:h.type,v2Examples:h.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...h.inlinedTypes,...t,...h.schema!=null?{[p]:h.schema}:{}})}let a;if(this.method.result!=null){let s=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(s!=null){let u=new VO.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:s.schema}),l=[this.method.name,"Result"].join("_"),p=u.convert();p!=null&&(a={docs:s.description,v2Examples:p.schema?.typeDeclaration.v2Examples,responseBodyType:p.type},t={...p.inlinedTypes,...t,...p.schema!=null?{[l]:p.schema}:{}})}}let o=this.getEndpointBaseUrls(),c=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:o,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:i,fullPath:i,requestBody:n.length>0?LO.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:n,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:a!=null?{body:cy.json(iz.response(a)),statusCode:void 0,isWildcardStatusCode:void 0}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:CL.openrpc(),audiences:c,retries:void 0,apiPlayground:void 0},audiences:c,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(i=>i.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(i=>{if(this.topLevelServers.find(c=>c.name===i.name&&c.url!==i.url)!=null)return i.url;let o=this.topLevelServers.find(c=>c.url===i.url)??i;return Ahe.getServerName({server:o,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let i of this.method.examples??[]){let n;if(this.context.isReferenceObject(i)){let f=this.context.resolveReference({reference:i});if(f.resolved)n=f.value;else continue}else n=i;let a;if(n.result)if(this.context.isReferenceObject(n.result)){let f=this.context.resolveReference({reference:n.result});f.resolved&&(a=f.value)}else a=n.result;let o=n.name??`Example ${r+1}`,c=[];if(n.params&&Array.isArray(n.params)){c=[];for(let f of n.params)if(this.context.isReferenceObject(f)){let s=this.context.resolveReference({reference:f});if(s.resolved)c.push(s.value);else continue}else c.push(f)}t[o]={displayName:void 0,request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:c.map(f=>f.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?br.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:n.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var q9o=class extends VO.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let n=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();n!=null&&(t=n.type,r=n.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var PEa=class extends oFt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let i=new Ahe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&this.addSchemaOutputToIr(t,n)}}convertMethods(){let t=[],i=new I9o({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),n=[],a=[],o=[];if(i&&i.length>0)for(let[f,s]of i.entries()){let l=new q9o({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${f}]`],parameter:s}).convert();if(l!=null)switch(l.type){case"path":{n.push(l.parameter);break}case"query":{a.push(l.parameter);break}case"header":{o.push(l.parameter);break}}}let c=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let f of this.context.spec.methods??[]){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:["methods"]});if(s==null)continue;let l=new C9o({context:this.context,breadcrumbs:["methods"],method:s,pathParameters:n,queryParameters:a,headers:o,topLevelServers:this.context.spec.servers}).convert();if(l!=null&&(this.addEndpointToIr({endpoint:l.endpoint,audiences:l.audiences,endpointGroup:c,serviceName:"service_root"}),this.addTypesToIr(l.inlinedTypes),l.servers))for(let p of l.servers)this.shouldAddServerToCollectedServers({server:p,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(p))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(i=>i.name===t.name&&i.url!==t.url)?{...t,name:t.url}:t}};var jEa=class extends wB{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.title??i),{ok:!0,reference:ni.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var i1_=require("fs/promises");var hC_={[wn.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,QP(e)])),[wn.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[wn.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[wn.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[wn.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[wn.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[wn.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[wn.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[wn.GenerationLanguage.SWIFT]:new Set([])};var vCM=["go","ruby"];function z9o({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let o=l=>({unsafeName:l,safeName:gCM({name:l,keywords:OCM({generationLanguage:e,keywords:t})})}),c=No(n),f=QP(c),s=qxi(n),u=Dxi(c);return r&&(!PCM(u)&&(e==null||vCM.includes(e))&&(c=u.map((l,p)=>{if(p>0){let _=T9o(l);if(_!=null)return _;if(R9o(l))return l.toUpperCase()}return l}).join(""),f=QP(u.map((l,p)=>{let _=T9o(l);return _??(R9o(l)?l.toUpperCase():p===0?QP(l):l)}).join(""))),s=n.split(" ").map(l=>l.split(/(\d+)/).map(qxi).join("")).join("_")),{originalName:n,camelCase:o(a?.casingOverrides?.camel??c),snakeCase:o(a?.casingOverrides?.snake??s),screamingSnakeCase:o(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:o(a?.casingOverrides?.pascal??f)}},generateNameAndWireValue:({name:n,wireValue:a,opts:o})=>({name:i.generateName(n,o),wireValue:a})};return i}function gCM({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":mCM(e)?"_"+e:e}function OCM({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return hC_[e]}var ACM=/^[0-9]/;function mCM(e){return ACM.test(e)}function PCM(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=T9o(i)!=null||R9o(i),a=T9o(t)!=null||R9o(t);return n&&a})}function T9o(e){return wCM.get(e.toUpperCase())}function R9o(e){return jCM.has(e.toUpperCase())}var jCM=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),wCM=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var yC_=require("fs/promises");async function Iyc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,yC_.readFile)(t)).toString(),n;try{n=JSON.parse(i)}catch{n=Fi.load(i)}return r!=null?await t3n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var xq_=ae(Wq_(),1);function kqi(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...o}={}){let c=n.reduce((s,u)=>({...s,[u]:"<redacted>"}),a),f=[t,...r].join(" ");for(let[s,u]of Object.entries(c))f=f.replaceAll(s,u);return e?.debug(`+ ${f}`),(0,xq_.default)(t,r,o)}async function Jg(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...o}={}){let c=kqi(e,t,r,{doNotPipeOutput:i,secrets:n,substitutions:a,...o});i||(c.stdout?.pipe(process.stdout),c.stderr?.pipe(process.stderr));let f=await c;return f.stdout==null&&(f.stdout=""),f.stderr==null&&(f.stderr=""),f}function e1i(e,{logger:t,...r}={}){return(i,n)=>Jg(t,e,i,{...r,...n})}var Lhe=require("fs/promises"),kq_=ae(require("path"),1),Jyc=ae(MW(),1);var Gq_="buf.gen.yaml",v1M="output",Hq_=`${v1M}/ir.json`,Kq_="protoc-gen-fern",Jq_=`version: v1
1424
+ `).replaceAll("<rid>","<string>").replaceAll("rid>","string>").replaceAll(": safelong",": long").replaceAll("<safelong>","<long>").replaceAll("safelong>","long>").replaceAll(": any",": unknown").replaceAll("<any>","<unknown>").replaceAll("any>","unknown>");return{relativeFilepath:e,absoluteFilepath:t,fileContents:zWo.conjure.DefinitionFile.parseOrThrow(Fi.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function oS_(e,t){if($EM(e))return t.alias(e);if(YEM(e))return t.enum(e);if(XEM(e))return t.object(e);if(ZEM(e))return t.union(e);vt(e)}function $EM(e){return e?.alias!=null}function YEM(e){return e?.values!=null}function XEM(e){return e?.fields!=null}function ZEM(e){return e?.union!=null}var Mwa=class extends cja{fernDefinitionBuilder=new qJi(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:i,globalHeaderOverrides:n}){if(r!=null){for(let[a,o]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:o});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(i!=null){for(let[a,o]of Object.entries(i.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:o});i["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(i["default-environment"]),i["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(i["default-url"])}return await uS_(t,(a,o,c)=>{for(let[u,l]of Object.entries(c.services??{})){let p=zro({value:u,suffix:"Service"});this.conjureFilepathToFernFilepath[o]=Ze.of(`${p}/__package__.yml`);return}let s=v9i(o)?.split(".")[0];s!=null&&(this.conjureFilepathToFernFilepath[o]=Ze.of(`${s}/__package__.yml`))}),await uS_(t,(a,o,c)=>{if(c.services==null||Object.keys(c.services??{}).length===0){let f=this.conjureFilepathToFernFilepath[o];if(f==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${o}`);for(let[s,u]of Object.entries(c.types?.conjureImports??{})){let l=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Ze.of(u)});this.fernDefinitionBuilder.addImport({file:f,fileToImport:Ze.of(l),alias:s})}this.importAllTypes({conjureFile:c,fernFilePath:f});return}for(let[f,s]of Object.entries(c.services)){let u=zro({value:f,suffix:"Service"}),l=Ze.of(`${u}/__package__.yml`),p={};s.basePath!=null&&(p["base-path"]=s.basePath),s.docs!=null&&(p.docs=s.docs),this.fernDefinitionBuilder.setServiceInfo(l,p),this.importAllTypes({conjureFile:c,fernFilePath:l});for(let[_,h]of Object.entries(c.types?.conjureImports??{})){let y=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Ze.of(h)});this.fernDefinitionBuilder.addImport({file:l,fileToImport:Ze.of(y),alias:_})}for(let[_,h]of Object.entries(s.endpoints??{})){let y=Bws(h.http);if(y.type==="failure"){this.context?.logger.error(`Failed to parse ${h.http}. Skipping.`);continue}let v={auth:(h.auth??s.defaultAuth)!==DE_.None,path:y.path,method:y.method,response:h.returns==="binary"?"file":h.returns};h.docs!=null&&(v.docs=h.docs);let O={};if(h.args!=null)for(let A of y.pathParameters){let g=h.args[A];if(g==null)throw new Error(`Failed to find path parameter ${A} in ${h.http}`);O[A]=typeof g=="string"?g:{type:g.type}}Object.entries(O).length>0&&(v["path-parameters"]=O);for(let[A,g]of Object.entries(h.args??{}))if(O[A]==null)if(typeof g=="string")v.request?typeof v.request=="string"&&(v.request={body:v.request}):v.request={},v.request.body=g==="binary"?"bytes":g;else switch(g.paramType){case"body":v.request={body:g.type==="binary"?"bytes":g.type};break;case"query":v.request==null?v.request={"query-parameters":{[A]:g.type}}:typeof v.request!="string"&&v.request?.["query-parameters"]==null?v.request["query-parameters"]={[A]:g.type}:typeof v.request!="string"&&v.request?.["query-parameters"]!=null&&(v.request["query-parameters"][A]=g.type)}v.request!=null&&typeof v.request!="string"&&v.request?.["query-parameters"]!=null&&(v.request.name=`${_}Request`),this.fernDefinitionBuilder.addEndpoint(l,{name:_,schema:v,source:void 0})}}}),this.fernDefinitionBuilder.build()}convertBinaryType(t){return typeof t=="string"?t==="binary"?{type:"string",validation:{format:"binary"}}:t:t.type==="binary"?{...t,type:"string",validation:{format:"binary"}}:t}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[i,n]of Object.entries(t.types?.definitions?.objects??{}))oS_(n,{alias:a=>{let o=a.alias==="binary"?{type:"string",validation:{format:"binary"}}:a.alias;this.fernDefinitionBuilder.addType(r,{name:i,schema:typeof o=="string"?{type:o,docs:a.docs}:{...o,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{properties:Object.fromEntries(Object.entries(a.fields).map(([o,c])=>[o,this.convertBinaryType(c)]))}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{union:Object.fromEntries(Object.entries(a.union).map(([o,c])=>{let f=this.convertBinaryType(c);return[o,{type:typeof f=="string"?f:f.type,docs:typeof f=="string"?void 0:f.docs,key:o}]}))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:i}){let n=Ft(hn(t),Ze.of(r)),a=mH(i,n),o=this.conjureFilepathToFernFilepath[a];if(o==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return o}};async function uS_(e,t){for(let r of await aS_(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function sS_(e,t){return bn(e,t)}var NWo=class extends _Ft{type="conjure";absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=Ft(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new rK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let n=await new Mwa(t).import({absolutePathToConjureFolder:this.absolutePathToConjureFolder,authOverrides:this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0,environmentOverrides:this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:Lr.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:n.rootApiFile["default-url"],contents:n.rootApiFile,rawContents:Fi.dump(n.rootApiFile)},namedDefinitionFiles:{...sS_(n.definitionFiles,a=>({absoluteFilepath:Lr.of("/DUMMY_PATH"),rawContents:Fi.dump(a),contents:a})),[Ze.of(ob)]:{absoluteFilepath:Lr.of("/DUMMY_PATH"),rawContents:Fi.dump(n.packageMarkerFile),contents:n.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};var MB_=ae(_S_(),1);var b_;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(b_||(b_={}));function hS_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function FWo(e,t){for(let[r,i]of KD(e))eSM({relativeFilepath:r,failure:i,logger:t})}function eSM({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case b_.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case b_.FILE_READ:r.error("Failed to open file: "+e);break;case b_.FILE_MISSING:r.error("Missing file: "+e);break;case b_.FILE_PARSE:t.error instanceof Fpa?r.error(oPe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case b_.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of tSM(i))r.error(oPe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case b_.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case b_.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${qio}: `+t.dependencyName);break;case b_.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case b_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case b_.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let i=t.error.error.instancePath.split("/").filter(n=>n!=="").map(hS_);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?i.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&i.push(t.error.error.params.additionalProperty),r.error(oPe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...i]}))}for(let i of t.error.allErrors)if(i!==t.error.error){let n=i.instancePath.split("/").filter(a=>a!=="").map(hS_);i.keyword==="required"&&i.params?.missingProperty?n.push(i.params.missingProperty):i.keyword==="additionalProperties"&&i.params?.additionalProperty&&n.push(i.params.additionalProperty),r.debug(oPe({title:i.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:vt(t)}}function tSM(e){switch(e.code){case Oi.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Lt.underline(e.expected)} but received ${Lt.underline(e.received)}`}];case Oi.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Lt.underline(t)}`}));case Oi.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Lt.underline(t)).join(", ")}`}];case Oi.invalid_union:case Oi.invalid_arguments:case Oi.invalid_return_type:case Oi.invalid_date:case Oi.invalid_string:case Oi.too_small:case Oi.too_big:case Oi.invalid_intersection_types:case Oi.not_multiple_of:case Oi.custom:default:return[{title:e.message}]}}var yS_=require("fs/promises");async function bS_(e,t){let r=[];for(let i of await eQ(e,t))r.push(await rSM({relativeFilepath:Ev(e,i),absoluteFilepath:i}));return r}async function rSM({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,yS_.readFile)(t)).toString()}}async function vS_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Fi.load(n.fileContents,{schema:Fi.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:b_.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}var Zhc=ae(TDi(),1);var bB_=require("fs"),K4n=require("fs/promises");var vB_=require("os"),gB_=ae(require("path"),1),OB_=require("stream/promises"),AB_=ae(Xhc(),1),mB_=ae(MW(),1);var CDM=Sbi();async function PB_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:o}){let c,f={type:b_.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?f={type:b_.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${QDM(s)}`},async u=>{switch(s.type){case"version":c=await NDM({context:u,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:o});return;case"local":c=await zDM({context:u,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:o});return;default:vt(s)}}),c!=null?{didSucceed:!0,definition:c}:{didSucceed:!1,failure:f}}var jB_="dependencies";var qDM="metadata.json",TDM=".fern";function RDM(e){return Ft(Lr.of((0,vB_.homedir)()),Ze.of(TDM),Ze.of(jB_),Ze.of(e.organization),Ze.of(e.apiName),Ze.of(e.version))}async function zDM({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let o=await a.workspace.getDefinition({context:t,relativePathToDependency:Ze.of(e.path)},i);return t.logger.info("Loaded..."),o}async function NDM({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=RDM(e),o=Ft(a,Ze.of(jB_)),c=Ft(a,Ze.of(qDM)),f;if(!await Ri(o)||!await Ri(c)){t.logger.info("Downloading manifest...");let l=await CDM.definitionRegistry.get(Zhc.FernFiddle.OrganizationId(e.organization),Zhc.FernFiddle.ApiId(e.apiName),e.version);if(!l.ok){l.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:y=>{t.failWithoutThrowing("Failed to download API manifest",y)}});return}let p=l.body.yamlSchemaVersion!=null?parseInt(l.body.yamlSchemaVersion):void 0,_=sJi(r),h=sJi(l.body.cliVersion);if(p!=null){if(p>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${l.body.cliVersion}`);return}else if(p<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(_.major!==h.major||_.minor!==h.minor){t.failWithoutThrowing(`CLI version is ${l.body.cliVersion}. Expected ${_.major}.${_.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+l.body.definitionS3DownloadUrl),await(0,K4n.mkdir)(o,{recursive:!0});try{await FDM({s3PreSignedReadUrl:l.body.definitionS3DownloadUrl,absolutePathToLocalOutput:o})}catch(y){t.failWithoutThrowing("Failed to download API",y);return}f=l.body,await(0,K4n.writeFile)(c,JSON.stringify(f))}else f=JSON.parse((await(0,K4n.readFile)(c)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:o,context:t,cliVersion:f.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function FDM({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await pB.get(e,{responseType:"stream"}),i=await mB_.default.dir(),n=gB_.default.join(i.path,"api.tgz");await(0,OB_.pipeline)(r.data,(0,bB_.createWriteStream)(n)),await(0,AB_.extract)({file:n,cwd:t})}function QDM(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:vt(e)}}async function wB_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let o={},c={},f={};return await Promise.all(KD(t.packageMarkers).map(async([s,u])=>{if(u.contents.export==null)o[s]=u;else{let{export:l,...p}=u.contents;if(VA(p)>0)f[s]={type:b_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let _=hn(s);if(XRt(t.namedDefinitionFiles).some(y=>y!==s&&y.startsWith(_)))f[s]={type:b_.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:_};else{let y=await PB_({dependencyName:typeof u.contents.export=="string"?u.contents.export:u.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});y.didSucceed?c[hn(s)]={definition:y.definition,url:typeof u.contents.export=="object"?u.contents.export.url:void 0}:f[s]=y.failure}}}})),VA(f)>0?{didSucceed:!1,failures:f}:{didSucceed:!0,packageMarkers:o,importedDefinitions:c}}var EB_=ae(require("path"),1);var khc={};Kt(khc,{additionalProperties:()=>WDM,default:()=>GDM,definitions:()=>xDM,properties:()=>LDM,required:()=>VDM,type:()=>UDM});var UDM="object",LDM={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},VDM=["name"],WDM=!1,xDM={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.AuthScope":{type:"string"},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.TokenBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},GDM={type:UDM,properties:LDM,required:VDM,additionalProperties:WDM,definitions:xDM};var eyc={};Kt(eyc,{additionalProperties:()=>JDM,default:()=>YDM,definitions:()=>$DM,properties:()=>KDM,type:()=>HDM});var HDM="object",KDM={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},JDM=!1,$DM={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},YDM={type:HDM,properties:KDM,additionalProperties:JDM,definitions:$DM};var tyc={};Kt(tyc,{additionalProperties:()=>kDM,default:()=>tBM,definitions:()=>eBM,properties:()=>ZDM,type:()=>XDM});var XDM="object",ZDM={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},kDM=!1,eBM={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},tBM={type:XDM,properties:ZDM,additionalProperties:kDM,definitions:eBM};function SB_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[o,c]of KD(e)){let f=c.contents,s=u=>{a[o]={type:b_.JSONSCHEMA_VALIDATION,error:u}};if(o===n1){let u=rzt(f,khc);if(u.success){let l=AD.serialization.RootApiFileSchema.parseOrThrow(f);r={defaultUrl:l["default-url"],contents:l,rawContents:c.rawContents}}else s(u)}else if(EB_.default.basename(o)===ob){let u=rzt(f,tyc);if(u.success){let l=AD.serialization.PackageMarkerFileSchema.parseOrThrow(f);n[o]={defaultUrl:typeof l.export=="object"?l.export.url:void 0,contents:l,rawContents:c.rawContents}}else s(u)}else{let u=rzt(f,eyc);if(u.success){let l=AD.serialization.DefinitionFileSchema.parseOrThrow(f);i[o]={defaultUrl:void 0,contents:l,rawContents:c.rawContents,absoluteFilePath:Ft(t,o)}}else s(u)}}return r==null?{didSucceed:!1,failures:{[Ze.of(n1)]:{type:b_.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var FGt=class extends _Ft{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,MB_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,o=Ft(this.absoluteFilePath,Ze.of(pR)),c=await vBs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),f=await bS_(o,"{yml,yaml}"),s=await vS_(f);if(!s.didSucceed)return FWo(s.failures,a.logger),a.failAndThrow();let u=SB_({files:s.files,absolutePathToDefinition:o});if(!u.didSucceed)return FWo(u.failures,a.logger),a.failAndThrow();let l=await wB_({dependenciesConfiguration:c,structuralValidationResult:u,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!l.didSucceed)return FWo(l.failures,a.logger),a.failAndThrow();let p={absoluteFilePath:o,rootApiFile:u.rootApiFile,namedDefinitionFiles:u.namedDefinitionFiles,packageMarkers:l.packageMarkers,importedDefinitions:l.importedDefinitions};r?.auth!=null&&(p={...p,rootApiFile:{...p.rootApiFile,contents:{...p.rootApiFile.contents,auth:r?.auth}}}),n=new rK({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:c,workspaceName:this.workspaceName,definition:p,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var nC_=require("fs/promises");var kI_=ae(ZI_(),1);async function pEa(e){return(await(0,kI_.convertObj)(e,{})).openapi}var tC_=require("fs/promises");var eC_=require("fs/promises");async function t3n({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:i}){let n=null;try{let a=(await(0,eC_.readFile)(e,"utf8")).toString();try{n=JSON.parse(a)}catch{n=Fi.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return Ews({data:t,overrides:n,allowNullKeys:i})}async function jyc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,tC_.readFile)(t)).toString(),n=await Fi.load(i);return r!=null?await t3n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var iC_=require("fs/promises");var hEa=ae(fWo(),1);var rC_=ae(fWo(),1),wyc=ae(require("path"),1),_Ea=class extends rC_.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let i=super.resolveExternalRef(t,r);return i.startsWith("http://")||i.startsWith("https://")||uzt(Lr.of(i))?i:this.absolutePathToOpenAPIOverrides!=null?wyc.default.resolve(wyc.default.dirname(this.absolutePathToOpenAPIOverrides),r):i}};async function Eyc({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,hEa.bundle)({...dWo,doc:{source:new hEa.Source(e,"<openapi>"),parsed:r},externalRefResolver:new _Ea(t)}):await(0,hEa.bundle)({...dWo,ref:e,externalRefResolver:new _Ea(t)})).bundle.parsed}function xIM(e,t){if(t.includes(e))return e;for(let r of t){let i=r.replace(/\{[^}]+\}/g,"([^/]+)");if(new RegExp(`^${i}$`).test(e))return r}}var GIM=["examples","example",Gi.EXAMPLES,JQ.REDOCLY_CODE_SAMPLES_CAMEL,JQ.REDOCLY_CODE_SAMPLES_KEBAB];async function yEa({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let i=await Eyc({absolutePathToOpenAPI:t}),n;r!=null?n=r:typeof i=="object"&&i[Gi.OPENAPI_OVERIDES_FILEPATH]!=null&&(n=Ft(hn(t),Ze.of(i[Gi.OPENAPI_OVERIDES_FILEPATH])));let a=i;n!=null&&(a=await t3n({absoluteFilePathToOverrides:n,context:e,data:a,allowNullKeys:GIM}));let o=Ft(hn(t),Ze.of("ai_examples_override.yml"));try{let c=await(0,iC_.readFile)(o,"utf-8"),f=Fi.load(c);if(f?.paths&&a.paths){for(let[s,u]of Object.entries(f.paths))if(u&&typeof u=="object")for(let[l,p]of Object.entries(u)){let _=l.toLowerCase(),h=a.paths[s];if(!h&&a.paths){let y=xIM(s,Object.keys(a.paths));y&&(h=a.paths[y],e.logger.debug(`Matched override path "${s}" to OpenAPI path "${y}" using pattern matching`))}if(h&&typeof h=="object"){let b=h[_];if(b&&typeof b=="object"){let v=b;!v["x-fern-examples"]&&p["x-fern-examples"]&&(v["x-fern-examples"]=p["x-fern-examples"],e.logger.debug(`Added AI examples for ${l.toUpperCase()} ${s} from override file`))}}}}e.logger.debug(`Processed AI examples from ${o}`)}catch{}return n!=null||a!==i?await Eyc({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a}):a}var CFt=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let i=[];for(let n of r)try{let a=(await(0,nC_.readFile)(n.absoluteFilepath)).toString(),o=Ev(this.absoluteFilePath,n.source.file);n.source.relativePathToDependency!=null&&(o=Ft(n.source.relativePathToDependency,o));let c=n.source.type==="protobuf"?xL.protobuf({file:o}):xL.openapi({file:o});if(a.includes("openapi")||a.includes("swagger"))try{let f=await yEa({absolutePathToOpenAPI:n.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:n.absoluteFilepathToOverrides});if(kpc(f)){i.push({type:"openapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}else if(Pwa(f)){(!f.schemes||f.schemes.length===0)&&(f.schemes=["https"]);let s=await pEa(f);i.push({type:"openapi",value:s,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}}catch(f){t.logger.debug(`Failed to parse OpenAPI document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("asyncapi"))try{let f=await jyc({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}catch(f){t.logger.error(`Failed to parse AsyncAPI document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("openrpc"))try{let f=await jyc({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:f,source:c,namespace:n.namespace,settings:Y0e({options:n.settings})});continue}catch(f){t.logger.error(`Failed to parse OpenRPC document at ${n.absoluteFilepath}: ${f}. Skipping...`);continue}t.logger.warn(`${n.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`)}catch(a){t.logger.error(`Failed to read or process file ${n.absoluteFilepath}: ${a}. Skipping...`);continue}return i}};var HIM=Tt.object({type:Tt.string(),channelId:Tt.string().optional(),messageId:Tt.string(),value:Tt.any()}),KIM=Tt.object({summary:Tt.string().optional(),description:Tt.string().optional(),"query-parameters":Tt.record(Tt.string()).optional(),headers:Tt.record(Tt.string()).optional(),messages:Tt.array(HIM)}),aC_=Tt.array(KIM);var u9o=class extends kc{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:i,baseDir:n}){super({breadcrumbs:t??[],context:i}),this.channel=r,this.baseDir=n}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=aC_.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(i=>({summary:i.summary,description:i.description,queryParameters:i["query-parameters"],headers:i.headers,messages:i.messages.map(n=>({type:n.type,channelId:n.channelId,messageId:n.messageId,value:n.value}))}))}};var r3n=class extends Ra{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=i,this.channel=n,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:i}){let a=new u9o({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return a==null?{}:Object.fromEntries(a.map((o,c)=>[c.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:o.queryParameters,headers:o.headers,messages:o.messages.map(f=>({type:i==="v2"?f.type:f.messageId,body:f.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var Xqi=class extends VO.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:i,parameterNamePrefix:n}){super({context:t,breadcrumbs:r,parameter:i}),this.parameterNamePrefix=n}convert(){let t,r={},n=new I1.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},c=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:n}).convert();return c!=null&&(t=c.type,r=c.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var s9o=class extends kc{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var i3n=class extends kc{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var c9o=class extends r3n{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a})}convert(){let t=[],r=[],i=[],a=new i3n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:i}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let o;this.channel.subscribe!=null&&(o=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let c;this.channel.publish!=null&&(c=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let f=[];o!=null&&f.push(o),c!=null&&f.push(c);let u=new s9o({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),l=this.transformToValidPath(u??this.channelPath),p=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],_=mD(l),h=No(this.channelPath),y=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(h),displayName:a,baseUrl:p,path:_,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:f,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:l,baseUrl:p,asyncApiVersion:"v2"})}},audiences:y,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:i}){let n,a=i==="server"?"subscribe":"publish",o=[...this.breadcrumbs,a],c=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:o});c!=null&&(r.message=c);let f=Txi(No(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let u=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:r.message,schemaIdOverride:f}).convert();u!=null&&u.schema!=null&&(n=u.schema,this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let s=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:o});if(s!=null){let l=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:s,schemaIdOverride:f}).convert();l!=null&&l.schema!=null&&(n=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}}if(n!=null){let s=n,u=ni.named({fernFilepath:t.createFernFilepath(),name:s.typeDeclaration.name.name,typeId:s.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),l=uz.reference({bodyType:u,docs:r.description}),p=i==="server"?"subscribe":"publish";return{type:p,displayName:p,origin:i,body:l,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[i,n]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(a==null)continue;let c=new Xqi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:i,in:"path",description:a.description,required:a.required??!0}}).convert();c!=null&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type==="path"&&r.push(c.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let i=this.channel.bindings.ws.headers.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(o==null)continue;let f=new Xqi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"header",required:i.includes(n),schema:o,description:"description"in o?o.description:void 0}}).convert();f!=null&&f.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let i=this.channel.bindings.ws.query.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(o==null)continue;let f=new Xqi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"query",required:i.includes(n),schema:o,description:"description"in o?o.description:void 0,deprecated:o.deprecated??!1}}).convert();f!=null&&f.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}};var n3n=class extends Ra{servers;constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r}),this.servers=i}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[i,n]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,i,n);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:JE.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var l9o=class extends n3n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.url),docs:void 0}}};var Syc="$message.",oC_="#/channels/",uC_="#/servers/",f9o=class extends r3n{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a,operations:o}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}),this.operations=o}convert(){let t=[],r=[],i=[],a=new i3n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:this.channelPath});let o=Object.entries(this.operations).reduce((p,[_,h])=>{try{this.getChannelPathFromOperation(h)===this.channelPath&&(p[_]=h)}catch{}return p},{}),c=[];for(let[p,_]of Object.entries(o))for(let h of _.messages){let y=this.context.convertReferenceToTypeReference({reference:h});if(y.ok){let b=uz.reference({bodyType:y.reference,docs:_.description});c.push({type:p,displayName:p,origin:_.action==="send"?"client":"server",body:b,availability:this.context.getAvailability({node:_,breadcrumbs:this.breadcrumbs}),docs:_.description})}}let f=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],s=this.transformToValidPath(this.channel.address??this.channelPath),u=mD(s),l=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:f,path:u,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:s,baseUrl:f,asyncApiVersion:"v3"})}},audiences:l,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:n}){for(let a of Object.values(this.channel.parameters??{})){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(o==null)continue;let c=this.convertChannelParameterLocation(o.location);if(c==null)continue;let{type:f,parameterKey:s}=c,l=new Xqi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:s,in:f},parameterNamePrefix:this.channelPath}).convert();if(l!=null)switch(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type){case"path":t.push(l.parameter);break;case"query":r.push(l.parameter);break;case"header":i.push(l.parameter);break}}}convertChannelParameterLocation(t){try{let[r,i]=t.split("#/");if(r==null||i==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(Syc)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${Syc} prefix`,path:this.breadcrumbs});return}let n=r.substring(Syc.length);if(n!=="header"&&n!=="path"&&n!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${n}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return n==="payload"?{type:"query",parameterKey:i}:{type:n,parameterKey:i}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(uC_)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let i=r.$ref.substring(uC_.length);if(i==null){this.context.errorCollector.collect({message:`Failed to find server with name ${i}`,path:this.breadcrumbs});return}return i}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(oC_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(oC_.length)}};var d9o=class extends n3n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.host),docs:void 0}}};var bEa=class extends oFt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,i]of Object.entries(t.channels??{}))for(let[n,a]of Object.entries(i.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let o=["channels",r,"messages",n],c=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:o});if(!this.context.isMessageWithPayload(c))continue;let f=this.context.resolveMaybeReference({schemaOrReference:c.payload,breadcrumbs:o});if(f==null)continue;let s=`${r}_${n}`;this.convertSchema({id:s,breadcrumbs:o,schema:f})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let i=["components","messages",t],n=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:i});n!=null&&this.convertSchema({id:t,breadcrumbs:i,schema:n})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:i}){let a=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:i}).convert();a!=null&&this.addSchemaOutputToIr(t,a)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new d9o({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new l9o({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let n=new I1.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let c=this.context.spec.operations??{};a=new f9o({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t,operations:c}).convert()}else a=new c9o({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:n}),this.addTypesToIr(a.inlinedTypes))}}};var vEa=class extends wB{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a,o=t.$ref.match(/^.*\/schemas\/(.+)$/),c=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),f=t.$ref.match(/^.*\/messages\/(.+)$/);if(o&&o[1])return a=o[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a});if(c&&c[2]){let s=c[1],u=c[2];return a=`${s}_${u}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})}else return f&&f[1]?(a=f[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.title??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.name??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.messageId??o.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.messageId??o.value.name??i),{ok:!0,reference:ni.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var _C_=ae(p9o(),1);var _9o=class extends kc{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};function sC_({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?Ra.OPTIONAL_STRING:Ra.STRING,env:r.env,v2Examples:r.optional?void 0:YIM({header:r,context:t}),availability:void 0,docs:void 0}))}function YIM({header:e,context:t}){let r=new R0e({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:i}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:i}}}var h9o=class extends VO.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var y9o=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:i,mediaType:n,description:a,required:o,group:c,method:f,streamingExtension:s,queryParameters:u}){super({context:t,breadcrumbs:r,group:c,method:f}),this.contentType=i,this.mediaType=n,this.description=a,this.required=o,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=s,this.queryParameters=u??[]}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(LA.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=LA.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=LA.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;return n?.type==="object"?this.hasBodyQueryParameterOverlap(n.properties)?{requestBody:LO.reference({contentType:t,docs:this.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}:{requestBody:LO.inlinedRequestBody({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:n.extendedProperties,extends:n.extends,properties:n.properties,extraProperties:n.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes})}:{requestBody:LO.reference({contentType:t,docs:this.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;if(n?.type==="object")return{requestBody:LO.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:n.properties.map(a=>{let o=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:o})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes}),examples:i.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:LO.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:i}){let{isFile:n,isOptional:a,isArray:o}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return n?o?CC.file($6.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):CC.file($6.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):CC.bodyProperty({...t,contentType:i?.contentType??r,style:ZIM({encoding:i}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(i==null)return;let n=i.properties?.[this.streamingExtension.streamConditionProperty];if(n==null||this.context.isReferenceObject(n))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!0,contentType:t,mediaTypeObject:r}),o=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||o==null))return{requestBody:o.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...o.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:i,contentType:n,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let o={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:i,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},c={...a,schema:o},f=this.parseMediaTypeObject({mediaTypeObject:c,schemaId:this.schemaId,contentType:n});if(f==null)return;let s=f.schema?.typeDeclaration.shape;if(s?.type==="object")return{requestBody:LO.inlinedRequestBody({contentType:n,docs:void 0,name:this.context.casingsGenerator.generateName(i?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:s.extendedProperties,extends:s.extends,properties:s.properties,extraProperties:s.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:c,exampleGenerationStrategy:"request"})}),inlinedTypes:f.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:i}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:i}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:i}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:i??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(i=>i.name.wireValue.toLowerCase()));return t.some(i=>r.has(i.name.wireValue.toLowerCase()))}},XIM={"application/json":"json"};function ZIM({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return XIM[e.contentType]}}var kIM=/{([^}]+)}/g,eCM=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),a3n=class extends Ra{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r}),this.operation=i,this.method=n,this.path=a}convertHttpMethod(){switch(this.method){case"get":return KP.Get;case"post":return KP.Post;case"put":return KP.Put;case"delete":return KP.Delete;case"patch":return KP.Patch;case"head":return KP.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],i=[],n=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n};for(let a of this.operation.parameters){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(o==null)continue;let f=new h9o({context:this.context,breadcrumbs:t,parameter:o}).convert();if(f!=null)switch(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},f.type){case"path":r.push(f.parameter);break;case"query":i.push(f.parameter);break;case"header":{let s=f.parameter.name.name.originalName,u=f.parameter.name.wireValue,l=!1,p=this.context.authOverrides?.["auth-schemes"];if(p!=null){for(let h of Object.values(p))if(nCM(h)&&h.header.toLowerCase()===u.toLowerCase()){l=!0;break}}let _=this.context.globalHeaderNames;if(_!=null){for(let h of _)if(h.toLowerCase()===u.toLowerCase()){l=!0;break}}!eCM.has(s.toLowerCase())&&!l&&n.push(f.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n}}checkMissingPathParameters(t){let i=[...this.path.matchAll(kIM)].map(n=>n[1]).filter(n=>!t.some(a=>a.name.originalName===n));for(let n of i){if(n==null)continue;let a=`${n}_example`;t.push({name:this.context.casingsGenerator.generateName(n),valueType:Ra.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:n})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:i,streamingExtension:n,queryParameters:a}){if(this.operation.requestBody==null)return;let o=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(o==null)return null;let c=[];for(let[f,s]of Object.entries(o.content)){let l=new y9o({context:this.context,breadcrumbs:t,contentType:f,mediaType:s,description:o.description,required:o.required,group:r??[],method:i,streamingExtension:n,queryParameters:a}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},c.push({requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}))}return c}computeGroupNameAndLocationFromExtensions(){let r=new I1.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,n=new I1.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:n,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?No(this.operation.summary):No(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let i=cC_(t),n=cC_(r);return r1(i,n)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:n})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:i,methodNameTokens:n}){if(r.some((c,f)=>c!==n[f]))return{group:[t],method:i};let o=n.slice(r.length);return{group:[t],method:No(o.join("_"))}}generateStringParameterExample({example:t}){let r=new VO.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:i}=r.convert();return i}};function cC_(e){let t=tCM(e)?rCM(e):iCM(e);return t=t.map(r=>r.toLowerCase()),t=$Oe(t),t}function tCM(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function rCM(e){return e.split(/(?=[A-Z])/)}function iCM(e){return e.split(/[^a-zA-Z0-9]+/)}function nCM(e){return e?.header!=null}var o3n=class extends a3n{constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=[...this.breadcrumbs,"Payload"],{headers:a,queryParameters:o}=this.convertParameters({breadcrumbs:n}),c=this.convertRequestBody({breadcrumbs:n,group:r,method:i,streamingExtension:void 0,queryParameters:o});if(c==null)return;let f=c[0]?.requestBody;if(f==null)return;let s;if(f.type==="inlinedRequestBody")s=VQ.inlinedPayload({name:f.name,extends:f.extends,properties:f.properties});else if(f.type==="reference")s=VQ.reference({payloadType:f.requestBodyType,docs:f.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${i}`,name:this.context.casingsGenerator.generateName(i),displayName:this.operation.summary,method:t,headers:a,payload:s,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,{name:r,payload:i}]))}};var Byc=ae(p9o(),1);var lC_=["get","post","put","delete","patch","head"];var b9o=class extends kc{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var aCM=Tt.object({cursor:Tt.string(),next_cursor:Tt.string(),results:Tt.string()}),oCM=Tt.object({offset:Tt.string(),results:Tt.string(),step:Tt.string().optional(),"has-next-page":Tt.string().optional()}),Myc=Tt.union([Tt.boolean(),aCM,oCM]);var Dyc="$request.",v9o="$response.",g9o=class extends kc{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i,context:n}){super({breadcrumbs:t,context:n}),this.operation=r,this.document=i}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Myc.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let i=this.getExtensionValue(this.document);if(i==null)return;if(typeof i=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let n=Myc.safeParse(i);if(!n.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:n.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:wB.maybeTrimPrefix(r.cursor,Dyc),nextCursor:wB.maybeTrimPrefix(r.next_cursor,v9o),results:wB.maybeTrimPrefix(r.results,v9o)};let i=t;return{type:"offset",offset:wB.maybeTrimPrefix(i.offset,Dyc),results:wB.maybeTrimPrefix(i.results,v9o),step:i.step!=null?wB.maybeTrimPrefix(i.step,Dyc):void 0,hasNextPage:i["has-next-page"]!=null?wB.maybeTrimPrefix(i["has-next-page"],v9o):void 0}}};var uCM="$request.",sCM=Tt.object({"stream-condition":Tt.string().optional(),format:Tt.enum(["sse","json"]).optional(),"stream-description":Tt.string().optional(),"response-stream":Tt.any(),response:Tt.any()}),cCM=Tt.union([Tt.boolean(),sCM]),O9o=class extends kc{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=cCM.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:wB.maybeTrimPrefix(r.data["stream-condition"],uCM),responseStream:r.data["response-stream"],response:r.data.response}}};var A9o=class extends kc{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var P9o=require("fs"),fC_=require("path");function lCM(e){return Xc(e)&&typeof e.$ref=="string"}function fCM(e,t){if(e!=null){if(typeof e=="string")return e;if(lCM(e)){let r=(0,fC_.resolve)(t??process.cwd(),e.$ref);if((0,P9o.existsSync)(r))try{return(0,P9o.readFileSync)(r,"utf-8")}catch{return}}}}var m9o=class extends kc{operation;baseDir;key="x-codeSamples";constructor({context:t,breadcrumbs:r,operation:i,baseDir:n}){super({breadcrumbs:r,context:t}),this.operation=i,this.baseDir=n}convert(){let t=Xc(this.operation)?this.operation:{},r=t["x-codeSamples"],i=t["x-code-samples"],n=Array.isArray(r)?r:[],a=Array.isArray(i)?i:[],o=[...n,...a];if(o.length===0)return;let c=[];for(let f of o){if(!Xc(f))continue;let s=f,u=s.lang,l=s.label,p=s.source;if(typeof u!="string")continue;let _=fCM(p,this.baseDir);_!=null&&c.push({name:typeof l=="string"?l:u,language:u,code:_,install:void 0,docs:void 0})}if(c.length!==0)return[{"code-samples":c}]}};var w9o=require("fs"),dC_=require("path");function dCM(e){return Xc(e)&&typeof e.$ref=="string"}function pCM(e,t){if(e!=null){if(typeof e=="string")return e;if(dCM(e)){let r=(0,dC_.resolve)(t??process.cwd(),e.$ref);if((0,w9o.existsSync)(r))try{return(0,w9o.readFileSync)(r,"utf-8")}catch{return}}}}function _CM(e,t){if(!Array.isArray(e))return[];let r=[];for(let i of e){if(!Xc(i))continue;let a=pCM(i.code,t);a!=null&&r.push({...i,code:a})}return r}var j9o=class extends kc{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:i,baseDir:n}){super({breadcrumbs:r,context:t}),this.operation=i,this.baseDir=n}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(a=>{if(!Xc(a))return a;let c=a["code-samples"];if(c!=null){let f=_CM(c,this.baseDir);return{...a,"code-samples":f}}return a}).filter(a=>{let o=AD.serialization.ExampleEndpointCallSchema.parse(a);return o.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),o.ok})}};var gEa=class extends kc{document;key="x-fern-explorer";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}};var OEa=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:i,group:n,method:a,statusCode:o,streamingExtension:c}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseBody=i,this.statusCode=o,this.streamingExtension=c}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,i=[...this.group,this.method,"Response",this.statusCode].join("_"),n=`${i}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:n}),o=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:i});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:o})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let i of r){let n=this.responseBody.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:n,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(a=>a.includes("json"));for(let a of r){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null&&this.shouldReturnJsonResponse(a))return this.returnJsonResponse({mediaTypeObject:o,convertedSchema:c})}let i=Object.keys(this.responseBody.content??{}).filter(a=>!a.includes("json"));for(let a of i){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null){if(this.isBinarySchema(c))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:o}):this.returnFileDownloadResponse({mediaTypeObject:o});if(this.shouldReturnTextResponse(a))return this.returnTextResponse({mediaTypeObject:o})}}let n=parseInt(this.statusCode);if(!isNaN(n)&&n>=200&&n<300){let a={schema:{type:"object",description:"Empty response body"}},o=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:"application/json",resolveSchema:!0});if(o!=null)return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:o})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let i=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(i=this.streamingExtension.streamDescription),{responseBody:cy.json(iz.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:cy.streaming(nz.json({docs:i,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:cy.streaming(nz.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:cy.streaming(nz.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:cy.json(iz.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:cy.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:cy.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:cy.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return LA.parse(t)?.isText()??!1}};var E9o=class extends VO.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;isWildcardStatusCode;constructor({context:t,breadcrumbs:r,responseError:i,group:n,method:a,methodName:o,statusCode:c,isWildcardStatusCode:f}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseError=i,this.statusCode=c,this.methodName=o,this.isWildcardStatusCode=f}convert(){if(!this.responseError.content){let i=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(i==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let n=this.getErrorIdFromErrorName(i);return{error:{error:{name:this.context.casingsGenerator.generateName(n),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:n},docs:this.responseError.description},errorType:ni.unknown(),displayName:i,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(i=>i.includes("json")),r=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let i of[...t]){let n=this.responseError.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:pC_(`${this.methodName}Request${r}`),contentType:i});if(a==null)continue;let o=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:i,convertedSchema:n}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:i,errorId:r},docs:this.responseError.description},errorType:n.type,displayName:t,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:n.inlinedTypes,examples:n.examples}}getErrorNameForStatusCode(t,r){if(r){if(t===400)return"ClientRequestError";if(t===500)return"ServerError"}return nQo[t]}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?pC_(`${this.methodName}Request${t}`):t}};function pC_(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var S9o=class e extends a3n{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a,idempotent:o,idToAuthScheme:c,topLevelServers:f,streamingExtension:s}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a}),this.idempotent=o,this.idToAuthScheme=c,this.topLevelServers=f,this.streamingExtension=s}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=this.getGroupDisplayName(r),{headers:a,pathParameters:o,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),f=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:i,streamingExtension:this.streamingExtension,queryParameters:c}),s=f?.[0]?.requestBody,u=f?.[0]?.streamRequestBody,l={requestBodies:f?.map(H=>H.requestBody)},p=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:i,streamingExtension:this.streamingExtension}),_=p?.response,h=p?.streamResponse,y=p!=null?p.errors:[],b={},v=y.map(H=>H.error),O=mD(this.path),A=this.getEndpointBaseUrl(),g=this.getEndpointBaseUrls(),m=this.convertExamples({httpPath:O,httpMethod:t,baseUrl:A}),j=new Set(this.operation.security?.flatMap(H=>Object.keys(H))??[]),M=this.authSchemeToHeaders(Array.from(j));M.length>0&&a.push(...M);for(let H of y){let ue=H.error,se=H.errorType,x=ue.error.errorId,G=H.examples;b[x]={name:ue.error,displayName:H.displayName,discriminantValue:{name:ue.error.name,wireValue:x},type:se,statusCode:H.statusCode,isWildcardStatusCode:H.isWildcardStatusCode,docs:ue.docs,examples:[],v2Examples:{userSpecifiedExamples:G??{},autogeneratedExamples:{}}}}let E=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],B=new gEa({context:this.context,breadcrumbs:this.breadcrumbs,document:this.context.spec}).convert(),T=new gEa({context:this.context,breadcrumbs:this.breadcrumbs,document:this.operation}).convert()??B,R={displayName:this.operation.summary,method:t,baseUrl:A,v2BaseUrls:g,path:O,pathParameters:o,queryParameters:c,headers:a.filter((H,ue,se)=>ue===se.findIndex(x=>x.name.wireValue===H.name.wireValue)),sdkRequest:void 0,errors:v,auth:this.operation.security!=null||this.context.spec.security!=null||this.shouldApplyDefaultAuthOverrides(),security:this.operation.security??this.context.spec.security??this.getDefaultSecurityFromAuthOverrides(),availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:O,allPathParameters:o,pagination:void 0,transport:void 0,source:CL.openapi(),audiences:E,retries:void 0,apiPlayground:T},Q=this.context.namespace!=null?[this.context.namespace]:[],U=r?.map(H=>No(H));return Q.push(...U??[]),{audiences:E,group:r,groupDisplayName:n,errors:b,endpoint:{...R,id:`endpoint_${Q.join("/")}.${i}`,name:this.context.casingsGenerator.generateName(i),requestBody:s,v2RequestBodies:l,response:_,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:m.examples},v2Responses:{responses:p?.v2Responses}},streamEndpoint:h!=null&&h.body!=null?{...R,id:`endpoint_${Q.join("/")}.${i}_stream`,name:this.context.casingsGenerator.generateName(`${i}_stream`),requestBody:u,v2RequestBodies:void 0,response:h,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:m.streamExamples},v2Responses:{responses:[{statusCode:200,isWildcardStatusCode:void 0,body:h.body}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.responses==null)return;let a,o=!1;for(let[c,f]of Object.entries(this.operation.responses)){let s=/^[45]XX$/i.test(c),u,l=!1;if(s)u=parseInt(c.charAt(0))*100,l=!0;else{if(u=parseInt(c),isNaN(u)||u<200||u>=300&&u<400)continue;l=u>=400&&u<600}if(a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}}),u>=200&&u<300){let p=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(p==null)continue;let h=new OEa({context:this.context,breadcrumbs:[...t,c],responseBody:p,group:r??[],method:i,statusCode:c,streamingExtension:n}).convert();h!=null&&(this.inlinedTypes={...this.inlinedTypes,...h.inlinedTypes},o||(o=!0,a.response={statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.responseBody},a.streamResponse={statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.streamResponseBody}),a.v2Responses=[...a.v2Responses??[],{statusCode:u,isWildcardStatusCode:s?!0:void 0,body:h.responseBody}])}if(l){let p=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(p==null)continue;let h=new E9o({context:this.context,breadcrumbs:[...t,c],responseError:p,group:r??[],method:i,methodName:this.evaluateMethodNameFromOperation(),statusCode:u,isWildcardStatusCode:s?!0:void 0}).convert();h!=null&&(this.inlinedTypes={...this.inlinedTypes,...h.inlinedTypes},a.errors.push(h))}}if(this.streamingExtension!=null){a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}});let f=new OEa({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:i,statusCode:"stream",streamingExtension:n}).convert();f!=null&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},a.response={statusCode:200,isWildcardStatusCode:void 0,body:f.responseBody},a.streamResponse={statusCode:200,isWildcardStatusCode:void 0,body:f.streamResponseBody},a.v2Responses=[{statusCode:200,isWildcardStatusCode:void 0,body:f.responseBody}])}return a}shouldApplyDefaultAuthOverrides(){if(!this.context.authOverrides?.auth)return!1;let t=this.context.spec.security!=null&&this.context.spec.security.length>0,r=this.operation.security!=null;return!(t||r)}getDefaultSecurityFromAuthOverrides(){if(!this.context.authOverrides?.auth)return;let t=this.context.authOverrides.auth;if(typeof t!="string")return;let r={};return r[t]=[],[r]}authSchemeToHeaders(t){let r=[];for(let i of t){let n=this.idToAuthScheme?.[i];if(n==null)continue;let a={valueType:Ra.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(n.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:n.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:i}){let a=new j9o({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],c=new m9o({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],s=a.some(u=>Array.isArray(u["code-samples"])&&u["code-samples"].length>0)?a:[...a,...c];return s.length===0?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:s}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:s}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){let a=n.filter(s=>!(s.response!=null&&"stream"in s.response)),o=n.filter(s=>s.response!=null&&"stream"in s.response),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),f=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:o});return{examples:c,streamExamples:f}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){return Object.fromEntries(n.map((a,o)=>[this.getExampleName({example:a,exampleIndex:o}),{displayName:void 0,request:a.request!=null||a["path-parameters"]!=null||a["query-parameters"]!=null||a.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request??void 0}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(c=>{let f=("language"in c?c.language:c.sdk)??void 0;return{name:c.name,docs:void 0,language:f,code:c.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return br.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return br.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new I1.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${Gi.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let i=this.operation.servers?.[0];if(i==null)return;let a=this.topLevelServers?.find(o=>o.url===i.url)??i;return Ahe.getServerName({server:a,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(i=>{let a=this.topLevelServers?.find(o=>o.url===i.url)??i;return Ahe.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(i=>`${r[i.pathParameter]?.toString()??i.pathParameter}${i.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(i=>i.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let i=t?.[t.length-1];if(i!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===i?r:void 0}};var M9o=class extends Ra{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:i,path:n,idToAuthScheme:a,topLevelServers:o}){super({context:t,breadcrumbs:r}),this.pathItem=i,this.path=n,this.idToAuthScheme=a,this.topLevelServers=o}convert(){let t=[],r=[],i={};for(let n of lC_){let a=this.pathItem[n];if(a==null)continue;let o=[...this.breadcrumbs,n],c=this.tryParseAsWebhook({operationBreadcrumbs:o,operation:a,method:n,context:this.context});if(c!=null){r.push(c),Object.assign(i,c.inlinedTypes);continue}let s=new O9o({breadcrumbs:o,operation:a,context:this.context}).convert(),u=this.tryParseAsHttpEndpoint({operationBreadcrumbs:o,operation:a,method:n,streamingExtension:s});u!=null&&(t.push(u),Object.assign(i,u.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:i}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n}){return new A9o({breadcrumbs:i,operation:t,context:n}).convert()?new o3n({context:this.context,breadcrumbs:i,operation:t,method:Byc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,streamingExtension:n}){new g9o({breadcrumbs:i,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let f=new b9o({breadcrumbs:i,operation:t,context:this.context}).convert();return new S9o({context:this.context,breadcrumbs:i,operation:t,method:Byc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:f,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:n}).convert()}};var D9o=class extends Ra{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:i,schemeId:n}){super({context:t,breadcrumbs:r}),this.securityScheme=i,this.schemeId=n}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return wA.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return wA.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return wA.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:Ra.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return wA.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var AEa=class extends oFt{constructor({breadcrumbs:t,context:r,audiences:i}){super({breadcrumbs:t,context:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.overrideOpenApiAuthWithGeneratorsAuth(),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:i}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(i),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new _9o({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let i=sC_({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(i),this.context.setGlobalHeaders(i)}}convertSecuritySchemes(){if(this.context.authOverrides){let r=cac({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator});this.addAuthToIR({requirement:r.requirement,schemes:r.schemes,docs:r.docs});return}let t=this.convertOpenApiSecuritySchemes();t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertOpenApiSecuritySchemes(){let t=[];for(let[r,i]of Object.entries(this.context.spec.components?.securitySchemes??{})){let n=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:["components","securitySchemes",r]});if(n==null)continue;let o=new D9o({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:n,schemeId:r}).convert();o!=null&&t.push(o)}return t}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let n=oPa({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return n!=null&&this.addEnvironmentsToIr({environmentConfig:n.environmentsConfig,audiences:n.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let i=new Ahe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&this.addSchemaOutputToIr(t,n)}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,n=new o3n({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:_C_.OpenAPIV3.HttpMethods.POST,path:r}).convert();n!=null&&(this.addWebhookToIr({webhook:n.webhook,operationId:r,audiences:n.audiences,group:n.group}),this.addTypesToIr(n.inlinedTypes))}}convertPaths(){let t=[],r={};for(let[i,n]of Object.entries(this.context.spec.paths??{})){if(n==null)continue;let o=new M9o({context:this.context,breadcrumbs:["paths",i],topLevelServers:this.context.spec.servers,pathItem:n,path:i}).convert();if(o!=null){for(let c of o.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),c.servers)for(let f of c.servers)this.shouldAddServerToCollectedServers({server:f,currentServers:t})&&t.push(f);if(c.errors)for(let[f,s]of Object.entries(c.errors))r[f]=s}for(let c of o.webhooks){let f=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:f.join("."),group:f,audiences:c.audiences})}this.addTypesToIr(o.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}overrideOpenApiAuthWithGeneratorsAuth(){if(!this.context.authOverrides?.["auth-schemes"])return;this.context.spec.components||(this.context.spec.components={}),this.context.spec.components.securitySchemes={};let t={};for(let r of Object.keys(this.context.authOverrides["auth-schemes"]))this.context.spec.components.securitySchemes[r]={type:"http",scheme:"bearer"},t[r]=[];this.context.spec.security=[t],this.removeEndpointSpecificAuth()}removeEndpointSpecificAuth(){if(this.context.spec.paths)for(let t of Object.values(this.context.spec.paths)){if(!t)continue;let r=["get","post","put","patch","delete","options","head","trace"];for(let i of r){let n=t[i];n?.security&&delete n.security}}}};var B9o=class extends kc{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:i}){super({breadcrumbs:t,context:i}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var mEa=class extends wB{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;n==="reference_identifier"?c=i??o.value.title:n==="discriminator_key"?c=o.value.title??i:n==="schema_identifier"&&(c=o.value.title);let f;if(a.includes("/")){let u=new VO.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:o.value,id:a}).convert();u!=null&&(f={[a]:u.convertedSchema})}return{ok:!0,reference:ni.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:c}),inlinedTypes:f}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let n=new B9o({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=n}return this.tagToDisplayName[t]??t}};var hCM=Tt.object({description:Tt.string().optional(),required:Tt.boolean().optional(),deprecated:Tt.boolean().optional(),allowEmptyValue:Tt.boolean().optional(),style:Tt.string().optional(),explode:Tt.boolean().optional(),allowReserved:Tt.boolean().optional(),schema:Tt.any().optional(),example:Tt.any().optional(),examples:Tt.record(Tt.string(),Tt.any()).optional(),content:Tt.record(Tt.string(),Tt.any()).optional()}),yCM=hCM.extend({name:Tt.string(),in:Tt.string()}),bCM=Tt.array(yCM),I9o=class extends kc{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return bCM.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var C9o=class extends Ra{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:i,pathParameters:n=[],queryParameters:a=[],headers:o=[],topLevelServers:c=[]}){super({context:t,breadcrumbs:r}),this.method=i,this.pathParameters=n,this.queryParameters=a,this.headers=o,this.topLevelServers=c}convert(){let t={},r="";for(let s of this.pathParameters)r+=`/{${s.name.originalName}}`;let i=mD(r),n=[];for(let[s,u]of this.method.params.entries()){let l;if(this.context.isReferenceObject(u)){let y=this.context.resolveReference({reference:u});if(y.resolved)l=y.value;else continue}else l=u;let p=[this.method.name,"Param",l.name].join("_"),h=new VO.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",l.name],schemaIdOverride:p,context:this.context,schemaOrReference:l.schema,wrapAsOptional:!l.required}).convert();h!=null&&(n.push({docs:l.description,availability:this.context.getAvailability({node:u,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:l.name,wireValue:l.name}),valueType:h.type,v2Examples:h.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...h.inlinedTypes,...t,...h.schema!=null?{[p]:h.schema}:{}})}let a;if(this.method.result!=null){let s=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(s!=null){let u=new VO.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:s.schema}),l=[this.method.name,"Result"].join("_"),p=u.convert();p!=null&&(a={docs:s.description,v2Examples:p.schema?.typeDeclaration.v2Examples,responseBodyType:p.type},t={...p.inlinedTypes,...t,...p.schema!=null?{[l]:p.schema}:{}})}}let o=this.getEndpointBaseUrls(),c=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:o,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:i,fullPath:i,requestBody:n.length>0?LO.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:n,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:a!=null?{body:cy.json(iz.response(a)),statusCode:void 0,isWildcardStatusCode:void 0}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:CL.openrpc(),audiences:c,retries:void 0,apiPlayground:void 0},audiences:c,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(i=>i.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(i=>{if(this.topLevelServers.find(c=>c.name===i.name&&c.url!==i.url)!=null)return i.url;let o=this.topLevelServers.find(c=>c.url===i.url)??i;return Ahe.getServerName({server:o,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let i of this.method.examples??[]){let n;if(this.context.isReferenceObject(i)){let f=this.context.resolveReference({reference:i});if(f.resolved)n=f.value;else continue}else n=i;let a;if(n.result)if(this.context.isReferenceObject(n.result)){let f=this.context.resolveReference({reference:n.result});f.resolved&&(a=f.value)}else a=n.result;let o=n.name??`Example ${r+1}`,c=[];if(n.params&&Array.isArray(n.params)){c=[];for(let f of n.params)if(this.context.isReferenceObject(f)){let s=this.context.resolveReference({reference:f});if(s.resolved)c.push(s.value);else continue}else c.push(f)}t[o]={displayName:void 0,request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:c.map(f=>f.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?br.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:n.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var q9o=class extends VO.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let n=new VO.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();n!=null&&(t=n.type,r=n.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var PEa=class extends oFt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let i=new Ahe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new VO.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&this.addSchemaOutputToIr(t,n)}}convertMethods(){let t=[],i=new I9o({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),n=[],a=[],o=[];if(i&&i.length>0)for(let[f,s]of i.entries()){let l=new q9o({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${f}]`],parameter:s}).convert();if(l!=null)switch(l.type){case"path":{n.push(l.parameter);break}case"query":{a.push(l.parameter);break}case"header":{o.push(l.parameter);break}}}let c=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let f of this.context.spec.methods??[]){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:["methods"]});if(s==null)continue;let l=new C9o({context:this.context,breadcrumbs:["methods"],method:s,pathParameters:n,queryParameters:a,headers:o,topLevelServers:this.context.spec.servers}).convert();if(l!=null&&(this.addEndpointToIr({endpoint:l.endpoint,audiences:l.audiences,endpointGroup:c,serviceName:"service_root"}),this.addTypesToIr(l.inlinedTypes),l.servers))for(let p of l.servers)this.shouldAddServerToCollectedServers({server:p,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(p))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(i=>i.name===t.name&&i.url!==t.url)?{...t,name:t.url}:t}};var jEa=class extends wB{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return n==="reference_identifier"?c=i??o.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(c=o.value.title??i),{ok:!0,reference:ni.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var i1_=require("fs/promises");var hC_={[wn.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,QP(e)])),[wn.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[wn.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[wn.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[wn.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[wn.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[wn.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[wn.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[wn.GenerationLanguage.SWIFT]:new Set([])};var vCM=["go","ruby"];function z9o({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let o=l=>({unsafeName:l,safeName:gCM({name:l,keywords:OCM({generationLanguage:e,keywords:t})})}),c=No(n),f=QP(c),s=qxi(n),u=Dxi(c);return r&&(!PCM(u)&&(e==null||vCM.includes(e))&&(c=u.map((l,p)=>{if(p>0){let _=T9o(l);if(_!=null)return _;if(R9o(l))return l.toUpperCase()}return l}).join(""),f=QP(u.map((l,p)=>{let _=T9o(l);return _??(R9o(l)?l.toUpperCase():p===0?QP(l):l)}).join(""))),s=n.split(" ").map(l=>l.split(/(\d+)/).map(qxi).join("")).join("_")),{originalName:n,camelCase:o(a?.casingOverrides?.camel??c),snakeCase:o(a?.casingOverrides?.snake??s),screamingSnakeCase:o(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:o(a?.casingOverrides?.pascal??f)}},generateNameAndWireValue:({name:n,wireValue:a,opts:o})=>({name:i.generateName(n,o),wireValue:a})};return i}function gCM({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":mCM(e)?"_"+e:e}function OCM({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return hC_[e]}var ACM=/^[0-9]/;function mCM(e){return ACM.test(e)}function PCM(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=T9o(i)!=null||R9o(i),a=T9o(t)!=null||R9o(t);return n&&a})}function T9o(e){return wCM.get(e.toUpperCase())}function R9o(e){return jCM.has(e.toUpperCase())}var jCM=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),wCM=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var yC_=require("fs/promises");async function Iyc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,yC_.readFile)(t)).toString(),n;try{n=JSON.parse(i)}catch{n=Fi.load(i)}return r!=null?await t3n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var xq_=ae(Wq_(),1);function kqi(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...o}={}){let c=n.reduce((s,u)=>({...s,[u]:"<redacted>"}),a),f=[t,...r].join(" ");for(let[s,u]of Object.entries(c))f=f.replaceAll(s,u);return e?.debug(`+ ${f}`),(0,xq_.default)(t,r,o)}async function Jg(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...o}={}){let c=kqi(e,t,r,{doNotPipeOutput:i,secrets:n,substitutions:a,...o});i||(c.stdout?.pipe(process.stdout),c.stderr?.pipe(process.stderr));let f=await c;return f.stdout==null&&(f.stdout=""),f.stderr==null&&(f.stderr=""),f}function e1i(e,{logger:t,...r}={}){return(i,n)=>Jg(t,e,i,{...r,...n})}var Lhe=require("fs/promises"),kq_=ae(require("path"),1),Jyc=ae(MW(),1);var Gq_="buf.gen.yaml",v1M="output",Hq_=`${v1M}/ir.json`,Kq_="protoc-gen-fern",Jq_=`version: v1
1425
1425
  `,$q_=`version: v2
1426
1426
  `,x9o=e=>{let t=`version: v1
1427
1427
  `;if(e.length>0){t+=`deps:
@@ -2021,7 +2021,7 @@ generators:
2021
2021
  `),E!=null){await q_i.rm(M,{recursive:!0,force:!0}),await q_i.mkdir(M,{recursive:!0});try{let T=await vUs({githubRepository:E.uri,installationToken:E.token,targetDirectory:M,timeoutMs:1e3});(E.mode??"push")==="push"&&E.branch!=null&&(_.logger.debug(`Checking out branch ${E.branch} before generation`),await T.checkoutRemoteBranch(E.branch))}catch(T){_.failAndThrow(`Failed to clone GitHub repository ${E.uri}: ${T instanceof Error?T.message:String(T)}`)}}let D;p.raw?.snippets?.path!=null&&(D=Lr.of(Ft(r.absoluteFilePath,Ze.of(p.raw.snippets.path)))),D==null&&E!=null&&(D=Lr.of((await aLj()).path+"/snippet.json"));let B=await aLj(),{shouldCommit:F,autoVersioningCommitMessage:N}=await NUj({organization:t.organization,absolutePathToFernConfig:t._absolutePath,workspace:y,generatorInvocation:p,absolutePathToLocalOutput:M,absolutePathToLocalSnippetJSON:D,absolutePathToLocalSnippetTemplateJSON:void 0,version:n,audiences:i.audiences,workspaceTempDir:B,keepDocker:a,context:_,irVersionOverride:p.irVersionOverride,outputVersionOverride:n,writeUnitTests:g.ok?g?.body.snippetUnitTestsEnabled??!1:!1,generateOauthClients:g.ok?g?.body.oauthClientEnabled??!1:!1,generatePaginatedClients:g.ok?g?.body.paginationEnabled??!1:!1,includeOptionalRequestPropertyExamples:!1,inspect:o,executionEnvironment:void 0,ir:O,whiteLabel:g.ok?g.body.isWhitelabled:!1,runner:s,ai:u});_.logger.info(Lt.green("Wrote files to "+M)),E!=null&&F&&await oj8(_,E,M,N)})))).some(p=>!p)&&c.failAndThrow()}function ij8(e){if(typeof e.raw?.output=="object"&&e.raw?.output!==null){let t=e.raw.output["package-name"];if(t!=null)return t}if(typeof e.raw?.config=="object"&&e.raw?.config!==null){let t=e.raw.config.package_name;if(t!=null)return t;let r=e.raw.config.module?.path;if(r!=null)return r}}function nj8(e,t){if(e==null)return;let i=(t.name.split("/").pop()??"sdk").replace(/[^a-zA-Z0-9-_]/g,"_");return e?Ft(e,Ze.of(i)):void 0}function aj8(e){let t=e.split(`
2022
2022
  `),r=t[0]?.trim()||"SDK Generation",i=t.slice(1).join(`
2023
2023
  `).trim()||"Automated SDK generation by Fern";return{prTitle:r,prBody:i}}async function oj8(e,t,r,i){try{e.logger.debug("Starting GitHub self-hosted flow in directory: "+r);let n=I7i.createAtPath(r),c=`fern-bot/${new Date().toISOString().replace("T","_").replace(/:/g,"-").replace("Z","").replace(".","_")}`;try{await n.setUserAndEmail({name:"fern-api",email:"115122769+fern-api[bot]@users.noreply.github.com"})}catch{}let f=t.mode??"push";switch(f){case"pull-request":{e.logger.debug(`Checking out new branch ${c}`),await n.checkout(c),e.logger.debug("Checking for .fernignore file...");let s=Ft(r,Ze.of(".fernignore"));try{await q_i.access(s),e.logger.debug(".fernignore already exists")}catch{e.logger.debug("Creating .fernignore file..."),await q_i.writeFile(s,`# Specify files that shouldn't be modified by Fern
2024
- `,"utf-8")}e.logger.debug("Committing changes...");let u=i??"SDK Generation";if(await n.commitAllChanges(u),e.logger.debug(`Committed changes to local copy of GitHub repository at ${r}`),!t.previewMode){await n.push();let A=await n.getCurrentBranch();e.logger.info(`Pushed branch: https://github.com/${t.uri}/tree/${A}`)}let l=t.branch??await n.getDefaultBranch(),p=new nLj({auth:t.token}),_=C7i(t.uri),{owner:h,repo:y}=_,b=`${h}:${c}`,{prTitle:v,prBody:O}=aj8(u);try{await p.pulls.create({owner:h,repo:y,title:v,body:O,head:b,base:l,draft:!1}),e.logger.info(`Created pull request ${b} -> ${l} on ${t.uri}`)}catch(A){(A instanceof Error?A.message:String(A)).includes("A pull request already exists for")&&e.failWithoutThrowing(`A pull request already exists for ${b}`)}break}case"push":{t.branch!=null&&(e.logger.debug(`Checking out branch ${t.branch}`),await n.checkout(t.branch)),e.logger.debug("Checking for .fernignore file...");let s=Ft(r,Ze.of(".fernignore"));try{await q_i.access(s),e.logger.debug(".fernignore already exists")}catch{e.logger.debug("Creating .fernignore file..."),await q_i.writeFile(s,`# Specify files that shouldn't be modified by Fern
2024
+ `,"utf-8")}e.logger.debug("Committing changes...");let u=i??"SDK Generation";if(await n.commitAllChanges(u),e.logger.debug(`Committed changes to local copy of GitHub repository at ${r}`),!t.previewMode){await n.push();let A=await n.getCurrentBranch();e.logger.info(`Pushed branch: https://github.com/${t.uri}/tree/${A}`)}let l=t.branch??await n.getDefaultBranch(),p=new nLj({auth:t.token}),_=C7i(t.uri),{owner:h,repo:y}=_,b=`${h}:${c}`,{prTitle:v,prBody:O}=aj8(u);try{let{data:A}=await p.pulls.create({owner:h,repo:y,title:v,body:O,head:b,base:l,draft:!1});e.logger.info(`Created pull request: ${A.html_url}`)}catch(A){(A instanceof Error?A.message:String(A)).includes("A pull request already exists for")&&e.failWithoutThrowing(`A pull request already exists for ${b}`)}break}case"push":{t.branch!=null&&(e.logger.debug(`Checking out branch ${t.branch}`),await n.checkout(t.branch)),e.logger.debug("Checking for .fernignore file...");let s=Ft(r,Ze.of(".fernignore"));try{await q_i.access(s),e.logger.debug(".fernignore already exists")}catch{e.logger.debug("Creating .fernignore file..."),await q_i.writeFile(s,`# Specify files that shouldn't be modified by Fern
2025
2025
  `,"utf-8")}e.logger.debug("Committing changes...");let u=i??"SDK Generation";if(await n.commitAllChanges(u),e.logger.debug(`Committed changes to local copy of GitHub repository at ${r}`),!t.previewMode){await n.pushWithRebasingRemote();let l=await n.getCurrentBranch();e.logger.info(`Pushed branch: https://github.com/${t.uri}/tree/${l}`)}break}default:vt(f)}}catch(n){e.failAndThrow(`Error during GitHub self-hosted flow: ${String(n)}`)}}async function aLj(){return yyd.default.dir({tmpdir:hyd.default.platform()==="darwin"?oLj.default.join("/private",hyd.default.tmpdir()):void 0,prefix:"fern"})}function uj8({generatorInvocation:e,org:t,version:r,packageName:i,context:n}){if(e.raw?.github!=null&&sLj(e.raw.github)){let[a,o]=e.raw.github.uri.split("/");if(a==null||o==null)return n.failAndThrow(`Invalid GitHub repository URI: ${e.raw.github.uri}. Expected format: owner/repo`);let c=e.raw.github.mode==="pull-request"?"pull-request":void 0;return br.PublishingConfig.github({owner:a,repo:o,uri:e.raw.github.uri,token:e.raw.github.token,mode:c,branch:e.raw.github.branch,target:sj8({outputSchema:e.raw.output,version:r,packageName:i})})}if(e.raw?.output?.location==="local-file-system"){let a;if(e.language==="python")a=AB.pypi({version:r,packageName:i}),n.logger.debug(`Created PyPiPublishTarget: version ${r} package name: ${i}`);else if(e.language==="rust")a=AB.crates({version:r,packageName:i}),n.logger.debug(`Created CratesPublishTarget: version ${r} package name: ${i}`);else if(e.language==="java"){let o=e.raw?.config,c=(()=>{if(!o||typeof o!="object"||o===null)return;let s=o;if(typeof s.group=="string"&&typeof s.artifact=="string")return{groupId:s.group,artifactId:s.artifact};if(typeof s["package-prefix"]=="string"&&i)return{groupId:s["package-prefix"],artifactId:i};typeof s["package-prefix"]=="string"&&!i&&n.logger.warn("Java generator has package-prefix configured but packageName is missing")})(),f=c?`${c.groupId}:${c.artifactId}`:void 0;if(f){let s=r??"0.0.0";a=AB.maven({coordinate:f,version:s,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"}),n.logger.debug(`Created MavenPublishTarget: coordinate ${f} version ${s}`)}else o&&typeof o=="object"&&n.logger.debug("Java generator config provided but could not construct Maven coordinate. Expected either 'group' and 'artifact' or 'package-prefix' with packageName.")}return br.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:a})}return e.outputMode._visit({downloadFiles:()=>br.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:void 0}),github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:()=>{},_other:()=>{}})}function sj8({outputSchema:e,version:t,packageName:r}){let i=br.PublishTarget.postman({apiKey:"",workspaceId:"",collectionId:void 0});if(e==null)return i;if(e.location==="npm"){let n=(e.token||"${NPM_TOKEN}").trim(),a=n==="<USE_OIDC>"||n==="OIDC";return AB.npm({packageName:e["package-name"],version:t??"0.0.0",tokenEnvironmentVariable:a?"<USE_OIDC>":n.startsWith("${")&&n.endsWith("}")?n.slice(2,-1).trim():""})}else return e.location==="maven"?AB.maven({version:t??"0.0.0",coordinate:e.coordinate,usernameEnvironmentVariable:e.username||"MAVEN_USERNAME",passwordEnvironmentVariable:e.password||"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:e.url||"MAVEN_PUBLISH_REGISTRY_URL"}):e.location==="pypi"?AB.pypi({version:t,packageName:r}):i}function sLj(e){return e==null?!1:"uri"in e&&"token"in e}var cj8={defaultEndpoint:void 0,bannerLink:void 0,introduction:void 0,apiReferenceLink:void 0,apiName:void 0,disabledFeatures:void 0,whiteLabel:void 0,customSections:void 0,features:void 0,exampleStyle:void 0};function lj8(e,t){if(e.raw?.github!=null&&sLj(e.raw.github))return{...e.raw.github,previewMode:t}}var l8j=ae(TDi(),1);var GF={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};function sP(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}function qRt({example:e,visitor:t,nodePath:r}){if(typeof e=="string")e.startsWith("$")&&t.exampleTypeReference?.(e,r);else if(Xc(e))for(let i of Object.values(e))qRt({example:i,visitor:t,nodePath:r});else if(Array.isArray(e))for(let i of e)qRt({example:i,visitor:t,nodePath:r})}function r8t(e){return(t,r,{_default:i,validation:n,location:a}={})=>{e.typeReference?.({typeReference:t,_default:i,validation:n,location:a,nodePath:r},r)}}function cLj({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),uy(e,{url:i=>{t.serviceBaseUrl?.(i,[...r,"url"])},"base-path":Et,"display-name":Et,availability:Et,headers:i=>{lLj({headers:i,visitor:t,nodePath:[...r,"headers"]})},audiences:Et,auth:Et,"path-parameters":i=>{leo({pathParameters:i,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:i=>{for(let[n,a]of Object.entries(i)){let o=[...r,"endpoints",n];fj8({endpointId:n,endpoint:a,service:e,visitor:t,nodePathForEndpoint:o})}},idempotent:Et,transport:Et,source:Et})}function fj8({endpointId:e,endpoint:t,service:r,visitor:i,nodePathForEndpoint:n}){let a=r8t(i);i.httpEndpoint?.({endpointId:e,endpoint:t,service:r},n),uy(t,{docs:sP(i,n),"display-name":Et,availability:Et,"base-path":Et,path:Et,idempotent:Et,url:o=>{i.endpointBaseUrl?.({baseUrl:o,service:r},[...n,"url"])},"path-parameters":o=>{leo({pathParameters:o,visitor:i,nodePath:[...n,"path-parameters"]})},request:o=>{if(o==null)return;let c=[...n,"request"];if(typeof o=="string"){a(o,c,{location:"requestReference"});return}uy(o,{name:Et,docs:sP(i,c),"path-parameters":f=>{leo({pathParameters:f,visitor:i,nodePath:[...c,"path-parameters"]})},"query-parameters":f=>{if(f!=null)for(let[s,u]of Object.entries(f)){let l=[...c,"query-parameters",s];i.queryParameter?.({queryParameterKey:s,queryParameter:u},l),typeof u=="string"?a(u,l):uy(u,{name:Et,docs:sP(i,l),availability:Et,type:p=>{a(p,[...l,"type"],{_default:u.default,validation:u.validation})},"allow-multiple":Et,audiences:Et,encoding:Et,default:Et,validation:Et})}},"content-type":Et,headers:f=>{lLj({headers:f,visitor:i,nodePath:[...c,"headers"]})},body:f=>{if(f==null)return;let s=[...c,"body"];typeof f=="string"?a(f,s,{location:"requestReference"}):$P(f)?(i.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:f},s),uy(f,{extends:u=>{if(u==null)return;let l=typeof u=="string"?[u]:u;for(let p of l){let _=[...s,"extends",p];i.extension?.(p,_),a(p,_)}},properties:u=>{if(u!=null)for(let[l,p]of Object.entries(u)){let _=[...s,"properties",l];typeof p=="string"?a(p,_,{location:GF.InlinedRequestProperty}):uy(p,{name:Et,docs:sP(i,_),availability:Et,type:h=>{a(h,[..._,"type"],{location:GF.InlinedRequestProperty,_default:p.default,validation:p.validation})},style:Et,"content-type":Et,audiences:Et,encoding:Et,default:Et,validation:Et})}},"extra-properties":Et})):(sP(i,s)(f.docs),a(f.type,s))}})},audiences:Et,method:Et,auth:Et,"stream-condition":o=>{i.streamCondition?.({streamCondition:o,endpoint:t},[...n,"stream-condition"])},"response-stream":o=>{o!=null&&(typeof o=="string"?a(o,[...n,"response-stream"],{location:GF.StreamingResponse}):a(o.type,[...n,"response-stream"],{location:GF.StreamingResponse}))},response:o=>{if(o==null)return;let c=[...n,"response"];typeof o=="string"?a(o,c,{location:GF.Response}):uy(o,{docs:sP(i,c),type:f=>{f!=null&&a(f,[...c,"type"],{location:GF.Response})},property:Et,"status-code":Et})},errors:o=>{if(o!=null)for(let c of o){let f=[...n,"errors",typeof c=="string"?c:c.error];typeof c=="string"?i.errorReference?.(c,f):uy(c,{docs:sP(i,f),error:s=>{i.errorReference?.(s,[...f,"error"])}})}},examples:o=>{if(o!=null)for(let[c,f]of o.entries())dj8({nodePathForExample:[...n,{key:"examples",arrayIndex:c}],visitor:i,service:r,endpoint:t,example:f})},pagination:Et,source:Et,transport:Et,retries:Et})}function dj8({nodePathForExample:e,visitor:t,service:r,endpoint:i,example:n}){if(n.headers==null&&n["path-parameters"]==null&&n["query-parameters"]==null&&n.request==null&&n.response==null&&n["code-samples"]!=null)return;t.exampleHttpEndpointCall?.({service:r,endpoint:i,example:n},e);let a=[...e,"headers"];if(t.exampleHeaders?.({service:r,endpoint:i,examples:n.headers},a),n.headers!=null)for(let u of Object.values(n.headers))qRt({example:u,visitor:t,nodePath:a});let o=[...e,"path-parameters"];if(t.examplePathParameters?.({service:r,endpoint:i,examples:n["path-parameters"]},o),n["path-parameters"]!=null)for(let u of Object.values(n["path-parameters"]))qRt({example:u,visitor:t,nodePath:o});let c=[...e,"query-parameters"];if(t.exampleQueryParameters?.({service:r,endpoint:i,examples:n["query-parameters"]},c),n["query-parameters"]!=null)for(let u of Object.values(n["query-parameters"]))qRt({example:u,visitor:t,nodePath:c});let f=[...e,"request"];t.exampleRequest?.({service:r,endpoint:i,example:n.request},f),n.request!=null&&qRt({example:n.request,visitor:t,nodePath:f});let s=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:i,example:n.response},s),n.response!=null&&VKi(i,n.response,{body:u=>{u.body!=null&&qRt({example:u.body,visitor:t,nodePath:s}),u.error!=null&&t.errorReference?.(u.error,[...s,"error"])},stream:u=>{for(let l of u.stream)qRt({example:l,visitor:t,nodePath:s})},events:u=>{for(let{data:l}of u.stream)qRt({example:l,visitor:t,nodePath:s})}}),n["code-samples"]!=null)for(let[u,l]of n["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:i,example:n,sample:l},[...e,{key:"code-samples",arrayIndex:u}])}function leo({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let i=r8t(t);for(let[n,a]of Object.entries(e)){let o=[...r,n];t.pathParameter?.({pathParameterKey:n,pathParameter:a},o),$Fn(a)?typeof a=="string"?t.variableReference?.(a,o):uy(a,{docs:sP(t,o),variable:c=>t.variableReference?.(c,[...o,"variable"]),availability:Et}):typeof a=="string"?i(a,o):uy(a,{docs:sP(t,o),type:c=>{i(c,[...o,"type"],{_default:a.default,validation:a.validation})},availability:Et,encoding:Et,default:Et,validation:Et,name:Et,audiences:Et})}}function lLj({headers:e,visitor:t,nodePath:r}){if(e==null)return;let i=r8t(t);for(let[n,a]of Object.entries(e)){let o=[...r,n];t.header?.({headerKey:n,header:a},o),typeof a=="string"?i(a,o):uy(a,{name:Et,availability:Et,type:c=>{i(c,o,{_default:a.default,validation:a.validation})},docs:sP(t,o),audiences:Et,encoding:Et,env:Et,default:Et,validation:Et})}}function fLj({typeDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[i,n]of Object.entries(e)){let a=[...r,i];t.typeName?.(i,a),byd({typeName:i,declaration:n,visitor:t,nodePathForType:a})}}function byd({typeName:e,declaration:t,visitor:r,nodePathForType:i}){let n=r8t(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:i},i);let a=o=>{if(o!=null)for(let[c,f]of o.entries()){let s=[...i,{key:"examples",arrayIndex:c}];r.exampleType?.({typeName:e,typeDeclaration:t,example:f},s),qRt({example:f.value,nodePath:s,visitor:r})}};jB(t,{alias:o=>{typeof o=="string"?n(o,i):uy(o,{type:c=>{n(c,[...i,"type"])},docs:sP(r,i),availability:Et,audiences:Et,examples:a,validation:Et,encoding:Et,source:Et,inline:Et})},object:o=>{uy(o,{docs:sP(r,i),extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let s of f){let u=[...i,"extends",s];r.extension?.(s,u),n(s,u)}},properties:c=>{if(c!=null)for(let[f,s]of Object.entries(c)){let u=[...i,"properties",f];typeof s=="string"?n(s,u):uy(s,{name:Et,docs:sP(r,u),availability:Et,type:l=>{n(l,[...u,"type"],{_default:s.default,validation:s.validation})},audiences:Et,encoding:Et,default:Et,validation:Et,access:Et})}},"extra-properties":Et,availability:Et,audiences:Et,encoding:Et,source:Et,examples:a,inline:Et})},discriminatedUnion:o=>{uy(o,{docs:sP(r,i),discriminant:Et,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let s of f){let u=[...i,"extends",s];r.extension?.(s,u),n(s,u)}},union:c=>{for(let[f,s]of Object.entries(c)){let u=[...i,"union",f];typeof s=="string"?n(s,u):uy(s,{docs:sP(r,u),name:Et,key:Et,type:l=>{typeof l=="string"&&n(l,[...i,"type"])},"display-name":Et,availability:Et})}},"base-properties":Et,availability:Et,audiences:Et,encoding:Et,source:Et,examples:a,inline:Et})},undiscriminatedUnion:o=>{uy(o,{docs:sP(r,i),discriminated:Et,union:c=>{for(let[f,s]of c.entries()){let u=[...i,`union[${f}]`];typeof s!="string"&&uy(s,{docs:sP(r,u),type:l=>{n(l,[...i,"type"])},"display-name":Et,validation:Et})}},availability:Et,audiences:Et,encoding:Et,source:Et,examples:a,inline:Et})},enum:o=>{uy(o,{docs:sP(r,i),enum:c=>{for(let f of c){let s=[...i,typeof f=="string"?f:f.name??f.value];typeof f!="string"&&uy(f,{docs:sP(r,s),name:Et,value:Et,casing:Et})}},availability:Et,audiences:Et,default:Et,encoding:Et,source:Et,examples:a,inline:Et})}})}function dLj({errorDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[i,n]of Object.entries(e)){let a=[...r,i];t.errorDeclaration?.({errorName:i,declaration:n},a),pj8({errorName:i,declaration:n,visitor:t,nodePathForError:a})}}function pj8({errorName:e,declaration:t,visitor:r,nodePathForError:i}){let n=r8t(r);typeof t=="string"?n(t,i):uy(t,{docs:sP(r,i),"status-code":Et,type:a=>{if(a==null)return;let o=[...i,"type"];typeof a=="string"?n(a,o):byd({typeName:e,declaration:a,visitor:r,nodePathForType:o})},examples:a=>{if(a!=null)for(let o of a){let c=[...i,"type"];r.exampleError?.({errorName:e,declaration:t,example:o},c)}}})}function pLj({imports:e,visitor:t,nodePath:r}){if(e!=null)for(let[i,n]of Object.entries(e))t.import?.({importPath:n,importedAs:i},[...r,i])}function _Lj({webhook:e,visitor:t,nodePathForWebhook:r}){let i=r8t(t);uy(e,{"display-name":Et,method:Et,examples:Et,headers:n=>{_j8({headers:n,visitor:t,nodePath:[...r,"headers"]})},payload:n=>{let a=[...r,"payload"];if(typeof n=="string"){i(n,a,{location:"requestReference"});return}if(hj8(n)){i(n.type,[...a,"type"],{location:"requestReference"});return}let o=[...a];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:n},o),uy(n,{name:Et,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let s of f){let u=[...o,"extends",s];t.extension?.(s,u),i(s,u)}},properties:c=>{if(c!=null)for(let[f,s]of Object.entries(c)){let u=[...o,"properties",f];typeof s=="string"?i(s,u,{location:GF.InlinedRequestProperty}):uy(s,{name:Et,docs:sP(t,u),availability:Et,type:l=>{i(l,[...u,"type"],{_default:s.default,validation:s.validation,location:GF.InlinedRequestProperty})},audiences:Et,encoding:Et,default:Et,validation:Et,access:Et})}}})},audiences:Et,availability:Et,docs:sP(t,r)})}function _j8({headers:e,visitor:t,nodePath:r}){if(e==null)return;let i=r8t(t);for(let[n,a]of Object.entries(e)){let o=[...r,n];t.header?.({headerKey:n,header:a},o),typeof a=="string"?i(a,o):uy(a,{name:Et,availability:Et,type:c=>{i(c,o,{_default:a.default,validation:a.validation})},docs:sP(t,o),audiences:Et,encoding:Et,env:Et,default:Et,validation:Et})}}function hj8(e){return e.type!=null}function S3(e,t){uy(e,{docs:sP(t,[]),imports:r=>{pLj({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{fLj({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&cLj({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[i,n]of Object.entries(r??{}))_Lj({webhook:n,visitor:t,nodePathForWebhook:["webhooks",i]})},channel:Et,errors:r=>{dLj({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}function vyd(e,t){uy(e,{docs:Et,imports:Et,types:Et,service:Et,webhooks:Et,errors:Et,channel:Et,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}function gyd(e,t){t.file?.(e,[]),uy(e,{version:Et,product:Et,name:Et,"default-url":Et,"display-name":Et,imports:Et,auth:Et,"idempotency-headers":Et,"auth-schemes":r=>Object.entries(r??{}).map(([i,n])=>{iac(n)&&t.oauth?.({name:i,oauth:n},["auth-scheme",i])}),pagination:Et,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:Et,headers:Et,environments:r=>{if(r!=null)for(let[i,n]of Object.entries(r))t.environment?.({environmentId:i,environment:n},["environments",i])},"error-discrimination":r=>{t.errorDiscrimination?.(r,["error-discrimination"])},audiences:Et,errors:r=>{if(r!=null)for(let i of r)t.errorReference?.(i,["errors",i])},"base-path":Et,"path-parameters":r=>{leo({pathParameters:r,visitor:t,nodePath:["path-parameters"]})},variables:r=>{if(r!=null)for(let[i,n]of Object.entries(r))t.variableDeclaration?.({variableId:i,variable:n},["variables",i])}})}var UAs=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");function hLj({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:i}){function n(a){let o=(c,f)=>{for(let s of r){let u=s.definitionFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});i(l.map(p=>({severity:p.severity,relativeFilepath:e,nodePath:f,message:p.message})))}}};return{[a]:o}}return{...n("docs"),...n("import"),...n("typeReference"),...n("typeDeclaration"),...n("typeName"),...n("httpService"),...n("httpEndpoint"),...n("pathParameter"),...n("queryParameter"),...n("streamCondition"),...n("header"),...n("errorDeclaration"),...n("errorReference"),...n("exampleType"),...n("exampleTypeReference"),...n("exampleHttpEndpointCall"),...n("exampleCodeSample"),...n("exampleHeaders"),...n("examplePathParameters"),...n("exampleQueryParameters"),...n("exampleRequest"),...n("exampleResponse"),...n("variableReference"),...n("extension"),...n("serviceBaseUrl"),...n("endpointBaseUrl"),...n("exampleError")}}function yLj({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:i}){function n(a){let o=(c,f)=>{for(let s of r){let u=s.packageMarker?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});i(l.map(p=>({severity:p.severity,relativeFilepath:e,nodePath:f,message:p.message})))}}};return{[a]:o}}return{...n("export"),...n("navigation")}}function bLj({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:i}){function n(a){let o=(c,f)=>{for(let s of r){let u=s.rootApiFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});i(l.map(p=>({severity:p.severity,relativeFilepath:e,nodePath:f,message:p.message})))}}};return{[a]:o}}return{...n("file"),...n("oauth"),...n("defaultEnvironment"),...n("environment"),...n("errorDiscrimination"),...n("errorReference"),...n("variableDeclaration"),...n("variableReference"),...n("pathParameter")}}var Oyd={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(LKi(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&$P(e.request.body)){let r=[];for(let[i,n]of Object.entries(e.request.body.properties??{}))typeof n!="string"&&n["content-type"]!=null&&r.push({severity:"fatal",message:`${i} has content-type, but the request is not multipart`});return r}return[]}}})};var oO=dx({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var Ayd={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new _b(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:i,contents:n})=>{if(r.request==null||typeof r.request=="string"||r.request?.body==null||typeof r.request.body=="string")return[];if(!yj8(r.request.body))return[];let a=[];for(let[o,c]of Object.entries(r.request.body.properties??{})){if(typeof c=="string"||c.style!=="exploded")continue;let f=nf({relativeFilepath:i,definitionFile:n,casingsGenerator:oO,rootApiFile:e.definition.rootApiFile.contents}),s=t.resolveType({type:c.type,file:f});if(s==null)return[];vLj(s)||a.push({message:`${o} is exploded and must be a list. Did you mean list<${c.type}>?`,severity:"error"})}return a}}}}};function vLj(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?vLj(e.container.itemType):!1}function yj8(e){return e?.properties!=null}var myd={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(pgi(e.definition)),r=new Set;return t.forEach(i=>{let n=Ft(e.definition.absoluteFilePath,Ze.of(i));r.add(n)}),{definitionFile:{import:({importedAs:i,importPath:n},{relativeFilepath:a})=>{let o=[],c=Ft(e.definition.absoluteFilePath,hn(a),Ze.of(n));return r.has(c)||o.push({severity:"fatal",message:`Import ${Lt.bold(i)} points to non-existent path ${Lt.bold(n)}.`}),o}}}}};function LAs(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(ghe(r))for(let i of Object.keys(r.urls))t.includes(i)||t.push(i);return t},[])}var Pyd={name:"matching-environment-urls",create:({workspace:e})=>{let t=LAs(e);return t.length===0?{}:{rootApiFile:{environment:({environmentId:r,environment:i})=>{let n=[],a=o=>{n.push({severity:"fatal",message:`Environment ${r} is missing URL for ${Lt.bold(o)}`})};return nGt(i,{singleBaseUrl:()=>{for(let o of t)a(o)},multipleBaseUrls:o=>{for(let c of t)o.urls[c]==null&&a(c)}}),n}}}}};var jyd={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=bj8(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:i})=>{let n=t[i];if(n==null)return[];let a=c1i({referencedIn:i,importPath:Ze.of(r)});return n.filter(({chainWithoutStartingFilepath:c})=>c.length===0||c[0]===a).map(c=>({severity:"fatal",message:c.chainWithoutStartingFilepath.length===0?"A file cannot import itself":`Circular import detected: ${[c.startingFilepath,...c.chainWithoutStartingFilepath,c.startingFilepath].join(" -> ")}`}))}}}}};function bj8(e){let t={};for(let r of XRt(e))t[r]=gLj(r,[r],e);return t}function gLj(e,t,r){let i=[],n=r[e];if(n==null)return[];if(n.contents.imports!=null)for(let a of Object.values(n.contents.imports)){let o=c1i({referencedIn:e,importPath:Ze.of(a)});t.includes(o)?t[0]===o&&t[0]===vj8(t)&&i.push({startingFilepath:o,chainWithoutStartingFilepath:t.slice(1)}):i.push(...gLj(o,[...t,o],r))}return i}function vj8(e){return e.reduce((t,r)=>r<t?r:t)}var VAs=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new _b(t)}isTypeComplex(t,r){let i=nf({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:oO,rootApiFile:this.workspace.definition.rootApiFile.contents}),n=this.typeResolver.resolveType({type:t,file:i});if(n==null)return;let a=new Set;return this.isResolvedReferenceComplex({type:n,file:i,visited:a})}isResolvedReferenceComplex({type:t,file:r,visited:i}){switch(t._type){case"container":return this.isResolvedContainerComplex({type:t.container,file:r,visited:i});case"named":return this.isNamedTypeComplex({type:t,file:r,visited:i});case"primitive":return!1;case"unknown":return!1;default:vt(t)}}isResolvedContainerComplex({type:t,file:r,visited:i}){switch(t._type){case"literal":return!1;case"map":return(this.isResolvedReferenceComplex({type:t.keyType,file:r,visited:i})||this.isResolvedReferenceComplex({type:t.valueType,file:r,visited:i}))&&!(t.keyType._type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType._type==="unknown");case"optional":case"nullable":case"list":case"set":return this.isResolvedReferenceComplex({type:t.itemType,file:r,visited:i});default:vt(t)}}isNamedTypeComplex({type:t,file:r,visited:i}){if(i.has(t.rawName))return!1;if(i.add(t.rawName),OCi(t.declaration))return!0;if(aFt(t.declaration))return!1;if(pb(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:i});if(YFn(t.declaration)){for(let n of t.declaration.union){let a=typeof n=="string"?n:n.type,o=this.isTypeComplex(a,{contents:r.definitionFile,relativeFilepath:r.relativeFilepath});if(o!=null&&o)return!0}return!1}vt(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:i,visited:n}){return OPe({typeName:t,objectDeclaration:r,typeResolver:this.typeResolver,definitionFile:i.definitionFile,workspace:this.workspace,filepathOfDeclaration:i.relativeFilepath,smartCasing:!1}).some(o=>this.isComplex({type:o.resolvedPropertyType,file:i,visited:n}))}isComplex({type:t,file:r,visited:i}){switch(t._type){case"named":return this.isNamedTypeComplex({type:t,file:r,visited:i});case"primitive":case"unknown":return!1;case"container":return this.isComplexContainer({type:t.container,file:r,visited:i});default:vt(t)}}isComplexContainer({type:t,file:r,visited:i}){switch(t._type){case"literal":return!1;case"map":return this.isComplex({type:t.keyType,file:r,visited:i})||this.isComplex({type:t.valueType,file:r,visited:i});case"optional":case"nullable":case"list":case"set":return this.isComplex({type:t.itemType,file:r,visited:i});default:vt(t)}}};var wyd={name:"no-complex-query-params",create:({workspace:e})=>{let t=new VAs(e);return{definitionFile:{queryParameter:({queryParameter:r},i)=>{let n=typeof r=="string"?r:r.type,a=t.isTypeComplex(n,i);return a!=null&&a?[{severity:"fatal",message:`${n} is not a valid type for a query parameter`}]:[]}}}}};var Eyd={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===BGo?[{severity:"fatal",message:`Path parameter ${Lt.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function feo({service:e,endpoint:t}){return e["base-path"]+t.path}var WAs=class{root=new Syd;registerEndpoint(t){this.root.insert(this.getPathPartsForEndpoint(t),t)}getConflictingEndpoints(t){return this.root.getMatchingEndpoints(this.getPathPartsForEndpoint(t)).filter(r=>!(r.relativeFilepath===t.relativeFilepath&&r.endpointId===t.endpointId)&&r.endpoint.method===t.endpoint.method)}getPathPartsForEndpoint(t){return feo({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},Syd=class e{childPaths={};childPathParam;endpointsThatEndWithThisNode=[];insert(t,r){let[i,...n]=t;if(i==null){this.endpointsThatEndWithThisNode.push(r);return}(this.isPathParam(i)?this.childPathParam??=new e:this.childPaths[i]??=new e).insert(n,r)}getMatchingEndpoints(t){let[r,...i]=t;if(r==null)return this.endpointsThatEndWithThisNode;let n=[];if(this.isPathParam(r))n.push(...Object.values(this.childPaths).flatMap(a=>a.getMatchingEndpoints(i)));else{let a=this.childPaths[r];a!=null&&n.push(...a.getMatchingEndpoints(i))}return this.childPathParam!=null&&n.push(...this.childPathParam.getMatchingEndpoints(i)),n}isPathParam(t){return t.startsWith("{")&&t.endsWith("}")}};var Myd={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new WAs;return TB(e,(r,i)=>{S3(i,{httpEndpoint:({service:n,endpointId:a,endpoint:o})=>{t.registerEndpoint({service:n,endpointId:a,endpoint:o,relativeFilepath:r})}})}),{definitionFile:{httpEndpoint:({service:r,endpoint:i,endpointId:n},{relativeFilepath:a})=>{let o=t.getConflictingEndpoints({service:r,endpointId:n,endpoint:i,relativeFilepath:a});return o.length===0?[]:[{severity:"warning",message:[`Endpoint path ${feo({service:r,endpoint:i})} conflicts with other endpoints:`,...o.map(c=>` - ${c.relativeFilepath} -> ${c.endpointId} ${Lt.dim(feo({service:c.service,endpoint:c.endpoint}))}`)].join(`
2026
2026
  `)}]}}}}};var Dyd={name:"no-conflicting-request-wrapper-properties",create:({workspace:e})=>({definitionFile:{httpEndpoint:({endpoint:t,service:r},{contents:i,relativeFilepath:n})=>{let a=gj8({endpoint:t,service:r,relativeFilepath:n,definitionFile:i,workspace:e}),o=[];for(let[c,f]of Object.entries(a))f.length<=1||o.push({severity:"fatal",message:`Multiple request properties have the name ${Lt.bold(c)}. This is not suitable for code generation. Use the "name" property to deconflict.
2027
2027
  `+f.map(s=>` - ${Oj8(s)}`).join(`