fern-api 0.42.4 → 0.42.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.cjs +4 -4
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1784,7 +1784,7 @@ ${l.indent}`:""}${i4c(o)}:${f.indent?" ":""}`;return u=!1,c=!0,f.objectItem=void
|
|
|
1784
1784
|
`}),r.replaceAll(/\n$/g,"")}function UZP(e){return e?cl.green(n8r.radioOn):n8r.radioOff}var Opa=yu(Bje(),1);function rQl(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var Hdi=class extends dR{_run(t){this.done=t;let r=cW(this.rl),n=r.line.pipe((0,Opa.map)(this.filterInput.bind(this))),i=this.handleSubmitEvents(n);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,Opa.takeUntil)(i.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),n="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(n=`
|
|
1785
1785
|
`+cl.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?cl.cyan(rQl(t,this.opt.mask)):cl.italic.dim("[hidden]"):this.opt.mask?rQl(t,this.opt.mask):cl.italic.dim("[input is hidden] ")}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){var t;(t=this.opt).default&&(t.default=void 0),this.render()}};var MZl=yu(EZl(),1),xZl=yu(Bje(),1);var epi=class extends dR{_run(t){this.done=t,this.editorResult=new xZl.Subject;let r=cW(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?cl.dim("Received"):cl.dim("Press <enter> to launch your preferred editor."),t&&(r=cl.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),(0,MZl.editAsync)(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var IZl=yu(CZl(),1);var zZl=yu(require("readline"),1),BZl=yu(NZl(),1),Hkr=class{constructor(t){this.rl||(this.rl=zZl.default.createInterface(qkP(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 qkP(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new BZl.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var tpi=class extends Hkr{constructor(t={}){super(t),this.log=(0,IZl.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return Bdi(this.rl,this.bottomBar.split(`
|
|
1786
1786
|
`).length),this}updateBottomBar(t){return Bdi(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+`
|
|
1787
|
-
`}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&&vpa(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var GZl=yu(LZl(),1),KZl=yu(anu(),1),YZl=yu($Zl(),1),iq=yu(Bje(),1),XZl=yu(Hfi(),1);var Wpa=yu(Bje(),1),JZl=yu(Hfi(),1),Hpa=function(e,t,r){return typeof e[t]!="function"?(0,Wpa.of)(e):(0,Wpa.from)((0,JZl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var rpi={isPlainObject:GZl.default,set:YZl.default,get:KZl.default},KAn=class extends Hkr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=rpi.isPlainObject(r)?{...r}:{},rpi.isPlainObject(t)&&(t=Object.values(t).every(i=>rpi.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,iq.from)(t):t;return this.process=n.pipe((0,iq.concatMap)(this.processQuestion.bind(this)),(0,iq.publish)()),this.process.connect(),this.process.pipe((0,iq.reduce)((i,a)=>(rpi.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,iq.defer)(()=>(0,iq.of)(t).pipe((0,iq.concatMap)(this.setDefaultType.bind(this)),(0,iq.concatMap)(this.filterIfRunnable.bind(this)),(0,iq.concatMap)(()=>Hpa(t,"message",this.answers)),(0,iq.concatMap)(()=>Hpa(t,"default",this.answers)),(0,iq.concatMap)(()=>Hpa(t,"choices",this.answers)),(0,iq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,iq.defer)(()=>(0,iq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,iq.defer)(()=>(0,iq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&rpi.get(this.answers,t.name)!==void 0)return(0,iq.empty)();if(t.when===!1)return(0,iq.empty)();if(typeof t.when!="function")return(0,iq.of)(t);let{answers:r}=this;return(0,iq.defer)(()=>(0,iq.from)((0,XZl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,iq.filter)(n=>n!=null)))}};function QZl(e){let t=function(r,n){let i;try{i=new KAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",Rdi),this.registerPrompt("input",Ikr),this.registerPrompt("number",Fdi),this.registerPrompt("confirm",Ldi),this.registerPrompt("rawlist",Udi),this.registerPrompt("expand",Vdi),this.registerPrompt("checkbox",Wdi),this.registerPrompt("password",Hdi),this.registerPrompt("editor",epi)},t.restoreDefaultPrompts(),t}var Ziu=QZl();function YkP(e,t){Ziu.registerPrompt(e,t)}function XkP(){Ziu.restoreDefaultPrompts()}var QkP={prompt:Ziu,ui:{BottomBar:tpi,Prompt:KAn},createPromptModule:QZl,registerPrompt:YkP,restoreDefaultPrompts:XkP,Separator:gne},$pa=QkP;var pkl=yu(iau(),1),Gpa=class{posthog;constructor({posthogApiKey:t}){this.posthog=new pkl.PostHog(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.42.
|
|
1787
|
+
`}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&&vpa(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var GZl=yu(LZl(),1),KZl=yu(anu(),1),YZl=yu($Zl(),1),iq=yu(Bje(),1),XZl=yu(Hfi(),1);var Wpa=yu(Bje(),1),JZl=yu(Hfi(),1),Hpa=function(e,t,r){return typeof e[t]!="function"?(0,Wpa.of)(e):(0,Wpa.from)((0,JZl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var rpi={isPlainObject:GZl.default,set:YZl.default,get:KZl.default},KAn=class extends Hkr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=rpi.isPlainObject(r)?{...r}:{},rpi.isPlainObject(t)&&(t=Object.values(t).every(i=>rpi.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,iq.from)(t):t;return this.process=n.pipe((0,iq.concatMap)(this.processQuestion.bind(this)),(0,iq.publish)()),this.process.connect(),this.process.pipe((0,iq.reduce)((i,a)=>(rpi.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,iq.defer)(()=>(0,iq.of)(t).pipe((0,iq.concatMap)(this.setDefaultType.bind(this)),(0,iq.concatMap)(this.filterIfRunnable.bind(this)),(0,iq.concatMap)(()=>Hpa(t,"message",this.answers)),(0,iq.concatMap)(()=>Hpa(t,"default",this.answers)),(0,iq.concatMap)(()=>Hpa(t,"choices",this.answers)),(0,iq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,iq.defer)(()=>(0,iq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,iq.defer)(()=>(0,iq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&rpi.get(this.answers,t.name)!==void 0)return(0,iq.empty)();if(t.when===!1)return(0,iq.empty)();if(typeof t.when!="function")return(0,iq.of)(t);let{answers:r}=this;return(0,iq.defer)(()=>(0,iq.from)((0,XZl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,iq.filter)(n=>n!=null)))}};function QZl(e){let t=function(r,n){let i;try{i=new KAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",Rdi),this.registerPrompt("input",Ikr),this.registerPrompt("number",Fdi),this.registerPrompt("confirm",Ldi),this.registerPrompt("rawlist",Udi),this.registerPrompt("expand",Vdi),this.registerPrompt("checkbox",Wdi),this.registerPrompt("password",Hdi),this.registerPrompt("editor",epi)},t.restoreDefaultPrompts(),t}var Ziu=QZl();function YkP(e,t){Ziu.registerPrompt(e,t)}function XkP(){Ziu.restoreDefaultPrompts()}var QkP={prompt:Ziu,ui:{BottomBar:tpi,Prompt:KAn},createPromptModule:QZl,registerPrompt:YkP,restoreDefaultPrompts:XkP,Separator:gne},$pa=QkP;var pkl=yu(iau(),1),Gpa=class{posthog;constructor({posthogApiKey:t}){this.posthog=new pkl.PostHog(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.42.6",usingAccessToken:!0}})}flush(){this.posthog.flush()}};var opi=class{async sendEvent(){}async identify(){}async flush(){}};var XAn=require("fs/promises"),Akl=require("os"),Nkl=require("path"),zkl=yu(iau(),1);var hRt=yu(Ckl(),1),mU7=hRt.default.v1,OU7=hRt.default.v3,Jkr=hRt.default.v4,PU7=hRt.default.v5,jU7=hRt.default.NIL,wU7=hRt.default.version,DU7=hRt.default.validate,SU7=hRt.default.stringify,EU7=hRt.default.parse;var St1="id",Et1=".fern",lpi=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new zkl.PostHog(r),this.userId=t==null?void 0:yZo(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.42.6",...t,...t.properties}})}flush(){this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=pf(I_.of((0,Akl.homedir)()),zs.of(Et1),zs.of(St1));await Vh(t)||(await(0,XAn.mkdir)((0,Nkl.dirname)(t),{recursive:!0}),await(0,XAn.writeFile)(t,Jkr())),this.persistedDistinctId=(await(0,XAn.readFile)(t)).toString()}return this.persistedDistinctId}};var dau;async function QAn(){return dau==null&&(dau=await Mt1()),dau}async function Mt1(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new opi;let r=await Oua();return r!=null?new lpi({token:r,posthogApiKey:e}):await mua()!=null?new Gpa({posthogApiKey:e}):new lpi({token:void 0,posthogApiKey:e})}catch{return new opi}}var uou=yu(vRt(),1);var ppi=yu(require("process"),1);var xtf=yu(Iau(),1),Ttf=yu(Mtf(),1);function N9(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Kqt(e),e.length===0))return 0;e=e.replace((0,Ttf.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(a<=31||a>=127&&a<=159||a>=768&&a<=879)continue;switch(xtf.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function m_a(e){let t=0;for(let r of e.split(`
|
|
1788
1788
|
`))t=Math.max(t,N9(r));return t}var Xtf=yu(Fau(),1);var wn1=/[\p{Lu}]/u,Dn1=/[\p{Ll}]/u,Atf=/^[\p{Lu}](?![\p{Lu}])/gu,Btf=/([\p{Alpha}\p{N}_]|$)/u,Lau=/[_.\- ]+/,Sn1=new RegExp("^"+Lau.source),Ntf=new RegExp(Lau.source+Btf.source,"gu"),ztf=new RegExp("\\d+"+Btf.source,"gu"),En1=(e,t,r,n)=>{let i=!1,a=!1,u=!1,f=!1;for(let d=0;d<e.length;d++){let c=e[d];f=d>2?e[d-3]==="-":!0,i&&wn1.test(c)?(e=e.slice(0,d)+"-"+e.slice(d),i=!1,u=a,a=!0,d++):a&&u&&Dn1.test(c)&&(!f||n)?(e=e.slice(0,d-1)+"-"+e.slice(d-1),u=a,a=!1,i=!0):(i=t(c)===c&&r(c)!==c,u=a,a=r(c)===c&&t(c)!==c)}return e},Mn1=(e,t)=>(Atf.lastIndex=0,e.replace(Atf,r=>t(r))),xn1=(e,t)=>(Ntf.lastIndex=0,ztf.lastIndex=0,e.replace(Ntf,(r,n)=>t(n)).replace(ztf,r=>t(r)));function Uau(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(a=>a.trim()).filter(a=>a.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?a=>a.toLowerCase():a=>a.toLocaleLowerCase(t.locale),n=t.locale===!1?a=>a.toUpperCase():a=>a.toLocaleUpperCase(t.locale);return e.length===1?Lau.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=En1(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(Sn1,""),e=t.preserveConsecutiveUppercase?Mn1(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),xn1(e,n))}var $au=yu(Rtf(),1);var Ftf=(e=0)=>t=>`\x1B[${t+e}m`,Ltf=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Utf=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`;function An1(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,n]of Object.entries(t)){for(let[i,a]of Object.entries(n))t[i]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},n[i]=t[i],e.set(a[0],a[1]);Object.defineProperty(t,r,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Ftf(),t.color.ansi256=Ltf(),t.color.ansi16m=Utf(),t.bgColor.ansi=Ftf(10),t.bgColor.ansi256=Ltf(10),t.bgColor.ansi16m=Utf(10),Object.defineProperties(t,{rgbToAnsi256:{value:(r,n,i)=>r===n&&n===i?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:i}=n.groups;i.length===3&&(i=i.split("").map(u=>u+u).join(""));let a=Number.parseInt(i,16);return[a>>16&255,a>>8&255,a&255]},enumerable:!1},hexToAnsi256:{value:r=>t.rgbToAnsi256(...t.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:r=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,i,a;if(r>=232)n=((r-232)*10+8)/255,i=n,a=n;else{r-=16;let d=r%36;n=Math.floor(r/36)/5,i=Math.floor(d/6)/5,a=d%6/5}let u=Math.max(n,i,a)*2;if(u===0)return 30;let f=30+(Math.round(a)<<2|Math.round(i)<<1|Math.round(n));return u===2&&(f+=60),f},enumerable:!1},rgbToAnsi:{value:(r,n,i)=>t.ansi256ToAnsi(t.rgbToAnsi256(r,n,i)),enumerable:!1},hexToAnsi:{value:r=>t.ansi256ToAnsi(t.hexToAnsi256(r)),enumerable:!1}}),t}var Nn1=An1(),Vtf=Nn1;var O_a=new Set(["\x1B","\x9B"]),zn1=39,Wau="\x07",$tf="[",Bn1="]",Jtf="m",Hau=`${Bn1}8;;`,Wtf=e=>`${O_a.values().next().value}${$tf}${e}${Jtf}`,Htf=e=>`${O_a.values().next().value}${Hau}${e}${Wau}`,In1=e=>e.split(" ").map(t=>N9(t)),Vau=(e,t,r)=>{let n=[...t],i=!1,a=!1,u=N9(Kqt(e[e.length-1]));for(let[f,d]of n.entries()){let c=N9(d);if(u+c<=r?e[e.length-1]+=d:(e.push(d),u=0),O_a.has(d)&&(i=!0,a=n.slice(f+1).join("").startsWith(Hau)),i){a?d===Wau&&(i=!1,a=!1):d===Jtf&&(i=!1);continue}u+=c,u===r&&f<n.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Rn1=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(N9(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Fn1=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,u=In1(e),f=[""];for(let[c,o]of e.split(" ").entries()){r.trim!==!1&&(f[f.length-1]=f[f.length-1].trimStart());let l=N9(f[f.length-1]);if(c!==0&&(l>=t&&(r.wordWrap===!1||r.trim===!1)&&(f.push(""),l=0),(l>0||r.trim===!1)&&(f[f.length-1]+=" ",l++)),r.hard&&u[c]>t){let g=t-l,O=1+Math.floor((u[c]-g-1)/t);Math.floor((u[c]-1)/t)<O&&f.push(""),Vau(f,o,t);continue}if(l+u[c]>t&&l>0&&u[c]>0){if(r.wordWrap===!1&&l<t){Vau(f,o,t);continue}f.push("")}if(l+u[c]>t&&r.wordWrap===!1){Vau(f,o,t);continue}f[f.length-1]+=o}r.trim!==!1&&(f=f.map(c=>Rn1(c)));let d=[...f.join(`
|
|
1789
1789
|
`)];for(let[c,o]of d.entries()){if(n+=o,O_a.has(o)){let{groups:g}=new RegExp(`(?:\\${$tf}(?<code>\\d+)m|\\${Hau}(?<uri>.*)${Wau})`).exec(d.slice(c).join(""))||{groups:{}};if(g.code!==void 0){let O=Number.parseFloat(g.code);i=O===zn1?void 0:O}else g.uri!==void 0&&(a=g.uri.length===0?void 0:g.uri)}let l=Vtf.codes.get(Number(i));d[c+1]===`
|
|
1790
1790
|
`?(a&&(n+=Htf("")),i&&l&&(n+=Wtf(l))):o===`
|
|
@@ -1901,10 +1901,10 @@ errors:
|
|
|
1901
1901
|
Run ${cl.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1902
1902
|
Run ${cl.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),u6n(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Tsu({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!luf(e))return;let i=t??"",a=e.filter(f=>f.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((f,d)=>f.generatorName.localeCompare(d.generatorName)||f.currentVersion.localeCompare(d.currentVersion));for(let f of u)i+=`
|
|
1903
1903
|
${await Rp1(f.generatorName)} (${f.apiName!=null?"API: "+f.apiName+", ":""}Group: ${f.generatorGroup}) `+cl.dim(f.currentVersion)+cl.reset(" \u2192 ")+cl.green(f.latestVersion);return i+=`
|
|
1904
|
-
`,n?u6n(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function Rp1(e){let r=await new cuf.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 Fp1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=pg.getGeneratorNameOrThrow(o.name,l),O=await pg.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=pg.getGeneratorNameOrThrow(c.name,o),g=await pg.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await pg.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilepath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function puf(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=Pne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function Eha({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await Fp1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...puf(c,d,t.logger));else u.push(...puf(f.versions,void 0,t.logger))}return u}var e_i=class extends Error{constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var F6n=class extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var t_i=e=>e!==null&&typeof e=="object";var r_i=(...e)=>{for(let t of e)if((!t_i(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Mha({},...e)},qsu=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r},Mha=(...e)=>{let t={},r={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(t_i(n)){for(let[i,a]of Object.entries(n))t_i(a)&&i in t&&(a=Mha(t[i],a)),t={...t,[i]:a};t_i(n.headers)&&(r=qsu(r,n.headers),t.headers=r)}return t};var _uf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return r&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")),e&&!t})(),huf=typeof globalThis.AbortController=="function",yuf=typeof globalThis.ReadableStream=="function",vuf=typeof globalThis.FormData=="function",xha=["get","post","put","patch","head","delete"],Lp1=()=>{};Lp1();var buf={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},Tha=2147483647,qha=Symbol("stop"),guf={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},muf={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};var Puf=e=>xha.includes(e)?e.toUpperCase():e,Up1=["get","put","head","delete","options","trace"],Vp1=[408,413,429,500,502,503,504],juf=[413,429,503],Ouf={limit:2,methods:Up1,statusCodes:Vp1,afterStatusCodes:juf,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},wuf=(e={})=>{if(typeof e=="number")return{...Ouf,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{...Ouf,...e,afterStatusCodes:juf}};async function Csu(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new F6n(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function Asu(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e)})}var Duf=(e,t)=>{let r={};for(let n in t)!(n in muf)&&!(n in guf)&&!(n in e)&&(r[n]=t[n]);return r};var pen=class{static create(t,r){let n=new pen(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Tha)throw new RangeError(`The \`timeout\` option cannot be greater than ${Tha}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new e_i(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yuf)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(buf))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let n="credentials"in Request.prototype;if(this._options={credentials:n?this._input.credentials:void 0,...r,headers:qsu(this._input.headers,r.headers),hooks:Mha({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Puf(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:wuf(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(huf){if(this.abortController=new globalThis.AbortController,this._options.signal){let i=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(i.reason)})}this._options.signal=this.abortController.signal}if(_uf&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i=typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),a="?"+i,u=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,a);(vuf&&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(u,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof F6n)){if(t instanceof e_i){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n);return Number.isNaN(i)?i=Date.parse(n)-Date.now():i*=1e3,this._options.retry.maxRetryAfter!==void 0&&i>this._options.retry.maxRetryAfter?0:i}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),Tha);if(n!==0&&this._retryCount>0){await Asu(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===qha)return;return this._retry(t)}throw r}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=Duf(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):Csu(this.request.clone(),t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Nsu=e=>{let t=(r,n)=>pen.create(r,r_i(e,n));for(let r of xha)t[r]=(n,i)=>pen.create(n,r_i(e,i,{method:r}));return t.create=r=>Nsu(r_i(r)),t.extend=r=>Nsu(r_i(e,r)),t.stop=qha,t},Wp1=Nsu(),Suf=Wp1;var Yuf=yu(Kuf(),1);function Fsu(e){let t=(0,Yuf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var $sf=yu(Hsf(),1),Jsf=yu(ZQr(),1),Qsu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Zsu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function ksu(e,t={}){var l;let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??Fsu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,$sf.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Suf(u,{headers:d,keepalive:!0}).json()}catch(g){throw((l=g==null?void 0:g.response)==null?void 0:l.status)===404?new Qsu(e):g}if(t.allVersions)return c;let o=new Zsu(e,r);if(c["dist-tags"][r]){let{time:g}=c;c=c.versions[c["dist-tags"][r]],c.time=g}else if(r){let g=Boolean(c.versions[r]);if(n&&!g)for(let[j,S]of Object.entries(c.versions))S.deprecated&&delete c.versions[j];if(!g){let j=Object.keys(c.versions);if(r=Jsf.default.maxSatisfying(j,r),!r)throw o}let{time:O}=c;if(c=c.versions[r],c.time=O,!c)throw o}return c}async function u_i(e,t){let{version:r}=await ksu(e.toLowerCase(),t);return r}async function J6n({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:u_i(e.packageName,{version:t?"prerelease":"latest"})}var Gsf=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Hha=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=hM.Info;constructor(t){this.ttyAwareLogger=new Sha(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"==null&&this.logger.error("CLI_PACKAGE_NAME is not defined"),"fern-api"}getPackageVersion(){return"0.42.4"==null&&this.logger.error("CLI_VERSION is not defined"),"0.42.4"}getCliName(){return"fern"==null&&this.logger.error("CLI_NAME is not defined"),"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${cl.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Gte}failWithoutThrowing(t,r){this.didSucceed=!1,Pha({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await QAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fuf({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1904
|
+
`,n?u6n(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function Rp1(e){let r=await new cuf.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 Fp1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=pg.getGeneratorNameOrThrow(o.name,l),O=await pg.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=pg.getGeneratorNameOrThrow(c.name,o),g=await pg.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function duf({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await pg.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilepath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function puf(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=Pne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function Eha({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await Fp1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...puf(c,d,t.logger));else u.push(...puf(f.versions,void 0,t.logger))}return u}var e_i=class extends Error{constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var F6n=class extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var t_i=e=>e!==null&&typeof e=="object";var r_i=(...e)=>{for(let t of e)if((!t_i(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Mha({},...e)},qsu=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r},Mha=(...e)=>{let t={},r={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(t_i(n)){for(let[i,a]of Object.entries(n))t_i(a)&&i in t&&(a=Mha(t[i],a)),t={...t,[i]:a};t_i(n.headers)&&(r=qsu(r,n.headers),t.headers=r)}return t};var _uf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return r&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")),e&&!t})(),huf=typeof globalThis.AbortController=="function",yuf=typeof globalThis.ReadableStream=="function",vuf=typeof globalThis.FormData=="function",xha=["get","post","put","patch","head","delete"],Lp1=()=>{};Lp1();var buf={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},Tha=2147483647,qha=Symbol("stop"),guf={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},muf={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};var Puf=e=>xha.includes(e)?e.toUpperCase():e,Up1=["get","put","head","delete","options","trace"],Vp1=[408,413,429,500,502,503,504],juf=[413,429,503],Ouf={limit:2,methods:Up1,statusCodes:Vp1,afterStatusCodes:juf,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},wuf=(e={})=>{if(typeof e=="number")return{...Ouf,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{...Ouf,...e,afterStatusCodes:juf}};async function Csu(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new F6n(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function Asu(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e)})}var Duf=(e,t)=>{let r={};for(let n in t)!(n in muf)&&!(n in guf)&&!(n in e)&&(r[n]=t[n]);return r};var pen=class{static create(t,r){let n=new pen(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Tha)throw new RangeError(`The \`timeout\` option cannot be greater than ${Tha}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new e_i(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yuf)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(buf))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let n="credentials"in Request.prototype;if(this._options={credentials:n?this._input.credentials:void 0,...r,headers:qsu(this._input.headers,r.headers),hooks:Mha({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Puf(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:wuf(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(huf){if(this.abortController=new globalThis.AbortController,this._options.signal){let i=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(i.reason)})}this._options.signal=this.abortController.signal}if(_uf&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i=typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),a="?"+i,u=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,a);(vuf&&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(u,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof F6n)){if(t instanceof e_i){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n);return Number.isNaN(i)?i=Date.parse(n)-Date.now():i*=1e3,this._options.retry.maxRetryAfter!==void 0&&i>this._options.retry.maxRetryAfter?0:i}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),Tha);if(n!==0&&this._retryCount>0){await Asu(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===qha)return;return this._retry(t)}throw r}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=Duf(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):Csu(this.request.clone(),t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Nsu=e=>{let t=(r,n)=>pen.create(r,r_i(e,n));for(let r of xha)t[r]=(n,i)=>pen.create(n,r_i(e,i,{method:r}));return t.create=r=>Nsu(r_i(r)),t.extend=r=>Nsu(r_i(e,r)),t.stop=qha,t},Wp1=Nsu(),Suf=Wp1;var Yuf=yu(Kuf(),1);function Fsu(e){let t=(0,Yuf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var $sf=yu(Hsf(),1),Jsf=yu(ZQr(),1),Qsu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Zsu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function ksu(e,t={}){var l;let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??Fsu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,$sf.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Suf(u,{headers:d,keepalive:!0}).json()}catch(g){throw((l=g==null?void 0:g.response)==null?void 0:l.status)===404?new Qsu(e):g}if(t.allVersions)return c;let o=new Zsu(e,r);if(c["dist-tags"][r]){let{time:g}=c;c=c.versions[c["dist-tags"][r]],c.time=g}else if(r){let g=Boolean(c.versions[r]);if(n&&!g)for(let[j,S]of Object.entries(c.versions))S.deprecated&&delete c.versions[j];if(!g){let j=Object.keys(c.versions);if(r=Jsf.default.maxSatisfying(j,r),!r)throw o}let{time:O}=c;if(c=c.versions[r],c.time=O,!c)throw o}return c}async function u_i(e,t){let{version:r}=await ksu(e.toLowerCase(),t);return r}async function J6n({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:u_i(e.packageName,{version:t?"prerelease":"latest"})}var Gsf=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Hha=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=hM.Info;constructor(t){this.ttyAwareLogger=new Sha(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"==null&&this.logger.error("CLI_PACKAGE_NAME is not defined"),"fern-api"}getPackageVersion(){return"0.42.6"==null&&this.logger.error("CLI_VERSION is not defined"),"0.42.6"}getCliName(){return"fern"==null&&this.logger.error("CLI_NAME is not defined"),"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${cl.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Gte}failWithoutThrowing(t,r){this.didSucceed=!1,Pha({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await QAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fuf({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1905
1905
|
`)||(r+=`
|
|
1906
1906
|
`),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=PWo(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new Wpi(t);return this.ttyAwareLogger.registerTask(r),r}async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw n.failWithoutThrowing(void 0,a),new Gte}finally{n.finish()}return i}async instrumentPostHogEvent(t){(await QAn()).sendEvent(t)}logger=Zui(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Ksf(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?Ksf(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=Gsf[this.numTasks++%Gsf.length],u=cl.hex(a)(i);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===D4.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logImmediately(t){let r=t.filter(n=>_4r.indexOf(n.level)>=_4r.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===hM.Debug})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await J6n({cliEnvironment:this.environment,includePreReleases:t}),n=Pne(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await Eha({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}};function Ksf(e){return`[${e}]:`}var tC;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_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"})(tC||(tC={}));function ecu(e,t){for(let[r,n]of v3(e.failures))Ysf({relativeFilepath:r,failure:n,logger:t})}function $ha(e,t){for(let[r,n]of v3(e))Ysf({relativeFilepath:r,failure:n,logger:t})}function Ysf({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case tC.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 tC.FILE_READ:r.error("Failed to open file: "+e);break;case tC.FILE_MISSING:r.error("Missing file: "+e);break;case tC.FILE_PARSE:t.error instanceof jLo?r.error(wMn({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case tC.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:a}of J_1(n))r.error(wMn({title:i,subtitle:a,breadcrumbs:[e,...n.path]}));break;case tC.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case tC.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${t7c}: `+t.dependencyName);break;case tC.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case tC.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;default:Ol(t)}}function J_1(e){switch(e.code){case L_.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${cl.underline(e.expected)} but received ${cl.underline(e.received)}`}];case L_.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${cl.underline(t)}`}));case L_.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>cl.underline(t)).join(", ")}`}];case L_.invalid_union:case L_.invalid_arguments:case L_.invalid_return_type:case L_.invalid_date:case L_.invalid_string:case L_.too_small:case L_.too_big:case L_.invalid_intersection_types:case L_.not_multiple_of:case L_.custom:default:return[{title:e.message}]}}var Xsf=require("fs/promises");async function Jha(e,t){let r=[];for(let n of await u4r(e,t))r.push(await G_1({relativeFilepath:YN(e,n),absoluteFilepath:n}));return r}async function G_1({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Xsf.readFile)(t)).toString()}}async function Qsf({absolutePathToWorkspace:e}){let t=pf(e,zs.of(k6c));if(!await Vh(t))return;let n=await Jha(t,"{md,mdx}");return{files:await Promise.all(n.map(i=>({absoluteFilepath:i.absoluteFilepath,contents:i.fileContents})))}}var pdf=yu(ncu(),1);async function ncf(e){let t={},r={};function n(i){try{t[i.relativeFilepath]={defaultUrl:void 0,contents:av.load(i.fileContents,{schema:av.CORE_SCHEMA}),rawContents:i.fileContents}}catch(a){r[i.relativeFilepath]={type:tC.FILE_PARSE,error:a}}}return await Promise.all(e.map(n)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}var Hlu=yu(gZr(),1),tdf=yu(vRt(),1),rdf=require("fs"),v7n=require("fs/promises");var ndf=require("os"),idf=yu(require("path"),1),adf=require("stream/promises"),odf=yu(kya(),1),udf=yu(Jte(),1);var w01=QDr();async function sdf({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:n,cliVersion:i,settings:a}){let u,f={type:tC.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},d=t.dependencies[e];return d==null?f={type:tC.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${q01(d)}`},async c=>{switch(d.type){case"version":u=await x01({context:c,dependency:d,cliVersion:i,settings:a});return;case"local":u=await M01({context:c,dependency:d,cliVersion:i,settings:a});return;default:Ol(d)}}),u!=null?{didSucceed:!0,definition:u}:{didSucceed:!1,failure:f}}var cdf="dependencies";var D01="metadata.json",S01=".fern";function E01(e){return pf(I_.of((0,ndf.homedir)()),zs.of(S01),zs.of(cdf),zs.of(e.organization),zs.of(e.apiName),zs.of(e.version))}async function M01({dependency:e,context:t,cliVersion:r,settings:n}){t.logger.info("Parsing...");let i=await Nen({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!i.didSucceed){t.failWithoutThrowing("Failed to load api definition",i.failures);return}t.logger.info("Modifying source filepath ...");let a=await i.workspace.getDefinition({context:t,relativePathToDependency:zs.of(e.path)},n);return t.logger.info("Loaded..."),a}async function x01({dependency:e,context:t,cliVersion:r,settings:n}){let i=E01(e),a=pf(i,zs.of(cdf)),u=pf(i,zs.of(D01)),f;if(!await Vh(a)||!await Vh(u)){t.logger.info("Downloading manifest...");let o=await w01.definitionRegistry.get(Hlu.FernFiddle.OrganizationId(e.organization),Hlu.FernFiddle.ApiId(e.apiName),e.version);if(!o.ok){o.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:j=>{t.failWithoutThrowing("Failed to download API manifest",j)}});return}let l=o.body.yamlSchemaVersion!=null?parseInt(o.body.yamlSchemaVersion):void 0,g=cen(r),O=cen(o.body.cliVersion);if(l!=null){if(l>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${o.body.cliVersion}`);return}else if(l<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(g.major!==O.major||g.minor!==O.minor){t.failWithoutThrowing(`CLI version is ${o.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+o.body.definitionS3DownloadUrl),await(0,v7n.mkdir)(a,{recursive:!0});try{await T01({s3PreSignedReadUrl:o.body.definitionS3DownloadUrl,absolutePathToLocalOutput:a})}catch(j){t.failWithoutThrowing("Failed to download API",j);return}f=o.body,await(0,v7n.writeFile)(u,JSON.stringify(f))}else f=JSON.parse((await(0,v7n.readFile)(u)).toString());t.logger.info("Parsing...");let d=await Nen({absolutePathToWorkspace:a,context:t,cliVersion:f.cliVersion,workspaceName:void 0});if(!d.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",d.failures);return}if(d.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await d.workspace.getDefinition({context:t},n)}async function T01({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await tdf.default.get(e,{responseType:"stream"}),n=await udf.default.dir(),i=idf.default.join(n.path,"api.tgz");await(0,adf.pipeline)(r.data,(0,rdf.createWriteStream)(i)),await odf.default.extract({file:i,cwd:t})}function q01(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Ol(e)}}async function ldf({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:n,settings:i}){let a={},u={},f={};return await Promise.all(v3(t.packageMarkers).map(async([d,c])=>{if(c.contents.export==null)a[d]=c;else{let{export:o,...l}=c.contents;if(Q8t(l)>0)f[d]={type:tC.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:d};else{let g=Cg(d);if(E8t(t.namedDefinitionFiles).some(j=>j!==d&&j.startsWith(g)))f[d]={type:tC.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let j=await sdf({dependencyName:typeof c.contents.export=="string"?c.contents.export:c.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:n,settings:i});j.didSucceed?u[Cg(d)]={definition:j.definition,url:typeof c.contents.export=="object"?c.contents.export.url:void 0}:f[d]=j.failure}}}})),Q8t(f)>0?{didSucceed:!1,failures:f}:{didSucceed:!0,packageMarkers:a,importedDefinitions:u}}var fdf=yu(require("path"),1);function ddf({files:e,absolutePathToDefinition:t}){let r,n={},i={},a={};for(let[u,f]of v3(e)){let d=f.contents,c=o=>{a[u]={type:tC.STRUCTURE_VALIDATION,error:o}};if(u===nB){let o=tta.safeParse(d);o.success?r={defaultUrl:o.data["default-url"],contents:o.data,rawContents:f.rawContents}:c(o.error)}else if(fdf.default.basename(u)===HT){let o=Xea.safeParse(d);o.success?i[u]={defaultUrl:typeof o.data.export=="object"?o.data.export.url:void 0,contents:o.data,rawContents:f.rawContents}:c(o.error)}else{let o=s2n.safeParse(d);o.success?n[u]={defaultUrl:void 0,contents:o.data,rawContents:f.rawContents,absoluteFilepath:pf(t,u)}:c(o.error)}}return r==null?{didSucceed:!1,failures:{[zs.of(nB)]:{type:tC.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:n,rootApiFile:r,packageMarkers:i}}var zen=class{};var y5r=class extends zen{type="fern";workspaceName;absoluteFilepath;generatorsConfiguration;dependenciesConfiguration;definition;changelog;sources;cliVersion;constructor({absoluteFilepath:t,workspaceName:r,generatorsConfiguration:n,dependenciesConfiguration:i,definition:a,changelog:u,sources:f,cliVersion:d}){super(),this.absoluteFilepath=t,this.workspaceName=r,this.changelog=u,this.generatorsConfiguration=n,this.dependenciesConfiguration=i,this.definition=a,this.sources=f??[],this.cliVersion=d}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getAbsoluteFilepaths(){return[this.absoluteFilepath]}getSources(){return this.sources}},Ben=class extends zen{type="fern";workspaceName;absoluteFilepath;generatorsConfiguration;changelog;context;cliVersion;fernWorkspaces={};constructor({absoluteFilepath:t,workspaceName:r,generatorsConfiguration:n,changelog:i,cliVersion:a,context:u}){super(),this.absoluteFilepath=t,this.workspaceName=r,this.changelog=i,this.generatorsConfiguration=n,this.cliVersion=a,this.context=u}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let n=(0,pdf.default)(r??{}),i=this.fernWorkspaces[n];if(i==null){let a=t||this.context,u=pf(this.absoluteFilepath,zs.of(p9)),f=await FGi.loadDependenciesConfiguration({absolutePathToWorkspace:this.absoluteFilepath,context:a}),d=await Jha(u,"{yml,yaml}"),c=await ncf(d);if(!c.didSucceed)return $ha(c.failures,a.logger),a.failAndThrow();let o=ddf({files:c.files,absolutePathToDefinition:u});if(!o.didSucceed)return $ha(o.failures,a.logger),a.failAndThrow();let l=await ldf({dependenciesConfiguration:f,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r});if(!l.didSucceed)return $ha(l.failures,a.logger),a.failAndThrow();i=new y5r({absoluteFilepath:this.absoluteFilepath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:f,workspaceName:this.workspaceName,definition:{absoluteFilepath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:l.packageMarkers,importedDefinitions:l.importedDefinitions},changelog:this.changelog,sources:void 0,cliVersion:this.cliVersion}),this.fernWorkspaces[n]=i}return i}getAbsoluteFilepaths(){return[this.absoluteFilepath]}};var HSr={openapi:e=>({...e,type:"openapi",_visit:function(t){return HSr._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return HSr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var b7n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return b7n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var F9={basic:e=>({...e,type:"basic",_visit:function(t){return F9._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return F9._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return F9._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return F9._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return F9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var RP={primitive:e=>({value:e,type:"primitive",_visit:function(t){return RP._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return RP._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return RP._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return RP._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return RP._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return RP._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return RP._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return RP._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var t0={int:e=>({value:e,type:"int",_visit:function(t){return t0._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return t0._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return t0._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return t0._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return t0._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return t0._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return t0._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return t0._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return t0._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return t0._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return t0._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var g7n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return g7n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return g7n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var v5r={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return v5r._visit(this,t)}}),undisciminated:e=>({value:e,type:"undisciminated",_visit:function(t){return v5r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undisciminated":return t.undisciminated(e.value);default:return t._other(e)}}};var vW={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case vW.GenerallyAvailable:return t.generallyAvailable();case vW.Beta:return t.beta();case vW.Deprecated:return t.deprecated();default:return t._other()}}};var $Sr={cursor:e=>({...e,type:"cursor",_visit:function(t){return $Sr._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return $Sr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);default:return t._other(e)}}};var JSr={language:e=>({...e,type:"language",_visit:function(t){return JSr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return JSr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var bW={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm",_visit:(e,t)=>{switch(e){case bW.Curl:return t.curl();case bW.Python:return t.python();case bW.Javascript:return t.javascript();case bW.Typescript:return t.typescript();case bW.Go:return t.go();case bW.Ruby:return t.ruby();case bW.Csharp:return t.csharp();case bW.Java:return t.java();case bW.Js:return t.js();case bW.Node:return t.node();case bW.Ts:return t.ts();case bW.Nodets:return t.nodets();case bW.Golang:return t.golang();case bW.Dotnet:return t.dotnet();case bW.Jvm:return t.jvm();default:return t._other()}}};var pAt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return pAt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return pAt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var KJ={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case KJ.Get:return t.get();case KJ.Post:return t.post();case KJ.Put:return t.put();case KJ.Patch:return t.patch();case KJ.Delete:return t.delete();case KJ.Head:return t.head();case KJ.Options:return t.options();case KJ.Trace:return t.trace();default:return t._other()}}};var b5r={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return b5r._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return b5r._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return b5r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var D2e={file:e=>({...e,type:"file",_visit:function(t){return D2e._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return D2e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var Sne={file:e=>({...e,type:"file",_visit:function(t){return Sne._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Sne._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Sne._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Sne._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Sne._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Sne._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var ib={primitive:e=>({...e,type:"primitive",_visit:function(t){return ib._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ib._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ib._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ib._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ib._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ib._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ib._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ib._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ib._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ib._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ib._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var Xw={int:e=>({...e,type:"int",_visit:function(t){return Xw._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xw._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Xw._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Xw._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Xw._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Xw._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xw._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Xw._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Xw._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Xw._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var E7={boolean:e=>({value:e,type:"boolean",_visit:function(t){return E7._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return E7._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var GSr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return GSr._visit(this,t)}}),undisciminated:e=>({...e,type:"undisciminated",_visit:function(t){return GSr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undisciminated":return t.undisciminated(e);default:return t._other(e)}}};var S2e={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return S2e._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return S2e._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return S2e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var T3={file:e=>({...e,type:"file",_visit:function(t){return T3._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return T3._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return T3._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return T3._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return T3._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return T3._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Lp={primitive:e=>({...e,type:"primitive",_visit:function(t){return Lp._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Lp._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Lp._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Lp._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Lp._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Lp._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Lp._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Lp._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Lp._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Lp._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Lp._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var jQ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return jQ._visit(this,t)}}),undisciminated:e=>({...e,type:"undisciminated",_visit:function(t){return jQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undisciminated":return t.undisciminated(e);default:return t._other(e)}}};var by={int:e=>({...e,type:"int",_visit:function(t){return by._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return by._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return by._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return by._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return by._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return by._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return by._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return by._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return by._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return by._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return by._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var Ng={};Wb(Ng,{AllOfPropertyConflict:()=>I7n,ArraySchema:()=>fva,ArraySchemaWithExample:()=>Lva,Availability:()=>c0a,Base64WithExample:()=>zva,BasicSecurityScheme:()=>d0a,BearerSecurityScheme:()=>p0a,BooleanSchema:()=>ava,BooleanWithExample:()=>Bva,CasingOverrides:()=>y0a,CommonProperty:()=>gva,CommonPropertyWithExample:()=>Yva,CursorPagination:()=>H0a,CustomCodeSample:()=>V0a,CustomCodeSampleLanguage:()=>F0a,CustomCodeSampleSdk:()=>U0a,DateWithExample:()=>Nva,DatetimeWithExample:()=>Ava,DiscriminatedOneOfSchema:()=>vva,DiscriminatedOneOfSchemaWithExample:()=>Gva,DoubleSchema:()=>nva,DoubleWithExample:()=>qva,Encoding:()=>s0a,Endpoint:()=>J0a,EndpointExample:()=>N7n,EndpointSdkName:()=>M5r,EndpointWithExample:()=>Vdf,EnumSchema:()=>P7n,EnumSchemaWithExample:()=>Rva,EnumValue:()=>j5r,ErrorExample:()=>z0a,FernExample:()=>I0a,FileResponse:()=>T7n,FileSchema:()=>x0a,FloatWithExample:()=>Tva,FullEndpointExample:()=>W0a,FullExample:()=>yA,FullObjectExample:()=>w0a,FullOneOfExample:()=>S0a,GlobalHeader:()=>uva,Header:()=>E5r,HeaderExample:()=>A7n,HeaderSecurityScheme:()=>_0a,HeaderWithExample:()=>L7n,HttpEndpointServer:()=>q7n,HttpError:()=>B0a,HttpErrorWithExample:()=>Dva,HttpMethod:()=>D7n,IdempotencyHeader:()=>sva,Int64WithExample:()=>Eva,IntSchema:()=>tva,IntWithExample:()=>Sva,JsonRequest:()=>C0a,JsonRequestWithExample:()=>Ova,JsonResponse:()=>KSr,JsonResponseWithExample:()=>jva,KeyValuePair:()=>D0a,LiteralExample:()=>j0a,LiteralSchema:()=>B7n,LiteralSchemaValue:()=>cva,LongSchema:()=>rva,MapSchema:()=>dva,MapSchemaWithExample:()=>Uva,MultipartRequest:()=>x7n,MultipartRequestProperty:()=>q0a,MultipartSchema:()=>T0a,NamedFullExample:()=>BRt,Namespace:()=>v0a,NamespaceId:()=>P0a,NullableSchema:()=>_va,NullableSchemaWithExample:()=>Wva,OauthSecurityScheme:()=>g0a,ObjectProperty:()=>yva,ObjectPropertyConflictInfo:()=>R7n,ObjectPropertyWithExample:()=>Jva,ObjectSchema:()=>lva,ObjectSchemaWithExample:()=>Hva,OctetStreamRequest:()=>M7n,OffsetPagination:()=>$0a,OneOfSchema:()=>hva,OneOfSchemaWithExample:()=>$va,OpenApiIntermediateRepresentation:()=>Ldf,OpenApiSource:()=>i0a,OptionalSchema:()=>pva,OptionalSchemaWithExample:()=>Vva,Pagination:()=>z7n,PathParameter:()=>S7n,PathParameterExample:()=>R0a,PathParameterWithExample:()=>mva,PrimitiveExample:()=>w7n,PrimitiveSchema:()=>T5r,PrimitiveSchemaValue:()=>ova,PrimitiveSchemaValueWithExample:()=>Iva,PrimitiveSchemaWithExample:()=>U7n,PropertyKey:()=>j7n,ProtobufEncoding:()=>u0a,ProtobufSource:()=>a0a,QueryParameter:()=>E7n,QueryParameterExample:()=>C7n,QueryParameterWithExample:()=>F7n,QuerySecurityScheme:()=>h0a,ReferencedSchema:()=>zRt,Request:()=>A0a,RequestWithExample:()=>Pva,Response:()=>N0a,ResponseWithExample:()=>wva,Schema:()=>D1,SchemaId:()=>wQ,SchemaWithExample:()=>aq,Schemas:()=>eva,SdkGroup:()=>b0a,SdkGroupInfo:()=>E0a,SdkGroupName:()=>w5r,SecurityScheme:()=>m0a,SecuritySchemeId:()=>f0a,Server:()=>O0a,Source:()=>o0a,StatusCode:()=>D5r,StringSchema:()=>iva,StringSchemaWithExample:()=>Cva,SupportedSdkLanguage:()=>L0a,Tag:()=>l0a,TagId:()=>Kje,Tags:()=>M0a,TextResponse:()=>x5r,Uint64WithExample:()=>xva,UintWithExample:()=>Mva,UnDiscriminatedOneOfSchema:()=>bva,UnDiscriminatedOneOfSchemaWithExample:()=>Kva,UnknownSchemaWithExample:()=>Fva,Webhook:()=>Y0a,WebhookExampleCall:()=>K0a,WebhookHttpMethod:()=>G0a,WebsocketChannel:()=>k0a,WebsocketHandshake:()=>X0a,WebsocketHandshakeWithExample:()=>Udf,WebsocketMessageExample:()=>Q0a,WebsocketSessionExample:()=>Z0a,WithAvailability:()=>Z0,WithDescription:()=>O_,WithEncoding:()=>Ene,WithName:()=>Ym,WithNamespace:()=>S5r,WithSdkGroupName:()=>w1,WithSource:()=>hb,WithTitle:()=>j1,commons:()=>Ylu,example:()=>Xlu,finalIr:()=>Qlu,parseIr:()=>Zlu});var Ylu={};Wb(Ylu,{BasicSecurityScheme:()=>d0a,BearerSecurityScheme:()=>p0a,Encoding:()=>s0a,HeaderSecurityScheme:()=>_0a,Namespace:()=>v0a,NamespaceId:()=>P0a,OauthSecurityScheme:()=>g0a,OpenApiSource:()=>i0a,ProtobufEncoding:()=>u0a,ProtobufSource:()=>a0a,QuerySecurityScheme:()=>h0a,SchemaId:()=>wQ,SdkGroup:()=>b0a,SdkGroupName:()=>w5r,SecurityScheme:()=>m0a,SecuritySchemeId:()=>f0a,Server:()=>O0a,Source:()=>o0a,StatusCode:()=>D5r,Tag:()=>l0a,TagId:()=>Kje,WithAvailability:()=>Z0,WithDescription:()=>O_,WithEncoding:()=>Ene,WithName:()=>Ym,WithNamespace:()=>S5r,WithSdkGroupName:()=>w1,WithSource:()=>hb,WithTitle:()=>j1});var Wn={};Wb(Wn,{JsonError:()=>g5r,ParseError:()=>m5r,any:()=>Edf,boolean:()=>Mdf,booleanLiteral:()=>Sdf,date:()=>hdf,discriminant:()=>Idf,enum_:()=>t0a,getObjectLikeUtils:()=>NRt,getObjectUtils:()=>O7n,getSchemaUtils:()=>hA,isProperty:()=>P5r,lazy:()=>ydf,lazyObject:()=>jdf,list:()=>n0a,number:()=>xdf,object:()=>r0a,objectWithoutOptionalProperties:()=>Pdf,optional:()=>$lu,property:()=>bdf,record:()=>Adf,set:()=>Ndf,string:()=>Tdf,stringLiteral:()=>Ddf,transform:()=>Jlu,undiscriminatedUnion:()=>Bdf,union:()=>Fdf,unknown:()=>qdf,withParsedProperties:()=>Klu});var VS={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 rC(e,t){return`Expected ${t}. Received ${C01(e)}.`}function C01(e){if(Array.isArray(e))return"list";if(e===null)return"null";switch(typeof e){case"string":return`"${e}"`;case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function YJ(e){return{...e,json:_df(e.json),parse:_df(e.parse)}}function _df(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
1907
|
-
`)),{ok:!0,value:t}):n}}function e0a(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var g5r=class extends Error{errors;constructor(t){super(t.map(e0a).join("; ")),this.errors=t,Object.setPrototypeOf(this,g5r.prototype)}};var m5r=class extends Error{errors;constructor(t){super(t.map(e0a).join("; ")),this.errors=t,Object.setPrototypeOf(this,m5r.prototype)}};function hA(e){return{optional:()=>$lu(e),transform:t=>Jlu(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new m5r(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new g5r(n.errors)}}}function $lu(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>(n==null?void 0:n.omitUndefined)&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>VS.OPTIONAL};return{...t,...hA(t)}}function Jlu(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...hA(r)}}var A01=/^([+-]?\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 hdf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:rC(t,"string")}]}:A01.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:rC(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:rC(t,"Date object")}]},getType:()=>VS.DATE};return{...YJ(e),...hA(e)}}function XJ(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...YJ(r),...hA(r)}}}function t0a(e){let t=new Set(e);return XJ(VS.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:rC(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:rC(n,"enum")}]}:{ok:!0,value:n})()}function ydf(e){let t=Glu(e);return{...t,...hA(t)}}function Glu(e){return{parse:(t,r)=>m7n(e).parse(t,r),json:(t,r)=>m7n(e).json(t,r),getType:()=>m7n(e).getType()}}function m7n(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function T_i(e){return Object.entries(e)}function q_i(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function O5r(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 C_i(e){return Object.keys(e)}function vdf(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function NRt(e){return{withParsedProperties:t=>Klu(e,t)}}function Klu(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let u=Object.entries(t).reduce((f,[d,c])=>({...f,[d]:typeof c=="function"?c(a.value):c}),{});return{ok:!0,value:{...a.value,...u}}},json:(n,i)=>{if(!O5r(n))return{ok:!1,errors:[{path:(i==null?void 0:i.breadcrumbsPrefix)??[],message:rC(n,"object")}]};let a=new Set(Object.keys(t)),u=q_i(n,Object.keys(n).filter(f=>!a.has(f)));return e.json(u,i)},getType:()=>e.getType()};return{...r,...hA(r),...NRt(r)}}function bdf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function P5r(e){return e.isProperty}function r0a(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>P5r(n)?n.rawKey:r),_getParsedProperties:()=>C_i(e),parse:(r,n)=>{let i={},a=[];for(let[u,f]of T_i(e)){let d=P5r(f)?f.rawKey:u,c=P5r(f)?f.valueSchema:f,o={rawKey:d,parsedKey:u,valueSchema:c};i[d]=o,Odf(c)&&a.push(d)}return gdf({value:r,requiredKeys:a,getProperty:u=>{let f=i[u];if(f!=null)return{transformedKey:f.parsedKey,transform:d=>f.valueSchema.parse(d,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],u]})}},unrecognizedObjectKeys:n==null?void 0:n.unrecognizedObjectKeys,skipValidation:n==null?void 0:n.skipValidation,breadcrumbsPrefix:n==null?void 0:n.breadcrumbsPrefix,omitUndefined:n==null?void 0:n.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,u]of T_i(e)){let f=P5r(u)?u.valueSchema:u;Odf(f)&&i.push(a)}return gdf({value:r,requiredKeys:i,getProperty:a=>{let u=e[a];if(u!=null)return P5r(u)?{transformedKey:u.rawKey,transform:f=>u.valueSchema.json(f,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],a]})}:{transformedKey:a,transform:f=>u.json(f,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],a]})}},unrecognizedObjectKeys:n==null?void 0:n.unrecognizedObjectKeys,skipValidation:n==null?void 0:n.skipValidation,breadcrumbsPrefix:n==null?void 0:n.breadcrumbsPrefix,omitUndefined:n==null?void 0:n.omitUndefined})},getType:()=>VS.OBJECT};return{...YJ(t),...hA(t),...NRt(t),...O7n(t)}}function gdf({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!O5r(e))return{ok:!1,errors:[{path:a,message:rC(e,"object")}]};let u=new Set(t),f=[],d={};for(let[c,o]of Object.entries(e)){let l=r(c);if(l!=null){u.delete(c);let g=l.transform(o);g.ok?d[l.transformedKey]=g.value:(d[c]=o,f.push(...g.errors))}else switch(n){case"fail":f.push({path:[...a,c],message:`Unexpected key "${c}"`});break;case"strip":break;case"passthrough":d[c]=o;break}}return f.push(...t.filter(c=>u.has(c)).map(c=>({path:a,message:`Missing required key "${c}"`}))),f.length===0||i?{ok:!0,value:d}:{ok:!1,errors:f}}function O7n(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>mdf({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>mdf({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>VS.OBJECT};return{...r,...hA(r),...NRt(r),...O7n(r)}}}}function mdf({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,u]=vdf(C_i(t),c=>i.has(c)),f=r(q_i(t,u)),d=n(q_i(t,a));return f.ok&&d.ok?{ok:!0,value:{...f.value,...d.value}}:{ok:!1,errors:[...f.ok?[]:f.errors,...d.ok?[]:d.errors]}}function Odf(e){return!N01(e)}function N01(e){switch(e.getType()){case VS.ANY:case VS.UNKNOWN:case VS.OPTIONAL:return!0;default:return!1}}function Pdf(e){return r0a(e)}function jdf(e){let t={...Glu(e),_getRawProperties:()=>m7n(e)._getRawProperties(),_getParsedProperties:()=>m7n(e)._getParsedProperties()};return{...t,...hA(t),...NRt(t),...O7n(t)}}function n0a(e){let t={parse:(r,n)=>wdf(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],`[${a}]`]})),json:(r,n)=>wdf(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],`[${a}]`]})),getType:()=>VS.LIST};return{...YJ(t),...hA(t)}}function wdf(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:rC(e,"list"),path:[]}]}}function Ddf(e){return XJ(VS.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:rC(r,`"${e}"`)}]})()}function Sdf(e){return XJ(VS.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:rC(r,`${e.toString()}`)}]})()}var Edf=XJ(VS.ANY,e=>({ok:!0,value:e}));var Mdf=XJ(VS.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"boolean")}]});var xdf=XJ(VS.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"number")}]});var Tdf=XJ(VS.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"string")}]});var qdf=XJ(VS.UNKNOWN,e=>({ok:!0,value:e}));function Adf(e,t){let r={parse:(n,i)=>Cdf({value:n,isKeyNumeric:e.getType()===VS.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${u}`]}),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(n,i)=>Cdf({value:n,isKeyNumeric:e.getType()===VS.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${u}`]}),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>VS.RECORD};return{...YJ(r),...hA(r)}}function Cdf({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return O5r(e)?T_i(e).reduce((a,[u,f])=>{if(f==null)return a;let d=a,c=u;if(t){let O=u.length>0?Number(u):NaN;isNaN(O)||(c=O)}let o=r(c),l=n(f,c);if(d.ok&&o.ok&&l.ok)return{ok:!0,value:{...d.value,[o.value]:l.value}};let g=[];return d.ok||g.push(...d.errors),o.ok||g.push(...o.errors),l.ok||g.push(...l.errors),{ok:!1,errors:g}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:rC(e,"object")}]}}function Ndf(e){let t=n0a(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:(i==null?void 0:i.breadcrumbsPrefix)??[],message:rC(n,"Set")}]},getType:()=>VS.SET};return{...YJ(r),...hA(r)}}function Bdf(e){let t={parse:(r,n)=>zdf((i,a)=>i.parse(r,a),e,n),json:(r,n)=>zdf((i,a)=>i.json(r,a),e,n),getType:()=>VS.UNDISCRIMINATED_UNION};return{...YJ(t),...hA(t)}}function zdf(e,t,r){let n=[];for(let[i,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let f of u.errors)n.push({path:f.path,message:`[Variant ${i}] ${f.message}`})}return{ok:!1,errors:n}}function Idf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Fdf(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=t0a(C_i(t)),a={parse:(u,f)=>Rdf({value:u,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:d=>i.parse(d,{allowUnrecognizedEnumValues:f==null?void 0:f.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(f==null?void 0:f.breadcrumbsPrefix)??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:f==null?void 0:f.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,c)=>c.parse(d,f),breadcrumbsPrefix:f==null?void 0:f.breadcrumbsPrefix}),json:(u,f)=>Rdf({value:u,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:d=>i.json(d,{allowUnrecognizedEnumValues:f==null?void 0:f.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(f==null?void 0:f.breadcrumbsPrefix)??[],n]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:f==null?void 0:f.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,c)=>c.json(d,f),breadcrumbsPrefix:f==null?void 0:f.breadcrumbsPrefix}),getType:()=>VS.UNION};return{...YJ(a),...hA(a),...NRt(a)}}function Rdf({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:f=[]}){if(!O5r(e))return{ok:!1,errors:[{path:f,message:rC(e,"object")}]};let{[t]:d,...c}=e;if(d==null)return{ok:!1,errors:[{path:f,message:`Missing discriminant ("${t}")`}]};let o=n(d);if(!o.ok)return{ok:!1,errors:o.errors};let l=i(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...c}}:{ok:!1,errors:[{path:[...f,t],message:"Unexpected discriminant value"}]};let g=u(c,l);return g.ok?{ok:!0,value:{[r]:d,...g.value}}:g}var j1=Wn.objectWithoutOptionalProperties({title:Wn.string().optional()});var i0a=Wn.objectWithoutOptionalProperties({file:Wn.string()});var a0a=Wn.objectWithoutOptionalProperties({file:Wn.string()});var o0a=Wn.union("type",{openapi:i0a,protobuf:a0a}).transform({transform:e=>{switch(e.type){case"openapi":return HSr.openapi(e);case"protobuf":return HSr.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var hb=Wn.objectWithoutOptionalProperties({source:o0a.optional()});var u0a=Wn.objectWithoutOptionalProperties({typeName:Wn.string()});var s0a=Wn.union("type",{protobuf:u0a}).transform({transform:e=>{switch(e.type){case"protobuf":return b7n.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ene=Wn.objectWithoutOptionalProperties({encoding:s0a.optional()});var O_=Wn.objectWithoutOptionalProperties({description:Wn.string().optional()});var c0a=Wn.enum_(["GenerallyAvailable","Beta","Deprecated"]);var Z0=Wn.objectWithoutOptionalProperties({availability:c0a.optional()});var Ym=Wn.objectWithoutOptionalProperties({nameOverride:Wn.string().optional(),generatedName:Wn.string()});var wQ=Wn.string();var Kje=Wn.string();var l0a=Wn.objectWithoutOptionalProperties({id:Kje}).extend(O_);var f0a=Wn.string();var d0a=Wn.objectWithoutOptionalProperties({usernameVariableName:Wn.string().optional(),usernameEnvVar:Wn.string().optional(),passwordVariableName:Wn.string().optional(),passwordEnvVar:Wn.string().optional()});var p0a=Wn.objectWithoutOptionalProperties({tokenVariableName:Wn.string().optional(),tokenEnvVar:Wn.string().optional()});var _0a=Wn.objectWithoutOptionalProperties({headerName:Wn.string(),prefix:Wn.string().optional(),headerVariableName:Wn.string().optional(),headerEnvVar:Wn.string().optional()});var h0a=Wn.objectWithoutOptionalProperties({queryParameterName:Wn.string()});var y0a=Wn.objectWithoutOptionalProperties({snake:Wn.string().optional(),camel:Wn.string().optional(),screamingSnake:Wn.string().optional(),pascal:Wn.string().optional()});var j5r=Wn.objectWithoutOptionalProperties({nameOverride:Wn.string().optional(),generatedName:Wn.string(),value:Wn.string(),casing:y0a.optional()}).extend(O_).extend(Z0);var v0a=Wn.objectWithoutOptionalProperties({type:Wn.stringLiteral("namespace"),name:Wn.string()});var b0a=Wn.undiscriminatedUnion([Wn.string(),v0a]);var w5r=Wn.list(b0a);var w1=Wn.objectWithoutOptionalProperties({groupName:w5r.optional()});var P7n=Wn.objectWithoutOptionalProperties({default:j5r.optional(),values:Wn.list(j5r)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var g0a=Wn.objectWithoutOptionalProperties({scopesEnum:P7n.optional()});var m0a=Wn.union("type",{basic:d0a,bearer:p0a,header:_0a,query:h0a,oauth:g0a}).transform({transform:e=>{switch(e.type){case"basic":return F9.basic(e);case"bearer":return F9.bearer(e);case"header":return F9.header(e);case"query":return F9.query(e);case"oauth":return F9.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var D5r=Wn.number();var O0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),url:Wn.string(),audiences:Wn.list(Wn.string()).optional()}).extend(O_);var P0a=Wn.string();var S5r=Wn.objectWithoutOptionalProperties({namespace:Wn.string().optional()});var Xlu={};Wb(Xlu,{FullExample:()=>yA,FullObjectExample:()=>w0a,FullOneOfExample:()=>S0a,KeyValuePair:()=>D0a,LiteralExample:()=>j0a,PrimitiveExample:()=>w7n,PropertyKey:()=>j7n});var j7n=Wn.string();var w7n=Wn.union("type",{int:Wn.object({value:Wn.number()}),int64:Wn.object({value:Wn.number()}),uint:Wn.object({value:Wn.number()}),uint64:Wn.object({value:Wn.number()}),float:Wn.object({value:Wn.number()}),double:Wn.object({value:Wn.number()}),string:Wn.object({value:Wn.string()}),datetime:Wn.object({value:Wn.string()}),date:Wn.object({value:Wn.string()}),base64:Wn.object({value:Wn.string()}),boolean:Wn.object({value:Wn.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return t0.int(e.value);case"int64":return t0.int64(e.value);case"uint":return t0.uint(e.value);case"uint64":return t0.uint64(e.value);case"float":return t0.float(e.value);case"double":return t0.double(e.value);case"string":return t0.string(e.value);case"datetime":return t0.datetime(e.value);case"date":return t0.date(e.value);case"base64":return t0.base64(e.value);case"boolean":return t0.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var j0a=Wn.union("type",{boolean:Wn.object({value:Wn.boolean()}),string:Wn.object({value:Wn.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return g7n.boolean(e.value);case"string":return g7n.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var yA=Wn.union("type",{primitive:Wn.object({value:w7n}),object:Wn.lazyObject(()=>w0a),array:Wn.object({value:Wn.list(Wn.lazy(()=>yA))}),map:Wn.object({value:Wn.list(Wn.lazyObject(()=>D0a))}),enum:Wn.object({value:Wn.string()}),literal:Wn.object({value:j0a}),oneOf:Wn.object({value:Wn.lazy(()=>S0a)}),unknown:Wn.object({value:Wn.lazy(()=>yA)})}).transform({transform:e=>{switch(e.type){case"primitive":return RP.primitive(e.value);case"object":return RP.object(e);case"array":return RP.array(e.value);case"map":return RP.map(e.value);case"enum":return RP.enum(e.value);case"literal":return RP.literal(e.value);case"oneOf":return RP.oneOf(e.value);case"unknown":return RP.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var w0a=Wn.objectWithoutOptionalProperties({properties:Wn.record(j7n,Wn.lazy(()=>yA))});var D0a=Wn.objectWithoutOptionalProperties({key:w7n,value:Wn.lazy(()=>yA)});var S0a=Wn.union("type",{discriminated:Wn.object({value:Wn.record(j7n,Wn.lazy(()=>yA))}),undisciminated:Wn.object({value:Wn.lazy(()=>yA)})}).transform({transform:e=>{switch(e.type){case"discriminated":return v5r.discriminated(e.value);case"undisciminated":return v5r.undisciminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Qlu={};Wb(Qlu,{AllOfPropertyConflict:()=>I7n,ArraySchema:()=>fva,Availability:()=>c0a,BooleanSchema:()=>ava,CasingOverrides:()=>y0a,CommonProperty:()=>gva,CursorPagination:()=>H0a,CustomCodeSample:()=>V0a,CustomCodeSampleLanguage:()=>F0a,CustomCodeSampleSdk:()=>U0a,DiscriminatedOneOfSchema:()=>vva,DoubleSchema:()=>nva,Endpoint:()=>J0a,EndpointExample:()=>N7n,EndpointSdkName:()=>M5r,EnumSchema:()=>P7n,EnumValue:()=>j5r,ErrorExample:()=>z0a,FernExample:()=>I0a,FileResponse:()=>T7n,FileSchema:()=>x0a,FullEndpointExample:()=>W0a,GlobalHeader:()=>uva,Header:()=>E5r,HeaderExample:()=>A7n,HttpEndpointServer:()=>q7n,HttpError:()=>B0a,HttpMethod:()=>D7n,IdempotencyHeader:()=>sva,IntSchema:()=>tva,JsonRequest:()=>C0a,JsonResponse:()=>KSr,LiteralSchema:()=>B7n,LiteralSchemaValue:()=>cva,LongSchema:()=>rva,MapSchema:()=>dva,MultipartRequest:()=>x7n,MultipartRequestProperty:()=>q0a,MultipartSchema:()=>T0a,NullableSchema:()=>_va,ObjectProperty:()=>yva,ObjectPropertyConflictInfo:()=>R7n,ObjectSchema:()=>lva,OctetStreamRequest:()=>M7n,OffsetPagination:()=>$0a,OneOfSchema:()=>hva,OpenApiIntermediateRepresentation:()=>Ldf,OptionalSchema:()=>pva,Pagination:()=>z7n,PathParameter:()=>S7n,PathParameterExample:()=>R0a,PrimitiveSchema:()=>T5r,PrimitiveSchemaValue:()=>ova,QueryParameter:()=>E7n,QueryParameterExample:()=>C7n,ReferencedSchema:()=>zRt,Request:()=>A0a,Response:()=>N0a,Schema:()=>D1,Schemas:()=>eva,SdkGroupInfo:()=>E0a,StringSchema:()=>iva,SupportedSdkLanguage:()=>L0a,Tags:()=>M0a,TextResponse:()=>x5r,UnDiscriminatedOneOfSchema:()=>bva,Webhook:()=>Y0a,WebhookExampleCall:()=>K0a,WebhookHttpMethod:()=>G0a,WebsocketChannel:()=>k0a,WebsocketHandshake:()=>X0a,WebsocketMessageExample:()=>Q0a,WebsocketSessionExample:()=>Z0a});var E0a=Wn.objectWithoutOptionalProperties({summary:Wn.string().optional(),description:Wn.string().optional()});var M0a=Wn.objectWithoutOptionalProperties({tagsById:Wn.record(Kje,l0a),orderedTagIds:Wn.list(Kje).optional()});var D7n=Wn.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var S7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),variableReference:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var E7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var E5r=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),env:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var M5r=Wn.objectWithoutOptionalProperties({groupName:w5r,methodName:Wn.string()});var M7n=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var x0a=Wn.objectWithoutOptionalProperties({isOptional:Wn.boolean(),isArray:Wn.boolean()});var T0a=Wn.union("type",{file:x0a,json:Wn.object({value:Wn.lazy(()=>D1)})}).transform({transform:e=>{switch(e.type){case"file":return D2e.file(e);case"json":return D2e.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var q0a=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:T0a,contentType:Wn.string().optional()}).extend(O_);var x7n=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),properties:Wn.list(q0a)}).extend(O_).extend(hb);var C0a=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1),contentType:Wn.string().optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(hb);var A0a=Wn.union("type",{octetStream:M7n,multipart:x7n,json:C0a}).transform({transform:e=>{switch(e.type){case"octetStream":return b5r.octetStream(e);case"multipart":return b5r.multipart(e);case"json":return b5r.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var T7n=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var KSr=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1),responseProperty:Wn.string().optional()}).extend(O_).extend(hb);var x5r=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var N0a=Wn.union("type",{file:T7n,json:KSr,text:x5r,streamingSse:KSr,streamingText:x5r,streamingJson:KSr}).transform({transform:e=>{switch(e.type){case"file":return Sne.file(e);case"json":return Sne.json(e);case"text":return Sne.text(e);case"streamingSse":return Sne.streamingSse(e);case"streamingText":return Sne.streamingText(e);case"streamingJson":return Sne.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var z0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),description:Wn.string().optional(),example:Wn.lazy(()=>yA)});var B0a=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1).optional(),examples:Wn.list(z0a).optional()}).extend(O_).extend(Ym).extend(hb);var q7n=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),url:Wn.string().optional(),audiences:Wn.list(Wn.string()).optional()});var I0a=Wn.unknown();var R0a=Wn.objectWithoutOptionalProperties({name:Wn.string(),parameterNameOverride:Wn.string().optional(),value:Wn.lazy(()=>yA)});var C7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),value:Wn.lazy(()=>yA)});var A7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),value:Wn.lazy(()=>yA)});var F0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),language:Wn.string(),code:Wn.string(),install:Wn.string().optional()}).extend(O_);var L0a=Wn.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var U0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),sdk:L0a,code:Wn.string()}).extend(O_);var V0a=Wn.union("type",{language:F0a,sdk:U0a}).transform({transform:e=>{switch(e.type){case"language":return JSr.language(e);case"sdk":return JSr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var W0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),pathParameters:Wn.list(R0a).optional(),queryParameters:Wn.list(C7n).optional(),headers:Wn.list(A7n).optional(),request:Wn.lazy(()=>yA).optional(),response:Wn.lazy(()=>yA).optional(),codeSamples:Wn.list(V0a)}).extend(O_);var N7n=Wn.union("type",{unknown:Wn.object({value:I0a}),full:W0a}).transform({transform:e=>{switch(e.type){case"unknown":return pAt.unknown(e.value);case"full":return pAt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var H0a=Wn.objectWithoutOptionalProperties({cursor:Wn.string(),nextCursor:Wn.property("next_cursor",Wn.string()),results:Wn.string()});var $0a=Wn.objectWithoutOptionalProperties({offset:Wn.string(),results:Wn.string(),step:Wn.string().optional(),hasNextPage:Wn.string().optional()});var z7n=Wn.union("type",{cursor:H0a,offset:$0a}).transform({transform:e=>{switch(e.type){case"cursor":return $Sr.cursor(e);case"offset":return $Sr.offset(e);default:return e}},untransform:({_visit:e,...t})=>t});var J0a=Wn.objectWithoutOptionalProperties({authed:Wn.boolean(),internal:Wn.boolean().optional(),idempotent:Wn.boolean().optional(),method:D7n,audiences:Wn.list(Wn.string()),path:Wn.string(),summary:Wn.string().optional(),operationId:Wn.string().optional(),tags:Wn.list(Kje),pathParameters:Wn.list(S7n),queryParameters:Wn.list(E7n),headers:Wn.list(E5r),sdkName:M5r.optional(),generatedRequestName:Wn.string(),requestNameOverride:Wn.string().optional(),request:A0a.optional(),response:N0a.optional(),errors:Wn.record(D5r,B0a),server:Wn.list(q7n),examples:Wn.list(N7n),pagination:z7n.optional()}).extend(O_).extend(Z0).extend(hb).extend(S5r);var G0a=Wn.enum_(["GET","POST"]);var K0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),payload:Wn.lazy(()=>yA)}).extend(O_);var Y0a=Wn.objectWithoutOptionalProperties({sdkName:M5r.optional(),method:G0a,summary:Wn.string().optional(),operationId:Wn.string(),tags:Wn.list(Kje),headers:Wn.list(E5r),generatedPayloadName:Wn.string(),payload:Wn.lazy(()=>D1),examples:Wn.list(K0a)}).extend(O_).extend(hb).extend(S5r);var X0a=Wn.objectWithoutOptionalProperties({queryParameters:Wn.list(E7n),headers:Wn.list(E5r),pathParameters:Wn.list(S7n)});var Q0a=Wn.objectWithoutOptionalProperties({messageType:Wn.string(),payload:Wn.lazy(()=>yA)}).extend(O_);var Z0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),queryParameters:Wn.list(C7n).optional(),headers:Wn.list(A7n).optional(),messages:Wn.list(Q0a)}).extend(O_);var k0a=Wn.objectWithoutOptionalProperties({path:Wn.string(),groupName:w5r,summary:Wn.string().optional(),handshake:X0a,publish:Wn.lazy(()=>D1).optional(),subscribe:Wn.lazy(()=>D1).optional(),examples:Wn.list(Z0a)}).extend(O_).extend(hb);var eva=Wn.objectWithoutOptionalProperties({rootSchemas:Wn.record(wQ,Wn.lazy(()=>D1)),namespacedSchemas:Wn.record(P0a,Wn.record(wQ,Wn.lazy(()=>D1)))});var tva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional()});var rva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional()});var nva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional()});var iva=Wn.objectWithoutOptionalProperties({default:Wn.string().optional(),pattern:Wn.string().optional(),format:Wn.string().optional(),minLength:Wn.number().optional(),maxLength:Wn.number().optional()});var ava=Wn.objectWithoutOptionalProperties({default:Wn.boolean().optional()});var ova=Wn.union("type",{int:tva,int64:rva,uint:Wn.object({}),uint64:Wn.object({}),float:Wn.object({}),double:nva,string:iva,datetime:Wn.object({}),date:Wn.object({}),base64:Wn.object({}),boolean:ava}).transform({transform:e=>{switch(e.type){case"int":return Xw.int(e);case"int64":return Xw.int64(e);case"uint":return Xw.uint();case"uint64":return Xw.uint64();case"float":return Xw.float();case"double":return Xw.double(e);case"string":return Xw.string(e);case"datetime":return Xw.datetime();case"date":return Xw.date();case"base64":return Xw.base64();case"boolean":return Xw.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var T5r=Wn.objectWithoutOptionalProperties({schema:ova}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var uva=Wn.objectWithoutOptionalProperties({header:Wn.string(),name:Wn.string().optional(),optional:Wn.boolean().optional(),env:Wn.string().optional(),schema:Wn.lazy(()=>D1).optional()});var sva=Wn.objectWithoutOptionalProperties({header:Wn.string(),name:Wn.string().optional(),env:Wn.string().optional(),schema:Wn.lazy(()=>D1).optional()});var Ldf=Wn.objectWithoutOptionalProperties({apiVersion:Wn.unknown().optional(),title:Wn.string().optional(),description:Wn.string().optional(),basePath:Wn.string().optional(),servers:Wn.list(O0a),groups:Wn.record(Wn.string(),E0a),tags:M0a,hasEndpointsMarkedInternal:Wn.boolean(),endpoints:Wn.list(J0a),webhooks:Wn.list(Y0a),channel:Wn.list(k0a),groupedSchemas:eva,variables:Wn.record(Wn.string(),T5r),nonRequestReferencedSchemas:Wn.set(wQ),securitySchemes:Wn.record(f0a,m0a),globalHeaders:Wn.list(uva).optional(),idempotencyHeaders:Wn.list(sva).optional()});var zRt=Wn.objectWithoutOptionalProperties({schema:wQ}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var cva=Wn.union("type",{boolean:Wn.object({value:Wn.boolean()}),string:Wn.object({value:Wn.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return E7.boolean(e.value);case"string":return E7.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var B7n=Wn.objectWithoutOptionalProperties({value:cva}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var D1=Wn.union("type",{primitive:T5r,object:Wn.lazyObject(()=>lva),array:Wn.lazyObject(()=>fva),map:Wn.lazyObject(()=>dva),optional:Wn.lazyObject(()=>pva),enum:P7n,reference:zRt,literal:B7n,oneOf:Wn.object({value:Wn.lazy(()=>hva)}),nullable:Wn.lazyObject(()=>_va),unknown:Ym}).transform({transform:e=>{switch(e.type){case"primitive":return ib.primitive(e);case"object":return ib.object(e);case"array":return ib.array(e);case"map":return ib.map(e);case"optional":return ib.optional(e);case"enum":return ib.enum(e);case"reference":return ib.reference(e);case"literal":return ib.literal(e);case"oneOf":return ib.oneOf(e.value);case"nullable":return ib.nullable(e);case"unknown":return ib.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var I7n=Wn.objectWithoutOptionalProperties({propertyKey:Wn.string(),allOfSchemaIds:Wn.list(wQ),conflictingTypeSignatures:Wn.boolean()});var lva=Wn.objectWithoutOptionalProperties({allOf:Wn.list(zRt),properties:Wn.list(Wn.lazyObject(()=>yva)),allOfPropertyConflicts:Wn.list(I7n),additionalProperties:Wn.boolean()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var R7n=Wn.objectWithoutOptionalProperties({differentSchema:Wn.boolean()});var yva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>D1),conflict:Wn.record(wQ,R7n),generatedName:Wn.string(),nameOverride:Wn.string().optional(),audiences:Wn.list(Wn.string())}).extend(Z0);var fva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var dva=Wn.objectWithoutOptionalProperties({key:T5r,value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(j1);var pva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var _va=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var hva=Wn.union("type",{discriminated:Wn.lazyObject(()=>vva),undisciminated:Wn.lazyObject(()=>bva)}).transform({transform:e=>{switch(e.type){case"discriminated":return GSr.discriminated(e);case"undisciminated":return GSr.undisciminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var vva=Wn.objectWithoutOptionalProperties({discriminantProperty:Wn.string(),commonProperties:Wn.list(Wn.lazyObject(()=>gva)),schemas:Wn.record(Wn.string(),Wn.lazy(()=>D1))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var gva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>D1)});var bva=Wn.objectWithoutOptionalProperties({schemas:Wn.list(Wn.lazy(()=>D1))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var Zlu={};Wb(Zlu,{ArraySchemaWithExample:()=>Lva,Base64WithExample:()=>zva,BooleanWithExample:()=>Bva,CommonPropertyWithExample:()=>Yva,DateWithExample:()=>Nva,DatetimeWithExample:()=>Ava,DiscriminatedOneOfSchemaWithExample:()=>Gva,DoubleWithExample:()=>qva,EndpointWithExample:()=>Vdf,EnumSchemaWithExample:()=>Rva,FloatWithExample:()=>Tva,HeaderWithExample:()=>L7n,HttpErrorWithExample:()=>Dva,Int64WithExample:()=>Eva,IntWithExample:()=>Sva,JsonRequestWithExample:()=>Ova,JsonResponseWithExample:()=>jva,MapSchemaWithExample:()=>Uva,NamedFullExample:()=>BRt,NullableSchemaWithExample:()=>Wva,ObjectPropertyWithExample:()=>Jva,ObjectSchemaWithExample:()=>Hva,OneOfSchemaWithExample:()=>$va,OptionalSchemaWithExample:()=>Vva,PathParameterWithExample:()=>mva,PrimitiveSchemaValueWithExample:()=>Iva,PrimitiveSchemaWithExample:()=>U7n,QueryParameterWithExample:()=>F7n,RequestWithExample:()=>Pva,ResponseWithExample:()=>wva,SchemaWithExample:()=>aq,StringSchemaWithExample:()=>Cva,Uint64WithExample:()=>xva,UintWithExample:()=>Mva,UnDiscriminatedOneOfSchemaWithExample:()=>Kva,UnknownSchemaWithExample:()=>Fva,WebsocketHandshakeWithExample:()=>Udf});var BRt=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),value:Wn.unknown()}).extend(O_);var F7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var L7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),env:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var Udf=Wn.objectWithoutOptionalProperties({queryParameters:Wn.list(F7n),headers:Wn.list(L7n)});var mva=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),variableReference:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var Ova=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>aq),contentType:Wn.string().optional(),fullExamples:Wn.list(BRt).optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(hb);var Pva=Wn.union("type",{octetStream:M7n,multipart:x7n,json:Ova}).transform({transform:e=>{switch(e.type){case"octetStream":return S2e.octetStream(e);case"multipart":return S2e.multipart(e);case"json":return S2e.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var jva=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>aq),responseProperty:Wn.string().optional(),fullExamples:Wn.list(BRt).optional()}).extend(O_).extend(hb);var wva=Wn.union("type",{file:T7n,json:jva,text:x5r,streamingSse:KSr,streamingText:x5r,streamingJson:KSr}).transform({transform:e=>{switch(e.type){case"file":return T3.file(e);case"json":return T3.json(e);case"text":return T3.text(e);case"streamingSse":return T3.streamingSse(e);case"streamingText":return T3.streamingText(e);case"streamingJson":return T3.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Dva=Wn.objectWithoutOptionalProperties({statusCode:D5r,schema:Wn.lazy(()=>aq),fullExamples:Wn.list(BRt).optional()}).extend(O_).extend(Ym).extend(hb);var Vdf=Wn.objectWithoutOptionalProperties({authed:Wn.boolean(),internal:Wn.boolean().optional(),idempotent:Wn.boolean().optional(),method:D7n,audiences:Wn.list(Wn.string()),path:Wn.string(),summary:Wn.string().optional(),operationId:Wn.string().optional(),tags:Wn.list(Kje),pathParameters:Wn.list(mva),queryParameters:Wn.list(F7n),headers:Wn.list(L7n),sdkName:M5r.optional(),generatedRequestName:Wn.string(),requestNameOverride:Wn.string().optional(),request:Pva.optional(),response:wva.optional(),errors:Wn.record(D5r,Dva),server:Wn.list(q7n),examples:Wn.list(N7n),pagination:z7n.optional()}).extend(O_).extend(Z0).extend(hb).extend(S5r);var Sva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional(),example:Wn.number().optional()});var Eva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var Mva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var xva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var Tva=Wn.objectWithoutOptionalProperties({example:Wn.number().optional()});var qva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional(),example:Wn.number().optional()});var Cva=Wn.objectWithoutOptionalProperties({default:Wn.string().optional(),pattern:Wn.string().optional(),format:Wn.string().optional(),minLength:Wn.number().optional(),maxLength:Wn.number().optional(),example:Wn.string().optional()});var Ava=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var Nva=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var zva=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var Bva=Wn.objectWithoutOptionalProperties({default:Wn.boolean().optional(),example:Wn.boolean().optional()});var Iva=Wn.union("type",{int:Sva,int64:Eva,uint:Mva,uint64:xva,float:Tva,double:qva,string:Cva,datetime:Ava,date:Nva,base64:zva,boolean:Bva}).transform({transform:e=>{switch(e.type){case"int":return by.int(e);case"int64":return by.int64(e);case"uint":return by.uint(e);case"uint64":return by.uint64(e);case"float":return by.float(e);case"double":return by.double(e);case"string":return by.string(e);case"datetime":return by.datetime(e);case"date":return by.date(e);case"base64":return by.base64(e);case"boolean":return by.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var U7n=Wn.objectWithoutOptionalProperties({schema:Iva}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var Rva=Wn.objectWithoutOptionalProperties({default:j5r.optional(),values:Wn.list(j5r),example:Wn.string().optional()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var Fva=Wn.objectWithoutOptionalProperties({example:Wn.unknown()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var aq=Wn.union("type",{primitive:U7n,object:Wn.lazyObject(()=>Hva),array:Wn.lazyObject(()=>Lva),map:Wn.lazyObject(()=>Uva),optional:Wn.lazyObject(()=>Vva),enum:Rva,reference:zRt,literal:B7n,oneOf:Wn.object({value:Wn.lazy(()=>$va)}),nullable:Wn.lazyObject(()=>Wva),unknown:Fva}).transform({transform:e=>{switch(e.type){case"primitive":return Lp.primitive(e);case"object":return Lp.object(e);case"array":return Lp.array(e);case"map":return Lp.map(e);case"optional":return Lp.optional(e);case"enum":return Lp.enum(e);case"reference":return Lp.reference(e);case"literal":return Lp.literal(e);case"oneOf":return Lp.oneOf(e.value);case"nullable":return Lp.nullable(e);case"unknown":return Lp.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq),example:Wn.list(Wn.unknown()).optional()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Uva=Wn.objectWithoutOptionalProperties({key:U7n,value:Wn.lazy(()=>aq),example:Wn.unknown().optional()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(Ene).extend(j1);var Vva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq)}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Wva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq)}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Hva=Wn.objectWithoutOptionalProperties({allOf:Wn.list(zRt),properties:Wn.list(Wn.lazyObject(()=>Jva)),allOfPropertyConflicts:Wn.list(I7n),fullExamples:Wn.list(BRt).optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var Jva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>aq),audiences:Wn.list(Wn.string()),conflict:Wn.record(wQ,R7n),nameOverride:Wn.string().optional(),generatedName:Wn.string()}).extend(Z0);var $va=Wn.union("type",{discriminated:Wn.lazyObject(()=>Gva),undisciminated:Wn.lazyObject(()=>Kva)}).transform({transform:e=>{switch(e.type){case"discriminated":return jQ.discriminated(e);case"undisciminated":return jQ.undisciminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Gva=Wn.objectWithoutOptionalProperties({discriminantProperty:Wn.string(),commonProperties:Wn.list(Wn.lazyObject(()=>Yva)),schemas:Wn.record(Wn.string(),Wn.lazy(()=>aq))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var Yva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>aq)});var Kva=Wn.objectWithoutOptionalProperties({schemas:Wn.list(Wn.lazy(()=>aq))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);function Xva(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Ol(e.type)}}function V7n(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:Ol(e)}}function A2(e){return typeof e=="string"?e:e.type}function A_i(e){if(typeof e!="string")return e.docs}function Wdf(e){if(typeof e!="string")return e.default}function Hdf(e){if(typeof e!="string")return e.validation}function z01(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function $df(e){var n;let t=e?z01(e):void 0;if(t==null||t.length===0)return zui;let r=[];for(let[i,a]of t.entries())if(typeof a=="string")r.push(FE(a));else if(typeof a=="object")switch(a.type){case"namespace":{i<t.length-1?r.push(FE(a.name)):r.push(a.name,zui);break}default:Ol(a.type)}else Ol(a);if(((n=r[-1])==null?void 0:n.toLowerCase())==="v1")throw new Error(`[TESTING HERE] ${JSON.stringify(e)}, ${JSON.stringify(r)}`);return r.join("/")}function W7n(e){return zs.of(`${$df(e)}.yml`)}function klu({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?zui:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,$df(r))}function Jdf({sdkName:e,namespaceOverride:t}){return zs.of(`${klu({sdkName:e,namespaceOverride:t})}.yml`)}function Gdf({location:e,namespaceOverride:t}){return t!=null?pf(zs.of(t),e):e}function q3(e){switch(e){case vW.Deprecated:return"deprecated";case vW.Beta:return"pre-release";case vW.GenerallyAvailable:return"generally-available";default:return}}var B01=-2147483648,I01=2147483647,R01=-17976931348623157e292,F01=17976931348623157e292;function S1({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i}){switch(e.type){case"primitive":return Qva(e);case"array":return rfu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"map":return nfu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"reference":return tfu({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return afu();case"optional":case"nullable":return ifu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"enum":return K01({schema:e,fileContainingReference:t,context:n,declarationFile:r});case"literal":return e.value,ofu(e);case"object":return Y01({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"oneOf":return X01({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i});default:Ol(e)}}function Qva(e){switch(e.schema.type){case"string":return V01({description:e.description,schema:e.schema});case"int":return W01({description:e.description,schema:e.schema});case"float":return H01({description:e.description,schema:e.schema});case"double":return $01({description:e.description,schema:e.schema});case"boolean":return L01({description:e.description,schema:e.schema});case"int64":return U01({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{...e.title!=null?{"display-name":e.title}:{},type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function L01({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function U01({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function V01({description:e,schema:t}){let r="string",n=J01(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function W01({description:e,schema:t}){let r="integer",n=Kdf(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function H01({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function $01({description:e,schema:t}){let r="double",n=Kdf(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function J01(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=G01(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function G01(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function Kdf(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=efu(r,t),n=efu(n,t),i=efu(i,t),!(r==null&&n==null&&a==null&&u==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:u,multipleOf:i}}function efu(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[B01,I01]:[R01,F01];return e<r||e>n?void 0:e}function tfu({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=Q01(i)??e.schema,u=V7n(i),f=Z01(i),d=Zva({context:r,fileContainingReference:t,declarationFile:W7n(u),type:a}),c=i.type==="nullable"?`optional<${d}>`:d;return e.description==null&&f==null?c:{...f!=null?{"display-name":f}:{},type:i.type==="nullable"?`optional<${d}>`:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function rfu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),u=`list<${A2(a)}>`;return e.description==null&&e.title==null?u:{...e.title!=null?{"display-name":e.title}:{},...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{},type:u}}function nfu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=Qva(e.key),u=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),f=e.encoding!=null?Xva(e.encoding):void 0,d=`map<${A2(a)}, ${A2(u)}>`;if(e.description==null&&f==null&&e.title==null)return d;let c={type:d};return e.description!=null&&(c.docs=e.description),e.encoding!=null&&(c.encoding=f),e.title!=null&&(c["display-name"]=e.title),e.availability!=null&&(c.availability=q3(e.availability)),c}function ifu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),u=A2(a),f=A_i(a),d=Wdf(a),c=Hdf(a),o=u.startsWith("optional<")?u:`optional<${u}>`;if(e.availability==null&&e.description==null&&f==null&&d==null&&c==null&&e.title==null)return o;let l={type:o};return(e.description!=null||f!=null)&&(l.docs=e.description??f),d!=null&&(l.default=d),c!=null&&(l.validation=c),e.title!=null&&(l["display-name"]=e.title),e.availability!=null&&(l.availability=q3(e.availability)),l}function afu(){return"unknown"}function ofu(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ol(e.value)}return e.description==null&&e.title==null?t:{...e.title!=null?{"display-name":e.title}:{},type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function K01({schema:e,fileContainingReference:t,declarationFile:r,context:n}){let i=N_i(e),a=e.nameOverride??e.generatedName;n.builder.addType(r,{name:a,schema:i.schema});let u=Zva({type:a,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return u;let f={type:u};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.title!=null&&(f["display-name"]=e.title),e.availability!=null&&(f.availability=q3(e.availability)),f}function Y01({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=ufu({schema:e,declarationFile:r,context:n,namespace:i}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let f=Zva({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function X01({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=sfu({schema:e,declarationFile:r,context:n,namespace:i}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let f=Zva({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function Zva({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function Q01(e){return ib._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function Z01(e){return ib._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}function Ien(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ol(e)}}function Xdf({schema:e,context:t,declarationFile:r,namespace:n}){switch(e.type){case"primitive":return tv1(e);case"array":return k01({schema:e,context:t,declarationFile:r,namespace:n});case"map":return ev1({schema:e,context:t,declarationFile:r,namespace:n});case"reference":return rv1({schema:e,context:t,declarationFile:r,namespace:n});case"unknown":return iv1(e.nameOverride,e.generatedName);case"optional":case"nullable":return nv1({schema:e,context:t,declarationFile:r,namespace:n});case"enum":return N_i(e);case"literal":return av1(e,e.nameOverride,e.generatedName);case"object":return ufu({schema:e,context:t,declarationFile:r,namespace:n});case"oneOf":return sfu({schema:e.value,context:t,declarationFile:r,namespace:n});default:Ol(e)}}function ufu({schema:e,context:t,declarationFile:r,namespace:n}){let i={},a=new Set;for(let c of e.properties){if(Object.keys(c.conflict).length>0){if(Object.entries(c.conflict).every(([S,x])=>!x.differentSchema))continue;Object.entries(c.conflict).forEach(([S])=>{cfu({property:c.key,schemaId:S,context:t,namespace:n}).forEach(A=>{a.add(A)})})}let o=S1({schema:c.schema,context:t,fileContainingReference:r,namespace:n}),l=c.audiences,g=c.nameOverride,O=q3(c.availability);i[c.key]=sv1(o,l,g,O)}let u=new Set;for(let c of e.allOfPropertyConflicts)c.allOfSchemaIds.forEach(o=>a.add(o)),c.conflictingTypeSignatures&&u.add(c.propertyKey);let f=[];for(let c of e.allOf){let o=Qdf({schema:c.schema,context:t,namespace:n});if(o==null||a.has(c.schema)||a.has(o))continue;let l=S1({schema:ib.reference(c),context:t,fileContainingReference:r,namespace:n});f.push(A2(l))}for(let c of a){let o=lfu(t,c,n);for(let l of o.properties)i[l.key]==null&&(u.has(l.key)&&(i[l.key]="unknown"),i[l.key]=S1({schema:l.schema,context:t,fileContainingReference:r,namespace:n}));for(let l of o.allOf){if(a.has(l.schema))continue;let g=S1({schema:ib.reference(l),context:t,fileContainingReference:r,namespace:n});f.push(A2(g))}}let d={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(i).map(([c,o])=>uv1(c)?[c,typeof o=="string"?{type:o,name:`_${c}`}:{...o,name:`_${c}`}]:[c,o]))};return f.length>0&&(d.extends=f),e.additionalProperties&&(d["extra-properties"]=!0),e.availability!=null&&(d.availability=q3(e.availability)),e.source!=null&&(d.source=Ien(e.source)),{name:e.nameOverride??e.generatedName,schema:d}}function cfu({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return cfu({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:u}=lfu(r,t,n),f=a.some(c=>c.key===e),d=[...u.flatMap(c=>cfu({property:e,context:r,schemaId:c.schema,namespace:n}))];if(f||d.length>0)return[t,...d]}return[]}function lfu(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return lfu(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function k01({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:rfu({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n})}}function ev1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:nfu({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n})}}function tv1(e){let t=Qva(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function Ydf(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function N_i(e){let t={enum:e.values.map(i=>{let a=i.nameOverride??i.generatedName,u=i.value;if(a===u&&i.description==null&&(i.casing==null||Ydf(i.casing)))return a;let f={value:i.value};if(a!==u&&(f.name=a),i.description!=null&&(f.docs=i.description),i.casing!=null&&!Ydf(i.casing)){let d={},c=!1;i.casing.camel!=null&&(d.camel=i.casing.camel,c=!0),i.casing.screamingSnake!=null&&(d["screaming-snake"]=i.casing.screamingSnake,c=!0),i.casing.snake!=null&&(d.snake=i.casing.snake,c=!0),i.casing.pascal!=null&&(d.pascal=i.casing.pascal,c=!0),c&&(f.casing=d)}return f})};e.description!=null&&(t.docs=e.description),e.default!=null&&(t.default=e.default.value);let r=new Set,n={...t,enum:[],source:e.source!=null?Ien(e.source):void 0};for(let i of t.enum){let a=typeof i=="string"?i:i.name??i.value;r.has(a.toLowerCase())||(n.enum.push(i),r.add(a.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function rv1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:tfu({schema:e,context:t,fileContainingReference:r,namespace:n})}}function nv1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:ifu({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n})}}function iv1(e,t){return{name:e??t,schema:afu()}}function av1(e,t,r){return{name:t??r,schema:ofu(e)}}function sfu({schema:e,context:t,declarationFile:r,namespace:n}){let i=e.encoding!=null?Xva(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let d of e.commonProperties)u[d.key]=S1({schema:d.schema,fileContainingReference:r,context:t,namespace:n});let f={};for(let[d,c]of Object.entries(e.schemas))f[d]=S1({schema:c,context:t,fileContainingReference:r,namespace:n});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?q3(e.availability):void 0,union:f,encoding:i,source:e.source!=null?Ien(e.source):void 0}}}let a=[];for(let u of e.schemas)a.push(S1({schema:u,fileContainingReference:r,context:t,namespace:n}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:i,source:e.source!=null?Ien(e.source):void 0}}}var ov1=/^[0-9]/;function uv1(e){return ov1.test(e)}function Qdf({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?Qdf({context:t,schema:n.schema,namespace:r}):e}function sv1(e,t,r,n){return t.length===0&&r==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{}}}function Zdf(e){let t=e.replace(/^x-|^X-/,"");return FE(t)}var kdf="BasicAuthScheme",kva="BearerAuthScheme";function epf(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:kdf,schema:i}),t||(e.builder.setAuth(kdf),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:kva,schema:i}),t||(e.builder.setAuth(kva),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??Zdf(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:kva,schema:i}),t||(e.builder.setAuth(kva),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(zs.of("__package__.yml"),{name:"OauthScope",schema:N_i(n.scopesEnum).schema})}}function IRt({header:e,context:t,fileContainingReference:r,namespace:n}){let i=S1({schema:e.schema,context:t,fileContainingReference:r,namespace:n}),a=A2(i),u=e.name.replace(/^x-|^X-/,""),f=e.parameterNameOverride!=null?e.parameterNameOverride:FE(u);if(e.description==null&&e.name===f&&e.env==null&&e.availability==null)return a;let d={type:a};return f!==e.name&&(d.name=f),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=q3(e.availability)),d}function eba({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=S1({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(e.variableReference==null&&e.description==null&&e.availability==null)return A2(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:A2(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=q3(e.availability)),a}var Zmu=require("fs/promises");var tpf={naming:"v1"};function Lh(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function RRt(e,t,r,n,i=[]){try{let a=Lh(e,t);if(a!=null)return r.parse(a)}catch{let u=X8t(i).join(" -> ");n.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}var tba={of(e){return e}};var kh={SDK_METHOD_NAME:tba.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:tba.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:tba.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport"};function gy(e){return e.$ref!=null}function E2e(e){switch(Lh(e,kh.AVAILABILITY)){case"deprecated":return vW.Deprecated;case"beta":return vW.Beta;case"generally-available":return vW.GenerallyAvailable;default:break}if(!gy(e)&&e.deprecated)return vW.Deprecated}var Yje={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};function rpf({schema:e,logger:t}){return RRt(e,kh.ENCODING,h5.EncodingSchema,t)??void 0}function npf(e){return Lh(e,kh.FERN_ENUM)}function ipf({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let u=Lh(n,kh.SDK_GROUP_NAME),f=Lh(n,kh.TYPE_DEFINITION);if(f!=null)return z_i({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,groupName:typeof u=="string"?[u]:u})}function z_i({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u}){return IJ({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.base64({example:void 0})});case"BOOLEAN":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.boolean({default:void 0,example:void 0})});case"DATE":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.date({example:void 0})});case"DATE_TIME":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.datetime({example:void 0})});case"FLOAT":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.float({example:void 0})});case"DOUBLE":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.uint({default:void 0,example:void 0})});case"INTEGER":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.uint64({default:void 0,example:void 0})});case"LONG":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Ol(f.v1)}},unknown:()=>Lp.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,groupName:u}),map:({keyType:f,valueType:d})=>(f==null?void 0:f.type)==="primitive"&&d!=null?Lp.map({nameOverride:t,generatedName:r,title:n,key:f,value:d,description:i,availability:a,groupName:u,encoding:void 0,example:void 0}):void 0,list:f=>f!=null?Lp.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u,example:void 0}):void 0,optional:f=>f!=null?Lp.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u}):void 0,set:f=>f!=null?Lp.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u,example:void 0}):void 0,literal:f=>Lp.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:d=>E7.string(d),boolean:d=>E7.boolean(d),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,groupName:u}),named:()=>{}}})}function Ren(e){if(e!=null&&typeof e=="boolean")return e}function apf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:u,wrapAsNullable:f,context:d,groupName:c,example:o,encoding:l,source:g,namespace:O}){return typeof i=="boolean"||H7n(i)?rba({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:Lp.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:void 0}),groupName:c,example:o,encoding:l}):rba({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:L1(i,d.options.optionalAdditionalProperties?f:!1,d,[...n,"Value"],g,O),groupName:c,example:o,encoding:l})}function rba({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsNullable:a,description:u,availability:f,groupName:d,example:c,encoding:o}){return a?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.map({nameOverride:e,generatedName:t,title:r,description:u,availability:n.availability,key:n,value:i,groupName:d,encoding:o,example:c}),description:u,availability:f,groupName:d}):Lp.map({nameOverride:e,generatedName:t,title:r,description:u,availability:f,key:n,value:i,groupName:d,encoding:o,example:c})}function H7n(e){return e==null?!1:typeof e=="boolean"?e:!gy(e)&&Object.keys(e).length===0}function opf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:u,wrapAsNullable:f,context:d,groupName:c,example:o,source:l,namespace:g}){let O=i==null?Lp.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,groupName:c}):L1(i,!1,d,[...n,"Item"],l,g);return cv1({nameOverride:e,generatedName:t,title:r,groupName:c,itemSchema:O,wrapAsNullable:f,description:a,availability:u,example:o})}function cv1({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsNullable:i,description:a,availability:u,groupName:f,example:d}){return i?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,groupName:f,example:d}),description:a,availability:u,groupName:f}):Lp.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,groupName:f,example:d})}function ffu({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:f,wrapAsNullable:d,discriminator:c,context:o,groupName:l,encoding:g,source:O,namespace:j}){let S=c.propertyName,x=Object.fromEntries(Object.entries(c.mapping??{}).map(([z,N])=>{let C=$7n({$ref:N},!1,o,[N],g,O,j);return o.markReferencedByDiscriminatedUnion({$ref:N},S,1),[z,C]})),A=Object.entries(i).filter(([z])=>z!==S).map(([z,N])=>{let C=f!=null&&f.includes(z),U=L1(N,!C,o,[...n,z],O,j);return{key:z,schema:U}});return upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:A,description:a,availability:u,discriminant:S,subtypes:x,groupName:l,source:O})}function dfu({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:f,wrapAsNullable:d,discriminant:c,variants:o,context:l,groupName:g,encoding:O,source:j,namespace:S}){let x=Object.fromEntries(Object.entries(o).map(([z,N])=>{if(gy(N)){let C=$7n(N,!1,l,[N.$ref],O,j,S);return l.markReferencedByDiscriminatedUnion(N,c,1),[z,C]}else{let C=q5r(N,!1,l,[...n,z],O,j,S,new Set([c]));return[z,C]}})),A=Object.entries(i).filter(([z])=>z!==c).map(([z,N])=>{let C=f!=null&&f.includes(z),U=L1(N,!C,l,[...n,z],j,S);return{key:z,schema:U}});return upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:A,description:a,availability:u,discriminant:c,subtypes:x,groupName:g,source:j})}function upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,availability:u,discriminant:f,subtypes:d,groupName:c,source:o}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.oneOf(jQ.discriminated({description:a,availability:u,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:i,groupName:c,encoding:void 0,source:o})),groupName:c,description:a,availability:u}):Lp.oneOf(jQ.discriminated({description:a,availability:u,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:i,groupName:c,encoding:void 0,source:o}))}function spf(e){if(e.proto!=null)return b7n.protobuf({typeName:e.proto.type})}var lv1=/^(\d+)/;function nba(e){let t=e.match(lv1);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=J7n(i);return n.length>0?`${a}_${n}`:a}}}function J7n(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let u=Math.floor(e/10),f=e%10;return f===0?n[u]:`${n[u]}_${t[f]}`}if(e<1e3){let u=Math.floor(e/100),f=e%100;return f===0?`${t[u]}_hundred`:`${t[u]}_hundred_${J7n(f)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${J7n(a)}`}var G7n=/^[a-zA-Z][a-zA-Z0-9_]*$/;function C5r({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:u,description:f,availability:d,wrapAsNullable:c,groupName:o,context:l,source:g}){let O=pv1(i??[]),j=new Set(a),S=Array.from(j).map((A,z)=>{var G,$,ee,Ve;let N=n==null?void 0:n[A],C=O[z],U=G7n.test(A),Y=(N==null?void 0:N.name)??C,te=U?A:B_i(A);return Y!=null&&!G7n.test(Y)&&(l==null||l.logger.warn(`Enum name override ${Y} is not a valid name. Falling back on ${te}.`),Y=void 0),{nameOverride:Y,generatedName:te,value:A,description:N==null?void 0:N.description,availability:d,casing:{snake:((G=N==null?void 0:N.casing)==null?void 0:G.snake)??void 0,pascal:(($=N==null?void 0:N.casing)==null?void 0:$.pascal)??void 0,screamingSnake:((ee=N==null?void 0:N.casing)==null?void 0:ee.screamingSnake)??void 0,camel:((Ve=N==null?void 0:N.casing)==null?void 0:Ve.camel)??void 0}}}),x=u!=null?S.find(A=>A.value===u):void 0;return fv1({wrapAsNullable:c,nameOverride:e,generatedName:t,title:r,values:S,_default:x,description:f,availability:d,groupName:o,source:g})}function fv1({wrapAsNullable:e,nameOverride:t,generatedName:r,title:n,values:i,_default:a,description:u,availability:f,groupName:d,source:c}){return e?Lp.nullable({nameOverride:t,generatedName:r,title:n,value:Lp.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,default:a,availability:f,example:void 0,groupName:d,source:c}),description:u,availability:f,groupName:d}):Lp.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,availability:f,default:a,example:void 0,groupName:d,source:c})}var dv1={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function B_i(e){let t=nba(e),r=dv1[e];return t!=null?qV(FE(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":qV(FE(e)))}function pv1(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function cpf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,description:o,availability:l,wrapAsNullable:g,example:O,groupName:j}){return n==="int64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):L9({nameOverride:e,generatedName:t,title:r,primitive:by.int({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j})}function lpf(e){return typeof e=="string"?E7.string(e):typeof e=="boolean"?E7.boolean(e):E7.string(`${e}`)}function fpf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,value:i,description:a,availability:u,groupName:f}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.literal({nameOverride:e,generatedName:t,title:r,value:lpf(i),description:a,availability:u,groupName:f}),description:a,availability:u,groupName:f}):Lp.literal({nameOverride:e,generatedName:t,title:r,value:lpf(i),description:a,availability:u,groupName:f})}function pfu({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,description:o,availability:l,wrapAsNullable:g,example:O,groupName:j}){return n==null||n==="double"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.double({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="float"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="int32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="int64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="time-delta"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j})}var _v1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},hv1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},yv1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},vv1={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},bv1={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},gv1={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},mv1={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},Ov1={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function iba(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[_v1,hv1,yv1,vv1,bv1,gv1,mv1,Ov1],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:f}=a.applyStrategy(t);t=u,r=[...r,...f]}}while(t.join("")!==i.join(""));return r}function yR(e){let t=e.join("_"),r=qV(FE(t));return/^\d/.test(r)?nba(r)??r:r}function _fu(e){let t=e.join("_");return FE(t)}function oq(e){switch(e.type){case"object":return ib.object({allOf:e.allOf,properties:e.properties.map(t=>jv1(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source});case"array":return ib.array({description:e.description,availability:e.availability,value:oq(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"enum":return ib.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,groupName:e.groupName,source:e.source});case"literal":return ib.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"nullable":return ib.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:oq(e.value),groupName:e.groupName});case"optional":return ib.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:oq(e.value),groupName:e.groupName});case"primitive":return ib.primitive({description:e.description,availability:e.availability,schema:dpf(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return ib.map({description:e.description,availability:e.availability,key:ib.primitive({description:e.key.description,availability:e.key.availability,schema:dpf(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,groupName:e.groupName}),value:oq(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,encoding:e.encoding});case"reference":return ib.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return ib.oneOf(Pv1(e.value));case"unknown":return ib.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Ol(e)}}function Pv1(e){switch(e.type){case"discriminated":return GSr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:oq(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,oq(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source});case"undisciminated":return GSr.undisciminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>oq(t)),groupName:e.groupName,encoding:e.encoding,source:e.source});default:Ol(e)}}function dpf(e){switch(e.type){case"string":return Xw.string(e);case"base64":return Xw.base64();case"boolean":return Xw.boolean(e);case"date":return Xw.date();case"datetime":return Xw.datetime();case"double":return Xw.double(e);case"float":return Xw.float();case"int":return Xw.int(e);case"int64":return Xw.int64(e);case"uint":return Xw.uint();case"uint64":return Xw.uint64();default:Ol(e)}}function jv1(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:oq(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability}}function aba(e,t){return FRt(oq(e),oq(t))}function FRt(e,t){return e.type==="primitive"&&t.type==="primitive"?ppf(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?wv1(e.values,t.values):e.type==="array"&&t.type==="array"?FRt(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?FRt(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?Dv1(e.value,t.value):e.type==="object"&&t.type==="object"?Sv1(e,t):e.type==="map"&&t.type==="map"?ppf(e.key.schema,t.key.schema)&&FRt(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function ppf(e,t){return e.type===t.type}function wv1(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return iDr(r,n)}function Dv1(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:FRt(n,i)}):e.type==="undisciminated"&&t.type==="undisciminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:FRt(r,i)}):!1}function Sv1(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:FRt(a,i.schema)})}function _pf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:u,wrapAsNullable:f,allOf:d,context:c,propertiesToExclude:o,groupName:l,fullExamples:g,additionalProperties:O,availability:j,encoding:S,source:x,namespace:A}){let z=[...u??[]],N={...i},C=[],U=[];for(let $ of d)if(gy($)){let ee=c.resolveSchemaReference($);if(ee.discriminator!=null&&ee.discriminator.mapping!=null)continue;if(ee.oneOf!=null){for(let $e of ee.oneOf){let Dt=gy($e)?c.resolveSchemaReference($e):$e,Tt=L1(Dt,!1,c.DUMMY,n,x,A);Tt.type==="object"&&C.push(...Tt.properties.map(Wt=>Wt.schema.type!=="optional"&&Wt.schema.type!=="nullable"?{...Wt,schema:Lp.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Wt.schema,description:void 0,availability:Wt.availability,groupName:void 0})}:Wt))}continue}let Ve=A5r($);if(Ve==null)continue;U.push({schemaId:Ve,convertedSchema:hfu($,[Ve],x),properties:hpf({schema:$,context:c,breadcrumbs:n,source:x,namespace:A})}),c.markSchemaAsReferencedByNonRequest(Ve)}else{let ee=L1($,!1,c,n,x,A);ee.type==="object"&&C.push(...ee.properties)}let Y={};for(let $ of U)for(let[ee,Ve]of Object.entries($.properties)){let $e=Y[ee];$e!=null?($e.schemaIds.push($.schemaId),$e.schemas.some(Tt=>aba(Tt,Ve))||$e.schemas.push(Ve)):Y[ee]={schemaIds:[$.schemaId],schemas:[Ve]}}let te=[];for(let[$,ee]of Object.entries(Y))ee.schemaIds.length>1&&te.push({propertyKey:$,allOfSchemaIds:ee.schemaIds,conflictingTypeSignatures:ee.schemas.length>1});let G=Object.entries(N).map(([$,ee])=>{let Ve=z.includes($),$e=Lh(ee,kh.AUDIENCES)??[],Dt=E2e(ee),Tt=Lh(ee,kh.FERN_PROPERTY_NAME),Wt=[...n,$],Nt=_fu(Wt),ur=Ve?L1(ee,!1,c,Wt,x,A):Lp.optional({nameOverride:e,generatedName:Nt,title:r,description:void 0,availability:Dt,value:L1(ee,!1,c,Wt,x,A),groupName:l}),Ar={};for(let Gr of U){let zt=Gr.properties[$];zt!=null&&!aba(ur,zt)?Ar[Gr.schemaId]={differentSchema:!0}:zt!=null&&(Ar[Gr.schemaId]={differentSchema:!1})}return{key:$,schema:ur,nameOverride:Tt,audiences:$e,conflict:Ar,generatedName:_fu([...n,$]),availability:Dt}});return G.push(...C.map($=>{let ee=$.conflict;for(let Ve of U){let $e=Ve.properties[$.key];$e!=null&&!aba($.schema,$e)?ee[Ve.schemaId]={differentSchema:!0}:$e!=null&&(ee[Ve.schemaId]={differentSchema:!1})}return{...$,conflict:ee}})),Ev1({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,properties:G.filter($=>!o.has($.key)),description:a,allOf:U.map($=>$.convertedSchema),allOfPropertyConflicts:te,groupName:l,fullExamples:g,additionalProperties:O,availability:j,source:x})}function Ev1({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:o,availability:l,source:g}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:H7n(o),availability:void 0,source:g}),description:a,availability:l,groupName:d}):Lp.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:H7n(o),availability:l,source:g})}function hpf({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[u,f]=gy(e)?[t.resolveSchemaReference(e),iba(e.$ref)]:[e,r];for(let d of u.allOf??[])a={...a,...hpf({schema:d,context:t,breadcrumbs:f,source:n,namespace:i})};for(let[d,c]of Object.entries(u.properties??{})){let o=L1(c,!1,t,[...f,d],n,i);a[d]=o}return a}function K7n({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsNullable:u,context:f,subtypes:d,groupName:c,encoding:o,source:l,subtypePrefixOverrides:g,namespace:O}){let j=Mv1({schemas:d}),S=d.flatMap((z,N)=>{if(!gy(z)&&z.enum!=null)return z.enum.map(U=>Lp.literal({nameOverride:void 0,generatedName:yR([t,U]),title:void 0,value:E7.string(U),groupName:void 0,description:void 0,availability:U.availability}));let C=j[N];if(g!=null){let U=g[N];U!=null&&"name"in U&&(C=U.name)}return[L1(z,!1,f,[...n,C??`${N}`],l,O)]}),x=[];for(let z=0;z<S.length;++z){let N=S[z],C=!1;for(let U=z+1;U<S.length;++U){let Y=S[U];if(N!=null&&Y!=null&&FRt(N,Y)){C=!0;break}}N!=null&&!C&&x.push(N)}if(Object.entries(x).every(([z,N])=>N.type==="literal")){let z={},N=[];return Object.entries(x).forEach(([C,U])=>{U.type==="literal"&&U.value.type==="string"&&(N.push(U.value.value),U.description!=null&&(z[U.value.value]={description:U.description}))}),C5r({nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,fernEnum:z,enumVarNames:void 0,enumValues:N,_default:void 0,groupName:c,context:f,source:l})}return x.length===1&&x[0]!=null?x[0]:ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,subtypes:x,groupName:c,encoding:o,source:l})}function yfu({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsNullable:a,context:u,groupName:f,discriminator:d,encoding:c,source:o,namespace:l}){let g=Object.entries(d.mapping??{}).map(([S,x],A)=>{let z={$ref:x},N=$7n(z,!1,u,[x],c,o,l);return u.markSchemaWithDiscriminantValue(z,d.propertyName,S),N.type==="object"&&(N.properties={[d.propertyName]:Lp.literal({nameOverride:void 0,generatedName:yR([t,S]),title:void 0,value:E7.string(S),groupName:void 0,description:void 0,availability:void 0}),...N.properties.filter(C=>C.key!==d.propertyName)}),N}),O=[];for(let S=0;S<g.length;++S){let x=g[S],A=!1;for(let z=S+1;z<g.length;++z){let N=g[z];if(x!=null&&N!=null&&FRt(x,N)){A=!0;break}}x!=null&&!A&&O.push(x)}if(Object.entries(O).every(([S,x])=>x.type==="literal")){let S={},x=[];return Object.entries(O).forEach(([A,z])=>{z.type==="literal"&&z.value.type==="string"&&(x.push(z.value.value),z.description!=null&&(S[z.value.value]={description:z.description}))}),C5r({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,fernEnum:S,enumVarNames:void 0,enumValues:x,_default:void 0,groupName:f,context:u,source:o})}return O.length===1&&O[0]!=null?O[0]:ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,subtypes:O,groupName:f,encoding:c,source:o})}function Mv1({schemas:e}){let t={},r=0;for(let a of e){if(!gy(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),f={},d=u;for(let[c,o]of Object.entries(t)){let l=CXi(o,u);d=CXi(d,o),f[c]=l}f[r]=d,t=f}}r++}let n=[],i=0;for(let a of e){let u=t[i];if(u!=null&&u.length>0){let f=u.sort();if(f[0]!=null){n.push(f[0]),++i;continue}}gy(a)?n.push(J7n(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(J7n(i)??`${i}`),++i}return n}function ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,description:i,availability:a,subtypes:u,groupName:f,encoding:d,source:c}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.oneOf(jQ.undisciminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:f,encoding:d,source:c})),description:i,availability:a,groupName:f}):Lp.oneOf(jQ.undisciminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:f,encoding:d,source:c}))}function Y7n(e){if(e.default!=null&&typeof e.default=="string")return e.default}function oba({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;if(r&&typeof r=="number")return r;r&&t.warn(`Expected fallback to be a number, but got ${typeof r}`)}function vpf({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;if(r&&typeof r=="boolean")return r;r&&t.warn(`Expected fallback to be a boolean, but got ${typeof r}`)}function LRt({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;if(r&&typeof r=="string")return r;r&&t.warn(`Expected fallback to be a string, but got ${typeof r}`)}function bpf({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;if(r&&Array.isArray(r))return r;r&&t.warn(`Expected fallback to be a array, but got ${typeof r}`)}var Fen="#/components/schemas/";function L1(e,t,r,n,i,a,u=!1,f=new Set,d){let c=zv1({schema:e,logger:r.logger});if(gy(e)){let o=A5r(e);return o!=null?(u?r.markSchemaAsReferencedByRequest(o):r.markSchemaAsReferencedByNonRequest(o),$7n(e,t,r,n,c,i,a)):q5r(r.resolveSchemaReference(e),t,r,iba(e.$ref),c,i,a,f,u,d)}return q5r(e,t,r,n,c,i,a,f,u,d)}function $7n(e,t,r,n,i,a,u){let f=e.$ref.includes("properties")?q5r(r.resolveSchemaReference(e),t,r,n,i,a,u,new Set):Lp.reference(hfu(e,n,a));return t?Lp.nullable({title:void 0,nameOverride:void 0,generatedName:yR(n),value:f,description:void 0,availability:void 0,groupName:void 0}):f}function xv1(e){if(e!=null&&!e.includes(" ")&&!!/^[a-zA-Z]+$/.test(e))return e}function q5r(e,t,r,n,i,a,u,f=new Set,d=!1,c){var C;let o=Lh(e,kh.TYPE_NAME)??(r.options.useTitlesAsName?xv1(e.title):void 0),l=Lh(e,kh.SDK_GROUP_NAME)??((C=Lh(e,Yje.TAGS))==null?void 0:C[0]),g=(typeof l=="string"?[l]:l)??[];g=r.resolveGroupName(g);let O=yR(n),j=e.title,S=e.description,x=E2e(e),A=Lh(e,Yje.EXAMPLES),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0}),A!=null&&Object.keys(A).length>0&&z.push(...Object.entries(A).map(([U,Y])=>({name:Y.summary??U,value:Y.value,description:Y.description})));let N=ipf({schema:e,description:S,title:j,nameOverride:o,generatedName:O,availability:x});if(N!=null)return N;if(!t&&e.nullable===!0)return q5r(e,!0,r,n,i,a,u,f,d,c);if(e.enum!=null&&(e.type==="string"||e.type==null)){if(!I_i(e.enum))return L9({nameOverride:o,generatedName:O,title:j,primitive:by.string({default:Y7n(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g,wrapAsNullable:t,description:S,availability:x});let U=npf(e);return e.enum.length===1&&e.enum[0]!=null&&U==null?fpf({nameOverride:o,generatedName:O,title:j,wrapAsNullable:t,value:e.enum[0],description:S,availability:x,groupName:g}):C5r({nameOverride:o,generatedName:O,title:j,fernEnum:U,enumVarNames:Lh(e,[Yje.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:S,availability:x,wrapAsNullable:t,groupName:g,context:r,source:a})}if(I_i(e.type)&&e.type[1]!=null&&e.type[0]!=null){let U=e.type[0],Y=e.type[1];if(U==="null")return Lp.nullable({nameOverride:o,generatedName:O,title:j,value:q5r({...e,type:Y},t,r,n,i,a,u,f,d,c),groupName:g,description:e.description,availability:x});if(Y==="null")return Lp.nullable({nameOverride:o,generatedName:O,title:j,value:q5r({...e,type:U},t,r,n,i,a,u,f,d,c),groupName:g,description:e.description,availability:x})}if(I_i(e.type)&&e.type.length>1){let U=e.type.includes("null"),Y=e.type.filter(te=>te!=="null").map(te=>({type:te,nullable:U}));return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t,context:r,subtypes:Y,groupName:g,encoding:i,source:a,namespace:u})}if(e==="boolean"||e.type==="boolean"){let U=Lh(e,kh.BOOLEAN_LITERAL);return U!=null?mpf({nameOverride:o,generatedName:O,title:j,literal:E7.boolean(U),wrapAsNullable:t,description:S,availability:x,groupName:g}):L9({nameOverride:o,generatedName:O,title:j,primitive:by.boolean({default:e.default,example:vpf({schema:e,logger:r.logger,fallback:c})}),wrapAsNullable:t,description:S,availability:x,groupName:g})}if(e==="number"||e.type==="number")return pfu({nameOverride:o,generatedName:O,title:j,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="integer"||e.type==="integer")return cpf({nameOverride:o,generatedName:O,title:j,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="float")return pfu({nameOverride:o,generatedName:O,title:j,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="string"||e.type==="string"){if(e.format==="date-time")return L9({nameOverride:o,generatedName:O,title:j,primitive:by.datetime({example:LRt({schema:e,logger:r.logger,fallback:c})}),wrapAsNullable:t,description:S,availability:x,groupName:g});if(e.format==="json-string")return Lp.unknown({nameOverride:o,generatedName:O,title:j,description:S,availability:x,groupName:g,example:void 0});let U=jpf(e,"const");return U!=null?mpf({nameOverride:o,generatedName:O,title:j,literal:E7.string(U),wrapAsNullable:t,description:S,availability:x,groupName:g}):L9({nameOverride:o,generatedName:O,title:j,primitive:by.string({default:Y7n(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g,wrapAsNullable:t,description:S,availability:x})}if(e.type==="array")return opf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,item:e.items,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,example:bpf({schema:e,logger:r.logger,fallback:c}),source:a,namespace:u});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&gpf(e))return apf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,additionalProperties:e.additionalProperties,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,encoding:i,example:e.example,source:a,namespace:u});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?yfu({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,discriminator:e.discriminator,encoding:i,source:a,namespace:u}):ffu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:g,encoding:i,source:a,namespace:u});if(Array.isArray(e.type)&&(e.oneOf==null?e.oneOf=e.type:e.oneOf.push(...e.type)),e.oneOf!=null&&e.oneOf.length>0){let U=Lh(e,kh.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||U?yfu({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,discriminator:e.discriminator,encoding:i,source:a,namespace:u}):ffu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:g,encoding:i,source:a,namespace:u});if(e.oneOf.length===1&&e.oneOf[0]!=null){let Y=L1(e.oneOf[0],t,r,n,a,u,d);return X7n(Y,S,g)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let $=e.oneOf[0],ee=e.oneOf[1];if(!gy($)&&$.type==="null")return L1(ee,!0,r,n,a,u);if(!gy(ee)&&ee.type==="null")return L1($,!0,r,n,a,u)}let Y=Cv1({schemas:e.oneOf});if(Y!=null)return C5r({nameOverride:o,generatedName:O,title:j,fernEnum:void 0,enumVarNames:void 0,enumValues:Y,_default:e.default,description:S,availability:x,wrapAsNullable:t,groupName:g,context:r,source:a});let te=Opf({schemas:e.oneOf,context:r});if(te!=null&&!r.options.discriminatedUnionV2&&!U)return dfu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},required:e.required,description:S,availability:x,wrapAsNullable:t,discriminant:te.discriminant,variants:te.schemas,context:r,groupName:g,encoding:i,source:a,namespace:u});let G=e.oneOf.filter($=>!gy($)&&$.type==="null").length>0;return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t||G,context:r,subtypes:e.oneOf.filter($=>gy($)||$.type!=="null"),encoding:i,groupName:g,source:a,namespace:u})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let te=L1(e.anyOf[0],t,r,n,a,u,d);return X7n(te,S,g)}if(e.anyOf.length===2){let[te,G]=e.anyOf;if(te!=null&&G!=null){if(!gy(te)&&te.type==="null"){let $=L1(G,!0,r,n,a,u);return X7n($,S,g)}else if(!gy(G)&&G.type==="null"){let $=L1(te,!0,r,n,a,u);return X7n($,S,g)}}}let U=Opf({schemas:e.anyOf,context:r});if(U!=null&&!r.options.discriminatedUnionV2)return dfu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},required:e.required,description:S,availability:x,wrapAsNullable:t,discriminant:U.discriminant,variants:U.schemas,context:r,groupName:g,encoding:i,source:a,namespace:u});let Y=e.anyOf.filter(te=>!gy(te)&&te.type==="null").length>0;return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t||Y,context:r,subtypes:e.anyOf.filter(te=>gy(te)||te.type!=="null"),encoding:i,groupName:g,source:a,namespace:u})}if(e.allOf!=null||e.properties!=null){let U=[];for(let te of e.allOf??[])(gy(te)||Object.keys(te).length>0)&&U.push(te);if((e.properties==null||e.properties.length===0)&&U.length===1&&U[0]!=null){let te=L1(U[0],t,r,n,a,u,d);return X7n(te,S,g)}let Y=U.filter(te=>{let G=uba(te);return G||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(te)}`),G});if((e.properties==null||e.properties.length===0)&&Y.length===1&&Y[0]!=null){let te=L1(Y[0],t,r,n,a,u,d);return X7n(te,S,g)}return _pf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},description:S,required:e.required,wrapAsNullable:t,allOf:Y,context:r,propertiesToExclude:f,groupName:g,fullExamples:z,additionalProperties:e.additionalProperties,availability:x,encoding:i,source:a,namespace:u})}if(e.type==="object"&&Tv1(e)&&qv1(e)&&gpf(e))return rba({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${O}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:Y7n(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g},valueSchema:Lp.unknown({nameOverride:void 0,generatedName:`${O}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:g}),groupName:g,encoding:i,example:e.example});if(e.type==null){let U=e.example??e.default;return Lp.unknown({nameOverride:o,generatedName:O,title:j,description:S,availability:x,groupName:g,example:U})}throw new Error(`Failed to convert schema breadcrumbs=${JSON.stringify(n)} value=${JSON.stringify(e)}`)}function A5r(e){if(!!e.$ref.startsWith(Fen))return e.$ref.replace(Fen,"")}function hfu(e,t,r){let n=Lh(e,kh.TYPE_NAME),i=yR(t),a=e.description,u=E2e(e),f=A5r(e);if(f==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return ib.reference({generatedName:i,nameOverride:n,title:void 0,schema:f,description:a??void 0,availability:u,groupName:void 0,source:r})}function Tv1(e){return e.oneOf==null||e.oneOf.length===0}function qv1(e){return e.allOf==null||e.allOf.length===0}function gpf(e){return e.properties==null||Object.keys(e.properties).length===0}function I_i(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function X7n(e,t,r){return e.type==="reference"?Lp.reference({...e,description:t,availability:e.availability,groupName:r}):e.type==="optional"?Lp.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r}):e.type==="nullable"?Lp.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r}):e}function uba(e){return gy(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>uba(t)):e.oneOf!=null?e.oneOf.every(t=>uba(t)):e.anyOf!=null?e.anyOf.every(t=>uba(t)):!1}function mpf({literal:e,wrapAsNullable:t,groupName:r,description:n,availability:i,nameOverride:a,generatedName:u,title:f}){return t?Lp.nullable({nameOverride:a,generatedName:u,title:f,value:Lp.literal({nameOverride:a,generatedName:u,title:f,value:e,description:n,availability:i,groupName:r}),groupName:r,description:n,availability:i}):Lp.literal({nameOverride:a,generatedName:u,title:f,value:e,groupName:r,description:n,availability:i})}function L9({primitive:e,wrapAsNullable:t,groupName:r,description:n,availability:i,generatedName:a,nameOverride:u,title:f}){return r=typeof r=="string"?[r]:r,t?Lp.nullable({nameOverride:u,generatedName:a,title:f,value:Lp.primitive({nameOverride:u,generatedName:a,title:f,schema:e,description:n,availability:i,groupName:r}),groupName:r,description:n,availability:i}):Lp.primitive({nameOverride:u,generatedName:a,title:f,schema:e,description:n,availability:i,groupName:r})}function Cv1({schemas:e}){let t=new Set;for(let r of e){if(gy(r))return;if(r.enum!=null&&I_i(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function Opf({schemas:e,context:t}){let r={};for(let n of e){let i=Ppf({schema:n,context:t});for(let[a,u]of Object.entries(i)){let f=r[a];f!=null?f[u]=n:r[a]={[u]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function Ppf({schema:e,context:t}){let r=gy(e)?t.resolveSchemaReference(e):e;return Av1({schema:r,context:t})}function Av1({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=Ppf({schema:n,context:t});for(let[a,u]of Object.entries(i??{}))r[a]=u}return r}for(let[n,i]of Object.entries(e.properties??{})){let a=gy(i)?t.resolveSchemaReference(i):i;a.type==="string"&&a.enum!=null&&I_i(a.enum)&&Nv1(a.enum).length===1&&a.enum[0]!=null&&(r[n]=a.enum[0]);let u=jpf(a,"const");a.type==="string"&&u!=null&&(r[n]=u),n==="type"&&a.example!=null&&(r[n]=a.example)}return r}function Nv1(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function jpf(e,t){let r=e[t];if(r!=null)return r}function zv1({schema:e,logger:t}){let r=rpf({schema:e,logger:t});if(r!=null)return spf(r)}function sba(e,t){let r={},n={};return e==null?r=t:n={[e]:t},{rootSchemas:r,namespacedSchemas:n}}var wpf="#/components/messages/",vfu=class{logger;document;taskContext;DUMMY;options;namespace;constructor({document:t,taskContext:r,options:n,namespace:i}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=n,this.namespace=i}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let n=[];if(this.namespace!=null){let i={type:"namespace",name:this.namespace};n.push(i)}return n.concat(t??[])}resolveSchemaReference(t){var a;if(this.document.components==null||this.document.components.schemas==null||!t.$ref.startsWith(Fen))throw new Error(`Failed to resolve ${t.$ref}`);let n=t.$ref.substring(Fen.length).split("/");if(n[0]==null)throw new Error(`${t.$ref} is undefined`);let i=this.document.components.schemas[n[0]];if(i==null)throw new Error(`${n[0]} is undefined`);if(gy(i)&&(i=this.resolveSchemaReference(i)),n[1]==="properties"&&n[2]!=null){let u=(a=i.properties)==null?void 0:a[n[2]];if(u==null)throw new Error(`${t.$ref} is undefiened. Property does not exist on object.`);gy(u)?i=this.resolveSchemaReference(u):i=u}return i}resolveMessageReference(t){if(this.document.components==null||this.document.components.messages==null||!t.$ref.startsWith(wpf))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(wpf.length),n=this.document.components.messages[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}},cba=class extends vfu{constructor({document:t,taskContext:r,options:n,namespace:i}){super({document:t,taskContext:r,options:n,namespace:i})}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,n){}markSchemaWithDiscriminantValue(t,r,n){}};function N5r(e){if(typeof e=="string")return RP.primitive(t0.string(e));if(typeof e=="number")return Number.isInteger(e)?RP.primitive(t0.int(e)):RP.primitive(t0.double(e));if(typeof e=="boolean")return RP.primitive(t0.boolean(e));if(Array.isArray(e)){let t=e.map(r=>N5r(r));return t.length===0?void 0:RP.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,n]of Object.entries(e)){let i=N5r(n);i!=null&&t.push({key:t0.string(r),value:i})}return RP.map(t)}}function R_i(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function Dpf(e){if(e!=null&&Array.isArray(e))return e}var Q7n=class{schemas;constructor(t){this.schemas=t}buildExample({schema:t,exampleId:r,example:n,options:i}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:n,options:{...i,maxCheckerDepth:i.maxCheckerDepth??5},depth:0})}buildExampleHelper({exampleId:t,example:r,schema:n,depth:i,visitedSchemaIds:a,options:u}){var f,d,c,o;switch(n.type){case"enum":return typeof r=="string"&&Spf({schema:n,value:r})?RP.enum(r):n.values[0]!=null?RP.enum((f=n.values[0])==null?void 0:f.value):void 0;case"literal":return RP.literal(n.value);case"nullable":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u)))return;let l=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u});return l!=null&&l.type==="array"&&l.value.length===0||l!=null&&l.type==="map"&&l.value.length===0||l!=null&&l.type==="object"&&Object.keys(l.properties).length===0?void 0:l}case"optional":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u)))return;let l=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u});return l!=null&&l.type==="array"&&l.value.length===0||l!=null&&l.type==="map"&&l.value.length===0||l!=null&&l.type==="object"&&Object.keys(l.properties).length===0?void 0:l}case"primitive":{let l=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:u});return RP.primitive(l)}case"reference":{let l=this.schemas[n.schema];if(l!=null&&!a.has(n.schema)){a.add(n.schema);let g=this.buildExampleHelper({example:r,schema:l,exampleId:t,visitedSchemaIds:a,depth:i,options:u});return a.delete(n.schema),g}return}case"oneOf":switch(n.value.type){case"discriminated":{let l={},g={},O={},j=R_i(r),S=j==null?void 0:j[n.value.discriminantProperty],x=n.value.schemas[S],A=[],z=this.getDiscriminatedUnionVariantSchema(n.value,j);z!=null&&A.push(z),A.push(...Object.entries(n.value.schemas));for(let N of A)if(S!=null&&x!=null&&x.type==="object"){g=this.getAllProperties(x),O=this.getAllRequiredProperties(x),l[n.value.discriminantProperty]=RP.primitive(t0.string(S));break}else{let C=this.getObjectSchema(N[1]);if(C==null)continue;g=this.getAllProperties(C),O=this.getAllRequiredProperties(C),l[n.value.discriminantProperty]=RP.primitive(t0.string(N[0]))}for(let N of n.value.commonProperties){g[N.key]=N.schema;let C=this.getResolvedSchema(N.schema);C.type!=="optional"&&C.type!=="nullable"&&(O[N.key]=N.schema)}for(let[N,C]of Object.entries(g)){let U=N in O;if(U&&(j==null?void 0:j[N])!=null){let Y=this.buildExampleHelper({schema:C,exampleId:t,example:j[N],visitedSchemaIds:a,depth:i+1,options:u});if(Y!=null)l[N]=Y;else return}else{let Y=this.buildExampleHelper({exampleId:t,schema:C,example:j==null?void 0:j[N],visitedSchemaIds:a,depth:i+1,options:u});if(Y!=null)l[N]=Y;else if(U)return}}return RP.oneOf(v5r.discriminated(l))}case"undisciminated":{let l=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(l!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:l,visitedSchemaIds:a,depth:i,options:u});break}}return;case"unknown":if(r!=null){let l=N5r(r);if(l!=null)return RP.unknown(l)}return u.ignoreOptionals||this.exceedsMaxDepth(i,u)?void 0:u.isParameter?RP.primitive(t0.string(u.name??"string")):RP.map([{key:t0.string("key"),value:RP.primitive(t0.string("value"))}]);case"array":{let l=Dpf(r),g=[];if(l!=null&&l.length>0)for(let O of l){let j=this.buildExampleHelper({exampleId:t,example:O,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});j!=null&&g.push(j)}else if(n.example!=null&&n.example.length>0)for(let O of n.example){let j=this.buildExampleHelper({exampleId:t,example:O,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});j!=null&&g.push(j)}else{let O=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});O!=null&&g.push(O)}return RP.array(g)}case"map":{let l=R_i(r??n.example);if(l!=null&&Object.entries(l).length>0){let j=[];for(let[S,x]of Object.entries(l)){let A=this.buildExampleFromPrimitive({schema:n.key.schema,example:S,options:u}),z=this.buildExampleHelper({exampleId:t,example:x,schema:n.value,visitedSchemaIds:a,depth:i+1,options:u});z!=null&&j.push({key:A,value:z})}return RP.map(j)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return RP.map([{key:t0.string("key"),value:RP.unknown(RP.primitive(t0.string("value")))}]);let g=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...u,name:"key"}}),O=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:a,depth:i+1,options:{...u,name:"value"}});return O!=null?RP.map([{key:g,value:O}]):RP.map([])}case"object":{let l={},g=((d=n.fullExamples)==null?void 0:d.find(x=>x.name===t))??((c=n.fullExamples)==null?void 0:c.find(x=>x.name==null))??((o=n.fullExamples)==null?void 0:o[0]),O=R_i(r)??(g!=null?R_i(g.value):{})??{},j=this.getAllProperties(n),S=this.getAllRequiredProperties(n);for(let[x,A]of Object.entries(j)){let z=x in S,N=Object.keys(O).includes(x),C=this.buildExampleHelper({schema:A,exampleId:t,example:O[x],visitedSchemaIds:a,depth:i+1,options:{...u,name:x}});if(z&&C!=null)l[x]=C;else{if(z)return;(N&&C!=null||!u.ignoreOptionals&&C!=null)&&(l[x]=C)}}return RP.object({properties:l})}default:Ol(n)}}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let n=r==null?void 0:r[t.discriminantProperty];if(n==null||typeof n!="string")return Object.entries(t.schemas)[0];let i=t.schemas[n];return i==null?Object.entries(t.schemas)[0]:[n,i]}getUnDiscriminatedUnionVariantSchema(t,r){var a;return r==null?t.schemas[0]:(a=t.schemas.map(u=>({schema:u,heuristic:this.calcExampleHeuristic(u,r)})).sort((u,f)=>f.heuristic-u.heuristic)[0])==null?void 0:a.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return Spf({schema:t,value:r})?5:0;case"object":{if(!RO(r))return 0;let n=this.getAllProperties(t),i=0;for(let[a,u]of Object.entries(n))r[a]!=null?(i++,i+=this.calcExampleHeuristic(u,r[a])):i--;return i}case"array":{if(!Array.isArray(r))return 0;let n=0;for(let i of r)n+=this.calcExampleHeuristic(t.value,i);return n}case"map":{if(!RO(r))return 0;let n=0;for(let[,i]of Object.entries(r))n+=this.calcExampleHeuristic(t.value,i);return n}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let n=this.getResolvedSchema(t);return n==null?0:this.calcExampleHeuristic(n,r)}case"oneOf":return Object.values(t.value.schemas).map(i=>this.calcExampleHeuristic(i,r)).sort((i,a)=>a-i)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,n=new Set,i){if(this.exceedsMaxCheckerDepth(r,i))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,n,i);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,n,i);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let u of t.properties)if(this.hasExample(u.schema,r+1,n,i))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!n.has(t.schema)){n.add(t.schema);let u=this.hasExample(a,r,n,i);return n.delete(t.schema),u}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,n,i));default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let n of t.properties)r[n.key]=n.schema;for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let n of t.properties){let i=this.getResolvedSchema(n.schema);i.type!=="optional"&&i.type!=="nullable"&&(r[n.key]=n.schema)}for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);a.type==="object"&&(r={...this.getAllRequiredProperties(a),...r})}return r}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?t0.string(t):r.example!=null?t0.string(r.example):t0.string(n.name??DC.STRING);case"base64":return t!=null&&typeof t=="string"?t0.base64(t):r.example!=null?t0.base64(r.example):t0.base64(DC.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?t0.boolean(t):r.example!=null?t0.boolean(r.example):t0.boolean(DC.BOOLEAN);case"date":return t!=null&&typeof t=="string"?t0.date(t):r.example!=null?t0.date(r.example):t0.date(DC.DATE);case"datetime":return t!=null&&typeof t=="string"?t0.datetime(t):r.example!=null?t0.datetime(r.example):t0.datetime(DC.DATE_TIME);case"double":return t!=null&&typeof t=="number"?t0.double(t):r.example!=null?t0.double(r.example):t0.double(DC.DOUBLE);case"float":return t!=null&&typeof t=="number"?t0.float(t):r.example!=null?t0.float(r.example):t0.float(DC.FLOAT);case"int":return t!=null&&typeof t=="number"?t0.int(t):r.example!=null?t0.int(r.example):t0.int(DC.INT);case"int64":return t!=null&&typeof t=="number"?t0.int64(t):r.example!=null?t0.int64(r.example):t0.int64(DC.INT64);case"uint":return t!=null&&typeof t=="number"?t0.uint(t):r.example!=null?t0.uint(r.example):t0.uint(DC.UINT);case"uint64":return t!=null&&typeof t=="number"?t0.uint64(t):r.example!=null?t0.uint64(r.example):t0.uint64(DC.UINT64);default:Ol(r)}}};function Spf({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function URt(e){switch(e.type){case"object":return Lp.object({allOf:e.allOf,properties:e.properties.map(t=>Iv1(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source});case"array":return Lp.array({description:e.description,availability:e.availability,value:URt(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0});case"enum":return Lp.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,groupName:e.groupName,example:void 0,source:e.source});case"literal":return Lp.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName});case"nullable":return Lp.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:URt(e.value),groupName:e.groupName});case"optional":return Lp.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:URt(e.value),groupName:e.groupName});case"primitive":return Lp.primitive({description:e.description,availability:e.availability,schema:Epf(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return Lp.map({description:e.description,availability:e.availability,key:Lp.primitive({description:e.key.description,availability:e.key.availability,schema:Epf(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,groupName:e.groupName}),value:URt(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,encoding:e.encoding,example:void 0});case"reference":return Lp.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return Lp.oneOf(Bv1(e.value));case"unknown":return Lp.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,groupName:void 0,description:void 0,availability:void 0});default:Ol(e)}}function Bv1(e){switch(e.type){case"discriminated":return jQ.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:URt(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,URt(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source});case"undisciminated":return jQ.undisciminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>URt(t)),groupName:e.groupName,encoding:e.encoding,source:e.source});default:Ol(e)}}function Epf(e){switch(e.type){case"string":return by.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return by.base64({example:void 0});case"boolean":return by.boolean({default:e.default,example:void 0});case"date":return by.date({example:void 0});case"datetime":return by.datetime({example:void 0});case"double":return by.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return by.float({example:void 0});case"int":return by.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return by.int64({default:e.default,example:void 0});case"uint":return by.uint({default:void 0,example:void 0});case"uint64":return by.uint64({default:void 0,example:void 0});default:Ol(e)}}function Iv1(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:URt(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability}}function lba(e){return e.type!=="optional"&&e.type!=="nullable"}function F_i(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var fba=class{exampleTypeFactory;logger;schemas;constructor(t,r){this.schemas=t,this.exampleTypeFactory=new Q7n(t),this.logger=r}buildEndpointExample(t){this.logger.debug(`Building endpoint example for ${t.method.toUpperCase()} ${t.path}`);let r=Fv1(t.request),n=Lv1(t.response);if((r==null?void 0:r.type)==="unsupported"||(n==null?void 0:n.type)==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let l=this.isSchemaRequired(r.schema);if(r.examples.length===0){let g=this.exampleTypeFactory.buildExample({schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});g!=null&&i.push([void 0,g])}else for(let{name:g,value:O}of r.examples){let j=this.exampleTypeFactory.buildExample({schema:r.schema,exampleId:g,example:O,options:{isParameter:!1,ignoreOptionals:!0}});j!=null&&i.push([g,j])}if(l&&i.length===0)return this.logger.warn(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let a=[];if(n!=null&&n.type==="present"){let l=this.isSchemaRequired(n.schema);if(n.examples.length===0){let g=this.exampleTypeFactory.buildExample({schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:3,isParameter:!1,ignoreOptionals:!1}});g!=null&&a.push([void 0,g])}else for(let{name:g,value:O}of n.examples){let j=this.exampleTypeFactory.buildExample({schema:n.schema,exampleId:g,example:O,options:{maxDepth:3,isParameter:!1,ignoreOptionals:!1}});j!=null&&a.push([g,j])}if(l&&a.length===0)return this.logger.warn(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let u=[];for(let l of t.pathParameters){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for path parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&u.push({name:l.name,parameterNameOverride:l.parameterNameOverride,value:O})}let f=[];for(let l of t.queryParameters){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for query parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&f.push({name:l.name,value:O})}let d=[];for(let l of t.headers){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for header ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&d.push({name:l.name,value:O})}let c=[];t.request!=null&&t.response!=null?c=Rv1(i,a):t.request!=null?c=i.map(([l,g])=>({id:l,request:g,response:void 0})):t.response!=null&&(c=a.map(([l,g])=>({id:l,request:void 0,response:g})));let o=t.examples.filter(l=>F_i(l)).flatMap(l=>{if(l.type==="unknown"){if(l.value!=null){let g=l.value["code-samples"];if(g!=null)return this.convertCodeSamples(g)}return}else return l.codeSamples}).filter(l=>RS(l));return c.length===0?[pAt.full({name:void 0,description:void 0,pathParameters:u,queryParameters:f,headers:d,request:void 0,response:void 0,codeSamples:o})]:c.map(({id:l,request:g,response:O})=>pAt.full({name:l,description:void 0,pathParameters:u,queryParameters:f,headers:d,request:g,response:O,codeSamples:o}))}convertCodeSamples(t){return t.map(r=>"language"in r?JSr.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):JSr.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?bW.Csharp:r.sdk,code:r.code})).filter(RS)}isSchemaRequired(t){return lba(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function Rv1(e,t){var i,a,u,f;let r=[];if(e.length<=1){let[d,c]=e[0]??[];if(t.length===0)return r.push({id:d,request:c,response:void 0}),r;for(let[o,l]of t)r.push({id:o??d,request:c,response:l});return r}if(t.length<=1){let[d,c]=t[0]??[];if(t.length===0)return r.push({id:d,request:void 0,response:c}),r;for(let[o,l]of e)r.push({id:o??d,request:l,response:c});return r}let n=new Set;for(let[d,c]of e){let o=((i=t.find(([g])=>g==null))==null?void 0:i[1])??((a=t[0])==null?void 0:a[1]);if(d==null){if(o==null)continue;r.push({id:void 0,request:c,response:o});continue}let l=!1;for(let g=0;g<t.length;g++){let[O,j]=t[g];O!=null||n.has(g)||d===O&&(r.push({id:d,request:c,response:j}),O!=null&&n.add(g),l=!0)}!l&&o!=null&&r.push({id:d,request:c,response:o})}for(let d=0;d<t.length;d++){if(n.has(d))continue;let[c,o]=t[d],l=((u=e.find(([g])=>g==null))==null?void 0:u[1])??((f=e[0])==null?void 0:f[1]);l!=null&&r.push({id:c,request:l,response:o})}return r}function Fv1(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:Uv1(e),examples:[]}:e.type==="json"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function Lv1(e){if(e!=null)return e.type!=="json"?{type:"unsupported"}:{type:"present",schema:e.schema,examples:e.fullExamples??[]}}function VRt(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return VRt(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undisciminated":return VRt(e.value.value);default:return!1}default:Ol(e)}}function Uv1(e){return Lp.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:URt(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0}).filter(RS),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,source:e.source})}var dba=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new Q7n(t),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,publish:n,subscribe:i,handshake:a,source:u,namespace:f}){var c,o;let d=[];for(let l of r){let g=[];for(let S of a.queryParameters){let x=this.isSchemaRequired(S.schema),A=this.exampleTypeFactory.buildExample({schema:S.schema,exampleId:void 0,example:(c=l.queryParameters)==null?void 0:c[S.name],options:{name:S.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!VRt(A)&&(A=void 0),!(x&&A==null)&&A!=null&&g.push({name:S.name,value:A})}let O=[];for(let S of a.headers){let x=this.isSchemaRequired(S.schema),A=this.exampleTypeFactory.buildExample({schema:S.schema,exampleId:void 0,example:(o=l.headers)==null?void 0:o[S.name],options:{name:S.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!VRt(A)&&(A=void 0),!(x&&A==null)&&A!=null&&O.push({name:S.name,value:A})}let j=[];for(let S of l.messages){let x=t.resolveMessageReference({$ref:`#/components/messages/${S.messageId}`}),A=gy(x.payload)?t.resolveSchemaReference(x.payload):x.payload,z=this.exampleTypeFactory.buildExample({schema:L1(A,!1,t,[S.messageId],u,f),exampleId:void 0,example:S.value,options:{isParameter:!1,ignoreOptionals:!0}});z!=null&&j.push({messageType:S.type,payload:z,description:void 0})}d.push({name:l.summary,queryParameters:g,headers:O,description:l.description,messages:j})}return d}buildWebsocketSessionExample({publish:t,subscribe:r,handshake:n}){let i={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},a=[];for(let f of n.queryParameters){let d=this.isSchemaRequired(f.schema),c=this.exampleTypeFactory.buildExample({schema:f.schema,exampleId:void 0,example:void 0,options:{name:f.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!VRt(c)&&(c=void 0),d&&c==null)return;c!=null&&a.push({name:f.name,value:c})}let u=[];for(let f of n.headers){let d=this.isSchemaRequired(f.schema),c=this.exampleTypeFactory.buildExample({schema:f.schema,exampleId:void 0,example:void 0,options:{name:f.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!VRt(c)&&(c=void 0),d&&c==null)return;c!=null&&u.push({name:f.name,value:c})}if(t!=null){let f=this.exampleTypeFactory.buildExample({schema:t,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});f!=null&&i.messages.push({messageType:"publish",payload:f,description:void 0})}if(r!=null){let f=this.exampleTypeFactory.buildExample({schema:r,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});f!=null&&i.messages.push({messageType:"subscribe",payload:f,description:void 0})}return i}isSchemaRequired(t){return lba(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}};var L_i={FERN_DISPLAY_NAME:"x-fern-display-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path"};function Mpf(e){return Lh(e,L_i.FERN_EXAMPLES)??[]}function Tpf({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:a}){var l,g,O,j,S,x;let u=[];a!=null&&u.push(a),((l=e.tags)==null?void 0:l[0])!=null?u.push(e.tags[0].name):i.naming!=="v2"&&u.push("websocket");let f=new cba({document:e,taskContext:t,options:r,namespace:a}),d={},c;for(let[A,z]of Object.entries(((g=e.components)==null?void 0:g.schemas)??{})){let N=L1(z,!1,f,[A],n,a);d[A]=N}let o=new dba(d,t.logger);for(let[A,z]of Object.entries(e.channels??{})){if(((O=z.bindings)==null?void 0:O.ws)==null){f.logger.error(`Channel ${A} does not have websocket bindings. Skipping.`);continue}let N=[];if(z.parameters!=null)for(let[G,$]of Object.entries(z.parameters??{}))N.push({name:G,description:$.description,parameterNameOverride:void 0,schema:$.schema!=null?L1($.schema,!1,f,u,n,a):Lp.primitive({schema:by.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:E2e($),source:n});let C=[];if(z.bindings.ws.headers!=null){let G=z.bindings.ws.headers.required??[];for(let[$,ee]of Object.entries(z.bindings.ws.headers.properties??{})){let Ve=gy(ee)?f.resolveSchemaReference(ee):ee;C.push({name:$,schema:L1(Ve,!G.includes($),f,u,n,a),description:Ve.description,parameterNameOverride:void 0,env:void 0,availability:E2e(Ve),source:n})}}let U=[];if(z.bindings.ws.query!=null){let G=z.bindings.ws.query.required??[];for(let[$,ee]of Object.entries(z.bindings.ws.query.properties??{})){let Ve=gy(ee)?f.resolveSchemaReference(ee):ee;U.push({name:$,schema:L1(Ve,!G.includes($),f,u,n,a),description:Ve.description,parameterNameOverride:void 0,availability:E2e(Ve),source:n})}}let Y;z.publish!=null&&(Y=xpf({generatedName:z.publish.operationId??"PublishEvent",event:z.publish,breadcrumbs:u,context:f,source:n,options:r,asyncApiOptions:i}));let te;if(z.subscribe!=null&&(te=xpf({generatedName:z.subscribe.operationId??"SubscribeEvent",event:z.subscribe,breadcrumbs:u,context:f,source:n,options:r,asyncApiOptions:i})),C.length>0||U.length>0||Y!=null||te!=null){let G=Mpf(z),$=[];if(G.length>0)$=o.buildWebsocketSessionExamplesForExtension({context:f,extensionExamples:G,handshake:{headers:C,queryParameters:U},publish:Y,subscribe:te,source:n,namespace:a});else{let Ve=o.buildWebsocketSessionExample({handshake:{headers:C,queryParameters:U},publish:Y,subscribe:te});Ve!=null&&$.push(Ve)}let ee=((S=(j=e.tags)==null?void 0:j[0])==null?void 0:S.name)!=null?[(x=e.tags)==null?void 0:x[0].name]:void 0;c={handshake:{headers:C.map(Ve=>({...Ve,schema:oq(Ve.schema),env:Ve.env})),queryParameters:U.map(Ve=>({...Ve,schema:oq(Ve.schema)})),pathParameters:N.map(Ve=>({...Ve,parameterNameOverride:void 0,schema:oq(Ve.schema)}))},groupName:f.resolveTags(ee,"Websocket"),publish:Y!=null?oq(Y):Y,subscribe:te!=null?oq(te):te,summary:Lh(z,L_i.FERN_DISPLAY_NAME),path:A,description:void 0,examples:$,source:n};break}}return{groupedSchemas:sba(a,d),channel:c,basePath:Lh(e,L_i.BASE_PATH)}}function xpf({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:a,asyncApiOptions:u}){if(t.message.oneOf!=null){let f=[],d=[];for(let c of t.message.oneOf){let o,l={type:"notFound"};if(gy(c)){let g=r.resolveMessageReference(c);!gy(g.payload)&&u.naming==="v2"?(l=g.name?{type:"name",name:g.name}:l,o={...g.payload,title:g.name??g.payload.title,description:g.name??g.payload.description}):o=g.payload}else o=c;d.push(l),f.push(o)}return K7n({description:t.description??t.message.description,availability:E2e(t.message),subtypes:f,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypePrefixOverrides:u.naming==="v2"?d:[]})}}var IEf=yu(Vbf(),1);var Rtn=yu(NEf(),1);var zEf=require("fs/promises");async function jPa({absoluteFilepathToOverrides:e,data:t,context:r}){let n=null;try{let u=(await(0,zEf.readFile)(e,"utf8")).toString();try{n=JSON.parse(u)}catch{n=av.load(u,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}let i=qXi(t,qXi,n,(u,f)=>Array.isArray(u)&&Array.isArray(f)?f.every(d=>typeof d=="object")&&u.every(d=>typeof d=="object")?void 0:[...f]:void 0);return Wbu(i,mWo)}var Wbu=(e,t)=>{function r(n){if(!Array.isArray(n)&&!Lsi(n))return n;if(Array.isArray(n))return n.map(a=>Wbu(a,t));let i={};for(let[a,u]of Object.entries(n))i[a]=Wbu(u,t);return jWo(i,t)}return r(e)};var wH1={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},DH1={id:"",typeExtension:{oas3:e=>{var t;return{...e,XFernStreaming:wH1,Operation:{...e.Operation,properties:{...(t=e.Operation)==null?void 0:t.properties,"x-fern-streaming":"XFernStreaming"}}}}}};async function REf({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,context:r}){let n=await BEf({absolutePathToOpenAPI:e}),i;if(t!=null?i=t:typeof n=="object"&&n[kh.OPENAPI_OVERIDES_FILEPATH]!=null&&(i=pf(Cg(e),zs.of(n[kh.OPENAPI_OVERIDES_FILEPATH]))),i!=null){let a=await jPa({absoluteFilepathToOverrides:i,context:r,data:n});return await BEf({absolutePathToOpenAPI:e,parsed:a})}return n}async function BEf({absolutePathToOpenAPI:e,parsed:t}){let r={config:new Rtn.Config({apis:{},styleguide:{plugins:[DH1],rules:{spec:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!0},n=t!=null?await(0,Rtn.bundle)({...r,doc:{source:new Rtn.Source(e,"<openapi>"),parsed:t}}):await(0,Rtn.bundle)({...r,ref:e});return await IEf.default.parse(n.bundle.parsed)}var Cqf=yu(L2f(),1);function U2f(e){return Lh(e,kh.ASYNC_CONFIG)}var V2f="$request.";function W2f(e){let t=Lh(e,kh.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json"}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format}:{type:"streamCondition",format:t.format??"json",streamConditionProperty:IX1(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function IX1(e){return e.startsWith(V2f)?e.slice(V2f.length):e}function H2f(e){let t=e;if(t.cursor!=null)return $Sr.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;return $Sr.offset({offset:r.offset,results:r.results,step:r.step,hasNextPage:r["has-next-page"]})}function $2f(e,t){let r=Lh(t,kh.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=Lh(e,kh.PAGINATION);if(typeof n=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return n==null?void 0:H2f(n)}return H2f(r)}}function J2f(e){let t=RX1(e),r={};return Hmu({obj:t,occurrences:r,breadcrumbs:[]}),r}function Hmu({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)Hmu({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)Hmu({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function RX1(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:(r==null?void 0:r.get)!=null?C0i(r.get):void 0,put:(r==null?void 0:r.put)!=null?C0i(r.put):void 0,post:(r==null?void 0:r.post)!=null?C0i(r.post):void 0,patch:(r==null?void 0:r.patch)!=null?C0i(r.patch):void 0,delete:(r==null?void 0:r.delete)!=null?C0i(r.delete):void 0}]))}}function C0i(e){return{...e,requestBody:e.requestBody!=null?gy(e.requestBody)?e.requestBody:FX1(e.requestBody):void 0}}function FX1(e){let t,r;for(let n in e.content){let i=sA.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[sA.MULTIPART_FORM_DATA]:r}}:e}var G2f="#/components/parameters/",K2f="#/components/responses/",Y2f="#/components/examples/",X2f="#/components/requestBodies/",V3n=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;namespace;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=J2f(t),this.options=i,this.source=a,this.DUMMY=this.getDummy(),this.namespace=u}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown",additionalProperties:!0};n=n[i]}return n==null?{"x-fern-type":"unknown",additionalProperties:!0}:(gy(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(G2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(G2f.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(X2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(X2f.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(K2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(K2f.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(Y2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(Y2f.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveExampleReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}};var W3n=class extends V3n{constructor({document:t,taskContext:r,options:n,source:i,namespace:a}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:a})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}};var LX1=ir.object({lang:ir.string(),label:ir.optional(ir.string()),source:ir.string()}),$mu=ir.array(LX1);var Q2f={README_EXT:"x-readme"};function UX1(e){if(!Array.isArray(e))return!1;for(let t of e)if(!RO(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function Z2f(e){let t=Lh(e,Q2f.README_EXT);if(!RO(t))return[];let r=t["code-samples"];if(!UX1(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}function k2f(e,t,r){let n=RRt(t,kh.EXAMPLES,h5.ExampleEndpointCallArraySchema,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],i=RRt(t,Yje.REDOCLY_CODE_SAMPLES_KEBAB,$mu,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...RRt(t,Yje.REDOCLY_CODE_SAMPLES_CAMEL,$mu,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...i];u.length>0&&n.push({"code-samples":u.map(d=>({name:d.label??d.lang,language:d.lang,code:d.source,install:void 0,docs:void 0}))});let f=Z2f(t);return f.length>0&&n.push({"code-samples":f}),n.map(pAt.unknown)}function eqf(e){let t=Lh(e,kh.AVAILABILITY);if(t==="ga"||t==="generally-available")return vW.GenerallyAvailable;if(t==="beta"||t==="pre-release")return vW.Beta;if(t==="deprecated")return vW.Deprecated;if(e.deprecated)return vW.Deprecated}function x1a(e){return{url:VX1({url:e.url,variables:e.variables??{}}),description:e.description,name:WX1(e),audiences:Lh(e,kh.AUDIENCES)}}function VX1({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,i);return e}function WX1(e){var r,n;let t=Lh(e,[kh.SERVER_NAME_V1,kh.SERVER_NAME_V2]);if(t!=null)return t;if(((r=e.description)==null?void 0:r.toLowerCase())==="production")return"Production";if(((n=e.description)==null?void 0:n.toLowerCase())==="sandbox")return"Sandbox"}function tqf(e){return Lh(e,kh.PARAMETER_NAME)}function rqf(e){return Lh(e,kh.SDK_VARIABLE)}function T1a({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:a}){var f;let u={pathParameters:[],queryParameters:[],headers:[]};for(let d of r){let c=gy(d)?n.resolveParameterReference(d):d,o=c.required??!1,l=E2e(c),g=[...i,c.name],O=yR(g);(f=LRt({schema:c,logger:n.logger}))!=null&&f.includes(" ")&&n.logger.warn("Parameter example contains a space, which is ambiguous. Consider using enums for multiple examples, or use an encoding if a space is part of the parameter.");let j=c.schema!=null?L1(c.schema,!o,n,g,a,n.namespace,!1,new Set,LRt({schema:c,logger:n.logger})):o?Lp.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:LRt({schema:c,logger:n.logger})}),description:void 0,availability:l,groupName:void 0}):Lp.optional({nameOverride:void 0,generatedName:O,title:void 0,value:Lp.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:LRt({schema:c,logger:n.logger})}),description:void 0,availability:void 0,groupName:void 0}),description:void 0,availability:l,groupName:void 0});if(c.in==="header"&&c.schema!=null&&!gy(c.schema)&&c.schema.default!=null){let x=c.schema.default;typeof x=="string"&&x.length>0&&(j=Lp.literal({nameOverride:void 0,generatedName:O,title:void 0,value:E7.string(x),description:void 0,availability:l,groupName:void 0}))}let S={name:c.name,schema:j,description:c.description,parameterNameOverride:tqf(c),availability:l,source:a};c.in==="query"?u.queryParameters.push(S):c.in==="path"?u.pathParameters.push({...S,variableReference:rqf(c)}):c.in==="header"?!HX1.has(c.name)&&!n.authHeaders.has(c.name)?u.headers.push({...S,env:void 0}):n.logger.debug(`Ignoring ${c.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${c.in} parameter, ${c.name}, in ${t.toUpperCase()} ${e}`)}return u}var HX1=new Set(["User-Agent","Content-Length","Content-Type","X-Forwarded-For","Cookie","Origin","Content-Disposition","X-Ping-Custom-Domain"]);function H3n(e,t){for(let r of Object.keys(e))if(r.includes("json")){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:iqf(n,t)}}}function nqf(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:iqf(n,t)}}}function iqf(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=Lh(e,Yje.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,a])=>({name:a.summary??i,value:a.value,description:a.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,a])=>{let u=gy(a)?t.resolveExampleReference(a):a;return{name:u.summary??i,value:u.value,description:u.description}})),r}function $X1(e){var t;for(let[r,n]of Object.entries(e.content))if((t=sA.parse(r))!=null&&t.isMultipart())return{schema:n.schema,encoding:n.encoding}}function JX1(e){var t;for(let r in e.content)if((t=sA.parse(r))!=null&&t.isOctetStream())return!0;return!1}function GX1(e,t){let r=gy(e)?Jmu(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!gy(i)&&i.type==="string"&&i.format==="binary")!=null}function $3n({requestBody:e,document:t,context:r,requestBreadcrumbs:n,source:i,namespace:a}){var g,O,j,S,x;let u=gy(e)?r.resolveRequestBodyReference(e):e,f=$X1(u),d=f==null?void 0:f.schema,c=f==null?void 0:f.encoding,o=H3n(u.content,r);if(JX1(u))return S2e.octetStream({description:void 0,source:i});if(d!=null&&o==null||d!=null&&GX1(d,t)){let A=gy(d)?Jmu(d,t):{id:void 0,schema:d},z=L1(A.schema,!1,r,n,i,a),N=[];if(z.type==="object")for(let C of z.properties){if(C.schema.type==="primitive"&&C.schema.schema.type==="string"&&C.schema.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!1,isArray:!1}),description:C.schema.description,contentType:c!=null?(g=c[C.key])==null?void 0:g.contentType:void 0});continue}if(C.schema.type==="optional"&&C.schema.value.type==="primitive"&&C.schema.value.schema.type==="string"&&C.schema.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!0,isArray:!1}),description:C.schema.description,contentType:c!=null?(O=c[C.key])==null?void 0:O.contentType:void 0});continue}if(C.schema.type==="array"&&C.schema.value.type==="primitive"&&C.schema.value.schema.type==="string"&&C.schema.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!1,isArray:!0}),description:C.schema.description,contentType:c!=null?(j=c[C.key])==null?void 0:j.contentType:void 0});continue}if(C.schema.type==="optional"&&C.schema.value.type==="array"&&C.schema.value.value.type==="primitive"&&C.schema.value.value.schema.type==="string"&&C.schema.value.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!0,isArray:!0}),description:C.schema.description,contentType:c!=null?(S=c[C.key])==null?void 0:S.contentType:void 0});continue}N.push({key:C.key,schema:D2e.json(C.schema),description:void 0,contentType:c!=null?(x=c[C.key])==null?void 0:x.contentType:void 0})}return S2e.multipart({name:gy(d)&&r.getNumberOfOccurrencesForRef(d)===1?A.id:void 0,description:void 0,properties:N,source:i})}if(o==null)return;let l=L1(o.schema,!1,r,n,i,a,!0);return S2e.json({description:void 0,schema:l,contentType:void 0,fullExamples:o.examples,additionalProperties:!gy(o.schema)&&H7n(o.schema.additionalProperties),source:i})}function Jmu(e,t){var i,a;if(!e.$ref.startsWith(Fen))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=A5r(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let n=(a=(i=t.components)==null?void 0:i.schemas)==null?void 0:a[r];if(n==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return gy(n)?Jmu(n,t):{id:r,schema:n}}var Gmu={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},aqf=new Set(Object.values(Gmu));var KX1=["200","201","202","204"];function uqf({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:a,source:u}){if(t==null)return{value:void 0,errors:{}};let f=YX1({responses:t,context:r,source:u,namespace:r.namespace}),d=!1,c;for(let o of i!=null?[i]:KX1){let l=t[o];l!=null&&(d=!0,c==null&&(c=oqf({operationContext:e,response:l,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace})))}if(c==null&&!d&&t.default!=null&&(c=oqf({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace})),c!=null)switch(c.type){case"json":return{value:c,errors:f};case"streamingJson":case"streamingSse":return{value:c,errors:f};case"file":case"text":case"streamingText":return{value:c,errors:f};default:Ol(c)}return{value:void 0,errors:f}}function oqf({operationContext:e,streamFormat:t,response:r,context:n,responseBreadcrumbs:i,source:a,namespace:u}){let f=gy(r)?n.resolveResponseReference(r):r;if(f.content!=null&&Object.entries(f.content).find(([o,l])=>{if(l.schema==null)return!1;let g=gy(l.schema)?n.resolveSchemaReference(l.schema):l.schema;return g.type==="string"&&g.format==="binary"}))return T3.file({description:f.description,source:a});let d=H3n(f.content??{},n);if(d!=null){if(t!=null)switch(t){case"json":return T3.streamingJson({description:f.description,responseProperty:void 0,schema:oq(L1(d.schema,!1,n,i,a,u)),source:a});case"sse":return T3.streamingSse({description:f.description,responseProperty:void 0,schema:oq(L1(d.schema,!1,n,i,a,u)),source:a})}return T3.json({description:f.description,schema:L1(d.schema,!1,n,i,a,u),responseProperty:Lh(e.operation,kh.RESPONSE_PROPERTY),fullExamples:d.examples,source:a})}for(let[c,o]of Object.entries(f.content??{})){let l=sA.parse(c);if(l!=null){if(l.isOctetStream()||l.isPDF()||l.isAudio()||l.isImage()||l.isVideo())return T3.file({description:f.description,source:a});if(l.isPlainText()){let g=o.schema;if(g==null)return T3.text({description:f.description,source:a});let O=gy(g)?n.resolveSchemaReference(g):g;return O.type==="string"&&O.format==="byte"?T3.file({description:f.description,source:a}):T3.text({description:f.description,source:a})}}}}function YX1({responses:e,context:t,source:r,namespace:n}){let i={};for(let[a,u]of Object.entries(e)){if(a==="default")continue;let f=parseInt(a);if(f<400||f>600)continue;let d=gy(u)?t.resolveResponseReference(u):u,c=nqf(d.content??{},t),o=Gmu[f];if(o==null){t.logger.warn(`No error name found for status code ${a}`);continue}i[f]={statusCode:f,nameOverride:void 0,generatedName:o,description:d.description,schema:L1((c==null?void 0:c.schema)??{},!1,t,[o,"Body"],r,n),fullExamples:c==null?void 0:c.examples,source:r}}return i}function vEr({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,source:a}){let{document:u,operation:f,path:d,method:c,baseBreadcrumbs:o,sdkMethodName:l}=e,g=Lh(f,kh.IDEMPOTENT),O=Lh(f,[kh.REQUEST_NAME_V1,kh.REQUEST_NAME_V2]),j=[...o,"Request"],S=T1a({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:j,path:d,httpMethod:c,source:a}),x=f.requestBody!=null?$3n({requestBody:f.requestBody,document:u,context:new W3n({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:j,source:a,namespace:t.namespace}):void 0;(S.queryParameters.length>0||S.headers.length>0)&&x!=null&&x.type==="json"&&x.schema.type!=="object"&&f.requestBody!=null?x=$3n({requestBody:f.requestBody,document:u,context:t,requestBreadcrumbs:[...j,"Body"],source:a,namespace:t.namespace}):f.requestBody!=null&&(x=$3n({requestBody:f.requestBody,document:u,context:t,requestBreadcrumbs:[...j],source:a,namespace:t.namespace}));let A=[...o,"Response"],z=uqf({operationContext:e,streamFormat:i,responses:f.responses,context:t,responseBreadcrumbs:A,responseStatusCode:r,source:a}),N=eqf(f),C=k2f(e,f,t),U=Lh(f,kh.SERVER_NAME_V2);return{summary:f.summary,internal:Lh(f,Yje.INTERNAL),idempotent:g,audiences:Lh(f,kh.AUDIENCES)??[],operationId:f.operationId!=null&&n!=null?f.operationId+"_"+n:f.operationId,tags:t.resolveTagsToTagIds(f.tags),namespace:t.namespace,sdkName:l,pathParameters:S.pathParameters,queryParameters:S.queryParameters,headers:S.headers,requestNameOverride:O??void 0,generatedRequestName:yR(j),request:x,response:z.value,errors:z.errors,server:U!=null?[{name:U,url:void 0,audiences:void 0}]:(f.servers??[]).map(Y=>x1a(Y)),description:f.description,authed:XX1(f,u),availability:N,method:c,path:d,examples:C,pagination:e.pagination,source:a}}function XX1(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function cqf({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:a,operationParameters:u}=e,f=r.discriminant.name,d=r.discriminant.value,c=r["response-status-code"],o=sqf({context:t,headerToIgnore:f,parameters:a}),l=sqf({context:t,headerToIgnore:f,parameters:u}),g=vEr({operationContext:{...e,pathItemParameters:o,operationParameters:l,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([j])=>parseInt(j)!==c))}},context:t,streamFormat:void 0,source:n}),O=vEr({operationContext:{...e,pathItemParameters:o,operationParameters:l,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:c,streamFormat:void 0,source:n});return O.headers.push({name:f,schema:Lp.literal({nameOverride:void 0,generatedName:yR([f]),title:void 0,description:void 0,availability:void 0,value:E7.string(d),groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n}),{sync:g,async:O}}function sqf({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=gy(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var Kmu="stream";function pqf({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:vEr({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:void 0};case"streamCondition":{let n=lqf({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if((n==null?void 0:n.schemaReference)!=null){let c=A5r(n.schemaReference);c!=null&&t.excludeSchema(c)}let i=fqf({operation:e.operation,response:r.responseStream}),a=vEr({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+Kmu}:void 0,operation:{...e.operation,requestBody:n==null?void 0:n.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,Kmu]},context:t,streamFormat:r.format,suffix:Kmu,source:t.source});a.examples=a.examples.filter(c=>dqf(c,t)!==!1);let u=lqf({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),f=fqf({operation:e.operation,response:r.response}),d=vEr({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:u==null?void 0:u.requestBody,responses:f}},context:t,source:t.source});return d.examples=d.examples.filter(c=>dqf(c,t)!==!0),{streaming:a,nonStreaming:d}}default:Ol(r)}}function lqf({context:e,operation:t,streamingExtension:r,isStreaming:n}){var c;if(t.requestBody==null)return;let i=gy(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=H3n(i.content,e);if(a==null)return;let u=gy(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(u.allOf==null&&u.properties==null)return;let f=(c=u.properties)==null?void 0:c[r.streamConditionProperty];f!=null&&gy(f)&&(f=void 0);let d={...u,properties:{...u.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":n,...f??{}}},title:void 0,required:[...u.required??[],r.streamConditionProperty]};return{requestBody:{content:{[sA.APPLICATION_JSON]:{schema:d}}},schemaReference:gy(a.schema)?a.schema:void 0}}function fqf({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[sA.APPLICATION_JSON]:{schema:t}}}}}function dqf(e,t){return e._visit({unknown:r=>{let n=h5.ExampleEndpointCallSchema.safeParse(r);if(!n.success){t.logger.error("Failed to parse example",n.error.toString());return}if(n.data.response!=null)return n.data.response.stream!=null},full:()=>{},_other:()=>{}})}function _qf({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:a,method:u,baseBreadcrumbs:f,sdkMethodName:d}=t,c=[...f,"Payload"],o=T1a({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:c,path:a,httpMethod:u,source:r});if(i.requestBody==null){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Missing a request body`);return}if(u!=="POST"&&u!=="GET"){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Not POST or GET`);return}let l=$3n({requestBody:i.requestBody,document:n,context:e,requestBreadcrumbs:[...f,"Payload"],source:r,namespace:e.namespace});if(l==null||l.type!=="json"){e.logger.error(`Skipping webhook ${a} because non-json request body`);return}if(i.operationId==null){e.logger.error(`Skipping webhook ${a} because no operation id present`);return}return{summary:i.summary,sdkName:d,namespace:e.namespace,method:u,operationId:i.operationId,tags:e.resolveTagsToTagIds(i.tags),headers:o.headers,generatedPayloadName:yR(c),payload:l.schema,description:i.description,examples:QX1(l.fullExamples),source:r}}function QX1(e){if(e==null)return[];let t=[];for(let r of e){let n=N5r(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function Ymu({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=Lh(r,kh.IGNORE);if(i!=null&&i){e.logger.info(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=ZX1(r,e),u=$2f(e.document,r),f={...t,sdkMethodName:a,baseBreadcrumbs:kX1({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path}),operation:r,operationParameters:r.parameters??[],pagination:u};if(n){let l=_qf({context:e,operationContext:f,source:e.source});return l!=null?{type:"webhook",value:l}:void 0}let d=W2f(r);if(d!=null){let l=pqf({context:e,operationContext:f,streamingExtension:d});return l!=null?{type:"streaming",streaming:l.streaming,nonStreaming:l.nonStreaming}:void 0}let c=U2f(r);if(c!=null){let l=cqf({context:e,operationContext:f,asyncExtension:c,source:e.source});return{type:"async",async:l.async,sync:l.sync}}let o=vEr({context:e,operationContext:f,streamFormat:void 0,source:e.source});return{type:"http",value:o}}function ZX1(e,t){let r=Lh(e,kh.SDK_METHOD_NAME),n=Lh(e,kh.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function kX1({sdkMethodName:e,operation:t,httpMethod:r,path:n}){let i=[];if(e!=null){if(e.groupName.length>0){let a=e.groupName[e.groupName.length-1];a!=null&&i.push(typeof a=="string"?a:a.name)}i.push(e.methodName)}else t.operationId!=null?i.push(t.operationId):i.push(FE(`${r}_${n.split("/").join("_")}`));return i}function hqf(e,t,r,n){let i=[],a=vqf(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let f of a){let d=eQ1({operation:f.operation}),c=Ymu({context:n,pathItemContext:{...u,method:f.method},operation:f.operation,convertToWebhook:d});c!=null&&i.push(c)}return i}function yqf(e,t,r,n){let i=[],a=vqf(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let f of a){let d=Ymu({context:n,pathItemContext:{...u,method:f.method},operation:f.operation,convertToWebhook:!0});d!=null&&i.push(d)}return i}function vqf(e){let t=[];return e.get!=null&&t.push({method:KJ.Get,operation:e.get}),e.post!=null&&t.push({method:KJ.Post,operation:e.post}),e.put!=null&&t.push({method:KJ.Put,operation:e.put}),e.delete!=null&&t.push({method:KJ.Delete,operation:e.delete}),e.patch!=null&&t.push({method:KJ.Patch,operation:e.patch}),t}function eQ1({operation:e}){return Lh(e,[kh.WEBHOOK])??!1}function bqf(e){let t=Lh(e,kh.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=Lh(e,kh.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function gqf(e){return Lh(e,kh.FERN_BASIC_AUTH)}function Xmu(e,t){if(gy(e))throw new Error(`Converting referenced security schemes is unsupported: ${JSON.stringify(e)}`);return tQ1(e,t)}function tQ1(e,t){var r,n,i,a;if(e.type==="apiKey"&&e.in==="header"){let u=Lh(e,Yje.BEARER_FORMAT),f=Lh(e,kh.FERN_HEADER_AUTH);return F9.header({headerName:e.name,prefix:u!=null?"Bearer":f==null?void 0:f.prefix,headerVariableName:(f==null?void 0:f.name)??Lh(e,kh.HEADER_VARIABLE_NAME),headerEnvVar:f==null?void 0:f.env})}else if(e.type==="http"&&e.scheme==="bearer"){let u=Lh(e,kh.FERN_BEARER_TOKEN);return F9.bearer({tokenVariableName:(u==null?void 0:u.name)??Lh(e,kh.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:u==null?void 0:u.env})}else if(e.type==="http"&&e.scheme==="basic"){let u=gqf(e),f=bqf(e);return F9.basic({usernameVariableName:((r=u==null?void 0:u.username)==null?void 0:r.name)??f.usernameVariable,usernameEnvVar:(n=u==null?void 0:u.username)==null?void 0:n.env,passwordVariableName:((i=u==null?void 0:u.password)==null?void 0:i.name)??f.passwordVariable,passwordEnvVar:(a=u==null?void 0:u.password)==null?void 0:a.env})}else{if(e.type==="openIdConnect")return F9.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return F9.oauth({scopesEnum:rQ1(e,t)})}throw new Error(`Failed to convert security scheme ${JSON.stringify(e)}`)}function rQ1(e,t){var n,i,a,u;let r=((n=e.flows.authorizationCode)==null?void 0:n.scopes)??((i=e.flows.clientCredentials)==null?void 0:i.scopes)??((a=e.flows.implicit)==null?void 0:a.scopes)??((u=e.flows.password)==null?void 0:u.scopes);if(r!=null){let f=C5r({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([c,o])=>[c,{description:o}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsNullable:!1,groupName:void 0,context:void 0,source:t}),d=oq(f);if(d.type==="enum")return d}}function mqf(e){return Lh(e,kh.BASE_PATH)}var nQ1=ir.record(ir.string(),ir.object({summary:ir.string().optional(),description:ir.string().optional()}));function Oqf({document:e,context:t}){return RRt(e,kh.GROUPS,nQ1,t.logger)}function Pqf({context:e,document:t}){return RRt(t,kh.FERN_VERSION,h5.VersionDeclarationSchema,e.logger)??void 0}function jqf(e){let t=Lh(e,kh.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?z_i({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function wqf(e){let t=Lh(e,kh.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?z_i({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function Dqf(e){let t=Lh(e,kh.SDK_VARIABLES);return t==null?{}:Object.fromEntries(Object.entries(t).map(([r,n])=>{if(n.type==="string")return[r,{nameOverride:void 0,generatedName:yR([r]),title:n.title,schema:Xw.string({default:Y7n(n),pattern:n.pattern,format:n.format,minLength:n.minLength,maxLength:n.maxLength}),description:n.description,availability:void 0,groupName:void 0}];throw new Error(`Variable ${r} has unsupported schema ${JSON.stringify(n)}`)}))}var iQ1="webhooks";function Sqf(e){return Lh(e,iQ1)??{}}var q1a=class extends V3n{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discrminatedUnionReferences={};discrminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u}){super({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u})}getDummy(){return new W3n({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discrminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discrminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discrminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discrminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discrminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discrminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function Eqf(e){return Lh(e,kh.RESOLUTIONS)}function Mqf({openapi:e}){let t=Eqf(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let a of n.resolutions)e=aQ1({openapi:e,schemaReference:a,schemaName:n.name}),e=xqf({openapi:e,replaceReference:a,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(u=>[i,u]))}}return e}function aQ1({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(a=>a.replace("~1","/")),i=e;for(let a of n){let u=i[a];if(u==null)return e;i=u}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function xqf({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(d=>t.startsWith(d)).sort((d,c)=>c.length-d.length)[0];if(i!=null){let d=n[i];if(d!=null){let c=r.replace(i,d);return xqf({openapi:e,replaceReference:t,schemaReference:c,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(d=>d.replace("~1","/")),u=e;for(let d of a.slice(0,-1)){let c=u[d];if(c==null)return e;u=c}let f=a[a.length-1];return f==null||(u[f]={$ref:r}),e}function C1a({openApi:e,taskContext:t,options:r,source:n,namespace:i}){var Y,te,G;e=Mqf({openapi:e});let a=Object.fromEntries(Object.entries(((Y=e.components)==null?void 0:Y.securitySchemes)??{}).map(([$,ee])=>Xmu(ee,n)==null?[]:[$,Xmu(ee,n)])),u=new Set(...Object.entries(a).map(([$,ee])=>ee.type==="basic"||ee.type==="bearer"?"Authorization":ee.type==="header"?ee.headerName:null)),f=new q1a({document:e,taskContext:t,authHeaders:u,options:r,source:n,namespace:i}),d=Dqf(e),c=jqf(e),o=wqf(e),l=r.audiences??[],g=[],O=[];Object.entries(e.paths??{}).forEach(([$,ee])=>{if(ee==null)return;t.logger.debug(`Converting path ${$}`);let Ve=hqf($,ee,e,f);for(let $e of Ve){let Dt=Tqf({operation:$e});if(!(l.length>0&&!l.some(Tt=>Dt.includes(Tt))))switch($e.type){case"async":g.push($e.sync),g.push($e.async);break;case"http":g.push($e.value);break;case"streaming":g.push($e.streaming),$e.nonStreaming&&g.push($e.nonStreaming);break;case"webhook":O.push($e.value);break;default:Ol($e)}}}),Object.entries(Sqf(e)).forEach(([$,ee])=>{if(ee==null)return;t.logger.debug(`Converting path ${$}`);let Ve=yqf($,ee,e,f);for(let $e of Ve){let Dt=Tqf({operation:$e});l.length>0&&!l.some(Tt=>Dt.includes(Tt))||O.push($e.value)}});let j=Object.fromEntries(Object.entries(((te=e.components)==null?void 0:te.schemas)??{}).map(([$,ee])=>{if(!gy(ee)){let Ve=Lh(ee,kh.IGNORE);if(Ve!=null&&Ve)return[];if(aqf.has($))return[$,L1({...ee,"x-fern-type-name":`${$}Body`},!1,f,[$],n,i)]}return[$,L1(ee,!1,f,[$],n,i)]}).filter($=>$.length>0)),S=oQ1(j,f,n),x=uQ1(S,f),A={};for(let[$,ee]of Object.entries(x)){let Ve=oq(ee);f.isSchemaExcluded($)||(A[$]=Ve,t.logger.debug(`Converted schema ${$}`))}let z=new fba(x,f.logger),N=g.map($=>{let ee=$.examples,Ve=ee;if(!r.disableExamples&&(ee.length===0||ee.every(F_i))){let Tt=z.buildEndpointExample($);Tt.length>0&&(Ve=[...Tt,...ee.filter(Wt=>!F_i(Wt))])}let $e=$.request,Dt=$.response;return{...$,request:($e==null?void 0:$e.type)==="json"?{...$e,schema:oq($e.schema)}:$e,response:(Dt==null?void 0:Dt.type)==="json"?{...Dt,schema:oq(Dt.schema)}:Dt,queryParameters:$.queryParameters.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,availability:Tt.availability,source:Tt.source})),pathParameters:$.pathParameters.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,variableReference:Tt.variableReference,availability:Tt.availability,source:Tt.source})),headers:$.headers.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,env:Tt.env,availability:Tt.availability,source:Tt.source})),examples:Ve,errors:sy($.errors,Tt=>{var Wt;return{generatedName:Tt.generatedName,nameOverride:Tt.nameOverride,schema:oq(Tt.schema),description:Tt.description,source:Tt.source,examples:(Wt=Tt.fullExamples)==null?void 0:Wt.map(Nt=>{let ur=N5r(Nt.value);if(ur!=null)return{name:Nt.name,description:Nt.description,example:ur}}).filter(RS)}})}}),C=Oqf({document:e,context:f});return{apiVersion:Pqf({context:f,document:e}),basePath:mqf(e),title:e.info.title,description:e.info.description,groups:Object.fromEntries(Object.entries(C??{}).map(([$,ee])=>[$,{summary:ee.summary??void 0,description:ee.description??void 0}])),servers:(e.servers??[]).map($=>x1a($)),tags:{tagsById:Object.fromEntries((e.tags??[]).map($=>[$.name,{id:$.name,description:$.description}])),orderedTagIds:(G=e.tags)==null?void 0:G.map($=>$.name)},endpoints:N,webhooks:O,channel:[],groupedSchemas:sba(i,A),securitySchemes:a,hasEndpointsMarkedInternal:N.some($=>$.internal),nonRequestReferencedSchemas:f.getReferencedSchemas(),variables:d,globalHeaders:c,idempotencyHeaders:o}}function oQ1(e,t,r){let n={};for(let[i,a]of Object.entries(e)){if(a.type!=="object"){n[i]=a;continue}let u={$ref:`#/components/schemas/${i}`},f=t.getReferencesFromDiscriminatedUnion(u);if(f==null){n[i]=a;continue}let d={...a,type:"object",properties:a.properties.filter(o=>!f.discriminants.has(o.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(o=>!f.discriminants.has(o.propertyKey)),source:r};n[i]=d;let c=qqf({schema:a,schemas:e});for(let o of[...new Set(c)]){let l=n[o]??e[o];l==null||l.type!=="object"||(n[o]={...l,type:"object",properties:l.properties.filter(g=>!f.discriminants.has(g.key)),allOfPropertyConflicts:l.allOfPropertyConflicts.filter(g=>!f.discriminants.has(g.propertyKey))})}}return n}function uQ1(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let a={$ref:`#/components/schemas/${n}`},u=t.getDiscriminatedUnionMetadata(a);if(u==null){r[n]=i;continue}let f=[];for(let c of i.properties)if(u.discriminants.has(c.key)){let o=u.discriminants.get(c.key);o!=null&&f.push({...c,schema:Lp.literal({nameOverride:void 0,generatedName:yR([i.generatedName,o]),title:void 0,value:E7.string(o),groupName:void 0,description:void 0,availability:i.availability})})}else f.push(c);let d={...i,type:"object",properties:f};r[n]=d}return r}function qqf({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...qqf({schema:i,schemas:t}))}return r}function Tqf({operation:e}){let t=[];switch(e.type){case"async":t=e.async.audiences;break;case"http":t=e.value.audiences;break;case"streaming":t=e.streaming.audiences;break;case"webhook":break;default:Ol(e)}return t}async function Aqf({openApi:e,taskContext:t,options:r,source:n,namespace:i}){let a=await(0,Cqf.convertObj)(e,{});return C1a({openApi:a.openapi,taskContext:t,options:r,source:n,namespace:i})}var J3n={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0};async function Ktn({absoluteFilePathToWorkspace:e,specs:t,taskContext:r,optionOverrides:n}){let i={apiVersion:void 0,title:void 0,description:void 0,basePath:void 0,servers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channel:[],groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},globalHeaders:[],idempotencyHeaders:[],groups:{}};for(let a of t){let u=(await(0,Zmu.readFile)(a.absoluteFilepath)).toString(),f=YN(e,a.source.file);a.source.relativePathToDependency!=null&&(f=pf(a.source.relativePathToDependency,f));let d=a.source.type==="protobuf"?HSr.protobuf({file:f}):HSr.openapi({file:f});if(u.includes("openapi")||u.includes("swagger")){let c=await REf({absolutePathToOpenAPI:a.absoluteFilepath,context:r,absolutePathToOpenAPIOverrides:a.absoluteFilepathToOverrides});if(lQ1(c)){let o=C1a({openApi:c,taskContext:r,options:Qmu({specSettings:a.settings,overrides:n}),source:d,namespace:a.namespace});i=Nqf(i,o)}else if(fQ1(c)){let o=await Aqf({openApi:c,taskContext:r,options:Qmu({specSettings:a.settings}),source:d,namespace:a.namespace});i=Nqf(i,o)}}else if(u.includes("asyncapi")){let c=await cQ1({absoluteFilePathToAsyncAPI:a.absoluteFilepath,context:r,absoluteFilePathToAsyncAPIOverrides:a.absoluteFilepathToOverrides}),o=Tpf({document:c,taskContext:r,options:Qmu({specSettings:a.settings}),source:d,asyncApiOptions:sQ1({specSettings:a.settings}),namespace:a.namespace});o.channel!=null&&i.channel.push(o.channel),o.groupedSchemas!=null&&(i.groupedSchemas=zqf(i.groupedSchemas,o.groupedSchemas)),o.basePath!=null&&(i.basePath=o.basePath)}else r.failAndThrow(`${a.absoluteFilepath} is not a valid OpenAPI or AsyncAPI file`)}return i}function Qmu({specSettings:e,overrides:t}){return{disableExamples:(t==null?void 0:t.disableExamples)??J3n.disableExamples,discriminatedUnionV2:(t==null?void 0:t.discriminatedUnionV2)??(e==null?void 0:e.shouldUseUndiscriminatedUnionsWithLiterals)??J3n.discriminatedUnionV2,useTitlesAsName:(t==null?void 0:t.useTitlesAsName)??(e==null?void 0:e.shouldUseTitleAsName)??J3n.useTitlesAsName,audiences:(t==null?void 0:t.audiences)??(e==null?void 0:e.audiences)??J3n.audiences,optionalAdditionalProperties:(t==null?void 0:t.optionalAdditionalProperties)??(e==null?void 0:e.optionalAdditionalProperties)??J3n.optionalAdditionalProperties}}function sQ1({specSettings:e,overrides:t}){return{naming:(t==null?void 0:t.naming)??(e==null?void 0:e.asyncApiNaming)??tpf.naming}}function Nqf(e,t){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],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],channel:[...e.channel,...t.channel],groupedSchemas:zqf(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},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 zqf(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,n]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...n}:e.namespacedSchemas[r]=n;return e}async function cQ1({absoluteFilePathToAsyncAPI:e,absoluteFilePathToAsyncAPIOverrides:t,context:r}){let n=(await(0,Zmu.readFile)(e)).toString(),i=await av.load(n);return t!=null?await jPa({absoluteFilepathToOverrides:t,context:r,data:i}):i}function lQ1(e){return e.openapi!=null}function fQ1(e){return e.swagger!=null}function N1a({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=kmu({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=A2(i.value);if(a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>"),e.description==null&&!i.allowMultiple&&e.parameterNameOverride==null&&e.availability==null)return a;let u={type:a};return i.allowMultiple&&(u["allow-multiple"]=!0),e.description!=null&&(u.docs=e.description),e.parameterNameOverride!=null&&(u.name=e.parameterNameOverride),e.availability!=null&&(u.availability=q3(e.availability)),u}function kmu({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,groupName:void 0}),context:t,declarationFile:zs.of(HT),fileContainingReference:r,namespace:n}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undisciminated"){let a=[];for(let[u,f]of Object.entries(i.value.schemas))f.type==="literal"&&f.value.type==="string"&&(G7n.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:B_i(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[u,f]=i.value.schemas;if(u!=null&&f!=null&&A1a({array:u,primitive:f}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(u!=null&&f!=null&&A1a({array:u,primitive:f}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}}for(let[u,f]of Object.entries(i.value.schemas))return kmu({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(i.type==="object")return}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let i=t.getSchema(e.value.schema,n);if(i==null)return;if(i.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,declarationFile:zs.of(HT),namespace:n}),allowMultiple:!0}}if(e.value.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undisciminated"){let i=[];for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="literal"&&u.value.type==="string"&&(G7n.test(u.value.value)?i.push(u.value.value):i.push({value:u.value.value,name:B_i(u.value.value)}));if(i.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:i}}),{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&A1a({array:a,primitive:u}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(a!=null&&u!=null&&A1a({array:u,primitive:a}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}}for(let[a,u]of Object.entries(e.value.value.schemas))return kmu({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return;return{value:S1({schema:e,context:t,fileContainingReference:r,namespace:n}),allowMultiple:!1}}return e.type==="array"?{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}:{value:S1({schema:e,context:t,fileContainingReference:r,namespace:n}),allowMultiple:!1}}function A1a({array:e,primitive:t}){return(e==null?void 0:e.type)==="array"&&e.value.type==="primitive"&&(t==null?void 0:t.type)==="primitive"&&e.value.schema.type===t.schema.type}function Bqf({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=dQ1(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=pQ1({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Rzr(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function dQ1(e){let t={};return e.forEach(r=>{let n=Rzr(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function pQ1({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=Rzr(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Rzr(e){switch(e.type){case"primitive":return Iqf(e.value);case"object":return Rqf(e.properties);case"array":return _Q1(e.value);case"map":return hQ1(e.value);case"oneOf":return yQ1(e.value);case"enum":return e.value;case"literal":return vQ1(e.value);case"unknown":return Rzr(e.value);default:Ol(e)}}function Iqf(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Ol(e)}}function Rqf(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Rzr(r)]))}function _Q1(e){return e.map(t=>Rzr(t))}function hQ1(e){return Object.fromEntries(e.map(t=>[Iqf(t.key),Rzr(t.value)]))}function yQ1(e){return e.type==="discriminated"?Rqf(e.value):Rzr(e.value)}function vQ1(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ol(e)}}function bEr(e){var t;return(t=e.find(r=>typeof r!="string"&&r.type==="namespace"))==null?void 0:t.name}function z1a(e,t){return t??((e==null?void 0:e.groupName)!=null?bEr(e.groupName):void 0)}function Fqf({channel:e,context:t,declarationFile:r}){let n={path:e.path,auth:!1};e.summary!=null&&(n["display-name"]=e.summary);let i=bEr(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=eba({pathParameter:d,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let c=N1a({queryParameter:d,context:t,fileContainingReference:r,namespace:i});c!=null&&(u[d.name]=c)}Object.keys(u).length>0&&(n["query-parameters"]=u);let f={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let c=IRt({header:d,context:t,fileContainingReference:r,namespace:i});f[d.name]=c}Object.keys(f).length>0&&(n.headers=f),t.builder.addChannel(r,{channel:n}),e.subscribe!=null&&t.builder.addChannelMessage(r,{messageId:"subscribe",message:{origin:"server",body:S1({schema:e.subscribe,context:t,fileContainingReference:r,namespace:i})}}),e.publish!=null&&t.builder.addChannelMessage(r,{messageId:"publish",message:{origin:"client",body:S1({schema:e.publish,context:t,fileContainingReference:r,namespace:i})}});for(let d of e.examples){let c=Bqf({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:c})}}var Lqf="Production",Uqf="Default";function Vqf(e){return Object.entries(e).reduce((t,[r,n])=>(U2n(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function Wqf(e){var f,d;if(e.environmentOverrides!=null){for(let[c,o]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:c,schema:o});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[];for(let c of e.ir.servers){let o=c.audiences?{url:c.url,audiences:c.audiences}:c.url;if(c.name==null){r.push(o);continue}t[c.name]=o}let n={},i=[];for(let c of e.ir.endpoints)for(let o of c.server){if(o.url==null)continue;let l=o.audiences?{url:o.url,audiences:o.audiences}:o.url;if(o.name==null){i.push(l);continue}n[o.name]=l}let a=Object.keys(t).length,u=Object.keys(n).length;if(a===0&&u===0){let c=(f=e.ir.servers[0])==null?void 0:f.url,o=(d=e.ir.servers[0])==null?void 0:d.audiences;c!=null&&(e.builder.addEnvironment({name:Uqf,schema:o?{url:c,audiences:o}:c}),e.builder.setDefaultEnvironment(Uqf))}else if(a>0&&u===0){let c=0;r.length>0&&e.logger.error(`Skipping servers ${r.map(o=>typeof o=="string"?o:o.url).join(", ")} because x-fern-server-name was not provided.`);for(let[o,l]of Object.entries(t))c===0&&e.builder.setDefaultEnvironment(o),e.builder.addEnvironment({name:o,schema:l}),c+=1}else if(u>0){(r.length>0||i.length>0)&&e.logger.error(`Skipping servers ${[...r,...i].map(o=>typeof o=="string"?o:o.url).join(", ")} because x-fern-server-name was not provided.`);let c=Object.entries(t)[0];if(c!=null){let[o,l]=c;e.setDefaultServerName(o)}e.builder.addEnvironment({name:Lqf,schema:{urls:{...Vqf(t),...Vqf(n)}}}),e.builder.setDefaultEnvironment(Lqf)}}function B1a(e){return A2(e).startsWith("optional")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var eOu=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},bQ1=.75,gQ1=new Set("authorization");function Hqf(e){let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?V7n(n.schema):void 0,u=a!=null?bEr(a):void 0,f=zs.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?A2(S1({schema:n.schema,context:e,fileContainingReference:u?pf(zs.of(FE(u)),f):f,namespace:u}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(gQ1.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let f=t[a.name],d=IRt({header:{...a,schema:(f==null?void 0:f.schema)??a.schema,name:(f==null?void 0:f.name)??a.name},fileContainingReference:zs.of(nB),context:e,namespace:void 0});u=new eOu(d),r[a.name]=u}u.increment()}let n=e.ir.endpoints.length*bQ1;for(let[i,a]of Object.entries(r)){let u=t[i],f=a.count===e.ir.endpoints.length,d=a.count>=n;u==null&&(f?e.builder.addGlobalHeader({name:i,schema:a.schema}):d&&e.builder.addGlobalHeader({name:i,schema:B1a(a.schema)}))}}}function $qf(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?V7n(t.schema):void 0,n=r!=null?bEr(r):void 0,i=IRt({header:{...t,schema:t.schema??ib.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0,schema:Xw.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0},fileContainingReference:zs.of(nB),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:B1a(i)})}}function lG(e){switch(e.type){case"primitive":return Jqf(e.value);case"object":return Gqf(e.properties);case"array":return mQ1(e.value);case"map":return OQ1(e.value);case"oneOf":return PQ1(e.value);case"enum":return e.value;case"literal":return jQ1(e.value);case"unknown":return lG(e.value);default:Ol(e)}}function Jqf(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Ol(e)}}function Gqf(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,lG(r)]))}function mQ1(e){return e.map(t=>lG(t))}function OQ1(e){return Object.fromEntries(e.map(t=>[Jqf(t.key),lG(t.value)]))}function PQ1(e){return e.type==="discriminated"?Gqf(e.value):lG(e.value)}function jQ1(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ol(e)}}function Kqf({endpointExample:e,context:t}){let r={};return e.type!=="full"?e.value:(e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=wQ1(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=DQ1(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=SQ1({context:t,namedFullExamples:e.headers})),e.request!=null&&(r.request=lG(e.request)),e.response!=null&&(r.response={body:lG(e.response)}),e.response!=null&&(r.response={body:lG(e.response)}),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(n=>n.type==="language"?{name:n.name??void 0,docs:n.description??void 0,language:n.language,code:n.code,install:n.install??void 0}:{name:n.name??void 0,docs:n.description??void 0,sdk:n.sdk,code:n.code}).filter(RS)),r)}function wQ1(e){let t={};return e.forEach(r=>{let n=lG(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function DQ1(e){let t={};return e.forEach(r=>{let n=lG(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function SQ1({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=lG(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Yqf(e){return KJ._visit(e,{get:()=>h5.HttpMethodSchema.Enum.GET,post:()=>h5.HttpMethodSchema.Enum.POST,put:()=>h5.HttpMethodSchema.Enum.PUT,patch:()=>h5.HttpMethodSchema.Enum.PATCH,delete:()=>h5.HttpMethodSchema.Enum.DELETE,head:()=>{throw new Error("HEAD is unsupported")},options:()=>{throw new Error("HEAD is unsupported")},trace:()=>{throw new Error("HEAD is unsupported")},_other:()=>{throw new Error("Unkown http method is unsupported")}})}function Xqf({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,u=e.path,f=z1a(e.sdkName,e.namespace),d={};for(let S of e.pathParameters)S.parameterNameOverride&&(u=u.replace(S.name,S.parameterNameOverride)),d[S.parameterNameOverride??S.name]=eba({pathParameter:S,context:r,fileContainingReference:t,namespace:f}),a.add(S.name);let c={};for(let S of e.queryParameters){let x=N1a({queryParameter:S,context:r,fileContainingReference:t,namespace:f});x!=null&&(c[S.name]=x,a.add(S.name))}let o;e.pagination!=null&&(e.pagination.type==="cursor"?o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results}:o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage});let l={path:u,method:Yqf(e.method),auth:e.authed,docs:e.description??void 0,pagination:o};Object.keys(d).length>0&&(l["path-parameters"]=d),e.summary!=null&&(l["display-name"]=e.summary);let g={},O=r.builder.getGlobalHeaderNames(),j=e.headers.filter(S=>!O.has(S.name));for(let S of j){let x=IRt({header:S,context:r,fileContainingReference:t,namespace:f});g[S.name]=x,a.add(typeof x=="string"?S.name:x.name??S.name)}if(e.request!=null){let S=MQ1({context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,queryParameters:Object.keys(c).length>0?c:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(g).length>0?g:void 0,usedNames:a,namespace:f});l.request=S.value,i=[...i,...S.schemaIdsToExclude??[]]}else{let S=Object.keys(c).length>0,x=Object.keys(g).length>0,A={};(S||x)&&(A.name=e.requestNameOverride??e.generatedRequestName),S&&(A["query-parameters"]=c),x&&(A.headers=g),Object.keys(A).length>0&&(l.request=A)}if(e.response!=null&&e.response._visit({json:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l.response={docs:S.description??void 0,type:A2(x)},S.responseProperty!=null&&(l.response.property=S.responseProperty)},streamingJson:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l["response-stream"]={docs:S.description??void 0,type:A2(x),format:"json"}},streamingSse:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l["response-stream"]={docs:S.description??void 0,type:A2(x),format:"sse"}},file:S=>{l.response={docs:S.description??void 0,type:"file"}},streamingText:S=>{l["response-stream"]={docs:S.description??void 0,type:"text"}},text:S=>{l.response={docs:S.description??void 0,type:"text"}},_other:()=>{var S;throw new Error("Unrecognized Response type: "+((S=e.response)==null?void 0:S.type))}}),r.builder.getEnvironmentType()==="multi"){let S=r.getDefaultServerName(),x=e.server[0];x==null?S!=null&&(l.url=S):l.url=x.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=q3(e.availability)),Object.entries(e.errors).forEach(([S,x])=>{var te;let A=x.generatedName,z=zs.of(HT);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${x.generatedName}`,x.schema!=null&&(x.schema.type!=="reference"&&x.schema.type!=="oneOf"?x.schema.generatedName=`${e.generatedRequestName}${x.schema.generatedName}`:x.schema.type==="oneOf"&&(x.schema.value.generatedName=`${e.generatedRequestName}${x.schema.value.generatedName}`)));let N={"status-code":parseInt(S)},C=Gdf({location:Qqf,namespaceOverride:f});if(x.schema!=null){let G=S1({schema:x.schema,context:r,fileContainingReference:C,declarationFile:C,namespace:f});N.type=A2(G),N.docs=x.description}r.builder.addError(C,{name:A,schema:N}),l.errors==null&&(l.errors=[]);let U=r.builder.addImport({file:t,fileToImport:C});l.errors.push(U!=null?`${U}.${A}`:A),N.type!=null&&((te=x.examples)==null||te.forEach(G=>{let $={value:lG(G.example),name:G.name,docs:G.description};r.builder.addErrorExample(C,{name:A,example:$})}))}),e.examples.length>0&&(l.examples=EQ1({endpointExamples:e.examples,context:r})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[tOu,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function EQ1({endpointExamples:e,context:t}){return e.map(r=>{try{return Kqf({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function MQ1({declarationFile:e,context:t,request:r,requestNameOverride:n,generatedRequestName:i,queryParameters:a,nonRequestReferencedSchemas:u,headers:f,usedNames:d,namespace:c}){if(r.type==="json"){let o=r.schema.type==="reference"?r.schema.schema:void 0,l=r.schema.type==="reference"?t.getSchema(r.schema.schema,c):r.schema;if((l==null?void 0:l.type)!=="object"||o!=null&&u.includes(o)){let x=S1({schema:r.schema,fileContainingReference:e,context:t,namespace:c}),A={schemaIdsToExclude:[],value:{body:x}},z=Object.keys(a??{}).length>0,N=Object.keys(f??{}).length>0;return z&&(A.value["query-parameters"]=a),N&&(A.value.headers=f),(z||N)&&(A.value.name=n??i),r.contentType!=null&&(A.value["content-type"]=r.contentType),A}let g=Object.fromEntries(l.properties.map(x=>{let A=S1({schema:x.schema,fileContainingReference:e,context:t,namespace:c}),z=x.nameOverride??x.key,N=q3(x.availability);if(!d.has(z)&&x.audiences.length<=0)return d.add(z),x.nameOverride!=null?[x.key,{type:A2(A),docs:A_i(A),name:x.nameOverride,availability:N}]:[x.key,N?{...typeof A=="string"?{type:A}:A,availability:N}:A];let C={type:A2(A),docs:A_i(A)};return d.has(z)&&(C.name=x.generatedName),x.audiences.length>0&&(C.audiences=x.audiences),N!=null&&(C.availability=N),d.add(z),[x.key,C]})),O=l.allOf.map(x=>{let A=S1({schema:ib.reference(x),fileContainingReference:e,context:t,namespace:c});return A2(A)}),j={properties:g};O.length>0&&(j.extends=O),r.additionalProperties&&(j["extra-properties"]=!0);let S={name:n??l.nameOverride??l.generatedName,"query-parameters":a,headers:f,body:j};return r.contentType!=null&&(S["content-type"]=r.contentType),{schemaIdsToExclude:o!=null?[o]:[],value:S}}else{if(r.type==="octetStream")return{schemaIdsToExclude:[],value:{body:"bytes","content-type":sA.APPLICATION_OCTET_STREAM}};if(r.type==="multipart"){let o=Object.fromEntries(r.properties.map(l=>{if(l.schema.type==="file"){let g=l.schema.isArray?"list<file>":"file";if(g=l.schema.isOptional?`optional<${g}>`:g,l.description!=null||l.contentType!=null){let O={type:g};return l.description!=null&&(O.docs=l.description),l.contentType!=null&&(O["content-type"]=l.contentType),[l.key,O]}return[l.key,g]}else{let g=S1({schema:l.schema.value,fileContainingReference:e,context:t,namespace:c});return l.contentType!=null&&(typeof g=="string"?g={type:g,"content-type":l.contentType}:g["content-type"]=l.contentType),[l.key,g]}}));return{schemaIdsToExclude:r.name==null?[]:[r.name],value:{name:n??r.name??i,"query-parameters":a,headers:f,body:{properties:o},"content-type":sA.MULTIPART_FORM_DATA}}}else Ol(r)}}function xQ1({location:e,namespaceOverride:t}){return t!=null?{...e,file:pf(zs.of(t),e.file)}:e}function TQ1(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:zs.of(`${FE(r)}.yml`),endpointId:e.summary!=null?FE(e.summary):FE(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:zs.of(HT),endpointId:FE(e.summary)}:{file:zs.of(HT),endpointId:FE(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:zs.of(HT),endpointId:n};let i=A0i(r),a=A0i(n);if(iDr(i,a))return{file:zs.of("__package__.yml"),endpointId:r};let u=AQ1({operationId:n,tag:r,path:e.path,method:e.method});if(u!=null)return u;let f=[];for(let d=0;d<i.length;++d){let c=i[d];if(c!=null&&c===a[d])f.push(c);else{let o=FE(r);return{file:zs.of(`${o}.yml`),endpointId:n,tag:r}}}if(f.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:zs.of(FE(f.join("_"))+".yml"),endpointId:FE(a.slice(f.length).join("_")),tag:r}}function N0i(e){let t=e.tags[0];if(e.sdkName!=null){let r=klu({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===(t==null?void 0:t.toLowerCase().replaceAll(" ",""));return{file:zs.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return xQ1({namespaceOverride:e.namespace,location:TQ1(e)})}function A0i(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=X8t(t),t}var qQ1=new RegExp("[^a-zA-Z0-9{}]+"),CQ1=new RegExp("[{}]","g");function AQ1({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(qQ1).join("_").replaceAll(CQ1,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:zs.of(FE(t)+".yml"),endpointId:FE(e.slice(0,-1*a.length)),tag:t}}function Zqf(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:u,file:f,tag:d}=N0i(a),c=f.split(".")[0];c!=null&&t.add(c);let o;if(a.sdkName!=null){let O=e.ir.groups;for(let j of a.sdkName.groupName){let S=typeof j=="string"?j:j.name,x=O[S];if(x==null)break;if(x.summary!=null||x.description!=null){o=O[S];break}}}let l=d==null?void 0:n.tagsById[d],g=Xqf({context:e,endpoint:a,declarationFile:f});i=[...i,...g.schemaIdsToExclude],e.builder.addEndpoint(f,{name:u,schema:g.value,source:a.source}),((l==null?void 0:l.id)!=null||(l==null?void 0:l.description)!=null)&&e.builder.setServiceInfo(f,{displayName:(o==null?void 0:o.summary)??(l==null?void 0:l.id),docs:(o==null?void 0:o.description)??(l==null?void 0:l.description)??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function kqf(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?bEr(r.groupName):void 0,i=S1({schema:ib.primitive(r),context:e,fileContainingReference:zs.of(HT),namespace:n});e.builder.addVariable({name:t,schema:{type:A2(i),docs:r.description??void 0}})}}function eCf(e){for(let t of e.ir.webhooks){let r=BQ1({webhook:t,context:e});if(r==null)continue;let n=z1a(t.sdkName,t.namespace),i={};for(let u of t.headers)i[u.name]=IRt({header:u,context:e,fileContainingReference:r.file,namespace:n});let a={method:t.method,"display-name":t.summary??void 0,headers:i,payload:S1({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:lG(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function NQ1({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:pf(zs.of(t),e.file)}:e}function zQ1({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:zs.of(HT),endpointId:n};let i=A0i(r),a=A0i(n);if(iDr(i,a))return{file:zs.of("__package__.yml"),endpointId:r};let u=[];for(let f=0;f<i.length;++f){let d=i[f];if(d!=null&&d===a[f])u.push(d);else{let c=FE(r);return{file:zs.of(`${c}.yml`),endpointId:n,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:zs.of(FE(u.join("_"))+".yml"),endpointId:FE(a.slice(u.length).join("_")),tag:r}}function BQ1({webhook:e,context:t}){return e.sdkName!=null?{file:Jdf({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:NQ1({namespaceOverride:e.namespace,location:zQ1({webhook:e,context:t})})}var IQ1=zs.of(HT);function tCf(e){switch(e.type){case"object":return bFt(e.groupName);case"enum":return bFt(e.groupName);case"oneOf":return bFt(e.value.groupName);case"array":return bFt(e.groupName);case"map":return bFt(e.groupName);case"reference":return bFt(e.groupName);case"literal":return bFt(e.groupName);case"optional":return bFt(e.groupName);case"nullable":return bFt(e.groupName);case"primitive":return bFt(e.groupName);case"unknown":return IQ1;default:Ol(e)}}function bFt(e){return W7n(e)}var tOu="external",Qqf=zs.of(HT);function rCf({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let u=tCf(a),f=Xdf({schema:a,context:n,declarationFile:u,namespace:r});if(W2n(f.schema)){let d=A2(f.schema);if(d===(f.name??i)||d===`optional<${f.name??i}>`)continue}n.builder.addType(u,{name:f.name??i,schema:f.schema})}}function nCf(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Wqf(e),Hqf(e),$qf(e),epf(e),kqf(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(tOu);let{schemaIdsToExclude:t,sdkGroups:r}=Zqf(e);eCf(e);for(let n of e.ir.channel){let i=W7n(n.groupName);Fqf({channel:n,context:e,declarationFile:i})}rCf({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:t,namespace:void 0,context:e});for(let[n,i]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))rCf({schemas:i,schemaIdsToExclude:t,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(i=>r.has(i))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}var Fzr=yu(require("path"),1);var I1a=yu(require("path"),1),G3n=class{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[u,f]of Object.entries(n.files)){let d=i!=null?zs.of(`${i}${I1a.default.sep}${u}`):zs.of(u);t[d]=f}let a=Object.keys(n.directories).sort();for(let u of a){let f=i!=null?`${i}${I1a.default.sep}${u}`:u,d=n.directories[u];r(d,f)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(I1a.default.sep))}getOrCreateFileRecursive(t){var i,a;if(t.length===1)return(i=this.files)[a=zs.of(t[0])]??(i[a]={});let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new G3n),this.directories[r].getOrCreateFileRecursive(n)}};var R1a=class{modifyBasePaths;enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t,r,n){this.modifyBasePaths=r,this.enableUniqueErrorsPerEndpoint=n,this.root=new G3n,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}},t.title!=null&&(this.rootApiFile["display-name"]=t.title)}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{displayName:r,docs:n}){let i=this.getOrCreateFile(t);i.service==null&&(i.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(i.service["display-name"]=r),n!=null&&(i.docs=n)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return ADr(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{}),r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r}){if(t===r)return;let n=FE((Cg(r)+"/"+(0,Fzr.basename)(r,(0,Fzr.extname)(r))).replaceAll("__package__","root"));if(t===zs.of(nB))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=YN(Cg(I_.of(`/${t}`)),I_.of(`/${r}`)),n;let i=this.getOrCreateFile(t);return i.imports==null&&(i.imports={}),i.imports[n]=YN(Cg(I_.of(`/${t}`)),I_.of(`/${r}`)),n}addType(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){var a;let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:((a=i.errors[r])==null?void 0:a.type)!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){var f;let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(d=>iDr(d,n))??!1)||(f=a.examples)==null||f.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=Ien(i)),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=Fzr.default.join(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles();if(this.modifyBasePaths){let i=RQ1(this.rootApiFile);this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([a,u])=>[a,{...u,path:`${i}${u.path}`}]))});for(let a of Object.values(t))a.service!=null&&(a.service={...a.service,endpoints:Object.fromEntries(Object.entries(a.service.endpoints).map(([u,f])=>[u,{...f,path:`${i}${f.path}`}]))});this.rootApiFile.environments!=null&&(this.rootApiFile.environments={...Object.fromEntries(Object.entries(this.rootApiFile.environments).map(([a,u])=>typeof u=="string"?[a,u.substring(0,u.length-i.length)]:iCf(u)?[a,{url:u.url.substring(0,u.url.length-i.length)}]:[a,{urls:Object.fromEntries(Object.entries(u.urls).map(([f,d])=>[f,d.substring(0,d.length-i.length)]))}]))})}let r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:Fzr.default.join(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,u])=>[a,{...u,path:Fzr.default.join(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===HT?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function RQ1(e){if(e.environments==null)return"";let t=Object.entries(e.environments).flatMap(([r,n])=>typeof n=="string"?[n]:iCf(n)?[n.url]:Object.values(n.urls));return LQ1(t.map(FQ1))}function FQ1(e){try{let r=new URL(e).pathname;return r.endsWith("/")?r.slice(0,-1):r}catch{return""}}function LQ1(e){let t="";for(;;){let r=e.map(i=>i[i.length-t.length-1]),n=r[0];if(n==null||r.some(i=>i!==n))break;t=n+t}return t}function iCf(e){return e.url!=null}var F1a=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;detectGlobalHeaders;defaultServerName=void 0;constructor({taskContext:t,ir:r,enableUniqueErrorsPerEndpoint:n,detectGlobalHeaders:i,environmentOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.builder=new R1a(r,!1,n),this.detectGlobalHeaders=i,this.environmentOverrides=a,this.authOverrides=u}getSchema(t,r){var n;return r==null?this.ir.groupedSchemas.rootSchemas[t]:(n=this.ir.groupedSchemas.namespacedSchemas[r])==null?void 0:n[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}};function rOu(e){let t=new F1a(e);return nCf(t)}var CAf=yu(qAf(),1);async function iwe(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...u}={}){var o,l;let f=i.reduce((g,O)=>({...g,[O]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[g,O]of Object.entries(f))d=d.replaceAll(g,O);e==null||e.debug(`+ ${d}`);let c=(0,CAf.default)(t,r,u);return n||((o=c.stdout)==null||o.pipe(process.stdout),(l=c.stderr)==null||l.pipe(process.stderr)),c}function G1a(e,{logger:t,...r}={}){return(n,i)=>iwe(t,e,n,{...r,...i})}var Y1a=require("fs/promises"),AAf=yu(Jte(),1),Ak1="buf.gen.yaml",NAf="output",Nk1=`${NAf}/openapi.yaml`,zk1=`
|
|
1907
|
+
`)),{ok:!0,value:t}):n}}function e0a(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var g5r=class extends Error{errors;constructor(t){super(t.map(e0a).join("; ")),this.errors=t,Object.setPrototypeOf(this,g5r.prototype)}};var m5r=class extends Error{errors;constructor(t){super(t.map(e0a).join("; ")),this.errors=t,Object.setPrototypeOf(this,m5r.prototype)}};function hA(e){return{optional:()=>$lu(e),transform:t=>Jlu(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new m5r(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new g5r(n.errors)}}}function $lu(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>(n==null?void 0:n.omitUndefined)&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>VS.OPTIONAL};return{...t,...hA(t)}}function Jlu(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...hA(r)}}var A01=/^([+-]?\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 hdf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:rC(t,"string")}]}:A01.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:rC(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:rC(t,"Date object")}]},getType:()=>VS.DATE};return{...YJ(e),...hA(e)}}function XJ(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...YJ(r),...hA(r)}}}function t0a(e){let t=new Set(e);return XJ(VS.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:rC(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:rC(n,"enum")}]}:{ok:!0,value:n})()}function ydf(e){let t=Glu(e);return{...t,...hA(t)}}function Glu(e){return{parse:(t,r)=>m7n(e).parse(t,r),json:(t,r)=>m7n(e).json(t,r),getType:()=>m7n(e).getType()}}function m7n(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function T_i(e){return Object.entries(e)}function q_i(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function O5r(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 C_i(e){return Object.keys(e)}function vdf(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function NRt(e){return{withParsedProperties:t=>Klu(e,t)}}function Klu(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let u=Object.entries(t).reduce((f,[d,c])=>({...f,[d]:typeof c=="function"?c(a.value):c}),{});return{ok:!0,value:{...a.value,...u}}},json:(n,i)=>{if(!O5r(n))return{ok:!1,errors:[{path:(i==null?void 0:i.breadcrumbsPrefix)??[],message:rC(n,"object")}]};let a=new Set(Object.keys(t)),u=q_i(n,Object.keys(n).filter(f=>!a.has(f)));return e.json(u,i)},getType:()=>e.getType()};return{...r,...hA(r),...NRt(r)}}function bdf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function P5r(e){return e.isProperty}function r0a(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>P5r(n)?n.rawKey:r),_getParsedProperties:()=>C_i(e),parse:(r,n)=>{let i={},a=[];for(let[u,f]of T_i(e)){let d=P5r(f)?f.rawKey:u,c=P5r(f)?f.valueSchema:f,o={rawKey:d,parsedKey:u,valueSchema:c};i[d]=o,Odf(c)&&a.push(d)}return gdf({value:r,requiredKeys:a,getProperty:u=>{let f=i[u];if(f!=null)return{transformedKey:f.parsedKey,transform:d=>f.valueSchema.parse(d,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],u]})}},unrecognizedObjectKeys:n==null?void 0:n.unrecognizedObjectKeys,skipValidation:n==null?void 0:n.skipValidation,breadcrumbsPrefix:n==null?void 0:n.breadcrumbsPrefix,omitUndefined:n==null?void 0:n.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,u]of T_i(e)){let f=P5r(u)?u.valueSchema:u;Odf(f)&&i.push(a)}return gdf({value:r,requiredKeys:i,getProperty:a=>{let u=e[a];if(u!=null)return P5r(u)?{transformedKey:u.rawKey,transform:f=>u.valueSchema.json(f,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],a]})}:{transformedKey:a,transform:f=>u.json(f,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],a]})}},unrecognizedObjectKeys:n==null?void 0:n.unrecognizedObjectKeys,skipValidation:n==null?void 0:n.skipValidation,breadcrumbsPrefix:n==null?void 0:n.breadcrumbsPrefix,omitUndefined:n==null?void 0:n.omitUndefined})},getType:()=>VS.OBJECT};return{...YJ(t),...hA(t),...NRt(t),...O7n(t)}}function gdf({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!O5r(e))return{ok:!1,errors:[{path:a,message:rC(e,"object")}]};let u=new Set(t),f=[],d={};for(let[c,o]of Object.entries(e)){let l=r(c);if(l!=null){u.delete(c);let g=l.transform(o);g.ok?d[l.transformedKey]=g.value:(d[c]=o,f.push(...g.errors))}else switch(n){case"fail":f.push({path:[...a,c],message:`Unexpected key "${c}"`});break;case"strip":break;case"passthrough":d[c]=o;break}}return f.push(...t.filter(c=>u.has(c)).map(c=>({path:a,message:`Missing required key "${c}"`}))),f.length===0||i?{ok:!0,value:d}:{ok:!1,errors:f}}function O7n(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>mdf({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>mdf({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>VS.OBJECT};return{...r,...hA(r),...NRt(r),...O7n(r)}}}}function mdf({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,u]=vdf(C_i(t),c=>i.has(c)),f=r(q_i(t,u)),d=n(q_i(t,a));return f.ok&&d.ok?{ok:!0,value:{...f.value,...d.value}}:{ok:!1,errors:[...f.ok?[]:f.errors,...d.ok?[]:d.errors]}}function Odf(e){return!N01(e)}function N01(e){switch(e.getType()){case VS.ANY:case VS.UNKNOWN:case VS.OPTIONAL:return!0;default:return!1}}function Pdf(e){return r0a(e)}function jdf(e){let t={...Glu(e),_getRawProperties:()=>m7n(e)._getRawProperties(),_getParsedProperties:()=>m7n(e)._getParsedProperties()};return{...t,...hA(t),...NRt(t),...O7n(t)}}function n0a(e){let t={parse:(r,n)=>wdf(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],`[${a}]`]})),json:(r,n)=>wdf(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...(n==null?void 0:n.breadcrumbsPrefix)??[],`[${a}]`]})),getType:()=>VS.LIST};return{...YJ(t),...hA(t)}}function wdf(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:rC(e,"list"),path:[]}]}}function Ddf(e){return XJ(VS.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:rC(r,`"${e}"`)}]})()}function Sdf(e){return XJ(VS.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:rC(r,`${e.toString()}`)}]})()}var Edf=XJ(VS.ANY,e=>({ok:!0,value:e}));var Mdf=XJ(VS.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"boolean")}]});var xdf=XJ(VS.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"number")}]});var Tdf=XJ(VS.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rC(e,"string")}]});var qdf=XJ(VS.UNKNOWN,e=>({ok:!0,value:e}));function Adf(e,t){let r={parse:(n,i)=>Cdf({value:n,isKeyNumeric:e.getType()===VS.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${u}`]}),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(n,i)=>Cdf({value:n,isKeyNumeric:e.getType()===VS.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...i,breadcrumbsPrefix:[...(i==null?void 0:i.breadcrumbsPrefix)??[],`${u}`]}),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>VS.RECORD};return{...YJ(r),...hA(r)}}function Cdf({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return O5r(e)?T_i(e).reduce((a,[u,f])=>{if(f==null)return a;let d=a,c=u;if(t){let O=u.length>0?Number(u):NaN;isNaN(O)||(c=O)}let o=r(c),l=n(f,c);if(d.ok&&o.ok&&l.ok)return{ok:!0,value:{...d.value,[o.value]:l.value}};let g=[];return d.ok||g.push(...d.errors),o.ok||g.push(...o.errors),l.ok||g.push(...l.errors),{ok:!1,errors:g}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:rC(e,"object")}]}}function Ndf(e){let t=n0a(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:(i==null?void 0:i.breadcrumbsPrefix)??[],message:rC(n,"Set")}]},getType:()=>VS.SET};return{...YJ(r),...hA(r)}}function Bdf(e){let t={parse:(r,n)=>zdf((i,a)=>i.parse(r,a),e,n),json:(r,n)=>zdf((i,a)=>i.json(r,a),e,n),getType:()=>VS.UNDISCRIMINATED_UNION};return{...YJ(t),...hA(t)}}function zdf(e,t,r){let n=[];for(let[i,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let f of u.errors)n.push({path:f.path,message:`[Variant ${i}] ${f.message}`})}return{ok:!1,errors:n}}function Idf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Fdf(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=t0a(C_i(t)),a={parse:(u,f)=>Rdf({value:u,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:d=>i.parse(d,{allowUnrecognizedEnumValues:f==null?void 0:f.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(f==null?void 0:f.breadcrumbsPrefix)??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:f==null?void 0:f.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,c)=>c.parse(d,f),breadcrumbsPrefix:f==null?void 0:f.breadcrumbsPrefix}),json:(u,f)=>Rdf({value:u,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:d=>i.json(d,{allowUnrecognizedEnumValues:f==null?void 0:f.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(f==null?void 0:f.breadcrumbsPrefix)??[],n]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:f==null?void 0:f.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,c)=>c.json(d,f),breadcrumbsPrefix:f==null?void 0:f.breadcrumbsPrefix}),getType:()=>VS.UNION};return{...YJ(a),...hA(a),...NRt(a)}}function Rdf({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:f=[]}){if(!O5r(e))return{ok:!1,errors:[{path:f,message:rC(e,"object")}]};let{[t]:d,...c}=e;if(d==null)return{ok:!1,errors:[{path:f,message:`Missing discriminant ("${t}")`}]};let o=n(d);if(!o.ok)return{ok:!1,errors:o.errors};let l=i(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...c}}:{ok:!1,errors:[{path:[...f,t],message:"Unexpected discriminant value"}]};let g=u(c,l);return g.ok?{ok:!0,value:{[r]:d,...g.value}}:g}var j1=Wn.objectWithoutOptionalProperties({title:Wn.string().optional()});var i0a=Wn.objectWithoutOptionalProperties({file:Wn.string()});var a0a=Wn.objectWithoutOptionalProperties({file:Wn.string()});var o0a=Wn.union("type",{openapi:i0a,protobuf:a0a}).transform({transform:e=>{switch(e.type){case"openapi":return HSr.openapi(e);case"protobuf":return HSr.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var hb=Wn.objectWithoutOptionalProperties({source:o0a.optional()});var u0a=Wn.objectWithoutOptionalProperties({typeName:Wn.string()});var s0a=Wn.union("type",{protobuf:u0a}).transform({transform:e=>{switch(e.type){case"protobuf":return b7n.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ene=Wn.objectWithoutOptionalProperties({encoding:s0a.optional()});var O_=Wn.objectWithoutOptionalProperties({description:Wn.string().optional()});var c0a=Wn.enum_(["GenerallyAvailable","Beta","Deprecated"]);var Z0=Wn.objectWithoutOptionalProperties({availability:c0a.optional()});var Ym=Wn.objectWithoutOptionalProperties({nameOverride:Wn.string().optional(),generatedName:Wn.string()});var wQ=Wn.string();var Kje=Wn.string();var l0a=Wn.objectWithoutOptionalProperties({id:Kje}).extend(O_);var f0a=Wn.string();var d0a=Wn.objectWithoutOptionalProperties({usernameVariableName:Wn.string().optional(),usernameEnvVar:Wn.string().optional(),passwordVariableName:Wn.string().optional(),passwordEnvVar:Wn.string().optional()});var p0a=Wn.objectWithoutOptionalProperties({tokenVariableName:Wn.string().optional(),tokenEnvVar:Wn.string().optional()});var _0a=Wn.objectWithoutOptionalProperties({headerName:Wn.string(),prefix:Wn.string().optional(),headerVariableName:Wn.string().optional(),headerEnvVar:Wn.string().optional()});var h0a=Wn.objectWithoutOptionalProperties({queryParameterName:Wn.string()});var y0a=Wn.objectWithoutOptionalProperties({snake:Wn.string().optional(),camel:Wn.string().optional(),screamingSnake:Wn.string().optional(),pascal:Wn.string().optional()});var j5r=Wn.objectWithoutOptionalProperties({nameOverride:Wn.string().optional(),generatedName:Wn.string(),value:Wn.string(),casing:y0a.optional()}).extend(O_).extend(Z0);var v0a=Wn.objectWithoutOptionalProperties({type:Wn.stringLiteral("namespace"),name:Wn.string()});var b0a=Wn.undiscriminatedUnion([Wn.string(),v0a]);var w5r=Wn.list(b0a);var w1=Wn.objectWithoutOptionalProperties({groupName:w5r.optional()});var P7n=Wn.objectWithoutOptionalProperties({default:j5r.optional(),values:Wn.list(j5r)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var g0a=Wn.objectWithoutOptionalProperties({scopesEnum:P7n.optional()});var m0a=Wn.union("type",{basic:d0a,bearer:p0a,header:_0a,query:h0a,oauth:g0a}).transform({transform:e=>{switch(e.type){case"basic":return F9.basic(e);case"bearer":return F9.bearer(e);case"header":return F9.header(e);case"query":return F9.query(e);case"oauth":return F9.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var D5r=Wn.number();var O0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),url:Wn.string(),audiences:Wn.list(Wn.string()).optional()}).extend(O_);var P0a=Wn.string();var S5r=Wn.objectWithoutOptionalProperties({namespace:Wn.string().optional()});var Xlu={};Wb(Xlu,{FullExample:()=>yA,FullObjectExample:()=>w0a,FullOneOfExample:()=>S0a,KeyValuePair:()=>D0a,LiteralExample:()=>j0a,PrimitiveExample:()=>w7n,PropertyKey:()=>j7n});var j7n=Wn.string();var w7n=Wn.union("type",{int:Wn.object({value:Wn.number()}),int64:Wn.object({value:Wn.number()}),uint:Wn.object({value:Wn.number()}),uint64:Wn.object({value:Wn.number()}),float:Wn.object({value:Wn.number()}),double:Wn.object({value:Wn.number()}),string:Wn.object({value:Wn.string()}),datetime:Wn.object({value:Wn.string()}),date:Wn.object({value:Wn.string()}),base64:Wn.object({value:Wn.string()}),boolean:Wn.object({value:Wn.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return t0.int(e.value);case"int64":return t0.int64(e.value);case"uint":return t0.uint(e.value);case"uint64":return t0.uint64(e.value);case"float":return t0.float(e.value);case"double":return t0.double(e.value);case"string":return t0.string(e.value);case"datetime":return t0.datetime(e.value);case"date":return t0.date(e.value);case"base64":return t0.base64(e.value);case"boolean":return t0.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var j0a=Wn.union("type",{boolean:Wn.object({value:Wn.boolean()}),string:Wn.object({value:Wn.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return g7n.boolean(e.value);case"string":return g7n.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var yA=Wn.union("type",{primitive:Wn.object({value:w7n}),object:Wn.lazyObject(()=>w0a),array:Wn.object({value:Wn.list(Wn.lazy(()=>yA))}),map:Wn.object({value:Wn.list(Wn.lazyObject(()=>D0a))}),enum:Wn.object({value:Wn.string()}),literal:Wn.object({value:j0a}),oneOf:Wn.object({value:Wn.lazy(()=>S0a)}),unknown:Wn.object({value:Wn.lazy(()=>yA)})}).transform({transform:e=>{switch(e.type){case"primitive":return RP.primitive(e.value);case"object":return RP.object(e);case"array":return RP.array(e.value);case"map":return RP.map(e.value);case"enum":return RP.enum(e.value);case"literal":return RP.literal(e.value);case"oneOf":return RP.oneOf(e.value);case"unknown":return RP.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var w0a=Wn.objectWithoutOptionalProperties({properties:Wn.record(j7n,Wn.lazy(()=>yA))});var D0a=Wn.objectWithoutOptionalProperties({key:w7n,value:Wn.lazy(()=>yA)});var S0a=Wn.union("type",{discriminated:Wn.object({value:Wn.record(j7n,Wn.lazy(()=>yA))}),undisciminated:Wn.object({value:Wn.lazy(()=>yA)})}).transform({transform:e=>{switch(e.type){case"discriminated":return v5r.discriminated(e.value);case"undisciminated":return v5r.undisciminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Qlu={};Wb(Qlu,{AllOfPropertyConflict:()=>I7n,ArraySchema:()=>fva,Availability:()=>c0a,BooleanSchema:()=>ava,CasingOverrides:()=>y0a,CommonProperty:()=>gva,CursorPagination:()=>H0a,CustomCodeSample:()=>V0a,CustomCodeSampleLanguage:()=>F0a,CustomCodeSampleSdk:()=>U0a,DiscriminatedOneOfSchema:()=>vva,DoubleSchema:()=>nva,Endpoint:()=>J0a,EndpointExample:()=>N7n,EndpointSdkName:()=>M5r,EnumSchema:()=>P7n,EnumValue:()=>j5r,ErrorExample:()=>z0a,FernExample:()=>I0a,FileResponse:()=>T7n,FileSchema:()=>x0a,FullEndpointExample:()=>W0a,GlobalHeader:()=>uva,Header:()=>E5r,HeaderExample:()=>A7n,HttpEndpointServer:()=>q7n,HttpError:()=>B0a,HttpMethod:()=>D7n,IdempotencyHeader:()=>sva,IntSchema:()=>tva,JsonRequest:()=>C0a,JsonResponse:()=>KSr,LiteralSchema:()=>B7n,LiteralSchemaValue:()=>cva,LongSchema:()=>rva,MapSchema:()=>dva,MultipartRequest:()=>x7n,MultipartRequestProperty:()=>q0a,MultipartSchema:()=>T0a,NullableSchema:()=>_va,ObjectProperty:()=>yva,ObjectPropertyConflictInfo:()=>R7n,ObjectSchema:()=>lva,OctetStreamRequest:()=>M7n,OffsetPagination:()=>$0a,OneOfSchema:()=>hva,OpenApiIntermediateRepresentation:()=>Ldf,OptionalSchema:()=>pva,Pagination:()=>z7n,PathParameter:()=>S7n,PathParameterExample:()=>R0a,PrimitiveSchema:()=>T5r,PrimitiveSchemaValue:()=>ova,QueryParameter:()=>E7n,QueryParameterExample:()=>C7n,ReferencedSchema:()=>zRt,Request:()=>A0a,Response:()=>N0a,Schema:()=>D1,Schemas:()=>eva,SdkGroupInfo:()=>E0a,StringSchema:()=>iva,SupportedSdkLanguage:()=>L0a,Tags:()=>M0a,TextResponse:()=>x5r,UnDiscriminatedOneOfSchema:()=>bva,Webhook:()=>Y0a,WebhookExampleCall:()=>K0a,WebhookHttpMethod:()=>G0a,WebsocketChannel:()=>k0a,WebsocketHandshake:()=>X0a,WebsocketMessageExample:()=>Q0a,WebsocketSessionExample:()=>Z0a});var E0a=Wn.objectWithoutOptionalProperties({summary:Wn.string().optional(),description:Wn.string().optional()});var M0a=Wn.objectWithoutOptionalProperties({tagsById:Wn.record(Kje,l0a),orderedTagIds:Wn.list(Kje).optional()});var D7n=Wn.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var S7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),variableReference:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var E7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var E5r=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>D1),env:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var M5r=Wn.objectWithoutOptionalProperties({groupName:w5r,methodName:Wn.string()});var M7n=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var x0a=Wn.objectWithoutOptionalProperties({isOptional:Wn.boolean(),isArray:Wn.boolean()});var T0a=Wn.union("type",{file:x0a,json:Wn.object({value:Wn.lazy(()=>D1)})}).transform({transform:e=>{switch(e.type){case"file":return D2e.file(e);case"json":return D2e.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var q0a=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:T0a,contentType:Wn.string().optional()}).extend(O_);var x7n=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),properties:Wn.list(q0a)}).extend(O_).extend(hb);var C0a=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1),contentType:Wn.string().optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(hb);var A0a=Wn.union("type",{octetStream:M7n,multipart:x7n,json:C0a}).transform({transform:e=>{switch(e.type){case"octetStream":return b5r.octetStream(e);case"multipart":return b5r.multipart(e);case"json":return b5r.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var T7n=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var KSr=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1),responseProperty:Wn.string().optional()}).extend(O_).extend(hb);var x5r=Wn.objectWithoutOptionalProperties({}).extend(O_).extend(hb);var N0a=Wn.union("type",{file:T7n,json:KSr,text:x5r,streamingSse:KSr,streamingText:x5r,streamingJson:KSr}).transform({transform:e=>{switch(e.type){case"file":return Sne.file(e);case"json":return Sne.json(e);case"text":return Sne.text(e);case"streamingSse":return Sne.streamingSse(e);case"streamingText":return Sne.streamingText(e);case"streamingJson":return Sne.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var z0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),description:Wn.string().optional(),example:Wn.lazy(()=>yA)});var B0a=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>D1).optional(),examples:Wn.list(z0a).optional()}).extend(O_).extend(Ym).extend(hb);var q7n=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),url:Wn.string().optional(),audiences:Wn.list(Wn.string()).optional()});var I0a=Wn.unknown();var R0a=Wn.objectWithoutOptionalProperties({name:Wn.string(),parameterNameOverride:Wn.string().optional(),value:Wn.lazy(()=>yA)});var C7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),value:Wn.lazy(()=>yA)});var A7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),value:Wn.lazy(()=>yA)});var F0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),language:Wn.string(),code:Wn.string(),install:Wn.string().optional()}).extend(O_);var L0a=Wn.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var U0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),sdk:L0a,code:Wn.string()}).extend(O_);var V0a=Wn.union("type",{language:F0a,sdk:U0a}).transform({transform:e=>{switch(e.type){case"language":return JSr.language(e);case"sdk":return JSr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var W0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),pathParameters:Wn.list(R0a).optional(),queryParameters:Wn.list(C7n).optional(),headers:Wn.list(A7n).optional(),request:Wn.lazy(()=>yA).optional(),response:Wn.lazy(()=>yA).optional(),codeSamples:Wn.list(V0a)}).extend(O_);var N7n=Wn.union("type",{unknown:Wn.object({value:I0a}),full:W0a}).transform({transform:e=>{switch(e.type){case"unknown":return pAt.unknown(e.value);case"full":return pAt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var H0a=Wn.objectWithoutOptionalProperties({cursor:Wn.string(),nextCursor:Wn.property("next_cursor",Wn.string()),results:Wn.string()});var $0a=Wn.objectWithoutOptionalProperties({offset:Wn.string(),results:Wn.string(),step:Wn.string().optional(),hasNextPage:Wn.string().optional()});var z7n=Wn.union("type",{cursor:H0a,offset:$0a}).transform({transform:e=>{switch(e.type){case"cursor":return $Sr.cursor(e);case"offset":return $Sr.offset(e);default:return e}},untransform:({_visit:e,...t})=>t});var J0a=Wn.objectWithoutOptionalProperties({authed:Wn.boolean(),internal:Wn.boolean().optional(),idempotent:Wn.boolean().optional(),method:D7n,audiences:Wn.list(Wn.string()),path:Wn.string(),summary:Wn.string().optional(),operationId:Wn.string().optional(),tags:Wn.list(Kje),pathParameters:Wn.list(S7n),queryParameters:Wn.list(E7n),headers:Wn.list(E5r),sdkName:M5r.optional(),generatedRequestName:Wn.string(),requestNameOverride:Wn.string().optional(),request:A0a.optional(),response:N0a.optional(),errors:Wn.record(D5r,B0a),server:Wn.list(q7n),examples:Wn.list(N7n),pagination:z7n.optional()}).extend(O_).extend(Z0).extend(hb).extend(S5r);var G0a=Wn.enum_(["GET","POST"]);var K0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),payload:Wn.lazy(()=>yA)}).extend(O_);var Y0a=Wn.objectWithoutOptionalProperties({sdkName:M5r.optional(),method:G0a,summary:Wn.string().optional(),operationId:Wn.string(),tags:Wn.list(Kje),headers:Wn.list(E5r),generatedPayloadName:Wn.string(),payload:Wn.lazy(()=>D1),examples:Wn.list(K0a)}).extend(O_).extend(hb).extend(S5r);var X0a=Wn.objectWithoutOptionalProperties({queryParameters:Wn.list(E7n),headers:Wn.list(E5r),pathParameters:Wn.list(S7n)});var Q0a=Wn.objectWithoutOptionalProperties({messageType:Wn.string(),payload:Wn.lazy(()=>yA)}).extend(O_);var Z0a=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),queryParameters:Wn.list(C7n).optional(),headers:Wn.list(A7n).optional(),messages:Wn.list(Q0a)}).extend(O_);var k0a=Wn.objectWithoutOptionalProperties({path:Wn.string(),groupName:w5r,summary:Wn.string().optional(),handshake:X0a,publish:Wn.lazy(()=>D1).optional(),subscribe:Wn.lazy(()=>D1).optional(),examples:Wn.list(Z0a)}).extend(O_).extend(hb);var eva=Wn.objectWithoutOptionalProperties({rootSchemas:Wn.record(wQ,Wn.lazy(()=>D1)),namespacedSchemas:Wn.record(P0a,Wn.record(wQ,Wn.lazy(()=>D1)))});var tva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional()});var rva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional()});var nva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional()});var iva=Wn.objectWithoutOptionalProperties({default:Wn.string().optional(),pattern:Wn.string().optional(),format:Wn.string().optional(),minLength:Wn.number().optional(),maxLength:Wn.number().optional()});var ava=Wn.objectWithoutOptionalProperties({default:Wn.boolean().optional()});var ova=Wn.union("type",{int:tva,int64:rva,uint:Wn.object({}),uint64:Wn.object({}),float:Wn.object({}),double:nva,string:iva,datetime:Wn.object({}),date:Wn.object({}),base64:Wn.object({}),boolean:ava}).transform({transform:e=>{switch(e.type){case"int":return Xw.int(e);case"int64":return Xw.int64(e);case"uint":return Xw.uint();case"uint64":return Xw.uint64();case"float":return Xw.float();case"double":return Xw.double(e);case"string":return Xw.string(e);case"datetime":return Xw.datetime();case"date":return Xw.date();case"base64":return Xw.base64();case"boolean":return Xw.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var T5r=Wn.objectWithoutOptionalProperties({schema:ova}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var uva=Wn.objectWithoutOptionalProperties({header:Wn.string(),name:Wn.string().optional(),optional:Wn.boolean().optional(),env:Wn.string().optional(),schema:Wn.lazy(()=>D1).optional()});var sva=Wn.objectWithoutOptionalProperties({header:Wn.string(),name:Wn.string().optional(),env:Wn.string().optional(),schema:Wn.lazy(()=>D1).optional()});var Ldf=Wn.objectWithoutOptionalProperties({apiVersion:Wn.unknown().optional(),title:Wn.string().optional(),description:Wn.string().optional(),basePath:Wn.string().optional(),servers:Wn.list(O0a),groups:Wn.record(Wn.string(),E0a),tags:M0a,hasEndpointsMarkedInternal:Wn.boolean(),endpoints:Wn.list(J0a),webhooks:Wn.list(Y0a),channel:Wn.list(k0a),groupedSchemas:eva,variables:Wn.record(Wn.string(),T5r),nonRequestReferencedSchemas:Wn.set(wQ),securitySchemes:Wn.record(f0a,m0a),globalHeaders:Wn.list(uva).optional(),idempotencyHeaders:Wn.list(sva).optional()});var zRt=Wn.objectWithoutOptionalProperties({schema:wQ}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var cva=Wn.union("type",{boolean:Wn.object({value:Wn.boolean()}),string:Wn.object({value:Wn.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return E7.boolean(e.value);case"string":return E7.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var B7n=Wn.objectWithoutOptionalProperties({value:cva}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var D1=Wn.union("type",{primitive:T5r,object:Wn.lazyObject(()=>lva),array:Wn.lazyObject(()=>fva),map:Wn.lazyObject(()=>dva),optional:Wn.lazyObject(()=>pva),enum:P7n,reference:zRt,literal:B7n,oneOf:Wn.object({value:Wn.lazy(()=>hva)}),nullable:Wn.lazyObject(()=>_va),unknown:Ym}).transform({transform:e=>{switch(e.type){case"primitive":return ib.primitive(e);case"object":return ib.object(e);case"array":return ib.array(e);case"map":return ib.map(e);case"optional":return ib.optional(e);case"enum":return ib.enum(e);case"reference":return ib.reference(e);case"literal":return ib.literal(e);case"oneOf":return ib.oneOf(e.value);case"nullable":return ib.nullable(e);case"unknown":return ib.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var I7n=Wn.objectWithoutOptionalProperties({propertyKey:Wn.string(),allOfSchemaIds:Wn.list(wQ),conflictingTypeSignatures:Wn.boolean()});var lva=Wn.objectWithoutOptionalProperties({allOf:Wn.list(zRt),properties:Wn.list(Wn.lazyObject(()=>yva)),allOfPropertyConflicts:Wn.list(I7n),additionalProperties:Wn.boolean()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var R7n=Wn.objectWithoutOptionalProperties({differentSchema:Wn.boolean()});var yva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>D1),conflict:Wn.record(wQ,R7n),generatedName:Wn.string(),nameOverride:Wn.string().optional(),audiences:Wn.list(Wn.string())}).extend(Z0);var fva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var dva=Wn.objectWithoutOptionalProperties({key:T5r,value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(j1);var pva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var _va=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>D1)}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var hva=Wn.union("type",{discriminated:Wn.lazyObject(()=>vva),undisciminated:Wn.lazyObject(()=>bva)}).transform({transform:e=>{switch(e.type){case"discriminated":return GSr.discriminated(e);case"undisciminated":return GSr.undisciminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var vva=Wn.objectWithoutOptionalProperties({discriminantProperty:Wn.string(),commonProperties:Wn.list(Wn.lazyObject(()=>gva)),schemas:Wn.record(Wn.string(),Wn.lazy(()=>D1))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var gva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>D1)});var bva=Wn.objectWithoutOptionalProperties({schemas:Wn.list(Wn.lazy(()=>D1))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var Zlu={};Wb(Zlu,{ArraySchemaWithExample:()=>Lva,Base64WithExample:()=>zva,BooleanWithExample:()=>Bva,CommonPropertyWithExample:()=>Yva,DateWithExample:()=>Nva,DatetimeWithExample:()=>Ava,DiscriminatedOneOfSchemaWithExample:()=>Gva,DoubleWithExample:()=>qva,EndpointWithExample:()=>Vdf,EnumSchemaWithExample:()=>Rva,FloatWithExample:()=>Tva,HeaderWithExample:()=>L7n,HttpErrorWithExample:()=>Dva,Int64WithExample:()=>Eva,IntWithExample:()=>Sva,JsonRequestWithExample:()=>Ova,JsonResponseWithExample:()=>jva,MapSchemaWithExample:()=>Uva,NamedFullExample:()=>BRt,NullableSchemaWithExample:()=>Wva,ObjectPropertyWithExample:()=>Jva,ObjectSchemaWithExample:()=>Hva,OneOfSchemaWithExample:()=>$va,OptionalSchemaWithExample:()=>Vva,PathParameterWithExample:()=>mva,PrimitiveSchemaValueWithExample:()=>Iva,PrimitiveSchemaWithExample:()=>U7n,QueryParameterWithExample:()=>F7n,RequestWithExample:()=>Pva,ResponseWithExample:()=>wva,SchemaWithExample:()=>aq,StringSchemaWithExample:()=>Cva,Uint64WithExample:()=>xva,UintWithExample:()=>Mva,UnDiscriminatedOneOfSchemaWithExample:()=>Kva,UnknownSchemaWithExample:()=>Fva,WebsocketHandshakeWithExample:()=>Udf});var BRt=Wn.objectWithoutOptionalProperties({name:Wn.string().optional(),value:Wn.unknown()}).extend(O_);var F7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var L7n=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),env:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var Udf=Wn.objectWithoutOptionalProperties({queryParameters:Wn.list(F7n),headers:Wn.list(L7n)});var mva=Wn.objectWithoutOptionalProperties({name:Wn.string(),schema:Wn.lazy(()=>aq),variableReference:Wn.string().optional(),parameterNameOverride:Wn.string().optional()}).extend(O_).extend(Z0).extend(hb);var Ova=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>aq),contentType:Wn.string().optional(),fullExamples:Wn.list(BRt).optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(hb);var Pva=Wn.union("type",{octetStream:M7n,multipart:x7n,json:Ova}).transform({transform:e=>{switch(e.type){case"octetStream":return S2e.octetStream(e);case"multipart":return S2e.multipart(e);case"json":return S2e.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var jva=Wn.objectWithoutOptionalProperties({schema:Wn.lazy(()=>aq),responseProperty:Wn.string().optional(),fullExamples:Wn.list(BRt).optional()}).extend(O_).extend(hb);var wva=Wn.union("type",{file:T7n,json:jva,text:x5r,streamingSse:KSr,streamingText:x5r,streamingJson:KSr}).transform({transform:e=>{switch(e.type){case"file":return T3.file(e);case"json":return T3.json(e);case"text":return T3.text(e);case"streamingSse":return T3.streamingSse(e);case"streamingText":return T3.streamingText(e);case"streamingJson":return T3.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Dva=Wn.objectWithoutOptionalProperties({statusCode:D5r,schema:Wn.lazy(()=>aq),fullExamples:Wn.list(BRt).optional()}).extend(O_).extend(Ym).extend(hb);var Vdf=Wn.objectWithoutOptionalProperties({authed:Wn.boolean(),internal:Wn.boolean().optional(),idempotent:Wn.boolean().optional(),method:D7n,audiences:Wn.list(Wn.string()),path:Wn.string(),summary:Wn.string().optional(),operationId:Wn.string().optional(),tags:Wn.list(Kje),pathParameters:Wn.list(mva),queryParameters:Wn.list(F7n),headers:Wn.list(L7n),sdkName:M5r.optional(),generatedRequestName:Wn.string(),requestNameOverride:Wn.string().optional(),request:Pva.optional(),response:wva.optional(),errors:Wn.record(D5r,Dva),server:Wn.list(q7n),examples:Wn.list(N7n),pagination:z7n.optional()}).extend(O_).extend(Z0).extend(hb).extend(S5r);var Sva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional(),example:Wn.number().optional()});var Eva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var Mva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var xva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),example:Wn.number().optional()});var Tva=Wn.objectWithoutOptionalProperties({example:Wn.number().optional()});var qva=Wn.objectWithoutOptionalProperties({default:Wn.number().optional(),minimum:Wn.number().optional(),maximum:Wn.number().optional(),exclusiveMinimum:Wn.boolean().optional(),exclusiveMaximum:Wn.boolean().optional(),multipleOf:Wn.number().optional(),example:Wn.number().optional()});var Cva=Wn.objectWithoutOptionalProperties({default:Wn.string().optional(),pattern:Wn.string().optional(),format:Wn.string().optional(),minLength:Wn.number().optional(),maxLength:Wn.number().optional(),example:Wn.string().optional()});var Ava=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var Nva=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var zva=Wn.objectWithoutOptionalProperties({example:Wn.string().optional()});var Bva=Wn.objectWithoutOptionalProperties({default:Wn.boolean().optional(),example:Wn.boolean().optional()});var Iva=Wn.union("type",{int:Sva,int64:Eva,uint:Mva,uint64:xva,float:Tva,double:qva,string:Cva,datetime:Ava,date:Nva,base64:zva,boolean:Bva}).transform({transform:e=>{switch(e.type){case"int":return by.int(e);case"int64":return by.int64(e);case"uint":return by.uint(e);case"uint64":return by.uint64(e);case"float":return by.float(e);case"double":return by.double(e);case"string":return by.string(e);case"datetime":return by.datetime(e);case"date":return by.date(e);case"base64":return by.base64(e);case"boolean":return by.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var U7n=Wn.objectWithoutOptionalProperties({schema:Iva}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(j1);var Rva=Wn.objectWithoutOptionalProperties({default:j5r.optional(),values:Wn.list(j5r),example:Wn.string().optional()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var Fva=Wn.objectWithoutOptionalProperties({example:Wn.unknown()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var aq=Wn.union("type",{primitive:U7n,object:Wn.lazyObject(()=>Hva),array:Wn.lazyObject(()=>Lva),map:Wn.lazyObject(()=>Uva),optional:Wn.lazyObject(()=>Vva),enum:Rva,reference:zRt,literal:B7n,oneOf:Wn.object({value:Wn.lazy(()=>$va)}),nullable:Wn.lazyObject(()=>Wva),unknown:Fva}).transform({transform:e=>{switch(e.type){case"primitive":return Lp.primitive(e);case"object":return Lp.object(e);case"array":return Lp.array(e);case"map":return Lp.map(e);case"optional":return Lp.optional(e);case"enum":return Lp.enum(e);case"reference":return Lp.reference(e);case"literal":return Lp.literal(e);case"oneOf":return Lp.oneOf(e.value);case"nullable":return Lp.nullable(e);case"unknown":return Lp.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq),example:Wn.list(Wn.unknown()).optional()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Uva=Wn.objectWithoutOptionalProperties({key:U7n,value:Wn.lazy(()=>aq),example:Wn.unknown().optional()}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(Ene).extend(j1);var Vva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq)}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Wva=Wn.objectWithoutOptionalProperties({value:Wn.lazy(()=>aq)}).extend(w1).extend(Ym).extend(O_).extend(Z0).extend(j1);var Hva=Wn.objectWithoutOptionalProperties({allOf:Wn.list(zRt),properties:Wn.list(Wn.lazyObject(()=>Jva)),allOfPropertyConflicts:Wn.list(I7n),fullExamples:Wn.list(BRt).optional(),additionalProperties:Wn.boolean()}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(hb).extend(j1);var Jva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>aq),audiences:Wn.list(Wn.string()),conflict:Wn.record(wQ,R7n),nameOverride:Wn.string().optional(),generatedName:Wn.string()}).extend(Z0);var $va=Wn.union("type",{discriminated:Wn.lazyObject(()=>Gva),undisciminated:Wn.lazyObject(()=>Kva)}).transform({transform:e=>{switch(e.type){case"discriminated":return jQ.discriminated(e);case"undisciminated":return jQ.undisciminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Gva=Wn.objectWithoutOptionalProperties({discriminantProperty:Wn.string(),commonProperties:Wn.list(Wn.lazyObject(()=>Yva)),schemas:Wn.record(Wn.string(),Wn.lazy(()=>aq))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);var Yva=Wn.objectWithoutOptionalProperties({key:Wn.string(),schema:Wn.lazy(()=>aq)});var Kva=Wn.objectWithoutOptionalProperties({schemas:Wn.list(Wn.lazy(()=>aq))}).extend(O_).extend(Ym).extend(w1).extend(Z0).extend(Ene).extend(hb).extend(j1);function Xva(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Ol(e.type)}}function V7n(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:Ol(e)}}function A2(e){return typeof e=="string"?e:e.type}function A_i(e){if(typeof e!="string")return e.docs}function Wdf(e){if(typeof e!="string")return e.default}function Hdf(e){if(typeof e!="string")return e.validation}function z01(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function $df(e){let t=e?z01(e):void 0;if(t==null||t.length===0)return zui;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(FE(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(FE(i.name)):r.push(i.name,zui);break}default:Ol(i.type)}else Ol(i);return r.join("/")}function W7n(e){return zs.of(`${$df(e)}.yml`)}function klu({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?zui:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,$df(r))}function Jdf({sdkName:e,namespaceOverride:t}){return zs.of(`${klu({sdkName:e,namespaceOverride:t})}.yml`)}function Gdf({location:e,namespaceOverride:t}){return t!=null?pf(zs.of(t),e):e}function q3(e){switch(e){case vW.Deprecated:return"deprecated";case vW.Beta:return"pre-release";case vW.GenerallyAvailable:return"generally-available";default:return}}var B01=-2147483648,I01=2147483647,R01=-17976931348623157e292,F01=17976931348623157e292;function S1({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i}){switch(e.type){case"primitive":return Qva(e);case"array":return rfu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"map":return nfu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"reference":return tfu({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return afu();case"optional":case"nullable":return ifu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"enum":return K01({schema:e,fileContainingReference:t,context:n,declarationFile:r});case"literal":return e.value,ofu(e);case"object":return Y01({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i});case"oneOf":return X01({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i});default:Ol(e)}}function Qva(e){switch(e.schema.type){case"string":return V01({description:e.description,schema:e.schema});case"int":return W01({description:e.description,schema:e.schema});case"float":return H01({description:e.description,schema:e.schema});case"double":return $01({description:e.description,schema:e.schema});case"boolean":return L01({description:e.description,schema:e.schema});case"int64":return U01({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{...e.title!=null?{"display-name":e.title}:{},type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function L01({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function U01({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function V01({description:e,schema:t}){let r="string",n=J01(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function W01({description:e,schema:t}){let r="integer",n=Kdf(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function H01({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function $01({description:e,schema:t}){let r="double",n=Kdf(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function J01(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=G01(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function G01(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function Kdf(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=efu(r,t),n=efu(n,t),i=efu(i,t),!(r==null&&n==null&&a==null&&u==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:u,multipleOf:i}}function efu(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[B01,I01]:[R01,F01];return e<r||e>n?void 0:e}function tfu({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=Q01(i)??e.schema,u=V7n(i),f=Z01(i),d=Zva({context:r,fileContainingReference:t,declarationFile:W7n(u),type:a}),c=i.type==="nullable"?`optional<${d}>`:d;return e.description==null&&f==null?c:{...f!=null?{"display-name":f}:{},type:i.type==="nullable"?`optional<${d}>`:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function rfu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),u=`list<${A2(a)}>`;return e.description==null&&e.title==null?u:{...e.title!=null?{"display-name":e.title}:{},...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{},type:u}}function nfu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=Qva(e.key),u=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),f=e.encoding!=null?Xva(e.encoding):void 0,d=`map<${A2(a)}, ${A2(u)}>`;if(e.description==null&&f==null&&e.title==null)return d;let c={type:d};return e.description!=null&&(c.docs=e.description),e.encoding!=null&&(c.encoding=f),e.title!=null&&(c["display-name"]=e.title),e.availability!=null&&(c.availability=q3(e.availability)),c}function ifu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=S1({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i}),u=A2(a),f=A_i(a),d=Wdf(a),c=Hdf(a),o=u.startsWith("optional<")?u:`optional<${u}>`;if(e.availability==null&&e.description==null&&f==null&&d==null&&c==null&&e.title==null)return o;let l={type:o};return(e.description!=null||f!=null)&&(l.docs=e.description??f),d!=null&&(l.default=d),c!=null&&(l.validation=c),e.title!=null&&(l["display-name"]=e.title),e.availability!=null&&(l.availability=q3(e.availability)),l}function afu(){return"unknown"}function ofu(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ol(e.value)}return e.description==null&&e.title==null?t:{...e.title!=null?{"display-name":e.title}:{},type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function K01({schema:e,fileContainingReference:t,declarationFile:r,context:n}){let i=N_i(e),a=e.nameOverride??e.generatedName;n.builder.addType(r,{name:a,schema:i.schema});let u=Zva({type:a,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return u;let f={type:u};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.title!=null&&(f["display-name"]=e.title),e.availability!=null&&(f.availability=q3(e.availability)),f}function Y01({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=ufu({schema:e,declarationFile:r,context:n,namespace:i}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let f=Zva({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function X01({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i}){let a=sfu({schema:e,declarationFile:r,context:n,namespace:i}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let f=Zva({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:q3(e.availability)}:{}}}function Zva({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function Q01(e){return ib._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function Z01(e){return ib._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}function Ien(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ol(e)}}function Xdf({schema:e,context:t,declarationFile:r,namespace:n}){switch(e.type){case"primitive":return tv1(e);case"array":return k01({schema:e,context:t,declarationFile:r,namespace:n});case"map":return ev1({schema:e,context:t,declarationFile:r,namespace:n});case"reference":return rv1({schema:e,context:t,declarationFile:r,namespace:n});case"unknown":return iv1(e.nameOverride,e.generatedName);case"optional":case"nullable":return nv1({schema:e,context:t,declarationFile:r,namespace:n});case"enum":return N_i(e);case"literal":return av1(e,e.nameOverride,e.generatedName);case"object":return ufu({schema:e,context:t,declarationFile:r,namespace:n});case"oneOf":return sfu({schema:e.value,context:t,declarationFile:r,namespace:n});default:Ol(e)}}function ufu({schema:e,context:t,declarationFile:r,namespace:n}){let i={},a=new Set;for(let c of e.properties){if(Object.keys(c.conflict).length>0){if(Object.entries(c.conflict).every(([S,x])=>!x.differentSchema))continue;Object.entries(c.conflict).forEach(([S])=>{cfu({property:c.key,schemaId:S,context:t,namespace:n}).forEach(A=>{a.add(A)})})}let o=S1({schema:c.schema,context:t,fileContainingReference:r,namespace:n}),l=c.audiences,g=c.nameOverride,O=q3(c.availability);i[c.key]=sv1(o,l,g,O)}let u=new Set;for(let c of e.allOfPropertyConflicts)c.allOfSchemaIds.forEach(o=>a.add(o)),c.conflictingTypeSignatures&&u.add(c.propertyKey);let f=[];for(let c of e.allOf){let o=Qdf({schema:c.schema,context:t,namespace:n});if(o==null||a.has(c.schema)||a.has(o))continue;let l=S1({schema:ib.reference(c),context:t,fileContainingReference:r,namespace:n});f.push(A2(l))}for(let c of a){let o=lfu(t,c,n);for(let l of o.properties)i[l.key]==null&&(u.has(l.key)&&(i[l.key]="unknown"),i[l.key]=S1({schema:l.schema,context:t,fileContainingReference:r,namespace:n}));for(let l of o.allOf){if(a.has(l.schema))continue;let g=S1({schema:ib.reference(l),context:t,fileContainingReference:r,namespace:n});f.push(A2(g))}}let d={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(i).map(([c,o])=>uv1(c)?[c,typeof o=="string"?{type:o,name:`_${c}`}:{...o,name:`_${c}`}]:[c,o]))};return f.length>0&&(d.extends=f),e.additionalProperties&&(d["extra-properties"]=!0),e.availability!=null&&(d.availability=q3(e.availability)),e.source!=null&&(d.source=Ien(e.source)),{name:e.nameOverride??e.generatedName,schema:d}}function cfu({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return cfu({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:u}=lfu(r,t,n),f=a.some(c=>c.key===e),d=[...u.flatMap(c=>cfu({property:e,context:r,schemaId:c.schema,namespace:n}))];if(f||d.length>0)return[t,...d]}return[]}function lfu(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return lfu(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function k01({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:rfu({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n})}}function ev1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:nfu({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n})}}function tv1(e){let t=Qva(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function Ydf(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function N_i(e){let t={enum:e.values.map(i=>{let a=i.nameOverride??i.generatedName,u=i.value;if(a===u&&i.description==null&&(i.casing==null||Ydf(i.casing)))return a;let f={value:i.value};if(a!==u&&(f.name=a),i.description!=null&&(f.docs=i.description),i.casing!=null&&!Ydf(i.casing)){let d={},c=!1;i.casing.camel!=null&&(d.camel=i.casing.camel,c=!0),i.casing.screamingSnake!=null&&(d["screaming-snake"]=i.casing.screamingSnake,c=!0),i.casing.snake!=null&&(d.snake=i.casing.snake,c=!0),i.casing.pascal!=null&&(d.pascal=i.casing.pascal,c=!0),c&&(f.casing=d)}return f})};e.description!=null&&(t.docs=e.description),e.default!=null&&(t.default=e.default.value);let r=new Set,n={...t,enum:[],source:e.source!=null?Ien(e.source):void 0};for(let i of t.enum){let a=typeof i=="string"?i:i.name??i.value;r.has(a.toLowerCase())||(n.enum.push(i),r.add(a.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function rv1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:tfu({schema:e,context:t,fileContainingReference:r,namespace:n})}}function nv1({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:ifu({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n})}}function iv1(e,t){return{name:e??t,schema:afu()}}function av1(e,t,r){return{name:t??r,schema:ofu(e)}}function sfu({schema:e,context:t,declarationFile:r,namespace:n}){let i=e.encoding!=null?Xva(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let d of e.commonProperties)u[d.key]=S1({schema:d.schema,fileContainingReference:r,context:t,namespace:n});let f={};for(let[d,c]of Object.entries(e.schemas))f[d]=S1({schema:c,context:t,fileContainingReference:r,namespace:n});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?q3(e.availability):void 0,union:f,encoding:i,source:e.source!=null?Ien(e.source):void 0}}}let a=[];for(let u of e.schemas)a.push(S1({schema:u,fileContainingReference:r,context:t,namespace:n}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:i,source:e.source!=null?Ien(e.source):void 0}}}var ov1=/^[0-9]/;function uv1(e){return ov1.test(e)}function Qdf({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?Qdf({context:t,schema:n.schema,namespace:r}):e}function sv1(e,t,r,n){return t.length===0&&r==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{}}}function Zdf(e){let t=e.replace(/^x-|^X-/,"");return FE(t)}var kdf="BasicAuthScheme",kva="BearerAuthScheme";function epf(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:kdf,schema:i}),t||(e.builder.setAuth(kdf),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:kva,schema:i}),t||(e.builder.setAuth(kva),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??Zdf(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:kva,schema:i}),t||(e.builder.setAuth(kva),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(zs.of("__package__.yml"),{name:"OauthScope",schema:N_i(n.scopesEnum).schema})}}function IRt({header:e,context:t,fileContainingReference:r,namespace:n}){let i=S1({schema:e.schema,context:t,fileContainingReference:r,namespace:n}),a=A2(i),u=e.name.replace(/^x-|^X-/,""),f=e.parameterNameOverride!=null?e.parameterNameOverride:FE(u);if(e.description==null&&e.name===f&&e.env==null&&e.availability==null)return a;let d={type:a};return f!==e.name&&(d.name=f),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=q3(e.availability)),d}function eba({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=S1({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(e.variableReference==null&&e.description==null&&e.availability==null)return A2(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:A2(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=q3(e.availability)),a}var Zmu=require("fs/promises");var tpf={naming:"v1"};function Lh(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function RRt(e,t,r,n,i=[]){try{let a=Lh(e,t);if(a!=null)return r.parse(a)}catch{let u=X8t(i).join(" -> ");n.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}var tba={of(e){return e}};var kh={SDK_METHOD_NAME:tba.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:tba.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:tba.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport"};function gy(e){return e.$ref!=null}function E2e(e){switch(Lh(e,kh.AVAILABILITY)){case"deprecated":return vW.Deprecated;case"beta":return vW.Beta;case"generally-available":return vW.GenerallyAvailable;default:break}if(!gy(e)&&e.deprecated)return vW.Deprecated}var Yje={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};function rpf({schema:e,logger:t}){return RRt(e,kh.ENCODING,h5.EncodingSchema,t)??void 0}function npf(e){return Lh(e,kh.FERN_ENUM)}function ipf({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let u=Lh(n,kh.SDK_GROUP_NAME),f=Lh(n,kh.TYPE_DEFINITION);if(f!=null)return z_i({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,groupName:typeof u=="string"?[u]:u})}function z_i({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u}){return IJ({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.base64({example:void 0})});case"BOOLEAN":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.boolean({default:void 0,example:void 0})});case"DATE":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.date({example:void 0})});case"DATE_TIME":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.datetime({example:void 0})});case"FLOAT":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.float({example:void 0})});case"DOUBLE":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.uint({default:void 0,example:void 0})});case"INTEGER":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.uint64({default:void 0,example:void 0})});case"LONG":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Lp.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,groupName:u,schema:by.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Ol(f.v1)}},unknown:()=>Lp.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,groupName:u}),map:({keyType:f,valueType:d})=>(f==null?void 0:f.type)==="primitive"&&d!=null?Lp.map({nameOverride:t,generatedName:r,title:n,key:f,value:d,description:i,availability:a,groupName:u,encoding:void 0,example:void 0}):void 0,list:f=>f!=null?Lp.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u,example:void 0}):void 0,optional:f=>f!=null?Lp.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u}):void 0,set:f=>f!=null?Lp.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,groupName:u,example:void 0}):void 0,literal:f=>Lp.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:d=>E7.string(d),boolean:d=>E7.boolean(d),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,groupName:u}),named:()=>{}}})}function Ren(e){if(e!=null&&typeof e=="boolean")return e}function apf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:u,wrapAsNullable:f,context:d,groupName:c,example:o,encoding:l,source:g,namespace:O}){return typeof i=="boolean"||H7n(i)?rba({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:Lp.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:void 0}),groupName:c,example:o,encoding:l}):rba({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:L1(i,d.options.optionalAdditionalProperties?f:!1,d,[...n,"Value"],g,O),groupName:c,example:o,encoding:l})}function rba({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsNullable:a,description:u,availability:f,groupName:d,example:c,encoding:o}){return a?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.map({nameOverride:e,generatedName:t,title:r,description:u,availability:n.availability,key:n,value:i,groupName:d,encoding:o,example:c}),description:u,availability:f,groupName:d}):Lp.map({nameOverride:e,generatedName:t,title:r,description:u,availability:f,key:n,value:i,groupName:d,encoding:o,example:c})}function H7n(e){return e==null?!1:typeof e=="boolean"?e:!gy(e)&&Object.keys(e).length===0}function opf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:u,wrapAsNullable:f,context:d,groupName:c,example:o,source:l,namespace:g}){let O=i==null?Lp.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,groupName:c}):L1(i,!1,d,[...n,"Item"],l,g);return cv1({nameOverride:e,generatedName:t,title:r,groupName:c,itemSchema:O,wrapAsNullable:f,description:a,availability:u,example:o})}function cv1({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsNullable:i,description:a,availability:u,groupName:f,example:d}){return i?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,groupName:f,example:d}),description:a,availability:u,groupName:f}):Lp.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,groupName:f,example:d})}function ffu({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:f,wrapAsNullable:d,discriminator:c,context:o,groupName:l,encoding:g,source:O,namespace:j}){let S=c.propertyName,x=Object.fromEntries(Object.entries(c.mapping??{}).map(([z,N])=>{let C=$7n({$ref:N},!1,o,[N],g,O,j);return o.markReferencedByDiscriminatedUnion({$ref:N},S,1),[z,C]})),A=Object.entries(i).filter(([z])=>z!==S).map(([z,N])=>{let C=f!=null&&f.includes(z),U=L1(N,!C,o,[...n,z],O,j);return{key:z,schema:U}});return upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:A,description:a,availability:u,discriminant:S,subtypes:x,groupName:l,source:O})}function dfu({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:f,wrapAsNullable:d,discriminant:c,variants:o,context:l,groupName:g,encoding:O,source:j,namespace:S}){let x=Object.fromEntries(Object.entries(o).map(([z,N])=>{if(gy(N)){let C=$7n(N,!1,l,[N.$ref],O,j,S);return l.markReferencedByDiscriminatedUnion(N,c,1),[z,C]}else{let C=q5r(N,!1,l,[...n,z],O,j,S,new Set([c]));return[z,C]}})),A=Object.entries(i).filter(([z])=>z!==c).map(([z,N])=>{let C=f!=null&&f.includes(z),U=L1(N,!C,l,[...n,z],j,S);return{key:z,schema:U}});return upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:A,description:a,availability:u,discriminant:c,subtypes:x,groupName:g,source:j})}function upf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,availability:u,discriminant:f,subtypes:d,groupName:c,source:o}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.oneOf(jQ.discriminated({description:a,availability:u,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:i,groupName:c,encoding:void 0,source:o})),groupName:c,description:a,availability:u}):Lp.oneOf(jQ.discriminated({description:a,availability:u,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:i,groupName:c,encoding:void 0,source:o}))}function spf(e){if(e.proto!=null)return b7n.protobuf({typeName:e.proto.type})}var lv1=/^(\d+)/;function nba(e){let t=e.match(lv1);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=J7n(i);return n.length>0?`${a}_${n}`:a}}}function J7n(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let u=Math.floor(e/10),f=e%10;return f===0?n[u]:`${n[u]}_${t[f]}`}if(e<1e3){let u=Math.floor(e/100),f=e%100;return f===0?`${t[u]}_hundred`:`${t[u]}_hundred_${J7n(f)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${J7n(a)}`}var G7n=/^[a-zA-Z][a-zA-Z0-9_]*$/;function C5r({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:u,description:f,availability:d,wrapAsNullable:c,groupName:o,context:l,source:g}){let O=pv1(i??[]),j=new Set(a),S=Array.from(j).map((A,z)=>{var G,$,ee,Ve;let N=n==null?void 0:n[A],C=O[z],U=G7n.test(A),Y=(N==null?void 0:N.name)??C,te=U?A:B_i(A);return Y!=null&&!G7n.test(Y)&&(l==null||l.logger.warn(`Enum name override ${Y} is not a valid name. Falling back on ${te}.`),Y=void 0),{nameOverride:Y,generatedName:te,value:A,description:N==null?void 0:N.description,availability:d,casing:{snake:((G=N==null?void 0:N.casing)==null?void 0:G.snake)??void 0,pascal:(($=N==null?void 0:N.casing)==null?void 0:$.pascal)??void 0,screamingSnake:((ee=N==null?void 0:N.casing)==null?void 0:ee.screamingSnake)??void 0,camel:((Ve=N==null?void 0:N.casing)==null?void 0:Ve.camel)??void 0}}}),x=u!=null?S.find(A=>A.value===u):void 0;return fv1({wrapAsNullable:c,nameOverride:e,generatedName:t,title:r,values:S,_default:x,description:f,availability:d,groupName:o,source:g})}function fv1({wrapAsNullable:e,nameOverride:t,generatedName:r,title:n,values:i,_default:a,description:u,availability:f,groupName:d,source:c}){return e?Lp.nullable({nameOverride:t,generatedName:r,title:n,value:Lp.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,default:a,availability:f,example:void 0,groupName:d,source:c}),description:u,availability:f,groupName:d}):Lp.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,availability:f,default:a,example:void 0,groupName:d,source:c})}var dv1={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function B_i(e){let t=nba(e),r=dv1[e];return t!=null?qV(FE(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":qV(FE(e)))}function pv1(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function cpf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,description:o,availability:l,wrapAsNullable:g,example:O,groupName:j}){return n==="int64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):L9({nameOverride:e,generatedName:t,title:r,primitive:by.int({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j})}function lpf(e){return typeof e=="string"?E7.string(e):typeof e=="boolean"?E7.boolean(e):E7.string(`${e}`)}function fpf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,value:i,description:a,availability:u,groupName:f}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.literal({nameOverride:e,generatedName:t,title:r,value:lpf(i),description:a,availability:u,groupName:f}),description:a,availability:u,groupName:f}):Lp.literal({nameOverride:e,generatedName:t,title:r,value:lpf(i),description:a,availability:u,groupName:f})}function pfu({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,description:o,availability:l,wrapAsNullable:g,example:O,groupName:j}){return n==null||n==="double"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.double({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="float"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="int32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int({default:i,minimum:a,maximum:u,exclusiveMinimum:f,exclusiveMaximum:d,multipleOf:c,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="int64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.int64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint32"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="uint64"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.uint64({default:i,example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):n==="time-delta"?L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j}):L9({nameOverride:e,generatedName:t,title:r,primitive:by.float({example:O}),wrapAsNullable:g,description:o,availability:l,groupName:j})}var _v1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},hv1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},yv1={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},vv1={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},bv1={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},gv1={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},mv1={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},Ov1={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function iba(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[_v1,hv1,yv1,vv1,bv1,gv1,mv1,Ov1],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:f}=a.applyStrategy(t);t=u,r=[...r,...f]}}while(t.join("")!==i.join(""));return r}function yR(e){let t=e.join("_"),r=qV(FE(t));return/^\d/.test(r)?nba(r)??r:r}function _fu(e){let t=e.join("_");return FE(t)}function oq(e){switch(e.type){case"object":return ib.object({allOf:e.allOf,properties:e.properties.map(t=>jv1(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source});case"array":return ib.array({description:e.description,availability:e.availability,value:oq(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"enum":return ib.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,groupName:e.groupName,source:e.source});case"literal":return ib.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"nullable":return ib.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:oq(e.value),groupName:e.groupName});case"optional":return ib.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:oq(e.value),groupName:e.groupName});case"primitive":return ib.primitive({description:e.description,availability:e.availability,schema:dpf(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return ib.map({description:e.description,availability:e.availability,key:ib.primitive({description:e.key.description,availability:e.key.availability,schema:dpf(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,groupName:e.groupName}),value:oq(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,encoding:e.encoding});case"reference":return ib.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return ib.oneOf(Pv1(e.value));case"unknown":return ib.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Ol(e)}}function Pv1(e){switch(e.type){case"discriminated":return GSr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:oq(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,oq(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source});case"undisciminated":return GSr.undisciminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>oq(t)),groupName:e.groupName,encoding:e.encoding,source:e.source});default:Ol(e)}}function dpf(e){switch(e.type){case"string":return Xw.string(e);case"base64":return Xw.base64();case"boolean":return Xw.boolean(e);case"date":return Xw.date();case"datetime":return Xw.datetime();case"double":return Xw.double(e);case"float":return Xw.float();case"int":return Xw.int(e);case"int64":return Xw.int64(e);case"uint":return Xw.uint();case"uint64":return Xw.uint64();default:Ol(e)}}function jv1(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:oq(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability}}function aba(e,t){return FRt(oq(e),oq(t))}function FRt(e,t){return e.type==="primitive"&&t.type==="primitive"?ppf(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?wv1(e.values,t.values):e.type==="array"&&t.type==="array"?FRt(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?FRt(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?Dv1(e.value,t.value):e.type==="object"&&t.type==="object"?Sv1(e,t):e.type==="map"&&t.type==="map"?ppf(e.key.schema,t.key.schema)&&FRt(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function ppf(e,t){return e.type===t.type}function wv1(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return iDr(r,n)}function Dv1(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:FRt(n,i)}):e.type==="undisciminated"&&t.type==="undisciminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:FRt(r,i)}):!1}function Sv1(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:FRt(a,i.schema)})}function _pf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:u,wrapAsNullable:f,allOf:d,context:c,propertiesToExclude:o,groupName:l,fullExamples:g,additionalProperties:O,availability:j,encoding:S,source:x,namespace:A}){let z=[...u??[]],N={...i},C=[],U=[];for(let $ of d)if(gy($)){let ee=c.resolveSchemaReference($);if(ee.discriminator!=null&&ee.discriminator.mapping!=null)continue;if(ee.oneOf!=null){for(let $e of ee.oneOf){let Dt=gy($e)?c.resolveSchemaReference($e):$e,Tt=L1(Dt,!1,c.DUMMY,n,x,A);Tt.type==="object"&&C.push(...Tt.properties.map(Wt=>Wt.schema.type!=="optional"&&Wt.schema.type!=="nullable"?{...Wt,schema:Lp.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Wt.schema,description:void 0,availability:Wt.availability,groupName:void 0})}:Wt))}continue}let Ve=A5r($);if(Ve==null)continue;U.push({schemaId:Ve,convertedSchema:hfu($,[Ve],x),properties:hpf({schema:$,context:c,breadcrumbs:n,source:x,namespace:A})}),c.markSchemaAsReferencedByNonRequest(Ve)}else{let ee=L1($,!1,c,n,x,A);ee.type==="object"&&C.push(...ee.properties)}let Y={};for(let $ of U)for(let[ee,Ve]of Object.entries($.properties)){let $e=Y[ee];$e!=null?($e.schemaIds.push($.schemaId),$e.schemas.some(Tt=>aba(Tt,Ve))||$e.schemas.push(Ve)):Y[ee]={schemaIds:[$.schemaId],schemas:[Ve]}}let te=[];for(let[$,ee]of Object.entries(Y))ee.schemaIds.length>1&&te.push({propertyKey:$,allOfSchemaIds:ee.schemaIds,conflictingTypeSignatures:ee.schemas.length>1});let G=Object.entries(N).map(([$,ee])=>{let Ve=z.includes($),$e=Lh(ee,kh.AUDIENCES)??[],Dt=E2e(ee),Tt=Lh(ee,kh.FERN_PROPERTY_NAME),Wt=[...n,$],Nt=_fu(Wt),ur=Ve?L1(ee,!1,c,Wt,x,A):Lp.optional({nameOverride:e,generatedName:Nt,title:r,description:void 0,availability:Dt,value:L1(ee,!1,c,Wt,x,A),groupName:l}),Ar={};for(let Gr of U){let zt=Gr.properties[$];zt!=null&&!aba(ur,zt)?Ar[Gr.schemaId]={differentSchema:!0}:zt!=null&&(Ar[Gr.schemaId]={differentSchema:!1})}return{key:$,schema:ur,nameOverride:Tt,audiences:$e,conflict:Ar,generatedName:_fu([...n,$]),availability:Dt}});return G.push(...C.map($=>{let ee=$.conflict;for(let Ve of U){let $e=Ve.properties[$.key];$e!=null&&!aba($.schema,$e)?ee[Ve.schemaId]={differentSchema:!0}:$e!=null&&(ee[Ve.schemaId]={differentSchema:!1})}return{...$,conflict:ee}})),Ev1({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,properties:G.filter($=>!o.has($.key)),description:a,allOf:U.map($=>$.convertedSchema),allOfPropertyConflicts:te,groupName:l,fullExamples:g,additionalProperties:O,availability:j,source:x})}function Ev1({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:o,availability:l,source:g}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:H7n(o),availability:void 0,source:g}),description:a,availability:l,groupName:d}):Lp.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:f,groupName:d,fullExamples:c,additionalProperties:H7n(o),availability:l,source:g})}function hpf({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[u,f]=gy(e)?[t.resolveSchemaReference(e),iba(e.$ref)]:[e,r];for(let d of u.allOf??[])a={...a,...hpf({schema:d,context:t,breadcrumbs:f,source:n,namespace:i})};for(let[d,c]of Object.entries(u.properties??{})){let o=L1(c,!1,t,[...f,d],n,i);a[d]=o}return a}function K7n({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsNullable:u,context:f,subtypes:d,groupName:c,encoding:o,source:l,subtypePrefixOverrides:g,namespace:O}){let j=Mv1({schemas:d}),S=d.flatMap((z,N)=>{if(!gy(z)&&z.enum!=null)return z.enum.map(U=>Lp.literal({nameOverride:void 0,generatedName:yR([t,U]),title:void 0,value:E7.string(U),groupName:void 0,description:void 0,availability:U.availability}));let C=j[N];if(g!=null){let U=g[N];U!=null&&"name"in U&&(C=U.name)}return[L1(z,!1,f,[...n,C??`${N}`],l,O)]}),x=[];for(let z=0;z<S.length;++z){let N=S[z],C=!1;for(let U=z+1;U<S.length;++U){let Y=S[U];if(N!=null&&Y!=null&&FRt(N,Y)){C=!0;break}}N!=null&&!C&&x.push(N)}if(Object.entries(x).every(([z,N])=>N.type==="literal")){let z={},N=[];return Object.entries(x).forEach(([C,U])=>{U.type==="literal"&&U.value.type==="string"&&(N.push(U.value.value),U.description!=null&&(z[U.value.value]={description:U.description}))}),C5r({nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,fernEnum:z,enumVarNames:void 0,enumValues:N,_default:void 0,groupName:c,context:f,source:l})}return x.length===1&&x[0]!=null?x[0]:ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,subtypes:x,groupName:c,encoding:o,source:l})}function yfu({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsNullable:a,context:u,groupName:f,discriminator:d,encoding:c,source:o,namespace:l}){let g=Object.entries(d.mapping??{}).map(([S,x],A)=>{let z={$ref:x},N=$7n(z,!1,u,[x],c,o,l);return u.markSchemaWithDiscriminantValue(z,d.propertyName,S),N.type==="object"&&(N.properties={[d.propertyName]:Lp.literal({nameOverride:void 0,generatedName:yR([t,S]),title:void 0,value:E7.string(S),groupName:void 0,description:void 0,availability:void 0}),...N.properties.filter(C=>C.key!==d.propertyName)}),N}),O=[];for(let S=0;S<g.length;++S){let x=g[S],A=!1;for(let z=S+1;z<g.length;++z){let N=g[z];if(x!=null&&N!=null&&FRt(x,N)){A=!0;break}}x!=null&&!A&&O.push(x)}if(Object.entries(O).every(([S,x])=>x.type==="literal")){let S={},x=[];return Object.entries(O).forEach(([A,z])=>{z.type==="literal"&&z.value.type==="string"&&(x.push(z.value.value),z.description!=null&&(S[z.value.value]={description:z.description}))}),C5r({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,fernEnum:S,enumVarNames:void 0,enumValues:x,_default:void 0,groupName:f,context:u,source:o})}return O.length===1&&O[0]!=null?O[0]:ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,subtypes:O,groupName:f,encoding:c,source:o})}function Mv1({schemas:e}){let t={},r=0;for(let a of e){if(!gy(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),f={},d=u;for(let[c,o]of Object.entries(t)){let l=CXi(o,u);d=CXi(d,o),f[c]=l}f[r]=d,t=f}}r++}let n=[],i=0;for(let a of e){let u=t[i];if(u!=null&&u.length>0){let f=u.sort();if(f[0]!=null){n.push(f[0]),++i;continue}}gy(a)?n.push(J7n(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(J7n(i)??`${i}`),++i}return n}function ypf({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,description:i,availability:a,subtypes:u,groupName:f,encoding:d,source:c}){return n?Lp.nullable({nameOverride:e,generatedName:t,title:r,value:Lp.oneOf(jQ.undisciminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:f,encoding:d,source:c})),description:i,availability:a,groupName:f}):Lp.oneOf(jQ.undisciminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:f,encoding:d,source:c}))}function Y7n(e){if(e.default!=null&&typeof e.default=="string")return e.default}function oba({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;if(r&&typeof r=="number")return r;r&&t.warn(`Expected fallback to be a number, but got ${typeof r}`)}function vpf({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;if(r&&typeof r=="boolean")return r;r&&t.warn(`Expected fallback to be a boolean, but got ${typeof r}`)}function LRt({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;if(r&&typeof r=="string")return r;r&&t.warn(`Expected fallback to be a string, but got ${typeof r}`)}function bpf({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;if(r&&Array.isArray(r))return r;r&&t.warn(`Expected fallback to be a array, but got ${typeof r}`)}var Fen="#/components/schemas/";function L1(e,t,r,n,i,a,u=!1,f=new Set,d){let c=zv1({schema:e,logger:r.logger});if(gy(e)){let o=A5r(e);return o!=null?(u?r.markSchemaAsReferencedByRequest(o):r.markSchemaAsReferencedByNonRequest(o),$7n(e,t,r,n,c,i,a)):q5r(r.resolveSchemaReference(e),t,r,iba(e.$ref),c,i,a,f,u,d)}return q5r(e,t,r,n,c,i,a,f,u,d)}function $7n(e,t,r,n,i,a,u){let f=e.$ref.includes("properties")?q5r(r.resolveSchemaReference(e),t,r,n,i,a,u,new Set):Lp.reference(hfu(e,n,a));return t?Lp.nullable({title:void 0,nameOverride:void 0,generatedName:yR(n),value:f,description:void 0,availability:void 0,groupName:void 0}):f}function xv1(e){if(e!=null&&!e.includes(" ")&&!!/^[a-zA-Z]+$/.test(e))return e}function q5r(e,t,r,n,i,a,u,f=new Set,d=!1,c){var C;let o=Lh(e,kh.TYPE_NAME)??(r.options.useTitlesAsName?xv1(e.title):void 0),l=Lh(e,kh.SDK_GROUP_NAME)??((C=Lh(e,Yje.TAGS))==null?void 0:C[0]),g=(typeof l=="string"?[l]:l)??[];g=r.resolveGroupName(g);let O=yR(n),j=e.title,S=e.description,x=E2e(e),A=Lh(e,Yje.EXAMPLES),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0}),A!=null&&Object.keys(A).length>0&&z.push(...Object.entries(A).map(([U,Y])=>({name:Y.summary??U,value:Y.value,description:Y.description})));let N=ipf({schema:e,description:S,title:j,nameOverride:o,generatedName:O,availability:x});if(N!=null)return N;if(!t&&e.nullable===!0)return q5r(e,!0,r,n,i,a,u,f,d,c);if(e.enum!=null&&(e.type==="string"||e.type==null)){if(!I_i(e.enum))return L9({nameOverride:o,generatedName:O,title:j,primitive:by.string({default:Y7n(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g,wrapAsNullable:t,description:S,availability:x});let U=npf(e);return e.enum.length===1&&e.enum[0]!=null&&U==null?fpf({nameOverride:o,generatedName:O,title:j,wrapAsNullable:t,value:e.enum[0],description:S,availability:x,groupName:g}):C5r({nameOverride:o,generatedName:O,title:j,fernEnum:U,enumVarNames:Lh(e,[Yje.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:S,availability:x,wrapAsNullable:t,groupName:g,context:r,source:a})}if(I_i(e.type)&&e.type[1]!=null&&e.type[0]!=null){let U=e.type[0],Y=e.type[1];if(U==="null")return Lp.nullable({nameOverride:o,generatedName:O,title:j,value:q5r({...e,type:Y},t,r,n,i,a,u,f,d,c),groupName:g,description:e.description,availability:x});if(Y==="null")return Lp.nullable({nameOverride:o,generatedName:O,title:j,value:q5r({...e,type:U},t,r,n,i,a,u,f,d,c),groupName:g,description:e.description,availability:x})}if(I_i(e.type)&&e.type.length>1){let U=e.type.includes("null"),Y=e.type.filter(te=>te!=="null").map(te=>({type:te,nullable:U}));return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t,context:r,subtypes:Y,groupName:g,encoding:i,source:a,namespace:u})}if(e==="boolean"||e.type==="boolean"){let U=Lh(e,kh.BOOLEAN_LITERAL);return U!=null?mpf({nameOverride:o,generatedName:O,title:j,literal:E7.boolean(U),wrapAsNullable:t,description:S,availability:x,groupName:g}):L9({nameOverride:o,generatedName:O,title:j,primitive:by.boolean({default:e.default,example:vpf({schema:e,logger:r.logger,fallback:c})}),wrapAsNullable:t,description:S,availability:x,groupName:g})}if(e==="number"||e.type==="number")return pfu({nameOverride:o,generatedName:O,title:j,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="integer"||e.type==="integer")return cpf({nameOverride:o,generatedName:O,title:j,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="float")return pfu({nameOverride:o,generatedName:O,title:j,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Ren(e.exclusiveMinimum),exclusiveMaximum:Ren(e.exclusiveMaximum),multipleOf:e.multipleOf,description:S,availability:x,wrapAsNullable:t,example:oba({schema:e,logger:r.logger,fallback:c}),groupName:g});if(e==="string"||e.type==="string"){if(e.format==="date-time")return L9({nameOverride:o,generatedName:O,title:j,primitive:by.datetime({example:LRt({schema:e,logger:r.logger,fallback:c})}),wrapAsNullable:t,description:S,availability:x,groupName:g});if(e.format==="json-string")return Lp.unknown({nameOverride:o,generatedName:O,title:j,description:S,availability:x,groupName:g,example:void 0});let U=jpf(e,"const");return U!=null?mpf({nameOverride:o,generatedName:O,title:j,literal:E7.string(U),wrapAsNullable:t,description:S,availability:x,groupName:g}):L9({nameOverride:o,generatedName:O,title:j,primitive:by.string({default:Y7n(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g,wrapAsNullable:t,description:S,availability:x})}if(e.type==="array")return opf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,item:e.items,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,example:bpf({schema:e,logger:r.logger,fallback:c}),source:a,namespace:u});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&gpf(e))return apf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,additionalProperties:e.additionalProperties,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,encoding:i,example:e.example,source:a,namespace:u});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?yfu({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,discriminator:e.discriminator,encoding:i,source:a,namespace:u}):ffu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:g,encoding:i,source:a,namespace:u});if(Array.isArray(e.type)&&(e.oneOf==null?e.oneOf=e.type:e.oneOf.push(...e.type)),e.oneOf!=null&&e.oneOf.length>0){let U=Lh(e,kh.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||U?yfu({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,context:r,groupName:g,discriminator:e.discriminator,encoding:i,source:a,namespace:u}):ffu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:g,encoding:i,source:a,namespace:u});if(e.oneOf.length===1&&e.oneOf[0]!=null){let Y=L1(e.oneOf[0],t,r,n,a,u,d);return X7n(Y,S,g)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let $=e.oneOf[0],ee=e.oneOf[1];if(!gy($)&&$.type==="null")return L1(ee,!0,r,n,a,u);if(!gy(ee)&&ee.type==="null")return L1($,!0,r,n,a,u)}let Y=Cv1({schemas:e.oneOf});if(Y!=null)return C5r({nameOverride:o,generatedName:O,title:j,fernEnum:void 0,enumVarNames:void 0,enumValues:Y,_default:e.default,description:S,availability:x,wrapAsNullable:t,groupName:g,context:r,source:a});let te=Opf({schemas:e.oneOf,context:r});if(te!=null&&!r.options.discriminatedUnionV2&&!U)return dfu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},required:e.required,description:S,availability:x,wrapAsNullable:t,discriminant:te.discriminant,variants:te.schemas,context:r,groupName:g,encoding:i,source:a,namespace:u});let G=e.oneOf.filter($=>!gy($)&&$.type==="null").length>0;return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t||G,context:r,subtypes:e.oneOf.filter($=>gy($)||$.type!=="null"),encoding:i,groupName:g,source:a,namespace:u})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let te=L1(e.anyOf[0],t,r,n,a,u,d);return X7n(te,S,g)}if(e.anyOf.length===2){let[te,G]=e.anyOf;if(te!=null&&G!=null){if(!gy(te)&&te.type==="null"){let $=L1(G,!0,r,n,a,u);return X7n($,S,g)}else if(!gy(G)&&G.type==="null"){let $=L1(te,!0,r,n,a,u);return X7n($,S,g)}}}let U=Opf({schemas:e.anyOf,context:r});if(U!=null&&!r.options.discriminatedUnionV2)return dfu({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},required:e.required,description:S,availability:x,wrapAsNullable:t,discriminant:U.discriminant,variants:U.schemas,context:r,groupName:g,encoding:i,source:a,namespace:u});let Y=e.anyOf.filter(te=>!gy(te)&&te.type==="null").length>0;return K7n({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,description:S,availability:x,wrapAsNullable:t||Y,context:r,subtypes:e.anyOf.filter(te=>gy(te)||te.type!=="null"),encoding:i,groupName:g,source:a,namespace:u})}if(e.allOf!=null||e.properties!=null){let U=[];for(let te of e.allOf??[])(gy(te)||Object.keys(te).length>0)&&U.push(te);if((e.properties==null||e.properties.length===0)&&U.length===1&&U[0]!=null){let te=L1(U[0],t,r,n,a,u,d);return X7n(te,S,g)}let Y=U.filter(te=>{let G=uba(te);return G||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(te)}`),G});if((e.properties==null||e.properties.length===0)&&Y.length===1&&Y[0]!=null){let te=L1(Y[0],t,r,n,a,u,d);return X7n(te,S,g)}return _pf({nameOverride:o,generatedName:O,title:j,breadcrumbs:n,properties:e.properties??{},description:S,required:e.required,wrapAsNullable:t,allOf:Y,context:r,propertiesToExclude:f,groupName:g,fullExamples:z,additionalProperties:e.additionalProperties,availability:x,encoding:i,source:a,namespace:u})}if(e.type==="object"&&Tv1(e)&&qv1(e)&&gpf(e))return rba({nameOverride:o,generatedName:O,title:j,description:S,availability:x,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${O}Key`,title:void 0,description:void 0,availability:void 0,schema:by.string({default:Y7n(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:LRt({schema:e,logger:r.logger,fallback:c})}),groupName:g},valueSchema:Lp.unknown({nameOverride:void 0,generatedName:`${O}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:g}),groupName:g,encoding:i,example:e.example});if(e.type==null){let U=e.example??e.default;return Lp.unknown({nameOverride:o,generatedName:O,title:j,description:S,availability:x,groupName:g,example:U})}throw new Error(`Failed to convert schema breadcrumbs=${JSON.stringify(n)} value=${JSON.stringify(e)}`)}function A5r(e){if(!!e.$ref.startsWith(Fen))return e.$ref.replace(Fen,"")}function hfu(e,t,r){let n=Lh(e,kh.TYPE_NAME),i=yR(t),a=e.description,u=E2e(e),f=A5r(e);if(f==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return ib.reference({generatedName:i,nameOverride:n,title:void 0,schema:f,description:a??void 0,availability:u,groupName:void 0,source:r})}function Tv1(e){return e.oneOf==null||e.oneOf.length===0}function qv1(e){return e.allOf==null||e.allOf.length===0}function gpf(e){return e.properties==null||Object.keys(e.properties).length===0}function I_i(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function X7n(e,t,r){return e.type==="reference"?Lp.reference({...e,description:t,availability:e.availability,groupName:r}):e.type==="optional"?Lp.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r}):e.type==="nullable"?Lp.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r}):e}function uba(e){return gy(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>uba(t)):e.oneOf!=null?e.oneOf.every(t=>uba(t)):e.anyOf!=null?e.anyOf.every(t=>uba(t)):!1}function mpf({literal:e,wrapAsNullable:t,groupName:r,description:n,availability:i,nameOverride:a,generatedName:u,title:f}){return t?Lp.nullable({nameOverride:a,generatedName:u,title:f,value:Lp.literal({nameOverride:a,generatedName:u,title:f,value:e,description:n,availability:i,groupName:r}),groupName:r,description:n,availability:i}):Lp.literal({nameOverride:a,generatedName:u,title:f,value:e,groupName:r,description:n,availability:i})}function L9({primitive:e,wrapAsNullable:t,groupName:r,description:n,availability:i,generatedName:a,nameOverride:u,title:f}){return r=typeof r=="string"?[r]:r,t?Lp.nullable({nameOverride:u,generatedName:a,title:f,value:Lp.primitive({nameOverride:u,generatedName:a,title:f,schema:e,description:n,availability:i,groupName:r}),groupName:r,description:n,availability:i}):Lp.primitive({nameOverride:u,generatedName:a,title:f,schema:e,description:n,availability:i,groupName:r})}function Cv1({schemas:e}){let t=new Set;for(let r of e){if(gy(r))return;if(r.enum!=null&&I_i(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function Opf({schemas:e,context:t}){let r={};for(let n of e){let i=Ppf({schema:n,context:t});for(let[a,u]of Object.entries(i)){let f=r[a];f!=null?f[u]=n:r[a]={[u]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function Ppf({schema:e,context:t}){let r=gy(e)?t.resolveSchemaReference(e):e;return Av1({schema:r,context:t})}function Av1({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=Ppf({schema:n,context:t});for(let[a,u]of Object.entries(i??{}))r[a]=u}return r}for(let[n,i]of Object.entries(e.properties??{})){let a=gy(i)?t.resolveSchemaReference(i):i;a.type==="string"&&a.enum!=null&&I_i(a.enum)&&Nv1(a.enum).length===1&&a.enum[0]!=null&&(r[n]=a.enum[0]);let u=jpf(a,"const");a.type==="string"&&u!=null&&(r[n]=u),n==="type"&&a.example!=null&&(r[n]=a.example)}return r}function Nv1(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function jpf(e,t){let r=e[t];if(r!=null)return r}function zv1({schema:e,logger:t}){let r=rpf({schema:e,logger:t});if(r!=null)return spf(r)}function sba(e,t){let r={},n={};return e==null?r=t:n={[e]:t},{rootSchemas:r,namespacedSchemas:n}}var wpf="#/components/messages/",vfu=class{logger;document;taskContext;DUMMY;options;namespace;constructor({document:t,taskContext:r,options:n,namespace:i}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=n,this.namespace=i}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let n=[];if(this.namespace!=null){let i={type:"namespace",name:this.namespace};n.push(i)}return n.concat(t??[])}resolveSchemaReference(t){var a;if(this.document.components==null||this.document.components.schemas==null||!t.$ref.startsWith(Fen))throw new Error(`Failed to resolve ${t.$ref}`);let n=t.$ref.substring(Fen.length).split("/");if(n[0]==null)throw new Error(`${t.$ref} is undefined`);let i=this.document.components.schemas[n[0]];if(i==null)throw new Error(`${n[0]} is undefined`);if(gy(i)&&(i=this.resolveSchemaReference(i)),n[1]==="properties"&&n[2]!=null){let u=(a=i.properties)==null?void 0:a[n[2]];if(u==null)throw new Error(`${t.$ref} is undefiened. Property does not exist on object.`);gy(u)?i=this.resolveSchemaReference(u):i=u}return i}resolveMessageReference(t){if(this.document.components==null||this.document.components.messages==null||!t.$ref.startsWith(wpf))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(wpf.length),n=this.document.components.messages[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}},cba=class extends vfu{constructor({document:t,taskContext:r,options:n,namespace:i}){super({document:t,taskContext:r,options:n,namespace:i})}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,n){}markSchemaWithDiscriminantValue(t,r,n){}};function N5r(e){if(typeof e=="string")return RP.primitive(t0.string(e));if(typeof e=="number")return Number.isInteger(e)?RP.primitive(t0.int(e)):RP.primitive(t0.double(e));if(typeof e=="boolean")return RP.primitive(t0.boolean(e));if(Array.isArray(e)){let t=e.map(r=>N5r(r));return t.length===0?void 0:RP.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,n]of Object.entries(e)){let i=N5r(n);i!=null&&t.push({key:t0.string(r),value:i})}return RP.map(t)}}function R_i(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function Dpf(e){if(e!=null&&Array.isArray(e))return e}var Q7n=class{schemas;constructor(t){this.schemas=t}buildExample({schema:t,exampleId:r,example:n,options:i}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:n,options:{...i,maxCheckerDepth:i.maxCheckerDepth??5},depth:0})}buildExampleHelper({exampleId:t,example:r,schema:n,depth:i,visitedSchemaIds:a,options:u}){var f,d,c,o;switch(n.type){case"enum":return typeof r=="string"&&Spf({schema:n,value:r})?RP.enum(r):n.values[0]!=null?RP.enum((f=n.values[0])==null?void 0:f.value):void 0;case"literal":return RP.literal(n.value);case"nullable":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u)))return;let l=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u});return l!=null&&l.type==="array"&&l.value.length===0||l!=null&&l.type==="map"&&l.value.length===0||l!=null&&l.type==="object"&&Object.keys(l.properties).length===0?void 0:l}case"optional":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u)))return;let l=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u});return l!=null&&l.type==="array"&&l.value.length===0||l!=null&&l.type==="map"&&l.value.length===0||l!=null&&l.type==="object"&&Object.keys(l.properties).length===0?void 0:l}case"primitive":{let l=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:u});return RP.primitive(l)}case"reference":{let l=this.schemas[n.schema];if(l!=null&&!a.has(n.schema)){a.add(n.schema);let g=this.buildExampleHelper({example:r,schema:l,exampleId:t,visitedSchemaIds:a,depth:i,options:u});return a.delete(n.schema),g}return}case"oneOf":switch(n.value.type){case"discriminated":{let l={},g={},O={},j=R_i(r),S=j==null?void 0:j[n.value.discriminantProperty],x=n.value.schemas[S],A=[],z=this.getDiscriminatedUnionVariantSchema(n.value,j);z!=null&&A.push(z),A.push(...Object.entries(n.value.schemas));for(let N of A)if(S!=null&&x!=null&&x.type==="object"){g=this.getAllProperties(x),O=this.getAllRequiredProperties(x),l[n.value.discriminantProperty]=RP.primitive(t0.string(S));break}else{let C=this.getObjectSchema(N[1]);if(C==null)continue;g=this.getAllProperties(C),O=this.getAllRequiredProperties(C),l[n.value.discriminantProperty]=RP.primitive(t0.string(N[0]))}for(let N of n.value.commonProperties){g[N.key]=N.schema;let C=this.getResolvedSchema(N.schema);C.type!=="optional"&&C.type!=="nullable"&&(O[N.key]=N.schema)}for(let[N,C]of Object.entries(g)){let U=N in O;if(U&&(j==null?void 0:j[N])!=null){let Y=this.buildExampleHelper({schema:C,exampleId:t,example:j[N],visitedSchemaIds:a,depth:i+1,options:u});if(Y!=null)l[N]=Y;else return}else{let Y=this.buildExampleHelper({exampleId:t,schema:C,example:j==null?void 0:j[N],visitedSchemaIds:a,depth:i+1,options:u});if(Y!=null)l[N]=Y;else if(U)return}}return RP.oneOf(v5r.discriminated(l))}case"undisciminated":{let l=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(l!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:l,visitedSchemaIds:a,depth:i,options:u});break}}return;case"unknown":if(r!=null){let l=N5r(r);if(l!=null)return RP.unknown(l)}return u.ignoreOptionals||this.exceedsMaxDepth(i,u)?void 0:u.isParameter?RP.primitive(t0.string(u.name??"string")):RP.map([{key:t0.string("key"),value:RP.primitive(t0.string("value"))}]);case"array":{let l=Dpf(r),g=[];if(l!=null&&l.length>0)for(let O of l){let j=this.buildExampleHelper({exampleId:t,example:O,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});j!=null&&g.push(j)}else if(n.example!=null&&n.example.length>0)for(let O of n.example){let j=this.buildExampleHelper({exampleId:t,example:O,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});j!=null&&g.push(j)}else{let O=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u});O!=null&&g.push(O)}return RP.array(g)}case"map":{let l=R_i(r??n.example);if(l!=null&&Object.entries(l).length>0){let j=[];for(let[S,x]of Object.entries(l)){let A=this.buildExampleFromPrimitive({schema:n.key.schema,example:S,options:u}),z=this.buildExampleHelper({exampleId:t,example:x,schema:n.value,visitedSchemaIds:a,depth:i+1,options:u});z!=null&&j.push({key:A,value:z})}return RP.map(j)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return RP.map([{key:t0.string("key"),value:RP.unknown(RP.primitive(t0.string("value")))}]);let g=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...u,name:"key"}}),O=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:a,depth:i+1,options:{...u,name:"value"}});return O!=null?RP.map([{key:g,value:O}]):RP.map([])}case"object":{let l={},g=((d=n.fullExamples)==null?void 0:d.find(x=>x.name===t))??((c=n.fullExamples)==null?void 0:c.find(x=>x.name==null))??((o=n.fullExamples)==null?void 0:o[0]),O=R_i(r)??(g!=null?R_i(g.value):{})??{},j=this.getAllProperties(n),S=this.getAllRequiredProperties(n);for(let[x,A]of Object.entries(j)){let z=x in S,N=Object.keys(O).includes(x),C=this.buildExampleHelper({schema:A,exampleId:t,example:O[x],visitedSchemaIds:a,depth:i+1,options:{...u,name:x}});if(z&&C!=null)l[x]=C;else{if(z)return;(N&&C!=null||!u.ignoreOptionals&&C!=null)&&(l[x]=C)}}return RP.object({properties:l})}default:Ol(n)}}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let n=r==null?void 0:r[t.discriminantProperty];if(n==null||typeof n!="string")return Object.entries(t.schemas)[0];let i=t.schemas[n];return i==null?Object.entries(t.schemas)[0]:[n,i]}getUnDiscriminatedUnionVariantSchema(t,r){var a;return r==null?t.schemas[0]:(a=t.schemas.map(u=>({schema:u,heuristic:this.calcExampleHeuristic(u,r)})).sort((u,f)=>f.heuristic-u.heuristic)[0])==null?void 0:a.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return Spf({schema:t,value:r})?5:0;case"object":{if(!RO(r))return 0;let n=this.getAllProperties(t),i=0;for(let[a,u]of Object.entries(n))r[a]!=null?(i++,i+=this.calcExampleHeuristic(u,r[a])):i--;return i}case"array":{if(!Array.isArray(r))return 0;let n=0;for(let i of r)n+=this.calcExampleHeuristic(t.value,i);return n}case"map":{if(!RO(r))return 0;let n=0;for(let[,i]of Object.entries(r))n+=this.calcExampleHeuristic(t.value,i);return n}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let n=this.getResolvedSchema(t);return n==null?0:this.calcExampleHeuristic(n,r)}case"oneOf":return Object.values(t.value.schemas).map(i=>this.calcExampleHeuristic(i,r)).sort((i,a)=>a-i)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,n=new Set,i){if(this.exceedsMaxCheckerDepth(r,i))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,n,i);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,n,i);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let u of t.properties)if(this.hasExample(u.schema,r+1,n,i))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!n.has(t.schema)){n.add(t.schema);let u=this.hasExample(a,r,n,i);return n.delete(t.schema),u}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,n,i));default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let n of t.properties)r[n.key]=n.schema;for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let n of t.properties){let i=this.getResolvedSchema(n.schema);i.type!=="optional"&&i.type!=="nullable"&&(r[n.key]=n.schema)}for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);a.type==="object"&&(r={...this.getAllRequiredProperties(a),...r})}return r}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?t0.string(t):r.example!=null?t0.string(r.example):t0.string(n.name??DC.STRING);case"base64":return t!=null&&typeof t=="string"?t0.base64(t):r.example!=null?t0.base64(r.example):t0.base64(DC.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?t0.boolean(t):r.example!=null?t0.boolean(r.example):t0.boolean(DC.BOOLEAN);case"date":return t!=null&&typeof t=="string"?t0.date(t):r.example!=null?t0.date(r.example):t0.date(DC.DATE);case"datetime":return t!=null&&typeof t=="string"?t0.datetime(t):r.example!=null?t0.datetime(r.example):t0.datetime(DC.DATE_TIME);case"double":return t!=null&&typeof t=="number"?t0.double(t):r.example!=null?t0.double(r.example):t0.double(DC.DOUBLE);case"float":return t!=null&&typeof t=="number"?t0.float(t):r.example!=null?t0.float(r.example):t0.float(DC.FLOAT);case"int":return t!=null&&typeof t=="number"?t0.int(t):r.example!=null?t0.int(r.example):t0.int(DC.INT);case"int64":return t!=null&&typeof t=="number"?t0.int64(t):r.example!=null?t0.int64(r.example):t0.int64(DC.INT64);case"uint":return t!=null&&typeof t=="number"?t0.uint(t):r.example!=null?t0.uint(r.example):t0.uint(DC.UINT);case"uint64":return t!=null&&typeof t=="number"?t0.uint64(t):r.example!=null?t0.uint64(r.example):t0.uint64(DC.UINT64);default:Ol(r)}}};function Spf({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function URt(e){switch(e.type){case"object":return Lp.object({allOf:e.allOf,properties:e.properties.map(t=>Iv1(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source});case"array":return Lp.array({description:e.description,availability:e.availability,value:URt(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0});case"enum":return Lp.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,groupName:e.groupName,example:void 0,source:e.source});case"literal":return Lp.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName});case"nullable":return Lp.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:URt(e.value),groupName:e.groupName});case"optional":return Lp.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:URt(e.value),groupName:e.groupName});case"primitive":return Lp.primitive({description:e.description,availability:e.availability,schema:Epf(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return Lp.map({description:e.description,availability:e.availability,key:Lp.primitive({description:e.key.description,availability:e.key.availability,schema:Epf(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,groupName:e.groupName}),value:URt(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,encoding:e.encoding,example:void 0});case"reference":return Lp.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return Lp.oneOf(Bv1(e.value));case"unknown":return Lp.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,groupName:void 0,description:void 0,availability:void 0});default:Ol(e)}}function Bv1(e){switch(e.type){case"discriminated":return jQ.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:URt(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,URt(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source});case"undisciminated":return jQ.undisciminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>URt(t)),groupName:e.groupName,encoding:e.encoding,source:e.source});default:Ol(e)}}function Epf(e){switch(e.type){case"string":return by.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return by.base64({example:void 0});case"boolean":return by.boolean({default:e.default,example:void 0});case"date":return by.date({example:void 0});case"datetime":return by.datetime({example:void 0});case"double":return by.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return by.float({example:void 0});case"int":return by.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return by.int64({default:e.default,example:void 0});case"uint":return by.uint({default:void 0,example:void 0});case"uint64":return by.uint64({default:void 0,example:void 0});default:Ol(e)}}function Iv1(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:URt(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability}}function lba(e){return e.type!=="optional"&&e.type!=="nullable"}function F_i(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var fba=class{exampleTypeFactory;logger;schemas;constructor(t,r){this.schemas=t,this.exampleTypeFactory=new Q7n(t),this.logger=r}buildEndpointExample(t){this.logger.debug(`Building endpoint example for ${t.method.toUpperCase()} ${t.path}`);let r=Fv1(t.request),n=Lv1(t.response);if((r==null?void 0:r.type)==="unsupported"||(n==null?void 0:n.type)==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let l=this.isSchemaRequired(r.schema);if(r.examples.length===0){let g=this.exampleTypeFactory.buildExample({schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});g!=null&&i.push([void 0,g])}else for(let{name:g,value:O}of r.examples){let j=this.exampleTypeFactory.buildExample({schema:r.schema,exampleId:g,example:O,options:{isParameter:!1,ignoreOptionals:!0}});j!=null&&i.push([g,j])}if(l&&i.length===0)return this.logger.warn(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let a=[];if(n!=null&&n.type==="present"){let l=this.isSchemaRequired(n.schema);if(n.examples.length===0){let g=this.exampleTypeFactory.buildExample({schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:3,isParameter:!1,ignoreOptionals:!1}});g!=null&&a.push([void 0,g])}else for(let{name:g,value:O}of n.examples){let j=this.exampleTypeFactory.buildExample({schema:n.schema,exampleId:g,example:O,options:{maxDepth:3,isParameter:!1,ignoreOptionals:!1}});j!=null&&a.push([g,j])}if(l&&a.length===0)return this.logger.warn(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let u=[];for(let l of t.pathParameters){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for path parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&u.push({name:l.name,parameterNameOverride:l.parameterNameOverride,value:O})}let f=[];for(let l of t.queryParameters){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for query parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&f.push({name:l.name,value:O})}let d=[];for(let l of t.headers){let g=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!VRt(O)&&(this.logger.warn(`Expected a primitive example but got ${O.type} for header ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),g&&O==null)return[];O!=null&&d.push({name:l.name,value:O})}let c=[];t.request!=null&&t.response!=null?c=Rv1(i,a):t.request!=null?c=i.map(([l,g])=>({id:l,request:g,response:void 0})):t.response!=null&&(c=a.map(([l,g])=>({id:l,request:void 0,response:g})));let o=t.examples.filter(l=>F_i(l)).flatMap(l=>{if(l.type==="unknown"){if(l.value!=null){let g=l.value["code-samples"];if(g!=null)return this.convertCodeSamples(g)}return}else return l.codeSamples}).filter(l=>RS(l));return c.length===0?[pAt.full({name:void 0,description:void 0,pathParameters:u,queryParameters:f,headers:d,request:void 0,response:void 0,codeSamples:o})]:c.map(({id:l,request:g,response:O})=>pAt.full({name:l,description:void 0,pathParameters:u,queryParameters:f,headers:d,request:g,response:O,codeSamples:o}))}convertCodeSamples(t){return t.map(r=>"language"in r?JSr.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):JSr.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?bW.Csharp:r.sdk,code:r.code})).filter(RS)}isSchemaRequired(t){return lba(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function Rv1(e,t){var i,a,u,f;let r=[];if(e.length<=1){let[d,c]=e[0]??[];if(t.length===0)return r.push({id:d,request:c,response:void 0}),r;for(let[o,l]of t)r.push({id:o??d,request:c,response:l});return r}if(t.length<=1){let[d,c]=t[0]??[];if(t.length===0)return r.push({id:d,request:void 0,response:c}),r;for(let[o,l]of e)r.push({id:o??d,request:l,response:c});return r}let n=new Set;for(let[d,c]of e){let o=((i=t.find(([g])=>g==null))==null?void 0:i[1])??((a=t[0])==null?void 0:a[1]);if(d==null){if(o==null)continue;r.push({id:void 0,request:c,response:o});continue}let l=!1;for(let g=0;g<t.length;g++){let[O,j]=t[g];O!=null||n.has(g)||d===O&&(r.push({id:d,request:c,response:j}),O!=null&&n.add(g),l=!0)}!l&&o!=null&&r.push({id:d,request:c,response:o})}for(let d=0;d<t.length;d++){if(n.has(d))continue;let[c,o]=t[d],l=((u=e.find(([g])=>g==null))==null?void 0:u[1])??((f=e[0])==null?void 0:f[1]);l!=null&&r.push({id:c,request:l,response:o})}return r}function Fv1(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:Uv1(e),examples:[]}:e.type==="json"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function Lv1(e){if(e!=null)return e.type!=="json"?{type:"unsupported"}:{type:"present",schema:e.schema,examples:e.fullExamples??[]}}function VRt(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return VRt(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undisciminated":return VRt(e.value.value);default:return!1}default:Ol(e)}}function Uv1(e){return Lp.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:URt(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0}).filter(RS),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,source:e.source})}var dba=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new Q7n(t),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,publish:n,subscribe:i,handshake:a,source:u,namespace:f}){var c,o;let d=[];for(let l of r){let g=[];for(let S of a.queryParameters){let x=this.isSchemaRequired(S.schema),A=this.exampleTypeFactory.buildExample({schema:S.schema,exampleId:void 0,example:(c=l.queryParameters)==null?void 0:c[S.name],options:{name:S.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!VRt(A)&&(A=void 0),!(x&&A==null)&&A!=null&&g.push({name:S.name,value:A})}let O=[];for(let S of a.headers){let x=this.isSchemaRequired(S.schema),A=this.exampleTypeFactory.buildExample({schema:S.schema,exampleId:void 0,example:(o=l.headers)==null?void 0:o[S.name],options:{name:S.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!VRt(A)&&(A=void 0),!(x&&A==null)&&A!=null&&O.push({name:S.name,value:A})}let j=[];for(let S of l.messages){let x=t.resolveMessageReference({$ref:`#/components/messages/${S.messageId}`}),A=gy(x.payload)?t.resolveSchemaReference(x.payload):x.payload,z=this.exampleTypeFactory.buildExample({schema:L1(A,!1,t,[S.messageId],u,f),exampleId:void 0,example:S.value,options:{isParameter:!1,ignoreOptionals:!0}});z!=null&&j.push({messageType:S.type,payload:z,description:void 0})}d.push({name:l.summary,queryParameters:g,headers:O,description:l.description,messages:j})}return d}buildWebsocketSessionExample({publish:t,subscribe:r,handshake:n}){let i={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},a=[];for(let f of n.queryParameters){let d=this.isSchemaRequired(f.schema),c=this.exampleTypeFactory.buildExample({schema:f.schema,exampleId:void 0,example:void 0,options:{name:f.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!VRt(c)&&(c=void 0),d&&c==null)return;c!=null&&a.push({name:f.name,value:c})}let u=[];for(let f of n.headers){let d=this.isSchemaRequired(f.schema),c=this.exampleTypeFactory.buildExample({schema:f.schema,exampleId:void 0,example:void 0,options:{name:f.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!VRt(c)&&(c=void 0),d&&c==null)return;c!=null&&u.push({name:f.name,value:c})}if(t!=null){let f=this.exampleTypeFactory.buildExample({schema:t,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});f!=null&&i.messages.push({messageType:"publish",payload:f,description:void 0})}if(r!=null){let f=this.exampleTypeFactory.buildExample({schema:r,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});f!=null&&i.messages.push({messageType:"subscribe",payload:f,description:void 0})}return i}isSchemaRequired(t){return lba(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}};var L_i={FERN_DISPLAY_NAME:"x-fern-display-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path"};function Mpf(e){return Lh(e,L_i.FERN_EXAMPLES)??[]}function Tpf({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:a}){var l,g,O,j,S,x;let u=[];a!=null&&u.push(a),((l=e.tags)==null?void 0:l[0])!=null?u.push(e.tags[0].name):i.naming!=="v2"&&u.push("websocket");let f=new cba({document:e,taskContext:t,options:r,namespace:a}),d={},c;for(let[A,z]of Object.entries(((g=e.components)==null?void 0:g.schemas)??{})){let N=L1(z,!1,f,[A],n,a);d[A]=N}let o=new dba(d,t.logger);for(let[A,z]of Object.entries(e.channels??{})){if(((O=z.bindings)==null?void 0:O.ws)==null){f.logger.error(`Channel ${A} does not have websocket bindings. Skipping.`);continue}let N=[];if(z.parameters!=null)for(let[G,$]of Object.entries(z.parameters??{}))N.push({name:G,description:$.description,parameterNameOverride:void 0,schema:$.schema!=null?L1($.schema,!1,f,u,n,a):Lp.primitive({schema:by.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:E2e($),source:n});let C=[];if(z.bindings.ws.headers!=null){let G=z.bindings.ws.headers.required??[];for(let[$,ee]of Object.entries(z.bindings.ws.headers.properties??{})){let Ve=gy(ee)?f.resolveSchemaReference(ee):ee;C.push({name:$,schema:L1(Ve,!G.includes($),f,u,n,a),description:Ve.description,parameterNameOverride:void 0,env:void 0,availability:E2e(Ve),source:n})}}let U=[];if(z.bindings.ws.query!=null){let G=z.bindings.ws.query.required??[];for(let[$,ee]of Object.entries(z.bindings.ws.query.properties??{})){let Ve=gy(ee)?f.resolveSchemaReference(ee):ee;U.push({name:$,schema:L1(Ve,!G.includes($),f,u,n,a),description:Ve.description,parameterNameOverride:void 0,availability:E2e(Ve),source:n})}}let Y;z.publish!=null&&(Y=xpf({generatedName:z.publish.operationId??"PublishEvent",event:z.publish,breadcrumbs:u,context:f,source:n,options:r,asyncApiOptions:i}));let te;if(z.subscribe!=null&&(te=xpf({generatedName:z.subscribe.operationId??"SubscribeEvent",event:z.subscribe,breadcrumbs:u,context:f,source:n,options:r,asyncApiOptions:i})),C.length>0||U.length>0||Y!=null||te!=null){let G=Mpf(z),$=[];if(G.length>0)$=o.buildWebsocketSessionExamplesForExtension({context:f,extensionExamples:G,handshake:{headers:C,queryParameters:U},publish:Y,subscribe:te,source:n,namespace:a});else{let Ve=o.buildWebsocketSessionExample({handshake:{headers:C,queryParameters:U},publish:Y,subscribe:te});Ve!=null&&$.push(Ve)}let ee=((S=(j=e.tags)==null?void 0:j[0])==null?void 0:S.name)!=null?[(x=e.tags)==null?void 0:x[0].name]:void 0;c={handshake:{headers:C.map(Ve=>({...Ve,schema:oq(Ve.schema),env:Ve.env})),queryParameters:U.map(Ve=>({...Ve,schema:oq(Ve.schema)})),pathParameters:N.map(Ve=>({...Ve,parameterNameOverride:void 0,schema:oq(Ve.schema)}))},groupName:f.resolveTags(ee,"Websocket"),publish:Y!=null?oq(Y):Y,subscribe:te!=null?oq(te):te,summary:Lh(z,L_i.FERN_DISPLAY_NAME),path:A,description:void 0,examples:$,source:n};break}}return{groupedSchemas:sba(a,d),channel:c,basePath:Lh(e,L_i.BASE_PATH)}}function xpf({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:a,asyncApiOptions:u}){if(t.message.oneOf!=null){let f=[],d=[];for(let c of t.message.oneOf){let o,l={type:"notFound"};if(gy(c)){let g=r.resolveMessageReference(c);!gy(g.payload)&&u.naming==="v2"?(l=g.name?{type:"name",name:g.name}:l,o={...g.payload,title:g.name??g.payload.title,description:g.name??g.payload.description}):o=g.payload}else o=c;d.push(l),f.push(o)}return K7n({description:t.description??t.message.description,availability:E2e(t.message),subtypes:f,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypePrefixOverrides:u.naming==="v2"?d:[]})}}var IEf=yu(Vbf(),1);var Rtn=yu(NEf(),1);var zEf=require("fs/promises");async function jPa({absoluteFilepathToOverrides:e,data:t,context:r}){let n=null;try{let u=(await(0,zEf.readFile)(e,"utf8")).toString();try{n=JSON.parse(u)}catch{n=av.load(u,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}let i=qXi(t,qXi,n,(u,f)=>Array.isArray(u)&&Array.isArray(f)?f.every(d=>typeof d=="object")&&u.every(d=>typeof d=="object")?void 0:[...f]:void 0);return Wbu(i,mWo)}var Wbu=(e,t)=>{function r(n){if(!Array.isArray(n)&&!Lsi(n))return n;if(Array.isArray(n))return n.map(a=>Wbu(a,t));let i={};for(let[a,u]of Object.entries(n))i[a]=Wbu(u,t);return jWo(i,t)}return r(e)};var wH1={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},DH1={id:"",typeExtension:{oas3:e=>{var t;return{...e,XFernStreaming:wH1,Operation:{...e.Operation,properties:{...(t=e.Operation)==null?void 0:t.properties,"x-fern-streaming":"XFernStreaming"}}}}}};async function REf({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,context:r}){let n=await BEf({absolutePathToOpenAPI:e}),i;if(t!=null?i=t:typeof n=="object"&&n[kh.OPENAPI_OVERIDES_FILEPATH]!=null&&(i=pf(Cg(e),zs.of(n[kh.OPENAPI_OVERIDES_FILEPATH]))),i!=null){let a=await jPa({absoluteFilepathToOverrides:i,context:r,data:n});return await BEf({absolutePathToOpenAPI:e,parsed:a})}return n}async function BEf({absolutePathToOpenAPI:e,parsed:t}){let r={config:new Rtn.Config({apis:{},styleguide:{plugins:[DH1],rules:{spec:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!0},n=t!=null?await(0,Rtn.bundle)({...r,doc:{source:new Rtn.Source(e,"<openapi>"),parsed:t}}):await(0,Rtn.bundle)({...r,ref:e});return await IEf.default.parse(n.bundle.parsed)}var Cqf=yu(L2f(),1);function U2f(e){return Lh(e,kh.ASYNC_CONFIG)}var V2f="$request.";function W2f(e){let t=Lh(e,kh.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json"}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format}:{type:"streamCondition",format:t.format??"json",streamConditionProperty:IX1(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function IX1(e){return e.startsWith(V2f)?e.slice(V2f.length):e}function H2f(e){let t=e;if(t.cursor!=null)return $Sr.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;return $Sr.offset({offset:r.offset,results:r.results,step:r.step,hasNextPage:r["has-next-page"]})}function $2f(e,t){let r=Lh(t,kh.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=Lh(e,kh.PAGINATION);if(typeof n=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return n==null?void 0:H2f(n)}return H2f(r)}}function J2f(e){let t=RX1(e),r={};return Hmu({obj:t,occurrences:r,breadcrumbs:[]}),r}function Hmu({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)Hmu({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)Hmu({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function RX1(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:(r==null?void 0:r.get)!=null?C0i(r.get):void 0,put:(r==null?void 0:r.put)!=null?C0i(r.put):void 0,post:(r==null?void 0:r.post)!=null?C0i(r.post):void 0,patch:(r==null?void 0:r.patch)!=null?C0i(r.patch):void 0,delete:(r==null?void 0:r.delete)!=null?C0i(r.delete):void 0}]))}}function C0i(e){return{...e,requestBody:e.requestBody!=null?gy(e.requestBody)?e.requestBody:FX1(e.requestBody):void 0}}function FX1(e){let t,r;for(let n in e.content){let i=sA.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[sA.MULTIPART_FORM_DATA]:r}}:e}var G2f="#/components/parameters/",K2f="#/components/responses/",Y2f="#/components/examples/",X2f="#/components/requestBodies/",V3n=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;namespace;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=J2f(t),this.options=i,this.source=a,this.DUMMY=this.getDummy(),this.namespace=u}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown",additionalProperties:!0};n=n[i]}return n==null?{"x-fern-type":"unknown",additionalProperties:!0}:(gy(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(G2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(G2f.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(X2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(X2f.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(K2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(K2f.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(Y2f))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(Y2f.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return gy(n)?this.resolveExampleReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}};var W3n=class extends V3n{constructor({document:t,taskContext:r,options:n,source:i,namespace:a}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:a})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}};var LX1=ir.object({lang:ir.string(),label:ir.optional(ir.string()),source:ir.string()}),$mu=ir.array(LX1);var Q2f={README_EXT:"x-readme"};function UX1(e){if(!Array.isArray(e))return!1;for(let t of e)if(!RO(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function Z2f(e){let t=Lh(e,Q2f.README_EXT);if(!RO(t))return[];let r=t["code-samples"];if(!UX1(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}function k2f(e,t,r){let n=RRt(t,kh.EXAMPLES,h5.ExampleEndpointCallArraySchema,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],i=RRt(t,Yje.REDOCLY_CODE_SAMPLES_KEBAB,$mu,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...RRt(t,Yje.REDOCLY_CODE_SAMPLES_CAMEL,$mu,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...i];u.length>0&&n.push({"code-samples":u.map(d=>({name:d.label??d.lang,language:d.lang,code:d.source,install:void 0,docs:void 0}))});let f=Z2f(t);return f.length>0&&n.push({"code-samples":f}),n.map(pAt.unknown)}function eqf(e){let t=Lh(e,kh.AVAILABILITY);if(t==="ga"||t==="generally-available")return vW.GenerallyAvailable;if(t==="beta"||t==="pre-release")return vW.Beta;if(t==="deprecated")return vW.Deprecated;if(e.deprecated)return vW.Deprecated}function x1a(e){return{url:VX1({url:e.url,variables:e.variables??{}}),description:e.description,name:WX1(e),audiences:Lh(e,kh.AUDIENCES)}}function VX1({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,i);return e}function WX1(e){var r,n;let t=Lh(e,[kh.SERVER_NAME_V1,kh.SERVER_NAME_V2]);if(t!=null)return t;if(((r=e.description)==null?void 0:r.toLowerCase())==="production")return"Production";if(((n=e.description)==null?void 0:n.toLowerCase())==="sandbox")return"Sandbox"}function tqf(e){return Lh(e,kh.PARAMETER_NAME)}function rqf(e){return Lh(e,kh.SDK_VARIABLE)}function T1a({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:a}){var f;let u={pathParameters:[],queryParameters:[],headers:[]};for(let d of r){let c=gy(d)?n.resolveParameterReference(d):d,o=c.required??!1,l=E2e(c),g=[...i,c.name],O=yR(g);(f=LRt({schema:c,logger:n.logger}))!=null&&f.includes(" ")&&n.logger.warn("Parameter example contains a space, which is ambiguous. Consider using enums for multiple examples, or use an encoding if a space is part of the parameter.");let j=c.schema!=null?L1(c.schema,!o,n,g,a,n.namespace,!1,new Set,LRt({schema:c,logger:n.logger})):o?Lp.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:LRt({schema:c,logger:n.logger})}),description:void 0,availability:l,groupName:void 0}):Lp.optional({nameOverride:void 0,generatedName:O,title:void 0,value:Lp.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:by.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:LRt({schema:c,logger:n.logger})}),description:void 0,availability:void 0,groupName:void 0}),description:void 0,availability:l,groupName:void 0});if(c.in==="header"&&c.schema!=null&&!gy(c.schema)&&c.schema.default!=null){let x=c.schema.default;typeof x=="string"&&x.length>0&&(j=Lp.literal({nameOverride:void 0,generatedName:O,title:void 0,value:E7.string(x),description:void 0,availability:l,groupName:void 0}))}let S={name:c.name,schema:j,description:c.description,parameterNameOverride:tqf(c),availability:l,source:a};c.in==="query"?u.queryParameters.push(S):c.in==="path"?u.pathParameters.push({...S,variableReference:rqf(c)}):c.in==="header"?!HX1.has(c.name)&&!n.authHeaders.has(c.name)?u.headers.push({...S,env:void 0}):n.logger.debug(`Ignoring ${c.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${c.in} parameter, ${c.name}, in ${t.toUpperCase()} ${e}`)}return u}var HX1=new Set(["User-Agent","Content-Length","Content-Type","X-Forwarded-For","Cookie","Origin","Content-Disposition","X-Ping-Custom-Domain"]);function H3n(e,t){for(let r of Object.keys(e))if(r.includes("json")){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:iqf(n,t)}}}function nqf(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:iqf(n,t)}}}function iqf(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=Lh(e,Yje.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,a])=>({name:a.summary??i,value:a.value,description:a.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,a])=>{let u=gy(a)?t.resolveExampleReference(a):a;return{name:u.summary??i,value:u.value,description:u.description}})),r}function $X1(e){var t;for(let[r,n]of Object.entries(e.content))if((t=sA.parse(r))!=null&&t.isMultipart())return{schema:n.schema,encoding:n.encoding}}function JX1(e){var t;for(let r in e.content)if((t=sA.parse(r))!=null&&t.isOctetStream())return!0;return!1}function GX1(e,t){let r=gy(e)?Jmu(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!gy(i)&&i.type==="string"&&i.format==="binary")!=null}function $3n({requestBody:e,document:t,context:r,requestBreadcrumbs:n,source:i,namespace:a}){var g,O,j,S,x;let u=gy(e)?r.resolveRequestBodyReference(e):e,f=$X1(u),d=f==null?void 0:f.schema,c=f==null?void 0:f.encoding,o=H3n(u.content,r);if(JX1(u))return S2e.octetStream({description:void 0,source:i});if(d!=null&&o==null||d!=null&&GX1(d,t)){let A=gy(d)?Jmu(d,t):{id:void 0,schema:d},z=L1(A.schema,!1,r,n,i,a),N=[];if(z.type==="object")for(let C of z.properties){if(C.schema.type==="primitive"&&C.schema.schema.type==="string"&&C.schema.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!1,isArray:!1}),description:C.schema.description,contentType:c!=null?(g=c[C.key])==null?void 0:g.contentType:void 0});continue}if(C.schema.type==="optional"&&C.schema.value.type==="primitive"&&C.schema.value.schema.type==="string"&&C.schema.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!0,isArray:!1}),description:C.schema.description,contentType:c!=null?(O=c[C.key])==null?void 0:O.contentType:void 0});continue}if(C.schema.type==="array"&&C.schema.value.type==="primitive"&&C.schema.value.schema.type==="string"&&C.schema.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!1,isArray:!0}),description:C.schema.description,contentType:c!=null?(j=c[C.key])==null?void 0:j.contentType:void 0});continue}if(C.schema.type==="optional"&&C.schema.value.type==="array"&&C.schema.value.value.type==="primitive"&&C.schema.value.value.schema.type==="string"&&C.schema.value.value.schema.format==="binary"){N.push({key:C.key,schema:D2e.file({isOptional:!0,isArray:!0}),description:C.schema.description,contentType:c!=null?(S=c[C.key])==null?void 0:S.contentType:void 0});continue}N.push({key:C.key,schema:D2e.json(C.schema),description:void 0,contentType:c!=null?(x=c[C.key])==null?void 0:x.contentType:void 0})}return S2e.multipart({name:gy(d)&&r.getNumberOfOccurrencesForRef(d)===1?A.id:void 0,description:void 0,properties:N,source:i})}if(o==null)return;let l=L1(o.schema,!1,r,n,i,a,!0);return S2e.json({description:void 0,schema:l,contentType:void 0,fullExamples:o.examples,additionalProperties:!gy(o.schema)&&H7n(o.schema.additionalProperties),source:i})}function Jmu(e,t){var i,a;if(!e.$ref.startsWith(Fen))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=A5r(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let n=(a=(i=t.components)==null?void 0:i.schemas)==null?void 0:a[r];if(n==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return gy(n)?Jmu(n,t):{id:r,schema:n}}var Gmu={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},aqf=new Set(Object.values(Gmu));var KX1=["200","201","202","204"];function uqf({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:a,source:u}){if(t==null)return{value:void 0,errors:{}};let f=YX1({responses:t,context:r,source:u,namespace:r.namespace}),d=!1,c;for(let o of i!=null?[i]:KX1){let l=t[o];l!=null&&(d=!0,c==null&&(c=oqf({operationContext:e,response:l,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace})))}if(c==null&&!d&&t.default!=null&&(c=oqf({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace})),c!=null)switch(c.type){case"json":return{value:c,errors:f};case"streamingJson":case"streamingSse":return{value:c,errors:f};case"file":case"text":case"streamingText":return{value:c,errors:f};default:Ol(c)}return{value:void 0,errors:f}}function oqf({operationContext:e,streamFormat:t,response:r,context:n,responseBreadcrumbs:i,source:a,namespace:u}){let f=gy(r)?n.resolveResponseReference(r):r;if(f.content!=null&&Object.entries(f.content).find(([o,l])=>{if(l.schema==null)return!1;let g=gy(l.schema)?n.resolveSchemaReference(l.schema):l.schema;return g.type==="string"&&g.format==="binary"}))return T3.file({description:f.description,source:a});let d=H3n(f.content??{},n);if(d!=null){if(t!=null)switch(t){case"json":return T3.streamingJson({description:f.description,responseProperty:void 0,schema:oq(L1(d.schema,!1,n,i,a,u)),source:a});case"sse":return T3.streamingSse({description:f.description,responseProperty:void 0,schema:oq(L1(d.schema,!1,n,i,a,u)),source:a})}return T3.json({description:f.description,schema:L1(d.schema,!1,n,i,a,u),responseProperty:Lh(e.operation,kh.RESPONSE_PROPERTY),fullExamples:d.examples,source:a})}for(let[c,o]of Object.entries(f.content??{})){let l=sA.parse(c);if(l!=null){if(l.isOctetStream()||l.isPDF()||l.isAudio()||l.isImage()||l.isVideo())return T3.file({description:f.description,source:a});if(l.isPlainText()){let g=o.schema;if(g==null)return T3.text({description:f.description,source:a});let O=gy(g)?n.resolveSchemaReference(g):g;return O.type==="string"&&O.format==="byte"?T3.file({description:f.description,source:a}):T3.text({description:f.description,source:a})}}}}function YX1({responses:e,context:t,source:r,namespace:n}){let i={};for(let[a,u]of Object.entries(e)){if(a==="default")continue;let f=parseInt(a);if(f<400||f>600)continue;let d=gy(u)?t.resolveResponseReference(u):u,c=nqf(d.content??{},t),o=Gmu[f];if(o==null){t.logger.warn(`No error name found for status code ${a}`);continue}i[f]={statusCode:f,nameOverride:void 0,generatedName:o,description:d.description,schema:L1((c==null?void 0:c.schema)??{},!1,t,[o,"Body"],r,n),fullExamples:c==null?void 0:c.examples,source:r}}return i}function vEr({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,source:a}){let{document:u,operation:f,path:d,method:c,baseBreadcrumbs:o,sdkMethodName:l}=e,g=Lh(f,kh.IDEMPOTENT),O=Lh(f,[kh.REQUEST_NAME_V1,kh.REQUEST_NAME_V2]),j=[...o,"Request"],S=T1a({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:j,path:d,httpMethod:c,source:a}),x=f.requestBody!=null?$3n({requestBody:f.requestBody,document:u,context:new W3n({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:j,source:a,namespace:t.namespace}):void 0;(S.queryParameters.length>0||S.headers.length>0)&&x!=null&&x.type==="json"&&x.schema.type!=="object"&&f.requestBody!=null?x=$3n({requestBody:f.requestBody,document:u,context:t,requestBreadcrumbs:[...j,"Body"],source:a,namespace:t.namespace}):f.requestBody!=null&&(x=$3n({requestBody:f.requestBody,document:u,context:t,requestBreadcrumbs:[...j],source:a,namespace:t.namespace}));let A=[...o,"Response"],z=uqf({operationContext:e,streamFormat:i,responses:f.responses,context:t,responseBreadcrumbs:A,responseStatusCode:r,source:a}),N=eqf(f),C=k2f(e,f,t),U=Lh(f,kh.SERVER_NAME_V2);return{summary:f.summary,internal:Lh(f,Yje.INTERNAL),idempotent:g,audiences:Lh(f,kh.AUDIENCES)??[],operationId:f.operationId!=null&&n!=null?f.operationId+"_"+n:f.operationId,tags:t.resolveTagsToTagIds(f.tags),namespace:t.namespace,sdkName:l,pathParameters:S.pathParameters,queryParameters:S.queryParameters,headers:S.headers,requestNameOverride:O??void 0,generatedRequestName:yR(j),request:x,response:z.value,errors:z.errors,server:U!=null?[{name:U,url:void 0,audiences:void 0}]:(f.servers??[]).map(Y=>x1a(Y)),description:f.description,authed:XX1(f,u),availability:N,method:c,path:d,examples:C,pagination:e.pagination,source:a}}function XX1(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function cqf({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:a,operationParameters:u}=e,f=r.discriminant.name,d=r.discriminant.value,c=r["response-status-code"],o=sqf({context:t,headerToIgnore:f,parameters:a}),l=sqf({context:t,headerToIgnore:f,parameters:u}),g=vEr({operationContext:{...e,pathItemParameters:o,operationParameters:l,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([j])=>parseInt(j)!==c))}},context:t,streamFormat:void 0,source:n}),O=vEr({operationContext:{...e,pathItemParameters:o,operationParameters:l,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:c,streamFormat:void 0,source:n});return O.headers.push({name:f,schema:Lp.literal({nameOverride:void 0,generatedName:yR([f]),title:void 0,description:void 0,availability:void 0,value:E7.string(d),groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n}),{sync:g,async:O}}function sqf({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=gy(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var Kmu="stream";function pqf({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:vEr({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:void 0};case"streamCondition":{let n=lqf({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if((n==null?void 0:n.schemaReference)!=null){let c=A5r(n.schemaReference);c!=null&&t.excludeSchema(c)}let i=fqf({operation:e.operation,response:r.responseStream}),a=vEr({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+Kmu}:void 0,operation:{...e.operation,requestBody:n==null?void 0:n.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,Kmu]},context:t,streamFormat:r.format,suffix:Kmu,source:t.source});a.examples=a.examples.filter(c=>dqf(c,t)!==!1);let u=lqf({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),f=fqf({operation:e.operation,response:r.response}),d=vEr({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:u==null?void 0:u.requestBody,responses:f}},context:t,source:t.source});return d.examples=d.examples.filter(c=>dqf(c,t)!==!0),{streaming:a,nonStreaming:d}}default:Ol(r)}}function lqf({context:e,operation:t,streamingExtension:r,isStreaming:n}){var c;if(t.requestBody==null)return;let i=gy(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=H3n(i.content,e);if(a==null)return;let u=gy(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(u.allOf==null&&u.properties==null)return;let f=(c=u.properties)==null?void 0:c[r.streamConditionProperty];f!=null&&gy(f)&&(f=void 0);let d={...u,properties:{...u.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":n,...f??{}}},title:void 0,required:[...u.required??[],r.streamConditionProperty]};return{requestBody:{content:{[sA.APPLICATION_JSON]:{schema:d}}},schemaReference:gy(a.schema)?a.schema:void 0}}function fqf({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[sA.APPLICATION_JSON]:{schema:t}}}}}function dqf(e,t){return e._visit({unknown:r=>{let n=h5.ExampleEndpointCallSchema.safeParse(r);if(!n.success){t.logger.error("Failed to parse example",n.error.toString());return}if(n.data.response!=null)return n.data.response.stream!=null},full:()=>{},_other:()=>{}})}function _qf({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:a,method:u,baseBreadcrumbs:f,sdkMethodName:d}=t,c=[...f,"Payload"],o=T1a({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:c,path:a,httpMethod:u,source:r});if(i.requestBody==null){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Missing a request body`);return}if(u!=="POST"&&u!=="GET"){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Not POST or GET`);return}let l=$3n({requestBody:i.requestBody,document:n,context:e,requestBreadcrumbs:[...f,"Payload"],source:r,namespace:e.namespace});if(l==null||l.type!=="json"){e.logger.error(`Skipping webhook ${a} because non-json request body`);return}if(i.operationId==null){e.logger.error(`Skipping webhook ${a} because no operation id present`);return}return{summary:i.summary,sdkName:d,namespace:e.namespace,method:u,operationId:i.operationId,tags:e.resolveTagsToTagIds(i.tags),headers:o.headers,generatedPayloadName:yR(c),payload:l.schema,description:i.description,examples:QX1(l.fullExamples),source:r}}function QX1(e){if(e==null)return[];let t=[];for(let r of e){let n=N5r(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function Ymu({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=Lh(r,kh.IGNORE);if(i!=null&&i){e.logger.info(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=ZX1(r,e),u=$2f(e.document,r),f={...t,sdkMethodName:a,baseBreadcrumbs:kX1({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path}),operation:r,operationParameters:r.parameters??[],pagination:u};if(n){let l=_qf({context:e,operationContext:f,source:e.source});return l!=null?{type:"webhook",value:l}:void 0}let d=W2f(r);if(d!=null){let l=pqf({context:e,operationContext:f,streamingExtension:d});return l!=null?{type:"streaming",streaming:l.streaming,nonStreaming:l.nonStreaming}:void 0}let c=U2f(r);if(c!=null){let l=cqf({context:e,operationContext:f,asyncExtension:c,source:e.source});return{type:"async",async:l.async,sync:l.sync}}let o=vEr({context:e,operationContext:f,streamFormat:void 0,source:e.source});return{type:"http",value:o}}function ZX1(e,t){let r=Lh(e,kh.SDK_METHOD_NAME),n=Lh(e,kh.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function kX1({sdkMethodName:e,operation:t,httpMethod:r,path:n}){let i=[];if(e!=null){if(e.groupName.length>0){let a=e.groupName[e.groupName.length-1];a!=null&&i.push(typeof a=="string"?a:a.name)}i.push(e.methodName)}else t.operationId!=null?i.push(t.operationId):i.push(FE(`${r}_${n.split("/").join("_")}`));return i}function hqf(e,t,r,n){let i=[],a=vqf(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let f of a){let d=eQ1({operation:f.operation}),c=Ymu({context:n,pathItemContext:{...u,method:f.method},operation:f.operation,convertToWebhook:d});c!=null&&i.push(c)}return i}function yqf(e,t,r,n){let i=[],a=vqf(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let f of a){let d=Ymu({context:n,pathItemContext:{...u,method:f.method},operation:f.operation,convertToWebhook:!0});d!=null&&i.push(d)}return i}function vqf(e){let t=[];return e.get!=null&&t.push({method:KJ.Get,operation:e.get}),e.post!=null&&t.push({method:KJ.Post,operation:e.post}),e.put!=null&&t.push({method:KJ.Put,operation:e.put}),e.delete!=null&&t.push({method:KJ.Delete,operation:e.delete}),e.patch!=null&&t.push({method:KJ.Patch,operation:e.patch}),t}function eQ1({operation:e}){return Lh(e,[kh.WEBHOOK])??!1}function bqf(e){let t=Lh(e,kh.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=Lh(e,kh.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function gqf(e){return Lh(e,kh.FERN_BASIC_AUTH)}function Xmu(e,t){if(gy(e))throw new Error(`Converting referenced security schemes is unsupported: ${JSON.stringify(e)}`);return tQ1(e,t)}function tQ1(e,t){var r,n,i,a;if(e.type==="apiKey"&&e.in==="header"){let u=Lh(e,Yje.BEARER_FORMAT),f=Lh(e,kh.FERN_HEADER_AUTH);return F9.header({headerName:e.name,prefix:u!=null?"Bearer":f==null?void 0:f.prefix,headerVariableName:(f==null?void 0:f.name)??Lh(e,kh.HEADER_VARIABLE_NAME),headerEnvVar:f==null?void 0:f.env})}else if(e.type==="http"&&e.scheme==="bearer"){let u=Lh(e,kh.FERN_BEARER_TOKEN);return F9.bearer({tokenVariableName:(u==null?void 0:u.name)??Lh(e,kh.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:u==null?void 0:u.env})}else if(e.type==="http"&&e.scheme==="basic"){let u=gqf(e),f=bqf(e);return F9.basic({usernameVariableName:((r=u==null?void 0:u.username)==null?void 0:r.name)??f.usernameVariable,usernameEnvVar:(n=u==null?void 0:u.username)==null?void 0:n.env,passwordVariableName:((i=u==null?void 0:u.password)==null?void 0:i.name)??f.passwordVariable,passwordEnvVar:(a=u==null?void 0:u.password)==null?void 0:a.env})}else{if(e.type==="openIdConnect")return F9.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return F9.oauth({scopesEnum:rQ1(e,t)})}throw new Error(`Failed to convert security scheme ${JSON.stringify(e)}`)}function rQ1(e,t){var n,i,a,u;let r=((n=e.flows.authorizationCode)==null?void 0:n.scopes)??((i=e.flows.clientCredentials)==null?void 0:i.scopes)??((a=e.flows.implicit)==null?void 0:a.scopes)??((u=e.flows.password)==null?void 0:u.scopes);if(r!=null){let f=C5r({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([c,o])=>[c,{description:o}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsNullable:!1,groupName:void 0,context:void 0,source:t}),d=oq(f);if(d.type==="enum")return d}}function mqf(e){return Lh(e,kh.BASE_PATH)}var nQ1=ir.record(ir.string(),ir.object({summary:ir.string().optional(),description:ir.string().optional()}));function Oqf({document:e,context:t}){return RRt(e,kh.GROUPS,nQ1,t.logger)}function Pqf({context:e,document:t}){return RRt(t,kh.FERN_VERSION,h5.VersionDeclarationSchema,e.logger)??void 0}function jqf(e){let t=Lh(e,kh.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?z_i({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function wqf(e){let t=Lh(e,kh.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?z_i({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function Dqf(e){let t=Lh(e,kh.SDK_VARIABLES);return t==null?{}:Object.fromEntries(Object.entries(t).map(([r,n])=>{if(n.type==="string")return[r,{nameOverride:void 0,generatedName:yR([r]),title:n.title,schema:Xw.string({default:Y7n(n),pattern:n.pattern,format:n.format,minLength:n.minLength,maxLength:n.maxLength}),description:n.description,availability:void 0,groupName:void 0}];throw new Error(`Variable ${r} has unsupported schema ${JSON.stringify(n)}`)}))}var iQ1="webhooks";function Sqf(e){return Lh(e,iQ1)??{}}var q1a=class extends V3n{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discrminatedUnionReferences={};discrminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u}){super({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u})}getDummy(){return new W3n({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discrminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discrminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discrminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discrminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discrminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discrminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function Eqf(e){return Lh(e,kh.RESOLUTIONS)}function Mqf({openapi:e}){let t=Eqf(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let a of n.resolutions)e=aQ1({openapi:e,schemaReference:a,schemaName:n.name}),e=xqf({openapi:e,replaceReference:a,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(u=>[i,u]))}}return e}function aQ1({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(a=>a.replace("~1","/")),i=e;for(let a of n){let u=i[a];if(u==null)return e;i=u}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function xqf({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(d=>t.startsWith(d)).sort((d,c)=>c.length-d.length)[0];if(i!=null){let d=n[i];if(d!=null){let c=r.replace(i,d);return xqf({openapi:e,replaceReference:t,schemaReference:c,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(d=>d.replace("~1","/")),u=e;for(let d of a.slice(0,-1)){let c=u[d];if(c==null)return e;u=c}let f=a[a.length-1];return f==null||(u[f]={$ref:r}),e}function C1a({openApi:e,taskContext:t,options:r,source:n,namespace:i}){var Y,te,G;e=Mqf({openapi:e});let a=Object.fromEntries(Object.entries(((Y=e.components)==null?void 0:Y.securitySchemes)??{}).map(([$,ee])=>Xmu(ee,n)==null?[]:[$,Xmu(ee,n)])),u=new Set(...Object.entries(a).map(([$,ee])=>ee.type==="basic"||ee.type==="bearer"?"Authorization":ee.type==="header"?ee.headerName:null)),f=new q1a({document:e,taskContext:t,authHeaders:u,options:r,source:n,namespace:i}),d=Dqf(e),c=jqf(e),o=wqf(e),l=r.audiences??[],g=[],O=[];Object.entries(e.paths??{}).forEach(([$,ee])=>{if(ee==null)return;t.logger.debug(`Converting path ${$}`);let Ve=hqf($,ee,e,f);for(let $e of Ve){let Dt=Tqf({operation:$e});if(!(l.length>0&&!l.some(Tt=>Dt.includes(Tt))))switch($e.type){case"async":g.push($e.sync),g.push($e.async);break;case"http":g.push($e.value);break;case"streaming":g.push($e.streaming),$e.nonStreaming&&g.push($e.nonStreaming);break;case"webhook":O.push($e.value);break;default:Ol($e)}}}),Object.entries(Sqf(e)).forEach(([$,ee])=>{if(ee==null)return;t.logger.debug(`Converting path ${$}`);let Ve=yqf($,ee,e,f);for(let $e of Ve){let Dt=Tqf({operation:$e});l.length>0&&!l.some(Tt=>Dt.includes(Tt))||O.push($e.value)}});let j=Object.fromEntries(Object.entries(((te=e.components)==null?void 0:te.schemas)??{}).map(([$,ee])=>{if(!gy(ee)){let Ve=Lh(ee,kh.IGNORE);if(Ve!=null&&Ve)return[];if(aqf.has($))return[$,L1({...ee,"x-fern-type-name":`${$}Body`},!1,f,[$],n,i)]}return[$,L1(ee,!1,f,[$],n,i)]}).filter($=>$.length>0)),S=oQ1(j,f,n),x=uQ1(S,f),A={};for(let[$,ee]of Object.entries(x)){let Ve=oq(ee);f.isSchemaExcluded($)||(A[$]=Ve,t.logger.debug(`Converted schema ${$}`))}let z=new fba(x,f.logger),N=g.map($=>{let ee=$.examples,Ve=ee;if(!r.disableExamples&&(ee.length===0||ee.every(F_i))){let Tt=z.buildEndpointExample($);Tt.length>0&&(Ve=[...Tt,...ee.filter(Wt=>!F_i(Wt))])}let $e=$.request,Dt=$.response;return{...$,request:($e==null?void 0:$e.type)==="json"?{...$e,schema:oq($e.schema)}:$e,response:(Dt==null?void 0:Dt.type)==="json"?{...Dt,schema:oq(Dt.schema)}:Dt,queryParameters:$.queryParameters.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,availability:Tt.availability,source:Tt.source})),pathParameters:$.pathParameters.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,variableReference:Tt.variableReference,availability:Tt.availability,source:Tt.source})),headers:$.headers.map(Tt=>({description:Tt.description,name:Tt.name,schema:oq(Tt.schema),parameterNameOverride:Tt.parameterNameOverride,env:Tt.env,availability:Tt.availability,source:Tt.source})),examples:Ve,errors:sy($.errors,Tt=>{var Wt;return{generatedName:Tt.generatedName,nameOverride:Tt.nameOverride,schema:oq(Tt.schema),description:Tt.description,source:Tt.source,examples:(Wt=Tt.fullExamples)==null?void 0:Wt.map(Nt=>{let ur=N5r(Nt.value);if(ur!=null)return{name:Nt.name,description:Nt.description,example:ur}}).filter(RS)}})}}),C=Oqf({document:e,context:f});return{apiVersion:Pqf({context:f,document:e}),basePath:mqf(e),title:e.info.title,description:e.info.description,groups:Object.fromEntries(Object.entries(C??{}).map(([$,ee])=>[$,{summary:ee.summary??void 0,description:ee.description??void 0}])),servers:(e.servers??[]).map($=>x1a($)),tags:{tagsById:Object.fromEntries((e.tags??[]).map($=>[$.name,{id:$.name,description:$.description}])),orderedTagIds:(G=e.tags)==null?void 0:G.map($=>$.name)},endpoints:N,webhooks:O,channel:[],groupedSchemas:sba(i,A),securitySchemes:a,hasEndpointsMarkedInternal:N.some($=>$.internal),nonRequestReferencedSchemas:f.getReferencedSchemas(),variables:d,globalHeaders:c,idempotencyHeaders:o}}function oQ1(e,t,r){let n={};for(let[i,a]of Object.entries(e)){if(a.type!=="object"){n[i]=a;continue}let u={$ref:`#/components/schemas/${i}`},f=t.getReferencesFromDiscriminatedUnion(u);if(f==null){n[i]=a;continue}let d={...a,type:"object",properties:a.properties.filter(o=>!f.discriminants.has(o.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(o=>!f.discriminants.has(o.propertyKey)),source:r};n[i]=d;let c=qqf({schema:a,schemas:e});for(let o of[...new Set(c)]){let l=n[o]??e[o];l==null||l.type!=="object"||(n[o]={...l,type:"object",properties:l.properties.filter(g=>!f.discriminants.has(g.key)),allOfPropertyConflicts:l.allOfPropertyConflicts.filter(g=>!f.discriminants.has(g.propertyKey))})}}return n}function uQ1(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let a={$ref:`#/components/schemas/${n}`},u=t.getDiscriminatedUnionMetadata(a);if(u==null){r[n]=i;continue}let f=[];for(let c of i.properties)if(u.discriminants.has(c.key)){let o=u.discriminants.get(c.key);o!=null&&f.push({...c,schema:Lp.literal({nameOverride:void 0,generatedName:yR([i.generatedName,o]),title:void 0,value:E7.string(o),groupName:void 0,description:void 0,availability:i.availability})})}else f.push(c);let d={...i,type:"object",properties:f};r[n]=d}return r}function qqf({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...qqf({schema:i,schemas:t}))}return r}function Tqf({operation:e}){let t=[];switch(e.type){case"async":t=e.async.audiences;break;case"http":t=e.value.audiences;break;case"streaming":t=e.streaming.audiences;break;case"webhook":break;default:Ol(e)}return t}async function Aqf({openApi:e,taskContext:t,options:r,source:n,namespace:i}){let a=await(0,Cqf.convertObj)(e,{});return C1a({openApi:a.openapi,taskContext:t,options:r,source:n,namespace:i})}var J3n={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0};async function Ktn({absoluteFilePathToWorkspace:e,specs:t,taskContext:r,optionOverrides:n}){let i={apiVersion:void 0,title:void 0,description:void 0,basePath:void 0,servers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channel:[],groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},globalHeaders:[],idempotencyHeaders:[],groups:{}};for(let a of t){let u=(await(0,Zmu.readFile)(a.absoluteFilepath)).toString(),f=YN(e,a.source.file);a.source.relativePathToDependency!=null&&(f=pf(a.source.relativePathToDependency,f));let d=a.source.type==="protobuf"?HSr.protobuf({file:f}):HSr.openapi({file:f});if(u.includes("openapi")||u.includes("swagger")){let c=await REf({absolutePathToOpenAPI:a.absoluteFilepath,context:r,absolutePathToOpenAPIOverrides:a.absoluteFilepathToOverrides});if(lQ1(c)){let o=C1a({openApi:c,taskContext:r,options:Qmu({specSettings:a.settings,overrides:n}),source:d,namespace:a.namespace});i=Nqf(i,o)}else if(fQ1(c)){let o=await Aqf({openApi:c,taskContext:r,options:Qmu({specSettings:a.settings}),source:d,namespace:a.namespace});i=Nqf(i,o)}}else if(u.includes("asyncapi")){let c=await cQ1({absoluteFilePathToAsyncAPI:a.absoluteFilepath,context:r,absoluteFilePathToAsyncAPIOverrides:a.absoluteFilepathToOverrides}),o=Tpf({document:c,taskContext:r,options:Qmu({specSettings:a.settings}),source:d,asyncApiOptions:sQ1({specSettings:a.settings}),namespace:a.namespace});o.channel!=null&&i.channel.push(o.channel),o.groupedSchemas!=null&&(i.groupedSchemas=zqf(i.groupedSchemas,o.groupedSchemas)),o.basePath!=null&&(i.basePath=o.basePath)}else r.failAndThrow(`${a.absoluteFilepath} is not a valid OpenAPI or AsyncAPI file`)}return i}function Qmu({specSettings:e,overrides:t}){return{disableExamples:(t==null?void 0:t.disableExamples)??J3n.disableExamples,discriminatedUnionV2:(t==null?void 0:t.discriminatedUnionV2)??(e==null?void 0:e.shouldUseUndiscriminatedUnionsWithLiterals)??J3n.discriminatedUnionV2,useTitlesAsName:(t==null?void 0:t.useTitlesAsName)??(e==null?void 0:e.shouldUseTitleAsName)??J3n.useTitlesAsName,audiences:(t==null?void 0:t.audiences)??(e==null?void 0:e.audiences)??J3n.audiences,optionalAdditionalProperties:(t==null?void 0:t.optionalAdditionalProperties)??(e==null?void 0:e.optionalAdditionalProperties)??J3n.optionalAdditionalProperties}}function sQ1({specSettings:e,overrides:t}){return{naming:(t==null?void 0:t.naming)??(e==null?void 0:e.asyncApiNaming)??tpf.naming}}function Nqf(e,t){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],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],channel:[...e.channel,...t.channel],groupedSchemas:zqf(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},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 zqf(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,n]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...n}:e.namespacedSchemas[r]=n;return e}async function cQ1({absoluteFilePathToAsyncAPI:e,absoluteFilePathToAsyncAPIOverrides:t,context:r}){let n=(await(0,Zmu.readFile)(e)).toString(),i=await av.load(n);return t!=null?await jPa({absoluteFilepathToOverrides:t,context:r,data:i}):i}function lQ1(e){return e.openapi!=null}function fQ1(e){return e.swagger!=null}function N1a({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=kmu({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=A2(i.value);if(a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>"),e.description==null&&!i.allowMultiple&&e.parameterNameOverride==null&&e.availability==null)return a;let u={type:a};return i.allowMultiple&&(u["allow-multiple"]=!0),e.description!=null&&(u.docs=e.description),e.parameterNameOverride!=null&&(u.name=e.parameterNameOverride),e.availability!=null&&(u.availability=q3(e.availability)),u}function kmu({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,groupName:void 0}),context:t,declarationFile:zs.of(HT),fileContainingReference:r,namespace:n}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undisciminated"){let a=[];for(let[u,f]of Object.entries(i.value.schemas))f.type==="literal"&&f.value.type==="string"&&(G7n.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:B_i(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[u,f]=i.value.schemas;if(u!=null&&f!=null&&A1a({array:u,primitive:f}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(u!=null&&f!=null&&A1a({array:u,primitive:f}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}}for(let[u,f]of Object.entries(i.value.schemas))return kmu({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(i.type==="object")return}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let i=t.getSchema(e.value.schema,n);if(i==null)return;if(i.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,declarationFile:zs.of(HT),namespace:n}),allowMultiple:!0}}if(e.value.type==="array")return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undisciminated"){let i=[];for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="literal"&&u.value.type==="string"&&(G7n.test(u.value.value)?i.push(u.value.value):i.push({value:u.value.value,name:B_i(u.value.value)}));if(i.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:i}}),{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&A1a({array:a,primitive:u}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0};if(a!=null&&u!=null&&A1a({array:u,primitive:a}))return{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}}for(let[a,u]of Object.entries(e.value.value.schemas))return kmu({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return;return{value:S1({schema:e,context:t,fileContainingReference:r,namespace:n}),allowMultiple:!1}}return e.type==="array"?{value:S1({schema:ib.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,groupName:void 0}),context:t,fileContainingReference:r,namespace:n}),allowMultiple:!0}:{value:S1({schema:e,context:t,fileContainingReference:r,namespace:n}),allowMultiple:!1}}function A1a({array:e,primitive:t}){return(e==null?void 0:e.type)==="array"&&e.value.type==="primitive"&&(t==null?void 0:t.type)==="primitive"&&e.value.schema.type===t.schema.type}function Bqf({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=dQ1(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=pQ1({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Rzr(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function dQ1(e){let t={};return e.forEach(r=>{let n=Rzr(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function pQ1({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=Rzr(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Rzr(e){switch(e.type){case"primitive":return Iqf(e.value);case"object":return Rqf(e.properties);case"array":return _Q1(e.value);case"map":return hQ1(e.value);case"oneOf":return yQ1(e.value);case"enum":return e.value;case"literal":return vQ1(e.value);case"unknown":return Rzr(e.value);default:Ol(e)}}function Iqf(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Ol(e)}}function Rqf(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Rzr(r)]))}function _Q1(e){return e.map(t=>Rzr(t))}function hQ1(e){return Object.fromEntries(e.map(t=>[Iqf(t.key),Rzr(t.value)]))}function yQ1(e){return e.type==="discriminated"?Rqf(e.value):Rzr(e.value)}function vQ1(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ol(e)}}function bEr(e){var t;return(t=e.find(r=>typeof r!="string"&&r.type==="namespace"))==null?void 0:t.name}function z1a(e,t){return t??((e==null?void 0:e.groupName)!=null?bEr(e.groupName):void 0)}function Fqf({channel:e,context:t,declarationFile:r}){let n={path:e.path,auth:!1};e.summary!=null&&(n["display-name"]=e.summary);let i=bEr(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=eba({pathParameter:d,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let c=N1a({queryParameter:d,context:t,fileContainingReference:r,namespace:i});c!=null&&(u[d.name]=c)}Object.keys(u).length>0&&(n["query-parameters"]=u);let f={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let c=IRt({header:d,context:t,fileContainingReference:r,namespace:i});f[d.name]=c}Object.keys(f).length>0&&(n.headers=f),t.builder.addChannel(r,{channel:n}),e.subscribe!=null&&t.builder.addChannelMessage(r,{messageId:"subscribe",message:{origin:"server",body:S1({schema:e.subscribe,context:t,fileContainingReference:r,namespace:i})}}),e.publish!=null&&t.builder.addChannelMessage(r,{messageId:"publish",message:{origin:"client",body:S1({schema:e.publish,context:t,fileContainingReference:r,namespace:i})}});for(let d of e.examples){let c=Bqf({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:c})}}var Lqf="Production",Uqf="Default";function Vqf(e){return Object.entries(e).reduce((t,[r,n])=>(U2n(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function Wqf(e){var f,d;if(e.environmentOverrides!=null){for(let[c,o]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:c,schema:o});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[];for(let c of e.ir.servers){let o=c.audiences?{url:c.url,audiences:c.audiences}:c.url;if(c.name==null){r.push(o);continue}t[c.name]=o}let n={},i=[];for(let c of e.ir.endpoints)for(let o of c.server){if(o.url==null)continue;let l=o.audiences?{url:o.url,audiences:o.audiences}:o.url;if(o.name==null){i.push(l);continue}n[o.name]=l}let a=Object.keys(t).length,u=Object.keys(n).length;if(a===0&&u===0){let c=(f=e.ir.servers[0])==null?void 0:f.url,o=(d=e.ir.servers[0])==null?void 0:d.audiences;c!=null&&(e.builder.addEnvironment({name:Uqf,schema:o?{url:c,audiences:o}:c}),e.builder.setDefaultEnvironment(Uqf))}else if(a>0&&u===0){let c=0;r.length>0&&e.logger.error(`Skipping servers ${r.map(o=>typeof o=="string"?o:o.url).join(", ")} because x-fern-server-name was not provided.`);for(let[o,l]of Object.entries(t))c===0&&e.builder.setDefaultEnvironment(o),e.builder.addEnvironment({name:o,schema:l}),c+=1}else if(u>0){(r.length>0||i.length>0)&&e.logger.error(`Skipping servers ${[...r,...i].map(o=>typeof o=="string"?o:o.url).join(", ")} because x-fern-server-name was not provided.`);let c=Object.entries(t)[0];if(c!=null){let[o,l]=c;e.setDefaultServerName(o)}e.builder.addEnvironment({name:Lqf,schema:{urls:{...Vqf(t),...Vqf(n)}}}),e.builder.setDefaultEnvironment(Lqf)}}function B1a(e){return A2(e).startsWith("optional")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var eOu=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},bQ1=.75,gQ1=new Set("authorization");function Hqf(e){let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?V7n(n.schema):void 0,u=a!=null?bEr(a):void 0,f=zs.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?A2(S1({schema:n.schema,context:e,fileContainingReference:u?pf(zs.of(FE(u)),f):f,namespace:u}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(gQ1.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let f=t[a.name],d=IRt({header:{...a,schema:(f==null?void 0:f.schema)??a.schema,name:(f==null?void 0:f.name)??a.name},fileContainingReference:zs.of(nB),context:e,namespace:void 0});u=new eOu(d),r[a.name]=u}u.increment()}let n=e.ir.endpoints.length*bQ1;for(let[i,a]of Object.entries(r)){let u=t[i],f=a.count===e.ir.endpoints.length,d=a.count>=n;u==null&&(f?e.builder.addGlobalHeader({name:i,schema:a.schema}):d&&e.builder.addGlobalHeader({name:i,schema:B1a(a.schema)}))}}}function $qf(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?V7n(t.schema):void 0,n=r!=null?bEr(r):void 0,i=IRt({header:{...t,schema:t.schema??ib.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0,schema:Xw.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0},fileContainingReference:zs.of(nB),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:B1a(i)})}}function lG(e){switch(e.type){case"primitive":return Jqf(e.value);case"object":return Gqf(e.properties);case"array":return mQ1(e.value);case"map":return OQ1(e.value);case"oneOf":return PQ1(e.value);case"enum":return e.value;case"literal":return jQ1(e.value);case"unknown":return lG(e.value);default:Ol(e)}}function Jqf(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Ol(e)}}function Gqf(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,lG(r)]))}function mQ1(e){return e.map(t=>lG(t))}function OQ1(e){return Object.fromEntries(e.map(t=>[Jqf(t.key),lG(t.value)]))}function PQ1(e){return e.type==="discriminated"?Gqf(e.value):lG(e.value)}function jQ1(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ol(e)}}function Kqf({endpointExample:e,context:t}){let r={};return e.type!=="full"?e.value:(e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=wQ1(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=DQ1(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=SQ1({context:t,namedFullExamples:e.headers})),e.request!=null&&(r.request=lG(e.request)),e.response!=null&&(r.response={body:lG(e.response)}),e.response!=null&&(r.response={body:lG(e.response)}),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(n=>n.type==="language"?{name:n.name??void 0,docs:n.description??void 0,language:n.language,code:n.code,install:n.install??void 0}:{name:n.name??void 0,docs:n.description??void 0,sdk:n.sdk,code:n.code}).filter(RS)),r)}function wQ1(e){let t={};return e.forEach(r=>{let n=lG(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function DQ1(e){let t={};return e.forEach(r=>{let n=lG(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function SQ1({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=lG(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Yqf(e){return KJ._visit(e,{get:()=>h5.HttpMethodSchema.Enum.GET,post:()=>h5.HttpMethodSchema.Enum.POST,put:()=>h5.HttpMethodSchema.Enum.PUT,patch:()=>h5.HttpMethodSchema.Enum.PATCH,delete:()=>h5.HttpMethodSchema.Enum.DELETE,head:()=>{throw new Error("HEAD is unsupported")},options:()=>{throw new Error("HEAD is unsupported")},trace:()=>{throw new Error("HEAD is unsupported")},_other:()=>{throw new Error("Unkown http method is unsupported")}})}function Xqf({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,u=e.path,f=z1a(e.sdkName,e.namespace),d={};for(let S of e.pathParameters)S.parameterNameOverride&&(u=u.replace(S.name,S.parameterNameOverride)),d[S.parameterNameOverride??S.name]=eba({pathParameter:S,context:r,fileContainingReference:t,namespace:f}),a.add(S.name);let c={};for(let S of e.queryParameters){let x=N1a({queryParameter:S,context:r,fileContainingReference:t,namespace:f});x!=null&&(c[S.name]=x,a.add(S.name))}let o;e.pagination!=null&&(e.pagination.type==="cursor"?o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results}:o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage});let l={path:u,method:Yqf(e.method),auth:e.authed,docs:e.description??void 0,pagination:o};Object.keys(d).length>0&&(l["path-parameters"]=d),e.summary!=null&&(l["display-name"]=e.summary);let g={},O=r.builder.getGlobalHeaderNames(),j=e.headers.filter(S=>!O.has(S.name));for(let S of j){let x=IRt({header:S,context:r,fileContainingReference:t,namespace:f});g[S.name]=x,a.add(typeof x=="string"?S.name:x.name??S.name)}if(e.request!=null){let S=MQ1({context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,queryParameters:Object.keys(c).length>0?c:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(g).length>0?g:void 0,usedNames:a,namespace:f});l.request=S.value,i=[...i,...S.schemaIdsToExclude??[]]}else{let S=Object.keys(c).length>0,x=Object.keys(g).length>0,A={};(S||x)&&(A.name=e.requestNameOverride??e.generatedRequestName),S&&(A["query-parameters"]=c),x&&(A.headers=g),Object.keys(A).length>0&&(l.request=A)}if(e.response!=null&&e.response._visit({json:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l.response={docs:S.description??void 0,type:A2(x)},S.responseProperty!=null&&(l.response.property=S.responseProperty)},streamingJson:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l["response-stream"]={docs:S.description??void 0,type:A2(x),format:"json"}},streamingSse:S=>{let x=S1({schema:S.schema,context:r,fileContainingReference:t,namespace:f});l["response-stream"]={docs:S.description??void 0,type:A2(x),format:"sse"}},file:S=>{l.response={docs:S.description??void 0,type:"file"}},streamingText:S=>{l["response-stream"]={docs:S.description??void 0,type:"text"}},text:S=>{l.response={docs:S.description??void 0,type:"text"}},_other:()=>{var S;throw new Error("Unrecognized Response type: "+((S=e.response)==null?void 0:S.type))}}),r.builder.getEnvironmentType()==="multi"){let S=r.getDefaultServerName(),x=e.server[0];x==null?S!=null&&(l.url=S):l.url=x.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=q3(e.availability)),Object.entries(e.errors).forEach(([S,x])=>{var te;let A=x.generatedName,z=zs.of(HT);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${x.generatedName}`,x.schema!=null&&(x.schema.type!=="reference"&&x.schema.type!=="oneOf"?x.schema.generatedName=`${e.generatedRequestName}${x.schema.generatedName}`:x.schema.type==="oneOf"&&(x.schema.value.generatedName=`${e.generatedRequestName}${x.schema.value.generatedName}`)));let N={"status-code":parseInt(S)},C=Gdf({location:Qqf,namespaceOverride:f});if(x.schema!=null){let G=S1({schema:x.schema,context:r,fileContainingReference:C,declarationFile:C,namespace:f});N.type=A2(G),N.docs=x.description}r.builder.addError(C,{name:A,schema:N}),l.errors==null&&(l.errors=[]);let U=r.builder.addImport({file:t,fileToImport:C});l.errors.push(U!=null?`${U}.${A}`:A),N.type!=null&&((te=x.examples)==null||te.forEach(G=>{let $={value:lG(G.example),name:G.name,docs:G.description};r.builder.addErrorExample(C,{name:A,example:$})}))}),e.examples.length>0&&(l.examples=EQ1({endpointExamples:e.examples,context:r})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[tOu,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function EQ1({endpointExamples:e,context:t}){return e.map(r=>{try{return Kqf({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function MQ1({declarationFile:e,context:t,request:r,requestNameOverride:n,generatedRequestName:i,queryParameters:a,nonRequestReferencedSchemas:u,headers:f,usedNames:d,namespace:c}){if(r.type==="json"){let o=r.schema.type==="reference"?r.schema.schema:void 0,l=r.schema.type==="reference"?t.getSchema(r.schema.schema,c):r.schema;if((l==null?void 0:l.type)!=="object"||o!=null&&u.includes(o)){let x=S1({schema:r.schema,fileContainingReference:e,context:t,namespace:c}),A={schemaIdsToExclude:[],value:{body:x}},z=Object.keys(a??{}).length>0,N=Object.keys(f??{}).length>0;return z&&(A.value["query-parameters"]=a),N&&(A.value.headers=f),(z||N)&&(A.value.name=n??i),r.contentType!=null&&(A.value["content-type"]=r.contentType),A}let g=Object.fromEntries(l.properties.map(x=>{let A=S1({schema:x.schema,fileContainingReference:e,context:t,namespace:c}),z=x.nameOverride??x.key,N=q3(x.availability);if(!d.has(z)&&x.audiences.length<=0)return d.add(z),x.nameOverride!=null?[x.key,{type:A2(A),docs:A_i(A),name:x.nameOverride,availability:N}]:[x.key,N?{...typeof A=="string"?{type:A}:A,availability:N}:A];let C={type:A2(A),docs:A_i(A)};return d.has(z)&&(C.name=x.generatedName),x.audiences.length>0&&(C.audiences=x.audiences),N!=null&&(C.availability=N),d.add(z),[x.key,C]})),O=l.allOf.map(x=>{let A=S1({schema:ib.reference(x),fileContainingReference:e,context:t,namespace:c});return A2(A)}),j={properties:g};O.length>0&&(j.extends=O),r.additionalProperties&&(j["extra-properties"]=!0);let S={name:n??l.nameOverride??l.generatedName,"query-parameters":a,headers:f,body:j};return r.contentType!=null&&(S["content-type"]=r.contentType),{schemaIdsToExclude:o!=null?[o]:[],value:S}}else{if(r.type==="octetStream")return{schemaIdsToExclude:[],value:{body:"bytes","content-type":sA.APPLICATION_OCTET_STREAM}};if(r.type==="multipart"){let o=Object.fromEntries(r.properties.map(l=>{if(l.schema.type==="file"){let g=l.schema.isArray?"list<file>":"file";if(g=l.schema.isOptional?`optional<${g}>`:g,l.description!=null||l.contentType!=null){let O={type:g};return l.description!=null&&(O.docs=l.description),l.contentType!=null&&(O["content-type"]=l.contentType),[l.key,O]}return[l.key,g]}else{let g=S1({schema:l.schema.value,fileContainingReference:e,context:t,namespace:c});return l.contentType!=null&&(typeof g=="string"?g={type:g,"content-type":l.contentType}:g["content-type"]=l.contentType),[l.key,g]}}));return{schemaIdsToExclude:r.name==null?[]:[r.name],value:{name:n??r.name??i,"query-parameters":a,headers:f,body:{properties:o},"content-type":sA.MULTIPART_FORM_DATA}}}else Ol(r)}}function xQ1({location:e,namespaceOverride:t}){return t!=null?{...e,file:pf(zs.of(t),e.file)}:e}function TQ1(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:zs.of(`${FE(r)}.yml`),endpointId:e.summary!=null?FE(e.summary):FE(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:zs.of(HT),endpointId:FE(e.summary)}:{file:zs.of(HT),endpointId:FE(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:zs.of(HT),endpointId:n};let i=A0i(r),a=A0i(n);if(iDr(i,a))return{file:zs.of("__package__.yml"),endpointId:r};let u=AQ1({operationId:n,tag:r,path:e.path,method:e.method});if(u!=null)return u;let f=[];for(let d=0;d<i.length;++d){let c=i[d];if(c!=null&&c===a[d])f.push(c);else{let o=FE(r);return{file:zs.of(`${o}.yml`),endpointId:n,tag:r}}}if(f.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:zs.of(FE(f.join("_"))+".yml"),endpointId:FE(a.slice(f.length).join("_")),tag:r}}function N0i(e){let t=e.tags[0];if(e.sdkName!=null){let r=klu({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===(t==null?void 0:t.toLowerCase().replaceAll(" ",""));return{file:zs.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return xQ1({namespaceOverride:e.namespace,location:TQ1(e)})}function A0i(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=X8t(t),t}var qQ1=new RegExp("[^a-zA-Z0-9{}]+"),CQ1=new RegExp("[{}]","g");function AQ1({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(qQ1).join("_").replaceAll(CQ1,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:zs.of(FE(t)+".yml"),endpointId:FE(e.slice(0,-1*a.length)),tag:t}}function Zqf(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:u,file:f,tag:d}=N0i(a),c=f.split(".")[0];c!=null&&t.add(c);let o;if(a.sdkName!=null){let O=e.ir.groups;for(let j of a.sdkName.groupName){let S=typeof j=="string"?j:j.name,x=O[S];if(x==null)break;if(x.summary!=null||x.description!=null){o=O[S];break}}}let l=d==null?void 0:n.tagsById[d],g=Xqf({context:e,endpoint:a,declarationFile:f});i=[...i,...g.schemaIdsToExclude],e.builder.addEndpoint(f,{name:u,schema:g.value,source:a.source}),((l==null?void 0:l.id)!=null||(l==null?void 0:l.description)!=null)&&e.builder.setServiceInfo(f,{displayName:(o==null?void 0:o.summary)??(l==null?void 0:l.id),docs:(o==null?void 0:o.description)??(l==null?void 0:l.description)??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function kqf(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?bEr(r.groupName):void 0,i=S1({schema:ib.primitive(r),context:e,fileContainingReference:zs.of(HT),namespace:n});e.builder.addVariable({name:t,schema:{type:A2(i),docs:r.description??void 0}})}}function eCf(e){for(let t of e.ir.webhooks){let r=BQ1({webhook:t,context:e});if(r==null)continue;let n=z1a(t.sdkName,t.namespace),i={};for(let u of t.headers)i[u.name]=IRt({header:u,context:e,fileContainingReference:r.file,namespace:n});let a={method:t.method,"display-name":t.summary??void 0,headers:i,payload:S1({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:lG(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function NQ1({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:pf(zs.of(t),e.file)}:e}function zQ1({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:zs.of(HT),endpointId:n};let i=A0i(r),a=A0i(n);if(iDr(i,a))return{file:zs.of("__package__.yml"),endpointId:r};let u=[];for(let f=0;f<i.length;++f){let d=i[f];if(d!=null&&d===a[f])u.push(d);else{let c=FE(r);return{file:zs.of(`${c}.yml`),endpointId:n,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:zs.of(FE(u.join("_"))+".yml"),endpointId:FE(a.slice(u.length).join("_")),tag:r}}function BQ1({webhook:e,context:t}){return e.sdkName!=null?{file:Jdf({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:NQ1({namespaceOverride:e.namespace,location:zQ1({webhook:e,context:t})})}var IQ1=zs.of(HT);function tCf(e){switch(e.type){case"object":return bFt(e.groupName);case"enum":return bFt(e.groupName);case"oneOf":return bFt(e.value.groupName);case"array":return bFt(e.groupName);case"map":return bFt(e.groupName);case"reference":return bFt(e.groupName);case"literal":return bFt(e.groupName);case"optional":return bFt(e.groupName);case"nullable":return bFt(e.groupName);case"primitive":return bFt(e.groupName);case"unknown":return IQ1;default:Ol(e)}}function bFt(e){return W7n(e)}var tOu="external",Qqf=zs.of(HT);function rCf({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let u=tCf(a),f=Xdf({schema:a,context:n,declarationFile:u,namespace:r});if(W2n(f.schema)){let d=A2(f.schema);if(d===(f.name??i)||d===`optional<${f.name??i}>`)continue}n.builder.addType(u,{name:f.name??i,schema:f.schema})}}function nCf(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Wqf(e),Hqf(e),$qf(e),epf(e),kqf(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(tOu);let{schemaIdsToExclude:t,sdkGroups:r}=Zqf(e);eCf(e);for(let n of e.ir.channel){let i=W7n(n.groupName);Fqf({channel:n,context:e,declarationFile:i})}rCf({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:t,namespace:void 0,context:e});for(let[n,i]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))rCf({schemas:i,schemaIdsToExclude:t,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(i=>r.has(i))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}var Fzr=yu(require("path"),1);var I1a=yu(require("path"),1),G3n=class{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[u,f]of Object.entries(n.files)){let d=i!=null?zs.of(`${i}${I1a.default.sep}${u}`):zs.of(u);t[d]=f}let a=Object.keys(n.directories).sort();for(let u of a){let f=i!=null?`${i}${I1a.default.sep}${u}`:u,d=n.directories[u];r(d,f)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(I1a.default.sep))}getOrCreateFileRecursive(t){var i,a;if(t.length===1)return(i=this.files)[a=zs.of(t[0])]??(i[a]={});let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new G3n),this.directories[r].getOrCreateFileRecursive(n)}};var R1a=class{modifyBasePaths;enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t,r,n){this.modifyBasePaths=r,this.enableUniqueErrorsPerEndpoint=n,this.root=new G3n,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}},t.title!=null&&(this.rootApiFile["display-name"]=t.title)}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{displayName:r,docs:n}){let i=this.getOrCreateFile(t);i.service==null&&(i.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(i.service["display-name"]=r),n!=null&&(i.docs=n)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return ADr(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{}),r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r}){if(t===r)return;let n=FE((Cg(r)+"/"+(0,Fzr.basename)(r,(0,Fzr.extname)(r))).replaceAll("__package__","root"));if(t===zs.of(nB))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=YN(Cg(I_.of(`/${t}`)),I_.of(`/${r}`)),n;let i=this.getOrCreateFile(t);return i.imports==null&&(i.imports={}),i.imports[n]=YN(Cg(I_.of(`/${t}`)),I_.of(`/${r}`)),n}addType(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){var a;let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:((a=i.errors[r])==null?void 0:a.type)!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){var f;let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(d=>iDr(d,n))??!1)||(f=a.examples)==null||f.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=Ien(i)),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=Fzr.default.join(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles();if(this.modifyBasePaths){let i=RQ1(this.rootApiFile);this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([a,u])=>[a,{...u,path:`${i}${u.path}`}]))});for(let a of Object.values(t))a.service!=null&&(a.service={...a.service,endpoints:Object.fromEntries(Object.entries(a.service.endpoints).map(([u,f])=>[u,{...f,path:`${i}${f.path}`}]))});this.rootApiFile.environments!=null&&(this.rootApiFile.environments={...Object.fromEntries(Object.entries(this.rootApiFile.environments).map(([a,u])=>typeof u=="string"?[a,u.substring(0,u.length-i.length)]:iCf(u)?[a,{url:u.url.substring(0,u.url.length-i.length)}]:[a,{urls:Object.fromEntries(Object.entries(u.urls).map(([f,d])=>[f,d.substring(0,d.length-i.length)]))}]))})}let r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:Fzr.default.join(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,u])=>[a,{...u,path:Fzr.default.join(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===HT?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function RQ1(e){if(e.environments==null)return"";let t=Object.entries(e.environments).flatMap(([r,n])=>typeof n=="string"?[n]:iCf(n)?[n.url]:Object.values(n.urls));return LQ1(t.map(FQ1))}function FQ1(e){try{let r=new URL(e).pathname;return r.endsWith("/")?r.slice(0,-1):r}catch{return""}}function LQ1(e){let t="";for(;;){let r=e.map(i=>i[i.length-t.length-1]),n=r[0];if(n==null||r.some(i=>i!==n))break;t=n+t}return t}function iCf(e){return e.url!=null}var F1a=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;detectGlobalHeaders;defaultServerName=void 0;constructor({taskContext:t,ir:r,enableUniqueErrorsPerEndpoint:n,detectGlobalHeaders:i,environmentOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.builder=new R1a(r,!1,n),this.detectGlobalHeaders=i,this.environmentOverrides=a,this.authOverrides=u}getSchema(t,r){var n;return r==null?this.ir.groupedSchemas.rootSchemas[t]:(n=this.ir.groupedSchemas.namespacedSchemas[r])==null?void 0:n[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}};function rOu(e){let t=new F1a(e);return nCf(t)}var CAf=yu(qAf(),1);async function iwe(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...u}={}){var o,l;let f=i.reduce((g,O)=>({...g,[O]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[g,O]of Object.entries(f))d=d.replaceAll(g,O);e==null||e.debug(`+ ${d}`);let c=(0,CAf.default)(t,r,u);return n||((o=c.stdout)==null||o.pipe(process.stdout),(l=c.stderr)==null||l.pipe(process.stderr)),c}function G1a(e,{logger:t,...r}={}){return(n,i)=>iwe(t,e,n,{...r,...i})}var Y1a=require("fs/promises"),AAf=yu(Jte(),1),Ak1="buf.gen.yaml",NAf="output",Nk1=`${NAf}/openapi.yaml`,zk1=`
|
|
1908
1908
|
version: v1
|
|
1909
1909
|
plugins:
|
|
1910
1910
|
- plugin: openapi
|
|
@@ -1917,7 +1917,7 @@ plugins:
|
|
|
1917
1917
|
`);return t.failAndThrow(a)}function Lzr(e,t={}){return{...Object.fromEntries(v3(e.namedDefinitionFiles).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...v3(e.importedDefinitions).reduce((r,[n,i])=>({...r,...Ksi(Lzr(i.definition,{defaultURL:i.url}),(a,u)=>pf(n,zs.of(u)))}),{})}}function F0i(e,t={}){return{...Object.fromEntries(v3(e.packageMarkers).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...v3(e.importedDefinitions).reduce((r,[n,i])=>({...r,...Ksi(F0i(i.definition,{defaultURL:i.url}),(a,u)=>pf(n,zs.of(u)))}),{})}}function gEr(e){return{...F0i(e),...Lzr(e)}}function Vne(e,t){var r;return(r=gEr(e.definition)[t])==null?void 0:r.contents}var IAf=yu(require("path"),1);async function N5(e,t){for(let[r,n]of v3(gEr(e.definition)))await t(r,n.contents,{isPackageMarker:IAf.default.basename(r)===HT,defaultUrl:n.defaultUrl})}async function Xtn(e,t){for(let[r,n]of v3(F0i(e.definition)))await t(r,n.contents)}var RAf=require("fs/promises");async function OOu({context:e,nameOverride:t,...r}){let n=await wBt(t);return n==null?e.failAndThrow(`Directory "${t??Yqt}" not found.`):await FAf({absolutePathToFernDirectory:n,context:e,nameOverride:t,...r})}async function FAf({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i,context:a}){let u=[];return(await Vh(pf(e,zs.of(k7r)))||await Vh(pf(e,zs.of(p9)))||await Vh(pf(e,zs.of(i5)))||await Vh(pf(e,zs.of(RXr)))||await Vh(pf(e,zs.of(e7c))))&&(u=await LAf({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i})),{config:await e5t.loadProjectConfig({directory:e,context:a}),apiWorkspaces:u,docsWorkspaces:await mOu({fernDirectory:e,context:a}),loadAPIWorkspace:f=>f==null?u[0]:u.find(d=>d.workspaceName===f)}}async function LAf({cliName:e,fernDirectory:t,context:r,cliVersion:n,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:a}){let u=pf(t,zs.of(k7r));if(await Vh(u)){let o=(await(0,RAf.readdir)(u,{withFileTypes:!0})).reduce((O,j)=>(j.isDirectory()&&O.push(j.name),O),[]);if(i!=null){if(!o.includes(i))return r.failAndThrow("API does not exist: "+i)}else{if(o.length===0)return r.failAndThrow("No APIs found.");if(o.length>1&&!a){let O=`There are multiple workspaces. You must specify one with --api:
|
|
1918
1918
|
`,j=Math.max(...o.map(S=>S.length));return O+=o.map(S=>{let x=`${e} ${process.argv.slice(2).join(" ")} --api ${S}`;return` \u203A ${cl.bold(S.padEnd(j))} ${cl.dim(x)}`}).join(`
|
|
1919
1919
|
`),r.failAndThrow(O)}}let l=[],g=i!=null?o.filter(O=>O===i):o;return await Promise.all(g.map(async O=>{let j=await Nen({absolutePathToWorkspace:pf(u,zs.of(O)),context:r,cliVersion:n,workspaceName:O});j.didSucceed?l.push(j.workspace):(ecu(j,r.logger),r.failAndThrow())})),l}let d=await Nen({absolutePathToWorkspace:t,context:r,cliVersion:n,workspaceName:void 0});return d.didSucceed?[d.workspace]:(ecu(d,r.logger),[])}async function q7(e,t,r=!1){let n=e.addTask().start(),i=await OOu({...t,cliName:e.environment.cliName,cliVersion:e.environment.packageVersion,context:n});return n.finish(),r&&i.docsWorkspaces!=null?e.registerWorkspaces([...i.apiWorkspaces,i.docsWorkspaces]):e.registerWorkspaces(i.apiWorkspaces),e.registerProject(i),i}var GAf=yu(nZi(),1);var UAf=require("fs/promises");async function VAf({cliContext:e,generatorFilter:t,groupFilter:r,apiFilter:n,apiKeyFallback:i="FERN_DEFAULT",project:{apiWorkspaces:a},outputLocation:u}){let f={};await Promise.all(a.map(async c=>{await e.runTaskForWorkspace(c,async o=>{if(n!=null&&(c.workspaceName==null||!n.has(c.workspaceName)))return;let l=await pg.loadGeneratorsConfiguration({absolutePathToWorkspace:c.absoluteFilepath,context:o});if(l==null||l.groups==null)return;let g=c.workspaceName??i;f[g]={};for(let O of l.groups)r!=null&&!r.has(O.groupName)||(f[g][O.groupName]=O.generators.filter(j=>t==null||t.has(j.name)).map(j=>j.name))})}));let d=av.dump(f);if(u==null){process.stdout.write(d);return}try{await(0,UAf.writeFile)(u,d)}catch(c){e.failAndThrow(`Could not write file to the specified location: ${u}`,c)}}async function WAf({cliContext:e,generatorFilter:t,groupFilter:r,apiFilter:n,project:{apiWorkspaces:i}}){let a;return await Promise.all(i.map(async u=>{await e.runTaskForWorkspace(u,async f=>{if(n!=null&&(u.workspaceName==null||n!==u.workspaceName))return;let d=await pg.loadGeneratorsConfiguration({absolutePathToWorkspace:u.absoluteFilepath,context:f});if(!(d==null||d.groups==null)){for(let c of d.groups)if(r===c.groupName)for(let o of c.generators)t===o.name&&(a=o)}})})),a}var HAf=require("fs/promises");async function $Af({project:e,outputLocation:t,context:r}){let n=e.config.organization;if(t==null){process.stdout.write(n);return}try{await(0,HAf.writeFile)(t,n)}catch(i){r.failAndThrow(`Could not write file to the specified location: ${t}`,i)}}var X1a=require("fs/promises"),L0i=yu(require("path"),1),eNn=yu(VQ(),1);async function Vk1({absolutePathToWorkspace:e,context:t,generatorFilter:r,groupFilter:n,includeMajor:i,channel:a,cliVersion:u}){let f=pg.getPathToGeneratorsConfiguration({absolutePathToWorkspace:e});if(!await Vh(f)){t.failAndThrow("Generators configuration file was not found, no generators to upgrade.");return}let d=await(0,X1a.readFile)(f);t.logger.debug(`Found generators: ${d.toString()}`);let c=eNn.default.parseDocument(d.toString()),o=c.get("groups");if(o==null){t.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");return}if(!eNn.default.isMap(o)){t.failAndThrow(`Expected 'groups' to be a map in ${L0i.default.relative(process.cwd(),f)}`);return}t.logger.debug(`Groups found: ${o.toString()}`);for(let l of o.items){let g=l.key.value,O=l.value;if(!eNn.default.isMap(O)){t.failAndThrow(`Expected group ${g} to be a map in ${L0i.default.relative(process.cwd(),f)}`);continue}if(n!=null&&n!==g){t.logger.debug(`Skipping group ${g} as it does not match the filter: ${n}`);continue}let j=O.get("generators");if(!eNn.default.isSeq(j)){t.failAndThrow(`Expected group ${g} to have a 'generators' key in ${L0i.default.relative(process.cwd(),f)}`);continue}t.logger.debug(`Generators found: ${j.toString()}`);for(let S of j.items){eNn.default.isMap(S)||t.failAndThrow(`Expected generator in group ${g} to be a map in ${L0i.default.relative(process.cwd(),f)}`);let x=S.get("name");if(r!=null&&x!==r){t.logger.debug(`Skipping generator ${x} as it does not match the filter: ${r}`);continue}let A=pg.getGeneratorNameOrThrow(x,t),z=S.get("version"),N=await pg.getLatestGeneratorVersion({generatorName:A,cliVersion:u,currentGeneratorVersion:z,channel:a,includeMajor:i,context:t});N!=null&&(t.logger.debug(cl.green(`Upgrading ${x} from ${z} to ${N}`)),S.set("version",N))}}return c.toString()}async function JAf({cliContext:e,generator:t,group:r,project:{apiWorkspaces:n},includeMajor:i,channel:a}){await Promise.all(n.map(async u=>{await e.runTaskForWorkspace(u,async f=>{var o;let d=await pg.loadRawGeneratorsConfiguration({absolutePathToWorkspace:u.absoluteFilepath,context:f})??{};if(d==null||d.groups==null){f.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");return}f.logger.info(`Upgrading generators in workspace: ${u.workspaceName}`);let c=await Vk1({absolutePathToWorkspace:u.absoluteFilepath,context:f,generatorFilter:t,groupFilter:r,includeMajor:i,channel:a,cliVersion:e.environment.packageVersion});c!=null&&await(0,X1a.writeFile)(((o=u.generatorsConfiguration)==null?void 0:o.absolutePathToConfiguration)??pg.getPathToGeneratorsConfiguration({absolutePathToWorkspace:u.absoluteFilepath}),c)})}))}var KAf=require("fs/promises");function YAf(e,t){e.command("organization",!1,r=>r.option("output",{string:!0,alias:"o",description:"The location to output the organization name as a text file, defaults to standard out."}),async r=>{await t.instrumentPostHogEvent({command:"fern organization",properties:{outputLocation:r.output}}),await $Af({project:await q7(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0}),context:t,outputLocation:r.output})})}function XAf(e,t){e.command("generator","Operate on the generators within your Fern configuration",r=>{r.command("list",!1,n=>n.option("output",{string:!0,alias:"o",description:"The location to output the list as a text file, defaults to standard out."}).option("generators",{string:!0,type:"array",description:"The type of generator to include in the list, ex: `fern-typescript-node-sdk`. If omitted, all generators will be listed."}).option("groups",{type:"array",string:!0,description:"The groups to include generators from, if group is not specified, the all generators of the specified type will be listed."}).option("apis",{type:"array",string:!0,description:"The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."}).option("api-fallback",{string:!0,description:"The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator list",properties:{outputLocation:n.output}}),await VAf({project:await q7(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0}),generatorFilter:n.generators?new Set(n.generators):void 0,groupFilter:n.groups?new Set(n.groups):void 0,apiFilter:n.apis?new Set(n.apis):void 0,apiKeyFallback:n.apiFallback,cliContext:t,outputLocation:n.output})}).command("upgrade",`Upgrades the specified generator in ${i5} to the latest stable version.`,n=>n.option("generator",{string:!0,description:"The type of generator to upgrade, ex: `fern-typescript-node-sdk`."}).option("group",{string:!0,description:"The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."}).option("api",{string:!0,description:"The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."}).option("include-major",{boolean:!0,default:!1,description:"Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."}).option("channel",{demandOption:!1,choices:Object.values(GAf.FernRegistry.generators.ReleaseType)}).option("list",{demandOption:!1,boolean:!0,default:!1,description:"When specified, a list of available upgrades will be displayed, but no upgrade will be taken."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator upgrade",properties:{generator:n.generator,version:n.version,api:n.api,group:n.group,includeMajor:n.includeMajor,rc:n.rc}});let i=await q7(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0});if(n.list){t.suppressUpgradeMessage();let a=await Eha({cliContext:t,project:i,generatorFilter:n.generator,groupFilter:n.group,includeMajor:n.includeMajor,channel:n.channel}),u=await Tsu({generatorUpgradeInfo:a,header:`Generator Upgrades
|
|
1920
|
-
`,includeBoxen:!0});u!=null&&t.logger.info(u)}else await JAf({cliContext:t,generator:n.generator,group:n.group,project:await q7(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0}),includeMajor:n.includeMajor,channel:n.channel})}).command("get",!1,n=>n.option("output",{string:!0,alias:"o",description:"The location to output the list as a text file, defaults to standard out."}).option("generator",{string:!0,demandOption:!0,description:"The name of the generator to get, ex: `fern-typescript-node-sdk`."}).option("group",{string:!0,demandOption:!0,description:"The group in which the generator is located."}).option("api",{string:!0,description:"The API in which the generator is located."}).option("version",{boolean:!0,default:!1,description:"Get the version of the specified generator."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator get",properties:{generator:n.generator,version:n.version,api:n.api,group:n.group,includeMajor:n.includeMajor}});let i=await WAf({cliContext:t,generatorFilter:n.generator,groupFilter:n.group,apiFilter:n.api,project:await q7(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0})});if(i==null){let
|
|
1920
|
+
`,includeBoxen:!0});u!=null&&t.logger.info(u)}else await JAf({cliContext:t,generator:n.generator,group:n.group,project:await q7(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0}),includeMajor:n.includeMajor,channel:n.channel})}).command("get",!1,n=>n.option("output",{string:!0,alias:"o",description:"The location to output the list as a text file, defaults to standard out."}).option("generator",{string:!0,demandOption:!0,description:"The name of the generator to get, ex: `fern-typescript-node-sdk`."}).option("group",{string:!0,demandOption:!0,description:"The group in which the generator is located."}).option("api",{string:!0,description:"The API in which the generator is located."}).option("version",{boolean:!0,default:!1,description:"Get the version of the specified generator."}).option("language",{boolean:!0,default:!1,description:"Get the language of the specified generator."}).option("repository",{boolean:!0,default:!1,description:"Get repository for the generator invocation, if one is specified."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator get",properties:{generator:n.generator,version:n.version,api:n.api,group:n.group,includeMajor:n.includeMajor}});let i=await WAf({cliContext:t,generatorFilter:n.generator,groupFilter:n.group,apiFilter:n.api,project:await q7(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0})});if(i==null){let u=n.api?` for API ${n.api}`:"";t.failAndThrow(`Generator ${n.generator}, in group ${n.group}${u} was not found.`)}let a={};if(n.version&&(a.version=i.version,n.output==null)){process.stdout.write(i.version);return}if(n.language)if(i.language!=null){if(a.language=i.language,n.output==null){process.stdout.write(i.language);return}}else t.logger.warn(`Language information is not available for generator ${i.name} in group ${n.group}`);if(n.repository){let u=i.outputMode.type==="github"?i.outputMode.repo:i.outputMode.type==="githubV2"?i.outputMode.githubV2.repo:void 0;if(u!=null){if(a.repository=u,n.output==null){process.stdout.write(a.repository);return}}else t.logger.warn(`Repository information is not available for generator ${i.name} in group ${n.group}`)}if(n.output)try{await(0,KAf.writeFile)(n.output,JSON.stringify(a,null,2))}catch(u){t.failAndThrow(`Could not write file to the specified location: ${n.output}`,u)}})})}var QAf=require("fs/promises");async function ZAf({project:{apiWorkspaces:e},generatorName:t,groupName:r,cliContext:n}){await Promise.all(e.map(async i=>{await n.runTaskForWorkspace(i,async a=>{var d;let u=await pg.loadRawGeneratorsConfiguration({absolutePathToWorkspace:i.absoluteFilepath,context:a})??{},f=await pg.addGenerator({generatorName:t,generatorsConfiguration:u,groupName:r,context:a,cliVersion:n.environment.packageVersion});await(0,QAf.writeFile)(((d=i.generatorsConfiguration)==null?void 0:d.absolutePathToConfiguration)??pg.getPathToGeneratorsConfiguration({absolutePathToWorkspace:i.absoluteFilepath}),av.dump(f)),a.logger.info(cl.green(`Added ${t} generator`))})}))}var X0i=yu(Z1a(),1);var wej={};function Qtn(e,t){let r=t||wej,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return E6f(e,n,i)}function E6f(e,t,r){if(Dej(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return S6f(e.children,t,r)}return Array.isArray(e)?S6f(e,t,r):""}function S6f(e,t,r){let n=[],i=-1;for(;++i<e.length;)n[i]=E6f(e[i],t,r);return n.join("")}function Dej(e){return Boolean(e&&typeof e=="object")}var SOu={AElig:"\xC6",AMP:"&",Aacute:"\xC1",Abreve:"\u0102",Acirc:"\xC2",Acy:"\u0410",Afr:"\u{1D504}",Agrave:"\xC0",Alpha:"\u0391",Amacr:"\u0100",And:"\u2A53",Aogon:"\u0104",Aopf:"\u{1D538}",ApplyFunction:"\u2061",Aring:"\xC5",Ascr:"\u{1D49C}",Assign:"\u2254",Atilde:"\xC3",Auml:"\xC4",Backslash:"\u2216",Barv:"\u2AE7",Barwed:"\u2306",Bcy:"\u0411",Because:"\u2235",Bernoullis:"\u212C",Beta:"\u0392",Bfr:"\u{1D505}",Bopf:"\u{1D539}",Breve:"\u02D8",Bscr:"\u212C",Bumpeq:"\u224E",CHcy:"\u0427",COPY:"\xA9",Cacute:"\u0106",Cap:"\u22D2",CapitalDifferentialD:"\u2145",Cayleys:"\u212D",Ccaron:"\u010C",Ccedil:"\xC7",Ccirc:"\u0108",Cconint:"\u2230",Cdot:"\u010A",Cedilla:"\xB8",CenterDot:"\xB7",Cfr:"\u212D",Chi:"\u03A7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",Colon:"\u2237",Colone:"\u2A74",Congruent:"\u2261",Conint:"\u222F",ContourIntegral:"\u222E",Copf:"\u2102",Coproduct:"\u2210",CounterClockwiseContourIntegral:"\u2233",Cross:"\u2A2F",Cscr:"\u{1D49E}",Cup:"\u22D3",CupCap:"\u224D",DD:"\u2145",DDotrahd:"\u2911",DJcy:"\u0402",DScy:"\u0405",DZcy:"\u040F",Dagger:"\u2021",Darr:"\u21A1",Dashv:"\u2AE4",Dcaron:"\u010E",Dcy:"\u0414",Del:"\u2207",Delta:"\u0394",Dfr:"\u{1D507}",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",Diamond:"\u22C4",DifferentialD:"\u2146",Dopf:"\u{1D53B}",Dot:"\xA8",DotDot:"\u20DC",DotEqual:"\u2250",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",Downarrow:"\u21D3",Dscr:"\u{1D49F}",Dstrok:"\u0110",ENG:"\u014A",ETH:"\xD0",Eacute:"\xC9",Ecaron:"\u011A",Ecirc:"\xCA",Ecy:"\u042D",Edot:"\u0116",Efr:"\u{1D508}",Egrave:"\xC8",Element:"\u2208",Emacr:"\u0112",EmptySmallSquare:"\u25FB",EmptyVerySmallSquare:"\u25AB",Eogon:"\u0118",Eopf:"\u{1D53C}",Epsilon:"\u0395",Equal:"\u2A75",EqualTilde:"\u2242",Equilibrium:"\u21CC",Escr:"\u2130",Esim:"\u2A73",Eta:"\u0397",Euml:"\xCB",Exists:"\u2203",ExponentialE:"\u2147",Fcy:"\u0424",Ffr:"\u{1D509}",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",Fopf:"\u{1D53D}",ForAll:"\u2200",Fouriertrf:"\u2131",Fscr:"\u2131",GJcy:"\u0403",GT:">",Gamma:"\u0393",Gammad:"\u03DC",Gbreve:"\u011E",Gcedil:"\u0122",Gcirc:"\u011C",Gcy:"\u0413",Gdot:"\u0120",Gfr:"\u{1D50A}",Gg:"\u22D9",Gopf:"\u{1D53E}",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",Gt:"\u226B",HARDcy:"\u042A",Hacek:"\u02C7",Hat:"^",Hcirc:"\u0124",Hfr:"\u210C",HilbertSpace:"\u210B",Hopf:"\u210D",HorizontalLine:"\u2500",Hscr:"\u210B",Hstrok:"\u0126",HumpDownHump:"\u224E",HumpEqual:"\u224F",IEcy:"\u0415",IJlig:"\u0132",IOcy:"\u0401",Iacute:"\xCD",Icirc:"\xCE",Icy:"\u0418",Idot:"\u0130",Ifr:"\u2111",Igrave:"\xCC",Im:"\u2111",Imacr:"\u012A",ImaginaryI:"\u2148",Implies:"\u21D2",Int:"\u222C",Integral:"\u222B",Intersection:"\u22C2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Iogon:"\u012E",Iopf:"\u{1D540}",Iota:"\u0399",Iscr:"\u2110",Itilde:"\u0128",Iukcy:"\u0406",Iuml:"\xCF",Jcirc:"\u0134",Jcy:"\u0419",Jfr:"\u{1D50D}",Jopf:"\u{1D541}",Jscr:"\u{1D4A5}",Jsercy:"\u0408",Jukcy:"\u0404",KHcy:"\u0425",KJcy:"\u040C",Kappa:"\u039A",Kcedil:"\u0136",Kcy:"\u041A",Kfr:"\u{1D50E}",Kopf:"\u{1D542}",Kscr:"\u{1D4A6}",LJcy:"\u0409",LT:"<",Lacute:"\u0139",Lambda:"\u039B",Lang:"\u27EA",Laplacetrf:"\u2112",Larr:"\u219E",Lcaron:"\u013D",Lcedil:"\u013B",Lcy:"\u041B",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",LeftRightArrow:"\u2194",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",Leftarrow:"\u21D0",Leftrightarrow:"\u21D4",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",LessLess:"\u2AA1",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",Lfr:"\u{1D50F}",Ll:"\u22D8",Lleftarrow:"\u21DA",Lmidot:"\u013F",LongLeftArrow:"\u27F5",LongLeftRightArrow:"\u27F7",LongRightArrow:"\u27F6",Longleftarrow:"\u27F8",Longleftrightarrow:"\u27FA",Longrightarrow:"\u27F9",Lopf:"\u{1D543}",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",Lscr:"\u2112",Lsh:"\u21B0",Lstrok:"\u0141",Lt:"\u226A",Map:"\u2905",Mcy:"\u041C",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",MinusPlus:"\u2213",Mopf:"\u{1D544}",Mscr:"\u2133",Mu:"\u039C",NJcy:"\u040A",Nacute:"\u0143",Ncaron:"\u0147",Ncedil:"\u0145",Ncy:"\u041D",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
1921
1921
|
`,Nfr:"\u{1D511}",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",Not:"\u2AEC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",Nscr:"\u{1D4A9}",Ntilde:"\xD1",Nu:"\u039D",OElig:"\u0152",Oacute:"\xD3",Ocirc:"\xD4",Ocy:"\u041E",Odblac:"\u0150",Ofr:"\u{1D512}",Ograve:"\xD2",Omacr:"\u014C",Omega:"\u03A9",Omicron:"\u039F",Oopf:"\u{1D546}",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",Or:"\u2A54",Oscr:"\u{1D4AA}",Oslash:"\xD8",Otilde:"\xD5",Otimes:"\u2A37",Ouml:"\xD6",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",PartialD:"\u2202",Pcy:"\u041F",Pfr:"\u{1D513}",Phi:"\u03A6",Pi:"\u03A0",PlusMinus:"\xB1",Poincareplane:"\u210C",Popf:"\u2119",Pr:"\u2ABB",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",Prime:"\u2033",Product:"\u220F",Proportion:"\u2237",Proportional:"\u221D",Pscr:"\u{1D4AB}",Psi:"\u03A8",QUOT:'"',Qfr:"\u{1D514}",Qopf:"\u211A",Qscr:"\u{1D4AC}",RBarr:"\u2910",REG:"\xAE",Racute:"\u0154",Rang:"\u27EB",Rarr:"\u21A0",Rarrtl:"\u2916",Rcaron:"\u0158",Rcedil:"\u0156",Rcy:"\u0420",Re:"\u211C",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",Rfr:"\u211C",Rho:"\u03A1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",Rightarrow:"\u21D2",Ropf:"\u211D",RoundImplies:"\u2970",Rrightarrow:"\u21DB",Rscr:"\u211B",Rsh:"\u21B1",RuleDelayed:"\u29F4",SHCHcy:"\u0429",SHcy:"\u0428",SOFTcy:"\u042C",Sacute:"\u015A",Sc:"\u2ABC",Scaron:"\u0160",Scedil:"\u015E",Scirc:"\u015C",Scy:"\u0421",Sfr:"\u{1D516}",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",Sigma:"\u03A3",SmallCircle:"\u2218",Sopf:"\u{1D54A}",Sqrt:"\u221A",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Sscr:"\u{1D4AE}",Star:"\u22C6",Sub:"\u22D0",Subset:"\u22D0",SubsetEqual:"\u2286",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",SuchThat:"\u220B",Sum:"\u2211",Sup:"\u22D1",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22D1",THORN:"\xDE",TRADE:"\u2122",TSHcy:"\u040B",TScy:"\u0426",Tab:" ",Tau:"\u03A4",Tcaron:"\u0164",Tcedil:"\u0162",Tcy:"\u0422",Tfr:"\u{1D517}",Therefore:"\u2234",Theta:"\u0398",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",Topf:"\u{1D54B}",TripleDot:"\u20DB",Tscr:"\u{1D4AF}",Tstrok:"\u0166",Uacute:"\xDA",Uarr:"\u219F",Uarrocir:"\u2949",Ubrcy:"\u040E",Ubreve:"\u016C",Ucirc:"\xDB",Ucy:"\u0423",Udblac:"\u0170",Ufr:"\u{1D518}",Ugrave:"\xD9",Umacr:"\u016A",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",Uopf:"\u{1D54C}",UpArrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",UpEquilibrium:"\u296E",UpTee:"\u22A5",UpTeeArrow:"\u21A5",Uparrow:"\u21D1",Updownarrow:"\u21D5",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",Upsilon:"\u03A5",Uring:"\u016E",Uscr:"\u{1D4B0}",Utilde:"\u0168",Uuml:"\xDC",VDash:"\u22AB",Vbar:"\u2AEB",Vcy:"\u0412",Vdash:"\u22A9",Vdashl:"\u2AE6",Vee:"\u22C1",Verbar:"\u2016",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",Vopf:"\u{1D54D}",Vscr:"\u{1D4B1}",Vvdash:"\u22AA",Wcirc:"\u0174",Wedge:"\u22C0",Wfr:"\u{1D51A}",Wopf:"\u{1D54E}",Wscr:"\u{1D4B2}",Xfr:"\u{1D51B}",Xi:"\u039E",Xopf:"\u{1D54F}",Xscr:"\u{1D4B3}",YAcy:"\u042F",YIcy:"\u0407",YUcy:"\u042E",Yacute:"\xDD",Ycirc:"\u0176",Ycy:"\u042B",Yfr:"\u{1D51C}",Yopf:"\u{1D550}",Yscr:"\u{1D4B4}",Yuml:"\u0178",ZHcy:"\u0416",Zacute:"\u0179",Zcaron:"\u017D",Zcy:"\u0417",Zdot:"\u017B",ZeroWidthSpace:"\u200B",Zeta:"\u0396",Zfr:"\u2128",Zopf:"\u2124",Zscr:"\u{1D4B5}",aacute:"\xE1",abreve:"\u0103",ac:"\u223E",acE:"\u223E\u0333",acd:"\u223F",acirc:"\xE2",acute:"\xB4",acy:"\u0430",aelig:"\xE6",af:"\u2061",afr:"\u{1D51E}",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",amacr:"\u0101",amalg:"\u2A3F",amp:"&",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",aogon:"\u0105",aopf:"\u{1D552}",ap:"\u2248",apE:"\u2A70",apacir:"\u2A6F",ape:"\u224A",apid:"\u224B",apos:"'",approx:"\u2248",approxeq:"\u224A",aring:"\xE5",ascr:"\u{1D4B6}",ast:"*",asymp:"\u2248",asympeq:"\u224D",atilde:"\xE3",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",bNot:"\u2AED",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",barvee:"\u22BD",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",beta:"\u03B2",beth:"\u2136",between:"\u226C",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxDL:"\u2557",boxDR:"\u2554",boxDl:"\u2556",boxDr:"\u2553",boxH:"\u2550",boxHD:"\u2566",boxHU:"\u2569",boxHd:"\u2564",boxHu:"\u2567",boxUL:"\u255D",boxUR:"\u255A",boxUl:"\u255C",boxUr:"\u2559",boxV:"\u2551",boxVH:"\u256C",boxVL:"\u2563",boxVR:"\u2560",boxVh:"\u256B",boxVl:"\u2562",boxVr:"\u255F",boxbox:"\u29C9",boxdL:"\u2555",boxdR:"\u2552",boxdl:"\u2510",boxdr:"\u250C",boxh:"\u2500",boxhD:"\u2565",boxhU:"\u2568",boxhd:"\u252C",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxuL:"\u255B",boxuR:"\u2558",boxul:"\u2518",boxur:"\u2514",boxv:"\u2502",boxvH:"\u256A",boxvL:"\u2561",boxvR:"\u255E",boxvh:"\u253C",boxvl:"\u2524",boxvr:"\u251C",bprime:"\u2035",breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",bumpeq:"\u224F",cacute:"\u0107",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",ccaps:"\u2A4D",ccaron:"\u010D",ccedil:"\xE7",ccirc:"\u0109",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",cedil:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",cfr:"\u{1D520}",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",cir:"\u25CB",cirE:"\u29C3",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledR:"\xAE",circledS:"\u24C8",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",clubs:"\u2663",clubsuit:"\u2663",colon:":",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",conint:"\u222E",copf:"\u{1D554}",coprod:"\u2210",copy:"\xA9",copysr:"\u2117",crarr:"\u21B5",cross:"\u2717",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cup:"\u222A",cupbrcap:"\u2A48",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dArr:"\u21D3",dHar:"\u2965",dagger:"\u2020",daleth:"\u2138",darr:"\u2193",dash:"\u2010",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",dcaron:"\u010F",dcy:"\u0434",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",ddotseq:"\u2A77",deg:"\xB0",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\u{1D521}",dharl:"\u21C3",dharr:"\u21C2",diam:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\u{1D555}",dot:"\u02D9",doteq:"\u2250",doteqdot:"\u2251",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",downarrow:"\u2193",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",dscr:"\u{1D4B9}",dscy:"\u0455",dsol:"\u29F6",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",dzcy:"\u045F",dzigrarr:"\u27FF",eDDot:"\u2A77",eDot:"\u2251",eacute:"\xE9",easter:"\u2A6E",ecaron:"\u011B",ecir:"\u2256",ecirc:"\xEA",ecolon:"\u2255",ecy:"\u044D",edot:"\u0117",ee:"\u2147",efDot:"\u2252",efr:"\u{1D522}",eg:"\u2A9A",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",eng:"\u014B",ensp:"\u2002",eogon:"\u0119",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",equals:"=",equest:"\u225F",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erDot:"\u2253",erarr:"\u2971",escr:"\u212F",esdot:"\u2250",esim:"\u2242",eta:"\u03B7",eth:"\xF0",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",expectation:"\u2130",exponentiale:"\u2147",fallingdotseq:"\u2252",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\u{1D523}",filig:"\uFB01",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\u{1D557}",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",gE:"\u2267",gEl:"\u2A8C",gacute:"\u01F5",gamma:"\u03B3",gammad:"\u03DD",gap:"\u2A86",gbreve:"\u011F",gcirc:"\u011D",gcy:"\u0433",gdot:"\u0121",ge:"\u2265",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\u{1D524}",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",gjcy:"\u0453",gl:"\u2277",glE:"\u2A92",gla:"\u2AA5",glj:"\u2AA4",gnE:"\u2269",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gopf:"\u{1D558}",grave:"`",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",hArr:"\u21D4",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",hardcy:"\u044A",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",hbar:"\u210F",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",horbar:"\u2015",hscr:"\u{1D4BD}",hslash:"\u210F",hstrok:"\u0127",hybull:"\u2043",hyphen:"\u2010",iacute:"\xED",ic:"\u2063",icirc:"\xEE",icy:"\u0438",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",imacr:"\u012B",image:"\u2111",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",int:"\u222B",intcal:"\u22BA",integers:"\u2124",intercal:"\u22BA",intlarhk:"\u2A17",intprod:"\u2A3C",iocy:"\u0451",iogon:"\u012F",iopf:"\u{1D55A}",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",isin:"\u2208",isinE:"\u22F9",isindot:"\u22F5",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",itilde:"\u0129",iukcy:"\u0456",iuml:"\xEF",jcirc:"\u0135",jcy:"\u0439",jfr:"\u{1D527}",jmath:"\u0237",jopf:"\u{1D55B}",jscr:"\u{1D4BF}",jsercy:"\u0458",jukcy:"\u0454",kappa:"\u03BA",kappav:"\u03F0",kcedil:"\u0137",kcy:"\u043A",kfr:"\u{1D528}",kgreen:"\u0138",khcy:"\u0445",kjcy:"\u045C",kopf:"\u{1D55C}",kscr:"\u{1D4C0}",lAarr:"\u21DA",lArr:"\u21D0",lAtail:"\u291B",lBarr:"\u290E",lE:"\u2266",lEg:"\u2A8B",lHar:"\u2962",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",lambda:"\u03BB",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",laquo:"\xAB",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",lcedil:"\u013C",lceil:"\u2308",lcub:"{",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",leftarrow:"\u2190",leftarrowtail:"\u21A2",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",leftthreetimes:"\u22CB",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",lessgtr:"\u2276",lesssim:"\u2272",lfisht:"\u297C",lfloor:"\u230A",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnE:"\u2268",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",lstrok:"\u0142",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltrPar:"\u2996",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",mDDot:"\u223A",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",mdash:"\u2014",measuredangle:"\u2221",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",mstpos:"\u223E",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nGg:"\u22D9\u0338",nGt:"\u226B\u20D2",nGtv:"\u226B\u0338",nLeftarrow:"\u21CD",nLeftrightarrow:"\u21CE",nLl:"\u22D8\u0338",nLt:"\u226A\u20D2",nLtv:"\u226A\u0338",nRightarrow:"\u21CF",nVDash:"\u22AF",nVdash:"\u22AE",nabla:"\u2207",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",ncaron:"\u0148",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",neArr:"\u21D7",nearhk:"\u2924",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",nexist:"\u2204",nexists:"\u2204",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",ngsim:"\u2275",ngt:"\u226F",ngtr:"\u226F",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",njcy:"\u045A",nlArr:"\u21CD",nlE:"\u2266\u0338",nlarr:"\u219A",nldr:"\u2025",nle:"\u2270",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nlsim:"\u2274",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nmid:"\u2224",nopf:"\u{1D55F}",not:"\xAC",notin:"\u2209",notinE:"\u22F9\u0338",notindot:"\u22F5\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvDash:"\u22AD",nvHarr:"\u2904",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwArr:"\u21D6",nwarhk:"\u2923",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",oS:"\u24C8",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",ocirc:"\xF4",ocy:"\u043E",odash:"\u229D",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",oelig:"\u0153",ofcir:"\u29BF",ofr:"\u{1D52C}",ogon:"\u02DB",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",omacr:"\u014D",omega:"\u03C9",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",oopf:"\u{1D560}",opar:"\u29B7",operp:"\u29B9",oplus:"\u2295",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oscr:"\u2134",oslash:"\xF8",osol:"\u2298",otilde:"\xF5",otimes:"\u2297",otimesas:"\u2A36",ouml:"\xF6",ovbar:"\u233D",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",pfr:"\u{1D52D}",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",pointint:"\u2A15",popf:"\u{1D561}",pound:"\xA3",pr:"\u227A",prE:"\u2AB3",prap:"\u2AB7",prcue:"\u227C",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",prime:"\u2032",primes:"\u2119",prnE:"\u2AB5",prnap:"\u2AB9",prnsim:"\u22E8",prod:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",pscr:"\u{1D4C5}",psi:"\u03C8",puncsp:"\u2008",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",qprime:"\u2057",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',rAarr:"\u21DB",rArr:"\u21D2",rAtail:"\u291C",rBarr:"\u290F",rHar:"\u2964",race:"\u223D\u0331",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",rarrw:"\u219D",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",rcedil:"\u0157",rceil:"\u2309",rcub:"}",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",reg:"\xAE",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",rho:"\u03C1",rhov:"\u03F1",rightarrow:"\u2192",rightarrowtail:"\u21A3",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",rightthreetimes:"\u22CC",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",rsaquo:"\u203A",rscr:"\u{1D4C7}",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",sbquo:"\u201A",sc:"\u227B",scE:"\u2AB4",scap:"\u2AB8",scaron:"\u0161",sccue:"\u227D",sce:"\u2AB0",scedil:"\u015F",scirc:"\u015D",scnE:"\u2AB6",scnap:"\u2ABA",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",seArr:"\u21D8",searhk:"\u2925",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",shchcy:"\u0449",shcy:"\u0448",shortmid:"\u2223",shortparallel:"\u2225",shy:"\xAD",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",square:"\u25A1",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",subE:"\u2AC5",subdot:"\u2ABD",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",sum:"\u2211",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",supE:"\u2AC6",supdot:"\u2ABE",supdsub:"\u2AD8",supe:"\u2287",supedot:"\u2AC4",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swArr:"\u21D9",swarhk:"\u2926",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",target:"\u2316",tau:"\u03C4",tbrk:"\u23B4",tcaron:"\u0165",tcedil:"\u0163",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",thorn:"\xFE",tilde:"\u02DC",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\u{1D4C9}",tscy:"\u0446",tshcy:"\u045B",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",uArr:"\u21D1",uHar:"\u2963",uacute:"\xFA",uarr:"\u2191",ubrcy:"\u045E",ubreve:"\u016D",ucirc:"\xFB",ucy:"\u0443",udarr:"\u21C5",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",ufr:"\u{1D532}",ugrave:"\xF9",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",uml:"\xA8",uogon:"\u0173",uopf:"\u{1D566}",uparrow:"\u2191",updownarrow:"\u2195",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",upsi:"\u03C5",upsih:"\u03D2",upsilon:"\u03C5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",urtri:"\u25F9",uscr:"\u{1D4CA}",utdot:"\u22F0",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",uuml:"\xFC",uwangle:"\u29A7",vArr:"\u21D5",vBar:"\u2AE8",vBarv:"\u2AE9",vDash:"\u22A8",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vcy:"\u0432",vdash:"\u22A2",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",vert:"|",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",vzigzag:"\u299A",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",wfr:"\u{1D534}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",yacute:"\xFD",yacy:"\u044F",ycirc:"\u0177",ycy:"\u044B",yen:"\xA5",yfr:"\u{1D536}",yicy:"\u0457",yopf:"\u{1D56A}",yscr:"\u{1D4CE}",yucy:"\u044E",yuml:"\xFF",zacute:"\u017A",zcaron:"\u017E",zcy:"\u0437",zdot:"\u017C",zeetrf:"\u2128",zeta:"\u03B6",zfr:"\u{1D537}",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"};var Sej={}.hasOwnProperty;function OEr(e){return Sej.call(SOu,e)?SOu[e]:!1}function wB(e,t,r,n){let i=e.length,a=0,u;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)u=Array.from(n),u.unshift(t,r),e.splice(...u);else for(r&&e.splice(t,r);a<n.length;)u=n.slice(a,a+1e4),u.unshift(t,0),e.splice(...u),a+=1e4,t+=1e4}function $Q(e,t){return e.length>0?(wB(e,e.length,0,t),e):t}var M6f={}.hasOwnProperty;function Uzr(e){let t={},r=-1;for(;++r<e.length;)Eej(t,e[r]);return t}function Eej(e,t){let r;for(r in t){let i=(M6f.call(e,r)?e[r]:void 0)||(e[r]={}),a=t[r],u;if(a)for(u in a){M6f.call(i,u)||(i[u]=[]);let f=a[u];Mej(i[u],Array.isArray(f)?f:f?[f]:[])}}}function Mej(e,t){let r=-1,n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);wB(e,0,0,n)}function k1a(e,t){let r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function fG(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var z5=Vzr(/[A-Za-z]/),l8=Vzr(/[\dA-Za-z]/),x6f=Vzr(/[#-'*+\--9=?A-Z^-~]/);function Ztn(e){return e!==null&&(e<32||e===127)}var W0i=Vzr(/\d/),T6f=Vzr(/[\dA-Fa-f]/),q6f=Vzr(/[!-/:-@[-`{-~]/);function Y_(e){return e!==null&&e<-2}function PP(e){return e!==null&&(e<0||e===32)}function Cb(e){return e===-2||e===-1||e===32}var ktn=Vzr(/\p{P}|\p{S}/u),PR=Vzr(/\s/);function Vzr(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $2e(e){let t=[],r=-1,n=0,i=0;for(;++r<e.length;){let a=e.charCodeAt(r),u="";if(a===37&&l8(e.charCodeAt(r+1))&&l8(e.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(u=String.fromCharCode(a));else if(a>55295&&a<57344){let f=e.charCodeAt(r+1);a<56320&&f>56319&&f<57344?(u=String.fromCharCode(a,f),i=1):u="\uFFFD"}else u=String.fromCharCode(a);u&&(t.push(e.slice(n,r),encodeURIComponent(u)),n=r+i+1,u=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Bv(e,t,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return u;function u(d){return Cb(d)?(e.enter(r),f(d)):t(d)}function f(d){return Cb(d)&&a++<i?(e.consume(d),f):(e.exit(r),t(d))}}var C6f={tokenize:xej};function xej(e){let t=e.attempt(this.parser.constructs.contentInitial,n,i),r;return t;function n(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Bv(e,t,"linePrefix")}function i(f){return e.enter("paragraph"),a(f)}function a(f){let d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Y_(f)?(e.consume(f),e.exit("chunkText"),a):(e.consume(f),u)}}var N6f={tokenize:Tej},A6f={tokenize:qej};function Tej(e){let t=this,r=[],n=0,i,a,u;return f;function f(N){if(n<r.length){let C=r[n];return t.containerState=C[1],e.attempt(C[0].continuation,d,c)(N)}return c(N)}function d(N){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&z();let C=t.events.length,U=C,Y;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){Y=t.events[U][1].end;break}A(n);let te=C;for(;te<t.events.length;)t.events[te][1].end=Object.assign({},Y),te++;return wB(t.events,U+1,0,t.events.slice(C)),t.events.length=te,c(N)}return f(N)}function c(N){if(n===r.length){if(!i)return g(N);if(i.currentConstruct&&i.currentConstruct.concrete)return j(N);t.interrupt=Boolean(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(A6f,o,l)(N)}function o(N){return i&&z(),A(n),g(N)}function l(N){return t.parser.lazy[t.now().line]=n!==r.length,u=t.now().offset,j(N)}function g(N){return t.containerState={},e.attempt(A6f,O,j)(N)}function O(N){return n++,r.push([t.currentConstruct,t.containerState]),g(N)}function j(N){if(N===null){i&&z(),A(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),S(N)}function S(N){if(N===null){x(e.exit("chunkFlow"),!0),A(0),e.consume(N);return}return Y_(N)?(e.consume(N),x(e.exit("chunkFlow")),n=0,t.interrupt=void 0,f):(e.consume(N),S)}function x(N,C){let U=t.sliceStream(N);if(C&&U.push(null),N.previous=a,a&&(a.next=N),a=N,i.defineSkip(N.start),i.write(U),t.parser.lazy[N.start.line]){let Y=i.events.length;for(;Y--;)if(i.events[Y][1].start.offset<u&&(!i.events[Y][1].end||i.events[Y][1].end.offset>u))return;let te=t.events.length,G=te,$,ee;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){if($){ee=t.events[G][1].end;break}$=!0}for(A(n),Y=te;Y<t.events.length;)t.events[Y][1].end=Object.assign({},ee),Y++;wB(t.events,G+1,0,t.events.slice(te)),t.events.length=Y}}function A(N){let C=r.length;for(;C-- >N;){let U=r[C];t.containerState=U[1],U[0].exit.call(t,e)}r.length=N}function z(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function qej(e,t,r){return Bv(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nNn(e){if(e===null||PP(e)||PR(e))return 1;if(ktn(e))return 2}function Wzr(e,t,r){let n=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!n.includes(a)&&(t=a(t,r),n.push(a))}return t}var H0i={name:"attention",tokenize:Aej,resolveAll:Cej};function Cej(e,t){let r=-1,n,i,a,u,f,d,c,o;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;let l=Object.assign({},e[n][1].end),g=Object.assign({},e[r][1].start);z6f(l,-d),z6f(g,d),u={type:d>1?"strongSequence":"emphasisSequence",start:l,end:Object.assign({},e[n][1].end)},f={type:d>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[r][1].start),end:g},a={type:d>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},i={type:d>1?"strong":"emphasis",start:Object.assign({},u.start),end:Object.assign({},f.end)},e[n][1].end=Object.assign({},u.start),e[r][1].start=Object.assign({},f.end),c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=$Q(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=$Q(c,[["enter",i,t],["enter",u,t],["exit",u,t],["enter",a,t]]),c=$Q(c,Wzr(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=$Q(c,[["exit",a,t],["enter",f,t],["exit",f,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(o=2,c=$Q(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):o=0,wB(e,n-1,r-n+3,c),r=n+c.length-o-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Aej(e,t){let r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=nNn(n),a;return u;function u(d){return a=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===a)return e.consume(d),f;let c=e.exit("attentionSequence"),o=nNn(d),l=!o||o===2&&i||r.includes(d),g=!i||i===2&&o||r.includes(n);return c._open=Boolean(a===42?l:l&&(i||!g)),c._close=Boolean(a===42?g:g&&(o||!l)),t(d)}}function z6f(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var EOu={name:"autolink",tokenize:Nej};function Nej(e,t,r){let n=0;return i;function i(O){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(O),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(O){return z5(O)?(e.consume(O),u):O===64?r(O):c(O)}function u(O){return O===43||O===45||O===46||l8(O)?(n=1,f(O)):c(O)}function f(O){return O===58?(e.consume(O),n=0,d):(O===43||O===45||O===46||l8(O))&&n++<32?(e.consume(O),f):(n=0,c(O))}function d(O){return O===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(O),e.exit("autolinkMarker"),e.exit("autolink"),t):O===null||O===32||O===60||Ztn(O)?r(O):(e.consume(O),d)}function c(O){return O===64?(e.consume(O),o):x6f(O)?(e.consume(O),c):r(O)}function o(O){return l8(O)?l(O):r(O)}function l(O){return O===46?(e.consume(O),n=0,o):O===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(O),e.exit("autolinkMarker"),e.exit("autolink"),t):g(O)}function g(O){if((O===45||l8(O))&&n++<63){let j=O===45?g:l;return e.consume(O),j}return r(O)}}var J2e={tokenize:zej,partial:!0};function zej(e,t,r){return n;function n(a){return Cb(a)?Bv(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||Y_(a)?t(a):r(a)}}var eja={name:"blockQuote",tokenize:Bej,continuation:{tokenize:Iej},exit:Rej};function Bej(e,t,r){let n=this;return i;function i(u){if(u===62){let f=n.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),a}return r(u)}function a(u){return Cb(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function Iej(e,t,r){let n=this;return i;function i(u){return Cb(u)?Bv(e,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):a(u)}function a(u){return e.attempt(eja,t,r)(u)}}function Rej(e){e.exit("blockQuote")}var tja={name:"characterEscape",tokenize:Fej};function Fej(e,t,r){return n;function n(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return q6f(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(a)}}var rja={name:"characterReference",tokenize:Lej};function Lej(e,t,r){let n=this,i=0,a,u;return f;function f(l){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),d}function d(l){return l===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(l),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,u=l8,o(l))}function c(l){return l===88||l===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(l),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,u=T6f,o):(e.enter("characterReferenceValue"),a=7,u=W0i,o(l))}function o(l){if(l===59&&i){let g=e.exit("characterReferenceValue");return u===l8&&!OEr(n.sliceSerialize(g))?r(l):(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(l)&&i++<a?(e.consume(l),o):r(l)}}var B6f={tokenize:Vej,partial:!0},nja={name:"codeFenced",tokenize:Uej,concrete:!0};function Uej(e,t,r){let n=this,i={tokenize:U,partial:!0},a=0,u=0,f;return d;function d(Y){return c(Y)}function c(Y){let te=n.events[n.events.length-1];return a=te&&te[1].type==="linePrefix"?te[2].sliceSerialize(te[1],!0).length:0,f=Y,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),o(Y)}function o(Y){return Y===f?(u++,e.consume(Y),o):u<3?r(Y):(e.exit("codeFencedFenceSequence"),Cb(Y)?Bv(e,l,"whitespace")(Y):l(Y))}function l(Y){return Y===null||Y_(Y)?(e.exit("codeFencedFence"),n.interrupt?t(Y):e.check(B6f,S,C)(Y)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(Y))}function g(Y){return Y===null||Y_(Y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(Y)):Cb(Y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Bv(e,O,"whitespace")(Y)):Y===96&&Y===f?r(Y):(e.consume(Y),g)}function O(Y){return Y===null||Y_(Y)?l(Y):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(Y))}function j(Y){return Y===null||Y_(Y)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(Y)):Y===96&&Y===f?r(Y):(e.consume(Y),j)}function S(Y){return e.attempt(i,C,x)(Y)}function x(Y){return e.enter("lineEnding"),e.consume(Y),e.exit("lineEnding"),A}function A(Y){return a>0&&Cb(Y)?Bv(e,z,"linePrefix",a+1)(Y):z(Y)}function z(Y){return Y===null||Y_(Y)?e.check(B6f,S,C)(Y):(e.enter("codeFlowValue"),N(Y))}function N(Y){return Y===null||Y_(Y)?(e.exit("codeFlowValue"),z(Y)):(e.consume(Y),N)}function C(Y){return e.exit("codeFenced"),t(Y)}function U(Y,te,G){let $=0;return ee;function ee(Wt){return Y.enter("lineEnding"),Y.consume(Wt),Y.exit("lineEnding"),Ve}function Ve(Wt){return Y.enter("codeFencedFence"),Cb(Wt)?Bv(Y,$e,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Wt):$e(Wt)}function $e(Wt){return Wt===f?(Y.enter("codeFencedFenceSequence"),Dt(Wt)):G(Wt)}function Dt(Wt){return Wt===f?($++,Y.consume(Wt),Dt):$>=u?(Y.exit("codeFencedFenceSequence"),Cb(Wt)?Bv(Y,Tt,"whitespace")(Wt):Tt(Wt)):G(Wt)}function Tt(Wt){return Wt===null||Y_(Wt)?(Y.exit("codeFencedFence"),te(Wt)):G(Wt)}}}function Vej(e,t,r){let n=this;return i;function i(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a)}function a(u){return n.parser.lazy[n.now().line]?r(u):t(u)}}var $0i={name:"codeIndented",tokenize:Hej},Wej={tokenize:$ej,partial:!0};function Hej(e,t,r){let n=this;return i;function i(c){return e.enter("codeIndented"),Bv(e,a,"linePrefix",4+1)(c)}function a(c){let o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?u(c):r(c)}function u(c){return c===null?d(c):Y_(c)?e.attempt(Wej,u,d)(c):(e.enter("codeFlowValue"),f(c))}function f(c){return c===null||Y_(c)?(e.exit("codeFlowValue"),u(c)):(e.consume(c),f)}function d(c){return e.exit("codeIndented"),t(c)}}function $ej(e,t,r){let n=this;return i;function i(u){return n.parser.lazy[n.now().line]?r(u):Y_(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),i):Bv(e,a,"linePrefix",4+1)(u)}function a(u){let f=n.events[n.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Y_(u)?i(u):r(u)}}var MOu={name:"codeText",tokenize:Kej,resolve:Jej,previous:Gej};function Jej(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function Gej(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Kej(e,t,r){let n=this,i=0,a,u;return f;function f(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),i++,d):(e.exit("codeTextSequence"),c(g))}function c(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),c):g===96?(u=e.enter("codeTextSequence"),a=0,l(g)):Y_(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),c):(e.enter("codeTextData"),o(g))}function o(g){return g===null||g===32||g===96||Y_(g)?(e.exit("codeTextData"),c(g)):(e.consume(g),o)}function l(g){return g===96?(e.consume(g),a++,l):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",o(g))}}var ija=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){let n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){let i=r||0;this.setCursor(Math.trunc(t));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&J0i(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),J0i(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),J0i(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let r=this.left.splice(t,Number.POSITIVE_INFINITY);J0i(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);J0i(this.left,r.reverse())}}};function J0i(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function aja(e){let t={},r=-1,n,i,a,u,f,d,c,o=new ija(e);for(;++r<o.length;){for(;r in t;)r=t[r];if(n=o.get(r),r&&n[1].type==="chunkFlow"&&o.get(r-1)[1].type==="listItemPrefix"&&(d=n[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,Yej(o,r)),r=t[r],c=!0);else if(n[1]._container){for(a=r,i=void 0;a--&&(u=o.get(a),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank");)u[0]==="enter"&&(i&&(o.get(i)[1].type="lineEndingBlank"),u[1].type="lineEnding",i=a);i&&(n[1].end=Object.assign({},o.get(i)[1].start),f=o.slice(i,r),f.unshift(n),o.splice(i,r-i+1,f))}}return wB(e,0,Number.POSITIVE_INFINITY,o.slice(0)),!c}function Yej(e,t){let r=e.get(t)[1],n=e.get(t)[2],i=t-1,a=[],u=r._tokenizer||n.parser[r.contentType](r.start),f=u.events,d=[],c={},o,l,g=-1,O=r,j=0,S=0,x=[S];for(;O;){for(;e.get(++i)[1]!==O;);a.push(i),O._tokenizer||(o=n.sliceStream(O),O.next||o.push(null),l&&u.defineSkip(O.start),O._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(o),O._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),l=O,O=O.next}for(O=r;++g<f.length;)f[g][0]==="exit"&&f[g-1][0]==="enter"&&f[g][1].type===f[g-1][1].type&&f[g][1].start.line!==f[g][1].end.line&&(S=g+1,x.push(S),O._tokenizer=void 0,O.previous=void 0,O=O.next);for(u.events=[],O?(O._tokenizer=void 0,O.previous=void 0):x.pop(),g=x.length;g--;){let A=f.slice(x[g],x[g+1]),z=a.pop();d.push([z,z+A.length-1]),e.splice(z,2,A)}for(d.reverse(),g=-1;++g<d.length;)c[j+d[g][0]]=j+d[g][1],j+=d[g][1]-d[g][0]-1;return c}var xOu={tokenize:Zej,resolve:Qej},Xej={tokenize:kej,partial:!0};function Qej(e){return aja(e),e}function Zej(e,t){let r;return n;function n(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(f)}function i(f){return f===null?a(f):Y_(f)?e.check(Xej,u,a)(f):(e.consume(f),i)}function a(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function kej(e,t,r){let n=this;return i;function i(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Bv(e,a,"linePrefix")}function a(u){if(u===null||Y_(u))return r(u);let f=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(n.parser.constructs.flow,r,t)(u)}}function oja(e,t,r,n,i,a,u,f,d){let c=d||Number.POSITIVE_INFINITY,o=0;return l;function l(A){return A===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(A),e.exit(a),g):A===null||A===32||A===41||Ztn(A)?r(A):(e.enter(n),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),S(A))}function g(A){return A===62?(e.enter(a),e.consume(A),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),O(A))}function O(A){return A===62?(e.exit("chunkString"),e.exit(f),g(A)):A===null||A===60||Y_(A)?r(A):(e.consume(A),A===92?j:O)}function j(A){return A===60||A===62||A===92?(e.consume(A),O):O(A)}function S(A){return!o&&(A===null||A===41||PP(A))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(n),t(A)):o<c&&A===40?(e.consume(A),o++,S):A===41?(e.consume(A),o--,S):A===null||A===32||A===40||Ztn(A)?r(A):(e.consume(A),A===92?x:S)}function x(A){return A===40||A===41||A===92?(e.consume(A),S):S(A)}}function uja(e,t,r,n,i,a){let u=this,f=0,d;return c;function c(O){return e.enter(n),e.enter(i),e.consume(O),e.exit(i),e.enter(a),o}function o(O){return f>999||O===null||O===91||O===93&&!d||O===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?r(O):O===93?(e.exit(a),e.enter(i),e.consume(O),e.exit(i),e.exit(n),t):Y_(O)?(e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),o):(e.enter("chunkString",{contentType:"string"}),l(O))}function l(O){return O===null||O===91||O===93||Y_(O)||f++>999?(e.exit("chunkString"),o(O)):(e.consume(O),d||(d=!Cb(O)),O===92?g:l)}function g(O){return O===91||O===92||O===93?(e.consume(O),f++,l):l(O)}}function sja(e,t,r,n,i,a){let u;return f;function f(g){return g===34||g===39||g===40?(e.enter(n),e.enter(i),e.consume(g),e.exit(i),u=g===40?41:g,d):r(g)}function d(g){return g===u?(e.enter(i),e.consume(g),e.exit(i),e.exit(n),t):(e.enter(a),c(g))}function c(g){return g===u?(e.exit(a),d(u)):g===null?r(g):Y_(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Bv(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),o(g))}function o(g){return g===u||g===null||Y_(g)?(e.exit("chunkString"),c(g)):(e.consume(g),g===92?l:o)}function l(g){return g===u||g===92?(e.consume(g),o):o(g)}}function ern(e,t){let r;return n;function n(i){return Y_(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Cb(i)?Bv(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}var TOu={name:"definition",tokenize:ttj},etj={tokenize:rtj,partial:!0};function ttj(e,t,r){let n=this,i;return a;function a(O){return e.enter("definition"),u(O)}function u(O){return uja.call(n,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(O)}function f(O){return i=fG(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),O===58?(e.enter("definitionMarker"),e.consume(O),e.exit("definitionMarker"),d):r(O)}function d(O){return PP(O)?ern(e,c)(O):c(O)}function c(O){return oja(e,o,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(O)}function o(O){return e.attempt(etj,l,l)(O)}function l(O){return Cb(O)?Bv(e,g,"whitespace")(O):g(O)}function g(O){return O===null||Y_(O)?(e.exit("definition"),n.parser.defined.push(i),t(O)):r(O)}}function rtj(e,t,r){return n;function n(f){return PP(f)?ern(e,i)(f):r(f)}function i(f){return sja(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function a(f){return Cb(f)?Bv(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Y_(f)?t(f):r(f)}}var qOu={name:"hardBreakEscape",tokenize:ntj};function ntj(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Y_(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}var COu={name:"headingAtx",tokenize:atj,resolve:itj};function itj(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},wB(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function atj(e,t,r){let n=0;return i;function i(o){return e.enter("atxHeading"),a(o)}function a(o){return e.enter("atxHeadingSequence"),u(o)}function u(o){return o===35&&n++<6?(e.consume(o),u):o===null||PP(o)?(e.exit("atxHeadingSequence"),f(o)):r(o)}function f(o){return o===35?(e.enter("atxHeadingSequence"),d(o)):o===null||Y_(o)?(e.exit("atxHeading"),t(o)):Cb(o)?Bv(e,f,"whitespace")(o):(e.enter("atxHeadingText"),c(o))}function d(o){return o===35?(e.consume(o),d):(e.exit("atxHeadingSequence"),f(o))}function c(o){return o===null||o===35||PP(o)?(e.exit("atxHeadingText"),f(o)):(e.consume(o),c)}}var I6f=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],AOu=["pre","script","style","textarea"];var NOu={name:"htmlFlow",tokenize:ctj,resolveTo:stj,concrete:!0},otj={tokenize:ftj,partial:!0},utj={tokenize:ltj,partial:!0};function stj(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ctj(e,t,r){let n=this,i,a,u,f,d;return c;function c(Gt){return o(Gt)}function o(Gt){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(Gt),l}function l(Gt){return Gt===33?(e.consume(Gt),g):Gt===47?(e.consume(Gt),a=!0,S):Gt===63?(e.consume(Gt),i=3,n.interrupt?t:zt):z5(Gt)?(e.consume(Gt),u=String.fromCharCode(Gt),x):r(Gt)}function g(Gt){return Gt===45?(e.consume(Gt),i=2,O):Gt===91?(e.consume(Gt),i=5,f=0,j):z5(Gt)?(e.consume(Gt),i=4,n.interrupt?t:zt):r(Gt)}function O(Gt){return Gt===45?(e.consume(Gt),n.interrupt?t:zt):r(Gt)}function j(Gt){let bn="CDATA[";return Gt===bn.charCodeAt(f++)?(e.consume(Gt),f===bn.length?n.interrupt?t:$e:j):r(Gt)}function S(Gt){return z5(Gt)?(e.consume(Gt),u=String.fromCharCode(Gt),x):r(Gt)}function x(Gt){if(Gt===null||Gt===47||Gt===62||PP(Gt)){let bn=Gt===47,An=u.toLowerCase();return!bn&&!a&&AOu.includes(An)?(i=1,n.interrupt?t(Gt):$e(Gt)):I6f.includes(u.toLowerCase())?(i=6,bn?(e.consume(Gt),A):n.interrupt?t(Gt):$e(Gt)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(Gt):a?z(Gt):N(Gt))}return Gt===45||l8(Gt)?(e.consume(Gt),u+=String.fromCharCode(Gt),x):r(Gt)}function A(Gt){return Gt===62?(e.consume(Gt),n.interrupt?t:$e):r(Gt)}function z(Gt){return Cb(Gt)?(e.consume(Gt),z):ee(Gt)}function N(Gt){return Gt===47?(e.consume(Gt),ee):Gt===58||Gt===95||z5(Gt)?(e.consume(Gt),C):Cb(Gt)?(e.consume(Gt),N):ee(Gt)}function C(Gt){return Gt===45||Gt===46||Gt===58||Gt===95||l8(Gt)?(e.consume(Gt),C):U(Gt)}function U(Gt){return Gt===61?(e.consume(Gt),Y):Cb(Gt)?(e.consume(Gt),U):N(Gt)}function Y(Gt){return Gt===null||Gt===60||Gt===61||Gt===62||Gt===96?r(Gt):Gt===34||Gt===39?(e.consume(Gt),d=Gt,te):Cb(Gt)?(e.consume(Gt),Y):G(Gt)}function te(Gt){return Gt===d?(e.consume(Gt),d=null,$):Gt===null||Y_(Gt)?r(Gt):(e.consume(Gt),te)}function G(Gt){return Gt===null||Gt===34||Gt===39||Gt===47||Gt===60||Gt===61||Gt===62||Gt===96||PP(Gt)?U(Gt):(e.consume(Gt),G)}function $(Gt){return Gt===47||Gt===62||Cb(Gt)?N(Gt):r(Gt)}function ee(Gt){return Gt===62?(e.consume(Gt),Ve):r(Gt)}function Ve(Gt){return Gt===null||Y_(Gt)?$e(Gt):Cb(Gt)?(e.consume(Gt),Ve):r(Gt)}function $e(Gt){return Gt===45&&i===2?(e.consume(Gt),Nt):Gt===60&&i===1?(e.consume(Gt),ur):Gt===62&&i===4?(e.consume(Gt),_r):Gt===63&&i===3?(e.consume(Gt),zt):Gt===93&&i===5?(e.consume(Gt),Gr):Y_(Gt)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(otj,Xr,Dt)(Gt)):Gt===null||Y_(Gt)?(e.exit("htmlFlowData"),Dt(Gt)):(e.consume(Gt),$e)}function Dt(Gt){return e.check(utj,Tt,Xr)(Gt)}function Tt(Gt){return e.enter("lineEnding"),e.consume(Gt),e.exit("lineEnding"),Wt}function Wt(Gt){return Gt===null||Y_(Gt)?Dt(Gt):(e.enter("htmlFlowData"),$e(Gt))}function Nt(Gt){return Gt===45?(e.consume(Gt),zt):$e(Gt)}function ur(Gt){return Gt===47?(e.consume(Gt),u="",Ar):$e(Gt)}function Ar(Gt){if(Gt===62){let bn=u.toLowerCase();return AOu.includes(bn)?(e.consume(Gt),_r):$e(Gt)}return z5(Gt)&&u.length<8?(e.consume(Gt),u+=String.fromCharCode(Gt),Ar):$e(Gt)}function Gr(Gt){return Gt===93?(e.consume(Gt),zt):$e(Gt)}function zt(Gt){return Gt===62?(e.consume(Gt),_r):Gt===45&&i===2?(e.consume(Gt),zt):$e(Gt)}function _r(Gt){return Gt===null||Y_(Gt)?(e.exit("htmlFlowData"),Xr(Gt)):(e.consume(Gt),_r)}function Xr(Gt){return e.exit("htmlFlow"),t(Gt)}}function ltj(e,t,r){let n=this;return i;function i(u){return Y_(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):r(u)}function a(u){return n.parser.lazy[n.now().line]?r(u):t(u)}}function ftj(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(J2e,t,r)}}var zOu={name:"htmlText",tokenize:dtj};function dtj(e,t,r){let n=this,i,a,u;return f;function f(zt){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(zt),d}function d(zt){return zt===33?(e.consume(zt),c):zt===47?(e.consume(zt),U):zt===63?(e.consume(zt),N):z5(zt)?(e.consume(zt),G):r(zt)}function c(zt){return zt===45?(e.consume(zt),o):zt===91?(e.consume(zt),a=0,j):z5(zt)?(e.consume(zt),z):r(zt)}function o(zt){return zt===45?(e.consume(zt),O):r(zt)}function l(zt){return zt===null?r(zt):zt===45?(e.consume(zt),g):Y_(zt)?(u=l,ur(zt)):(e.consume(zt),l)}function g(zt){return zt===45?(e.consume(zt),O):l(zt)}function O(zt){return zt===62?Nt(zt):zt===45?g(zt):l(zt)}function j(zt){let _r="CDATA[";return zt===_r.charCodeAt(a++)?(e.consume(zt),a===_r.length?S:j):r(zt)}function S(zt){return zt===null?r(zt):zt===93?(e.consume(zt),x):Y_(zt)?(u=S,ur(zt)):(e.consume(zt),S)}function x(zt){return zt===93?(e.consume(zt),A):S(zt)}function A(zt){return zt===62?Nt(zt):zt===93?(e.consume(zt),A):S(zt)}function z(zt){return zt===null||zt===62?Nt(zt):Y_(zt)?(u=z,ur(zt)):(e.consume(zt),z)}function N(zt){return zt===null?r(zt):zt===63?(e.consume(zt),C):Y_(zt)?(u=N,ur(zt)):(e.consume(zt),N)}function C(zt){return zt===62?Nt(zt):N(zt)}function U(zt){return z5(zt)?(e.consume(zt),Y):r(zt)}function Y(zt){return zt===45||l8(zt)?(e.consume(zt),Y):te(zt)}function te(zt){return Y_(zt)?(u=te,ur(zt)):Cb(zt)?(e.consume(zt),te):Nt(zt)}function G(zt){return zt===45||l8(zt)?(e.consume(zt),G):zt===47||zt===62||PP(zt)?$(zt):r(zt)}function $(zt){return zt===47?(e.consume(zt),Nt):zt===58||zt===95||z5(zt)?(e.consume(zt),ee):Y_(zt)?(u=$,ur(zt)):Cb(zt)?(e.consume(zt),$):Nt(zt)}function ee(zt){return zt===45||zt===46||zt===58||zt===95||l8(zt)?(e.consume(zt),ee):Ve(zt)}function Ve(zt){return zt===61?(e.consume(zt),$e):Y_(zt)?(u=Ve,ur(zt)):Cb(zt)?(e.consume(zt),Ve):$(zt)}function $e(zt){return zt===null||zt===60||zt===61||zt===62||zt===96?r(zt):zt===34||zt===39?(e.consume(zt),i=zt,Dt):Y_(zt)?(u=$e,ur(zt)):Cb(zt)?(e.consume(zt),$e):(e.consume(zt),Tt)}function Dt(zt){return zt===i?(e.consume(zt),i=void 0,Wt):zt===null?r(zt):Y_(zt)?(u=Dt,ur(zt)):(e.consume(zt),Dt)}function Tt(zt){return zt===null||zt===34||zt===39||zt===60||zt===61||zt===96?r(zt):zt===47||zt===62||PP(zt)?$(zt):(e.consume(zt),Tt)}function Wt(zt){return zt===47||zt===62||PP(zt)?$(zt):r(zt)}function Nt(zt){return zt===62?(e.consume(zt),e.exit("htmlTextData"),e.exit("htmlText"),t):r(zt)}function ur(zt){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(zt),e.exit("lineEnding"),Ar}function Ar(zt){return Cb(zt)?Bv(e,Gr,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(zt):Gr(zt)}function Gr(zt){return e.enter("htmlTextData"),u(zt)}}var trn={name:"labelEnd",tokenize:btj,resolveTo:vtj,resolveAll:ytj},ptj={tokenize:gtj},_tj={tokenize:mtj},htj={tokenize:Otj};function ytj(e){let t=-1;for(;++t<e.length;){let r=e[t][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(e.splice(t+1,r.type==="labelImage"?4:2),r.type="data",t++)}return e}function vtj(e,t){let r=e.length,n=0,i,a,u,f;for(;r--;)if(i=e[r][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(u){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(u=r);let d={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[u][1].end)},o={type:"labelText",start:Object.assign({},e[a+n+2][1].end),end:Object.assign({},e[u-2][1].start)};return f=[["enter",d,t],["enter",c,t]],f=$Q(f,e.slice(a+1,a+n+3)),f=$Q(f,[["enter",o,t]]),f=$Q(f,Wzr(t.parser.constructs.insideSpan.null,e.slice(a+n+4,u-3),t)),f=$Q(f,[["exit",o,t],e[u-2],e[u-1],["exit",c,t]]),f=$Q(f,e.slice(u+1)),f=$Q(f,[["exit",d,t]]),wB(e,a,e.length,f),e}function btj(e,t,r){let n=this,i=n.events.length,a,u;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){a=n.events[i][1];break}return f;function f(g){return a?a._inactive?l(g):(u=n.parser.defined.includes(fG(n.sliceSerialize({start:a.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),d):r(g)}function d(g){return g===40?e.attempt(ptj,o,u?o:l)(g):g===91?e.attempt(_tj,o,u?c:l)(g):u?o(g):l(g)}function c(g){return e.attempt(htj,o,l)(g)}function o(g){return t(g)}function l(g){return a._balanced=!0,r(g)}}function gtj(e,t,r){return n;function n(l){return e.enter("resource"),e.enter("resourceMarker"),e.consume(l),e.exit("resourceMarker"),i}function i(l){return PP(l)?ern(e,a)(l):a(l)}function a(l){return l===41?o(l):oja(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(l)}function u(l){return PP(l)?ern(e,d)(l):o(l)}function f(l){return r(l)}function d(l){return l===34||l===39||l===40?sja(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(l):o(l)}function c(l){return PP(l)?ern(e,o)(l):o(l)}function o(l){return l===41?(e.enter("resourceMarker"),e.consume(l),e.exit("resourceMarker"),e.exit("resource"),t):r(l)}}function mtj(e,t,r){let n=this;return i;function i(f){return uja.call(n,e,a,u,"reference","referenceMarker","referenceString")(f)}function a(f){return n.parser.defined.includes(fG(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function u(f){return r(f)}}function Otj(e,t,r){return n;function n(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):r(a)}}var BOu={name:"labelStartImage",tokenize:Ptj,resolveAll:trn.resolveAll};function Ptj(e,t,r){let n=this;return i;function i(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),a}function a(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):r(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(f):t(f)}}var IOu={name:"labelStartLink",tokenize:jtj,resolveAll:trn.resolveAll};function jtj(e,t,r){let n=this;return i;function i(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),a}function a(u){return u===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(u):t(u)}}var G0i={name:"lineEnding",tokenize:wtj};function wtj(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Bv(e,t,"linePrefix")}}var rrn={name:"thematicBreak",tokenize:Dtj};function Dtj(e,t,r){let n=0,i;return a;function a(c){return e.enter("thematicBreak"),u(c)}function u(c){return i=c,f(c)}function f(c){return c===i?(e.enter("thematicBreakSequence"),d(c)):n>=3&&(c===null||Y_(c))?(e.exit("thematicBreak"),t(c)):r(c)}function d(c){return c===i?(e.consume(c),n++,d):(e.exit("thematicBreakSequence"),Cb(c)?Bv(e,f,"whitespace")(c):f(c))}}var dG={name:"list",tokenize:Mtj,continuation:{tokenize:xtj},exit:qtj},Stj={tokenize:Ctj,partial:!0},Etj={tokenize:Ttj,partial:!0};function Mtj(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,u=0;return f;function f(O){let j=n.containerState.type||(O===42||O===43||O===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!n.containerState.marker||O===n.containerState.marker:W0i(O)){if(n.containerState.type||(n.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),O===42||O===45?e.check(rrn,r,c)(O):c(O);if(!n.interrupt||O===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(O)}return r(O)}function d(O){return W0i(O)&&++u<10?(e.consume(O),d):(!n.interrupt||u<2)&&(n.containerState.marker?O===n.containerState.marker:O===41||O===46)?(e.exit("listItemValue"),c(O)):r(O)}function c(O){return e.enter("listItemMarker"),e.consume(O),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||O,e.check(J2e,n.interrupt?r:o,e.attempt(Stj,g,l))}function o(O){return n.containerState.initialBlankLine=!0,a++,g(O)}function l(O){return Cb(O)?(e.enter("listItemPrefixWhitespace"),e.consume(O),e.exit("listItemPrefixWhitespace"),g):r(O)}function g(O){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(O)}}function xtj(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(J2e,i,a);function i(f){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Bv(e,t,"listItemIndent",n.containerState.size+1)(f)}function a(f){return n.containerState.furtherBlankLines||!Cb(f)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,u(f)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Etj,t,u)(f))}function u(f){return n.containerState._closeFlow=!0,n.interrupt=void 0,Bv(e,e.attempt(dG,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Ttj(e,t,r){let n=this;return Bv(e,i,"listItemIndent",n.containerState.size+1);function i(a){let u=n.events[n.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===n.containerState.size?t(a):r(a)}}function qtj(e){e.exit(this.containerState.type)}function Ctj(e,t,r){let n=this;return Bv(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(a){let u=n.events[n.events.length-1];return!Cb(a)&&u&&u[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}var cja={name:"setextUnderline",tokenize:Ntj,resolveTo:Atj};function Atj(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);let u={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",u,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[a][1].end)):e[n][1]=u,e.push(["exit",u,t]),e}function Ntj(e,t,r){let n=this,i;return a;function a(c){let o=n.events.length,l;for(;o--;)if(n.events[o][1].type!=="lineEnding"&&n.events[o][1].type!=="linePrefix"&&n.events[o][1].type!=="content"){l=n.events[o][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||l)?(e.enter("setextHeadingLine"),i=c,u(c)):r(c)}function u(c){return e.enter("setextHeadingLineSequence"),f(c)}function f(c){return c===i?(e.consume(c),f):(e.exit("setextHeadingLineSequence"),Cb(c)?Bv(e,d,"lineSuffix")(c):d(c))}function d(c){return c===null||Y_(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}var R6f={tokenize:ztj};function ztj(e){let t=this,r=e.attempt(J2e,n,e.attempt(this.parser.constructs.flowInitial,i,Bv(e,e.attempt(this.parser.constructs.flow,i,e.attempt(xOu,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}var F6f={resolveAll:W6f()},L6f=V6f("string"),U6f=V6f("text");function V6f(e){return{tokenize:t,resolveAll:W6f(e==="text"?Btj:void 0)};function t(r){let n=this,i=this.parser.constructs[e],a=r.attempt(i,u,f);return u;function u(o){return c(o)?a(o):f(o)}function f(o){if(o===null){r.consume(o);return}return r.enter("data"),r.consume(o),d}function d(o){return c(o)?(r.exit("data"),a(o)):(r.consume(o),d)}function c(o){if(o===null)return!0;let l=i[o],g=-1;if(l)for(;++g<l.length;){let O=l[g];if(!O.previous||O.previous.call(n,n.previous))return!0}return!1}}}function W6f(e){return t;function t(r,n){let i=-1,a;for(;++i<=r.length;)a===void 0?r[i]&&r[i][1].type==="data"&&(a=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==a+2&&(r[a][1].end=r[i-1][1].end,r.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(r,n):r}}function Btj(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){let n=e[r-1][1],i=t.sliceStream(n),a=i.length,u=-1,f=0,d;for(;a--;){let c=i[a];if(typeof c=="string"){for(u=c.length;c.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(c===-2)d=!0,f++;else if(c!==-1){a++;break}}if(f){let c={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-f,offset:n.end.offset-f,_index:n.start._index+a,_bufferIndex:a?u:n.start._bufferIndex+u},end:Object.assign({},n.end)};n.end=Object.assign({},c.start),n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}function H6f(e,t,r){let n=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},a=[],u=[],f=[],d=!0,c={consume:C,enter:U,exit:Y,attempt:$(te),check:$(G),interrupt:$(G,{interrupt:!0})},o={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:S,sliceSerialize:j,now:x,defineSkip:A,write:O},l=t.tokenize.call(o,c),g;return t.resolveAll&&a.push(t),o;function O(Dt){return u=$Q(u,Dt),z(),u[u.length-1]!==null?[]:(ee(t,0),o.events=Wzr(a,o.events,o),o.events)}function j(Dt,Tt){return Rtj(S(Dt),Tt)}function S(Dt){return Itj(u,Dt)}function x(){let{line:Dt,column:Tt,offset:Wt,_index:Nt,_bufferIndex:ur}=n;return{line:Dt,column:Tt,offset:Wt,_index:Nt,_bufferIndex:ur}}function A(Dt){i[Dt.line]=Dt.column,$e()}function z(){let Dt;for(;n._index<u.length;){let Tt=u[n._index];if(typeof Tt=="string")for(Dt=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===Dt&&n._bufferIndex<Tt.length;)N(Tt.charCodeAt(n._bufferIndex));else N(Tt)}}function N(Dt){d=void 0,g=Dt,l=l(Dt)}function C(Dt){Y_(Dt)?(n.line++,n.column=1,n.offset+=Dt===-3?2:1,$e()):Dt!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===u[n._index].length&&(n._bufferIndex=-1,n._index++)),o.previous=Dt,d=!0}function U(Dt,Tt){let Wt=Tt||{};return Wt.type=Dt,Wt.start=x(),o.events.push(["enter",Wt,o]),f.push(Wt),Wt}function Y(Dt){let Tt=f.pop();return Tt.end=x(),o.events.push(["exit",Tt,o]),Tt}function te(Dt,Tt){ee(Dt,Tt.from)}function G(Dt,Tt){Tt.restore()}function $(Dt,Tt){return Wt;function Wt(Nt,ur,Ar){let Gr,zt,_r,Xr;return Array.isArray(Nt)?bn(Nt):"tokenize"in Nt?bn([Nt]):Gt(Nt);function Gt(jn){return dn;function dn(Si){let ji=Si!==null&&jn[Si],pa=Si!==null&&jn.null,fo=[...Array.isArray(ji)?ji:ji?[ji]:[],...Array.isArray(pa)?pa:pa?[pa]:[]];return bn(fo)(Si)}}function bn(jn){return Gr=jn,zt=0,jn.length===0?Ar:An(jn[zt])}function An(jn){return dn;function dn(Si){return Xr=Ve(),_r=jn,jn.partial||(o.currentConstruct=jn),jn.name&&o.parser.constructs.disable.null.includes(jn.name)?er(Si):jn.tokenize.call(Tt?Object.assign(Object.create(o),Tt):o,c,Ht,er)(Si)}}function Ht(jn){return d=!0,Dt(_r,Xr),ur}function er(jn){return d=!0,Xr.restore(),++zt<Gr.length?An(Gr[zt]):Ar}}}function ee(Dt,Tt){Dt.resolveAll&&!a.includes(Dt)&&a.push(Dt),Dt.resolve&&wB(o.events,Tt,o.events.length-Tt,Dt.resolve(o.events.slice(Tt),o)),Dt.resolveTo&&(o.events=Dt.resolveTo(o.events,o))}function Ve(){let Dt=x(),Tt=o.previous,Wt=o.currentConstruct,Nt=o.events.length,ur=Array.from(f);return{restore:Ar,from:Nt};function Ar(){n=Dt,o.previous=Tt,o.currentConstruct=Wt,o.events.length=Nt,f=ur,$e()}}function $e(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function Itj(e,t){let r=t.start._index,n=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,u;if(r===i)u=[e[r].slice(n,a)];else{if(u=e.slice(r,i),n>-1){let f=u[0];typeof f=="string"?u[0]=f.slice(n):u.shift()}a>0&&u.push(e[i].slice(0,a))}return u}function Rtj(e,t){let r=-1,n=[],i;for(;++r<e.length;){let a=e[r],u;if(typeof a=="string")u=a;else switch(a){case-5:{u="\r";break}case-4:{u=`
|
|
1922
1922
|
`;break}case-3:{u=`\r
|
|
1923
1923
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&i)continue;u=" ";break}default:u=String.fromCharCode(a)}i=a===-2,n.push(u)}return n.join("")}var ROu={};Wb(ROu,{attentionMarkers:()=>Jtj,contentInitial:()=>Ltj,disable:()=>Gtj,document:()=>Ftj,flow:()=>Vtj,flowInitial:()=>Utj,insideSpan:()=>$tj,string:()=>Wtj,text:()=>Htj});var Ftj={[42]:dG,[43]:dG,[45]:dG,[48]:dG,[49]:dG,[50]:dG,[51]:dG,[52]:dG,[53]:dG,[54]:dG,[55]:dG,[56]:dG,[57]:dG,[62]:eja},Ltj={[91]:TOu},Utj={[-2]:$0i,[-1]:$0i,[32]:$0i},Vtj={[35]:COu,[42]:rrn,[45]:[cja,rrn],[60]:NOu,[61]:cja,[95]:rrn,[96]:nja,[126]:nja},Wtj={[38]:rja,[92]:tja},Htj={[-5]:G0i,[-4]:G0i,[-3]:G0i,[33]:BOu,[38]:rja,[42]:H0i,[60]:[EOu,zOu],[91]:IOu,[92]:[qOu,tja],[93]:trn,[95]:H0i,[96]:MOu},$tj={null:[H0i,F6f]},Jtj={null:[42,95]},Gtj={null:[]};function FOu(e){let r=Uzr([ROu,...(e||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(C6f),document:i(N6f),flow:i(R6f),string:i(L6f),text:i(U6f)};return n;function i(a){return u;function u(f){return H6f(n,a,f)}}}function LOu(e){for(;!aja(e););return e}var $6f=/[\0\t\n\r]/g;function UOu(){let e=1,t="",r=!0,n;return i;function i(a,u,f){let d=[],c,o,l,g,O;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(u||void 0).decode(a)),l=0,t="",r&&(a.charCodeAt(0)===65279&&l++,r=void 0);l<a.length;){if($6f.lastIndex=l,c=$6f.exec(a),g=c&&c.index!==void 0?c.index:a.length,O=a.charCodeAt(g),!c){t=a.slice(l);break}if(O===10&&l===g&&n)d.push(-3),n=void 0;else switch(n&&(d.push(-5),n=void 0),l<g&&(d.push(a.slice(l,g)),e+=g-l),O){case 0:{d.push(65533),e++;break}case 9:{for(o=Math.ceil(e/4)*4,d.push(-2);e++<o;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:n=!0,e=1}l=g+1}return f&&(n&&d.push(-5),t&&d.push(t),d.push(null)),d}}var Ktj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function J6f(e){return e.replace(Ktj,Ytj)}function Ytj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){let i=r.charCodeAt(1),a=i===120||i===88;return k1a(r.slice(a?2:1),a?16:10)}return OEr(r)||e}function J9(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?G6f(e.position):"start"in e||"end"in e?G6f(e):"line"in e||"column"in e?VOu(e):""}function VOu(e){return K6f(e&&e.line)+":"+K6f(e&&e.column)}function G6f(e){return VOu(e&&e.start)+"-"+VOu(e&&e.end)}function K6f(e){return e&&typeof e=="number"?e:1}var X6f={}.hasOwnProperty;function iNn(e,t,r){return typeof t!="string"&&(r=t,t=void 0),Xtj(r)(LOu(FOu(r).document().write(UOu()(e,t,!0))))}function Xtj(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Tn),autolinkProtocol:$,autolinkEmail:$,atxHeading:a(qn),blockQuote:a(Si),characterEscape:$,characterReference:$,codeFenced:a(ji),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:a(ji,u),codeText:a(pa,u),codeTextData:$,data:$,codeFlowValue:$,definition:a(fo),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:a(Jo),hardBreakEscape:a(mn),hardBreakTrailing:a(mn),htmlFlow:a(Un,u),htmlFlowData:$,htmlText:a(Un,u),htmlTextData:$,image:a(Mn),label:u,link:a(Tn),listItem:a(Li),listItemValue:g,listOrdered:a(ma,l),listUnordered:a(ma),paragraph:a(ya),reference:Gt,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:a(qn),strong:a(bo),thematicBreak:a(Aa)},exit:{atxHeading:d(),atxHeadingSequence:U,autolink:d(),autolinkEmail:dn,autolinkProtocol:jn,blockQuote:d(),characterEscapeValue:ee,characterReferenceMarkerHexadecimal:An,characterReferenceMarkerNumeric:An,characterReferenceValue:Ht,characterReference:er,codeFenced:d(x),codeFencedFence:S,codeFencedFenceInfo:O,codeFencedFenceMeta:j,codeFlowValue:ee,codeIndented:d(A),codeText:d(Wt),codeTextData:ee,data:ee,definition:d(),definitionDestinationString:C,definitionLabelString:z,definitionTitleString:N,emphasis:d(),hardBreakEscape:d($e),hardBreakTrailing:d($e),htmlFlow:d(Dt),htmlFlowData:ee,htmlText:d(Tt),htmlTextData:ee,image:d(ur),label:Gr,labelText:Ar,lineEnding:Ve,link:d(Nt),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:bn,resourceDestinationString:zt,resourceTitleString:_r,resource:Xr,setextHeading:d(G),setextHeadingLineSequence:te,setextHeadingText:Y,strong:d(),thematicBreak:d()}};Q6f(t,(e||{}).mdastExtensions||[]);let r={};return n;function n(Kr){let an={type:"root",children:[]},br={stack:[an],tokenStack:[],config:t,enter:f,exit:c,buffer:u,resume:o,data:r},nn=[],Cr=-1;for(;++Cr<Kr.length;)if(Kr[Cr][1].type==="listOrdered"||Kr[Cr][1].type==="listUnordered")if(Kr[Cr][0]==="enter")nn.push(Cr);else{let Kt=nn.pop();Cr=i(Kr,Kt,Cr)}for(Cr=-1;++Cr<Kr.length;){let Kt=t[Kr[Cr][0]];X6f.call(Kt,Kr[Cr][1].type)&&Kt[Kr[Cr][1].type].call(Object.assign({sliceSerialize:Kr[Cr][2].sliceSerialize},br),Kr[Cr][1])}if(br.tokenStack.length>0){let Kt=br.tokenStack[br.tokenStack.length-1];(Kt[1]||Y6f).call(br,void 0,Kt[0])}for(an.position={start:Hzr(Kr.length>0?Kr[0][1].start:{line:1,column:1,offset:0}),end:Hzr(Kr.length>0?Kr[Kr.length-2][1].end:{line:1,column:1,offset:0})},Cr=-1;++Cr<t.transforms.length;)an=t.transforms[Cr](an)||an;return an}function i(Kr,an,br){let nn=an-1,Cr=-1,Kt=!1,Qt,qr,kr,Lr;for(;++nn<=br;){let gr=Kr[nn];switch(gr[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{gr[0]==="enter"?Cr++:Cr--,Lr=void 0;break}case"lineEndingBlank":{gr[0]==="enter"&&(Qt&&!Lr&&!Cr&&!kr&&(kr=nn),Lr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Lr=void 0}if(!Cr&&gr[0]==="enter"&&gr[1].type==="listItemPrefix"||Cr===-1&&gr[0]==="exit"&&(gr[1].type==="listUnordered"||gr[1].type==="listOrdered")){if(Qt){let hn=nn;for(qr=void 0;hn--;){let aa=Kr[hn];if(aa[1].type==="lineEnding"||aa[1].type==="lineEndingBlank"){if(aa[0]==="exit")continue;qr&&(Kr[qr][1].type="lineEndingBlank",Kt=!0),aa[1].type="lineEnding",qr=hn}else if(!(aa[1].type==="linePrefix"||aa[1].type==="blockQuotePrefix"||aa[1].type==="blockQuotePrefixWhitespace"||aa[1].type==="blockQuoteMarker"||aa[1].type==="listItemIndent"))break}kr&&(!qr||kr<qr)&&(Qt._spread=!0),Qt.end=Object.assign({},qr?Kr[qr][1].start:gr[1].end),Kr.splice(qr||nn,0,["exit",Qt,gr[2]]),nn++,br++}if(gr[1].type==="listItemPrefix"){let hn={type:"listItem",_spread:!1,start:Object.assign({},gr[1].start),end:void 0};Qt=hn,Kr.splice(nn,0,["enter",hn,gr[2]]),nn++,br++,kr=void 0,Lr=!0}}}return Kr[an][1]._spread=Kt,br}function a(Kr,an){return br;function br(nn){f.call(this,Kr(nn),nn),an&&an.call(this,nn)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(Kr,an,br){this.stack[this.stack.length-1].children.push(Kr),this.stack.push(Kr),this.tokenStack.push([an,br]),Kr.position={start:Hzr(an.start),end:void 0}}function d(Kr){return an;function an(br){Kr&&Kr.call(this,br),c.call(this,br)}}function c(Kr,an){let br=this.stack.pop(),nn=this.tokenStack.pop();if(nn)nn[0].type!==Kr.type&&(an?an.call(this,Kr,nn[0]):(nn[1]||Y6f).call(this,Kr,nn[0]));else throw new Error("Cannot close `"+Kr.type+"` ("+J9({start:Kr.start,end:Kr.end})+"): it\u2019s not open");br.position.end=Hzr(Kr.end)}function o(){return Qtn(this.stack.pop())}function l(){this.data.expectingFirstListItemValue=!0}function g(Kr){if(this.data.expectingFirstListItemValue){let an=this.stack[this.stack.length-2];an.start=Number.parseInt(this.sliceSerialize(Kr),10),this.data.expectingFirstListItemValue=void 0}}function O(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.lang=Kr}function j(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.meta=Kr}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.value=Kr.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.value=Kr.replace(/(\r?\n|\r)$/g,"")}function z(Kr){let an=this.resume(),br=this.stack[this.stack.length-1];br.label=an,br.identifier=fG(this.sliceSerialize(Kr)).toLowerCase()}function N(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.title=Kr}function C(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.url=Kr}function U(Kr){let an=this.stack[this.stack.length-1];if(!an.depth){let br=this.sliceSerialize(Kr).length;an.depth=br}}function Y(){this.data.setextHeadingSlurpLineEnding=!0}function te(Kr){let an=this.stack[this.stack.length-1];an.depth=this.sliceSerialize(Kr).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function $(Kr){let br=this.stack[this.stack.length-1].children,nn=br[br.length-1];(!nn||nn.type!=="text")&&(nn=Fa(),nn.position={start:Hzr(Kr.start),end:void 0},br.push(nn)),this.stack.push(nn)}function ee(Kr){let an=this.stack.pop();an.value+=this.sliceSerialize(Kr),an.position.end=Hzr(Kr.end)}function Ve(Kr){let an=this.stack[this.stack.length-1];if(this.data.atHardBreak){let br=an.children[an.children.length-1];br.position.end=Hzr(Kr.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(an.type)&&($.call(this,Kr),ee.call(this,Kr))}function $e(){this.data.atHardBreak=!0}function Dt(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.value=Kr}function Tt(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.value=Kr}function Wt(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.value=Kr}function Nt(){let Kr=this.stack[this.stack.length-1];if(this.data.inReference){let an=this.data.referenceType||"shortcut";Kr.type+="Reference",Kr.referenceType=an,delete Kr.url,delete Kr.title}else delete Kr.identifier,delete Kr.label;this.data.referenceType=void 0}function ur(){let Kr=this.stack[this.stack.length-1];if(this.data.inReference){let an=this.data.referenceType||"shortcut";Kr.type+="Reference",Kr.referenceType=an,delete Kr.url,delete Kr.title}else delete Kr.identifier,delete Kr.label;this.data.referenceType=void 0}function Ar(Kr){let an=this.sliceSerialize(Kr),br=this.stack[this.stack.length-2];br.label=J6f(an),br.identifier=fG(an).toLowerCase()}function Gr(){let Kr=this.stack[this.stack.length-1],an=this.resume(),br=this.stack[this.stack.length-1];if(this.data.inReference=!0,br.type==="link"){let nn=Kr.children;br.children=nn}else br.alt=an}function zt(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.url=Kr}function _r(){let Kr=this.resume(),an=this.stack[this.stack.length-1];an.title=Kr}function Xr(){this.data.inReference=void 0}function Gt(){this.data.referenceType="collapsed"}function bn(Kr){let an=this.resume(),br=this.stack[this.stack.length-1];br.label=an,br.identifier=fG(this.sliceSerialize(Kr)).toLowerCase(),this.data.referenceType="full"}function An(Kr){this.data.characterReferenceType=Kr.type}function Ht(Kr){let an=this.sliceSerialize(Kr),br=this.data.characterReferenceType,nn;br?(nn=k1a(an,br==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):nn=OEr(an);let Cr=this.stack[this.stack.length-1];Cr.value+=nn}function er(Kr){let an=this.stack.pop();an.position.end=Hzr(Kr.end)}function jn(Kr){ee.call(this,Kr);let an=this.stack[this.stack.length-1];an.url=this.sliceSerialize(Kr)}function dn(Kr){ee.call(this,Kr);let an=this.stack[this.stack.length-1];an.url="mailto:"+this.sliceSerialize(Kr)}function Si(){return{type:"blockquote",children:[]}}function ji(){return{type:"code",lang:null,meta:null,value:""}}function pa(){return{type:"inlineCode",value:""}}function fo(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Jo(){return{type:"emphasis",children:[]}}function qn(){return{type:"heading",depth:0,children:[]}}function mn(){return{type:"break"}}function Un(){return{type:"html",value:""}}function Mn(){return{type:"image",title:null,url:"",alt:null}}function Tn(){return{type:"link",title:null,url:"",children:[]}}function ma(Kr){return{type:"list",ordered:Kr.type==="listOrdered",start:null,spread:Kr._spread,children:[]}}function Li(Kr){return{type:"listItem",spread:Kr._spread,checked:null,children:[]}}function ya(){return{type:"paragraph",children:[]}}function bo(){return{type:"strong",children:[]}}function Fa(){return{type:"text",value:""}}function Aa(){return{type:"thematicBreak"}}}function Hzr(e){return{line:e.line,column:e.column,offset:e.offset}}function Q6f(e,t){let r=-1;for(;++r<t.length;){let n=t[r];Array.isArray(n)?Q6f(e,n):Qtj(e,n)}}function Qtj(e,t){let r;for(r in t)if(X6f.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n);break}}}function Y6f(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+J9({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+J9({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+J9({start:t.start,end:t.end})+") is still open")}function WOu(){return{enter:{mdxFlowExpression:Ztj,mdxTextExpression:ktj},exit:{mdxFlowExpression:Z6f,mdxFlowExpressionChunk:k6f,mdxTextExpression:Z6f,mdxTextExpressionChunk:k6f}}}function HOu(){return{handlers:{mdxFlowExpression:e7f,mdxTextExpression:e7f},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function Ztj(e){this.enter({type:"mdxFlowExpression",value:""},e),this.buffer()}function ktj(e){this.enter({type:"mdxTextExpression",value:""},e),this.buffer()}function Z6f(e){let t=this.resume(),r=e.estree,n=this.stack[this.stack.length-1];n.type==="mdxFlowExpression"||n.type,this.exit(e),n.value=t,r&&(n.data={estree:r})}function k6f(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function e7f(e){let t=e.value||"";return"{"+t+"}"}function aNn(e,t){let r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}var t7f=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var $Ou={0:"\uFFFD",128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};function lja(e){let t=typeof e=="string"?e.charCodeAt(0):e;return t>=48&&t<=57}function r7f(e){let t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function n7f(e){let t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function JOu(e){return n7f(e)||lja(e)}var oNn=String.fromCharCode,erj=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function GOu(e,t={}){let r=typeof t.additional=="string"?t.additional.charCodeAt(0):t.additional,n=[],i=0,a=-1,u="",f,d;t.position&&("start"in t.position||"indent"in t.position?(d=t.position.indent,f=t.position.start):f=t.position);let c=(f?f.line:0)||1,o=(f?f.column:0)||1,l=O(),g;for(i--;++i<=e.length;)if(g===10&&(o=(d?d[a]:0)||1),g=e.charCodeAt(i),g===38){let x=e.charCodeAt(i+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||r&&x===r){u+=oNn(g),o++;continue}let A=i+1,z=A,N=A,C;if(x===35){N=++z;let $e=e.charCodeAt(N);$e===88||$e===120?(C="hexadecimal",N=++z):C="decimal"}else C="named";let U="",Y="",te="",G=C==="named"?JOu:C==="decimal"?lja:r7f;for(N--;++N<=e.length;){let $e=e.charCodeAt(N);if(!G($e))break;te+=oNn($e),C==="named"&&t7f.includes(te)&&(U=te,Y=OEr(te))}let $=e.charCodeAt(N)===59;if($){N++;let $e=C==="named"?OEr(te):!1;$e&&(U=te,Y=$e)}let ee=1+N-A,Ve="";if(!(!$&&t.nonTerminated===!1))if(!te)C!=="named"&&j(4,ee);else if(C==="named"){if($&&!Y)j(5,1);else if(U!==te&&(N=z+U.length,ee=1+N-z,$=!1),!$){let $e=U?1:3;if(t.attribute){let Dt=e.charCodeAt(N);Dt===61?(j($e,ee),Y=""):JOu(Dt)?Y="":j($e,ee)}else j($e,ee)}Ve=Y}else{$||j(2,ee);let $e=Number.parseInt(te,C==="hexadecimal"?16:10);if(trj($e))j(7,ee),Ve=oNn(65533);else if($e in $Ou)j(6,ee),Ve=$Ou[$e];else{let Dt="";rrj($e)&&j(6,ee),$e>65535&&($e-=65536,Dt+=oNn($e>>>10|55296),$e=56320|$e&1023),Ve=Dt+oNn($e)}}if(Ve){S(),l=O(),i=N-1,o+=N-A+1,n.push(Ve);let $e=O();$e.offset++,t.reference&&t.reference.call(t.referenceContext,Ve,{start:l,end:$e},e.slice(A-1,N)),l=$e}else te=e.slice(A-1,N),u+=te,o+=te.length,i=N-1}else g===10&&(c++,a++,o=0),Number.isNaN(g)?S():(u+=oNn(g),o++);return n.join("");function O(){return{line:c,column:o,offset:i+((f?f.offset:0)||0)}}function j(x,A){let z;t.warning&&(z=O(),z.column+=A,z.offset+=A,t.warning.call(t.warningContext,erj[x],z,x))}function S(){u&&(n.push(u),t.text&&t.text.call(t.textContext,u,{start:l,end:O()}),u="")}}function trj(e){return e>=55296&&e<=57343||e>1114111}function rrj(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}function i7f(e,t){if(e=e.replace(t.subset?nrj(t.subset):/["&'<>`]/g,n),t.subset||t.escapeOnly)return e;return e.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,r).replace(/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,n);function r(i,a,u){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,u.charCodeAt(a+2),t)}function n(i,a,u){return t.format(i.charCodeAt(0),u.charCodeAt(a+1),t)}}function nrj(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(/[|\\{}()[\]^$+*?.]/g,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}function a7f(e){return"&#x"+e.toString(16).toUpperCase()+";"}function o7f(e,t){return i7f(e,Object.assign({format:a7f},t))}var rw=class extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},u=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(u=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){let d=n.indexOf(":");d===-1?a.ruleId=n:(a.source=n.slice(0,d),a.ruleId=n.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){let d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}let f=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=f?f.line:void 0,this.name=J9(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=u&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};rw.prototype.file="";rw.prototype.name="";rw.prototype.reason="";rw.prototype.message="";rw.prototype.stack="";rw.prototype.column=void 0;rw.prototype.line=void 0;rw.prototype.ancestors=void 0;rw.prototype.cause=void 0;rw.prototype.fatal=void 0;rw.prototype.place=void 0;rw.prototype.ruleId=void 0;rw.prototype.source=void 0;var u7f=" ";function KOu(){return{canContainEols:["mdxJsxTextElement"],enter:{mdxJsxFlowTag:n,mdxJsxFlowTagClosingMarker:i,mdxJsxFlowTagAttribute:l,mdxJsxFlowTagExpressionAttribute:g,mdxJsxFlowTagAttributeValueLiteral:e,mdxJsxFlowTagAttributeValueExpression:e,mdxJsxFlowTagSelfClosingMarker:u,mdxJsxTextTag:n,mdxJsxTextTagClosingMarker:i,mdxJsxTextTagAttribute:l,mdxJsxTextTagExpressionAttribute:g,mdxJsxTextTagAttributeValueLiteral:e,mdxJsxTextTagAttributeValueExpression:e,mdxJsxTextTagSelfClosingMarker:u},exit:{mdxJsxFlowTagClosingMarker:f,mdxJsxFlowTagNamePrimary:d,mdxJsxFlowTagNameMember:c,mdxJsxFlowTagNameLocal:o,mdxJsxFlowTagExpressionAttribute:O,mdxJsxFlowTagExpressionAttributeValue:r,mdxJsxFlowTagAttributeNamePrimary:j,mdxJsxFlowTagAttributeNameLocal:S,mdxJsxFlowTagAttributeValueLiteral:x,mdxJsxFlowTagAttributeValueLiteralValue:r,mdxJsxFlowTagAttributeValueExpression:A,mdxJsxFlowTagAttributeValueExpressionValue:r,mdxJsxFlowTagSelfClosingMarker:z,mdxJsxFlowTag:N,mdxJsxTextTagClosingMarker:f,mdxJsxTextTagNamePrimary:d,mdxJsxTextTagNameMember:c,mdxJsxTextTagNameLocal:o,mdxJsxTextTagExpressionAttribute:O,mdxJsxTextTagExpressionAttributeValue:r,mdxJsxTextTagAttributeNamePrimary:j,mdxJsxTextTagAttributeNameLocal:S,mdxJsxTextTagAttributeValueLiteral:x,mdxJsxTextTagAttributeValueLiteralValue:r,mdxJsxTextTagAttributeValueExpression:A,mdxJsxTextTagAttributeValueExpressionValue:r,mdxJsxTextTagSelfClosingMarker:z,mdxJsxTextTag:N}};function e(){this.buffer()}function t(te){return{line:te.line,column:te.column,offset:te.offset}}function r(te){this.config.enter.data.call(this,te),this.config.exit.data.call(this,te)}function n(te){let G={name:void 0,attributes:[],close:!1,selfClosing:!1,start:te.start,end:te.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=G,this.buffer()}function i(te){let G=this.data.mdxJsxTagStack;if(G.length===0)throw new rw("Unexpected closing slash `/` in tag, expected an open tag first",{start:te.start,end:te.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function a(te){let G=this.data.mdxJsxTag;if(G.close)throw new rw("Unexpected attribute in closing tag, expected the end of the tag",{start:te.start,end:te.end},"mdast-util-mdx-jsx:unexpected-attribute")}function u(te){let G=this.data.mdxJsxTag;if(G.close)throw new rw("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:te.start,end:te.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function f(){let te=this.data.mdxJsxTag;te.close=!0}function d(te){let G=this.data.mdxJsxTag;G.name=this.sliceSerialize(te)}function c(te){let G=this.data.mdxJsxTag;G.name+="."+this.sliceSerialize(te)}function o(te){let G=this.data.mdxJsxTag;G.name+=":"+this.sliceSerialize(te)}function l(te){let G=this.data.mdxJsxTag;a.call(this,te),G.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:t(te.start),end:void 0}})}function g(te){let G=this.data.mdxJsxTag;a.call(this,te),G.attributes.push({type:"mdxJsxExpressionAttribute",value:""}),this.buffer()}function O(te){let G=this.data.mdxJsxTag;let $=G.attributes[G.attributes.length-1];$.type;let ee=te.estree;$.value=this.resume(),ee&&($.data={estree:ee})}function j(te){let G=this.data.mdxJsxTag;let $=G.attributes[G.attributes.length-1];$.type,$.name=this.sliceSerialize(te),$.position,$.position.end=t(te.end)}function S(te){let G=this.data.mdxJsxTag;let $=G.attributes[G.attributes.length-1];$.type,$.name+=":"+this.sliceSerialize(te),$.position,$.position.end=t(te.end)}function x(te){let G=this.data.mdxJsxTag;let $=G.attributes[G.attributes.length-1];$.value=GOu(this.resume(),{nonTerminated:!1}),$.position,$.position.end=t(te.end)}function A(te){let G=this.data.mdxJsxTag;let $=G.attributes[G.attributes.length-1];$.type;let ee={type:"mdxJsxAttributeValueExpression",value:this.resume()},Ve=te.estree;Ve&&(ee.data={estree:Ve}),$.value=ee,$.position,$.position.end=t(te.end)}function z(){let te=this.data.mdxJsxTag;te.selfClosing=!0}function N(te){let G=this.data.mdxJsxTag;let $=this.data.mdxJsxTagStack;let ee=$[$.length-1];if(G.close&&ee.name!==G.name)throw new rw("Unexpected closing tag `"+Y(G)+"`, expected corresponding closing tag for `"+Y(ee)+"` ("+J9(ee)+")",{start:te.start,end:te.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),G.close?$.pop():this.enter({type:te.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:G.name||null,attributes:G.attributes,children:[]},te,C),G.selfClosing||G.close?this.exit(te,U):$.push(G)}function C(te,G){let $=this.data.mdxJsxTagStack;let ee=$[$.length-1];let Ve=te?" before the end of `"+te.type+"`":"",$e=te?{start:te.start,end:te.end}:void 0;throw new rw("Expected a closing tag for `"+Y(ee)+"` ("+J9({start:G.start,end:G.end})+")"+Ve,$e,"mdast-util-mdx-jsx:end-tag-mismatch")}function U(te,G){let $=this.data.mdxJsxTag;throw new rw("Expected the closing tag `"+Y($)+"` either after the end of `"+G.type+"` ("+J9(G.end)+") or another opening tag after the start of `"+G.type+"` ("+J9(G.start)+")",{start:te.start,end:te.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function Y(te){return"<"+(te.close?"/":"")+(te.name||"")+">"}}function YOu(e){let t=e||{},r=t.quote||'"',n=t.quoteSmart||!1,i=t.tightSelfClosing||!1,a=t.printWidth||Number.POSITIVE_INFINITY,u=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize attribute values with `"+r+"` for `options.quote`, expected `\"`, or `'`");return f.peek=arj,{handlers:{mdxJsxFlowElement:f,mdxJsxTextElement:f},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function f(d,c,o,l){let g=d.type==="mdxJsxFlowElement",O=d.name?!d.children||d.children.length===0:!1,j=s7f(o),S=c7f(j),x=o.createTracker(l),A=o.createTracker(l),z=[],N=(g?S:"")+"<"+(d.name||""),C=o.enter(d.type);if(x.move(N),A.move(N),d.attributes&&d.attributes.length>0){if(!d.name)throw new Error("Cannot serialize fragment w/ attributes");let $=-1;for(;++$<d.attributes.length;){let ee=d.attributes[$],Ve;if(ee.type==="mdxJsxExpressionAttribute")Ve="{"+(ee.value||"")+"}";else{if(!ee.name)throw new Error("Cannot serialize attribute w/o name");let $e=ee.value,Dt=ee.name,Tt="";if($e!=null)if(typeof $e=="object")Tt="{"+($e.value||"")+"}";else{let Wt=n&&aNn($e,r)>aNn($e,u)?u:r;Tt=Wt+o7f($e,{subset:[Wt]})+Wt}Ve=Dt+(Tt?"=":"")+Tt}z.push(Ve)}}let U=!1,Y=z.join(" ");g&&(/\r?\n|\r/.test(Y)||x.current().now.column+Y.length+(O?i?2:3:1)>a)&&(U=!0);let te=x,G=N;if(U){te=A;let $=-1;for(;++$<z.length;)z[$]=S+u7f+z[$];G+=te.move(`
|