fern-api 0.65.2 → 0.65.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +5 -5
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1672,7 +1672,7 @@ ${c.indent}`:""}${AOd(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
1672
1672
  `+e.slice(n,a),n=a+1),u=l;return d+=`
1673
1673
  `,e.length-n>t&&u>n?d+=e.slice(n,u)+`
1674
1674
  `+e.slice(u+1):d+=e.slice(n),d.slice(1)}function zQ1(e){for(var t="",r=0,i,n=0;n<e.length;r>=65536?n+=2:n++)r=qja(e,n),i=tQ[r],!i&&Ija(r)?(t+=e[n],r>=65536&&(t+=e[n+1])):t+=i||DQ1(r);return t}function xQ1(e,t,r){var i="",n=e.tag,a,u,l;for(a=0,u=r.length;a<u;a+=1)l=r[a],e.replacer&&(l=e.replacer.call(r,String(a),l)),(Hci(e,t,l,!1,!1)||typeof l>"u"&&Hci(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=n,e.dump="["+i+"]"}function pmd(e,t,r,i){var n="",a=e.tag,u,l,d;for(u=0,l=r.length;u<l;u+=1)d=r[u],e.replacer&&(d=e.replacer.call(r,String(u),d)),(Hci(e,t+1,d,!0,!0,!1,!0)||typeof d>"u"&&Hci(e,t+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=xRs(e,t)),e.dump&&Cja===e.dump.charCodeAt(0)?n+="-":n+="- ",n+=e.dump);e.tag=a,e.dump=n||"[]"}function RQ1(e,t,r){var i="",n=e.tag,a=Object.keys(r),u,l,d,s,o;for(u=0,l=a.length;u<l;u+=1)o="",i!==""&&(o+=", "),e.condenseFlow&&(o+='"'),d=a[u],s=r[d],e.replacer&&(s=e.replacer.call(r,d,s)),Hci(e,t,d,!1,!1)&&(e.dump.length>1024&&(o+="? "),o+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Hci(e,t,s,!1,!1)&&(o+=e.dump,i+=o));e.tag=n,e.dump="{"+i+"}"}function NQ1(e,t,r,i){var n="",a=e.tag,u=Object.keys(r),l,d,s,o,c,b;if(e.sortKeys===!0)u.sort();else if(typeof e.sortKeys=="function")u.sort(e.sortKeys);else if(e.sortKeys)throw new JX("sortKeys must be a boolean or a function");for(l=0,d=u.length;l<d;l+=1)b="",(!i||n!=="")&&(b+=xRs(e,t)),s=u[l],o=r[s],e.replacer&&(o=e.replacer.call(r,s,o)),Hci(e,t+1,s,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&Cja===e.dump.charCodeAt(0)?b+="?":b+="? "),b+=e.dump,c&&(b+=xRs(e,t)),Hci(e,t+1,o,!0,c)&&(e.dump&&Cja===e.dump.charCodeAt(0)?b+=":":b+=": ",b+=e.dump,n+=b));e.tag=a,e.dump=n||"{}"}function _md(e,t,r){var i,n,a,u,l,d;for(n=r?e.explicitTypes:e.implicitTypes,a=0,u=n.length;a<u;a+=1)if(l=n[a],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(r?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(d=e.styleMap[l.tag]||l.defaultStyle,$md.call(l.represent)==="[object Function]")i=l.represent(t,d);else if(Gmd.call(l.represent,d))i=l.represent[d](t,d);else throw new JX("!<"+l.tag+'> tag resolver accepts not "'+d+'" style');e.dump=i}return!0}return!1}function Hci(e,t,r,i,n,a,u){e.tag=null,e.dump=r,_md(e,r,!1)||_md(e,r,!0);var l=$md.call(e.dump),d=i,s;i&&(i=e.flowLevel<0||e.flowLevel>t);var o=l==="[object Object]"||l==="[object Array]",c,b;if(o&&(c=e.duplicates.indexOf(r),b=c!==-1),(e.tag!==null&&e.tag!=="?"||b||e.indent!==2&&t>0)&&(n=!1),b&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(o&&b&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(NQ1(e,t,e.dump,n),b&&(e.dump="&ref_"+c+e.dump)):(RQ1(e,t,e.dump),b&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!u&&t>0?pmd(e,t-1,e.dump,n):pmd(e,t,e.dump,n),b&&(e.dump="&ref_"+c+e.dump)):(xQ1(e,t,e.dump),b&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&BQ1(e,e.dump,t,a,d);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new JX("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(s=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?s="!"+s:s.slice(0,18)==="tag:yaml.org,2002:"?s="!!"+s.slice(18):s="!<"+s+">",e.dump=s+" "+e.dump)}return!0}function FQ1(e,t){var r=[],i=[],n,a;for(NRs(e,r,i),n=0,a=i.length;n<a;n+=1)t.duplicates.push(r[i[n]]);t.usedDuplicates=new Array(a)}function NRs(e,t,r){var i,n,a;if(e!==null&&typeof e=="object")if(n=t.indexOf(e),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(t.push(e),Array.isArray(e))for(n=0,a=e.length;n<a;n+=1)NRs(e[n],t,r);else for(i=Object.keys(e),n=0,a=i.length;n<a;n+=1)NRs(e[i[n]],t,r)}function LQ1(e,t){t=t||{};var r=new MQ1(t);r.noRefs||FQ1(e,r);var i=e;return r.replacer&&(i=r.replacer.call({"":i},"",i)),Hci(r,0,i,!0,!0)?r.dump+`
1675
- `:""}var UQ1=LQ1,VQ1={dump:UQ1};function HRs(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var WQ1=KV,HQ1=vmd,$Q1=mmd,GQ1=Dmd,QQ1=Emd,JQ1=LRs,KQ1=Hmd.load,YQ1=Hmd.loadAll,Ygo=VQ1.dump,zja=JX,XQ1={binary:Cmd,float:Smd,map:Omd,null:Pmd,pairs:Imd,set:zmd,timestamp:qmd,bool:jmd,int:wmd,merge:Tmd,omap:Bmd,seq:gmd,str:bmd},ZQ1=HRs("safeLoad","load"),kQ1=HRs("safeLoadAll","loadAll"),eJ1=HRs("safeDump","dump"),tJ1={Type:WQ1,Schema:HQ1,FAILSAFE_SCHEMA:$Q1,JSON_SCHEMA:GQ1,CORE_SCHEMA:QQ1,DEFAULT_SCHEMA:JQ1,load:KQ1,loadAll:YQ1,dump:Ygo,YAMLException:zja,types:XQ1,safeLoad:ZQ1,safeLoadAll:kQ1,safeDump:eJ1},md=tJ1;var rPd=du.object({dependencies:du.record(du.string(),du.string())});async function nPd({absolutePathToWorkspace:e,context:t}){let r=Ru(e,Na.of(zbd));if(!await mf(r))return;let i=await(0,iPd.readFile)(r),n=md.load(i.toString());return await Pvo({schema:rPd,value:n,context:t,filepathBeingParsed:r})}async function $Rs({absolutePathToWorkspace:e,context:t}){let r=await nPd({absolutePathToWorkspace:e,context:t});return kOd({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}function Xgo(e){"@babel/helpers - typeof";return Xgo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xgo(e)}var rJ1=/^\s+/,iJ1=/\s+$/;function E_(e,t){if(e=e||"",t=t||{},e instanceof E_)return e;if(!(this instanceof E_))return new E_(e,t);var r=nJ1(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}E_.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),r,i,n,a,u,l;return r=t.r/255,i=t.g/255,n=t.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?u=i/12.92:u=Math.pow((i+.055)/1.055,2.4),n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*a+.7152*u+.0722*l},setAlpha:function(t){return this._a=fPd(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=oPd(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=oPd(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+n+"%)":"hsva("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=aPd(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=aPd(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+n+"%)":"hsla("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return uPd(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return sJ1(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Zz(this._r,255)*100)+"%",g:Math.round(Zz(this._g,255)*100)+"%",b:Math.round(Zz(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Zz(this._r,255)*100)+"%, "+Math.round(Zz(this._g,255)*100)+"%, "+Math.round(Zz(this._b,255)*100)+"%)":"rgba("+Math.round(Zz(this._r,255)*100)+"%, "+Math.round(Zz(this._g,255)*100)+"%, "+Math.round(Zz(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:OJ1[uPd(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+sPd(this._r,this._g,this._b,this._a),i=r,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=E_(t);i="#"+sPd(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+i+")"},toString:function(t){var r=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,a=!r&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return E_(this.toString())},_applyModification:function(t,r){var i=t.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(dJ1,arguments)},brighten:function(){return this._applyModification(pJ1,arguments)},darken:function(){return this._applyModification(_J1,arguments)},desaturate:function(){return this._applyModification(cJ1,arguments)},saturate:function(){return this._applyModification(lJ1,arguments)},greyscale:function(){return this._applyModification(fJ1,arguments)},spin:function(){return this._applyModification(hJ1,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(bJ1,arguments)},complement:function(){return this._applyCombination(yJ1,arguments)},monochromatic:function(){return this._applyCombination(gJ1,arguments)},splitcomplement:function(){return this._applyCombination(vJ1,arguments)},triad:function(){return this._applyCombination(cPd,[3])},tetrad:function(){return this._applyCombination(cPd,[4])}};E_.fromRatio=function(e,t){if(Xgo(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=xja(e[i]));e=r}return E_(e,t)};function nJ1(e){var t={r:0,g:0,b:0},r=1,i=null,n=null,a=null,u=!1,l=!1;return typeof e=="string"&&(e=wJ1(e)),Xgo(e)=="object"&&($ci(e.r)&&$ci(e.g)&&$ci(e.b)?(t=aJ1(e.r,e.g,e.b),u=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):$ci(e.h)&&$ci(e.s)&&$ci(e.v)?(i=xja(e.s),n=xja(e.v),t=uJ1(e.h,i,n),u=!0,l="hsv"):$ci(e.h)&&$ci(e.s)&&$ci(e.l)&&(i=xja(e.s),a=xja(e.l),t=oJ1(e.h,i,a),u=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=fPd(r),{ok:u,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function aJ1(e,t,r){return{r:Zz(e,255)*255,g:Zz(t,255)*255,b:Zz(r,255)*255}}function aPd(e,t,r){e=Zz(e,255),t=Zz(t,255),r=Zz(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,u,l=(i+n)/2;if(i==n)a=u=0;else{var d=i-n;switch(u=l>.5?d/(2-i-n):d/(i+n),i){case e:a=(t-r)/d+(t<r?6:0);break;case t:a=(r-e)/d+2;break;case r:a=(e-t)/d+4;break}a/=6}return{h:a,s:u,l}}function oJ1(e,t,r){var i,n,a;e=Zz(e,360),t=Zz(t,100),r=Zz(r,100);function u(s,o,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?s+(o-s)*6*c:c<1/2?o:c<2/3?s+(o-s)*(2/3-c)*6:s}if(t===0)i=n=a=r;else{var l=r<.5?r*(1+t):r+t-r*t,d=2*r-l;i=u(d,l,e+1/3),n=u(d,l,e),a=u(d,l,e-1/3)}return{r:i*255,g:n*255,b:a*255}}function oPd(e,t,r){e=Zz(e,255),t=Zz(t,255),r=Zz(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,u,l=i,d=i-n;if(u=i===0?0:d/i,i==n)a=0;else{switch(i){case e:a=(t-r)/d+(t<r?6:0);break;case t:a=(r-e)/d+2;break;case r:a=(e-t)/d+4;break}a/=6}return{h:a,s:u,v:l}}function uJ1(e,t,r){e=Zz(e,360)*6,t=Zz(t,100),r=Zz(r,100);var i=Math.floor(e),n=e-i,a=r*(1-t),u=r*(1-n*t),l=r*(1-(1-n)*t),d=i%6,s=[r,u,a,a,l,r][d],o=[l,r,r,u,a,a][d],c=[a,a,l,r,r,u][d];return{r:s*255,g:o*255,b:c*255}}function uPd(e,t,r,i){var n=[tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function sJ1(e,t,r,i,n){var a=[tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16)),tVt(dPd(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function sPd(e,t,r,i){var n=[tVt(dPd(i)),tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16))];return n.join("")}E_.equals=function(e,t){return!e||!t?!1:E_(e).toRgbString()==E_(t).toRgbString()};E_.random=function(){return E_.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function cJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.s-=t/100,r.s=Zgo(r.s),E_(r)}function lJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.s+=t/100,r.s=Zgo(r.s),E_(r)}function fJ1(e){return E_(e).desaturate(100)}function dJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.l+=t/100,r.l=Zgo(r.l),E_(r)}function pJ1(e,t){t=t===0?0:t||10;var r=E_(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),E_(r)}function _J1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.l-=t/100,r.l=Zgo(r.l),E_(r)}function hJ1(e,t){var r=E_(e).toHsl(),i=(r.h+t)%360;return r.h=i<0?360+i:i,E_(r)}function yJ1(e){var t=E_(e).toHsl();return t.h=(t.h+180)%360,E_(t)}function cPd(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=E_(e).toHsl(),i=[E_(e)],n=360/t,a=1;a<t;a++)i.push(E_({h:(r.h+a*n)%360,s:r.s,l:r.l}));return i}function vJ1(e){var t=E_(e).toHsl(),r=t.h;return[E_(e),E_({h:(r+72)%360,s:t.s,l:t.l}),E_({h:(r+216)%360,s:t.s,l:t.l})]}function bJ1(e,t,r){t=t||6,r=r||30;var i=E_(e).toHsl(),n=360/r,a=[E_(e)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,a.push(E_(i));return a}function gJ1(e,t){t=t||6;for(var r=E_(e).toHsv(),i=r.h,n=r.s,a=r.v,u=[],l=1/t;t--;)u.push(E_({h:i,s:n,v:a})),a=(a+l)%1;return u}E_.mix=function(e,t,r){r=r===0?0:r||50;var i=E_(e).toRgb(),n=E_(t).toRgb(),a=r/100,u={r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a};return E_(u)};E_.readability=function(e,t){var r=E_(e),i=E_(t);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};E_.isReadable=function(e,t,r){var i=E_.readability(e,t),n,a;switch(a=!1,n=SJ1(r),n.level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};E_.mostReadable=function(e,t,r){var i=null,n=0,a,u,l,d;r=r||{},u=r.includeFallbackColors,l=r.level,d=r.size;for(var s=0;s<t.length;s++)a=E_.readability(e,t[s]),a>n&&(n=a,i=E_(t[s]));return E_.isReadable(e,i,{level:l,size:d})||!u?i:(r.includeFallbackColors=!1,E_.mostReadable(e,["#fff","#000"],r))};var GRs=E_.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},OJ1=E_.hexNames=mJ1(GRs);function mJ1(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function fPd(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Zz(e,t){PJ1(e)&&(e="100%");var r=jJ1(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Zgo(e){return Math.min(1,Math.max(0,e))}function aEe(e){return parseInt(e,16)}function PJ1(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function jJ1(e){return typeof e=="string"&&e.indexOf("%")!=-1}function tVt(e){return e.length==1?"0"+e:""+e}function xja(e){return e<=1&&(e=e*100+"%"),e}function dPd(e){return Math.round(parseFloat(e)*255).toString(16)}function lPd(e){return aEe(e)/255}var eVt=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function $ci(e){return!!eVt.CSS_UNIT.exec(e)}function wJ1(e){e=e.replace(rJ1,"").replace(iJ1,"").toLowerCase();var t=!1;if(GRs[e])e=GRs[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=eVt.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=eVt.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=eVt.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=eVt.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=eVt.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=eVt.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=eVt.hex8.exec(e))?{r:aEe(r[1]),g:aEe(r[2]),b:aEe(r[3]),a:lPd(r[4]),format:t?"name":"hex8"}:(r=eVt.hex6.exec(e))?{r:aEe(r[1]),g:aEe(r[2]),b:aEe(r[3]),format:t?"name":"hex"}:(r=eVt.hex4.exec(e))?{r:aEe(r[1]+""+r[1]),g:aEe(r[2]+""+r[2]),b:aEe(r[3]+""+r[3]),a:lPd(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=eVt.hex3.exec(e))?{r:aEe(r[1]+""+r[1]),g:aEe(r[2]+""+r[2]),b:aEe(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function SJ1(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}function pPd(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=eOo(e);switch(r){case"dark":return{type:"dark",...kgo(e,t,"dark")};case"light":return{type:"light",...kgo(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:kgo(e,t,"dark"),light:kgo(e,t,"light")};default:jo(r)}}function eOo({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return E_(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return E_(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return E_(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function kgo(e,t,r){let i=FBn(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??E_.random(),n=FBn(e.background,t,"background",r);return{accentPrimary:i.toRgb(),background:n?.toRgb(),border:FBn(e.border,t,"border",r)?.toRgb(),sidebarBackground:FBn(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:FBn(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:FBn(e.cardBackground,t,"card-background",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function Rja(e,t,r){if(e==null)return;let i=typeof e=="string"?e:e[r];if(i==null&&t==="accent-primary"&&typeof e!="string"&&(i=e[r==="dark"?"light":"dark"]),i!=null)return i}function FBn(e,t,r,i){let n=Rja(e,r,i);if(n==null)return;let a=E_(n);return a.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${i}`}' should be a hex color of the format #FFFFFF`),a}var HPo=require("fs/promises");var tW=ui(PEe(),1);var OJd=require("fs/promises");var gJd=100;async function KoS({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async i=>{let n=await(0,OJd.readFile)(i,"utf-8");return[Cie(t,i),n]}));return Object.fromEntries(r)}async function mJd({files:e,absolutePathToFernFolder:t}){let r={};for(let i=0;i<e.length;i+=gJd){let n=e.slice(i,i+gJd),a=await KoS({files:n,absolutePathToFernFolder:t});Object.assign(r,a)}return r}function UPo({landingPage:e,navigation:t}){return Jze([e?.absolutePath,...YoS(t)])}function YoS(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>Y7s({item:r})):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>Y7s({item:t}));case"versioned":return e.versions.flatMap(t=>UPo({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>UPo({landingPage:t.landingPage,navigation:t.navigation}));default:jo(e)}}function Y7s({item:e}){switch(e.type){case"apiSection":return Jze([e.overviewAbsolutePath,...e.navigation.flatMap(t=>PJd({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return Jze([e.overviewAbsolutePath,...e.contents.flatMap(t=>Y7s({item:t}))]);case"changelog":return e.changelog;default:jo(e)}}function PJd({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?Jze([e.overviewAbsolutePath,...e.contents.flatMap(t=>PJd({item:t}))]):[]}async function e6s({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:i}){let{instances:n,title:a,tabs:u,products:l,versions:d,navigation:s,navbarLinks:o,footerLinks:c,defaultLanguage:b,metadata:g,redirects:O,logo:m,favicon:w,backgroundImage:E,colors:q,typography:A,layout:D,analytics:C,integrations:x,css:$,js:I,aiChat:F,aiSearch:V,experimental:K}=e,Y=ywa(e.landingPage,r),Z=nuS({tabs:u,products:l,versions:d,navigation:s,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}),oe=Z.then(jt=>mJd({files:UPo({navigation:jt,landingPage:Y}),absolutePathToFernFolder:t})),pe=XoS(m,r),de=S2(w,r),Oe=ZoS(E,r),Ue=A!=null?auS({rawTypography:A,absoluteFilepathToDocsConfig:r}):void 0,wt=koS($,r),De=ruS(I,r),Te=OuS(g,r),[xt,Pe,ot,at,me,we]=await Promise.all([Z,oe,Ue,wt,De,Te]);return{title:a,instances:n,roles:e.roles,pages:Pe,landingPage:Y,navigation:xt,navbarLinks:buS(o),footerLinks:guS(c),defaultLanguage:b,announcement:e.announcement,metadata:we,redirects:O?.map(jt=>({...jt,permanent:jt?.permanent})),logo:pe,favicon:de,backgroundImage:Oe,colors:pPd(q,i),typography:ot,layout:iuS(D),analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},integrations:{...x,intercom:x?.intercom?x.intercom:void 0},css:at,js:me,aiChatConfig:V??F,experimental:K}}function XoS(e,t){return e!=null?{dark:S2(e.dark,t),light:S2(e.light,t),height:e.height,href:e.href!=null?tW.FernRegistry.Url(e.href):void 0}:void 0}function ZoS(e,t){if(e!=null)if(typeof e=="string"){let r=S2(e,t);return{dark:r,light:r}}else{let r=S2(e.dark,t),i=S2(e.light,t);return{dark:r,light:i}}}async function koS(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async i=>(await(0,HPo.readFile)(S2(i,t))).toString()))}}function euS(e){return Object.hasOwn(e,"url")}function tuS(e){return Object.hasOwn(e,"path")}async function ruS(e,t){let r=[],i=[];if(e==null)return{files:[]};let n=Array.isArray(e)?e:[e];for(let a of n)typeof a=="string"?i.push({absolutePath:S2(a,t)}):euS(a)?r.push({strategy:a.strategy,url:tW.FernRegistry.Url(a.url)}):tuS(a)&&i.push({absolutePath:S2(a.path,t),strategy:a.strategy});return{remote:r,files:i}}function iuS(e){if(e!=null)return{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:VPo(e.pageWidth),contentWidth:VPo(e.contentWidth),sidebarWidth:VPo(e.sidebarWidth),headerHeight:VPo(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?tW.FernRegistry.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?tW.FernRegistry.docs.v1.commons.SearchbarPlacement.HeaderTabs:tW.FernRegistry.docs.v1.commons.SearchbarPlacement.Sidebar,tabsPlacement:e.tabsPlacement==="header"?tW.FernRegistry.docs.v1.commons.TabsPlacement.Header:tW.FernRegistry.docs.v1.commons.TabsPlacement.Sidebar,contentAlignment:e.contentAlignment==="left"?tW.FernRegistry.docs.v1.commons.ContentAlignment.Left:tW.FernRegistry.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?tW.FernRegistry.docs.v1.commons.HeaderPosition.Absolute:tW.FernRegistry.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1}}function VPo(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let i=t.match(/^(\d+)rem$/);if(i!=null&&i[1]!=null)return{type:"rem",value:parseFloat(i[1])}}async function jJd({versions:e,absolutePathToFernFolder:t,context:r}){let i=[];for(let n of e){let a=Gv(t,n.path),u=md.load((await(0,HPo.readFile)(a)).toString()),l=Tie.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(u),d=await k7s({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:a,context:r});i.push({landingPage:ywa(l.landingPage,a),version:n.displayName,navigation:d,availability:n.availability,slug:n.slug,viewers:dVt(n.viewers),orphaned:n.orphaned,featureFlags:fVt(n.featureFlag)})}return{type:"versioned",versions:i}}async function nuS({tabs:e,products:t,versions:r,navigation:i,absolutePathToFernFolder:n,absolutePathToConfig:a,context:u}){if(i!=null)return await k7s({tabs:e,rawNavigationConfig:i,absolutePathToFernFolder:n,absolutePathToConfig:a,context:u});if(t!=null){let l=[];for(let d of t){let s=Gv(n,d.path),o=d.image!=null?Gv(n,d.image):void 0,c=md.load((await(0,HPo.readFile)(s)).toString()),b=Tie.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(c),g;d.versions!=null&&d.versions.length>0?g=await jJd({versions:d.versions,absolutePathToFernFolder:n,context:u}):g=await k7s({tabs:b.tabs,rawNavigationConfig:b.navigation,absolutePathToFernFolder:n,absolutePathToConfig:s,context:u}),l.push({landingPage:ywa(b.landingPage,s),product:d.displayName,navigation:g,slug:d.slug,subtitle:d.subtitle,icon:d.icon||"fa-solid fa-code",image:o})}return{type:"productgroup",products:l}}else if(r!=null)return await jJd({versions:r,absolutePathToFernFolder:n,context:u});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function fVt(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function auS({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await X7s({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await X7s({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await X7s({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function X7s({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await ouS(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function ouS(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(i=>{typeof i=="string"?r.push({path:i,weight:e.weight,style:e.style}):r.push({path:i.path,weight:i.weight??e.weight,style:i.style??e.style})}),Promise.all(r.map(async i=>({absolutePath:S2(i.path,t),weight:uuS(i.weight),style:i.style})))}function uuS(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function suS({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n}){let a=e[t.tab];if(a==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(t.layout!=null){let u=await Promise.all(t.layout.map(l=>t6s({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})));return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"layout",layout:u},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)}}if(a.href!=null)return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"link",href:a.href},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)};if(a.changelog!=null)return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"changelog",changelog:await cxe(S2(a.changelog,i),"{md,mdx}")},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)};jo(a)}async function k7s({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n}){return vuS(t)?{type:"tabbed",items:await Promise.all(t.map(u=>suS({tabs:e,item:u,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})))}:{type:"untabbed",items:await Promise.all(t.map(a=>t6s({rawConfig:a,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})))}}var cuS="Changelog";async function t6s({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}){if(wJd(e))return ywa(e,r);if(fuS(e))return{type:"section",title:e.section,icon:e.icon,contents:await Promise.all(e.contents.map(n=>t6s({rawConfig:n,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:S2(e.path,r),viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};if(duS(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:e.icon,apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:e.audiences}:{type:"all"},showErrors:e.displayErrors??!0,snippetsConfiguration:e.snippets!=null?luS({rawConfig:e.snippets}):void 0,navigation:e.layout?.flatMap(n=>WPo(n,r))??[],overviewAbsolutePath:S2(e.summary,r),hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};if(SJd(e))return{type:"link",text:e.link,url:e.href,icon:e.icon};if(puS(e))return{type:"changelog",changelog:await cxe(S2(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:e.icon,title:e.title??cuS,slug:e.slug,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};jo(e)}function ywa(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:S2(e.path,t),slug:e.slug,icon:e.icon,hidden:e.hidden,noindex:e.noindex,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}}function WPo(e,t){return typeof e=="string"?[{type:"item",value:e}]:wJd(e)?[ywa(e,t)]:SJd(e)?[{type:"link",text:e.link,url:e.href,icon:e.icon}]:_uS(e)?[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:S2(e.summary,t),contents:e.contents?.flatMap(r=>WPo(r,t))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,icon:e.icon,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}]:huS(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:e.icon,slug:e.slug,hidden:e.hidden,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}]:Object.entries(e).map(([r,i])=>yuS(i)?{type:"package",title:i.title,package:r,overviewAbsolutePath:S2(i.summary,t),contents:i.contents?.flatMap(n=>WPo(n,t))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:i.icon,playground:i.playground,viewers:dVt(i.viewers),orphaned:i.orphaned,featureFlags:fVt(i.featureFlag)}:{type:"package",title:void 0,package:r,overviewAbsolutePath:void 0,contents:i.flatMap(n=>WPo(n,t)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function luS({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp}}function wJd(e){return Gj(e)&&typeof e.page=="string"&&typeof e.path=="string"}function fuS(e){return e.section!=null}function duS(e){return e.api!=null}function SJd(e){return Tie.RawSchemas,Gj(e)&&typeof e.link=="string"&&typeof e.href=="string"}function puS(e){return Gj(e)&&typeof e.changelog=="string"}function _uS(e){return Gj(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function huS(e){return Gj(e)&&typeof e.endpoint=="string"}function yuS(e){return!Array.isArray(e)}function S2(e,t){if(e!=null)return Gv(Cd(t),e)}function vuS(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function buS(e){return e?.map(t=>t.type==="github"?{type:"github",url:tW.FernRegistry.Url(t.value)}:{type:t.type,text:t.text,url:tW.FernRegistry.Url(t.href??t.url??"/"),icon:t.icon,rightIcon:t.rightIcon,rounded:t.rounded})}function guS(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let i=e[r];i!=null&&t.push({type:r,value:tW.FernRegistry.Url(i)})}),t.length!==0)return t}async function OuS(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await Z7s(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await Z7s(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await Z7s(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,nofollow:void 0,noindex:void 0}}async function Z7s(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=S2(e,t);return await mf(r)?{type:"filepath",value:r}:{type:"url",value:e}}function dVt(e){if(e!=null){if(typeof e=="string")return[tW.FernRegistry.RoleId(e)];if(e.length!==0)return e.map(tW.FernRegistry.RoleId)}}var EJd=require("fs/promises");var DJd=du.strictObject({organization:du.string(),version:du.string()});async function uli({directory:e,context:t}){let r=Ru(e,Na.of(Mie)),i=await(0,EJd.readFile)(r),n=JSON.parse(i.toString()),a=await Pvo({schema:DJd,value:n,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:a,organization:a.organization,version:a.version}}var vwa={[Q.JAVA]:{version:"2.38.1"},[Q.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[Q.JAVA_MODEL]:{version:"1.0.0"},[Q.JAVA_SDK]:{version:"2.38.1"},[Q.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"},config:{"package-prefix":"com.fern"}},[Q.TYPESCRIPT]:{version:"0.0.247"},[Q.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.PYTHON_PYDANTIC]:{version:"1.4.7"},[Q.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[Q.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[Q.GO_FIBER]:{version:"0.23.5"},[Q.GO_MODEL]:{version:"0.23.5"},[Q.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{importPath:"go-mod-path/generated/go"}},[Q.RUBY_MODEL]:{version:"0.0.8"},[Q.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[Q.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[Q.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[Q.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[Q.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[Q.CSHARP_MODEL]:{version:"0.0.1"},[Q.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[Q.SWIFT_MODEL]:{version:"0.0.0"},[Q.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[Q.PHP_MODEL]:{version:"0.0.0"},[Q.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}}};function Ewi(e,t){let r=muS(e);return r??t.failAndThrow("Unrecognized generator: "+e)}function muS(e){if(e.startsWith("fernapi/")||(e=`fernapi/${e}`),PuS(e))return e}function PuS(e){return Object.values(Q).includes(e)}var trp=ui(Mwi(),1),Cwo=ui(Ywa(),1);async function XZt({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:i,includeMajor:n,context:a}){let u=trp.default.parse(i),l=new Cwo.FernRegistryClient({environment:"https://registry.buildwithfern.com"});a?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${n}, prior version: ${u}`);let d={generator:YOS(e,a),releaseTypes:[r??Cwo.FernRegistry.generators.ReleaseType.Ga],cliVersion:t==="0.0.0"?void 0:t};!n&&u!=null&&(d.generatorMajorVersion=u.major);let s=await l.generators.versions.getLatestGeneratorRelease(d);if(s.ok)return s.body.version}function YOS(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-go-fiber":return"go-fiber";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-ruby-model":return"ruby-model";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function rrp({generatorsConfiguration:e,groupName:t=e[gy.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:i}){if(t==null)return r.failAndThrow("No group specified.");let n=e.groups??={},a=n[t];if(a==null){let u=n[t]??={generators:[]};await i(u,t)}else await i(a,t);return e}async function c2s({generatorName:e,generatorsConfiguration:t,groupName:r=t[Avo],context:i,cliVersion:n}){let a=Ewi(e,i),u=vwa[a];return await rrp({generatorsConfiguration:t,groupName:r,context:i,update:async l=>{l.generators.some(d=>d.name===a)&&i.failAndThrow(`${e} is already installed in group ${r}.`),l.generators.push({name:a,...u,version:await XZt({cliVersion:n,generatorName:a,context:i,channel:void 0})??u.version})}})}var Adp=require("fs/promises");var qdp=ui(require("path"),1);var mdp=require("fs/promises"),Pdp=ui(require("path"),1);var ZZt="$";var BN={};mo(BN,{AvailabilityStatusSchema:()=>nrp,FernDefinitionError:()=>e1a,FernDefinitionTimeoutError:()=>t1a,FormDataBodyEncodingStyle:()=>_rp,HttpMethodSchema:()=>prp,ObjectPropertyAccess:()=>vrp,StreamFormat:()=>hrp,SupportedSdkLanguageSchema:()=>crp,WebSocketOrigin:()=>Prp,WebhookMethodSchema:()=>mrp,auth:()=>irp,availability:()=>l2s,commons:()=>arp,encoding:()=>orp,environments:()=>urp,errors:()=>srp,examples:()=>f2s,file:()=>lrp,pagination:()=>frp,products:()=>drp,serialization:()=>N2s,service:()=>d2s,source:()=>yrp,types:()=>p2s,validation:()=>brp,variables:()=>grp,versioning:()=>Orp,webhooks:()=>_2s,websocket:()=>h2s});var irp={};var l2s={};mo(l2s,{AvailabilityStatusSchema:()=>nrp});var nrp={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var arp={};var orp={};var urp={};var srp={};var f2s={};mo(f2s,{SupportedSdkLanguageSchema:()=>crp});var crp={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",Csharp2:"c#"};var lrp={};var frp={};var drp={};var d2s={};mo(d2s,{FormDataBodyEncodingStyle:()=>_rp,HttpMethodSchema:()=>prp,StreamFormat:()=>hrp});var prp={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var _rp={Json:"json",Exploded:"exploded",Form:"form"};var hrp={Sse:"sse",Json:"json"};var yrp={};var p2s={};mo(p2s,{ObjectPropertyAccess:()=>vrp});var vrp={ReadOnly:"read-only",WriteOnly:"write-only"};var brp={};var grp={};var Orp={};var _2s={};mo(_2s,{WebhookMethodSchema:()=>mrp});var mrp={Post:"POST",Get:"GET"};var h2s={};mo(h2s,{WebSocketOrigin:()=>Prp});var Prp={Client:"client",Server:"server"};var N2s={};mo(N2s,{AliasSchema:()=>W1o,AnyAuthItem:()=>Rwo,AnyAuthSchemesSchema:()=>Nwo,ApiAuthSchema:()=>Fwo,AuthSchemeDeclarationSchema:()=>Ywo,AuthSchemeReferenceSchema:()=>izn,AuthVariable:()=>iWi,AvailabilitySchema:()=>Zwo,AvailabilityStatusSchema:()=>azn,AvailabilityUnionSchema:()=>kwo,BaseTypeDeclarationSchema:()=>Uxe,BaseTypeReferenceSchema:()=>czn,BasicAuthSchemeSchema:()=>Jwo,BearerAuthSchemeSchema:()=>Kwo,CasingOverridesSchema:()=>M1o,CursorPaginationSchema:()=>pSo,CustomPaginationSchema:()=>hSo,DeclarationSchema:()=>kZt,DeclarationWithNameSchema:()=>Yrp,DeclarationWithoutDocsSchema:()=>i1o,DefinitionFileSchema:()=>qSo,DiscriminatedUnionSchema:()=>F1o,EncodingSchema:()=>ozn,EnumSchema:()=>T1o,EnumValue:()=>q1o,EnumValueSchema:()=>A1o,EnvironmentSchema:()=>u1o,ErrorDeclarationSchema:()=>l1o,ErrorDiscriminationSchema:()=>RSo,ExampleBodyResponseSchema:()=>p1o,ExampleCodeSampleSchema:()=>m1o,ExampleCodeSampleSchemaLanguage:()=>O1o,ExampleCodeSampleSchemaSdk:()=>g1o,ExampleEndpointCallArraySchema:()=>Xrp,ExampleEndpointCallSchema:()=>szn,ExampleResponseSchema:()=>v1o,ExampleSseEventSchema:()=>h1o,ExampleSseResponseSchema:()=>y1o,ExampleStreamResponseSchema:()=>_1o,ExampleTypeReferenceSchema:()=>M2,ExampleTypeSchema:()=>uzn,ExampleTypeValueSchema:()=>c1o,ExampleWebSocketMessage:()=>f1o,ExampleWebSocketSession:()=>d1o,ExampleWebhookCallSchema:()=>P1o,Export:()=>BSo,ExportDetailed:()=>CSo,FormDataBodyEncodingStyle:()=>Z1o,GrpcTransport:()=>$1o,HeaderAuthSchemeSchema:()=>Qwo,HttpEndpointSchema:()=>vSo,HttpHeaderSchema:()=>Vxe,HttpInlineFileRequestBodyPropertySchema:()=>k1o,HttpInlineRequestBodyPropertySchema:()=>eSo,HttpInlineRequestBodySchema:()=>tSo,HttpMethodSchema:()=>G1o,HttpPathParameterSchema:()=>ekt,HttpQueryParameterSchema:()=>fzn,HttpReferencedRequestBodySchema:()=>X1o,HttpRequest:()=>nSo,HttpRequestBodySchema:()=>rSo,HttpRequestSchema:()=>iSo,HttpResponseSchema:()=>oSo,HttpResponseSchemaDetailed:()=>aSo,HttpResponseStreamSchema:()=>cSo,HttpResponseStreamSchemaDetailed:()=>sSo,HttpServiceSchema:()=>bSo,MultipleBaseUrlsEnvironmentSchema:()=>o1o,Navigation:()=>TSo,NumberValidationSchema:()=>t1o,OAuthAccessTokenRequestPropertiesSchema:()=>Lwo,OAuthAccessTokenResponsePropertiesSchema:()=>Uwo,OAuthGetTokenEndpointSchema:()=>Vwo,OAuthRefreshTokenEndpointSchema:()=>$wo,OAuthRefreshTokenRequestPropertiesSchema:()=>Wwo,OAuthRefreshTokenResponsePropertiesSchema:()=>Hwo,OAuthSchemeSchema:()=>Gwo,ObjectExtendsSchema:()=>Fxe,ObjectPropertyAccess:()=>j1o,ObjectPropertySchema:()=>Xwi,ObjectPropertyWithAccessSchema:()=>w1o,ObjectSchema:()=>E1o,OffsetPaginationSchema:()=>_So,OpenApiSourceSchema:()=>S1o,PackageMarkerFileSchema:()=>Zrp,Pagination:()=>ySo,PaginationSchema:()=>dzn,ProductDeclarationHeaderObjectSchema:()=>GSo,ProductDeclarationHeaderSchema:()=>QSo,ProductDeclarationSchema:()=>JSo,ProductValue:()=>$So,ProductValueDetailed:()=>HSo,PropertyBasedErrorDiscrimination:()=>zSo,ProtobufSourceSchema:()=>D1o,ProtobufTypeSchema:()=>n1o,QueryParameterTypeReferenceDetailed:()=>J1o,ResponseError:()=>fSo,ResponseErrorWithDocsSchema:()=>lSo,ResponseErrorsSchema:()=>dSo,RootApiFileSchema:()=>krp,ServiceTransport:()=>lzn,SingleBaseUrlEnvironmentSchema:()=>a1o,SingleUndiscriminatedUnionTypeDetailedSchema:()=>L1o,SingleUndiscriminatedUnionTypeSchema:()=>U1o,SingleUnionTypeDetailedSchema:()=>R1o,SingleUnionTypeKey:()=>x1o,SingleUnionTypeKeySchema:()=>z1o,SingleUnionTypeSchema:()=>N1o,SourceSchema:()=>Zwi,StatusCodeBasedErrorDiscrimination:()=>xSo,StreamFormat:()=>uSo,StringValidationSchema:()=>e1o,SupportedSdkLanguageSchema:()=>b1o,TypeDeclarationSchema:()=>H1o,TypeReferenceDeclarationWithEnvOverride:()=>Y1o,TypeReferenceDeclarationWithEnvOverrideSchema:()=>K1o,TypeReferenceDeclarationWithName:()=>Lxe,TypeReferenceDeclarationWithNameSchema:()=>eip,TypeReferenceDetailedSchema:()=>I1o,TypeReferenceSchema:()=>pli,UndiscriminatedUnionSchema:()=>V1o,UnionDiscriminant:()=>B1o,UnionDiscriminantSchema:()=>C1o,ValidationSchema:()=>Ywi,VariableDeclarationDetailed:()=>NSo,VariableDeclarationSchema:()=>FSo,VariableReferenceSchema:()=>Q1o,VersionDeclarationHeaderObjectSchema:()=>VSo,VersionDeclarationHeaderSchema:()=>WSo,VersionDeclarationSchema:()=>pzn,VersionValue:()=>USo,VersionValueDetailed:()=>LSo,WebSocketChannelInlinedMessageSchema:()=>DSo,WebSocketChannelMessageBodySchema:()=>ESo,WebSocketChannelMessageSchema:()=>MSo,WebSocketChannelReferencedMessageSchema:()=>SSo,WebSocketChannelSchema:()=>ASo,WebSocketOrigin:()=>wSo,WebhookInlinedPayloadSchema:()=>mSo,WebhookMethodSchema:()=>gSo,WebhookPayloadSchema:()=>PSo,WebhookReferencedPayloadSchema:()=>OSo,WebhookSchema:()=>jSo,WithAudiences:()=>O9,WithAuthSchema:()=>Xwo,WithAvailability:()=>pQ,WithDisplayName:()=>g9,WithDocsSchema:()=>p_,WithEnvironmentVariable:()=>nzn,WithEnvironmentsSchema:()=>s1o,WithHeadersSchema:()=>ISo,WithName:()=>F1,WithValidation:()=>r1o,auth:()=>O2s,availability:()=>m2s,commons:()=>P2s,encoding:()=>j2s,environments:()=>w2s,errors:()=>S2s,examples:()=>D2s,file:()=>E2s,pagination:()=>M2s,products:()=>A2s,service:()=>q2s,source:()=>T2s,types:()=>C2s,validation:()=>B2s,variables:()=>I2s,versioning:()=>z2s,webhooks:()=>x2s,websocket:()=>R2s});var O2s={};mo(O2s,{AnyAuthItem:()=>Rwo,AnyAuthSchemesSchema:()=>Nwo,ApiAuthSchema:()=>Fwo,AuthSchemeDeclarationSchema:()=>Ywo,AuthSchemeReferenceSchema:()=>izn,AuthVariable:()=>iWi,BasicAuthSchemeSchema:()=>Jwo,BearerAuthSchemeSchema:()=>Kwo,HeaderAuthSchemeSchema:()=>Qwo,OAuthAccessTokenRequestPropertiesSchema:()=>Lwo,OAuthAccessTokenResponsePropertiesSchema:()=>Uwo,OAuthGetTokenEndpointSchema:()=>Vwo,OAuthRefreshTokenEndpointSchema:()=>$wo,OAuthRefreshTokenRequestPropertiesSchema:()=>Wwo,OAuthRefreshTokenResponsePropertiesSchema:()=>Hwo,OAuthSchemeSchema:()=>Gwo,WithAuthSchema:()=>Xwo,WithEnvironmentVariable:()=>nzn});var Ar={};mo(Ar,{JsonError:()=>ezn,ParseError:()=>tzn,any:()=>Rrp,bigint:()=>wrp,boolean:()=>Nrp,booleanLiteral:()=>xrp,date:()=>Srp,discriminant:()=>Qrp,enum_:()=>Iwo,getObjectLikeUtils:()=>OVt,getObjectUtils:()=>rWi,getSchemaUtils:()=>zq,isProperty:()=>Kwi,lazy:()=>Drp,lazyObject:()=>Brp,list:()=>xwo,number:()=>Frp,object:()=>zwo,objectWithoutOptionalProperties:()=>Crp,optional:()=>y2s,property:()=>Mrp,record:()=>Wrp,set:()=>Hrp,string:()=>Lrp,stringLiteral:()=>zrp,transform:()=>v2s,undiscriminatedUnion:()=>Grp,union:()=>Krp,unknown:()=>Urp,withParsedProperties:()=>g2s});var jj={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function eA(e,t){return`Expected ${t}. Received ${XOS(e)}.`}function XOS(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function b9(e){return{...e,json:jrp(e.json),parse:jrp(e.parse)}}function jrp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1675
+ `:""}var UQ1=LQ1,VQ1={dump:UQ1};function HRs(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var WQ1=KV,HQ1=vmd,$Q1=mmd,GQ1=Dmd,QQ1=Emd,JQ1=LRs,KQ1=Hmd.load,YQ1=Hmd.loadAll,Ygo=VQ1.dump,zja=JX,XQ1={binary:Cmd,float:Smd,map:Omd,null:Pmd,pairs:Imd,set:zmd,timestamp:qmd,bool:jmd,int:wmd,merge:Tmd,omap:Bmd,seq:gmd,str:bmd},ZQ1=HRs("safeLoad","load"),kQ1=HRs("safeLoadAll","loadAll"),eJ1=HRs("safeDump","dump"),tJ1={Type:WQ1,Schema:HQ1,FAILSAFE_SCHEMA:$Q1,JSON_SCHEMA:GQ1,CORE_SCHEMA:QQ1,DEFAULT_SCHEMA:JQ1,load:KQ1,loadAll:YQ1,dump:Ygo,YAMLException:zja,types:XQ1,safeLoad:ZQ1,safeLoadAll:kQ1,safeDump:eJ1},md=tJ1;var rPd=du.object({dependencies:du.record(du.string(),du.string())});async function nPd({absolutePathToWorkspace:e,context:t}){let r=Ru(e,Na.of(zbd));if(!await mf(r))return;let i=await(0,iPd.readFile)(r),n=md.load(i.toString());return await Pvo({schema:rPd,value:n,context:t,filepathBeingParsed:r})}async function $Rs({absolutePathToWorkspace:e,context:t}){let r=await nPd({absolutePathToWorkspace:e,context:t});return kOd({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}function Xgo(e){"@babel/helpers - typeof";return Xgo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xgo(e)}var rJ1=/^\s+/,iJ1=/\s+$/;function E_(e,t){if(e=e||"",t=t||{},e instanceof E_)return e;if(!(this instanceof E_))return new E_(e,t);var r=nJ1(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}E_.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),r,i,n,a,u,l;return r=t.r/255,i=t.g/255,n=t.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?u=i/12.92:u=Math.pow((i+.055)/1.055,2.4),n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*a+.7152*u+.0722*l},setAlpha:function(t){return this._a=fPd(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=oPd(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=oPd(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+n+"%)":"hsva("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=aPd(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=aPd(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+n+"%)":"hsla("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return uPd(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return sJ1(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Zz(this._r,255)*100)+"%",g:Math.round(Zz(this._g,255)*100)+"%",b:Math.round(Zz(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Zz(this._r,255)*100)+"%, "+Math.round(Zz(this._g,255)*100)+"%, "+Math.round(Zz(this._b,255)*100)+"%)":"rgba("+Math.round(Zz(this._r,255)*100)+"%, "+Math.round(Zz(this._g,255)*100)+"%, "+Math.round(Zz(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:OJ1[uPd(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+sPd(this._r,this._g,this._b,this._a),i=r,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=E_(t);i="#"+sPd(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+i+")"},toString:function(t){var r=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,a=!r&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return E_(this.toString())},_applyModification:function(t,r){var i=t.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(dJ1,arguments)},brighten:function(){return this._applyModification(pJ1,arguments)},darken:function(){return this._applyModification(_J1,arguments)},desaturate:function(){return this._applyModification(cJ1,arguments)},saturate:function(){return this._applyModification(lJ1,arguments)},greyscale:function(){return this._applyModification(fJ1,arguments)},spin:function(){return this._applyModification(hJ1,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(bJ1,arguments)},complement:function(){return this._applyCombination(yJ1,arguments)},monochromatic:function(){return this._applyCombination(gJ1,arguments)},splitcomplement:function(){return this._applyCombination(vJ1,arguments)},triad:function(){return this._applyCombination(cPd,[3])},tetrad:function(){return this._applyCombination(cPd,[4])}};E_.fromRatio=function(e,t){if(Xgo(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=xja(e[i]));e=r}return E_(e,t)};function nJ1(e){var t={r:0,g:0,b:0},r=1,i=null,n=null,a=null,u=!1,l=!1;return typeof e=="string"&&(e=wJ1(e)),Xgo(e)=="object"&&($ci(e.r)&&$ci(e.g)&&$ci(e.b)?(t=aJ1(e.r,e.g,e.b),u=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):$ci(e.h)&&$ci(e.s)&&$ci(e.v)?(i=xja(e.s),n=xja(e.v),t=uJ1(e.h,i,n),u=!0,l="hsv"):$ci(e.h)&&$ci(e.s)&&$ci(e.l)&&(i=xja(e.s),a=xja(e.l),t=oJ1(e.h,i,a),u=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=fPd(r),{ok:u,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function aJ1(e,t,r){return{r:Zz(e,255)*255,g:Zz(t,255)*255,b:Zz(r,255)*255}}function aPd(e,t,r){e=Zz(e,255),t=Zz(t,255),r=Zz(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,u,l=(i+n)/2;if(i==n)a=u=0;else{var d=i-n;switch(u=l>.5?d/(2-i-n):d/(i+n),i){case e:a=(t-r)/d+(t<r?6:0);break;case t:a=(r-e)/d+2;break;case r:a=(e-t)/d+4;break}a/=6}return{h:a,s:u,l}}function oJ1(e,t,r){var i,n,a;e=Zz(e,360),t=Zz(t,100),r=Zz(r,100);function u(s,o,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?s+(o-s)*6*c:c<1/2?o:c<2/3?s+(o-s)*(2/3-c)*6:s}if(t===0)i=n=a=r;else{var l=r<.5?r*(1+t):r+t-r*t,d=2*r-l;i=u(d,l,e+1/3),n=u(d,l,e),a=u(d,l,e-1/3)}return{r:i*255,g:n*255,b:a*255}}function oPd(e,t,r){e=Zz(e,255),t=Zz(t,255),r=Zz(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,u,l=i,d=i-n;if(u=i===0?0:d/i,i==n)a=0;else{switch(i){case e:a=(t-r)/d+(t<r?6:0);break;case t:a=(r-e)/d+2;break;case r:a=(e-t)/d+4;break}a/=6}return{h:a,s:u,v:l}}function uJ1(e,t,r){e=Zz(e,360)*6,t=Zz(t,100),r=Zz(r,100);var i=Math.floor(e),n=e-i,a=r*(1-t),u=r*(1-n*t),l=r*(1-(1-n)*t),d=i%6,s=[r,u,a,a,l,r][d],o=[l,r,r,u,a,a][d],c=[a,a,l,r,r,u][d];return{r:s*255,g:o*255,b:c*255}}function uPd(e,t,r,i){var n=[tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function sJ1(e,t,r,i,n){var a=[tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16)),tVt(dPd(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function sPd(e,t,r,i){var n=[tVt(dPd(i)),tVt(Math.round(e).toString(16)),tVt(Math.round(t).toString(16)),tVt(Math.round(r).toString(16))];return n.join("")}E_.equals=function(e,t){return!e||!t?!1:E_(e).toRgbString()==E_(t).toRgbString()};E_.random=function(){return E_.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function cJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.s-=t/100,r.s=Zgo(r.s),E_(r)}function lJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.s+=t/100,r.s=Zgo(r.s),E_(r)}function fJ1(e){return E_(e).desaturate(100)}function dJ1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.l+=t/100,r.l=Zgo(r.l),E_(r)}function pJ1(e,t){t=t===0?0:t||10;var r=E_(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),E_(r)}function _J1(e,t){t=t===0?0:t||10;var r=E_(e).toHsl();return r.l-=t/100,r.l=Zgo(r.l),E_(r)}function hJ1(e,t){var r=E_(e).toHsl(),i=(r.h+t)%360;return r.h=i<0?360+i:i,E_(r)}function yJ1(e){var t=E_(e).toHsl();return t.h=(t.h+180)%360,E_(t)}function cPd(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=E_(e).toHsl(),i=[E_(e)],n=360/t,a=1;a<t;a++)i.push(E_({h:(r.h+a*n)%360,s:r.s,l:r.l}));return i}function vJ1(e){var t=E_(e).toHsl(),r=t.h;return[E_(e),E_({h:(r+72)%360,s:t.s,l:t.l}),E_({h:(r+216)%360,s:t.s,l:t.l})]}function bJ1(e,t,r){t=t||6,r=r||30;var i=E_(e).toHsl(),n=360/r,a=[E_(e)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,a.push(E_(i));return a}function gJ1(e,t){t=t||6;for(var r=E_(e).toHsv(),i=r.h,n=r.s,a=r.v,u=[],l=1/t;t--;)u.push(E_({h:i,s:n,v:a})),a=(a+l)%1;return u}E_.mix=function(e,t,r){r=r===0?0:r||50;var i=E_(e).toRgb(),n=E_(t).toRgb(),a=r/100,u={r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a};return E_(u)};E_.readability=function(e,t){var r=E_(e),i=E_(t);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};E_.isReadable=function(e,t,r){var i=E_.readability(e,t),n,a;switch(a=!1,n=SJ1(r),n.level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};E_.mostReadable=function(e,t,r){var i=null,n=0,a,u,l,d;r=r||{},u=r.includeFallbackColors,l=r.level,d=r.size;for(var s=0;s<t.length;s++)a=E_.readability(e,t[s]),a>n&&(n=a,i=E_(t[s]));return E_.isReadable(e,i,{level:l,size:d})||!u?i:(r.includeFallbackColors=!1,E_.mostReadable(e,["#fff","#000"],r))};var GRs=E_.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},OJ1=E_.hexNames=mJ1(GRs);function mJ1(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function fPd(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Zz(e,t){PJ1(e)&&(e="100%");var r=jJ1(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Zgo(e){return Math.min(1,Math.max(0,e))}function aEe(e){return parseInt(e,16)}function PJ1(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function jJ1(e){return typeof e=="string"&&e.indexOf("%")!=-1}function tVt(e){return e.length==1?"0"+e:""+e}function xja(e){return e<=1&&(e=e*100+"%"),e}function dPd(e){return Math.round(parseFloat(e)*255).toString(16)}function lPd(e){return aEe(e)/255}var eVt=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function $ci(e){return!!eVt.CSS_UNIT.exec(e)}function wJ1(e){e=e.replace(rJ1,"").replace(iJ1,"").toLowerCase();var t=!1;if(GRs[e])e=GRs[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=eVt.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=eVt.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=eVt.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=eVt.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=eVt.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=eVt.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=eVt.hex8.exec(e))?{r:aEe(r[1]),g:aEe(r[2]),b:aEe(r[3]),a:lPd(r[4]),format:t?"name":"hex8"}:(r=eVt.hex6.exec(e))?{r:aEe(r[1]),g:aEe(r[2]),b:aEe(r[3]),format:t?"name":"hex"}:(r=eVt.hex4.exec(e))?{r:aEe(r[1]+""+r[1]),g:aEe(r[2]+""+r[2]),b:aEe(r[3]+""+r[3]),a:lPd(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=eVt.hex3.exec(e))?{r:aEe(r[1]+""+r[1]),g:aEe(r[2]+""+r[2]),b:aEe(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function SJ1(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}function pPd(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=eOo(e);switch(r){case"dark":return{type:"dark",...kgo(e,t,"dark")};case"light":return{type:"light",...kgo(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:kgo(e,t,"dark"),light:kgo(e,t,"light")};default:jo(r)}}function eOo({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return E_(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return E_(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return E_(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function kgo(e,t,r){let i=FBn(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??E_.random(),n=FBn(e.background,t,"background",r);return{accentPrimary:i.toRgb(),background:n?.toRgb(),border:FBn(e.border,t,"border",r)?.toRgb(),sidebarBackground:FBn(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:FBn(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:FBn(e.cardBackground,t,"card-background",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function Rja(e,t,r){if(e==null)return;let i=typeof e=="string"?e:e[r];if(i==null&&t==="accent-primary"&&typeof e!="string"&&(i=e[r==="dark"?"light":"dark"]),i!=null)return i}function FBn(e,t,r,i){let n=Rja(e,r,i);if(n==null)return;let a=E_(n);return a.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${i}`}' should be a hex color of the format #FFFFFF`),a}var HPo=require("fs/promises");var tW=ui(PEe(),1);var OJd=require("fs/promises");var gJd=100;async function KoS({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async i=>{let n=await(0,OJd.readFile)(i,"utf-8");return[Cie(t,i),n]}));return Object.fromEntries(r)}async function mJd({files:e,absolutePathToFernFolder:t}){let r={};for(let i=0;i<e.length;i+=gJd){let n=e.slice(i,i+gJd),a=await KoS({files:n,absolutePathToFernFolder:t});Object.assign(r,a)}return r}function UPo({landingPage:e,navigation:t}){return Jze([e?.absolutePath,...YoS(t)])}function YoS(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>Y7s({item:r})):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>Y7s({item:t}));case"versioned":return e.versions.flatMap(t=>UPo({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>UPo({landingPage:t.landingPage,navigation:t.navigation}));default:jo(e)}}function Y7s({item:e}){switch(e.type){case"apiSection":return Jze([e.overviewAbsolutePath,...e.navigation.flatMap(t=>PJd({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return Jze([e.overviewAbsolutePath,...e.contents.flatMap(t=>Y7s({item:t}))]);case"changelog":return e.changelog;default:jo(e)}}function PJd({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?Jze([e.overviewAbsolutePath,...e.contents.flatMap(t=>PJd({item:t}))]):[]}async function e6s({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:i}){let{instances:n,title:a,tabs:u,products:l,versions:d,navigation:s,navbarLinks:o,footerLinks:c,defaultLanguage:b,metadata:g,redirects:O,logo:m,favicon:w,backgroundImage:E,colors:q,typography:A,layout:D,analytics:C,integrations:x,css:$,js:I,aiChat:F,aiSearch:V,experimental:K}=e,Y=ywa(e.landingPage,r),Z=nuS({tabs:u,products:l,versions:d,navigation:s,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}),oe=Z.then(jt=>mJd({files:UPo({navigation:jt,landingPage:Y}),absolutePathToFernFolder:t})),pe=XoS(m,r),de=S2(w,r),Oe=ZoS(E,r),Ue=A!=null?auS({rawTypography:A,absoluteFilepathToDocsConfig:r}):void 0,wt=koS($,r),De=ruS(I,r),Te=OuS(g,r),[xt,Pe,ot,at,me,we]=await Promise.all([Z,oe,Ue,wt,De,Te]);return{title:a,instances:n,roles:e.roles,pages:Pe,landingPage:Y,navigation:xt,navbarLinks:buS(o),footerLinks:guS(c),defaultLanguage:b,announcement:e.announcement,metadata:we,redirects:O?.map(jt=>({...jt,permanent:jt?.permanent})),logo:pe,favicon:de,backgroundImage:Oe,colors:pPd(q,i),typography:ot,layout:iuS(D),analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},integrations:{...x,intercom:x?.intercom?x.intercom:void 0},css:at,js:me,aiChatConfig:V??F,experimental:K}}function XoS(e,t){return e!=null?{dark:S2(e.dark,t),light:S2(e.light,t),height:e.height,href:e.href!=null?tW.FernRegistry.Url(e.href):void 0}:void 0}function ZoS(e,t){if(e!=null)if(typeof e=="string"){let r=S2(e,t);return{dark:r,light:r}}else{let r=S2(e.dark,t),i=S2(e.light,t);return{dark:r,light:i}}}async function koS(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async i=>(await(0,HPo.readFile)(S2(i,t))).toString()))}}function euS(e){return Object.hasOwn(e,"url")}function tuS(e){return Object.hasOwn(e,"path")}async function ruS(e,t){let r=[],i=[];if(e==null)return{files:[]};let n=Array.isArray(e)?e:[e];for(let a of n)typeof a=="string"?i.push({absolutePath:S2(a,t)}):euS(a)?r.push({strategy:a.strategy,url:tW.FernRegistry.Url(a.url)}):tuS(a)&&i.push({absolutePath:S2(a.path,t),strategy:a.strategy});return{remote:r,files:i}}function iuS(e){if(e!=null)return{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:VPo(e.pageWidth),contentWidth:VPo(e.contentWidth),sidebarWidth:VPo(e.sidebarWidth),headerHeight:VPo(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?tW.FernRegistry.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?tW.FernRegistry.docs.v1.commons.SearchbarPlacement.HeaderTabs:tW.FernRegistry.docs.v1.commons.SearchbarPlacement.Sidebar,tabsPlacement:e.tabsPlacement==="header"?tW.FernRegistry.docs.v1.commons.TabsPlacement.Header:tW.FernRegistry.docs.v1.commons.TabsPlacement.Sidebar,contentAlignment:e.contentAlignment==="left"?tW.FernRegistry.docs.v1.commons.ContentAlignment.Left:tW.FernRegistry.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?tW.FernRegistry.docs.v1.commons.HeaderPosition.Absolute:tW.FernRegistry.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1}}function VPo(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let i=t.match(/^(\d+)rem$/);if(i!=null&&i[1]!=null)return{type:"rem",value:parseFloat(i[1])}}async function jJd({versions:e,absolutePathToFernFolder:t,context:r}){let i=[];for(let n of e){let a=Gv(t,n.path),u=md.load((await(0,HPo.readFile)(a)).toString()),l=Tie.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(u),d=await k7s({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:a,context:r});i.push({landingPage:ywa(l.landingPage,a),version:n.displayName,navigation:d,availability:n.availability,slug:n.slug,viewers:dVt(n.viewers),orphaned:n.orphaned,featureFlags:fVt(n.featureFlag)})}return{type:"versioned",versions:i}}async function nuS({tabs:e,products:t,versions:r,navigation:i,absolutePathToFernFolder:n,absolutePathToConfig:a,context:u}){if(i!=null)return await k7s({tabs:e,rawNavigationConfig:i,absolutePathToFernFolder:n,absolutePathToConfig:a,context:u});if(t!=null){let l=[];for(let d of t){let s=Gv(n,d.path),o=d.image!=null?Gv(n,d.image):void 0,c=md.load((await(0,HPo.readFile)(s)).toString()),b=Tie.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(c),g;d.versions!=null&&d.versions.length>0?g=await jJd({versions:d.versions,absolutePathToFernFolder:n,context:u}):g=await k7s({tabs:b.tabs,rawNavigationConfig:b.navigation,absolutePathToFernFolder:n,absolutePathToConfig:s,context:u}),l.push({landingPage:ywa(b.landingPage,s),product:d.displayName,navigation:g,slug:d.slug,subtitle:d.subtitle,icon:d.icon||"fa-solid fa-code",image:o})}return{type:"productgroup",products:l}}else if(r!=null)return await jJd({versions:r,absolutePathToFernFolder:n,context:u});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function fVt(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function auS({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await X7s({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await X7s({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await X7s({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function X7s({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await ouS(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function ouS(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(i=>{typeof i=="string"?r.push({path:i,weight:e.weight,style:e.style}):r.push({path:i.path,weight:i.weight??e.weight,style:i.style??e.style})}),Promise.all(r.map(async i=>({absolutePath:S2(i.path,t),weight:uuS(i.weight),style:i.style})))}function uuS(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function suS({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n}){let a=e[t.tab];if(a==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(t.layout!=null){let u=await Promise.all(t.layout.map(l=>t6s({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})));return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"layout",layout:u},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)}}if(a.href!=null)return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"link",href:a.href},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)};if(a.changelog!=null)return{title:a.displayName,icon:a.icon,slug:a.slug,skipUrlSlug:a.skipSlug,hidden:a.hidden,child:{type:"changelog",changelog:await cxe(S2(a.changelog,i),"{md,mdx}")},viewers:dVt(a.viewers),orphaned:a.orphaned,featureFlags:fVt(a.featureFlag)};jo(a)}async function k7s({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n}){return vuS(t)?{type:"tabbed",items:await Promise.all(t.map(u=>suS({tabs:e,item:u,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})))}:{type:"untabbed",items:await Promise.all(t.map(a=>t6s({rawConfig:a,absolutePathToFernFolder:r,absolutePathToConfig:i,context:n})))}}var cuS="Changelog";async function t6s({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}){if(wJd(e))return ywa(e,r);if(fuS(e))return{type:"section",title:e.section,icon:e.icon,contents:await Promise.all(e.contents.map(n=>t6s({rawConfig:n,absolutePathToFernFolder:t,absolutePathToConfig:r,context:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:S2(e.path,r),viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};if(duS(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:e.icon,apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:e.audiences}:{type:"all"},showErrors:e.displayErrors??!0,snippetsConfiguration:e.snippets!=null?luS({rawConfig:e.snippets}):void 0,navigation:e.layout?.flatMap(n=>WPo(n,r))??[],overviewAbsolutePath:S2(e.summary,r),hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};if(SJd(e))return{type:"link",text:e.link,url:e.href,icon:e.icon};if(puS(e))return{type:"changelog",changelog:await cxe(S2(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:e.icon,title:e.title??cuS,slug:e.slug,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)};jo(e)}function ywa(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:S2(e.path,t),slug:e.slug,icon:e.icon,hidden:e.hidden,noindex:e.noindex,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}}function WPo(e,t){return typeof e=="string"?[{type:"item",value:e}]:wJd(e)?[ywa(e,t)]:SJd(e)?[{type:"link",text:e.link,url:e.href,icon:e.icon}]:_uS(e)?[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:S2(e.summary,t),contents:e.contents?.flatMap(r=>WPo(r,t))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,icon:e.icon,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}]:huS(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:e.icon,slug:e.slug,hidden:e.hidden,playground:e.playground,viewers:dVt(e.viewers),orphaned:e.orphaned,featureFlags:fVt(e.featureFlag)}]:Object.entries(e).map(([r,i])=>yuS(i)?{type:"package",title:i.title,package:r,overviewAbsolutePath:S2(i.summary,t),contents:i.contents?.flatMap(n=>WPo(n,t))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:i.icon,playground:i.playground,viewers:dVt(i.viewers),orphaned:i.orphaned,featureFlags:fVt(i.featureFlag)}:{type:"package",title:void 0,package:r,overviewAbsolutePath:void 0,contents:i.flatMap(n=>WPo(n,t)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function luS({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp}}function wJd(e){return Gj(e)&&typeof e.page=="string"&&typeof e.path=="string"}function fuS(e){return e.section!=null}function duS(e){return e.api!=null}function SJd(e){return Tie.RawSchemas,Gj(e)&&typeof e.link=="string"&&typeof e.href=="string"}function puS(e){return Gj(e)&&typeof e.changelog=="string"}function _uS(e){return Gj(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function huS(e){return Gj(e)&&typeof e.endpoint=="string"}function yuS(e){return!Array.isArray(e)}function S2(e,t){if(e!=null)return Gv(Cd(t),e)}function vuS(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function buS(e){return e?.map(t=>t.type==="github"?{type:"github",url:tW.FernRegistry.Url(t.value)}:{type:t.type,text:t.text,url:tW.FernRegistry.Url(t.href??t.url??"/"),icon:t.icon,rightIcon:t.rightIcon,rounded:t.rounded})}function guS(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let i=e[r];i!=null&&t.push({type:r,value:tW.FernRegistry.Url(i)})}),t.length!==0)return t}async function OuS(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await Z7s(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await Z7s(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await Z7s(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,nofollow:void 0,noindex:void 0}}async function Z7s(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=S2(e,t);return await mf(r)?{type:"filepath",value:r}:{type:"url",value:e}}function dVt(e){if(e!=null){if(typeof e=="string")return[tW.FernRegistry.RoleId(e)];if(e.length!==0)return e.map(tW.FernRegistry.RoleId)}}var EJd=require("fs/promises");var DJd=du.strictObject({organization:du.string(),version:du.string()});async function uli({directory:e,context:t}){let r=Ru(e,Na.of(Mie)),i=await(0,EJd.readFile)(r),n=JSON.parse(i.toString()),a=await Pvo({schema:DJd,value:n,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:a,organization:a.organization,version:a.version}}var vwa={[Q.JAVA]:{version:"2.38.1"},[Q.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[Q.JAVA_MODEL]:{version:"1.0.0"},[Q.JAVA_SDK]:{version:"2.38.1",output:{location:"local-file-system",path:"../sdks/java/src/main/java/"}},[Q.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"}},[Q.TYPESCRIPT]:{version:"0.0.247"},[Q.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[Q.PYTHON_PYDANTIC]:{version:"1.4.7"},[Q.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[Q.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[Q.GO_FIBER]:{version:"0.23.5"},[Q.GO_MODEL]:{version:"0.23.5"},[Q.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{module:{path:"sdk"}}},[Q.RUBY_MODEL]:{version:"0.0.8"},[Q.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[Q.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[Q.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[Q.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[Q.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[Q.CSHARP_MODEL]:{version:"0.0.1"},[Q.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[Q.SWIFT_MODEL]:{version:"0.0.0"},[Q.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[Q.PHP_MODEL]:{version:"0.0.0"},[Q.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}}};function Ewi(e,t){let r=muS(e);return r??t.failAndThrow("Unrecognized generator: "+e)}function muS(e){if(e.startsWith("fernapi/")||(e=`fernapi/${e}`),PuS(e))return e}function PuS(e){return Object.values(Q).includes(e)}var trp=ui(Mwi(),1),Cwo=ui(Ywa(),1);async function XZt({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:i,includeMajor:n,context:a}){let u=trp.default.parse(i),l=new Cwo.FernRegistryClient({environment:"https://registry.buildwithfern.com"});a?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${n}, prior version: ${u}`);let d={generator:YOS(e,a),releaseTypes:[r??Cwo.FernRegistry.generators.ReleaseType.Ga],cliVersion:t==="0.0.0"?void 0:t};!n&&u!=null&&(d.generatorMajorVersion=u.major);let s=await l.generators.versions.getLatestGeneratorRelease(d);if(s.ok)return s.body.version}function YOS(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-go-fiber":return"go-fiber";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-ruby-model":return"ruby-model";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function rrp({generatorsConfiguration:e,groupName:t=e[gy.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:i}){if(t==null)return r.failAndThrow("No group specified.");let n=e.groups??={},a=n[t];if(a==null){let u=n[t]??={generators:[]};await i(u,t)}else await i(a,t);return e}async function c2s({generatorName:e,generatorsConfiguration:t,groupName:r=t[Avo],context:i,cliVersion:n}){let a=Ewi(e,i),u=vwa[a];return await rrp({generatorsConfiguration:t,groupName:r,context:i,update:async l=>{l.generators.some(d=>d.name===a)&&i.failAndThrow(`${e} is already installed in group ${r}.`),l.generators.push({name:a,...u,version:await XZt({cliVersion:n,generatorName:a,context:i,channel:void 0})??u.version})}})}var Adp=require("fs/promises");var qdp=ui(require("path"),1);var mdp=require("fs/promises"),Pdp=ui(require("path"),1);var ZZt="$";var BN={};mo(BN,{AvailabilityStatusSchema:()=>nrp,FernDefinitionError:()=>e1a,FernDefinitionTimeoutError:()=>t1a,FormDataBodyEncodingStyle:()=>_rp,HttpMethodSchema:()=>prp,ObjectPropertyAccess:()=>vrp,StreamFormat:()=>hrp,SupportedSdkLanguageSchema:()=>crp,WebSocketOrigin:()=>Prp,WebhookMethodSchema:()=>mrp,auth:()=>irp,availability:()=>l2s,commons:()=>arp,encoding:()=>orp,environments:()=>urp,errors:()=>srp,examples:()=>f2s,file:()=>lrp,pagination:()=>frp,products:()=>drp,serialization:()=>N2s,service:()=>d2s,source:()=>yrp,types:()=>p2s,validation:()=>brp,variables:()=>grp,versioning:()=>Orp,webhooks:()=>_2s,websocket:()=>h2s});var irp={};var l2s={};mo(l2s,{AvailabilityStatusSchema:()=>nrp});var nrp={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var arp={};var orp={};var urp={};var srp={};var f2s={};mo(f2s,{SupportedSdkLanguageSchema:()=>crp});var crp={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",Csharp2:"c#"};var lrp={};var frp={};var drp={};var d2s={};mo(d2s,{FormDataBodyEncodingStyle:()=>_rp,HttpMethodSchema:()=>prp,StreamFormat:()=>hrp});var prp={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var _rp={Json:"json",Exploded:"exploded",Form:"form"};var hrp={Sse:"sse",Json:"json"};var yrp={};var p2s={};mo(p2s,{ObjectPropertyAccess:()=>vrp});var vrp={ReadOnly:"read-only",WriteOnly:"write-only"};var brp={};var grp={};var Orp={};var _2s={};mo(_2s,{WebhookMethodSchema:()=>mrp});var mrp={Post:"POST",Get:"GET"};var h2s={};mo(h2s,{WebSocketOrigin:()=>Prp});var Prp={Client:"client",Server:"server"};var N2s={};mo(N2s,{AliasSchema:()=>W1o,AnyAuthItem:()=>Rwo,AnyAuthSchemesSchema:()=>Nwo,ApiAuthSchema:()=>Fwo,AuthSchemeDeclarationSchema:()=>Ywo,AuthSchemeReferenceSchema:()=>izn,AuthVariable:()=>iWi,AvailabilitySchema:()=>Zwo,AvailabilityStatusSchema:()=>azn,AvailabilityUnionSchema:()=>kwo,BaseTypeDeclarationSchema:()=>Uxe,BaseTypeReferenceSchema:()=>czn,BasicAuthSchemeSchema:()=>Jwo,BearerAuthSchemeSchema:()=>Kwo,CasingOverridesSchema:()=>M1o,CursorPaginationSchema:()=>pSo,CustomPaginationSchema:()=>hSo,DeclarationSchema:()=>kZt,DeclarationWithNameSchema:()=>Yrp,DeclarationWithoutDocsSchema:()=>i1o,DefinitionFileSchema:()=>qSo,DiscriminatedUnionSchema:()=>F1o,EncodingSchema:()=>ozn,EnumSchema:()=>T1o,EnumValue:()=>q1o,EnumValueSchema:()=>A1o,EnvironmentSchema:()=>u1o,ErrorDeclarationSchema:()=>l1o,ErrorDiscriminationSchema:()=>RSo,ExampleBodyResponseSchema:()=>p1o,ExampleCodeSampleSchema:()=>m1o,ExampleCodeSampleSchemaLanguage:()=>O1o,ExampleCodeSampleSchemaSdk:()=>g1o,ExampleEndpointCallArraySchema:()=>Xrp,ExampleEndpointCallSchema:()=>szn,ExampleResponseSchema:()=>v1o,ExampleSseEventSchema:()=>h1o,ExampleSseResponseSchema:()=>y1o,ExampleStreamResponseSchema:()=>_1o,ExampleTypeReferenceSchema:()=>M2,ExampleTypeSchema:()=>uzn,ExampleTypeValueSchema:()=>c1o,ExampleWebSocketMessage:()=>f1o,ExampleWebSocketSession:()=>d1o,ExampleWebhookCallSchema:()=>P1o,Export:()=>BSo,ExportDetailed:()=>CSo,FormDataBodyEncodingStyle:()=>Z1o,GrpcTransport:()=>$1o,HeaderAuthSchemeSchema:()=>Qwo,HttpEndpointSchema:()=>vSo,HttpHeaderSchema:()=>Vxe,HttpInlineFileRequestBodyPropertySchema:()=>k1o,HttpInlineRequestBodyPropertySchema:()=>eSo,HttpInlineRequestBodySchema:()=>tSo,HttpMethodSchema:()=>G1o,HttpPathParameterSchema:()=>ekt,HttpQueryParameterSchema:()=>fzn,HttpReferencedRequestBodySchema:()=>X1o,HttpRequest:()=>nSo,HttpRequestBodySchema:()=>rSo,HttpRequestSchema:()=>iSo,HttpResponseSchema:()=>oSo,HttpResponseSchemaDetailed:()=>aSo,HttpResponseStreamSchema:()=>cSo,HttpResponseStreamSchemaDetailed:()=>sSo,HttpServiceSchema:()=>bSo,MultipleBaseUrlsEnvironmentSchema:()=>o1o,Navigation:()=>TSo,NumberValidationSchema:()=>t1o,OAuthAccessTokenRequestPropertiesSchema:()=>Lwo,OAuthAccessTokenResponsePropertiesSchema:()=>Uwo,OAuthGetTokenEndpointSchema:()=>Vwo,OAuthRefreshTokenEndpointSchema:()=>$wo,OAuthRefreshTokenRequestPropertiesSchema:()=>Wwo,OAuthRefreshTokenResponsePropertiesSchema:()=>Hwo,OAuthSchemeSchema:()=>Gwo,ObjectExtendsSchema:()=>Fxe,ObjectPropertyAccess:()=>j1o,ObjectPropertySchema:()=>Xwi,ObjectPropertyWithAccessSchema:()=>w1o,ObjectSchema:()=>E1o,OffsetPaginationSchema:()=>_So,OpenApiSourceSchema:()=>S1o,PackageMarkerFileSchema:()=>Zrp,Pagination:()=>ySo,PaginationSchema:()=>dzn,ProductDeclarationHeaderObjectSchema:()=>GSo,ProductDeclarationHeaderSchema:()=>QSo,ProductDeclarationSchema:()=>JSo,ProductValue:()=>$So,ProductValueDetailed:()=>HSo,PropertyBasedErrorDiscrimination:()=>zSo,ProtobufSourceSchema:()=>D1o,ProtobufTypeSchema:()=>n1o,QueryParameterTypeReferenceDetailed:()=>J1o,ResponseError:()=>fSo,ResponseErrorWithDocsSchema:()=>lSo,ResponseErrorsSchema:()=>dSo,RootApiFileSchema:()=>krp,ServiceTransport:()=>lzn,SingleBaseUrlEnvironmentSchema:()=>a1o,SingleUndiscriminatedUnionTypeDetailedSchema:()=>L1o,SingleUndiscriminatedUnionTypeSchema:()=>U1o,SingleUnionTypeDetailedSchema:()=>R1o,SingleUnionTypeKey:()=>x1o,SingleUnionTypeKeySchema:()=>z1o,SingleUnionTypeSchema:()=>N1o,SourceSchema:()=>Zwi,StatusCodeBasedErrorDiscrimination:()=>xSo,StreamFormat:()=>uSo,StringValidationSchema:()=>e1o,SupportedSdkLanguageSchema:()=>b1o,TypeDeclarationSchema:()=>H1o,TypeReferenceDeclarationWithEnvOverride:()=>Y1o,TypeReferenceDeclarationWithEnvOverrideSchema:()=>K1o,TypeReferenceDeclarationWithName:()=>Lxe,TypeReferenceDeclarationWithNameSchema:()=>eip,TypeReferenceDetailedSchema:()=>I1o,TypeReferenceSchema:()=>pli,UndiscriminatedUnionSchema:()=>V1o,UnionDiscriminant:()=>B1o,UnionDiscriminantSchema:()=>C1o,ValidationSchema:()=>Ywi,VariableDeclarationDetailed:()=>NSo,VariableDeclarationSchema:()=>FSo,VariableReferenceSchema:()=>Q1o,VersionDeclarationHeaderObjectSchema:()=>VSo,VersionDeclarationHeaderSchema:()=>WSo,VersionDeclarationSchema:()=>pzn,VersionValue:()=>USo,VersionValueDetailed:()=>LSo,WebSocketChannelInlinedMessageSchema:()=>DSo,WebSocketChannelMessageBodySchema:()=>ESo,WebSocketChannelMessageSchema:()=>MSo,WebSocketChannelReferencedMessageSchema:()=>SSo,WebSocketChannelSchema:()=>ASo,WebSocketOrigin:()=>wSo,WebhookInlinedPayloadSchema:()=>mSo,WebhookMethodSchema:()=>gSo,WebhookPayloadSchema:()=>PSo,WebhookReferencedPayloadSchema:()=>OSo,WebhookSchema:()=>jSo,WithAudiences:()=>O9,WithAuthSchema:()=>Xwo,WithAvailability:()=>pQ,WithDisplayName:()=>g9,WithDocsSchema:()=>p_,WithEnvironmentVariable:()=>nzn,WithEnvironmentsSchema:()=>s1o,WithHeadersSchema:()=>ISo,WithName:()=>F1,WithValidation:()=>r1o,auth:()=>O2s,availability:()=>m2s,commons:()=>P2s,encoding:()=>j2s,environments:()=>w2s,errors:()=>S2s,examples:()=>D2s,file:()=>E2s,pagination:()=>M2s,products:()=>A2s,service:()=>q2s,source:()=>T2s,types:()=>C2s,validation:()=>B2s,variables:()=>I2s,versioning:()=>z2s,webhooks:()=>x2s,websocket:()=>R2s});var O2s={};mo(O2s,{AnyAuthItem:()=>Rwo,AnyAuthSchemesSchema:()=>Nwo,ApiAuthSchema:()=>Fwo,AuthSchemeDeclarationSchema:()=>Ywo,AuthSchemeReferenceSchema:()=>izn,AuthVariable:()=>iWi,BasicAuthSchemeSchema:()=>Jwo,BearerAuthSchemeSchema:()=>Kwo,HeaderAuthSchemeSchema:()=>Qwo,OAuthAccessTokenRequestPropertiesSchema:()=>Lwo,OAuthAccessTokenResponsePropertiesSchema:()=>Uwo,OAuthGetTokenEndpointSchema:()=>Vwo,OAuthRefreshTokenEndpointSchema:()=>$wo,OAuthRefreshTokenRequestPropertiesSchema:()=>Wwo,OAuthRefreshTokenResponsePropertiesSchema:()=>Hwo,OAuthSchemeSchema:()=>Gwo,WithAuthSchema:()=>Xwo,WithEnvironmentVariable:()=>nzn});var Ar={};mo(Ar,{JsonError:()=>ezn,ParseError:()=>tzn,any:()=>Rrp,bigint:()=>wrp,boolean:()=>Nrp,booleanLiteral:()=>xrp,date:()=>Srp,discriminant:()=>Qrp,enum_:()=>Iwo,getObjectLikeUtils:()=>OVt,getObjectUtils:()=>rWi,getSchemaUtils:()=>zq,isProperty:()=>Kwi,lazy:()=>Drp,lazyObject:()=>Brp,list:()=>xwo,number:()=>Frp,object:()=>zwo,objectWithoutOptionalProperties:()=>Crp,optional:()=>y2s,property:()=>Mrp,record:()=>Wrp,set:()=>Hrp,string:()=>Lrp,stringLiteral:()=>zrp,transform:()=>v2s,undiscriminatedUnion:()=>Grp,union:()=>Krp,unknown:()=>Urp,withParsedProperties:()=>g2s});var jj={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function eA(e,t){return`Expected ${t}. Received ${XOS(e)}.`}function XOS(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function b9(e){return{...e,json:jrp(e.json),parse:jrp(e.parse)}}function jrp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1676
1676
  `)),{ok:!0,value:t}):i}}function Bwo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var ezn=class e extends Error{errors;constructor(t){super(t.map(Bwo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var tzn=class e extends Error{errors;constructor(t){super(t.map(Bwo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function zq(e){return{optional:()=>y2s(e),transform:t=>v2s(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new tzn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new ezn(i.errors)}}}function y2s(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>jj.OPTIONAL};return{...t,...zq(t)}}function v2s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...zq(r)}}function wrp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:eA(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:eA(t,"bigint")}]},getType:()=>jj.BIGINT};return{...b9(e),...zq(e)}}var ZOS=/^([+-]?\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 Srp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:eA(t,"string")}]}:ZOS.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:eA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:eA(t,"Date object")}]},getType:()=>jj.DATE};return{...b9(e),...zq(e)}}function dQ(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...b9(r),...zq(r)}}}function Iwo(e){let t=new Set(e);return dQ(jj.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:eA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:eA(i,"enum")}]}:{ok:!0,value:i})()}function Drp(e){let t=b2s(e);return{...t,...zq(t)}}function b2s(e){return{parse:(t,r)=>rzn(e).parse(t,r),json:(t,r)=>rzn(e).json(t,r),getType:()=>rzn(e).getType()}}function rzn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function Xwa(e){return Object.entries(e)}function Zwa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function Jwi(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 kwa(e){return Object.keys(e)}function Erp(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function OVt(e){return{withParsedProperties:t=>g2s(e,t)}}function g2s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!Jwi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:eA(i,"object")}]};let a=new Set(Object.keys(t)),u=Zwa(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...zq(r),...OVt(r)}}function Mrp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Kwi(e){return e.isProperty}function zwo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>Kwi(i)?i.rawKey:r),_getParsedProperties:()=>kwa(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of Xwa(e)){let d=Kwi(l)?l.rawKey:u,s=Kwi(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,Trp(s)&&a.push(d)}return Arp({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of Xwa(e)){let l=Kwi(u)?u.valueSchema:u;Trp(l)&&n.push(a)}return Arp({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return Kwi(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>jj.OBJECT};return{...b9(t),...zq(t),...OVt(t),...rWi(t)}}function Arp({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!Jwi(e))return{ok:!1,errors:[{path:a,message:eA(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function rWi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>qrp({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>qrp({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>jj.OBJECT};return{...r,...zq(r),...OVt(r),...rWi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>jj.OBJECT};return{...t,...zq(t),...OVt(t),...rWi(t)}}}}function qrp({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=Erp(kwa(t),s=>n.has(s)),l=r(Zwa(t,u)),d=i(Zwa(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function Trp(e){return!kOS(e)}function kOS(e){switch(e.getType()){case jj.ANY:case jj.UNKNOWN:case jj.OPTIONAL:return!0;default:return!1}}function Crp(e){return zwo(e)}function Brp(e){let t={...b2s(e),_getRawProperties:()=>rzn(e)._getRawProperties(),_getParsedProperties:()=>rzn(e)._getParsedProperties()};return{...t,...zq(t),...OVt(t),...rWi(t)}}function xwo(e){let t={parse:(r,i)=>Irp(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>Irp(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>jj.LIST};return{...b9(t),...zq(t)}}function Irp(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:eA(e,"list"),path:[]}]}}function zrp(e){return dQ(jj.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:eA(r,`"${e}"`)}]})()}function xrp(e){return dQ(jj.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:eA(r,`${e.toString()}`)}]})()}var Rrp=dQ(jj.ANY,e=>({ok:!0,value:e}));var Nrp=dQ(jj.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:eA(e,"boolean")}]});var Frp=dQ(jj.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:eA(e,"number")}]});var Lrp=dQ(jj.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:eA(e,"string")}]});var Urp=dQ(jj.UNKNOWN,e=>({ok:!0,value:e}));function Wrp(e,t){let r={parse:(i,n)=>Vrp({value:i,isKeyNumeric:e.getType()===jj.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Vrp({value:i,isKeyNumeric:e.getType()===jj.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>jj.RECORD};return{...b9(r),...zq(r)}}function Vrp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return Jwi(e)?Xwa(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:eA(e,"object")}]}}function Hrp(e){let t=xwo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:eA(i,"Set")}]},getType:()=>jj.SET};return{...b9(r),...zq(r)}}function Grp(e){let t={parse:(r,i)=>$rp((n,a)=>n.parse(r,a),e,i),json:(r,i)=>$rp((n,a)=>n.json(r,a),e,i),getType:()=>jj.UNDISCRIMINATED_UNION};return{...b9(t),...zq(t)}}function $rp(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function Qrp(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Krp(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=Iwo(kwa(t)),a={parse:(u,l)=>Jrp({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>Jrp({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>jj.UNION};return{...b9(a),...zq(a),...OVt(a)}}function Jrp({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!Jwi(e))return{ok:!1,errors:[{path:l,message:eA(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var p_=Ar.object({docs:Ar.string().optional()});var izn=Ar.object({scheme:Ar.string()}).extend(p_);var Rwo=Ar.undiscriminatedUnion([Ar.string(),izn]);var Nwo=Ar.object({any:Ar.list(Rwo)}).extend(p_);var Fwo=Ar.undiscriminatedUnion([Ar.string(),izn,Nwo]);var Lwo=Ar.object({"client-id":Ar.string().optional(),"client-secret":Ar.string().optional(),scopes:Ar.string().optional()});var Uwo=Ar.object({"access-token":Ar.string().optional(),"expires-in":Ar.string().optional(),"refresh-token":Ar.string().optional()});var Vwo=Ar.object({endpoint:Ar.string(),"request-properties":Lwo.optional(),"response-properties":Uwo.optional()});var Wwo=Ar.object({"refresh-token":Ar.string()});var Hwo=Ar.object({"access-token":Ar.string().optional(),"expires-in":Ar.string().optional(),"refresh-token":Ar.string().optional()});var $wo=Ar.object({endpoint:Ar.string(),"request-properties":Wwo.optional(),"response-properties":Hwo.optional()});var Gwo=Ar.object({scheme:Ar.stringLiteral("oauth"),type:Ar.stringLiteral("client-credentials"),scopes:Ar.list(Ar.string()).optional(),"client-id-env":Ar.string().optional(),"client-secret-env":Ar.string().optional(),"token-prefix":Ar.string().optional(),"token-header":Ar.string().optional(),"get-token":Vwo,"refresh-token":$wo.optional()}).extend(p_);var nzn=Ar.object({env:Ar.string().optional()});var F1=Ar.object({name:Ar.string().optional()});var Qwo=Ar.object({header:Ar.string(),type:Ar.string().optional(),prefix:Ar.string().optional()}).extend(nzn).extend(F1).extend(p_);var iWi=Ar.object({}).extend(nzn).extend(F1);var Jwo=Ar.object({scheme:Ar.stringLiteral("basic"),username:iWi.optional(),password:iWi.optional()}).extend(p_);var Kwo=Ar.object({scheme:Ar.stringLiteral("bearer"),token:iWi.optional()}).extend(p_);var Ywo=Ar.undiscriminatedUnion([Gwo,Qwo,Jwo,Kwo]);var Xwo=Ar.object({auth:Fwo.optional(),"auth-schemes":Ar.record(Ar.string(),Ywo).optional()});var m2s={};mo(m2s,{AvailabilitySchema:()=>Zwo,AvailabilityStatusSchema:()=>azn,AvailabilityUnionSchema:()=>kwo});var azn=Ar.enum_(["in-development","pre-release","deprecated","generally-available"]);var Zwo=Ar.object({status:azn,message:Ar.string().optional()});var kwo=Ar.undiscriminatedUnion([azn,Zwo]);var P2s={};mo(P2s,{DeclarationSchema:()=>kZt,DeclarationWithNameSchema:()=>Yrp,DeclarationWithoutDocsSchema:()=>i1o,WithAudiences:()=>O9,WithAvailability:()=>pQ,WithDisplayName:()=>g9,WithDocsSchema:()=>p_,WithName:()=>F1,WithValidation:()=>r1o});var pQ=Ar.object({availability:kwo.optional()});var g9=Ar.object({"display-name":Ar.string().optional()});var e1o=Ar.object({minLength:Ar.number().optional(),maxLength:Ar.number().optional(),pattern:Ar.string().optional(),format:Ar.string().optional()});var t1o=Ar.object({min:Ar.number().optional(),max:Ar.number().optional(),exclusiveMin:Ar.boolean().optional(),exclusiveMax:Ar.boolean().optional(),multipleOf:Ar.number().optional()});var Ywi=Ar.undiscriminatedUnion([e1o,t1o]);var r1o=Ar.object({validation:Ywi.optional()});var O9=Ar.object({audiences:Ar.list(Ar.string()).optional()});var kZt=Ar.object({}).extend(p_).extend(pQ).extend(O9);var i1o=Ar.object({}).extend(pQ).extend(O9);var Yrp=Ar.object({}).extend(kZt).extend(F1);var j2s={};mo(j2s,{EncodingSchema:()=>ozn,ProtobufTypeSchema:()=>n1o});var n1o=Ar.object({type:Ar.string()});var ozn=Ar.object({proto:n1o.optional()});var w2s={};mo(w2s,{EnvironmentSchema:()=>u1o,MultipleBaseUrlsEnvironmentSchema:()=>o1o,SingleBaseUrlEnvironmentSchema:()=>a1o,WithEnvironmentsSchema:()=>s1o});var a1o=Ar.object({url:Ar.string()}).extend(O9).extend(p_);var o1o=Ar.object({urls:Ar.record(Ar.string(),Ar.string())}).extend(O9).extend(p_);var u1o=Ar.undiscriminatedUnion([Ar.string(),a1o,o1o]);var s1o=Ar.object({"default-url":Ar.string().optional(),"default-environment":Ar.string().optional(),environments:Ar.record(Ar.string(),u1o).optional()});var S2s={};mo(S2s,{ErrorDeclarationSchema:()=>l1o});var c1o=Ar.unknown();var uzn=Ar.object({value:c1o}).extend(F1).extend(p_);var l1o=Ar.object({"status-code":Ar.number(),type:Ar.string().optional(),examples:Ar.list(uzn).optional()}).extend(p_);var D2s={};mo(D2s,{ExampleBodyResponseSchema:()=>p1o,ExampleCodeSampleSchema:()=>m1o,ExampleCodeSampleSchemaLanguage:()=>O1o,ExampleCodeSampleSchemaSdk:()=>g1o,ExampleEndpointCallArraySchema:()=>Xrp,ExampleEndpointCallSchema:()=>szn,ExampleResponseSchema:()=>v1o,ExampleSseEventSchema:()=>h1o,ExampleSseResponseSchema:()=>y1o,ExampleStreamResponseSchema:()=>_1o,ExampleTypeReferenceSchema:()=>M2,ExampleTypeSchema:()=>uzn,ExampleTypeValueSchema:()=>c1o,ExampleWebSocketMessage:()=>f1o,ExampleWebSocketSession:()=>d1o,ExampleWebhookCallSchema:()=>P1o,SupportedSdkLanguageSchema:()=>b1o});var M2=Ar.unknown();var f1o=Ar.object({type:Ar.string(),body:Ar.unknown()});var d1o=Ar.object({"path-parameters":Ar.record(Ar.string(),M2).optional(),"query-parameters":Ar.record(Ar.string(),M2).optional(),headers:Ar.record(Ar.string(),M2).optional(),messages:Ar.list(f1o)}).extend(F1).extend(p_);var p1o=Ar.object({error:Ar.string().optional(),body:M2.optional()});var _1o=Ar.object({stream:Ar.list(M2)});var h1o=Ar.object({event:Ar.string(),data:M2.optional()});var y1o=Ar.object({stream:Ar.list(h1o)});var v1o=Ar.undiscriminatedUnion([p1o,_1o,y1o]);var b1o=Ar.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]);var g1o=Ar.object({sdk:b1o,code:Ar.string()}).extend(p_).extend(F1);var O1o=Ar.object({language:Ar.string(),code:Ar.string(),install:Ar.string().optional()}).extend(p_).extend(F1);var m1o=Ar.undiscriminatedUnion([g1o,O1o]);var szn=Ar.object({id:Ar.string().optional(),"path-parameters":Ar.record(Ar.string(),M2).optional(),"query-parameters":Ar.record(Ar.string(),M2).optional(),headers:Ar.record(Ar.string(),M2).optional(),request:M2.optional(),response:v1o.optional(),"code-samples":Ar.list(m1o).optional()}).extend(F1).extend(p_);var Xrp=Ar.list(szn);var P1o=Ar.object({id:Ar.string().optional(),payload:M2}).extend(F1).extend(p_);var E2s={};mo(E2s,{DefinitionFileSchema:()=>qSo,ErrorDiscriminationSchema:()=>RSo,Export:()=>BSo,ExportDetailed:()=>CSo,Navigation:()=>TSo,PackageMarkerFileSchema:()=>Zrp,PropertyBasedErrorDiscrimination:()=>zSo,RootApiFileSchema:()=>krp,StatusCodeBasedErrorDiscrimination:()=>xSo,WithHeadersSchema:()=>ISo});var Fxe=Ar.undiscriminatedUnion([Ar.string(),Ar.list(Ar.string())]);var j1o=Ar.enum_(["read-only","write-only"]);var czn=Ar.object({default:Ar.unknown().optional(),encoding:ozn.optional(),validation:Ywi.optional()}).extend(p_).extend(pQ);var Lxe=Ar.object({type:Ar.string()}).extend(czn).extend(F1).extend(O9);var w1o=Ar.object({access:j1o.optional()}).extend(Lxe);var Xwi=Ar.undiscriminatedUnion([Ar.string(),w1o]);var S1o=Ar.object({openapi:Ar.string()});var D1o=Ar.object({proto:Ar.string()});var Zwi=Ar.undiscriminatedUnion([S1o,D1o]);var Uxe=Ar.object({examples:Ar.list(uzn).optional(),encoding:ozn.optional(),source:Zwi.optional(),inline:Ar.boolean().optional()}).extend(p_).extend(pQ).extend(O9);var E1o=Ar.object({extends:Fxe.optional(),properties:Ar.record(Ar.string(),Xwi).optional(),"extra-properties":Ar.boolean().optional()}).extend(Uxe);var M1o=Ar.object({camel:Ar.string().optional(),snake:Ar.string().optional(),pascal:Ar.string().optional(),"screaming-snake":Ar.string().optional()});var A1o=Ar.object({value:Ar.string(),casing:M1o.optional()}).extend(p_).extend(F1);var q1o=Ar.undiscriminatedUnion([Ar.string(),A1o]);var T1o=Ar.object({default:Ar.string().optional(),enum:Ar.list(q1o)}).extend(Uxe);var C1o=Ar.object({value:Ar.string()}).extend(F1);var B1o=Ar.undiscriminatedUnion([Ar.string(),C1o]);var I1o=Ar.object({type:Ar.string()}).extend(czn).extend(F1).extend(O9);var pli=Ar.undiscriminatedUnion([Ar.string(),I1o]);var z1o=Ar.object({value:Ar.string()}).extend(F1);var x1o=Ar.undiscriminatedUnion([Ar.string(),z1o]);var R1o=Ar.object({type:Ar.string().optional(),key:x1o.optional()}).extend(p_).extend(F1).extend(pQ).extend(g9);var N1o=Ar.undiscriminatedUnion([Ar.string(),R1o]);var F1o=Ar.object({discriminant:B1o.optional(),extends:Fxe.optional(),"base-properties":Ar.record(Ar.string(),pli).optional(),union:Ar.record(Ar.string(),N1o)}).extend(Uxe);var L1o=Ar.object({type:Ar.string()}).extend(p_).extend(g9).extend(r1o);var U1o=Ar.undiscriminatedUnion([Ar.string(),L1o]);var V1o=Ar.object({discriminated:Ar.booleanLiteral(!1),union:Ar.list(U1o)}).extend(Uxe);var W1o=Ar.object({type:Ar.string(),validation:Ywi.optional()}).extend(Uxe);var H1o=Ar.undiscriminatedUnion([Ar.string(),E1o,T1o,F1o,V1o,W1o]);var $1o=Ar.object({"service-name":Ar.string()});var lzn=Ar.object({grpc:$1o.optional()});var G1o=Ar.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var Q1o=Ar.object({variable:Ar.string()}).extend(pQ).extend(p_);var ekt=Ar.undiscriminatedUnion([pli,Q1o]);var J1o=Ar.object({"allow-multiple":Ar.boolean().optional()}).extend(Lxe);var fzn=Ar.undiscriminatedUnion([Ar.string(),J1o]);var K1o=Ar.object({env:Ar.string().optional()}).extend(Lxe);var Y1o=Ar.undiscriminatedUnion([Ar.string(),K1o]);var Vxe=Y1o;var X1o=Ar.object({type:Ar.string()}).extend(p_);var Z1o=Ar.enum_(["json","exploded","form"]);var k1o=Ar.object({style:Z1o.optional(),"content-type":Ar.string().optional()}).extend(Lxe);var eSo=Ar.undiscriminatedUnion([Ar.string(),k1o]);var tSo=Ar.object({extends:Fxe.optional(),"extra-properties":Ar.boolean().optional(),properties:Ar.record(Ar.string(),eSo).optional()});var rSo=Ar.undiscriminatedUnion([Ar.string(),X1o,tSo]);var iSo=Ar.object({"content-type":Ar.string().optional(),"path-parameters":Ar.record(Ar.string(),ekt).optional(),"query-parameters":Ar.record(Ar.string(),fzn).optional(),headers:Ar.record(Ar.string(),Vxe).optional(),body:rSo.optional()}).extend(F1).extend(p_);var nSo=Ar.undiscriminatedUnion([Ar.string(),iSo]);var aSo=Ar.object({type:Ar.string().optional(),property:Ar.string().optional(),"status-code":Ar.number().optional()}).extend(p_);var oSo=Ar.undiscriminatedUnion([Ar.string(),aSo]);var uSo=Ar.enum_(["sse","json"]);var sSo=Ar.object({type:Ar.string(),format:uSo.optional(),terminator:Ar.string().optional()}).extend(p_);var cSo=Ar.undiscriminatedUnion([Ar.string(),sSo]);var lSo=Ar.object({error:Ar.string()}).extend(p_);var fSo=Ar.undiscriminatedUnion([Ar.string(),lSo]);var dSo=Ar.list(fSo);var pSo=Ar.object({cursor:Ar.string(),next_cursor:Ar.string(),results:Ar.string()});var _So=Ar.object({offset:Ar.string(),results:Ar.string(),step:Ar.string().optional(),"has-next-page":Ar.string().optional()});var hSo=Ar.object({type:Ar.stringLiteral("custom"),results:Ar.string()});var dzn=Ar.undiscriminatedUnion([pSo,_So,hSo]);var ySo=Ar.undiscriminatedUnion([dzn,Ar.boolean()]);var vSo=Ar.object({method:G1o.optional(),"base-path":Ar.string().optional(),path:Ar.string(),url:Ar.string().optional(),"path-parameters":Ar.record(Ar.string(),ekt).optional(),auth:Ar.boolean().optional(),idempotent:Ar.boolean().optional(),"stream-condition":Ar.string().optional(),request:nSo.optional(),response:oSo.optional(),"response-stream":cSo.optional(),errors:dSo.optional(),examples:Ar.list(szn).optional(),pagination:ySo.optional(),transport:lzn.optional(),source:Zwi.optional()}).extend(g9).extend(kZt);var bSo=Ar.object({auth:Ar.boolean(),url:Ar.string().optional(),"base-path":Ar.string(),"path-parameters":Ar.record(Ar.string(),pli).optional(),idempotent:Ar.boolean().optional(),headers:Ar.record(Ar.string(),pli).optional(),transport:lzn.optional(),source:Zwi.optional(),endpoints:Ar.record(Ar.string(),vSo)}).extend(i1o).extend(g9);var gSo=Ar.enum_(["POST","GET"]);var OSo=Ar.object({type:Ar.string()}).extend(p_);var mSo=Ar.object({name:Ar.string(),extends:Fxe.optional(),properties:Ar.record(Ar.string(),Xwi).optional()});var PSo=Ar.undiscriminatedUnion([Ar.string(),OSo,mSo]);var jSo=Ar.object({method:gSo,headers:Ar.record(Ar.string(),Vxe).optional(),payload:PSo,examples:Ar.list(P1o).optional()}).extend(pQ).extend(O9).extend(p_).extend(g9);var wSo=Ar.enum_(["client","server"]);var SSo=Ar.object({type:Ar.string()}).extend(p_);var DSo=Ar.object({name:Ar.string(),extends:Fxe.optional(),properties:Ar.record(Ar.string(),Xwi).optional()});var ESo=Ar.undiscriminatedUnion([Ar.string(),SSo,DSo]);var MSo=Ar.object({origin:wSo,body:ESo}).extend(kZt).extend(g9);var ASo=Ar.object({auth:Ar.boolean(),url:Ar.string().optional(),path:Ar.string(),headers:Ar.record(Ar.string(),Vxe).optional(),"path-parameters":Ar.record(Ar.string(),ekt).optional(),"query-parameters":Ar.record(Ar.string(),fzn).optional(),messages:Ar.record(Ar.string(),MSo).optional(),examples:Ar.list(d1o).optional()}).extend(kZt).extend(g9);var qSo=Ar.object({imports:Ar.record(Ar.string(),Ar.string()).optional(),types:Ar.record(Ar.string(),H1o).optional(),service:bSo.optional(),errors:Ar.record(Ar.string(),l1o).optional(),webhooks:Ar.record(Ar.string(),jSo).optional(),channel:ASo.optional()}).extend(p_);var TSo=Ar.undiscriminatedUnion([Ar.string(),Ar.list(Ar.string())]);var CSo=Ar.object({dependency:Ar.string(),url:Ar.string().optional()});var BSo=Ar.undiscriminatedUnion([Ar.string(),CSo]);var Zrp=Ar.object({navigation:TSo.optional(),export:BSo.optional()}).extend(qSo);var ISo=Ar.object({headers:Ar.record(Ar.string(),Vxe).optional()});var zSo=Ar.object({strategy:Ar.stringLiteral("property"),"property-name":Ar.string()});var xSo=Ar.object({strategy:Ar.stringLiteral("status-code")});var RSo=Ar.undiscriminatedUnion([zSo,xSo]);var NSo=Ar.object({type:Ar.string()}).extend(p_);var FSo=Ar.undiscriminatedUnion([Ar.string(),NSo]);var LSo=Ar.object({value:Ar.string()}).extend(p_).extend(F1);var USo=Ar.undiscriminatedUnion([Ar.string(),LSo]);var VSo=Ar.object({name:Ar.string().optional(),env:Ar.string().optional(),value:Ar.string()});var WSo=Ar.undiscriminatedUnion([Ar.string(),VSo]);var pzn=Ar.object({default:Ar.string().optional(),values:Ar.list(USo),header:WSo});var HSo=Ar.object({value:Ar.string(),versions:pzn.optional()}).extend(p_).extend(F1);var $So=Ar.undiscriminatedUnion([Ar.string(),HSo]);var GSo=Ar.object({name:Ar.string().optional(),env:Ar.string().optional(),value:Ar.string()});var QSo=Ar.undiscriminatedUnion([Ar.string(),GSo]);var JSo=Ar.object({default:Ar.string().optional(),values:Ar.list($So),header:QSo});var krp=Ar.object({name:Ar.string(),imports:Ar.record(Ar.string(),Ar.string()).optional(),"error-discrimination":RSo.optional(),audiences:Ar.list(Ar.string()).optional(),errors:Ar.list(Ar.string()).optional(),"base-path":Ar.string().optional(),"path-parameters":Ar.record(Ar.string(),ekt).optional(),"idempotency-headers":Ar.record(Ar.string(),Vxe).optional(),variables:Ar.record(Ar.string(),FSo).optional(),pagination:dzn.optional(),product:JSo.optional(),version:pzn.optional()}).extend(p_).extend(g9).extend(s1o).extend(Xwo).extend(ISo);var M2s={};mo(M2s,{CursorPaginationSchema:()=>pSo,CustomPaginationSchema:()=>hSo,OffsetPaginationSchema:()=>_So,PaginationSchema:()=>dzn});var A2s={};mo(A2s,{ProductDeclarationHeaderObjectSchema:()=>GSo,ProductDeclarationHeaderSchema:()=>QSo,ProductDeclarationSchema:()=>JSo,ProductValue:()=>$So,ProductValueDetailed:()=>HSo});var q2s={};mo(q2s,{FormDataBodyEncodingStyle:()=>Z1o,GrpcTransport:()=>$1o,HttpEndpointSchema:()=>vSo,HttpHeaderSchema:()=>Vxe,HttpInlineFileRequestBodyPropertySchema:()=>k1o,HttpInlineRequestBodyPropertySchema:()=>eSo,HttpInlineRequestBodySchema:()=>tSo,HttpMethodSchema:()=>G1o,HttpPathParameterSchema:()=>ekt,HttpQueryParameterSchema:()=>fzn,HttpReferencedRequestBodySchema:()=>X1o,HttpRequest:()=>nSo,HttpRequestBodySchema:()=>rSo,HttpRequestSchema:()=>iSo,HttpResponseSchema:()=>oSo,HttpResponseSchemaDetailed:()=>aSo,HttpResponseStreamSchema:()=>cSo,HttpResponseStreamSchemaDetailed:()=>sSo,HttpServiceSchema:()=>bSo,Pagination:()=>ySo,QueryParameterTypeReferenceDetailed:()=>J1o,ResponseError:()=>fSo,ResponseErrorWithDocsSchema:()=>lSo,ResponseErrorsSchema:()=>dSo,ServiceTransport:()=>lzn,StreamFormat:()=>uSo,TypeReferenceDeclarationWithEnvOverride:()=>Y1o,TypeReferenceDeclarationWithEnvOverrideSchema:()=>K1o});var T2s={};mo(T2s,{OpenApiSourceSchema:()=>S1o,ProtobufSourceSchema:()=>D1o,SourceSchema:()=>Zwi});var C2s={};mo(C2s,{AliasSchema:()=>W1o,BaseTypeDeclarationSchema:()=>Uxe,BaseTypeReferenceSchema:()=>czn,CasingOverridesSchema:()=>M1o,DiscriminatedUnionSchema:()=>F1o,EnumSchema:()=>T1o,EnumValue:()=>q1o,EnumValueSchema:()=>A1o,ObjectExtendsSchema:()=>Fxe,ObjectPropertyAccess:()=>j1o,ObjectPropertySchema:()=>Xwi,ObjectPropertyWithAccessSchema:()=>w1o,ObjectSchema:()=>E1o,SingleUndiscriminatedUnionTypeDetailedSchema:()=>L1o,SingleUndiscriminatedUnionTypeSchema:()=>U1o,SingleUnionTypeDetailedSchema:()=>R1o,SingleUnionTypeKey:()=>x1o,SingleUnionTypeKeySchema:()=>z1o,SingleUnionTypeSchema:()=>N1o,TypeDeclarationSchema:()=>H1o,TypeReferenceDeclarationWithName:()=>Lxe,TypeReferenceDeclarationWithNameSchema:()=>eip,TypeReferenceDetailedSchema:()=>I1o,TypeReferenceSchema:()=>pli,UndiscriminatedUnionSchema:()=>V1o,UnionDiscriminant:()=>B1o,UnionDiscriminantSchema:()=>C1o});var eip=Ar.undiscriminatedUnion([Ar.string(),Lxe]);var B2s={};mo(B2s,{NumberValidationSchema:()=>t1o,StringValidationSchema:()=>e1o,ValidationSchema:()=>Ywi});var I2s={};mo(I2s,{VariableDeclarationDetailed:()=>NSo,VariableDeclarationSchema:()=>FSo,VariableReferenceSchema:()=>Q1o});var z2s={};mo(z2s,{VersionDeclarationHeaderObjectSchema:()=>VSo,VersionDeclarationHeaderSchema:()=>WSo,VersionDeclarationSchema:()=>pzn,VersionValue:()=>USo,VersionValueDetailed:()=>LSo});var x2s={};mo(x2s,{WebhookInlinedPayloadSchema:()=>mSo,WebhookMethodSchema:()=>gSo,WebhookPayloadSchema:()=>PSo,WebhookReferencedPayloadSchema:()=>OSo,WebhookSchema:()=>jSo});var R2s={};mo(R2s,{WebSocketChannelInlinedMessageSchema:()=>DSo,WebSocketChannelMessageBodySchema:()=>ESo,WebSocketChannelMessageSchema:()=>MSo,WebSocketChannelReferencedMessageSchema:()=>SSo,WebSocketChannelSchema:()=>ASo,WebSocketOrigin:()=>wSo});var e1a=class e extends Error{statusCode;body;constructor({message:t,statusCode:r,body:i}){super(emS({message:t,statusCode:r,body:i})),Object.setPrototypeOf(this,e.prototype),r!=null&&(this.statusCode=r),i!==void 0&&(this.body=i)}};function emS({message:e,statusCode:t,body:r}){let i=[];return e!=null&&i.push(e),t!=null&&i.push(`Status code: ${t.toString()}`),r!=null&&i.push(`Body: ${JSON.stringify(r,void 0,2)}`),i.join(`
1677
1677
  `)}var t1a=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var tmS={optional:"optional",nullable:"nullable",set:"set",list:"list",map:"map",literal:"literal"},tip=new Set(Object.values(tmS));function Zx(e){let t=e.match(/([\w.]+)<([\w,\s]+)>/);if(t?.[0]!=null&&t[1]!=null&&t[2]!=null&&!tip.has(t[1].trim()))return{name:t[1].trim(),arguments:t[2].split(",").map(r=>r.trim())}}function Wxe(e){return Zx(e)!=null}function F2s(e){return e.scheme==="oauth"}function L2s(e){if(e.request!=null)return typeof e.request=="string"?e.request:e.request.body}function U2s(e){if(e.response!=null)return typeof e.response=="string"?e.response:e.response.type}function KC(e){return typeof e=="string"?!1:e?.extends!=null||e?.properties!=null}function tkt(e){return e?e.proto!=null:!1}var rmS="text";function _zn(e){return e===rmS}var Gs={};mo(Gs,{ApiDefinitionSource:()=>mne,ApiVersionScheme:()=>r1i,AuthScheme:()=>BT,AuthSchemesRequirement:()=>bne,AvailabilityStatus:()=>m9,ContainerType:()=>Py,Environments:()=>ex,ErrorDeclarationDiscriminantValue:()=>e1i,ErrorDiscriminationStrategy:()=>SEe,ExampleCodeSample:()=>wEe,ExampleContainer:()=>mm,ExampleEndpointSuccessResponse:()=>XC,ExamplePrimitive:()=>Fd,ExampleQueryParameterShape:()=>A2,ExampleRequestBody:()=>yQ,ExampleResponse:()=>IT,ExampleSingleUnionTypeProperties:()=>i3,ExampleTypeReferenceShape:()=>Vh,ExampleTypeShape:()=>Rw,ExampleWebSocketMessageBody:()=>DEe,FileProperty:()=>gne,FileUploadBodyPropertyEncoding:()=>r1a,FileUploadRequestProperty:()=>w6,HttpEndpointSource:()=>_Q,HttpMethod:()=>YC,HttpRequestBody:()=>tA,HttpResponseBody:()=>xw,JsonResponse:()=>j9,Literal:()=>D9,NamedTypeDefault:()=>hzn,NonStreamHttpResponseBody:()=>cW,OAuthConfiguration:()=>kwi,ObjectPropertyAccess:()=>akt,Pagination:()=>hQ,PathParameterLocation:()=>Gxe,PrimitiveTypeV1:()=>Uh,PrimitiveTypeV2:()=>Ed,ProtobufMethodType:()=>PVt,ProtobufType:()=>Kj,PublishTarget:()=>nkt,PublishingConfig:()=>ikt,RequestPropertyValue:()=>One,ResolvedTypeReference:()=>lW,SdkRequestBodyType:()=>mVt,SdkRequestShape:()=>Qxe,ShapeType:()=>jVt,SingleUnionTypeProperties:()=>S9,Source:()=>_li,StreamingResponse:()=>w9,SupportedSdkLanguage:()=>rkt,Transport:()=>$xe,Type:()=>Sb,TypeReference:()=>Kc,V2AuthValues:()=>Hxe,V2EndpointLocationHttpMethod:()=>t1i,V2HttpEndpointResponseBody:()=>P9,WebSocketMessageBody:()=>E9,WebSocketMessageOrigin:()=>ZSo,WebhookHttpMethod:()=>XSo,WebhookPayload:()=>fW,WellKnownProtobufType:()=>id,audience:()=>rip,auth:()=>V2s,commons:()=>W2s,constants:()=>iip,dynamic:()=>bs,environment:()=>K2s,errors:()=>Y2s,examples:()=>X2s,generatorExec:()=>w0,http:()=>k2s,ir:()=>e8s,proto:()=>t8s,publish:()=>r8s,types:()=>i8s,variables:()=>wip,webhooks:()=>n8s,websocket:()=>a8s});var rip={};var V2s={};mo(V2s,{AuthScheme:()=>BT,AuthSchemesRequirement:()=>bne,OAuthConfiguration:()=>kwi});var bne={All:"ALL",Any:"ANY",_visit:(e,t)=>{switch(e){case bne.All:return t.all();case bne.Any:return t.any();default:return t._other()}}};var BT={bearer:e=>({...e,type:"bearer",_visit:function(t){return BT._visit(this,t)}}),basic:e=>({...e,type:"basic",_visit:function(t){return BT._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return BT._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return BT._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"bearer":return t.bearer(e);case"basic":return t.basic(e);case"header":return t.header(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var kwi={clientCredentials:e=>({...e,type:"clientCredentials",_visit:function(t){return kwi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"clientCredentials":return t.clientCredentials(e);default:return t._other(e)}}};var W2s={};mo(W2s,{AvailabilityStatus:()=>m9});var m9={InDevelopment:"IN_DEVELOPMENT",PreRelease:"PRE_RELEASE",GeneralAvailability:"GENERAL_AVAILABILITY",Deprecated:"DEPRECATED",_visit:(e,t)=>{switch(e){case m9.InDevelopment:return t.inDevelopment();case m9.PreRelease:return t.preRelease();case m9.GeneralAvailability:return t.generalAvailability();case m9.Deprecated:return t.deprecated();default:return t._other()}}};var iip={};var bs={};mo(bs,{Auth:()=>nip,AuthValues:()=>aip,ErrorSeverity:()=>KSo,FileUploadRequestBodyProperty:()=>fip,GeneratorOutputConfig:()=>pip,InlinedRequestBody:()=>cip,LiteralType:()=>bip,NamedType:()=>hip,PublishInfo:()=>_ip,ReferencedRequestBodyType:()=>lip,Request:()=>uip,Response:()=>sip,SingleDiscriminatedUnionType:()=>vip,TypeReference:()=>yip,auth:()=>H2s,declaration:()=>oip,endpoints:()=>$2s,environment:()=>dip,ir:()=>G2s,snippets:()=>Q2s,types:()=>J2s});var H2s={};mo(H2s,{Auth:()=>nip,AuthValues:()=>aip});var nip={basic:e=>({...e,type:"basic",_visit:function(t){return bs.Auth._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return bs.Auth._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return bs.Auth._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return bs.Auth._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"oauth":return t.oauth(e);default:return t._other(e)}}};var aip={basic:e=>({...e,type:"basic",_visit:function(t){return bs.AuthValues._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return bs.AuthValues._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return bs.AuthValues._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return bs.AuthValues._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"oauth":return t.oauth(e);default:return t._other(e)}}};var oip={};var $2s={};mo($2s,{FileUploadRequestBodyProperty:()=>fip,InlinedRequestBody:()=>cip,ReferencedRequestBodyType:()=>lip,Request:()=>uip,Response:()=>sip});var uip={body:e=>({...e,type:"body",_visit:function(t){return bs.Request._visit(this,t)}}),inlined:e=>({...e,type:"inlined",_visit:function(t){return bs.Request._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"body":return t.body(e);case"inlined":return t.inlined(e);default:return t._other(e)}}};var sip={json:()=>({type:"json",_visit:function(e){return bs.Response._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json();default:return t._other(e)}}};var cip={properties:e=>({value:e,type:"properties",_visit:function(t){return bs.InlinedRequestBody._visit(this,t)}}),referenced:e=>({...e,type:"referenced",_visit:function(t){return bs.InlinedRequestBody._visit(this,t)}}),fileUpload:e=>({...e,type:"fileUpload",_visit:function(t){return bs.InlinedRequestBody._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"properties":return t.properties(e.value);case"referenced":return t.referenced(e);case"fileUpload":return t.fileUpload(e);default:return t._other(e)}}};var lip={bytes:()=>({type:"bytes",_visit:function(e){return bs.ReferencedRequestBodyType._visit(this,e)}}),typeReference:e=>({value:e,type:"typeReference",_visit:function(t){return bs.ReferencedRequestBodyType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"bytes":return t.bytes();case"typeReference":return t.typeReference(e.value);default:return t._other(e)}}};var fip={file:e=>({...e,type:"file",_visit:function(t){return bs.FileUploadRequestBodyProperty._visit(this,t)}}),fileArray:e=>({...e,type:"fileArray",_visit:function(t){return bs.FileUploadRequestBodyProperty._visit(this,t)}}),bodyProperty:e=>({...e,type:"bodyProperty",_visit:function(t){return bs.FileUploadRequestBodyProperty._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"fileArray":return t.fileArray(e);case"bodyProperty":return t.bodyProperty(e);default:return t._other(e)}}};var dip={};var G2s={};mo(G2s,{GeneratorOutputConfig:()=>pip,PublishInfo:()=>_ip});var pip={publish:e=>({value:e,type:"publish",_visit:function(t){return bs.GeneratorOutputConfig._visit(this,t)}}),local:()=>({type:"local",_visit:function(e){return bs.GeneratorOutputConfig._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"publish":return t.publish(e.value);case"local":return t.local();default:return t._other(e)}}};var _ip={go:e=>({...e,type:"go",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return bs.PublishInfo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"go":return t.go(e);case"maven":return t.maven(e);case"npm":return t.npm(e);case"nuget":return t.nuget(e);case"pypi":return t.pypi(e);case"rubygems":return t.rubygems(e);default:return t._other(e)}}};var Q2s={};mo(Q2s,{ErrorSeverity:()=>KSo});var KSo={Critical:"CRITICAL",Warning:"WARNING",_visit:(e,t)=>{switch(e){case KSo.Critical:return t.critical();case KSo.Warning:return t.warning();default:return t._other()}}};var J2s={};mo(J2s,{LiteralType:()=>bip,NamedType:()=>hip,SingleDiscriminatedUnionType:()=>vip,TypeReference:()=>yip});var hip={alias:e=>({...e,type:"alias",_visit:function(t){return bs.NamedType._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return bs.NamedType._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return bs.NamedType._visit(this,t)}}),discriminatedUnion:e=>({...e,type:"discriminatedUnion",_visit:function(t){return bs.NamedType._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return bs.NamedType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"discriminatedUnion":return t.discriminatedUnion(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var yip={list:e=>({value:e,type:"list",_visit:function(t){return bs.TypeReference._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return bs.TypeReference._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return bs.TypeReference._visit(this,t)}}),named:e=>({value:e,type:"named",_visit:function(t){return bs.TypeReference._visit(this,t)}}),nullable:e=>({value:e,type:"nullable",_visit:function(t){return bs.TypeReference._visit(this,t)}}),optional:e=>({value:e,type:"optional",_visit:function(t){return bs.TypeReference._visit(this,t)}}),primitive:e=>({value:e,type:"primitive",_visit:function(t){return bs.TypeReference._visit(this,t)}}),set:e=>({value:e,type:"set",_visit:function(t){return bs.TypeReference._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return bs.TypeReference._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e.value);case"literal":return t.literal(e.value);case"map":return t.map(e);case"named":return t.named(e.value);case"nullable":return t.nullable(e.value);case"optional":return t.optional(e.value);case"primitive":return t.primitive(e.value);case"set":return t.set(e.value);case"unknown":return t.unknown();default:return t._other(e)}}};var vip={samePropertiesAsObject:e=>({...e,type:"samePropertiesAsObject",_visit:function(t){return bs.SingleDiscriminatedUnionType._visit(this,t)}}),singleProperty:e=>({...e,type:"singleProperty",_visit:function(t){return bs.SingleDiscriminatedUnionType._visit(this,t)}}),noProperties:e=>({...e,type:"noProperties",_visit:function(t){return bs.SingleDiscriminatedUnionType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties(e);default:return t._other(e)}}};var bip={boolean:e=>({value:e,type:"boolean",_visit:function(t){return bs.LiteralType._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return bs.LiteralType._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 K2s={};mo(K2s,{Environments:()=>ex});var ex={singleBaseUrl:e=>({...e,type:"singleBaseUrl",_visit:function(t){return ex._visit(this,t)}}),multipleBaseUrls:e=>({...e,type:"multipleBaseUrls",_visit:function(t){return ex._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"singleBaseUrl":return t.singleBaseUrl(e);case"multipleBaseUrls":return t.multipleBaseUrls(e);default:return t._other(e)}}};var Y2s={};mo(Y2s,{ErrorDeclarationDiscriminantValue:()=>e1i});var e1i={property:e=>({...e,type:"property",_visit:function(t){return e1i._visit(this,t)}}),statusCode:()=>({type:"statusCode",_visit:function(e){return e1i._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"property":return t.property(e);case"statusCode":return t.statusCode();default:return t._other(e)}}};var X2s={};mo(X2s,{V2AuthValues:()=>Hxe,V2EndpointLocationHttpMethod:()=>t1i,V2HttpEndpointResponseBody:()=>P9});var P9={error:e=>({value:e,type:"error",_visit:function(t){return P9._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return P9._visit(this,t)}}),stream:e=>({value:e,type:"stream",_visit:function(t){return P9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"error":return t.error(e.value);case"json":return t.json(e.value);case"stream":return t.stream(e.value);default:return t._other(e)}}};var t1i={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",_visit:(e,t)=>{switch(e){case t1i.Get:return t.get();case t1i.Post:return t.post();case t1i.Put:return t.put();case t1i.Patch:return t.patch();case t1i.Delete:return t.delete();case t1i.Head:return t.head();default:return t._other()}}};var Hxe={basic:e=>({...e,type:"basic",_visit:function(t){return Hxe._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Hxe._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Hxe._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Hxe._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"oauth":return t.oauth(e);default:return t._other(e)}}};var w0={};mo(w0,{GeneratorEnvironment:()=>jip,GeneratorPublishTarget:()=>Pip,GithubPublishInfo:()=>mip,LicenseConfig:()=>gip,LicenseId:()=>YSo,OutputMode:()=>Oip,config:()=>Z2s});var Z2s={};mo(Z2s,{GeneratorEnvironment:()=>jip,GeneratorPublishTarget:()=>Pip,GithubPublishInfo:()=>mip,LicenseConfig:()=>gip,LicenseId:()=>YSo,OutputMode:()=>Oip});var gip={basic:e=>({...e,type:"basic",_visit:function(t){return w0.LicenseConfig._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return w0.LicenseConfig._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"custom":return t.custom(e);default:return t._other(e)}}};var YSo={Mit:"MIT",Apache2:"Apache-2.0",_visit:(e,t)=>{switch(e){case YSo.Mit:return t.mit();case YSo.Apache2:return t.apache2();default:return t._other()}}};var Oip={publish:e=>({...e,type:"publish",_visit:function(t){return w0.OutputMode._visit(this,t)}}),downloadFiles:()=>({type:"downloadFiles",_visit:function(e){return w0.OutputMode._visit(this,e)}}),github:e=>({...e,type:"github",_visit:function(t){return w0.OutputMode._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"publish":return t.publish(e);case"downloadFiles":return t.downloadFiles();case"github":return t.github(e);default:return t._other(e)}}};var mip={npm:e=>({...e,type:"npm",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),postman:e=>({...e,type:"postman",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return w0.GithubPublishInfo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"npm":return t.npm(e);case"maven":return t.maven(e);case"postman":return t.postman(e);case"pypi":return t.pypi(e);case"rubygems":return t.rubygems(e);case"nuget":return t.nuget(e);default:return t._other(e)}}};var Pip={maven:e=>({...e,type:"maven",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),postman:e=>({...e,type:"postman",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return w0.GeneratorPublishTarget._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"maven":return t.maven(e);case"npm":return t.npm(e);case"pypi":return t.pypi(e);case"postman":return t.postman(e);case"rubygems":return t.rubygems(e);case"nuget":return t.nuget(e);default:return t._other(e)}}};var jip={local:()=>({type:"local",_visit:function(e){return w0.GeneratorEnvironment._visit(this,e)}}),remote:e=>({...e,type:"remote",_visit:function(t){return w0.GeneratorEnvironment._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"local":return t.local();case"remote":return t.remote(e);default:return t._other(e)}}};var k2s={};mo(k2s,{ExampleCodeSample:()=>wEe,ExampleEndpointSuccessResponse:()=>XC,ExampleQueryParameterShape:()=>A2,ExampleRequestBody:()=>yQ,ExampleResponse:()=>IT,FileProperty:()=>gne,FileUploadBodyPropertyEncoding:()=>r1a,FileUploadRequestProperty:()=>w6,HttpEndpointSource:()=>_Q,HttpMethod:()=>YC,HttpRequestBody:()=>tA,HttpResponseBody:()=>xw,JsonResponse:()=>j9,NonStreamHttpResponseBody:()=>cW,Pagination:()=>hQ,PathParameterLocation:()=>Gxe,RequestPropertyValue:()=>One,SdkRequestBodyType:()=>mVt,SdkRequestShape:()=>Qxe,StreamingResponse:()=>w9,SupportedSdkLanguage:()=>rkt,Transport:()=>$xe});var $xe={http:()=>({type:"http",_visit:function(e){return $xe._visit(this,e)}}),grpc:e=>({...e,type:"grpc",_visit:function(t){return $xe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"http":return t.http();case"grpc":return t.grpc(e);default:return t._other(e)}}};var _Q={proto:e=>({...e,type:"proto",_visit:function(t){return _Q._visit(this,t)}}),openapi:()=>({type:"openapi",_visit:function(e){return _Q._visit(this,e)}}),openrpc:()=>({type:"openrpc",_visit:function(e){return _Q._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"proto":return t.proto(e);case"openapi":return t.openapi();case"openrpc":return t.openrpc();default:return t._other(e)}}};var YC={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",_visit:(e,t)=>{switch(e){case YC.Get:return t.get();case YC.Post:return t.post();case YC.Put:return t.put();case YC.Patch:return t.patch();case YC.Delete:return t.delete();case YC.Head:return t.head();default:return t._other()}}};var Gxe={Root:"ROOT",Service:"SERVICE",Endpoint:"ENDPOINT",_visit:(e,t)=>{switch(e){case Gxe.Root:return t.root();case Gxe.Service:return t.service();case Gxe.Endpoint:return t.endpoint();default:return t._other()}}};var tA={inlinedRequestBody:e=>({...e,type:"inlinedRequestBody",_visit:function(t){return tA._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return tA._visit(this,t)}}),fileUpload:e=>({...e,type:"fileUpload",_visit:function(t){return tA._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return tA._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedRequestBody":return t.inlinedRequestBody(e);case"reference":return t.reference(e);case"fileUpload":return t.fileUpload(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var w6={file:e=>({value:e,type:"file",_visit:function(t){return w6._visit(this,t)}}),bodyProperty:e=>({...e,type:"bodyProperty",_visit:function(t){return w6._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e.value);case"bodyProperty":return t.bodyProperty(e);default:return t._other(e)}}};var r1a={Exploded:"exploded",Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case r1a.Exploded:return t.exploded();case r1a.Json:return t.json();case r1a.Form:return t.form();default:return t._other()}}};var gne={file:e=>({...e,type:"file",_visit:function(t){return gne._visit(this,t)}}),fileArray:e=>({...e,type:"fileArray",_visit:function(t){return gne._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"fileArray":return t.fileArray(e);default:return t._other(e)}}};var mVt={typeReference:e=>({...e,type:"typeReference",_visit:function(t){return mVt._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return mVt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"typeReference":return t.typeReference(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var Qxe={justRequestBody:e=>({value:e,type:"justRequestBody",_visit:function(t){return Qxe._visit(this,t)}}),wrapper:e=>({...e,type:"wrapper",_visit:function(t){return Qxe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"justRequestBody":return t.justRequestBody(e.value);case"wrapper":return t.wrapper(e);default:return t._other(e)}}};var cW={json:e=>({value:e,type:"json",_visit:function(t){return cW._visit(this,t)}}),fileDownload:e=>({...e,type:"fileDownload",_visit:function(t){return cW._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return cW._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return cW._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e.value);case"fileDownload":return t.fileDownload(e);case"text":return t.text(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var xw={json:e=>({value:e,type:"json",_visit:function(t){return xw._visit(this,t)}}),fileDownload:e=>({...e,type:"fileDownload",_visit:function(t){return xw._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return xw._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return xw._visit(this,t)}}),streaming:e=>({value:e,type:"streaming",_visit:function(t){return xw._visit(this,t)}}),streamParameter:e=>({...e,type:"streamParameter",_visit:function(t){return xw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e.value);case"fileDownload":return t.fileDownload(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streaming":return t.streaming(e.value);case"streamParameter":return t.streamParameter(e);default:return t._other(e)}}};var j9={response:e=>({...e,type:"response",_visit:function(t){return j9._visit(this,t)}}),nestedPropertyAsResponse:e=>({...e,type:"nestedPropertyAsResponse",_visit:function(t){return j9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"response":return t.response(e);case"nestedPropertyAsResponse":return t.nestedPropertyAsResponse(e);default:return t._other(e)}}};var w9={json:e=>({...e,type:"json",_visit:function(t){return w9._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return w9._visit(this,t)}}),sse:e=>({...e,type:"sse",_visit:function(t){return w9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e);case"text":return t.text(e);case"sse":return t.sse(e);default:return t._other(e)}}};var hQ={cursor:e=>({...e,type:"cursor",_visit:function(t){return hQ._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return hQ._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return hQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);default:return t._other(e)}}};var One={query:e=>({...e,type:"query",_visit:function(t){return One._visit(this,t)}}),body:e=>({...e,type:"body",_visit:function(t){return One._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"query":return t.query(e);case"body":return t.body(e);default:return t._other(e)}}};var wEe={language:e=>({...e,type:"language",_visit:function(t){return wEe._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return wEe._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 rkt={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",_visit:(e,t)=>{switch(e){case rkt.Curl:return t.curl();case rkt.Python:return t.python();case rkt.Javascript:return t.javascript();case rkt.Typescript:return t.typescript();case rkt.Go:return t.go();case rkt.Ruby:return t.ruby();case rkt.Csharp:return t.csharp();case rkt.Java:return t.java();default:return t._other()}}};var A2={single:()=>({type:"single",_visit:function(e){return A2._visit(this,e)}}),exploded:()=>({type:"exploded",_visit:function(e){return A2._visit(this,e)}}),commaSeparated:()=>({type:"commaSeparated",_visit:function(e){return A2._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"single":return t.single();case"exploded":return t.exploded();case"commaSeparated":return t.commaSeparated();default:return t._other(e)}}};var yQ={inlinedRequestBody:e=>({...e,type:"inlinedRequestBody",_visit:function(t){return yQ._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return yQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedRequestBody":return t.inlinedRequestBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var IT={ok:e=>({value:e,type:"ok",_visit:function(t){return IT._visit(this,t)}}),error:e=>({...e,type:"error",_visit:function(t){return IT._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"ok":return t.ok(e.value);case"error":return t.error(e);default:return t._other(e)}}};var XC={body:e=>({value:e,type:"body",_visit:function(t){return XC._visit(this,t)}}),stream:e=>({value:e,type:"stream",_visit:function(t){return XC._visit(this,t)}}),sse:e=>({value:e,type:"sse",_visit:function(t){return XC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"body":return t.body(e.value);case"stream":return t.stream(e.value);case"sse":return t.sse(e.value);default:return t._other(e)}}};var e8s={};mo(e8s,{ApiDefinitionSource:()=>mne,ApiVersionScheme:()=>r1i,ErrorDiscriminationStrategy:()=>SEe});var mne={proto:e=>({...e,type:"proto",_visit:function(t){return mne._visit(this,t)}}),openapi:()=>({type:"openapi",_visit:function(e){return mne._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"proto":return t.proto(e);case"openapi":return t.openapi();default:return t._other(e)}}};var r1i={header:e=>({...e,type:"header",_visit:function(t){return r1i._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"header":return t.header(e);default:return t._other(e)}}};var SEe={statusCode:()=>({type:"statusCode",_visit:function(e){return SEe._visit(this,e)}}),property:e=>({...e,type:"property",_visit:function(t){return SEe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"statusCode":return t.statusCode();case"property":return t.property(e);default:return t._other(e)}}};var t8s={};mo(t8s,{ProtobufMethodType:()=>PVt,ProtobufType:()=>Kj,WellKnownProtobufType:()=>id});var Kj={wellKnown:e=>({value:e,type:"wellKnown",_visit:function(t){return Kj._visit(this,t)}}),userDefined:e=>({...e,type:"userDefined",_visit:function(t){return Kj._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"wellKnown":return t.wellKnown(e.value);case"userDefined":return t.userDefined(e);default:return t._other(e)}}};var id={any:()=>({type:"any",_visit:function(e){return id._visit(this,e)}}),api:()=>({type:"api",_visit:function(e){return id._visit(this,e)}}),boolValue:()=>({type:"boolValue",_visit:function(e){return id._visit(this,e)}}),bytesValue:()=>({type:"bytesValue",_visit:function(e){return id._visit(this,e)}}),doubleValue:()=>({type:"doubleValue",_visit:function(e){return id._visit(this,e)}}),duration:()=>({type:"duration",_visit:function(e){return id._visit(this,e)}}),empty:()=>({type:"empty",_visit:function(e){return id._visit(this,e)}}),enum:()=>({type:"enum",_visit:function(e){return id._visit(this,e)}}),enumValue:()=>({type:"enumValue",_visit:function(e){return id._visit(this,e)}}),field:()=>({type:"field",_visit:function(e){return id._visit(this,e)}}),fieldCardinality:()=>({type:"fieldCardinality",_visit:function(e){return id._visit(this,e)}}),fieldKind:()=>({type:"fieldKind",_visit:function(e){return id._visit(this,e)}}),fieldMask:()=>({type:"fieldMask",_visit:function(e){return id._visit(this,e)}}),floatValue:()=>({type:"floatValue",_visit:function(e){return id._visit(this,e)}}),int32Value:()=>({type:"int32Value",_visit:function(e){return id._visit(this,e)}}),int64Value:()=>({type:"int64Value",_visit:function(e){return id._visit(this,e)}}),listValue:()=>({type:"listValue",_visit:function(e){return id._visit(this,e)}}),method:()=>({type:"method",_visit:function(e){return id._visit(this,e)}}),mixin:()=>({type:"mixin",_visit:function(e){return id._visit(this,e)}}),nullValue:()=>({type:"nullValue",_visit:function(e){return id._visit(this,e)}}),option:()=>({type:"option",_visit:function(e){return id._visit(this,e)}}),sourceContext:()=>({type:"sourceContext",_visit:function(e){return id._visit(this,e)}}),stringValue:()=>({type:"stringValue",_visit:function(e){return id._visit(this,e)}}),struct:()=>({type:"struct",_visit:function(e){return id._visit(this,e)}}),syntax:()=>({type:"syntax",_visit:function(e){return id._visit(this,e)}}),timestamp:()=>({type:"timestamp",_visit:function(e){return id._visit(this,e)}}),type:()=>({type:"type",_visit:function(e){return id._visit(this,e)}}),uint32Value:()=>({type:"uint32Value",_visit:function(e){return id._visit(this,e)}}),uint64Value:()=>({type:"uint64Value",_visit:function(e){return id._visit(this,e)}}),value:()=>({type:"value",_visit:function(e){return id._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"any":return t.any();case"api":return t.api();case"boolValue":return t.boolValue();case"bytesValue":return t.bytesValue();case"doubleValue":return t.doubleValue();case"duration":return t.duration();case"empty":return t.empty();case"enum":return t.enum();case"enumValue":return t.enumValue();case"field":return t.field();case"fieldCardinality":return t.fieldCardinality();case"fieldKind":return t.fieldKind();case"fieldMask":return t.fieldMask();case"floatValue":return t.floatValue();case"int32Value":return t.int32Value();case"int64Value":return t.int64Value();case"listValue":return t.listValue();case"method":return t.method();case"mixin":return t.mixin();case"nullValue":return t.nullValue();case"option":return t.option();case"sourceContext":return t.sourceContext();case"stringValue":return t.stringValue();case"struct":return t.struct();case"syntax":return t.syntax();case"timestamp":return t.timestamp();case"type":return t.type();case"uint32Value":return t.uint32Value();case"uint64Value":return t.uint64Value();case"value":return t.value();default:return t._other(e)}}};var PVt={Unary:"UNARY",ClientStream:"CLIENT_STREAM",ServerStream:"SERVER_STREAM",BidirectionalStream:"BIDIRECTIONAL_STREAM",_visit:(e,t)=>{switch(e){case PVt.Unary:return t.unary();case PVt.ClientStream:return t.clientStream();case PVt.ServerStream:return t.serverStream();case PVt.BidirectionalStream:return t.bidirectionalStream();default:return t._other()}}};var r8s={};mo(r8s,{PublishTarget:()=>nkt,PublishingConfig:()=>ikt});var ikt={github:e=>({...e,type:"github",_visit:function(t){return ikt._visit(this,t)}}),direct:e=>({...e,type:"direct",_visit:function(t){return ikt._visit(this,t)}}),filesystem:e=>({...e,type:"filesystem",_visit:function(t){return ikt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"github":return t.github(e);case"direct":return t.direct(e);case"filesystem":return t.filesystem(e);default:return t._other(e)}}};var nkt={postman:e=>({...e,type:"postman",_visit:function(t){return nkt._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return nkt._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return nkt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"postman":return t.postman(e);case"npm":return t.npm(e);case"maven":return t.maven(e);default:return t._other(e)}}};var i8s={};mo(i8s,{ContainerType:()=>Py,ExampleContainer:()=>mm,ExamplePrimitive:()=>Fd,ExampleSingleUnionTypeProperties:()=>i3,ExampleTypeReferenceShape:()=>Vh,ExampleTypeShape:()=>Rw,Literal:()=>D9,NamedTypeDefault:()=>hzn,ObjectPropertyAccess:()=>akt,PrimitiveTypeV1:()=>Uh,PrimitiveTypeV2:()=>Ed,ResolvedTypeReference:()=>lW,ShapeType:()=>jVt,SingleUnionTypeProperties:()=>S9,Source:()=>_li,Type:()=>Sb,TypeReference:()=>Kc});var _li={proto:e=>({value:e,type:"proto",_visit:function(t){return _li._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"proto":return t.proto(e.value);default:return t._other(e)}}};var Sb={alias:e=>({...e,type:"alias",_visit:function(t){return Sb._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Sb._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Sb._visit(this,t)}}),union:e=>({...e,type:"union",_visit:function(t){return Sb._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return Sb._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"union":return t.union(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var lW={container:e=>({container:e,type:"container",_visit:function(t){return lW._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return lW._visit(this,t)}}),primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return lW._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return lW._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"container":return t.container(e.container);case"named":return t.named(e);case"primitive":return t.primitive(e.primitive);case"unknown":return t.unknown();default:return t._other(e)}}};var jVt={Enum:"ENUM",Object:"OBJECT",Union:"UNION",UndiscriminatedUnion:"UNDISCRIMINATED_UNION",_visit:(e,t)=>{switch(e){case jVt.Enum:return t.enum();case jVt.Object:return t.object();case jVt.Union:return t.union();case jVt.UndiscriminatedUnion:return t.undiscriminatedUnion();default:return t._other()}}};var akt={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY",_visit:(e,t)=>{switch(e){case akt.ReadOnly:return t.readOnly();case akt.WriteOnly:return t.writeOnly();default:return t._other()}}};var S9={samePropertiesAsObject:e=>({...e,propertiesType:"samePropertiesAsObject",_visit:function(t){return S9._visit(this,t)}}),singleProperty:e=>({...e,propertiesType:"singleProperty",_visit:function(t){return S9._visit(this,t)}}),noProperties:()=>({propertiesType:"noProperties",_visit:function(e){return S9._visit(this,e)}}),_visit:(e,t)=>{switch(e.propertiesType){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties();default:return t._other(e)}}};var Kc={container:e=>({container:e,type:"container",_visit:function(t){return Kc._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return Kc._visit(this,t)}}),primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return Kc._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return Kc._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"container":return t.container(e.container);case"named":return t.named(e);case"primitive":return t.primitive(e.primitive);case"unknown":return t.unknown();default:return t._other(e)}}};var hzn={enum:e=>({...e,type:"enum",_visit:function(t){return hzn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"enum":return t.enum(e);default:return t._other(e)}}};var Py={list:e=>({list:e,type:"list",_visit:function(t){return Py._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Py._visit(this,t)}}),nullable:e=>({nullable:e,type:"nullable",_visit:function(t){return Py._visit(this,t)}}),optional:e=>({optional:e,type:"optional",_visit:function(t){return Py._visit(this,t)}}),set:e=>({set:e,type:"set",_visit:function(t){return Py._visit(this,t)}}),literal:e=>({literal:e,type:"literal",_visit:function(t){return Py._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e.list);case"map":return t.map(e);case"nullable":return t.nullable(e.nullable);case"optional":return t.optional(e.optional);case"set":return t.set(e.set);case"literal":return t.literal(e.literal);default:return t._other(e)}}};var Uh={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER",_visit:(e,t)=>{switch(e){case Uh.Integer:return t.integer();case Uh.Long:return t.long();case Uh.Uint:return t.uint();case Uh.Uint64:return t.uint64();case Uh.Float:return t.float();case Uh.Double:return t.double();case Uh.Boolean:return t.boolean();case Uh.String:return t.string();case Uh.Date:return t.date();case Uh.DateTime:return t.dateTime();case Uh.Uuid:return t.uuid();case Uh.Base64:return t.base64();case Uh.BigInteger:return t.bigInteger();default:return t._other()}}};var Ed={integer:e=>({...e,type:"integer",_visit:function(t){return Ed._visit(this,t)}}),long:e=>({...e,type:"long",_visit:function(t){return Ed._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ed._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ed._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ed._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ed._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ed._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ed._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ed._visit(this,t)}}),dateTime:e=>({...e,type:"dateTime",_visit:function(t){return Ed._visit(this,t)}}),uuid:e=>({...e,type:"uuid",_visit:function(t){return Ed._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ed._visit(this,t)}}),bigInteger:e=>({...e,type:"bigInteger",_visit:function(t){return Ed._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"integer":return t.integer(e);case"long":return t.long(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"boolean":return t.boolean(e);case"string":return t.string(e);case"date":return t.date(e);case"dateTime":return t.dateTime(e);case"uuid":return t.uuid(e);case"base64":return t.base64(e);case"bigInteger":return t.bigInteger(e);default:return t._other(e)}}};var D9={string:e=>({string:e,type:"string",_visit:function(t){return D9._visit(this,t)}}),boolean:e=>({boolean:e,type:"boolean",_visit:function(t){return D9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"string":return t.string(e.string);case"boolean":return t.boolean(e.boolean);default:return t._other(e)}}};var Rw={alias:e=>({...e,type:"alias",_visit:function(t){return Rw._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Rw._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Rw._visit(this,t)}}),union:e=>({...e,type:"union",_visit:function(t){return Rw._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return Rw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"union":return t.union(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var i3={samePropertiesAsObject:e=>({...e,type:"samePropertiesAsObject",_visit:function(t){return i3._visit(this,t)}}),singleProperty:e=>({...e,type:"singleProperty",_visit:function(t){return i3._visit(this,t)}}),noProperties:()=>({type:"noProperties",_visit:function(e){return i3._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties();default:return t._other(e)}}};var Vh={primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return Vh._visit(this,t)}}),container:e=>({container:e,type:"container",_visit:function(t){return Vh._visit(this,t)}}),unknown:e=>({unknown:e,type:"unknown",_visit:function(t){return Vh._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return Vh._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.primitive);case"container":return t.container(e.container);case"unknown":return t.unknown(e.unknown);case"named":return t.named(e);default:return t._other(e)}}};var mm={list:e=>({...e,type:"list",_visit:function(t){return mm._visit(this,t)}}),set:e=>({...e,type:"set",_visit:function(t){return mm._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return mm._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return mm._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return mm._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return mm._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e);case"set":return t.set(e);case"optional":return t.optional(e);case"nullable":return t.nullable(e);case"map":return t.map(e);case"literal":return t.literal(e);default:return t._other(e)}}};var Fd={integer:e=>({integer:e,type:"integer",_visit:function(t){return Fd._visit(this,t)}}),long:e=>({long:e,type:"long",_visit:function(t){return Fd._visit(this,t)}}),uint:e=>({uint:e,type:"uint",_visit:function(t){return Fd._visit(this,t)}}),uint64:e=>({uint64:e,type:"uint64",_visit:function(t){return Fd._visit(this,t)}}),float:e=>({float:e,type:"float",_visit:function(t){return Fd._visit(this,t)}}),double:e=>({double:e,type:"double",_visit:function(t){return Fd._visit(this,t)}}),boolean:e=>({boolean:e,type:"boolean",_visit:function(t){return Fd._visit(this,t)}}),string:e=>({string:e,type:"string",_visit:function(t){return Fd._visit(this,t)}}),date:e=>({date:e,type:"date",_visit:function(t){return Fd._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Fd._visit(this,t)}}),uuid:e=>({uuid:e,type:"uuid",_visit:function(t){return Fd._visit(this,t)}}),base64:e=>({base64:e,type:"base64",_visit:function(t){return Fd._visit(this,t)}}),bigInteger:e=>({bigInteger:e,type:"bigInteger",_visit:function(t){return Fd._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"integer":return t.integer(e.integer);case"long":return t.long(e.long);case"uint":return t.uint(e.uint);case"uint64":return t.uint64(e.uint64);case"float":return t.float(e.float);case"double":return t.double(e.double);case"boolean":return t.boolean(e.boolean);case"string":return t.string(e.string);case"date":return t.date(e.date);case"datetime":return t.datetime(e);case"uuid":return t.uuid(e.uuid);case"base64":return t.base64(e.base64);case"bigInteger":return t.bigInteger(e.bigInteger);default:return t._other(e)}}};var wip={};var n8s={};mo(n8s,{WebhookHttpMethod:()=>XSo,WebhookPayload:()=>fW});var fW={inlinedPayload:e=>({...e,type:"inlinedPayload",_visit:function(t){return fW._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return fW._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedPayload":return t.inlinedPayload(e);case"reference":return t.reference(e);default:return t._other(e)}}};var XSo={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case XSo.Get:return t.get();case XSo.Post:return t.post();default:return t._other()}}};var a8s={};mo(a8s,{ExampleWebSocketMessageBody:()=>DEe,WebSocketMessageBody:()=>E9,WebSocketMessageOrigin:()=>ZSo});var ZSo={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case ZSo.Client:return t.client();case ZSo.Server:return t.server();default:return t._other()}}};var E9={inlinedBody:e=>({...e,type:"inlinedBody",_visit:function(t){return E9._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return E9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedBody":return t.inlinedBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var DEe={inlinedBody:e=>({...e,type:"inlinedBody",_visit:function(t){return DEe._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return DEe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedBody":return t.inlinedBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var Pp={};mo(Pp,{AliasTypeDeclaration:()=>RAo,ApiAuth:()=>gDo,ApiDefinitionSource:()=>Aqo,ApiDefinitionSourceId:()=>Eqo,ApiVersionScheme:()=>yAo,AudienceDefinition:()=>iDo,AudienceReference:()=>gzn,AuthScheme:()=>bDo,AuthSchemesRequirement:()=>nDo,AutogeneratedEndpointExample:()=>iAo,Availability:()=>skt,AvailabilityStatus:()=>sDo,Base64Type:()=>BAo,BasicAuthScheme:()=>oDo,BasicAuthValues:()=>MEo,BearerAuthScheme:()=>aDo,BearerAuthValues:()=>AEo,BigIntegerType:()=>IAo,BooleanType:()=>EAo,BytesRequest:()=>Hzn,BytesResponse:()=>Jzn,Constants:()=>jDo,ContainerType:()=>nxn,CsharpProtobufFileOptions:()=>nAo,CursorPagination:()=>UMo,CustomPagination:()=>WMo,DateTimeType:()=>TAo,DateType:()=>qAo,Declaration:()=>S6,DeclaredErrorName:()=>s1i,DeclaredServiceName:()=>pMo,DeclaredTypeName:()=>CB,DirectPublish:()=>zqo,DisplayName:()=>Pzn,DoubleType:()=>DAo,DoubleValidationRules:()=>SAo,Encoding:()=>txn,EndpointId:()=>SVt,EndpointName:()=>hMo,EndpointReference:()=>Ozn,EnumTypeDeclaration:()=>rxn,EnumTypeReference:()=>nnp,EnumValue:()=>hli,EnvironmentBaseUrlId:()=>oZ,EnvironmentBaseUrlWithId:()=>oEo,EnvironmentId:()=>Yxe,EnvironmentUrl:()=>lkt,EnvironmentVariable:()=>Jxe,Environments:()=>cEo,EnvironmentsConfig:()=>Azn,ErrorDeclaration:()=>wEo,ErrorDeclarationDiscriminantValue:()=>tnp,ErrorDiscriminationByPropertyStrategy:()=>gqo,ErrorDiscriminationStrategy:()=>Oqo,ErrorId:()=>u1i,EscapedString:()=>ODo,ExampleAliasType:()=>Wqo,ExampleCodeSample:()=>JMo,ExampleCodeSampleLanguage:()=>$Mo,ExampleCodeSampleSdk:()=>QMo,ExampleContainer:()=>Zqo,ExampleDatetime:()=>Xqo,ExampleEndpointCall:()=>Zzn,ExampleEndpointErrorResponse:()=>eAo,ExampleEndpointSuccessResponse:()=>kMo,ExampleEnumType:()=>Vqo,ExampleError:()=>jEo,ExampleHeader:()=>oWi,ExampleInlinedRequestBody:()=>Xzn,ExampleInlinedRequestBodyProperty:()=>YMo,ExampleKeyValuePair:()=>oTo,ExampleListContainer:()=>tTo,ExampleLiteralContainer:()=>eTo,ExampleMapContainer:()=>aTo,ExampleNamedType:()=>kqo,ExampleNullableContainer:()=>nTo,ExampleObjectProperty:()=>Gqo,ExampleObjectType:()=>cxn,ExampleObjectTypeWithTypeId:()=>Kqo,ExampleOptionalContainer:()=>iTo,ExamplePathParameter:()=>c1i,ExamplePrimitive:()=>lxn,ExampleQueryParameter:()=>Yzn,ExampleQueryParameterShape:()=>KMo,ExampleRequestBody:()=>XMo,ExampleResponse:()=>tAo,ExampleServerSideEvent:()=>ZMo,ExampleSetContainer:()=>rTo,ExampleSingleUnionType:()=>Qqo,ExampleSingleUnionTypeProperties:()=>Jqo,ExampleType:()=>l1a,ExampleTypeReference:()=>nm,ExampleTypeReferenceShape:()=>Yqo,ExampleTypeShape:()=>axn,ExampleUndiscriminatedUnionType:()=>$qo,ExampleUnionType:()=>Hqo,ExampleWebSocketMessage:()=>_qo,ExampleWebSocketMessageBody:()=>pqo,ExampleWebSocketSession:()=>hqo,ExampleWebhookCall:()=>iqo,FeatureId:()=>PDo,FernFilepath:()=>jne,FileDownloadResponse:()=>Gzn,FileProperty:()=>OMo,FilePropertyArray:()=>gMo,FilePropertySingle:()=>bMo,FileUploadBodyProperty:()=>PMo,FileUploadBodyPropertyEncoding:()=>mMo,FileUploadRequest:()=>wMo,FileUploadRequestProperty:()=>jMo,Filesystem:()=>xqo,FloatType:()=>wAo,GithubPublish:()=>Iqo,GrpcTransport:()=>uAo,HeaderApiVersionScheme:()=>hAo,HeaderAuthScheme:()=>uDo,HeaderAuthValues:()=>qEo,HttpEndpoint:()=>fAo,HttpEndpointSource:()=>lAo,HttpHeader:()=>uZ,HttpMethod:()=>Szn,HttpPath:()=>Xxe,HttpPathPart:()=>_Mo,HttpRequestBody:()=>SMo,HttpRequestBodyReference:()=>Wzn,HttpResponse:()=>NMo,HttpResponseBody:()=>RMo,HttpService:()=>_Ao,InlinedRequestBody:()=>vMo,InlinedRequestBodyProperty:()=>Vzn,InlinedWebSocketMessageBody:()=>cqo,InlinedWebSocketMessageBodyProperty:()=>sqo,InlinedWebhookPayload:()=>eqo,InlinedWebhookPayloadProperty:()=>kAo,IntegerType:()=>OAo,IntegerValidationRules:()=>gAo,IntermediateRepresentation:()=>inp,JsonEncoding:()=>dAo,JsonResponse:()=>$zn,JsonResponseBody:()=>qMo,JsonResponseBodyWithProperty:()=>TMo,JsonStreamChunk:()=>CMo,Literal:()=>Lqo,LongType:()=>mAo,MapType:()=>Uqo,MavenPublishTarget:()=>Bqo,MultipleBaseUrlsEnvironment:()=>uEo,MultipleBaseUrlsEnvironments:()=>sEo,MultipleEnvironmentUrlValues:()=>EEo,Name:()=>Pd,NameAndWireValue:()=>qh,NamedType:()=>Fqo,NamedTypeDefault:()=>Nqo,NonStreamHttpResponseBody:()=>zMo,NpmPublishTarget:()=>Cqo,OAuthAccessTokenRequestProperties:()=>fDo,OAuthAccessTokenResponseProperties:()=>mzn,OAuthClientCredentials:()=>hDo,OAuthConfiguration:()=>yDo,OAuthRefreshEndpoint:()=>_Do,OAuthRefreshTokenRequestProperties:()=>pDo,OAuthScheme:()=>vDo,OAuthTokenEndpoint:()=>dDo,OAuthValues:()=>TEo,ObjectProperty:()=>aZ,ObjectPropertyAccess:()=>cDo,ObjectTypeDeclaration:()=>NAo,OffsetPagination:()=>VMo,Package:()=>uxn,PackageNavigationConfig:()=>vqo,Pagination:()=>HMo,PathParameter:()=>DVt,PathParameterLocation:()=>yMo,PlatformHeaders:()=>Pqo,PostmanPublishTarget:()=>Tqo,PrimitiveType:()=>ixn,PrimitiveTypeV1:()=>qzn,PrimitiveTypeV2:()=>zAo,ProtoEncoding:()=>pAo,ProtoSource:()=>Mqo,ProtoSourceInfo:()=>cAo,ProtobufFile:()=>kzn,ProtobufFileOptions:()=>aAo,ProtobufMethodType:()=>sAo,ProtobufService:()=>oAo,ProtobufType:()=>JAo,PublishTarget:()=>sxn,PublishingConfig:()=>Rqo,QueryParameter:()=>a1i,ReadmeConfig:()=>Dqo,RequestProperty:()=>bQ,RequestPropertyValue:()=>lDo,ResolvedNamedType:()=>bAo,ResolvedTypeReference:()=>xAo,ResponseError:()=>FMo,ResponseErrors:()=>LMo,ResponseProperty:()=>Pne,SafeAndUnsafeString:()=>aWi,SdkConfig:()=>jqo,SdkRequest:()=>AMo,SdkRequestBodyType:()=>DMo,SdkRequestShape:()=>MMo,SdkRequestWrapper:()=>EMo,ServiceId:()=>okt,ServiceTypeReferenceInfo:()=>Sqo,ShapeType:()=>vAo,SingleBaseUrlEnvironment:()=>nEo,SingleBaseUrlEnvironments:()=>aEo,SingleUnionType:()=>UAo,SingleUnionTypeProperties:()=>LAo,SingleUnionTypeProperty:()=>FAo,Source:()=>KAo,SourceConfig:()=>qqo,SseStreamChunk:()=>IMo,StreamParameterResponse:()=>xMo,StreamingResponse:()=>Kzn,StringType:()=>AAo,StringValidationRules:()=>MAo,Subpackage:()=>bqo,SubpackageId:()=>ukt,SupportedSdkLanguage:()=>GMo,TextResponse:()=>Qzn,TextStreamChunk:()=>BMo,Transport:()=>exn,Type:()=>$Ao,TypeDeclaration:()=>YAo,TypeId:()=>kx,TypeReference:()=>Hy,Uint64Type:()=>jAo,UintType:()=>PAo,UndiscriminatedUnionMember:()=>WAo,UndiscriminatedUnionTypeDeclaration:()=>HAo,UnionTypeDeclaration:()=>VAo,UserAgent:()=>mqo,UserDefinedProtobufType:()=>QAo,UserSpecifiedEndpointExample:()=>rAo,UuidType:()=>CAo,V2AuthValues:()=>Czn,V2EndpointLocation:()=>DEo,V2EndpointLocationHttpMethod:()=>SEo,V2EnvironmentValues:()=>Tzn,V2HttpEndpointCodeSample:()=>zEo,V2HttpEndpointExample:()=>u1a,V2HttpEndpointExamples:()=>xEo,V2HttpEndpointRequest:()=>CEo,V2HttpEndpointResponse:()=>IEo,V2HttpEndpointResponseBody:()=>BEo,V2SchemaExample:()=>o1a,V2SchemaExamples:()=>A9,V2ValueExamples:()=>fkt,V2WebSocketEndpointLocation:()=>REo,V2WebSocketMessageExample:()=>NEo,V2WebSocketSessionExample:()=>s1a,V2WebSocketSessionExamples:()=>FEo,V2WebhookExample:()=>c1a,V2WebhookExamples:()=>LEo,VariableDeclaration:()=>wqo,VariableId:()=>Uzn,WebSocketChannel:()=>yqo,WebSocketChannelId:()=>wzn,WebSocketMessage:()=>dqo,WebSocketMessageBody:()=>fqo,WebSocketMessageBodyReference:()=>lqo,WebSocketMessageId:()=>oxn,WebSocketMessageOrigin:()=>uqo,WebSocketName:()=>oqo,Webhook:()=>nqo,WebhookGroup:()=>aqo,WebhookGroupId:()=>jzn,WebhookHttpMethod:()=>ZAo,WebhookId:()=>mDo,WebhookName:()=>XAo,WebhookPayload:()=>rqo,WebhookPayloadReference:()=>tqo,WellKnownProtobufType:()=>GAo,WithContentType:()=>Kxe,WithDocs:()=>Bd,WithDocsAndAvailability:()=>o1i,WithJsonExample:()=>ckt,WithV2Examples:()=>TB,audience:()=>l8s,auth:()=>f8s,commons:()=>d8s,constants:()=>p8s,dynamic:()=>IN,environment:()=>m8s,errors:()=>P8s,examples:()=>j8s,generatorExec:()=>S8s,http:()=>D8s,ir:()=>E8s,proto:()=>M8s,publish:()=>A8s,types:()=>q8s,variables:()=>T8s,webhooks:()=>C8s,websocket:()=>B8s});var l8s={};mo(l8s,{AudienceDefinition:()=>iDo,AudienceReference:()=>gzn});var ae={};mo(ae,{JsonError:()=>yzn,ParseError:()=>vzn,any:()=>Fip,bigint:()=>Dip,boolean:()=>Lip,booleanLiteral:()=>Nip,date:()=>Eip,discriminant:()=>Kip,enum_:()=>eDo,getObjectLikeUtils:()=>wVt,getObjectUtils:()=>nWi,getSchemaUtils:()=>xq,isProperty:()=>n1i,lazy:()=>Mip,lazyObject:()=>zip,list:()=>rDo,number:()=>Uip,object:()=>tDo,objectWithoutOptionalProperties:()=>Iip,optional:()=>o8s,property:()=>qip,record:()=>$ip,set:()=>Gip,string:()=>Vip,stringLiteral:()=>Rip,transform:()=>u8s,undiscriminatedUnion:()=>Jip,union:()=>Xip,unknown:()=>Wip,withParsedProperties:()=>c8s});var wj={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function rA(e,t){return`Expected ${t}. Received ${imS(e)}.`}function imS(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function M9(e){return{...e,json:Sip(e.json),parse:Sip(e.parse)}}function Sip(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1678
1678
  `)),{ok:!0,value:t}):i}}function kSo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var yzn=class e extends Error{errors;constructor(t){super(t.map(kSo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var vzn=class e extends Error{errors;constructor(t){super(t.map(kSo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function xq(e){return{optional:()=>o8s(e),transform:t=>u8s(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new vzn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new yzn(i.errors)}}}function o8s(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>wj.OPTIONAL};return{...t,...xq(t)}}function u8s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...xq(r)}}function Dip(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:rA(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:rA(t,"bigint")}]},getType:()=>wj.BIGINT};return{...M9(e),...xq(e)}}var nmS=/^([+-]?\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 Eip(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:rA(t,"string")}]}:nmS.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:rA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:rA(t,"Date object")}]},getType:()=>wj.DATE};return{...M9(e),...xq(e)}}function vQ(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...M9(r),...xq(r)}}}function eDo(e){let t=new Set(e);return vQ(wj.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:rA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:rA(i,"enum")}]}:{ok:!0,value:i})()}function Mip(e){let t=s8s(e);return{...t,...xq(t)}}function s8s(e){return{parse:(t,r)=>bzn(e).parse(t,r),json:(t,r)=>bzn(e).json(t,r),getType:()=>bzn(e).getType()}}function bzn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function i1a(e){return Object.entries(e)}function n1a(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function i1i(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 a1a(e){return Object.keys(e)}function Aip(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function wVt(e){return{withParsedProperties:t=>c8s(e,t)}}function c8s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!i1i(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:rA(i,"object")}]};let a=new Set(Object.keys(t)),u=n1a(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...xq(r),...wVt(r)}}function qip(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function n1i(e){return e.isProperty}function tDo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>n1i(i)?i.rawKey:r),_getParsedProperties:()=>a1a(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of i1a(e)){let d=n1i(l)?l.rawKey:u,s=n1i(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,Bip(s)&&a.push(d)}return Tip({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of i1a(e)){let l=n1i(u)?u.valueSchema:u;Bip(l)&&n.push(a)}return Tip({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return n1i(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>wj.OBJECT};return{...M9(t),...xq(t),...wVt(t),...nWi(t)}}function Tip({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!i1i(e))return{ok:!1,errors:[{path:a,message:rA(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function nWi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>Cip({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>Cip({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>wj.OBJECT};return{...r,...xq(r),...wVt(r),...nWi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>wj.OBJECT};return{...t,...xq(t),...wVt(t),...nWi(t)}}}}function Cip({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=Aip(a1a(t),s=>n.has(s)),l=r(n1a(t,u)),d=i(n1a(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function Bip(e){return!amS(e)}function amS(e){switch(e.getType()){case wj.ANY:case wj.UNKNOWN:case wj.OPTIONAL:return!0;default:return!1}}function Iip(e){return tDo(e)}function zip(e){let t={...s8s(e),_getRawProperties:()=>bzn(e)._getRawProperties(),_getParsedProperties:()=>bzn(e)._getParsedProperties()};return{...t,...xq(t),...wVt(t),...nWi(t)}}function rDo(e){let t={parse:(r,i)=>xip(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>xip(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>wj.LIST};return{...M9(t),...xq(t)}}function xip(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:rA(e,"list"),path:[]}]}}function Rip(e){return vQ(wj.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:rA(r,`"${e}"`)}]})()}function Nip(e){return vQ(wj.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:rA(r,`${e.toString()}`)}]})()}var Fip=vQ(wj.ANY,e=>({ok:!0,value:e}));var Lip=vQ(wj.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rA(e,"boolean")}]});var Uip=vQ(wj.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rA(e,"number")}]});var Vip=vQ(wj.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:rA(e,"string")}]});var Wip=vQ(wj.UNKNOWN,e=>({ok:!0,value:e}));function $ip(e,t){let r={parse:(i,n)=>Hip({value:i,isKeyNumeric:e.getType()===wj.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Hip({value:i,isKeyNumeric:e.getType()===wj.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>wj.RECORD};return{...M9(r),...xq(r)}}function Hip({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return i1i(e)?i1a(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:rA(e,"object")}]}}function Gip(e){let t=rDo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:rA(i,"Set")}]},getType:()=>wj.SET};return{...M9(r),...xq(r)}}function Jip(e){let t={parse:(r,i)=>Qip((n,a)=>n.parse(r,a),e,i),json:(r,i)=>Qip((n,a)=>n.json(r,a),e,i),getType:()=>wj.UNDISCRIMINATED_UNION};return{...M9(t),...xq(t)}}function Qip(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function Kip(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Xip(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=eDo(a1a(t)),a={parse:(u,l)=>Yip({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>Yip({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>wj.UNION};return{...M9(a),...xq(a),...wVt(a)}}function Yip({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!i1i(e))return{ok:!1,errors:[{path:l,message:rA(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var iDo=ae.string();var gzn=ae.string();var f8s={};mo(f8s,{ApiAuth:()=>gDo,AuthScheme:()=>bDo,AuthSchemesRequirement:()=>nDo,BasicAuthScheme:()=>oDo,BearerAuthScheme:()=>aDo,EnvironmentVariable:()=>Jxe,HeaderAuthScheme:()=>uDo,OAuthAccessTokenRequestProperties:()=>fDo,OAuthAccessTokenResponseProperties:()=>mzn,OAuthClientCredentials:()=>hDo,OAuthConfiguration:()=>yDo,OAuthRefreshEndpoint:()=>_Do,OAuthRefreshTokenRequestProperties:()=>pDo,OAuthScheme:()=>vDo,OAuthTokenEndpoint:()=>dDo});var Jxe=ae.string();var nDo=ae.enum_(["ALL","ANY"]);var aWi=ae.objectWithoutOptionalProperties({unsafeName:ae.string(),safeName:ae.string()});var Pd=ae.objectWithoutOptionalProperties({originalName:ae.string(),camelCase:aWi,pascalCase:aWi,snakeCase:aWi,screamingSnakeCase:aWi});var Bd=ae.objectWithoutOptionalProperties({docs:ae.string().optional()});var aDo=ae.objectWithoutOptionalProperties({token:Pd,tokenEnvVar:Jxe.optional()}).extend(Bd);var oDo=ae.objectWithoutOptionalProperties({username:Pd,usernameEnvVar:Jxe.optional(),password:Pd,passwordEnvVar:Jxe.optional()}).extend(Bd);var qh=ae.objectWithoutOptionalProperties({wireValue:ae.string(),name:Pd});var uDo=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy),prefix:ae.string().optional(),headerEnvVar:Jxe.optional()}).extend(Bd);var SVt=ae.string();var okt=ae.string();var ukt=ae.string();var Ozn=ae.objectWithoutOptionalProperties({endpointId:SVt,serviceId:okt,subpackageId:ukt.optional()});var o1a=ae.unknown();var A9=ae.objectWithoutOptionalProperties({userSpecifiedExamples:ae.record(ae.string(),o1a),autogeneratedExamples:ae.record(ae.string(),o1a)});var sDo=ae.enum_(["IN_DEVELOPMENT","PRE_RELEASE","GENERAL_AVAILABILITY","DEPRECATED"]);var skt=ae.objectWithoutOptionalProperties({status:sDo,message:ae.string().optional()});var S6=ae.objectWithoutOptionalProperties({availability:skt.optional()}).extend(Bd);var a1i=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy),allowMultiple:ae.boolean(),v2Examples:A9.optional()}).extend(S6);var cDo=ae.enum_(["READ_ONLY","WRITE_ONLY"]);var aZ=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy),propertyAccess:cDo.optional(),v2Examples:A9.optional()}).extend(S6);var lDo=ae.union("type",{query:a1i,body:aZ}).transform({transform:e=>{switch(e.type){case"query":return One.query(e);case"body":return One.body(e);default:return e}},untransform:({_visit:e,...t})=>t});var bQ=ae.objectWithoutOptionalProperties({propertyPath:ae.list(Pd).optional(),property:lDo});var fDo=ae.objectWithoutOptionalProperties({clientId:bQ,clientSecret:bQ,scopes:bQ.optional(),customProperties:ae.list(bQ).optional()});var Pne=ae.objectWithoutOptionalProperties({propertyPath:ae.list(Pd).optional(),property:aZ});var mzn=ae.objectWithoutOptionalProperties({accessToken:Pne,expiresIn:Pne.optional(),refreshToken:Pne.optional()});var dDo=ae.objectWithoutOptionalProperties({endpointReference:Ozn,requestProperties:fDo,responseProperties:mzn});var pDo=ae.objectWithoutOptionalProperties({refreshToken:bQ});var _Do=ae.objectWithoutOptionalProperties({endpointReference:Ozn,requestProperties:pDo,responseProperties:mzn});var hDo=ae.objectWithoutOptionalProperties({clientIdEnvVar:Jxe.optional(),clientSecretEnvVar:Jxe.optional(),tokenPrefix:ae.string().optional(),tokenHeader:ae.string().optional(),scopes:ae.list(ae.string()).optional(),tokenEndpoint:dDo,refreshEndpoint:_Do.optional()});var yDo=ae.union("type",{clientCredentials:hDo}).transform({transform:e=>{switch(e.type){case"clientCredentials":return kwi.clientCredentials(e);default:return e}},untransform:({_visit:e,...t})=>t});var vDo=ae.objectWithoutOptionalProperties({configuration:yDo}).extend(Bd);var bDo=ae.union(ae.discriminant("type","_type"),{bearer:aDo,basic:oDo,header:uDo,oauth:vDo}).transform({transform:e=>{switch(e.type){case"bearer":return BT.bearer(e);case"basic":return BT.basic(e);case"header":return BT.header(e);case"oauth":return BT.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var gDo=ae.objectWithoutOptionalProperties({requirement:nDo,schemes:ae.list(bDo)}).extend(Bd);var d8s={};mo(d8s,{Availability:()=>skt,AvailabilityStatus:()=>sDo,Declaration:()=>S6,DisplayName:()=>Pzn,EndpointId:()=>SVt,EndpointReference:()=>Ozn,ErrorId:()=>u1i,EscapedString:()=>ODo,FeatureId:()=>PDo,FernFilepath:()=>jne,Name:()=>Pd,NameAndWireValue:()=>qh,SafeAndUnsafeString:()=>aWi,ServiceId:()=>okt,SubpackageId:()=>ukt,TypeId:()=>kx,WebSocketChannelId:()=>wzn,WebhookGroupId:()=>jzn,WebhookId:()=>mDo,WithContentType:()=>Kxe,WithDocs:()=>Bd,WithDocsAndAvailability:()=>o1i,WithJsonExample:()=>ckt});var o1i=ae.objectWithoutOptionalProperties({availability:skt.optional()}).extend(Bd);var jne=ae.objectWithoutOptionalProperties({allParts:ae.list(Pd),packagePath:ae.list(Pd),file:Pd.optional()});var Pzn=ae.string();var ODo=ae.objectWithoutOptionalProperties({original:ae.string()});var ckt=ae.objectWithoutOptionalProperties({jsonExample:ae.unknown()});var Kxe=ae.objectWithoutOptionalProperties({contentType:ae.string().optional()});var kx=ae.string();var u1i=ae.string();var jzn=ae.string();var mDo=ae.string();var wzn=ae.string();var PDo=ae.string();var p8s={};mo(p8s,{Constants:()=>jDo});var jDo=ae.objectWithoutOptionalProperties({errorInstanceIdKey:qh});var IN={};mo(IN,{AliasType:()=>JDo,Auth:()=>MDo,AuthValues:()=>BDo,BasicAuth:()=>wDo,BasicAuthValues:()=>ADo,BearerAuth:()=>SDo,BearerAuthValues:()=>qDo,BodyRequest:()=>IDo,Declaration:()=>gQ,DiscriminatedUnionType:()=>tEo,DynamicIntermediateRepresentation:()=>gEo,Endpoint:()=>QDo,EndpointExample:()=>GDo,EndpointLocation:()=>Dzn,EndpointSnippetRequest:()=>$Do,EndpointSnippetResponse:()=>Zip,EnumType:()=>KDo,EnvironmentValues:()=>HDo,ErrorSeverity:()=>OEo,Error_:()=>mEo,FileUploadRequestBody:()=>RDo,FileUploadRequestBodyProperty:()=>xDo,GeneratorConfig:()=>bEo,GeneratorOutputConfig:()=>vEo,GoPublishInfo:()=>lEo,HeaderAuth:()=>DDo,HeaderAuthValues:()=>TDo,InlinedRequest:()=>LDo,InlinedRequestBody:()=>NDo,InlinedRequestMetadata:()=>FDo,LiteralType:()=>PEo,MapType:()=>enp,MavenPublishInfo:()=>fEo,MultipleEnvironmentUrlValues:()=>WDo,NamedParameter:()=>nz,NamedType:()=>iEo,NpmPublishInfo:()=>dEo,NugetPublishInfo:()=>pEo,OAuth:()=>EDo,OAuthValues:()=>CDo,ObjectType:()=>YDo,PublishInfo:()=>yEo,PypiPublishInfo:()=>_Eo,ReferencedRequestBody:()=>zDo,ReferencedRequestBodyType:()=>Ezn,Request:()=>UDo,Response:()=>VDo,RubyGemsPublishInfo:()=>hEo,SingleDiscriminatedUnionType:()=>eEo,SingleDiscriminatedUnionTypeNoProperties:()=>kDo,SingleDiscriminatedUnionTypeObject:()=>XDo,SingleDiscriminatedUnionTypeSingleProperty:()=>ZDo,TypeReference:()=>kip,UndiscriminatedUnionType:()=>rEo,Values:()=>Mzn,auth:()=>_8s,declaration:()=>h8s,endpoints:()=>y8s,environment:()=>v8s,ir:()=>b8s,snippets:()=>g8s,types:()=>O8s});var _8s={};mo(_8s,{Auth:()=>MDo,AuthValues:()=>BDo,BasicAuth:()=>wDo,BasicAuthValues:()=>ADo,BearerAuth:()=>SDo,BearerAuthValues:()=>qDo,HeaderAuth:()=>DDo,HeaderAuthValues:()=>TDo,OAuth:()=>EDo,OAuthValues:()=>CDo});var wDo=ae.objectWithoutOptionalProperties({username:Pd,password:Pd});var SDo=ae.objectWithoutOptionalProperties({token:Pd});var nz=ae.objectWithoutOptionalProperties({name:qh,typeReference:ae.lazy(()=>IN.TypeReference)});var DDo=ae.objectWithoutOptionalProperties({header:nz});var EDo=ae.objectWithoutOptionalProperties({clientId:Pd,clientSecret:Pd});var MDo=ae.union("type",{basic:wDo,bearer:SDo,header:DDo,oauth:EDo}).transform({transform:e=>{switch(e.type){case"basic":return bs.Auth.basic(e);case"bearer":return bs.Auth.bearer(e);case"header":return bs.Auth.header(e);case"oauth":return bs.Auth.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var ADo=ae.objectWithoutOptionalProperties({username:ae.string(),password:ae.string()});var qDo=ae.objectWithoutOptionalProperties({token:ae.string()});var TDo=ae.objectWithoutOptionalProperties({value:ae.unknown()});var CDo=ae.objectWithoutOptionalProperties({clientId:ae.string(),clientSecret:ae.string()});var BDo=ae.union("type",{basic:ADo,bearer:qDo,header:TDo,oauth:CDo}).transform({transform:e=>{switch(e.type){case"basic":return bs.AuthValues.basic(e);case"bearer":return bs.AuthValues.bearer(e);case"header":return bs.AuthValues.header(e);case"oauth":return bs.AuthValues.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var h8s={};mo(h8s,{Declaration:()=>gQ});var gQ=ae.objectWithoutOptionalProperties({fernFilepath:jne,name:Pd});var y8s={};mo(y8s,{BodyRequest:()=>IDo,Endpoint:()=>QDo,EndpointExample:()=>GDo,EndpointLocation:()=>Dzn,FileUploadRequestBody:()=>RDo,FileUploadRequestBodyProperty:()=>xDo,InlinedRequest:()=>LDo,InlinedRequestBody:()=>NDo,InlinedRequestMetadata:()=>FDo,ReferencedRequestBody:()=>zDo,ReferencedRequestBodyType:()=>Ezn,Request:()=>UDo,Response:()=>VDo});var Szn=ae.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var Dzn=ae.objectWithoutOptionalProperties({method:Szn,path:ae.string()});var Ezn=ae.union("type",{bytes:ae.object({}),typeReference:ae.object({value:ae.lazy(()=>IN.TypeReference)})}).transform({transform:e=>{switch(e.type){case"bytes":return bs.ReferencedRequestBodyType.bytes();case"typeReference":return bs.ReferencedRequestBodyType.typeReference(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var IDo=ae.objectWithoutOptionalProperties({pathParameters:ae.list(nz).optional(),body:Ezn.optional()});var zDo=ae.objectWithoutOptionalProperties({bodyKey:Pd,bodyType:Ezn});var xDo=ae.union("type",{file:qh,fileArray:qh,bodyProperty:nz}).transform({transform:e=>{switch(e.type){case"file":return bs.FileUploadRequestBodyProperty.file(e);case"fileArray":return bs.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return bs.FileUploadRequestBodyProperty.bodyProperty(e);default:return e}},untransform:({_visit:e,...t})=>t});var RDo=ae.objectWithoutOptionalProperties({properties:ae.list(xDo)});var NDo=ae.union("type",{properties:ae.object({value:ae.list(nz)}),referenced:zDo,fileUpload:RDo}).transform({transform:e=>{switch(e.type){case"properties":return bs.InlinedRequestBody.properties(e.value);case"referenced":return bs.InlinedRequestBody.referenced(e);case"fileUpload":return bs.InlinedRequestBody.fileUpload(e);default:return e}},untransform:({_visit:e,...t})=>t});var FDo=ae.objectWithoutOptionalProperties({includePathParameters:ae.boolean(),onlyPathParameters:ae.boolean()});var LDo=ae.objectWithoutOptionalProperties({declaration:gQ,pathParameters:ae.list(nz).optional(),queryParameters:ae.list(nz).optional(),headers:ae.list(nz).optional(),body:NDo.optional(),metadata:FDo.optional()});var UDo=ae.union("type",{body:IDo,inlined:LDo}).transform({transform:e=>{switch(e.type){case"body":return bs.Request.body(e);case"inlined":return bs.Request.inlined(e);default:return e}},untransform:({_visit:e,...t})=>t});var VDo=ae.union("type",{json:ae.object({})}).transform({transform:e=>{switch(e.type){case"json":return bs.Response.json();default:return e}},untransform:({_visit:e,...t})=>t});var Yxe=ae.string();var oZ=ae.string();var lkt=ae.string();var WDo=ae.record(oZ,lkt);var HDo=ae.undiscriminatedUnion([Yxe,WDo]);var Mzn=ae.record(ae.string(),ae.unknown());var $Do=ae.objectWithoutOptionalProperties({endpoint:Dzn,baseUrl:ae.property("baseURL",ae.string().optional()),environment:HDo.optional(),auth:BDo.optional(),pathParameters:Mzn.optional(),queryParameters:Mzn.optional(),headers:Mzn.optional(),requestBody:ae.unknown().optional()});var GDo=ae.objectWithoutOptionalProperties({id:ae.string(),name:ae.string().optional()}).extend($Do);var QDo=ae.objectWithoutOptionalProperties({auth:MDo.optional(),declaration:gQ,location:Dzn,request:UDo,response:VDo,examples:ae.list(GDo).optional()});var v8s={};mo(v8s,{EnvironmentValues:()=>HDo,MultipleEnvironmentUrlValues:()=>WDo});var b8s={};mo(b8s,{DynamicIntermediateRepresentation:()=>gEo,GeneratorConfig:()=>bEo,GeneratorOutputConfig:()=>vEo,GoPublishInfo:()=>lEo,MavenPublishInfo:()=>fEo,NpmPublishInfo:()=>dEo,NugetPublishInfo:()=>pEo,PublishInfo:()=>yEo,PypiPublishInfo:()=>_Eo,RubyGemsPublishInfo:()=>hEo});var JDo=ae.objectWithoutOptionalProperties({declaration:gQ,typeReference:ae.lazy(()=>IN.TypeReference)});var KDo=ae.objectWithoutOptionalProperties({declaration:gQ,values:ae.list(qh)});var YDo=ae.objectWithoutOptionalProperties({declaration:gQ,properties:ae.list(nz),additionalProperties:ae.boolean().optional()});var XDo=ae.objectWithoutOptionalProperties({typeId:kx,discriminantValue:qh,properties:ae.list(nz)});var ZDo=ae.objectWithoutOptionalProperties({typeReference:ae.lazy(()=>IN.TypeReference),discriminantValue:qh,properties:ae.list(nz).optional()});var kDo=ae.objectWithoutOptionalProperties({discriminantValue:qh,properties:ae.list(nz).optional()});var eEo=ae.union("type",{samePropertiesAsObject:XDo,singleProperty:ZDo,noProperties:kDo}).transform({transform:e=>{switch(e.type){case"samePropertiesAsObject":return bs.SingleDiscriminatedUnionType.samePropertiesAsObject(e);case"singleProperty":return bs.SingleDiscriminatedUnionType.singleProperty(e);case"noProperties":return bs.SingleDiscriminatedUnionType.noProperties(e);default:return e}},untransform:({_visit:e,...t})=>t});var tEo=ae.objectWithoutOptionalProperties({declaration:gQ,discriminant:qh,types:ae.record(ae.string(),eEo)});var rEo=ae.objectWithoutOptionalProperties({declaration:gQ,types:ae.list(ae.lazy(()=>IN.TypeReference))});var iEo=ae.union("type",{alias:JDo,enum:KDo,object:YDo,discriminatedUnion:tEo,undiscriminatedUnion:rEo}).transform({transform:e=>{switch(e.type){case"alias":return bs.NamedType.alias(e);case"enum":return bs.NamedType.enum(e);case"object":return bs.NamedType.object(e);case"discriminatedUnion":return bs.NamedType.discriminatedUnion(e);case"undiscriminatedUnion":return bs.NamedType.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var nEo=ae.objectWithoutOptionalProperties({id:Yxe,name:Pd,url:lkt}).extend(Bd);var aEo=ae.objectWithoutOptionalProperties({environments:ae.list(nEo)});var oEo=ae.objectWithoutOptionalProperties({id:oZ,name:Pd});var uEo=ae.objectWithoutOptionalProperties({id:Yxe,name:Pd,urls:ae.record(oZ,lkt)}).extend(Bd);var sEo=ae.objectWithoutOptionalProperties({baseUrls:ae.list(oEo),environments:ae.list(uEo)});var cEo=ae.union("type",{singleBaseUrl:aEo,multipleBaseUrls:sEo}).transform({transform:e=>{switch(e.type){case"singleBaseUrl":return ex.singleBaseUrl(e);case"multipleBaseUrls":return ex.multipleBaseUrls(e);default:return e}},untransform:({_visit:e,...t})=>t});var Azn=ae.objectWithoutOptionalProperties({defaultEnvironment:Yxe.optional(),environments:cEo});var lEo=ae.objectWithoutOptionalProperties({version:ae.string(),repoUrl:ae.string()});var fEo=ae.objectWithoutOptionalProperties({version:ae.string(),coordinate:ae.string(),repoUrl:ae.string().optional()});var dEo=ae.objectWithoutOptionalProperties({version:ae.string(),packageName:ae.string(),repoUrl:ae.string().optional()});var pEo=ae.objectWithoutOptionalProperties({version:ae.string(),packageName:ae.string(),repoUrl:ae.string().optional()});var _Eo=ae.objectWithoutOptionalProperties({version:ae.string(),packageName:ae.string(),repoUrl:ae.string().optional()});var hEo=ae.objectWithoutOptionalProperties({version:ae.string(),packageName:ae.string(),repoUrl:ae.string().optional()});var yEo=ae.union("type",{go:lEo,maven:fEo,npm:dEo,nuget:pEo,pypi:_Eo,rubygems:hEo}).transform({transform:e=>{switch(e.type){case"go":return bs.PublishInfo.go(e);case"maven":return bs.PublishInfo.maven(e);case"npm":return bs.PublishInfo.npm(e);case"nuget":return bs.PublishInfo.nuget(e);case"pypi":return bs.PublishInfo.pypi(e);case"rubygems":return bs.PublishInfo.rubygems(e);default:return e}},untransform:({_visit:e,...t})=>t});var vEo=ae.union("type",{publish:ae.object({value:yEo}),local:ae.object({})}).transform({transform:e=>{switch(e.type){case"publish":return bs.GeneratorOutputConfig.publish(e.value);case"local":return bs.GeneratorOutputConfig.local();default:return e}},untransform:({_visit:e,...t})=>t});var bEo=ae.objectWithoutOptionalProperties({apiName:ae.string(),organization:ae.string(),customConfig:ae.unknown(),outputConfig:vEo});var gEo=ae.objectWithoutOptionalProperties({version:ae.stringLiteral("1.0.0"),types:ae.record(kx,iEo),endpoints:ae.record(SVt,QDo),environments:Azn.optional(),headers:ae.list(nz).optional(),pathParameters:ae.list(nz).optional(),generatorConfig:bEo.optional()});var g8s={};mo(g8s,{EndpointSnippetRequest:()=>$Do,EndpointSnippetResponse:()=>Zip,ErrorSeverity:()=>OEo,Error_:()=>mEo,Values:()=>Mzn});var OEo=ae.enum_(["CRITICAL","WARNING"]);var mEo=ae.objectWithoutOptionalProperties({severity:OEo,message:ae.string()});var Zip=ae.objectWithoutOptionalProperties({snippet:ae.string(),errors:ae.list(mEo).optional()});var O8s={};mo(O8s,{AliasType:()=>JDo,DiscriminatedUnionType:()=>tEo,EnumType:()=>KDo,LiteralType:()=>PEo,MapType:()=>enp,NamedParameter:()=>nz,NamedType:()=>iEo,ObjectType:()=>YDo,SingleDiscriminatedUnionType:()=>eEo,SingleDiscriminatedUnionTypeNoProperties:()=>kDo,SingleDiscriminatedUnionTypeObject:()=>XDo,SingleDiscriminatedUnionTypeSingleProperty:()=>ZDo,TypeReference:()=>kip,UndiscriminatedUnionType:()=>rEo});var PEo=ae.union("type",{boolean:ae.object({value:ae.boolean()}),string:ae.object({value:ae.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return bs.LiteralType.boolean(e.value);case"string":return bs.LiteralType.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var qzn=ae.enum_(["INTEGER","LONG","UINT","UINT_64","FLOAT","DOUBLE","BOOLEAN","STRING","DATE","DATE_TIME","UUID","BASE_64","BIG_INTEGER"]);var kip=ae.union("type",{list:ae.object({value:ae.lazy(()=>IN.TypeReference)}),literal:ae.object({value:PEo}),map:ae.lazyObject(()=>IN.MapType),named:ae.object({value:kx}),nullable:ae.object({value:ae.lazy(()=>IN.TypeReference)}),optional:ae.object({value:ae.lazy(()=>IN.TypeReference)}),primitive:ae.object({value:qzn}),set:ae.object({value:ae.lazy(()=>IN.TypeReference)}),unknown:ae.object({})}).transform({transform:e=>{switch(e.type){case"list":return bs.TypeReference.list(e.value);case"literal":return bs.TypeReference.literal(e.value);case"map":return bs.TypeReference.map(e);case"named":return bs.TypeReference.named(e.value);case"nullable":return bs.TypeReference.nullable(e.value);case"optional":return bs.TypeReference.optional(e.value);case"primitive":return bs.TypeReference.primitive(e.value);case"set":return bs.TypeReference.set(e.value);case"unknown":return bs.TypeReference.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var enp=ae.objectWithoutOptionalProperties({key:ae.lazy(()=>IN.TypeReference),value:ae.lazy(()=>IN.TypeReference)});var m8s={};mo(m8s,{EnvironmentBaseUrlId:()=>oZ,EnvironmentBaseUrlWithId:()=>oEo,EnvironmentId:()=>Yxe,EnvironmentUrl:()=>lkt,Environments:()=>cEo,EnvironmentsConfig:()=>Azn,MultipleBaseUrlsEnvironment:()=>uEo,MultipleBaseUrlsEnvironments:()=>sEo,SingleBaseUrlEnvironment:()=>nEo,SingleBaseUrlEnvironments:()=>aEo});var P8s={};mo(P8s,{DeclaredErrorName:()=>s1i,ErrorDeclaration:()=>wEo,ErrorDeclarationDiscriminantValue:()=>tnp,ExampleError:()=>jEo});var s1i=ae.objectWithoutOptionalProperties({errorId:u1i,fernFilepath:jne,name:Pd});var jEo=ae.objectWithoutOptionalProperties({name:Pd.optional(),shape:ae.lazyObject(()=>nm)}).extend(ckt).extend(Bd);var wEo=ae.objectWithoutOptionalProperties({name:s1i,displayName:ae.string().optional(),discriminantValue:qh,type:ae.lazy(()=>Hy).optional(),statusCode:ae.number(),examples:ae.list(jEo),v2Examples:A9.optional()}).extend(Bd);var tnp=ae.union("type",{property:qh,statusCode:ae.object({})}).transform({transform:e=>{switch(e.type){case"property":return e1i.property(e);case"statusCode":return e1i.statusCode();default:return e}},untransform:({_visit:e,...t})=>t});var j8s={};mo(j8s,{BasicAuthValues:()=>MEo,BearerAuthValues:()=>AEo,HeaderAuthValues:()=>qEo,MultipleEnvironmentUrlValues:()=>EEo,OAuthValues:()=>TEo,V2AuthValues:()=>Czn,V2EndpointLocation:()=>DEo,V2EndpointLocationHttpMethod:()=>SEo,V2EnvironmentValues:()=>Tzn,V2HttpEndpointCodeSample:()=>zEo,V2HttpEndpointExample:()=>u1a,V2HttpEndpointExamples:()=>xEo,V2HttpEndpointRequest:()=>CEo,V2HttpEndpointResponse:()=>IEo,V2HttpEndpointResponseBody:()=>BEo,V2SchemaExample:()=>o1a,V2SchemaExamples:()=>A9,V2ValueExamples:()=>fkt,V2WebSocketEndpointLocation:()=>REo,V2WebSocketMessageExample:()=>NEo,V2WebSocketSessionExample:()=>s1a,V2WebSocketSessionExamples:()=>FEo,V2WebhookExample:()=>c1a,V2WebhookExamples:()=>LEo,WithV2Examples:()=>TB});var TB=ae.objectWithoutOptionalProperties({v2Examples:A9.optional()});var SEo=ae.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var DEo=ae.objectWithoutOptionalProperties({method:SEo,path:ae.string()});var EEo=ae.record(oZ,lkt);var Tzn=ae.undiscriminatedUnion([Yxe,EEo]);var MEo=ae.objectWithoutOptionalProperties({username:ae.string(),password:ae.string()});var AEo=ae.objectWithoutOptionalProperties({token:ae.string()});var qEo=ae.objectWithoutOptionalProperties({value:ae.unknown()});var TEo=ae.objectWithoutOptionalProperties({clientId:ae.string(),clientSecret:ae.string()});var Czn=ae.union("type",{basic:MEo,bearer:AEo,header:qEo,oauth:TEo}).transform({transform:e=>{switch(e.type){case"basic":return Hxe.basic(e);case"bearer":return Hxe.bearer(e);case"header":return Hxe.header(e);case"oauth":return Hxe.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var fkt=ae.record(ae.string(),ae.unknown());var CEo=ae.objectWithoutOptionalProperties({endpoint:DEo,baseUrl:ae.property("baseURL",ae.string().optional()),environment:Tzn.optional(),auth:Czn.optional(),pathParameters:fkt.optional(),queryParameters:fkt.optional(),headers:fkt.optional(),requestBody:ae.unknown().optional()}).extend(Bd);var BEo=ae.union("type",{error:ae.object({value:ae.unknown()}),json:ae.object({value:ae.unknown()}),stream:ae.object({value:ae.list(ae.unknown())})}).transform({transform:e=>{switch(e.type){case"error":return P9.error(e.value);case"json":return P9.json(e.value);case"stream":return P9.stream(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var IEo=ae.objectWithoutOptionalProperties({statusCode:ae.number().optional(),body:BEo.optional()}).extend(Bd);var zEo=ae.objectWithoutOptionalProperties({name:ae.string().optional(),language:ae.string(),code:ae.string()}).extend(Bd);var u1a=ae.objectWithoutOptionalProperties({request:CEo.optional(),response:IEo.optional(),codeSamples:ae.list(zEo).optional()});var xEo=ae.objectWithoutOptionalProperties({userSpecifiedExamples:ae.record(ae.string(),u1a),autogeneratedExamples:ae.record(ae.string(),u1a)});var REo=ae.objectWithoutOptionalProperties({path:ae.string()});var NEo=ae.objectWithoutOptionalProperties({type:ae.string(),body:ae.unknown()});var s1a=ae.objectWithoutOptionalProperties({channel:REo,baseUrl:ae.property("baseURL",ae.string().optional()),environment:Tzn.optional(),auth:Czn.optional(),pathParameters:fkt.optional(),queryParameters:fkt.optional(),headers:fkt.optional(),messages:ae.list(NEo).optional()});var FEo=ae.objectWithoutOptionalProperties({autogeneratedExamples:ae.record(ae.string(),s1a),userSpecifiedExamples:ae.record(ae.string(),s1a)});var c1a=ae.objectWithoutOptionalProperties({name:ae.string().optional(),payload:ae.unknown()});var LEo=ae.objectWithoutOptionalProperties({userSpecifiedExamples:ae.record(ae.string(),c1a),autogeneratedExamples:ae.record(ae.string(),c1a)});var S8s={};mo(S8s,{BasicLicense:()=>VEo,CustomLicense:()=>WEo,EnvironmentVariable:()=>n3,GeneratorConfig:()=>rnp,GeneratorEnvironment:()=>dMo,GeneratorOutputConfig:()=>lMo,GeneratorPublishConfig:()=>Lzn,GeneratorPublishTarget:()=>kEo,GeneratorRegistriesConfig:()=>JEo,GeneratorRegistriesConfigV2:()=>XEo,GithubOutputMode:()=>sMo,GithubPublishInfo:()=>uMo,LicenseConfig:()=>HEo,LicenseId:()=>UEo,MavenCentralSignature:()=>Bzn,MavenCentralSignatureGithubInfo:()=>tMo,MavenGithubPublishInfo:()=>rMo,MavenRegistryConfig:()=>GEo,MavenRegistryConfigV2:()=>Izn,NpmGithubPublishInfo:()=>eMo,NpmRegistryConfig:()=>QEo,NpmRegistryConfigV2:()=>zzn,NugetGithubPublishInfo:()=>oMo,NugetRegistryConfig:()=>Fzn,OutputMetadata:()=>YEo,OutputMetadataAuthor:()=>KEo,OutputMode:()=>cMo,PostmanConfig:()=>ZEo,PostmanGithubPublishInfo:()=>iMo,PublishingMetadata:()=>$Eo,PypiGithubPublishInfo:()=>nMo,PypiMetadata:()=>xzn,PypiRegistryConfig:()=>Rzn,RemoteGeneratorEnvironment:()=>fMo,RubyGemsGithubPublishInfo:()=>aMo,RubyGemsRegistryConfig:()=>Nzn,config:()=>w8s});var w8s={};mo(w8s,{BasicLicense:()=>VEo,CustomLicense:()=>WEo,EnvironmentVariable:()=>n3,GeneratorConfig:()=>rnp,GeneratorEnvironment:()=>dMo,GeneratorOutputConfig:()=>lMo,GeneratorPublishConfig:()=>Lzn,GeneratorPublishTarget:()=>kEo,GeneratorRegistriesConfig:()=>JEo,GeneratorRegistriesConfigV2:()=>XEo,GithubOutputMode:()=>sMo,GithubPublishInfo:()=>uMo,LicenseConfig:()=>HEo,LicenseId:()=>UEo,MavenCentralSignature:()=>Bzn,MavenCentralSignatureGithubInfo:()=>tMo,MavenGithubPublishInfo:()=>rMo,MavenRegistryConfig:()=>GEo,MavenRegistryConfigV2:()=>Izn,NpmGithubPublishInfo:()=>eMo,NpmRegistryConfig:()=>QEo,NpmRegistryConfigV2:()=>zzn,NugetGithubPublishInfo:()=>oMo,NugetRegistryConfig:()=>Fzn,OutputMetadata:()=>YEo,OutputMetadataAuthor:()=>KEo,OutputMode:()=>cMo,PostmanConfig:()=>ZEo,PostmanGithubPublishInfo:()=>iMo,PublishingMetadata:()=>$Eo,PypiGithubPublishInfo:()=>nMo,PypiMetadata:()=>xzn,PypiRegistryConfig:()=>Rzn,RemoteGeneratorEnvironment:()=>fMo,RubyGemsGithubPublishInfo:()=>aMo,RubyGemsRegistryConfig:()=>Nzn});var UEo=ae.enum_(["MIT","Apache-2.0"]);var VEo=ae.objectWithoutOptionalProperties({id:UEo});var WEo=ae.objectWithoutOptionalProperties({filename:ae.string()});var HEo=ae.union("type",{basic:VEo,custom:WEo}).transform({transform:e=>{switch(e.type){case"basic":return w0.LicenseConfig.basic(e);case"custom":return w0.LicenseConfig.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Eo=ae.objectWithoutOptionalProperties({packageDescription:ae.property("package_description",ae.string().optional()),publisherEmail:ae.property("publisher_email",ae.string().optional()),referenceUrl:ae.property("reference_url",ae.string().optional()),publisherName:ae.property("publisher_name",ae.string().optional())});var Bzn=ae.objectWithoutOptionalProperties({keyId:ae.string(),password:ae.string(),secretKey:ae.string()});var GEo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),username:ae.string(),password:ae.string(),group:ae.string(),signature:Bzn.optional()});var QEo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),token:ae.string(),scope:ae.string()});var JEo=ae.objectWithoutOptionalProperties({maven:GEo,npm:QEo});var Izn=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),username:ae.string(),password:ae.string(),coordinate:ae.string(),signature:Bzn.optional()});var zzn=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),token:ae.string(),packageName:ae.string()});var KEo=ae.objectWithoutOptionalProperties({name:ae.string(),email:ae.string()});var YEo=ae.objectWithoutOptionalProperties({description:ae.string().optional(),authors:ae.list(KEo).optional()});var xzn=ae.objectWithoutOptionalProperties({keywords:ae.list(ae.string()).optional(),documentationLink:ae.string().optional(),homepageLink:ae.string().optional()}).extend(YEo);var Rzn=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),username:ae.string(),password:ae.string(),packageName:ae.string(),pypiMetadata:xzn.optional()});var Nzn=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),apiKey:ae.string(),packageName:ae.string()});var Fzn=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),apiKey:ae.string(),packageName:ae.string()});var XEo=ae.objectWithoutOptionalProperties({maven:Izn,npm:zzn,pypi:Rzn,rubygems:Nzn,nuget:Fzn});var ZEo=ae.objectWithoutOptionalProperties({apiKey:ae.string(),workspaceId:ae.string()});var kEo=ae.union("type",{maven:Izn,npm:zzn,pypi:Rzn,postman:ZEo,rubygems:Nzn,nuget:Fzn}).transform({transform:e=>{switch(e.type){case"maven":return w0.GeneratorPublishTarget.maven(e);case"npm":return w0.GeneratorPublishTarget.npm(e);case"pypi":return w0.GeneratorPublishTarget.pypi(e);case"postman":return w0.GeneratorPublishTarget.postman(e);case"rubygems":return w0.GeneratorPublishTarget.rubygems(e);case"nuget":return w0.GeneratorPublishTarget.nuget(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lzn=ae.objectWithoutOptionalProperties({registries:JEo,registriesV2:XEo,publishTarget:kEo.optional(),version:ae.string()});var n3=ae.string();var eMo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),packageName:ae.string(),tokenEnvironmentVariable:n3,shouldGeneratePublishWorkflow:ae.boolean().optional()});var tMo=ae.objectWithoutOptionalProperties({keyIdEnvironmentVariable:n3,passwordEnvironmentVariable:n3,secretKeyEnvironmentVariable:n3});var rMo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),coordinate:ae.string(),usernameEnvironmentVariable:n3,passwordEnvironmentVariable:n3,signature:tMo.optional(),shouldGeneratePublishWorkflow:ae.boolean().optional()});var iMo=ae.objectWithoutOptionalProperties({apiKeyEnvironmentVariable:n3,workspaceIdEnvironmentVariable:n3});var nMo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),packageName:ae.string(),usernameEnvironmentVariable:n3,passwordEnvironmentVariable:n3,pypiMetadata:xzn.optional(),shouldGeneratePublishWorkflow:ae.boolean().optional()});var aMo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),packageName:ae.string(),apiKeyEnvironmentVariable:n3,shouldGeneratePublishWorkflow:ae.boolean().optional()});var oMo=ae.objectWithoutOptionalProperties({registryUrl:ae.string(),packageName:ae.string(),apiKeyEnvironmentVariable:n3,shouldGeneratePublishWorkflow:ae.boolean().optional()});var uMo=ae.union("type",{npm:eMo,maven:rMo,postman:iMo,pypi:nMo,rubygems:aMo,nuget:oMo}).transform({transform:e=>{switch(e.type){case"npm":return w0.GithubPublishInfo.npm(e);case"maven":return w0.GithubPublishInfo.maven(e);case"postman":return w0.GithubPublishInfo.postman(e);case"pypi":return w0.GithubPublishInfo.pypi(e);case"rubygems":return w0.GithubPublishInfo.rubygems(e);case"nuget":return w0.GithubPublishInfo.nuget(e);default:return e}},untransform:({_visit:e,...t})=>t});var sMo=ae.objectWithoutOptionalProperties({version:ae.string(),repoUrl:ae.string(),installationToken:ae.string().optional(),publishInfo:uMo.optional()});var cMo=ae.union("type",{publish:Lzn,downloadFiles:ae.object({}),github:sMo}).transform({transform:e=>{switch(e.type){case"publish":return w0.OutputMode.publish(e);case"downloadFiles":return w0.OutputMode.downloadFiles();case"github":return w0.OutputMode.github(e);default:return e}},untransform:({_visit:e,...t})=>t});var lMo=ae.objectWithoutOptionalProperties({path:ae.string(),snippetFilepath:ae.string().optional(),snippetTemplateFilepath:ae.string().optional(),publishingMetadata:$Eo.optional(),mode:cMo});var fMo=ae.objectWithoutOptionalProperties({coordinatorUrl:ae.string(),coordinatorUrlV2:ae.string(),id:ae.string()});var dMo=ae.union(ae.discriminant("type","_type"),{local:ae.object({}),remote:fMo}).transform({transform:e=>{switch(e.type){case"local":return w0.GeneratorEnvironment.local();case"remote":return w0.GeneratorEnvironment.remote(e);default:return e}},untransform:({_visit:e,...t})=>t});var rnp=ae.objectWithoutOptionalProperties({dryRun:ae.boolean(),irFilepath:ae.string(),originalReadmeFilepath:ae.string().optional(),license:HEo.optional(),output:lMo,publish:Lzn.optional(),workspaceName:ae.string(),organization:ae.string(),customConfig:ae.unknown(),environment:dMo,whitelabel:ae.boolean(),writeUnitTests:ae.boolean(),generatePaginatedClients:ae.boolean().optional(),generateOauthClients:ae.boolean()});var D8s={};mo(D8s,{AutogeneratedEndpointExample:()=>iAo,BytesRequest:()=>Hzn,BytesResponse:()=>Jzn,CursorPagination:()=>UMo,CustomPagination:()=>WMo,DeclaredServiceName:()=>pMo,EndpointName:()=>hMo,ExampleCodeSample:()=>JMo,ExampleCodeSampleLanguage:()=>$Mo,ExampleCodeSampleSdk:()=>QMo,ExampleEndpointCall:()=>Zzn,ExampleEndpointErrorResponse:()=>eAo,ExampleEndpointSuccessResponse:()=>kMo,ExampleHeader:()=>oWi,ExampleInlinedRequestBody:()=>Xzn,ExampleInlinedRequestBodyProperty:()=>YMo,ExamplePathParameter:()=>c1i,ExampleQueryParameter:()=>Yzn,ExampleQueryParameterShape:()=>KMo,ExampleRequestBody:()=>XMo,ExampleResponse:()=>tAo,ExampleServerSideEvent:()=>ZMo,FileDownloadResponse:()=>Gzn,FileProperty:()=>OMo,FilePropertyArray:()=>gMo,FilePropertySingle:()=>bMo,FileUploadBodyProperty:()=>PMo,FileUploadBodyPropertyEncoding:()=>mMo,FileUploadRequest:()=>wMo,FileUploadRequestProperty:()=>jMo,GrpcTransport:()=>uAo,HttpEndpoint:()=>fAo,HttpEndpointSource:()=>lAo,HttpHeader:()=>uZ,HttpMethod:()=>Szn,HttpPath:()=>Xxe,HttpPathPart:()=>_Mo,HttpRequestBody:()=>SMo,HttpRequestBodyReference:()=>Wzn,HttpResponse:()=>NMo,HttpResponseBody:()=>RMo,HttpService:()=>_Ao,InlinedRequestBody:()=>vMo,InlinedRequestBodyProperty:()=>Vzn,JsonResponse:()=>$zn,JsonResponseBody:()=>qMo,JsonResponseBodyWithProperty:()=>TMo,JsonStreamChunk:()=>CMo,NonStreamHttpResponseBody:()=>zMo,OffsetPagination:()=>VMo,Pagination:()=>HMo,PathParameter:()=>DVt,PathParameterLocation:()=>yMo,ProtoSourceInfo:()=>cAo,QueryParameter:()=>a1i,RequestProperty:()=>bQ,RequestPropertyValue:()=>lDo,ResponseError:()=>FMo,ResponseErrors:()=>LMo,ResponseProperty:()=>Pne,SdkRequest:()=>AMo,SdkRequestBodyType:()=>DMo,SdkRequestShape:()=>MMo,SdkRequestWrapper:()=>EMo,SseStreamChunk:()=>IMo,StreamParameterResponse:()=>xMo,StreamingResponse:()=>Kzn,SupportedSdkLanguage:()=>GMo,TextResponse:()=>Qzn,TextStreamChunk:()=>BMo,Transport:()=>exn,UserSpecifiedEndpointExample:()=>rAo});var pMo=ae.objectWithoutOptionalProperties({fernFilepath:jne});var _Mo=ae.objectWithoutOptionalProperties({pathParameter:ae.string(),tail:ae.string()});var Xxe=ae.objectWithoutOptionalProperties({head:ae.string(),parts:ae.list(_Mo)});var hMo=Pd;var uZ=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy),env:ae.string().optional(),v2Examples:A9.optional()}).extend(S6);var yMo=ae.enum_(["ROOT","SERVICE","ENDPOINT"]);var Uzn=ae.string();var DVt=ae.objectWithoutOptionalProperties({name:Pd,valueType:ae.lazy(()=>Hy),location:yMo,variable:Uzn.optional(),v2Examples:A9.optional()}).extend(Bd);var CB=ae.objectWithoutOptionalProperties({typeId:kx,fernFilepath:jne,name:Pd,displayName:Pzn.optional()});var Vzn=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy),v2Examples:A9.optional()}).extend(o1i);var vMo=ae.objectWithoutOptionalProperties({name:Pd,extends:ae.list(CB),properties:ae.list(Vzn),extendedProperties:ae.list(aZ).optional(),extraProperties:ae.property("extra-properties",ae.boolean())}).extend(Bd).extend(TB).extend(Kxe);var Wzn=ae.objectWithoutOptionalProperties({requestBodyType:ae.lazy(()=>Hy)}).extend(Bd).extend(Kxe).extend(TB);var bMo=ae.objectWithoutOptionalProperties({key:qh,isOptional:ae.boolean(),contentType:ae.string().optional()}).extend(Bd);var gMo=ae.objectWithoutOptionalProperties({key:qh,isOptional:ae.boolean(),contentType:ae.string().optional()}).extend(Bd);var OMo=ae.union("type",{file:bMo,fileArray:gMo}).transform({transform:e=>{switch(e.type){case"file":return gne.file(e);case"fileArray":return gne.fileArray(e);default:return e}},untransform:({_visit:e,...t})=>t});var mMo=ae.enum_(["exploded","json","form"]);var PMo=ae.objectWithoutOptionalProperties({style:mMo.optional()}).extend(Vzn).extend(Kxe);var jMo=ae.union("type",{file:ae.object({value:OMo}),bodyProperty:PMo}).transform({transform:e=>{switch(e.type){case"file":return w6.file(e.value);case"bodyProperty":return w6.bodyProperty(e);default:return e}},untransform:({_visit:e,...t})=>t});var wMo=ae.objectWithoutOptionalProperties({name:Pd,properties:ae.list(jMo)}).extend(Bd).extend(TB).extend(Kxe);var Hzn=ae.objectWithoutOptionalProperties({isOptional:ae.boolean()}).extend(Bd).extend(TB).extend(Kxe);var SMo=ae.union("type",{inlinedRequestBody:vMo,reference:Wzn,fileUpload:wMo,bytes:Hzn}).transform({transform:e=>{switch(e.type){case"inlinedRequestBody":return tA.inlinedRequestBody(e);case"reference":return tA.reference(e);case"fileUpload":return tA.fileUpload(e);case"bytes":return tA.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var DMo=ae.union("type",{typeReference:Wzn,bytes:Hzn}).transform({transform:e=>{switch(e.type){case"typeReference":return mVt.typeReference(e);case"bytes":return mVt.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var EMo=ae.objectWithoutOptionalProperties({wrapperName:Pd,bodyKey:Pd,includePathParameters:ae.boolean().optional(),onlyPathParameters:ae.boolean().optional()});var MMo=ae.union("type",{justRequestBody:ae.object({value:DMo}),wrapper:EMo}).transform({transform:e=>{switch(e.type){case"justRequestBody":return Qxe.justRequestBody(e.value);case"wrapper":return Qxe.wrapper(e);default:return e}},untransform:({_visit:e,...t})=>t});var AMo=ae.objectWithoutOptionalProperties({streamParameter:bQ.optional(),requestParameterName:Pd,shape:MMo});var qMo=ae.objectWithoutOptionalProperties({responseBodyType:ae.lazy(()=>Hy)}).extend(Bd).extend(TB);var TMo=ae.objectWithoutOptionalProperties({responseBodyType:ae.lazy(()=>Hy),responseProperty:aZ.optional()}).extend(Bd).extend(TB);var $zn=ae.union("type",{response:qMo,nestedPropertyAsResponse:TMo}).transform({transform:e=>{switch(e.type){case"response":return j9.response(e);case"nestedPropertyAsResponse":return j9.nestedPropertyAsResponse(e);default:return e}},untransform:({_visit:e,...t})=>t});var Gzn=ae.objectWithoutOptionalProperties({}).extend(Bd).extend(TB);var Qzn=ae.objectWithoutOptionalProperties({}).extend(Bd).extend(TB);var Jzn=ae.objectWithoutOptionalProperties({}).extend(Bd).extend(TB);var CMo=ae.objectWithoutOptionalProperties({payload:ae.lazy(()=>Hy),terminator:ae.string().optional()}).extend(Bd).extend(TB);var BMo=ae.objectWithoutOptionalProperties({}).extend(Bd).extend(TB);var IMo=ae.objectWithoutOptionalProperties({payload:ae.lazy(()=>Hy),terminator:ae.string().optional()}).extend(Bd).extend(TB);var Kzn=ae.union("type",{json:CMo,text:BMo,sse:IMo}).transform({transform:e=>{switch(e.type){case"json":return w9.json(e);case"text":return w9.text(e);case"sse":return w9.sse(e);default:return e}},untransform:({_visit:e,...t})=>t});var zMo=ae.union("type",{json:ae.object({value:$zn}),fileDownload:Gzn,text:Qzn,bytes:Jzn}).transform({transform:e=>{switch(e.type){case"json":return cW.json(e.value);case"fileDownload":return cW.fileDownload(e);case"text":return cW.text(e);case"bytes":return cW.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var xMo=ae.objectWithoutOptionalProperties({nonStreamResponse:zMo,streamResponse:Kzn});var RMo=ae.union("type",{json:ae.object({value:$zn}),fileDownload:Gzn,text:Qzn,bytes:Jzn,streaming:ae.object({value:Kzn}),streamParameter:xMo}).transform({transform:e=>{switch(e.type){case"json":return xw.json(e.value);case"fileDownload":return xw.fileDownload(e);case"text":return xw.text(e);case"bytes":return xw.bytes(e);case"streaming":return xw.streaming(e.value);case"streamParameter":return xw.streamParameter(e);default:return e}},untransform:({_visit:e,...t})=>t});var NMo=ae.objectWithoutOptionalProperties({statusCode:ae.property("status-code",ae.number().optional()),body:RMo.optional()});var FMo=ae.objectWithoutOptionalProperties({error:s1i}).extend(Bd);var LMo=ae.list(FMo);var UMo=ae.objectWithoutOptionalProperties({page:bQ,next:Pne,results:Pne});var VMo=ae.objectWithoutOptionalProperties({page:bQ,results:Pne,hasNextPage:Pne.optional(),step:bQ.optional()});var WMo=ae.objectWithoutOptionalProperties({results:Pne});var HMo=ae.union("type",{cursor:UMo,offset:VMo,custom:WMo}).transform({transform:e=>{switch(e.type){case"cursor":return hQ.cursor(e);case"offset":return hQ.offset(e);case"custom":return hQ.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Mo=ae.objectWithoutOptionalProperties({name:Pd.optional(),language:ae.string(),code:ae.string(),install:ae.string().optional()}).extend(Bd);var GMo=ae.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java"]);var QMo=ae.objectWithoutOptionalProperties({name:Pd.optional(),sdk:GMo,code:ae.string()}).extend(Bd);var JMo=ae.union("type",{language:$Mo,sdk:QMo}).transform({transform:e=>{switch(e.type){case"language":return wEe.language(e);case"sdk":return wEe.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var c1i=ae.objectWithoutOptionalProperties({name:Pd,value:ae.lazyObject(()=>nm)});var oWi=ae.objectWithoutOptionalProperties({name:qh,value:ae.lazyObject(()=>nm)});var KMo=ae.union("type",{single:ae.object({}),exploded:ae.object({}),commaSeparated:ae.object({})}).transform({transform:e=>{switch(e.type){case"single":return A2.single();case"exploded":return A2.exploded();case"commaSeparated":return A2.commaSeparated();default:return e}},untransform:({_visit:e,...t})=>t});var Yzn=ae.objectWithoutOptionalProperties({name:qh,value:ae.lazyObject(()=>nm),shape:KMo.optional()});var YMo=ae.objectWithoutOptionalProperties({name:qh,value:ae.lazyObject(()=>nm),originalTypeDeclaration:CB.optional()});var Xzn=ae.objectWithoutOptionalProperties({properties:ae.list(YMo)}).extend(ckt);var XMo=ae.union("type",{inlinedRequestBody:Xzn,reference:ae.lazyObject(()=>nm)}).transform({transform:e=>{switch(e.type){case"inlinedRequestBody":return yQ.inlinedRequestBody(e);case"reference":return yQ.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var ZMo=ae.objectWithoutOptionalProperties({event:ae.string(),data:ae.lazyObject(()=>nm)});var kMo=ae.union("type",{body:ae.object({value:ae.lazyObject(()=>nm).optional()}),stream:ae.object({value:ae.list(ae.lazyObject(()=>nm))}),sse:ae.object({value:ae.list(ZMo)})}).transform({transform:e=>{switch(e.type){case"body":return XC.body(e.value);case"stream":return XC.stream(e.value);case"sse":return XC.sse(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var eAo=ae.objectWithoutOptionalProperties({error:s1i,body:ae.lazyObject(()=>nm).optional()});var tAo=ae.union("type",{ok:ae.object({value:kMo}),error:eAo}).transform({transform:e=>{switch(e.type){case"ok":return IT.ok(e.value);case"error":return IT.error(e);default:return e}},untransform:({_visit:e,...t})=>t});var Zzn=ae.objectWithoutOptionalProperties({id:ae.string().optional(),name:Pd.optional(),url:ae.string(),rootPathParameters:ae.list(c1i),servicePathParameters:ae.list(c1i),endpointPathParameters:ae.list(c1i),serviceHeaders:ae.list(oWi),endpointHeaders:ae.list(oWi),queryParameters:ae.list(Yzn),request:XMo.optional(),response:tAo}).extend(Bd);var rAo=ae.objectWithoutOptionalProperties({codeSamples:ae.list(JMo).optional(),example:Zzn.optional()});var iAo=ae.objectWithoutOptionalProperties({example:Zzn});var nAo=ae.objectWithoutOptionalProperties({namespace:ae.string()});var aAo=ae.objectWithoutOptionalProperties({csharp:nAo.optional()});var kzn=ae.objectWithoutOptionalProperties({filepath:ae.string(),packageName:ae.string().optional(),options:aAo.optional()});var oAo=ae.objectWithoutOptionalProperties({file:kzn,name:Pd});var uAo=ae.objectWithoutOptionalProperties({service:oAo});var exn=ae.union("type",{http:ae.object({}),grpc:uAo}).transform({transform:e=>{switch(e.type){case"http":return $xe.http();case"grpc":return $xe.grpc(e);default:return e}},untransform:({_visit:e,...t})=>t});var sAo=ae.enum_(["UNARY","CLIENT_STREAM","SERVER_STREAM","BIDIRECTIONAL_STREAM"]);var cAo=ae.objectWithoutOptionalProperties({methodType:sAo.optional()});var lAo=ae.union("type",{proto:cAo,openapi:ae.object({}),openrpc:ae.object({})}).transform({transform:e=>{switch(e.type){case"proto":return _Q.proto(e);case"openapi":return _Q.openapi();case"openrpc":return _Q.openrpc();default:return e}},untransform:({_visit:e,...t})=>t});var fAo=ae.objectWithoutOptionalProperties({id:SVt,name:hMo,displayName:ae.string().optional(),method:Szn,headers:ae.list(uZ),baseUrl:oZ.optional(),v2BaseUrls:ae.list(oZ).optional(),basePath:Xxe.optional(),path:Xxe,fullPath:Xxe,pathParameters:ae.list(DVt),allPathParameters:ae.list(DVt),queryParameters:ae.list(a1i),requestBody:SMo.optional(),sdkRequest:AMo.optional(),response:NMo.optional(),errors:LMo,auth:ae.boolean(),idempotent:ae.boolean(),pagination:HMo.optional(),userSpecifiedExamples:ae.list(rAo),autogeneratedExamples:ae.list(iAo),v2Examples:xEo.optional(),transport:exn.optional(),source:lAo.optional(),audiences:ae.list(gzn).optional()}).extend(S6);var dAo=ae.objectWithoutOptionalProperties({});var pAo=ae.objectWithoutOptionalProperties({});var txn=ae.objectWithoutOptionalProperties({json:dAo.optional(),proto:pAo.optional()});var _Ao=ae.objectWithoutOptionalProperties({availability:skt.optional(),name:pMo,displayName:ae.string().optional(),basePath:Xxe,endpoints:ae.list(fAo),headers:ae.list(uZ),pathParameters:ae.list(DVt),encoding:txn.optional(),transport:exn.optional(),audiences:ae.list(gzn).optional()});var E8s={};mo(E8s,{ApiDefinitionSource:()=>Aqo,ApiDefinitionSourceId:()=>Eqo,ApiVersionScheme:()=>yAo,ErrorDiscriminationByPropertyStrategy:()=>gqo,ErrorDiscriminationStrategy:()=>Oqo,HeaderApiVersionScheme:()=>hAo,IntermediateRepresentation:()=>inp,Package:()=>uxn,PackageNavigationConfig:()=>vqo,PlatformHeaders:()=>Pqo,ProtoSource:()=>Mqo,ReadmeConfig:()=>Dqo,SdkConfig:()=>jqo,ServiceTypeReferenceInfo:()=>Sqo,SourceConfig:()=>qqo,Subpackage:()=>bqo,UserAgent:()=>mqo});var hli=ae.objectWithoutOptionalProperties({name:qh}).extend(S6);var rxn=ae.objectWithoutOptionalProperties({default:hli.optional(),values:ae.list(hli)});var hAo=ae.objectWithoutOptionalProperties({header:uZ,value:rxn});var yAo=ae.union("type",{header:hAo}).transform({transform:e=>{switch(e.type){case"header":return r1i.header(e);default:return e}},untransform:({_visit:e,...t})=>t});var vAo=ae.enum_(["ENUM","OBJECT","UNION","UNDISCRIMINATED_UNION"]);var bAo=ae.objectWithoutOptionalProperties({name:CB,shape:vAo});var gAo=ae.objectWithoutOptionalProperties({min:ae.number().optional(),max:ae.number().optional(),exclusiveMin:ae.boolean().optional(),exclusiveMax:ae.boolean().optional(),multipleOf:ae.number().optional()});var OAo=ae.objectWithoutOptionalProperties({default:ae.number().optional(),validation:gAo.optional()});var mAo=ae.objectWithoutOptionalProperties({default:ae.number().optional()});var PAo=ae.objectWithoutOptionalProperties({});var jAo=ae.objectWithoutOptionalProperties({});var wAo=ae.objectWithoutOptionalProperties({});var SAo=ae.objectWithoutOptionalProperties({min:ae.number().optional(),max:ae.number().optional(),exclusiveMin:ae.boolean().optional(),exclusiveMax:ae.boolean().optional(),multipleOf:ae.number().optional()});var DAo=ae.objectWithoutOptionalProperties({default:ae.number().optional(),validation:SAo.optional()});var EAo=ae.objectWithoutOptionalProperties({default:ae.boolean().optional()});var MAo=ae.objectWithoutOptionalProperties({format:ae.string().optional(),pattern:ae.string().optional(),minLength:ae.number().optional(),maxLength:ae.number().optional()});var AAo=ae.objectWithoutOptionalProperties({default:ae.string().optional(),validation:MAo.optional()});var qAo=ae.objectWithoutOptionalProperties({});var TAo=ae.objectWithoutOptionalProperties({});var CAo=ae.objectWithoutOptionalProperties({});var BAo=ae.objectWithoutOptionalProperties({});var IAo=ae.objectWithoutOptionalProperties({default:ae.string().optional()});var zAo=ae.union("type",{integer:OAo,long:mAo,uint:PAo,uint64:jAo,float:wAo,double:DAo,boolean:EAo,string:AAo,date:qAo,dateTime:TAo,uuid:CAo,base64:BAo,bigInteger:IAo}).transform({transform:e=>{switch(e.type){case"integer":return Ed.integer(e);case"long":return Ed.long(e);case"uint":return Ed.uint(e);case"uint64":return Ed.uint64(e);case"float":return Ed.float(e);case"double":return Ed.double(e);case"boolean":return Ed.boolean(e);case"string":return Ed.string(e);case"date":return Ed.date(e);case"dateTime":return Ed.dateTime(e);case"uuid":return Ed.uuid(e);case"base64":return Ed.base64(e);case"bigInteger":return Ed.bigInteger(e);default:return e}},untransform:({_visit:e,...t})=>t});var ixn=ae.objectWithoutOptionalProperties({v1:qzn,v2:zAo.optional()});var xAo=ae.union(ae.discriminant("type","_type"),{container:ae.object({container:ae.lazy(()=>nxn)}),named:bAo,primitive:ae.object({primitive:ixn}),unknown:ae.object({})}).transform({transform:e=>{switch(e.type){case"container":return lW.container(e.container);case"named":return lW.named(e);case"primitive":return lW.primitive(e.primitive);case"unknown":return lW.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var RAo=ae.objectWithoutOptionalProperties({aliasOf:ae.lazy(()=>Hy),resolvedType:xAo});var NAo=ae.objectWithoutOptionalProperties({extends:ae.list(CB),properties:ae.list(aZ),extendedProperties:ae.list(aZ).optional(),extraProperties:ae.property("extra-properties",ae.boolean())});var FAo=ae.objectWithoutOptionalProperties({name:qh,type:ae.lazy(()=>Hy)});var LAo=ae.union(ae.discriminant("propertiesType","_type"),{samePropertiesAsObject:CB,singleProperty:FAo,noProperties:ae.object({})}).transform({transform:e=>{switch(e.propertiesType){case"samePropertiesAsObject":return S9.samePropertiesAsObject(e);case"singleProperty":return S9.singleProperty(e);case"noProperties":return S9.noProperties();default:return e}},untransform:({_visit:e,...t})=>t});var UAo=ae.objectWithoutOptionalProperties({discriminantValue:qh,shape:LAo,displayName:ae.string().optional(),availability:skt.optional()}).extend(Bd);var VAo=ae.objectWithoutOptionalProperties({discriminant:qh,extends:ae.list(CB),types:ae.list(UAo),baseProperties:ae.list(aZ)});var WAo=ae.objectWithoutOptionalProperties({type:ae.lazy(()=>Hy)}).extend(Bd);var HAo=ae.objectWithoutOptionalProperties({members:ae.list(WAo)});var $Ao=ae.union(ae.discriminant("type","_type"),{alias:RAo,enum:rxn,object:NAo,union:VAo,undiscriminatedUnion:HAo}).transform({transform:e=>{switch(e.type){case"alias":return Sb.alias(e);case"enum":return Sb.enum(e);case"object":return Sb.object(e);case"union":return Sb.union(e);case"undiscriminatedUnion":return Sb.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var l1a=ae.objectWithoutOptionalProperties({name:Pd.optional(),shape:ae.lazy(()=>axn)}).extend(ckt).extend(Bd);var GAo=ae.union("type",{any:ae.object({}),api:ae.object({}),boolValue:ae.object({}),bytesValue:ae.object({}),doubleValue:ae.object({}),duration:ae.object({}),empty:ae.object({}),enum:ae.object({}),enumValue:ae.object({}),field:ae.object({}),fieldCardinality:ae.object({}),fieldKind:ae.object({}),fieldMask:ae.object({}),floatValue:ae.object({}),int32Value:ae.object({}),int64Value:ae.object({}),listValue:ae.object({}),method:ae.object({}),mixin:ae.object({}),nullValue:ae.object({}),option:ae.object({}),sourceContext:ae.object({}),stringValue:ae.object({}),struct:ae.object({}),syntax:ae.object({}),timestamp:ae.object({}),type:ae.object({}),uint32Value:ae.object({}),uint64Value:ae.object({}),value:ae.object({})}).transform({transform:e=>{switch(e.type){case"any":return id.any();case"api":return id.api();case"boolValue":return id.boolValue();case"bytesValue":return id.bytesValue();case"doubleValue":return id.doubleValue();case"duration":return id.duration();case"empty":return id.empty();case"enum":return id.enum();case"enumValue":return id.enumValue();case"field":return id.field();case"fieldCardinality":return id.fieldCardinality();case"fieldKind":return id.fieldKind();case"fieldMask":return id.fieldMask();case"floatValue":return id.floatValue();case"int32Value":return id.int32Value();case"int64Value":return id.int64Value();case"listValue":return id.listValue();case"method":return id.method();case"mixin":return id.mixin();case"nullValue":return id.nullValue();case"option":return id.option();case"sourceContext":return id.sourceContext();case"stringValue":return id.stringValue();case"struct":return id.struct();case"syntax":return id.syntax();case"timestamp":return id.timestamp();case"type":return id.type();case"uint32Value":return id.uint32Value();case"uint64Value":return id.uint64Value();case"value":return id.value();default:return e}},untransform:({_visit:e,...t})=>t});var QAo=ae.objectWithoutOptionalProperties({file:kzn,name:Pd});var JAo=ae.union("type",{wellKnown:ae.object({value:GAo}),userDefined:QAo}).transform({transform:e=>{switch(e.type){case"wellKnown":return Kj.wellKnown(e.value);case"userDefined":return Kj.userDefined(e);default:return e}},untransform:({_visit:e,...t})=>t});var KAo=ae.union("type",{proto:ae.object({value:JAo})}).transform({transform:e=>{switch(e.type){case"proto":return _li.proto(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var YAo=ae.objectWithoutOptionalProperties({name:CB,shape:$Ao,autogeneratedExamples:ae.list(l1a),userProvidedExamples:ae.list(l1a),v2Examples:A9.optional(),referencedTypes:ae.set(kx),encoding:txn.optional(),source:KAo.optional(),inline:ae.boolean().optional()}).extend(S6);var XAo=Pd;var ZAo=ae.enum_(["GET","POST"]);var kAo=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy)}).extend(o1i);var eqo=ae.objectWithoutOptionalProperties({name:Pd,extends:ae.list(CB),properties:ae.list(kAo)});var tqo=ae.objectWithoutOptionalProperties({payloadType:ae.lazy(()=>Hy)}).extend(Bd);var rqo=ae.union("type",{inlinedPayload:eqo,reference:tqo}).transform({transform:e=>{switch(e.type){case"inlinedPayload":return fW.inlinedPayload(e);case"reference":return fW.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var iqo=ae.objectWithoutOptionalProperties({name:Pd.optional(),payload:ae.lazyObject(()=>nm)}).extend(Bd);var nqo=ae.objectWithoutOptionalProperties({id:mDo,name:XAo,displayName:ae.string().optional(),method:ZAo,headers:ae.list(uZ),payload:rqo,examples:ae.list(iqo).optional(),v2Examples:LEo.optional()}).extend(S6);var aqo=ae.list(nqo);var oqo=Pd;var oxn=ae.string();var uqo=ae.enum_(["client","server"]);var sqo=ae.objectWithoutOptionalProperties({name:qh,valueType:ae.lazy(()=>Hy)}).extend(o1i);var cqo=ae.objectWithoutOptionalProperties({name:Pd,extends:ae.list(CB),properties:ae.list(sqo)});var lqo=ae.objectWithoutOptionalProperties({bodyType:ae.lazy(()=>Hy)}).extend(Bd);var fqo=ae.union("type",{inlinedBody:cqo,reference:lqo}).transform({transform:e=>{switch(e.type){case"inlinedBody":return E9.inlinedBody(e);case"reference":return E9.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var dqo=ae.objectWithoutOptionalProperties({type:oxn,displayName:ae.string().optional(),origin:uqo,body:fqo}).extend(S6);var pqo=ae.union("type",{inlinedBody:Xzn,reference:ae.lazyObject(()=>nm)}).transform({transform:e=>{switch(e.type){case"inlinedBody":return DEe.inlinedBody(e);case"reference":return DEe.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var _qo=ae.objectWithoutOptionalProperties({type:oxn,body:pqo});var hqo=ae.objectWithoutOptionalProperties({name:Pd.optional(),url:ae.string(),pathParameters:ae.list(c1i),headers:ae.list(oWi),queryParameters:ae.list(Yzn),messages:ae.list(_qo)}).extend(Bd);var yqo=ae.objectWithoutOptionalProperties({name:oqo,displayName:ae.string().optional(),baseUrl:oZ.optional(),path:Xxe,auth:ae.boolean(),headers:ae.list(uZ),queryParameters:ae.list(a1i),pathParameters:ae.list(DVt),messages:ae.list(dqo),examples:ae.list(hqo),v2Examples:FEo.optional()}).extend(S6);var vqo=ae.objectWithoutOptionalProperties({pointsTo:ukt});var uxn=ae.objectWithoutOptionalProperties({fernFilepath:jne,service:okt.optional(),types:ae.list(kx),errors:ae.list(u1i),webhooks:jzn.optional(),websocket:wzn.optional(),subpackages:ae.list(ukt),hasEndpointsInTree:ae.boolean(),navigationConfig:vqo.optional()}).extend(Bd);var bqo=ae.objectWithoutOptionalProperties({name:Pd}).extend(uxn);var gqo=ae.objectWithoutOptionalProperties({discriminant:qh,contentProperty:qh});var Oqo=ae.union("type",{statusCode:ae.object({}),property:gqo}).transform({transform:e=>{switch(e.type){case"statusCode":return SEe.statusCode();case"property":return SEe.property(e);default:return e}},untransform:({_visit:e,...t})=>t});var mqo=ae.objectWithoutOptionalProperties({header:ae.stringLiteral("User-Agent"),value:ae.string()});var Pqo=ae.objectWithoutOptionalProperties({language:ae.string(),sdkName:ae.string(),sdkVersion:ae.string(),userAgent:mqo.optional()});var jqo=ae.objectWithoutOptionalProperties({isAuthMandatory:ae.boolean(),hasStreamingEndpoints:ae.boolean(),hasPaginatedEndpoints:ae.boolean(),hasFileDownloadEndpoints:ae.boolean(),platformHeaders:Pqo});var wqo=ae.objectWithoutOptionalProperties({id:Uzn,name:Pd,type:ae.lazy(()=>Hy)}).extend(Bd);var Sqo=ae.objectWithoutOptionalProperties({typesReferencedOnlyByService:ae.record(okt,ae.list(kx)),sharedTypes:ae.list(kx)});var Dqo=ae.objectWithoutOptionalProperties({defaultEndpoint:SVt.optional(),bannerLink:ae.string().optional(),introduction:ae.string().optional(),apiReferenceLink:ae.string().optional(),features:ae.record(PDo,ae.list(SVt)).optional()});var Eqo=ae.string();var Mqo=ae.objectWithoutOptionalProperties({id:Eqo,protoRootUrl:ae.string()});var Aqo=ae.union("type",{proto:Mqo,openapi:ae.object({})}).transform({transform:e=>{switch(e.type){case"proto":return mne.proto(e);case"openapi":return mne.openapi();default:return e}},untransform:({_visit:e,...t})=>t});var qqo=ae.objectWithoutOptionalProperties({sources:ae.list(Aqo)});var Tqo=ae.objectWithoutOptionalProperties({apiKey:ae.string(),workspaceId:ae.string(),collectionId:ae.string().optional()});var Cqo=ae.objectWithoutOptionalProperties({version:ae.string().optional(),packageName:ae.string().optional(),tokenEnvironmentVariable:ae.string()});var Bqo=ae.objectWithoutOptionalProperties({coordinate:ae.string().optional(),version:ae.string().optional(),usernameEnvironmentVariable:ae.string(),passwordEnvironmentVariable:ae.string(),mavenUrlEnvironmentVariable:ae.string()});var sxn=ae.union("type",{postman:Tqo,npm:Cqo,maven:Bqo}).transform({transform:e=>{switch(e.type){case"postman":return nkt.postman(e);case"npm":return nkt.npm(e);case"maven":return nkt.maven(e);default:return e}},untransform:({_visit:e,...t})=>t});var Iqo=ae.objectWithoutOptionalProperties({owner:ae.string(),repo:ae.string(),uri:ae.string().optional(),token:ae.string().optional(),target:sxn});var zqo=ae.objectWithoutOptionalProperties({target:sxn});var xqo=ae.objectWithoutOptionalProperties({generateFullProject:ae.boolean()});var Rqo=ae.union("type",{github:Iqo,direct:zqo,filesystem:xqo}).transform({transform:e=>{switch(e.type){case"github":return ikt.github(e);case"direct":return ikt.direct(e);case"filesystem":return ikt.filesystem(e);default:return e}},untransform:({_visit:e,...t})=>t});var inp=ae.objectWithoutOptionalProperties({fdrApiDefinitionId:ae.string().optional(),apiVersion:yAo.optional(),apiName:Pd,apiDisplayName:ae.string().optional(),apiDocs:ae.string().optional(),auth:gDo,headers:ae.list(uZ),idempotencyHeaders:ae.list(uZ),types:ae.record(kx,YAo),services:ae.record(okt,_Ao),webhookGroups:ae.record(jzn,aqo),websocketChannels:ae.record(wzn,yqo).optional(),errors:ae.record(u1i,wEo),subpackages:ae.record(ukt,bqo),rootPackage:uxn,constants:jDo,environments:Azn.optional(),basePath:Xxe.optional(),pathParameters:ae.list(DVt),errorDiscriminationStrategy:Oqo,sdkConfig:jqo,variables:ae.list(wqo),serviceTypeReferenceInfo:Sqo,readmeConfig:Dqo.optional(),sourceConfig:qqo.optional(),publishConfig:Rqo.optional(),dynamic:gEo.optional(),selfHosted:ae.boolean().optional(),audiences:ae.list(iDo).optional()});var M8s={};mo(M8s,{CsharpProtobufFileOptions:()=>nAo,ProtobufFile:()=>kzn,ProtobufFileOptions:()=>aAo,ProtobufMethodType:()=>sAo,ProtobufService:()=>oAo,ProtobufType:()=>JAo,UserDefinedProtobufType:()=>QAo,WellKnownProtobufType:()=>GAo});var A8s={};mo(A8s,{DirectPublish:()=>zqo,Filesystem:()=>xqo,GithubPublish:()=>Iqo,MavenPublishTarget:()=>Bqo,NpmPublishTarget:()=>Cqo,PostmanPublishTarget:()=>Tqo,PublishTarget:()=>sxn,PublishingConfig:()=>Rqo});var q8s={};mo(q8s,{AliasTypeDeclaration:()=>RAo,Base64Type:()=>BAo,BigIntegerType:()=>IAo,BooleanType:()=>EAo,ContainerType:()=>nxn,DateTimeType:()=>TAo,DateType:()=>qAo,DeclaredTypeName:()=>CB,DoubleType:()=>DAo,DoubleValidationRules:()=>SAo,Encoding:()=>txn,EnumTypeDeclaration:()=>rxn,EnumTypeReference:()=>nnp,EnumValue:()=>hli,ExampleAliasType:()=>Wqo,ExampleContainer:()=>Zqo,ExampleDatetime:()=>Xqo,ExampleEnumType:()=>Vqo,ExampleKeyValuePair:()=>oTo,ExampleListContainer:()=>tTo,ExampleLiteralContainer:()=>eTo,ExampleMapContainer:()=>aTo,ExampleNamedType:()=>kqo,ExampleNullableContainer:()=>nTo,ExampleObjectProperty:()=>Gqo,ExampleObjectType:()=>cxn,ExampleObjectTypeWithTypeId:()=>Kqo,ExampleOptionalContainer:()=>iTo,ExamplePrimitive:()=>lxn,ExampleSetContainer:()=>rTo,ExampleSingleUnionType:()=>Qqo,ExampleSingleUnionTypeProperties:()=>Jqo,ExampleType:()=>l1a,ExampleTypeReference:()=>nm,ExampleTypeReferenceShape:()=>Yqo,ExampleTypeShape:()=>axn,ExampleUndiscriminatedUnionType:()=>$qo,ExampleUnionType:()=>Hqo,FloatType:()=>wAo,IntegerType:()=>OAo,IntegerValidationRules:()=>gAo,JsonEncoding:()=>dAo,Literal:()=>Lqo,LongType:()=>mAo,MapType:()=>Uqo,NamedType:()=>Fqo,NamedTypeDefault:()=>Nqo,ObjectProperty:()=>aZ,ObjectPropertyAccess:()=>cDo,ObjectTypeDeclaration:()=>NAo,PrimitiveType:()=>ixn,PrimitiveTypeV1:()=>qzn,PrimitiveTypeV2:()=>zAo,ProtoEncoding:()=>pAo,ResolvedNamedType:()=>bAo,ResolvedTypeReference:()=>xAo,ShapeType:()=>vAo,SingleUnionType:()=>UAo,SingleUnionTypeProperties:()=>LAo,SingleUnionTypeProperty:()=>FAo,Source:()=>KAo,StringType:()=>AAo,StringValidationRules:()=>MAo,Type:()=>$Ao,TypeDeclaration:()=>YAo,TypeReference:()=>Hy,Uint64Type:()=>jAo,UintType:()=>PAo,UndiscriminatedUnionMember:()=>WAo,UndiscriminatedUnionTypeDeclaration:()=>HAo,UnionTypeDeclaration:()=>VAo,UuidType:()=>CAo});var Nqo=ae.union("type",{enum:hli}).transform({transform:e=>{switch(e.type){case"enum":return hzn.enum(e);default:return e}},untransform:({_visit:e,...t})=>t});var Fqo=ae.objectWithoutOptionalProperties({typeId:kx,fernFilepath:jne,name:Pd,displayName:Pzn.optional(),default:Nqo.optional(),inline:ae.boolean().optional()});var Hy=ae.union(ae.discriminant("type","_type"),{container:ae.object({container:ae.lazy(()=>nxn)}),named:Fqo,primitive:ae.object({primitive:ixn}),unknown:ae.object({})}).transform({transform:e=>{switch(e.type){case"container":return Kc.container(e.container);case"named":return Kc.named(e);case"primitive":return Kc.primitive(e.primitive);case"unknown":return Kc.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var nnp=ae.objectWithoutOptionalProperties({default:hli.optional(),name:CB});var Lqo=ae.union("type",{string:ae.object({string:ae.string()}),boolean:ae.object({boolean:ae.boolean()})}).transform({transform:e=>{switch(e.type){case"string":return D9.string(e.string);case"boolean":return D9.boolean(e.boolean);default:return e}},untransform:({_visit:e,...t})=>t});var nxn=ae.union(ae.discriminant("type","_type"),{list:ae.object({list:ae.lazy(()=>Hy)}),map:ae.lazyObject(()=>Uqo),nullable:ae.object({nullable:ae.lazy(()=>Hy)}),optional:ae.object({optional:ae.lazy(()=>Hy)}),set:ae.object({set:ae.lazy(()=>Hy)}),literal:ae.object({literal:Lqo})}).transform({transform:e=>{switch(e.type){case"list":return Py.list(e.list);case"map":return Py.map(e);case"nullable":return Py.nullable(e.nullable);case"optional":return Py.optional(e.optional);case"set":return Py.set(e.set);case"literal":return Py.literal(e.literal);default:return e}},untransform:({_visit:e,...t})=>t});var Uqo=ae.objectWithoutOptionalProperties({keyType:ae.lazy(()=>Hy),valueType:ae.lazy(()=>Hy)});var Vqo=ae.objectWithoutOptionalProperties({value:qh});var axn=ae.union("type",{alias:ae.lazyObject(()=>Wqo),enum:Vqo,object:ae.lazyObject(()=>cxn),union:ae.lazyObject(()=>Hqo),undiscriminatedUnion:ae.lazyObject(()=>$qo)}).transform({transform:e=>{switch(e.type){case"alias":return Rw.alias(e);case"enum":return Rw.enum(e);case"object":return Rw.object(e);case"union":return Rw.union(e);case"undiscriminatedUnion":return Rw.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var Wqo=ae.objectWithoutOptionalProperties({value:ae.lazyObject(()=>nm)});var cxn=ae.objectWithoutOptionalProperties({properties:ae.list(ae.lazyObject(()=>Gqo))});var Gqo=ae.objectWithoutOptionalProperties({name:qh,value:ae.lazyObject(()=>nm),originalTypeDeclaration:CB});var Hqo=ae.objectWithoutOptionalProperties({discriminant:qh,singleUnionType:ae.lazyObject(()=>Qqo)});var $qo=ae.objectWithoutOptionalProperties({index:ae.number(),singleUnionType:ae.lazyObject(()=>nm)});var Qqo=ae.objectWithoutOptionalProperties({wireDiscriminantValue:qh,shape:ae.lazy(()=>Jqo)});var Jqo=ae.union("type",{samePropertiesAsObject:ae.lazyObject(()=>Kqo),singleProperty:ae.lazyObject(()=>nm),noProperties:ae.object({})}).transform({transform:e=>{switch(e.type){case"samePropertiesAsObject":return i3.samePropertiesAsObject(e);case"singleProperty":return i3.singleProperty(e);case"noProperties":return i3.noProperties();default:return e}},untransform:({_visit:e,...t})=>t});var nm=ae.objectWithoutOptionalProperties({shape:ae.lazy(()=>Yqo)}).extend(ckt);var Xqo=ae.objectWithoutOptionalProperties({datetime:ae.date(),raw:ae.string().optional()});var lxn=ae.union("type",{integer:ae.object({integer:ae.number()}),long:ae.object({long:ae.number()}),uint:ae.object({uint:ae.number()}),uint64:ae.object({uint64:ae.number()}),float:ae.object({float:ae.number()}),double:ae.object({double:ae.number()}),boolean:ae.object({boolean:ae.boolean()}),string:ae.object({string:ODo}),date:ae.object({date:ae.string()}),datetime:Xqo,uuid:ae.object({uuid:ae.string()}),base64:ae.object({base64:ae.string()}),bigInteger:ae.object({bigInteger:ae.string()})}).transform({transform:e=>{switch(e.type){case"integer":return Fd.integer(e.integer);case"long":return Fd.long(e.long);case"uint":return Fd.uint(e.uint);case"uint64":return Fd.uint64(e.uint64);case"float":return Fd.float(e.float);case"double":return Fd.double(e.double);case"boolean":return Fd.boolean(e.boolean);case"string":return Fd.string(e.string);case"date":return Fd.date(e.date);case"datetime":return Fd.datetime(e);case"uuid":return Fd.uuid(e.uuid);case"base64":return Fd.base64(e.base64);case"bigInteger":return Fd.bigInteger(e.bigInteger);default:return e}},untransform:({_visit:e,...t})=>t});var Yqo=ae.union("type",{primitive:ae.object({primitive:lxn}),container:ae.object({container:ae.lazy(()=>Zqo)}),unknown:ae.object({unknown:ae.unknown()}),named:ae.lazyObject(()=>kqo)}).transform({transform:e=>{switch(e.type){case"primitive":return Vh.primitive(e.primitive);case"container":return Vh.container(e.container);case"unknown":return Vh.unknown(e.unknown);case"named":return Vh.named(e);default:return e}},untransform:({_visit:e,...t})=>t});var eTo=ae.objectWithoutOptionalProperties({literal:lxn});var Zqo=ae.union("type",{list:ae.lazyObject(()=>tTo),set:ae.lazyObject(()=>rTo),optional:ae.lazyObject(()=>iTo),nullable:ae.lazyObject(()=>nTo),map:ae.lazyObject(()=>aTo),literal:eTo}).transform({transform:e=>{switch(e.type){case"list":return mm.list(e);case"set":return mm.set(e);case"optional":return mm.optional(e);case"nullable":return mm.nullable(e);case"map":return mm.map(e);case"literal":return mm.literal(e);default:return e}},untransform:({_visit:e,...t})=>t});var tTo=ae.objectWithoutOptionalProperties({list:ae.list(ae.lazyObject(()=>nm)),itemType:ae.lazy(()=>Hy)});var rTo=ae.objectWithoutOptionalProperties({set:ae.list(ae.lazyObject(()=>nm)),itemType:ae.lazy(()=>Hy)});var iTo=ae.objectWithoutOptionalProperties({optional:ae.lazyObject(()=>nm).optional(),valueType:ae.lazy(()=>Hy)});var nTo=ae.objectWithoutOptionalProperties({nullable:ae.lazyObject(()=>nm).optional(),valueType:ae.lazy(()=>Hy)});var aTo=ae.objectWithoutOptionalProperties({map:ae.list(ae.lazyObject(()=>oTo)),keyType:ae.lazy(()=>Hy),valueType:ae.lazy(()=>Hy)});var oTo=ae.objectWithoutOptionalProperties({key:ae.lazyObject(()=>nm),value:ae.lazyObject(()=>nm)});var kqo=ae.objectWithoutOptionalProperties({typeName:CB,shape:ae.lazy(()=>axn)});var Kqo=ae.objectWithoutOptionalProperties({typeId:kx,object:ae.lazyObject(()=>cxn)});var T8s={};mo(T8s,{VariableDeclaration:()=>wqo,VariableId:()=>Uzn});var C8s={};mo(C8s,{ExampleWebhookCall:()=>iqo,InlinedWebhookPayload:()=>eqo,InlinedWebhookPayloadProperty:()=>kAo,Webhook:()=>nqo,WebhookGroup:()=>aqo,WebhookHttpMethod:()=>ZAo,WebhookName:()=>XAo,WebhookPayload:()=>rqo,WebhookPayloadReference:()=>tqo});var B8s={};mo(B8s,{ExampleWebSocketMessage:()=>_qo,ExampleWebSocketMessageBody:()=>pqo,ExampleWebSocketSession:()=>hqo,InlinedWebSocketMessageBody:()=>cqo,InlinedWebSocketMessageBodyProperty:()=>sqo,WebSocketChannel:()=>yqo,WebSocketMessage:()=>dqo,WebSocketMessageBody:()=>fqo,WebSocketMessageBodyReference:()=>lqo,WebSocketMessageId:()=>oxn,WebSocketMessageOrigin:()=>uqo,WebSocketName:()=>oqo});var sZ={integer:"integer",long:"long",uint:"uint",uint64:"uint64",float:"float",double:"double",boolean:"boolean",string:"string",datetime:"datetime",base64:"base64",uuid:"uuid",date:"date",bigint:"bigint",unknown:"unknown"};var wne={MAP:/^map<\s*([^,]*)\s*,\s*(.*)\s*>$/,LIST:/^list<\s*(.*)\s*>$/,SET:/^set<\s*(.*)\s*>$/,OPTIONAL:/^optional<\s*(.*)\s*>$/,NULLABLE:/^nullable<\s*(.*)\s*>$/,LITERAL:/^literal<\s*(?:"(.*)"|(true|false))\s*>$/};function uWi({type:e,_default:t,validation:r,visitor:i}){switch(e){case sZ.integer:{let o=r??void 0;return i.primitive({v1:Uh.Integer,v2:Ed.integer({default:t??void 0,validation:o!=null?{min:o.min,max:o.max,exclusiveMin:o.exclusiveMin,exclusiveMax:o.exclusiveMax,multipleOf:o.multipleOf}:void 0})})}case sZ.double:{let o=r??void 0;return i.primitive({v1:Uh.Double,v2:Ed.double({default:t??void 0,validation:o!=null?{min:o.min,max:o.max,exclusiveMin:o.exclusiveMin,exclusiveMax:o.exclusiveMax,multipleOf:o.multipleOf}:void 0})})}case sZ.string:{let o=r??void 0;return i.primitive({v1:Uh.String,v2:Ed.string({default:t??void 0,validation:o!=null?{format:o.format,pattern:o.pattern,minLength:o.minLength,maxLength:o.maxLength}:void 0})})}case sZ.float:return i.primitive({v1:Uh.Float,v2:void 0});case sZ.long:return i.primitive({v1:Uh.Long,v2:Ed.long({default:t??void 0})});case sZ.boolean:return i.primitive({v1:Uh.Boolean,v2:Ed.boolean({default:t??void 0})});case sZ.datetime:return i.primitive({v1:Uh.DateTime,v2:void 0});case sZ.date:return i.primitive({v1:Uh.Date,v2:void 0});case sZ.uuid:return i.primitive({v1:Uh.Uuid,v2:void 0});case sZ.base64:return i.primitive({v1:Uh.Base64,v2:void 0});case sZ.bigint:return i.primitive({v1:Uh.BigInteger,v2:Ed.bigInteger({default:t??void 0})});case sZ.uint:return i.primitive({v1:Uh.Uint,v2:void 0});case sZ.uint64:return i.primitive({v1:Uh.Uint64,v2:void 0});case sZ.unknown:return i.unknown()}let n=e.match(wne.MAP);if(n?.[1]!=null&&n[2]!=null)return i.map({keyType:n[1],valueType:n[2]});let a=e.match(wne.LIST);if(a?.[1]!=null)return i.list(a[1]);let u=e.match(wne.SET);if(u?.[1]!=null)return i.set(u[1]);let l=e.match(wne.OPTIONAL);if(l?.[1]!=null)return i.optional(l[1]);let d=e.match(wne.NULLABLE);if(d?.[1]!=null)return i.nullable(d[1]);let s=e.match(wne.LITERAL);if(s?.[1]!=null)return i.literal(D9.string(s[1]));if(s?.[2]!=null){let o=s[2];switch(o){case"false":return i.literal(D9.boolean(!1));case"true":return i.literal(D9.boolean(!0));default:throw new Error(`Unsupported literal value: ${o}`)}}return i.named(e)}var anp="bytes";function dkt(e){if(e===anp)return{isOptional:!1};if(e.match(wne.OPTIONAL)?.[1]===anp)return{isOptional:!0}}function f1a(e){let t=typeof e=="string"?e:typeof e.body=="string"?e.body:void 0;if(t!=null)return dkt(t)}function z8s({input:e,typeName:t}){for(let r of e.arguments)if(typeof r=="string"){if(r===t)return!0}else if(z8s({input:r,typeName:t}))return!0;return!1}function onp(e){return z8s({input:e,typeName:"file"})}function unp(e){let t=0,r=0;function i(){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t>=e.length)return;let a="";for(;t<e.length&&e[t]!=="<"&&e[t]!==","&&e[t]!==">";)a+=e[t++];if(a.trim()){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t<e.length&&e[t]==="<"){if(t++,r++,r>128)throw new Error("Internal error; Exceeded maximum recursion depth while parsing generics.");let u={name:a.trim(),arguments:[]};for(;t<e.length&&e[t]!==">";){for(;t<e.length&&/[\s,]/.test(e[t]);)t++;if(t<e.length&&e[t]!==">"){let l=i();l&&u.arguments.push(l)}}if(t<e.length&&e[t]===">")t++,r--;else throw new Error("Malformed input: missing closing '>' for generic arguments.");return u}else return a.trim()}}let n=i();if(typeof n=="object")return n}var x8s="file";function snp(e){return e.match(wne.LIST)?.[1]===x8s}function Zxe(e){if(e===x8s)return{isOptional:!1,isArray:!1};let t=e.match(wne.OPTIONAL);if(t?.[1]!==void 0){if(t[1]===x8s)return{isOptional:!0,isArray:!1};if(snp(t[1]))return{isOptional:!0,isArray:!0}}if(snp(e))return{isOptional:!1,isArray:!0}}function omS(e){return typeof e=="string"?!1:_M.parse(e["content-type"])?.isMultiPartFormData()??!1?!0:e.body==null?!1:!!(KC(e.body)&&Object.values(e.body.properties??[]).some(smS))}function sWi(e){if(!(!omS(e)||e.body==null)&&e.name!=null&&e.body!=null&&KC(e.body))return umS(e.name,e.body)}function umS(e,t){let r=Object.entries(t.properties??[]).reduce((i,[n,a])=>{let u=typeof a!="string"?a.docs:void 0,l=typeof a!="string"?a["content-type"]:void 0,d=typeof a!="string"?a.style:void 0,s=Zxe(typeof a=="string"?a:a.type);return s!=null?i.push({isFile:!0,key:n,docs:u,isOptional:s.isOptional,isArray:s.isArray,contentType:l,style:d}):i.push({isFile:!1,key:n,propertyType:a,docs:u,contentType:l,style:d}),i},[]);return t["extra-properties"],{name:e,extends:t.extends,properties:r}}function smS(e){let t=typeof e=="string"?e:e.type;if(t==="file")return!0;if(!t.includes("file"))return!1;let r=unp(t);return r==null?!1:onp(r)}var cnp="text";function d1a(e){if(e===cnp)return{isOptional:!1};if(e.match(wne.OPTIONAL)?.[1]===cnp)return{isOptional:!0}}function q2({type:e,_default:t,validation:r,visitor:i}){return uWi({type:e,_default:t,validation:r,visitor:{primitive:i.primitive,map:({keyType:n,valueType:a})=>i.map({keyType:q2({type:n,_default:void 0,validation:void 0,visitor:i}),valueType:q2({type:a,_default:void 0,validation:void 0,visitor:i})}),list:n=>i.list(q2({type:n,_default:void 0,validation:void 0,visitor:i})),set:n=>i.set(q2({type:n,_default:void 0,validation:void 0,visitor:i})),optional:n=>i.optional(q2({type:n,_default:t,validation:r,visitor:i})),nullable:n=>i.nullable(q2({type:n,_default:t,validation:r,visitor:i})),literal:i.literal,named:i.named,unknown:i.unknown}})}function R8s(e,t){if(cmS(e))return t.sdk(e);if(lmS(e))return t.language(e);jo(e)}function cmS(e){return e.sdk!=null}function lmS(e){return e.language!=null}function lnp(e){return e["response-stream"]!=null&&(typeof e["response-stream"]=="string"||e["response-stream"].format==null||e["response-stream"].format==="json")}function fnp(e){return e["response-stream"]!=null&&typeof e["response-stream"]!="string"&&e["response-stream"].format==="sse"}function cWi(e,t,r){return fmS(e,t)?r.stream(t):dmS(e,t)?r.events(t):r.body(t)}function fmS(e,t){return t.stream!==void 0&&lnp(e)}function dmS(e,t){return t.stream!==void 0&&fnp(e)}function lWi(e,t){if(dnp(e))return t.single(e);if(pnp(e))return t.any(e);jo(e)}function dnp(e){return typeof e=="string"||e.scheme!=null}function pnp(e){let[t,...r]=Object.keys(e);return t==="any"&&r.length===0}function p1a(e,t){if(_np(e))return t.header(e);switch(e.scheme){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"oauth":return t.oauth(e);default:jo(e)}}function _np(e){return e.header!=null}function pkt(e,t){if(hnp(e))return t.singleBaseUrl(e);if(fxn(e))return t.multipleBaseUrls(e);jo(e)}function hnp(e){return typeof e=="string"||"url"in e}function fxn(e){return typeof e!="string"&&"urls"in e}function dxn(e){return typeof e=="string"?e.startsWith("$"):"variable"in e}function a3(e,t){if(l1i(e))return t.alias(e);if(f1i(e))return t.discriminatedUnion(e);if(xS(e))return t.object(e);if(pxn(e))return t.undiscriminatedUnion(e);if(EVt(e))return t.enum(e);jo(e)}function l1i(e){return typeof e=="string"||e.type!=null}function xS(e){return e.extends!=null||e.properties!=null}function f1i(e){return e.union!=null&&e.discriminated==null}function pxn(e){let t=e;return t.union!=null&&t.discriminated!=null}function EVt(e){return e.enum!=null}var fWi=class{REFERENCE_REGEX=/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/;validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let i=t.match(this.REFERENCE_REGEX);if(!(i==null||i[1]==null||i[2]==null))return{method:i[1],path:i[2]}}};var iA=ui(TWi(),1),F9s=ui(hO(),1),C1i={shouldUseTitleAsName:void 0,shouldUseUndiscriminatedUnionsWithLiterals:void 0,shouldUseIdiomaticRequestNames:void 0,asyncApiMessageNaming:void 0,onlyIncludeReferencedSchemas:void 0,shouldUseOptionalAdditionalProperties:void 0,coerceEnumsToLiterals:void 0,objectQueryParameters:void 0,respectReadonlySchemas:void 0,respectNullableSchemas:void 0,inlinePathParameters:void 0,useBytesForBinaryResponse:void 0,respectForwardCompatibleEnums:void 0,filter:void 0,exampleGeneration:void 0,defaultFormParameterEncoding:void 0,additionalPropertiesDefaultsTo:void 0,typeDatesAsStrings:void 0,preserveSingleSchemaOneOf:void 0};async function jdp({absolutePathToGeneratorsConfiguration:e,rawGeneratorsConfiguration:t,context:r}){let i=Mdp(t.metadata),n=t.readme;hTS(r,t);let a=await nTS(t);return{absolutePathToConfiguration:e,api:a,rawConfiguration:t,defaultGroup:t["default-group"],reviewers:t.reviewers,groups:t.groups!=null?await Promise.all(Object.entries(t.groups).map(([u,l])=>aTS({absolutePathToGeneratorsConfiguration:e,groupName:u,group:l,maybeTopLevelMetadata:i,maybeTopLevelReviewers:t.reviewers,readme:n}))):[],whitelabel:t.whitelabel!=null&&t.whitelabel.github!=null?{github:t.whitelabel.github}:void 0}}function qCo(e){return{...C1i,shouldUseTitleAsName:e?.["use-title"],shouldUseUndiscriminatedUnionsWithLiterals:e?.unions==="v1",asyncApiMessageNaming:e?.["message-naming"],respectNullableSchemas:e?.["respect-nullable-schemas"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],inlinePathParameters:e?.["inline-path-parameters"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"]}}function wdp(e){return{...Sdp(e),shouldUseUndiscriminatedUnionsWithLiterals:e?.["prefer-undiscriminated-unions-with-literals"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],objectQueryParameters:e?.["object-query-parameters"],respectReadonlySchemas:e?.["respect-readonly-schemas"],inlinePathParameters:e?.["inline-path-parameters"],filter:e?.filter,exampleGeneration:e?.["example-generation"],defaultFormParameterEncoding:e?.["default-form-parameter-encoding"],useBytesForBinaryResponse:e?.["use-bytes-for-binary-response"],respectForwardCompatibleEnums:e?.["respect-forward-compatible-enums"],additionalPropertiesDefaultsTo:e?.["additional-properties-defaults-to"],typeDatesAsStrings:e?.["type-dates-as-strings"],preserveSingleSchemaOneOf:e?.["preserve-single-schema-oneof"]}}function rTS(e){return{...Sdp(e),asyncApiMessageNaming:e?.["message-naming"]}}function Sdp(e){return{...C1i,shouldUseTitleAsName:e?.["title-as-schema-name"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],shouldUseOptionalAdditionalProperties:e?.["optional-additional-properties"]??!0,coerceEnumsToLiterals:e?.["coerce-enums-to-literals"],respectNullableSchemas:e?.["respect-nullable-schemas"]}}async function Odp(e,t){let r=[];if(e!=null)if(typeof e=="string")r.push({schema:{type:"oss",path:e},origin:void 0,overrides:void 0,audiences:[],settings:{...C1i}});else if(gy.isRawProtobufAPIDefinitionSchema(e))r.push({schema:{type:"protobuf",root:e.proto.root,target:e.proto.target??"",localGeneration:e.proto["local-generation"]??!1},origin:void 0,overrides:e.proto.overrides,audiences:[],settings:{...C1i}});else if(Array.isArray(e))for(let i of e)typeof i=="string"?r.push({schema:{type:"oss",path:i},origin:void 0,overrides:void 0,audiences:[],settings:{...C1i}}):gy.isRawProtobufAPIDefinitionSchema(i)?r.push({schema:{type:"protobuf",root:i.proto.root,target:i.proto.target??"",localGeneration:i.proto["local-generation"]??!1},origin:void 0,overrides:i.proto.overrides,audiences:[],settings:{...C1i}}):r.push({schema:{type:"oss",path:i.path},origin:i.origin,overrides:i.overrides,audiences:i.audiences,settings:qCo(i.settings)});else r.push({schema:{type:"oss",path:e.path},origin:e.origin,overrides:e.overrides,audiences:e.audiences,settings:qCo(e.settings)});else{let i=t[gy.API_SETTINGS_KEY],n=t[gy.OPENAPI_LOCATION_KEY],a=t[gy.API_ORIGIN_LOCATION_KEY],u=t[gy.OPENAPI_OVERRIDES_LOCATION_KEY],l=t[gy.ASYNC_API_LOCATION_KEY];n!=null&&(typeof n=="string"?r.push({schema:{type:"oss",path:n},origin:a,overrides:u,audiences:[],settings:qCo(i)}):typeof n=="object"&&r.push({schema:{type:"oss",path:n.path},origin:n.origin,overrides:n.overrides,audiences:[],settings:wdp(n.settings)})),l!=null&&r.push({schema:{type:"oss",path:l},origin:a,overrides:void 0,audiences:[],settings:qCo(i)})}return r}async function iTS({apiConfiguration:e,rawConfiguration:t}){let r={"auth-schemes":e.auth!=null?Object.fromEntries(Object.entries(t["auth-schemes"]??{}).filter(([a,u])=>e.auth==null?!1:lWi(e.auth,{any:l=>l.any.includes(a),single:l=>l===a}))):void 0,...e};if(gy.isConjureSchema(e.specs))return{type:"conjure",pathToConjureDefinition:e.specs.conjure,...r};let i=[],n={};for(let a of e.specs??[]){let u;if(gy.isOpenApiSpecSchema(a))u={schema:{type:"oss",path:a.openapi},origin:a.origin,overrides:a.overrides,audiences:[],settings:wdp(a.settings)};else if(gy.isAsyncApiSpecSchema(a))u={schema:{type:"oss",path:a.asyncapi},origin:a.origin,overrides:a.overrides,audiences:[],settings:rTS(a.settings)};else if(gy.isProtoSpecSchema(a))u={schema:{type:"protobuf",root:a.proto.root,target:a.proto.target??"",localGeneration:a.proto["local-generation"]??!1},origin:void 0,overrides:a.proto.overrides,audiences:[],settings:{...C1i}};else if(gy.isOpenRpcSpecSchema(a))u={schema:{type:"openrpc",path:a.openrpc},origin:void 0,overrides:a.overrides,audiences:[],settings:{...C1i}};else continue;"namespace"in a&&a.namespace!=null?(n[a.namespace]??=[],n[a.namespace].push(u)):i.push(u)}return Object.keys(n).length===0?{type:"singleNamespace",definitions:i,...r}:{type:"multiNamespace",rootDefinitions:i,definitions:n,...r}}async function nTS(e){let t=e.api;if(t!=null){if(gy.isApiConfigurationV2Schema(t))return iTS({apiConfiguration:t,rawConfiguration:e});if(gy.isNamespacedApiConfiguration(t)){let r={};for(let[i,n]of Object.entries(t.namespaces))r[i]=await Odp(n,e);return{type:"multiNamespace",rootDefinitions:void 0,definitions:r}}}return{type:"singleNamespace",definitions:await Odp(t,e)}}async function aTS({absolutePathToGeneratorsConfiguration:e,groupName:t,group:r,maybeTopLevelMetadata:i,maybeTopLevelReviewers:n,readme:a}){let u=Mdp(r.metadata);return{groupName:t,reviewers:r.reviewers,audiences:r.audiences==null?{type:"all"}:{type:"select",audiences:r.audiences},generators:await Promise.all(r.generators.map(l=>oTS({absolutePathToGeneratorsConfiguration:e,generator:l,maybeTopLevelMetadata:i,maybeGroupLevelMetadata:u,maybeTopLevelReviewers:n,maybeGroupLevelReviewers:r.reviewers,readme:a})))}}async function oTS({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:i,maybeGroupLevelReviewers:n,maybeTopLevelReviewers:a,readme:u}){return{raw:t,name:t.name,version:t.version,config:t.config,outputMode:await cTS({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:i,maybeGroupLevelReviewers:n,maybeTopLevelReviewers:a}),keywords:t.keywords,smartCasing:t["smart-casing"]??!1,disableExamples:t["disable-examples"]??!1,absolutePathToLocalOutput:t.output?.location==="local-file-system"?Gv(Cd(e),t.output.path):void 0,absolutePathToLocalSnippets:t.snippets?.path!=null?Gv(Cd(e),t.snippets.path):void 0,language:dTS(t.name),irVersionOverride:t["ir-version"]??void 0,publishMetadata:uTS({generatorInvocation:t}),readme:u,settings:t.api?.settings??void 0}}function uTS({generatorInvocation:e}){let t=e["publish-metadata"];if(t!=null)return{packageDescription:t["package-description"],publisherEmail:t.email,publisherName:t.author,referenceUrl:t["reference-url"]};if(e.metadata!=null)return{packageDescription:e.metadata["package-description"],publisherEmail:e.metadata.email,publisherName:e.metadata.author,referenceUrl:e.metadata["reference-url"]}}function Ddp({pypiOutputMetadata:e,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r}){let i;return e!=null&&(i=_TS(e),i={...r,...t,...i}),i}function sTS({topLevelReviewers:e,groupLevelReviewers:t,outputModeReviewers:r}){let i=new Set,n=new Set,a=[],u=[...e?.teams??[],...t?.teams??[],...r?.teams??[]],l=[...e?.users??[],...t?.users??[],...r?.users??[]];for(let d of u)i.has(d.name)||(a.push(F9s.GithubPullRequestReviewer.team({name:d.name})),i.add(d.name));for(let d of l)n.has(d.name)||(a.push(F9s.GithubPullRequestReviewer.user({name:d.name})),n.add(d.name));return a}async function cTS({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r={},maybeTopLevelMetadata:i={},maybeGroupLevelReviewers:n,maybeTopLevelReviewers:a}){let u=t.snippets!=null&&t.snippets.path!=="";if(t.github!=null&&!R1a(t.github)){let l=t.github.repository.indexOf("/"),d=t.github.repository.slice(0,l),s=t.github.repository.slice(l+1),o=t.output!=null?fTS(t.output,r,i):void 0,c=pTS(t),b=c!=null?await lTS({absolutePathToGeneratorsConfiguration:e,githubLicense:c}):void 0,g=t.github.mode??"release";switch(g){case"commit":case"release":return iA.FernFiddle.OutputMode.githubV2(iA.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:d,repo:s,license:b,publishInfo:o,downloadSnippets:u}));case"pull-request":{let O=sTS({topLevelReviewers:a,groupLevelReviewers:n,outputModeReviewers:t.github.reviewers});return iA.FernFiddle.OutputMode.githubV2(iA.FernFiddle.GithubOutputModeV2.pullRequest({owner:d,repo:s,license:b,publishInfo:o,downloadSnippets:u,reviewers:O}))}case"push":return iA.FernFiddle.OutputMode.githubV2(iA.FernFiddle.GithubOutputModeV2.push({owner:d,repo:s,branch:t.github.mode==="push"?t.github.branch:void 0,license:b,publishInfo:o,downloadSnippets:u}));default:jo(g)}}if(t.output==null)return iA.FernFiddle.remoteGen.OutputMode.publish({registryOverrides:{}});switch(t.output.location){case"local-file-system":return iA.FernFiddle.OutputMode.downloadFiles({downloadSnippets:u});case"npm":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.npmOverride({registryUrl:t.output.url??"https://registry.npmjs.org",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:u}));case"maven":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.mavenOverride({registryUrl:Edp(t.output),username:t.output.username??"",password:t.output.password??"",coordinate:t.output.coordinate,signature:t.output.signature!=null?{keyId:t.output.signature.keyId,secretKey:t.output.signature.secretKey,password:t.output.signature.password}:void 0,downloadSnippets:u}));case"postman":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.postman({apiKey:t.output["api-key"],workspaceId:t.output["workspace-id"]}));case"pypi":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.pypiOverride({registryUrl:t.output.url??"https://upload.pypi.org/legacy/",username:t.output.token!=null?"__token__":t.output.password??"",password:t.output.token??t.output.password??"",coordinate:t.output["package-name"],downloadSnippets:u,pypiMetadata:Ddp({pypiOutputMetadata:t.output.metadata,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:i})}));case"nuget":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.nugetOverride({registryUrl:t.output.url??"https://nuget.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:u}));case"rubygems":return iA.FernFiddle.OutputMode.publishV2(iA.FernFiddle.remoteGen.PublishOutputModeV2.rubyGemsOverride({registryUrl:t.output.url??"https://rubygems.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:u}));default:jo(t.output)}}async function lTS({absolutePathToGeneratorsConfiguration:e,githubLicense:t}){if(typeof t=="string")switch(t){case"MIT":return iA.FernFiddle.GithubLicense.basic({id:iA.FernFiddle.GithubLicenseId.Mit});case"Apache-2.0":return iA.FernFiddle.GithubLicense.basic({id:iA.FernFiddle.GithubLicenseId.Apache});default:jo(t)}let r=Ru(ll.of(Pdp.default.dirname(e)),Na.of(t.custom)),i=await(0,mdp.readFile)(r);return iA.FernFiddle.GithubLicense.custom({contents:i.toString()})}function fTS(e,t,r){switch(e.location){case"local-file-system":throw new Error("Cannot use local-file-system with github publishing");case"npm":return iA.FernFiddle.GithubPublishInfo.npm({registryUrl:e.url??"https://registry.npmjs.org",packageName:e["package-name"],token:e.token});case"maven":return iA.FernFiddle.GithubPublishInfo.maven({registryUrl:Edp(e),coordinate:e.coordinate,credentials:e.username!=null&&e.password!=null?{username:e.username,password:e.password}:void 0,signature:e.signature!=null?{keyId:e.signature.keyId,password:e.signature.password,secretKey:e.signature.secretKey}:void 0});case"postman":return iA.FernFiddle.GithubPublishInfo.postman({apiKey:e["api-key"],workspaceId:e["workspace-id"]});case"pypi":return iA.FernFiddle.GithubPublishInfo.pypi({registryUrl:e.url??"https://upload.pypi.org/legacy/",packageName:e["package-name"],credentials:e.token!=null?{username:"__token__",password:e.token}:{username:e.username??"",password:e.password??""},pypiMetadata:Ddp({pypiOutputMetadata:e.metadata,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r})});case"nuget":return iA.FernFiddle.GithubPublishInfo.nuget({registryUrl:e.url??"https://nuget.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"rubygems":return iA.FernFiddle.GithubPublishInfo.rubygems({registryUrl:e.url??"https://rubygems.org/",packageName:e["package-name"],apiKey:e["api-key"]});default:jo(e)}}function dTS(e){if(e.includes("csharp"))return gy.GenerationLanguage.CSHARP;if(e.includes("go"))return gy.GenerationLanguage.GO;if(e.includes("java")||e.includes("spring"))return gy.GenerationLanguage.JAVA;if(e.includes("php"))return gy.GenerationLanguage.PHP;if(e.includes("python")||e.includes("fastapi")||e.includes("pydantic"))return gy.GenerationLanguage.PYTHON;if(e.includes("ruby"))return gy.GenerationLanguage.RUBY;if(e.includes("swift"))return gy.GenerationLanguage.SWIFT;if(e.includes("typescript"))return gy.GenerationLanguage.TYPESCRIPT}function Edp(e){return e.url!=null?e.url:e.signature!=null?"https://oss.sonatype.org/service/local/staging/deploy/maven2/":"https://s01.oss.sonatype.org/content/repositories/releases/"}function pTS(e){return e["publish-metadata"]?.license!=null?e["publish-metadata"].license:e.metadata?.license!=null?e.metadata.license:R1a(e.github)?void 0:e.github?.license}function Mdp(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email}))}:void 0}function _TS(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email})),keywords:e.keywords,documentationLink:e["documentation-link"],homepageLink:e["homepage-link"]}:void 0}function hTS(e,t){let r=[];t["api-settings"]!=null&&r.push('"api-settings" is deprecated. Please use "api.specs[].settings" instead.'),t["async-api"]!=null&&r.push('"async-api" is deprecated. Please use "api.specs[].asyncapi" instead.'),t.openapi!=null&&r.push('"openapi" is deprecated. Please use "api.specs[].openapi" instead.'),t["openapi-overrides"]!=null&&r.push('"openapi-overrides" is deprecated. Please use "api.specs[].overrides" instead.'),t["spec-origin"]&&r.push('"spec-origin" is deprecated. Please use "api.specs[].origin" instead.'),t.api!=null&&(typeof t.api=="string"&&r.push('Using an OpenAPI or AsyncAPI path string for "api" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),Array.isArray(t.api)?r.push('Using an array for "api" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" instead.'):typeof t.api=="object"&&("path"in t.api&&r.push('Using "api.path" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),"proto"in t.api&&r.push('Using "api.proto" is deprecated. Please use "api.specs[].proto" instead.'),"namespaces"in t.api&&r.push('Using "api.namespaces" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" with the "namespace" property instead.'))),r.length>0&&(e.logger.warn("Warnings for generators.yml:"),e.logger.warn(" "+r.join(`
@@ -1712,7 +1712,7 @@ ${gAp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&FQs(th
1712
1712
  `+DHi.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?DHi.default.cyan(MAp(t,this.opt.mask)):DHi.default.italic(DHi.default.dim("[hidden]")):this.opt.mask?MAp(t,this.opt.mask):DHi.default.italic(DHi.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var IFo=ui(z2(),1),kqp=ui(TJs(),1),eTp=ui(zEe(),1);var NDa=class extends x2{_run(t){this.done=t,this.editorResult=new eTp.Subject;let r=wW(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?IFo.default.dim("Received"):IFo.default.dim("Press <enter> to launch your preferred editor."),t&&(r=IFo.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,kqp.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 aTp=require("stream");var iTp=ui(require("readline"),1),nTp=ui(rTp(),1),IHi=class{constructor(t){this.rl||=iTp.default.createInterface(NpD(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 NpD(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new nTp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var FDa=class extends IHi{constructor(t={}){super(t),this.log=new aTp.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return ODa(this.rl,this.bottomBar.split(`
1713
1713
  `).length),this}updateBottomBar(t){return ODa(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+`
1714
1714
  `}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&&sFo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var LE=ui(zEe(),1),sTp=ui(VSa(),1);var zFo=ui(zEe(),1),oTp=ui(VSa(),1),xFo=function(e,t,r){return typeof e[t]!="function"?(0,zFo.of)(e):(0,zFo.from)((0,oTp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var uTp={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,u)=>{n==="__proto__"||n==="constructor"||(a===u.length-1?i[n]=r:(!(n in i)||typeof i[n]!="object")&&(i[n]={}),i=i[n])})},get:(e,t="",r)=>{let i=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((u,l)=>u!=null?u[l]:u,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},eFn=class extends IHi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let i;return Array.isArray(t)?i=(0,LE.from)(t):(0,LE.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,LE.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,LE.from)([t]),this.process=i.pipe((0,LE.concatMap)(this.processQuestion.bind(this)),(0,LE.publish)()),this.process.connect(),this.process.pipe((0,LE.reduce)((n,a)=>(uTp.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,LE.defer)(()=>(0,LE.of)(t).pipe((0,LE.concatMap)(this.setDefaultType.bind(this)),(0,LE.concatMap)(this.filterIfRunnable.bind(this)),(0,LE.concatMap)(()=>xFo(t,"message",this.answers)),(0,LE.concatMap)(()=>xFo(t,"default",this.answers)),(0,LE.concatMap)(()=>xFo(t,"choices",this.answers)),(0,LE.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,LE.defer)(()=>(0,LE.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,LE.defer)(()=>(0,LE.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&uTp.get(this.answers,t.name)!==void 0)return LE.EMPTY;if(t.when===!1)return LE.EMPTY;if(typeof t.when!="function")return(0,LE.of)(t);let{answers:r}=this;return(0,LE.defer)(()=>(0,LE.from)((0,sTp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,LE.filter)(i=>i!=null)))}};function cTp(e){let t=function(r,i){let n;try{n=new eFn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",PDa),this.registerPrompt("input",SHi),this.registerPrompt("number",jDa),this.registerPrompt("confirm",wDa),this.registerPrompt("rawlist",SDa),this.registerPrompt("expand",DDa),this.registerPrompt("checkbox",EDa),this.registerPrompt("password",MDa),this.registerPrompt("editor",NDa)},t.restoreDefaultPrompts(),t}var BJs=cTp();function LpD(e,t){BJs.registerPrompt(e,t)}function UpD(){BJs.restoreDefaultPrompts()}var VpD={prompt:BJs,ui:{BottomBar:FDa,Prompt:eFn},createPromptModule:cTp,registerPrompt:LpD,restoreDefaultPrompts:UpD,Separator:iae},RFo=VpD;var dFn=require("path"),WCp=require("fs"),HCp=require("readline"),_Cp="posthog-node";function jyD(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"]}={}){return a=>{if(!(n==="*"||n.includes(a.level)))return a;a.tags||(a.tags={});let l=a.tags[a3o.POSTHOG_ID_TAG];if(l===void 0)return a;let d=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${l}`,d).toString();a.tags["PostHog Person URL"]=s;let o=a.exception?.values||[],c=o.map(g=>({...g,stacktrace:g.stacktrace?{...g.stacktrace,type:"raw",frames:(g.stacktrace.frames||[]).map(O=>({...O,platform:"node:javascript"}))}:void 0})),b={$exception_message:o[0]?.value||a.message,$exception_type:o[0]?.type,$exception_personURL:s,$exception_level:a.level,$exception_list:c,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:o[0]?.value||a.message,$sentry_exception_type:o[0]?.type,$sentry_tags:a.tags};return t&&r&&(b.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:l,properties:b}),a}}var a3o=class{constructor(t,r,i,n){this.name=_Cp,this.name=_Cp,this.setupOnce=function(a,u){let l=u()?.getClient()?.getDsn()?.projectId;a(jyD(t,{organization:r,projectId:l,prefix:i,severityAllowList:n}))}}};a3o.POSTHOG_ID_TAG="posthog_distinct_id";var e3o="0123456789abcdef",o3o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=e3o.charAt(this.bytes[r]>>>4),t+=e3o.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=e3o.charAt(this.bytes[r]>>>4),t+=e3o.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},PKs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??wyD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return o3o.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,o3o.ofInner(t)}},wyD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),hCp,jKs=()=>SyD().toString(),SyD=()=>(hCp||(hCp=new PKs)).generate();function DyD(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(u=>u.name!=="domainUncaughtExceptionClear"&&u._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function EyD(e,t){global.process.on("uncaughtException",DyD(e,t))}function MyD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var t3o,yCp,r3o;function AyD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return r3o&&r.length===yCp||(yCp=r.length,r3o=r.reduce((i,n)=>{t3o||(t3o={});let a=t3o[n];if(a)i[a[0]]=a[1];else{let u=e(n);for(let l=u.length-1;l>=0;l--){let s=u[l]?.filename,o=t[n];if(s&&o){i[s]=o,t3o[n]=[s,o];break}}}return i},{})),r3o}function qyD(e){return typeof Event<"u"&&$Cp(e,Event)}function TyD(e){return GCp(e,"Object")}function TKs(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return $Cp(e,Error)}}function $Cp(e,t){try{return e instanceof t}catch{return!1}}function CyD(e){return GCp(e,"ErrorEvent")}function GCp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function ByD(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},u=QCp(a,r,i);return{$exception_list:await Promise.all(u.map(async s=>{let o=await LyD(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function QCp(e,t,r){let i=IyD(e,t,r);return i.cause?[i,...QCp(e,i.cause,r)]:[i]}function IyD(e,t,r){if(TKs(t))return t;if(e.synthetic=!0,TyD(t)){let n=zyD(t);if(n)return n;let a=xyD(t),u=r?.syntheticException||new Error(a);return u.message=a,u}let i=r?.syntheticException||new Error(t);return i.message=`${t}`,i}function zyD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(TKs(r))return r}}function xyD(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message '${e.message}'`),i}else if("message"in e&&typeof e.message=="string")return e.message;let t=NyD(e);if(CyD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=RyD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function RyD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function NyD(e,t=40){let r=Object.keys(FyD(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return vCp(i,t);for(let n=r.length;n>0;n--){let a=r.slice(0,n).join(", ");if(!(a.length>t))return n===r.length?a:vCp(a,t)}return""}function vCp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function FyD(e){return TKs(e)?{message:e.message,name:e.name,stack:e.stack,...bCp(e)}:qyD(e)?{type:e.type,target:gCp(e.target),currentTarget:gCp(e.currentTarget),...bCp(e)}:e}function bCp(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function gCp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function LyD(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=UyD(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function UyD(e,t){return VyD(e(t.stack||"",1),e)}function VyD(e,t){let r=AyD(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var WyD=2e3,cFn=class e{static async captureException(t,r,i,n,a){let u={...a};n||(u.$process_person_profile=!1);let l=await ByD(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||jKs(),properties:{...l,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(EyD(this.onException.bind(this),this.onFatalError.bind(this)),MyD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(WyD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function HyD(e=process.argv[1]?(0,dFn.dirname)(process.argv[1]):process.cwd(),t=dFn.sep==="\\"){let r=t?OCp(e):e;return i=>{if(!i)return;let n=t?OCp(i):i,{dir:a,base:u,ext:l}=dFn.posix.parse(n);(l===".js"||l===".mjs"||l===".cjs")&&(u=u.slice(0,l.length*-1));let d=decodeURIComponent(u);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let o=a.slice(r.length+1).replace(/\//g,".");return o?`${o}:${d}`:d}return d}}function OCp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var u3o=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}},n3o=new u3o(25),JCp=new u3o(20),CKs=7,$yD=1e3,GyD=1e4;async function QyD(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||XyD(u)||ZyD(a))continue;t[u]||(t[u]=[]),t[u].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(JCp.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let u=evD(a);if(u.every(d=>kyD(n,d)))continue;let l=tvD(n3o,n,{});i.push(JyD(n,u,l))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&KyD(e,n3o),n3o.reduce(),e}function JyD(e,t,r){return new Promise(i=>{let n=(0,WCp.createReadStream)(e),a=(0,HCp.createInterface)({input:n});function u(){n.destroy(),i()}let l=0,d=0,s=t[d];if(s===void 0){u();return}let o=s[0],c=s[1];function b(){JCp.set(e,1),a.close(),a.removeAllListeners(),u()}n.on("error",b),a.on("error",b),a.on("close",u),a.on("line",g=>{if(l++,!(l<o)&&(r[l]=rvD(g,0),l>=c)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let O=t[d];if(O===void 0){a.close(),a.removeAllListeners();return}o=O[0],c=O[1]}})})}function KyD(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;YyD(r.lineno,r,i)}}function YyD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=KCp(e);n<e;n++){let a=r[n];if(a===void 0){mCp(t);return}t.pre_context.push(a)}if(r[e]===void 0){mCp(t);return}t.context_line=r[e];let i=YCp(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function mCp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function XyD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function ZyD(e){return e.lineno!==void 0&&e.lineno>GyD||e.colno!==void 0&&e.colno>$yD}function kyD(e,t){let r=n3o.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function evD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=PCp(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+CKs:(n.push(i),i=PCp(a)),t++}return n}function PCp(e){return[KCp(e),YCp(e)]}function KCp(e){return Math.max(1,e-CKs)}function YCp(e){return e+CKs}function tvD(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function rvD(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}var ivD="4.18.0",cae;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.DecideEndpointWasHit="decide_endpoint_was_hit",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config"})(cae||(cae={}));var jCp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(jCp||(jCp={}));var wCp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(wCp||(wCp={}));var SCp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(SCp||(SCp={}));var DCp;(function(e){e.Html="html",e.Text="text"})(DCp||(DCp={}));var ECp;(function(e){e.Number="number",e.Emoji="emoji"})(ECp||(ECp={}));var MCp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(MCp||(MCp={}));var ACp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(ACp||(ACp={}));var qCp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(qCp||(qCp={}));var TCp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(TCp||(TCp={}));var nvD=e=>{if("flags"in e){let t=ovD(e.flags),r=uvD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,XCp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,avD(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function avD(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var ovD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,BKs(r)]).filter(([,t])=>t!==void 0)),uvD=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let i=t[r];return i.enabled&&i.metadata&&i.metadata.payload!==void 0}).map(r=>{let i=t[r].metadata?.payload;return[r,i?XCp(i):void 0]}))},BKs=e=>e===void 0?void 0:e.variant??e.enabled,XCp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},svD=1,cvD=new Set(["61be3dd8","96f6df5f","8cfdba9b","bf027177","e59430a8","7fa5500b","569798e9","04809ff7","0ebc61a5","32de7f98","3beeb69a","12d34ad9","733853ec","0645bb64","5dcbee21","b1f95fa3","2189e408","82b460c2","3a8cc979","29ef8843","2cdbf767","38084b54","50f9f8de","41d0df91","5c236689","c11aedd3","ada46672","f4331ee1","42fed62a","c957462c","d62f705a","e0162666","01b3e5cf","441cef7f","bb9cafee","8f348eb0","b2553f3a","97469d7d","39f21a76","03706dcc","27d50569","307584a7","6433e92e","150c7fbb","49f57f22","3772f65b","01eb8256","3c9e9234","f853c7f7","c0ac4b67","cd609d40","10ca9b1a","8a87f11b","8e8e5216","1f6b63b3","db7943dd","79b7164c","07f78e33","2d21b6fd","952db5ee","a7d3b43f","1924dd9c","84e1b8f6","dff631b6","c5aa8a79","fa133a95","498a4508","24748755","98f3d658","21bbda67","7dbfed69","be3ec24c","fc80b8e2","75cc0998"]),lvD="utf8";function fvD(e,t){if(!e||typeof e!="string"||dvD(e))throw new Error(t)}function dvD(e){return e.trim().length===0}function pvD(e){return e?.replace(/\/+$/,"")}async function _vD(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function CCp(){return new Date().getTime()}function OKs(){return new Date().toISOString()}function s3o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function hvD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function yvD(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(16).padStart(8,"0")}function vvD(e,t=0,r){let i=yvD(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function BCp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var KDa=String.fromCharCode,ICp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i3o={};function bvD(e,t){if(!i3o[e]){i3o[e]={};for(let r=0;r<e.length;r++)i3o[e][e.charAt(r)]=r}return i3o[e][t]}var uFn={compressToBase64:function(e){if(e==null)return"";let t=uFn._compress(e,6,function(r){return ICp.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:uFn._decompress(e.length,32,function(t){return bvD(ICp,e.charAt(t))})},compress:function(e){return uFn._compress(e,16,function(t){return KDa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(d=e.charAt(w),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:uFn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=KDa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=KDa(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=KDa(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=KDa(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},wKs=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}},lFn=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},YDa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function zCp(e){if(e instanceof lFn){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function mKs(e){return typeof e=="object"&&(e instanceof lFn||e instanceof YDa)}function xCp(e){return typeof e=="object"&&e instanceof lFn&&e.status===413}var SKs;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(SKs||(SKs={}));var DKs=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new wKs,this._isInitialized=!1,fvD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=pvD(r?.host||"https://us.i.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r?.maxQueueSize??1e3),this.flushInterval=r?.flushInterval??1e4,this.captureMode=r?.captureMode||"json",this.preloadFeatureFlags=r?.preloadFeatureFlags??!0,this.defaultOptIn=r?.defaultOptIn??!0,this.disableSurveys=r?.disableSurveys??!1,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:mKs},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r?.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(cae.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(cae.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(cae.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=jKs();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}async identifyStatelessImmediate(t,r,i){let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",n,i)}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}async captureStatelessImmediate(t,r,i,n){let a=this.buildPayload({distinct_id:t,event:r,properties:i});await this.sendImmediate("capture",a,n)}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}async aliasStatelessImmediate(t,r,i,n){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,n)}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,i,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(n=>n.json()).catch(n=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",n)),this._events.emit("error",n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let l=vvD(this.apiKey,svD,cvD)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,d={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",l)),this.fetchWithRetry(l,d,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>nvD(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagDetailStateless(t,r,i,n,a,u);if(l===void 0)return{response:void 0,requestId:void 0};let d=BKs(l.response);return d===void 0&&(d=!1),{response:d,requestId:l.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagDetailsStateless(r,i,n,a,u,[t]);return l===void 0?void 0:{response:l.flags[t],requestId:l.requestId}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u,[t]);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,u){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,u){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,u){await this._initPromise;let l=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,u);return l?{flags:l.featureFlags,payloads:l.featureFlagPayloads,requestId:l.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,u){await this._initPromise;let l={};(a??this.disableGeoip)&&(l.geoip_disable=!0),u&&(l.flag_keys_to_evaluate=u);let d=await this.getDecide(t,r,i,n,l);if(d!==void 0)return d.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),d.quotaLimited?.includes(SKs.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:d?.requestId}):d}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let u=`Surveys API could not be loaded: ${a.status}`,l=new Error(u);this.logMsgIfDebug(()=>console.error(l)),this._events.emit("error",new Error(u));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return n&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(n))),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(cae.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(cae.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(cae.Props,this.props)})}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n=this.prepareMessage(t,r,i),a=this.getPersistedProperty(cae.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:n}),this.setPersistedProperty(cae.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=s3o(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,i){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={api_key:this.apiKey,batch:[this.prepareMessage(t,r,i)],sent_at:OKs()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${CCp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,l=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(uFn.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(u,l)}catch(d){this._events.emit("error",d)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:OKs(),uuid:i?.uuid?i.uuid:jKs()};return(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId),n}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await zCp(t)})}async flush(){let t=BCp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),BCp([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(cae.Queue)||[];if(!t.length)return;let r=[],i=t.length;for(;t.length>0&&r.length<i;){let n=t.slice(0,this.maxBatchSize),a=n.map(b=>b.message),u=()=>{let g=(this.getPersistedProperty(cae.Queue)||[]).slice(n.length);this.setPersistedProperty(cae.Queue,g),t=g},l={api_key:this.apiKey,batch:a,sent_at:OKs()};this.historicalMigration&&(l.historical_migration=!0);let d=JSON.stringify(l),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${CCp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,o=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(uFn.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},c={retryCheck:b=>xCp(b)?!1:mKs(b)};try{await this.fetchWithRetry(s,o,c)}catch(b){if(xCp(b)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw b instanceof YDa||u(),this._events.emit("error",b),b}u(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let o=new AbortController;return setTimeout(()=>o.abort(),s),o.signal});let u=r.body?r.body:"",l=-1;try{l=Buffer.byteLength(u,lvD)}catch{l=new TextEncoder().encode(u).length}return await _vD(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(o){throw new YDa(o)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new lFn(d,l);return d},{...this._retryOptions,...i})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(cae.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!mKs(n))throw n;await zCp(n)}};return Promise.race([new Promise((n,a)=>{s3o(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),i()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},EKs=hvD();if(!EKs){let e=pCp();EKs=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var ZCp=EKs,c3o=class{constructor(t){this.factory=t}async getValue(){return this.value!==void 0?this.value:(this.initializationPromise===void 0&&(this.initializationPromise=(async()=>{try{let t=await this.factory();return this.value=t,t}finally{this.initializationPromise=void 0}})()),this.initializationPromise)}isInitialized(){return this.value!==void 0}async waitForInitialization(){this.isInitialized()||await this.getValue()}},kCp=new c3o(async()=>{try{return await import("crypto")}catch{return}});async function gvD(){return await kCp.getValue()}var OvD=new c3o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await kCp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function mvD(){return await OvD.getValue()}async function PvD(e){let t=await gvD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await mvD();if(r){let i=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var jvD=60*1e3,wvD=1152921504606847e3,SvD=["is_not"],sFn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},R2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},MKs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||ZCp,this.onError=l.onError,this.customHeaders=u,this.onLoad=l.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=await this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof R2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async d=>{try{let s=await this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof R2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}})),{response:a,payloads:u,fallbackToDecide:l}}async computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new R2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new R2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return await this.matchFeatureFlagProperties(t,i[d],s)}else return await this.matchFeatureFlagProperties(t,r,n)}async matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(await this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=await this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof R2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new R2("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=tBp(l,n,this.cohorts,this.debugMode):s=eBp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await RCp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await RCp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(jvD,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.getPollingInterval());try{let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new sFn(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new sFn(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new sFn(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof sFn&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=s3o(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,i=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;n=s3o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function RCp(e,t,r=""){let i=await PvD(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/wvD}function eBp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new R2("Operator is_not_set is not supported")}else throw new R2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!SvD.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return NCp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return NCp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=DvD(String(n));if(s==null&&(s=FCp(n)),s==null)throw new R2(`Invalid date: ${n}`);let o=FCp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new R2(`Unknown operator: ${a}`)}}function tBp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new R2("can't match cohort without a given cohort property value");let a=r[n];return rBp(a,t,r,i)}function rBp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=rBp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof R2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new R2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=tBp(l,t,r,i):d=eBp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof R2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new R2("can't match cohort without a given cohort property value");return n==="AND"}}function NCp(e){try{return new RegExp(e),!0}catch{return!1}}function FCp(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new R2(`${e} is in an invalid date format`)}else throw new R2(`The date provided ${e} must be a string, number, or date object`)}function DvD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var AKs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},EvD=100,LCp=30*1e3,MvD=50*1e3,qKs=class extends DKs{constructor(t,r={}){if(super(t,r),this._memoryStorage=new AKs,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,EvD):LCp,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');this.featureFlagsPoller=new MKs({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new cFn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||MvD}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):ZCp(t,r)}getLibraryVersion(){return ivD}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:l,disableGeoip:d,uuid:s}=t,o=g=>{super.captureStateless(r,i,g,{timestamp:l,disableGeoip:d,uuid:s})},c=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags,b=Promise.resolve().then(async()=>{if(u)return await c(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[w,E]of Object.entries(g))O[`$feature/${w}`]=E;let m=Object.keys(g||{}).filter(w=>g?.[w]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})});this.addPendingPromise(b)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:l,disableGeoip:d,uuid:s}=t,o=g=>super.captureStatelessImmediate(r,i,g,{timestamp:l,disableGeoip:d,uuid:s}),c=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags;await Promise.resolve().then(async()=>{if(u)return await c(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[w,E]of Object.entries(g))O[`$feature/${w}`]=E;let m=Object.keys(g||{}).filter(w=>g?.[w]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:n},{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=LCp){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0,g,O;if(!b&&!u){let w=await super.getFeatureFlagDetailStateless(t,r,n,d,s,a);if(w===void 0)return;O=w.response,c=BKs(O),g=w?.requestId}let m=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(m))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(m):this.distinctIdHasSentFlagCalls[r]=[m],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,$feature_flag_id:O?.metadata?.id,$feature_flag_version:O?.metadata?.version,$feature_flag_reason:O?.reason?.description??O?.reason?.code,locally_evaluated:b,[`$feature/${t}`]:c,$feature_flag_request_id:g},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return this.featureFlagsPoller!==void 0&&(i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i))),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}captureException(t,r,i){let n=new Error("PostHog syntheticException");cFn.captureException(this,t,{syntheticException:n},r,i)}},UCp=/\(error: (.*)\)/,iBp=50,nBp="?";function AvD(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return i=>{let n=i.match(r);if(n){let a,u,l,d,s;if(n[1]){l=n[1];let b=l.lastIndexOf(".");if(l[b-1]==="."&&b--,b>0){a=l.slice(0,b),u=l.slice(b+1);let g=a.indexOf(".Module");g>0&&(l=l.slice(g+1),a=a.slice(0,g))}d=void 0}u&&(d=a,s=u),u==="<anonymous>"&&(s=void 0,l=void 0),l===void 0&&(s=s||nBp,l=d?`${d}.${s}`:s);let o=n[2]?.startsWith("file://")?n[2].slice(7):n[2],c=n[5]==="native";return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),!o&&n[5]&&!c&&(o=n[5]),{filename:o?decodeURI(o):void 0,module:e?e(o):void 0,function:l,lineno:VCp(n[3]),colno:VCp(n[4]),in_app:qvD(o||"",c),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function qvD(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function VCp(e){return parseInt(e||"",10)||void 0}function TvD(e){return[90,AvD(e)]}function CvD(e){let r=[TvD(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],u=i.split(`
1715
- `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=UCp.test(d)?d.replace(UCp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let c=o(s);if(c){a.push(c);break}}if(a.length>=iBp)break}}return BvD(a)}}function BvD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,iBp).map(r=>({...r,filename:r.filename||IvD(t).filename,function:r.function||nBp}))}function IvD(e){return e[e.length-1]||{}}cFn.stackParser=CvD(HyD());cFn.frameModifiers=[QyD];var fFn=class extends qKs{getLibraryId(){return"posthog-node"}};var l3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new fFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.65.2",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var XDa=class{async sendEvent(){}async identify(){}async flush(){}};var pFn=require("fs/promises"),sBp=require("os"),cBp=require("path");var aBp=ui(require("crypto")),d3o=new Uint8Array(256),f3o=d3o.length;function IKs(){return f3o>d3o.length-16&&(aBp.default.randomFillSync(d3o),f3o=0),d3o.slice(f3o,f3o+=16)}var EW=[];for(let e=0;e<256;++e)EW.push((e+256).toString(16).slice(1));function oBp(e,t=0){return EW[e[t+0]]+EW[e[t+1]]+EW[e[t+2]]+EW[e[t+3]]+"-"+EW[e[t+4]]+EW[e[t+5]]+"-"+EW[e[t+6]]+EW[e[t+7]]+"-"+EW[e[t+8]]+EW[e[t+9]]+"-"+EW[e[t+10]]+EW[e[t+11]]+EW[e[t+12]]+EW[e[t+13]]+EW[e[t+14]]+EW[e[t+15]]}var uBp=ui(require("crypto")),zKs={randomUUID:uBp.default.randomUUID};function zvD(e,t,r){if(zKs.randomUUID&&!t&&!e)return zKs.randomUUID();e=e||{};let i=e.random||(e.rng||IKs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return oBp(i)}var lae=zvD;var xvD="id",RvD=".fern",ZDa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new fFn(r),this.userId=t==null?void 0:SVs(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.65.2",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(ll.of((0,sBp.homedir)()),Na.of(RvD),Na.of(xvD));await mf(t)||(await(0,pFn.mkdir)((0,cBp.dirname)(t),{recursive:!0}),await(0,pFn.writeFile)(t,lae())),this.persistedDistinctId=(await(0,pFn.readFile)(t)).toString()}return this.persistedDistinctId}};var xKs;async function _Fn(){return xKs==null&&(xKs=await NvD()),xKs}async function NvD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new XDa;let r=await TBo();return r!=null?new ZDa({token:r,posthogApiKey:e}):await pRn()!=null?new l3o({posthogApiKey:e}):new ZDa({token:void 0,posthogApiKey:e})}catch{return new XDa}}function kDa(e,t){return function(){return e.apply(t,arguments)}}var{toString:FvD}=Object.prototype,{getPrototypeOf:NKs}=Object,{iterator:_3o,toStringTag:fBp}=Symbol,h3o=(e=>t=>{let r=FvD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),nWt=e=>(e=e.toLowerCase(),t=>h3o(t)===e),y3o=e=>t=>typeof t===e,{isArray:hFn}=Array,eEa=y3o("undefined");function LvD(e){return e!==null&&!eEa(e)&&e.constructor!==null&&!eEa(e.constructor)&&fae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var dBp=nWt("ArrayBuffer");function UvD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dBp(e.buffer),t}var VvD=y3o("string"),fae=y3o("function"),pBp=y3o("number"),v3o=e=>e!==null&&typeof e=="object",WvD=e=>e===!0||e===!1,p3o=e=>{if(h3o(e)!=="object")return!1;let t=NKs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(fBp in e)&&!(_3o in e)},HvD=nWt("Date"),$vD=nWt("File"),GvD=nWt("Blob"),QvD=nWt("FileList"),JvD=e=>v3o(e)&&fae(e.pipe),KvD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fae(e.append)&&((t=h3o(e))==="formdata"||t==="object"&&fae(e.toString)&&e.toString()==="[object FormData]"))},YvD=nWt("URLSearchParams"),[XvD,ZvD,kvD,ebD]=["ReadableStream","Request","Response","Headers"].map(nWt),tbD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),hFn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function _Bp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var LHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hBp=e=>!eEa(e)&&e!==LHi;function RKs(){let{caseless:e}=hBp(this)&&this||{},t={},r=(i,n)=>{let a=e&&_Bp(t,n)||n;p3o(t[a])&&p3o(i)?t[a]=RKs(t[a],i):p3o(i)?t[a]=RKs({},i):hFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&tEa(arguments[i],r);return t}var rbD=(e,t,r,{allOwnKeys:i}={})=>(tEa(t,(n,a)=>{r&&fae(n)?e[a]=kDa(n,r):e[a]=n},{allOwnKeys:i}),e),ibD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nbD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},abD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&NKs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},obD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},ubD=e=>{if(!e)return null;if(hFn(e))return e;let t=e.length;if(!pBp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},sbD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&NKs(Uint8Array)),cbD=(e,t)=>{let i=(e&&e[_3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},lbD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},fbD=nWt("HTMLFormElement"),dbD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),lBp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),pbD=nWt("RegExp"),yBp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};tEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},_bD=e=>{yBp(e,(t,r)=>{if(fae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(fae(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},hbD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return hFn(e)?i(e):i(String(e).split(t)),r},ybD=()=>{},vbD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function bbD(e){return!!(e&&fae(e.append)&&e[fBp]==="FormData"&&e[_3o])}var gbD=e=>{let t=new Array(10),r=(i,n)=>{if(v3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=hFn(i)?[]:{};return tEa(i,(u,l)=>{let d=r(u,n+1);!eEa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},ObD=nWt("AsyncFunction"),mbD=e=>e&&(v3o(e)||fae(e))&&fae(e.then)&&fae(e.catch),vBp=((e,t)=>e?setImmediate:t?((r,i)=>(LHi.addEventListener("message",({source:n,data:a})=>{n===LHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),LHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fae(LHi.postMessage)),PbD=typeof queueMicrotask<"u"?queueMicrotask.bind(LHi):typeof process<"u"&&process.nextTick||vBp,jbD=e=>e!=null&&fae(e[_3o]),os={isArray:hFn,isArrayBuffer:dBp,isBuffer:LvD,isFormData:KvD,isArrayBufferView:UvD,isString:VvD,isNumber:pBp,isBoolean:WvD,isObject:v3o,isPlainObject:p3o,isReadableStream:XvD,isRequest:ZvD,isResponse:kvD,isHeaders:ebD,isUndefined:eEa,isDate:HvD,isFile:$vD,isBlob:GvD,isRegExp:pbD,isFunction:fae,isStream:JvD,isURLSearchParams:YvD,isTypedArray:sbD,isFileList:QvD,forEach:tEa,merge:RKs,extend:rbD,trim:tbD,stripBOM:ibD,inherits:nbD,toFlatObject:abD,kindOf:h3o,kindOfTest:nWt,endsWith:obD,toArray:ubD,forEachEntry:cbD,matchAll:lbD,isHTMLForm:fbD,hasOwnProperty:lBp,hasOwnProp:lBp,reduceDescriptors:yBp,freezeMethods:_bD,toObjectSet:hbD,toCamelCase:dbD,noop:ybD,toFiniteNumber:vbD,findKey:_Bp,global:LHi,isContextDefined:hBp,isSpecCompliantForm:bbD,toJSONObject:gbD,isAsyncFn:ObD,isThenable:mbD,setImmediate:vBp,asap:PbD,isIterable:jbD};function yFn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(yFn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var bBp=yFn.prototype,gBp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{gBp[e]={value:e}});Object.defineProperties(yFn,gBp);Object.defineProperty(bBp,"isAxiosError",{value:!0});yFn.from=(e,t,r,i,n,a)=>{let u=Object.create(bBp);return os.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),yFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=yFn;var OBp=ui(NFo(),1),b3o=OBp.default;function FKs(e){return os.isPlainObject(e)||os.isArray(e)}function PBp(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function mBp(e,t,r){return e?e.concat(t).map(function(n,a){return n=PBp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function wbD(e){return os.isArray(e)&&!e.some(FKs)}var SbD=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function DbD(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(b3o||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(os.isBoolean(O))return O.toString();if(!d&&os.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&wbD(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=PBp(m),E.forEach(function(A,D){!(os.isUndefined(A)||A===null)&&t.append(u===!0?mBp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return FKs(O)?!0:(t.append(mBp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(SbD,{defaultVisitor:o,convertValue:s,isVisitable:FKs});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,q){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var HSi=DbD;function jBp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function wBp(e,t){this._pairs=[],e&&HSi(e,this,t)}var SBp=wBp.prototype;SBp.append=function(t,r){this._pairs.push([t,r])};SBp.toString=function(t){let r=t?function(i){return t.call(this,i,jBp)}:jBp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var DBp=wBp;function EbD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function UHi(e,t,r){if(!t)return e;let i=r&&r.encode||EbD;os.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new DBp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var LKs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},UKs=LKs;var vFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var qBp=ui(require("crypto"),1);var EBp=ui(require("url"),1),MBp=EBp.default.URLSearchParams;var VKs="abcdefghijklmnopqrstuvwxyz",ABp="0123456789",TBp={DIGIT:ABp,ALPHA:VKs,ALPHA_DIGIT:VKs+VKs.toUpperCase()+ABp},MbD=(e=16,t=TBp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);qBp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},CBp={isNode:!0,classes:{URLSearchParams:MBp,FormData:b3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:TBp,generateString:MbD,protocols:["http","https","file","data"]};var $Ks={};mo($Ks,{hasBrowserEnv:()=>HKs,hasStandardBrowserEnv:()=>AbD,hasStandardBrowserWebWorkerEnv:()=>qbD,navigator:()=>WKs,origin:()=>TbD});var HKs=typeof window<"u"&&typeof document<"u",WKs=typeof navigator=="object"&&navigator||void 0,AbD=HKs&&(!WKs||["ReactNative","NativeScript","NS"].indexOf(WKs.product)<0),qbD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",TbD=HKs&&window.location.href||"http://localhost";var aA={...$Ks,...CBp};function GKs(e,t){return HSi(e,new aA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return aA.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function CbD(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function BbD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function IbD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,d?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=BbD(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(CbD(i),n,r,0)}),r}return null}var g3o=IbD;function zbD(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var QKs={transitional:vFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(g3o(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return GKs(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return HSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),zbD(t)):t}],transformResponse:[function(t){let r=this.transitional||QKs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Fp.from(l,Fp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:aA.classes.FormData,Blob:aA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{QKs.headers[e]={}});var bFn=QKs;var xbD=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),BBp=e=>{let t={},r,i,n;return e&&e.split(`
1715
+ `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=UCp.test(d)?d.replace(UCp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let c=o(s);if(c){a.push(c);break}}if(a.length>=iBp)break}}return BvD(a)}}function BvD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,iBp).map(r=>({...r,filename:r.filename||IvD(t).filename,function:r.function||nBp}))}function IvD(e){return e[e.length-1]||{}}cFn.stackParser=CvD(HyD());cFn.frameModifiers=[QyD];var fFn=class extends qKs{getLibraryId(){return"posthog-node"}};var l3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new fFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.65.5",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var XDa=class{async sendEvent(){}async identify(){}async flush(){}};var pFn=require("fs/promises"),sBp=require("os"),cBp=require("path");var aBp=ui(require("crypto")),d3o=new Uint8Array(256),f3o=d3o.length;function IKs(){return f3o>d3o.length-16&&(aBp.default.randomFillSync(d3o),f3o=0),d3o.slice(f3o,f3o+=16)}var EW=[];for(let e=0;e<256;++e)EW.push((e+256).toString(16).slice(1));function oBp(e,t=0){return EW[e[t+0]]+EW[e[t+1]]+EW[e[t+2]]+EW[e[t+3]]+"-"+EW[e[t+4]]+EW[e[t+5]]+"-"+EW[e[t+6]]+EW[e[t+7]]+"-"+EW[e[t+8]]+EW[e[t+9]]+"-"+EW[e[t+10]]+EW[e[t+11]]+EW[e[t+12]]+EW[e[t+13]]+EW[e[t+14]]+EW[e[t+15]]}var uBp=ui(require("crypto")),zKs={randomUUID:uBp.default.randomUUID};function zvD(e,t,r){if(zKs.randomUUID&&!t&&!e)return zKs.randomUUID();e=e||{};let i=e.random||(e.rng||IKs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return oBp(i)}var lae=zvD;var xvD="id",RvD=".fern",ZDa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new fFn(r),this.userId=t==null?void 0:SVs(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.65.5",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(ll.of((0,sBp.homedir)()),Na.of(RvD),Na.of(xvD));await mf(t)||(await(0,pFn.mkdir)((0,cBp.dirname)(t),{recursive:!0}),await(0,pFn.writeFile)(t,lae())),this.persistedDistinctId=(await(0,pFn.readFile)(t)).toString()}return this.persistedDistinctId}};var xKs;async function _Fn(){return xKs==null&&(xKs=await NvD()),xKs}async function NvD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new XDa;let r=await TBo();return r!=null?new ZDa({token:r,posthogApiKey:e}):await pRn()!=null?new l3o({posthogApiKey:e}):new ZDa({token:void 0,posthogApiKey:e})}catch{return new XDa}}function kDa(e,t){return function(){return e.apply(t,arguments)}}var{toString:FvD}=Object.prototype,{getPrototypeOf:NKs}=Object,{iterator:_3o,toStringTag:fBp}=Symbol,h3o=(e=>t=>{let r=FvD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),nWt=e=>(e=e.toLowerCase(),t=>h3o(t)===e),y3o=e=>t=>typeof t===e,{isArray:hFn}=Array,eEa=y3o("undefined");function LvD(e){return e!==null&&!eEa(e)&&e.constructor!==null&&!eEa(e.constructor)&&fae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var dBp=nWt("ArrayBuffer");function UvD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dBp(e.buffer),t}var VvD=y3o("string"),fae=y3o("function"),pBp=y3o("number"),v3o=e=>e!==null&&typeof e=="object",WvD=e=>e===!0||e===!1,p3o=e=>{if(h3o(e)!=="object")return!1;let t=NKs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(fBp in e)&&!(_3o in e)},HvD=nWt("Date"),$vD=nWt("File"),GvD=nWt("Blob"),QvD=nWt("FileList"),JvD=e=>v3o(e)&&fae(e.pipe),KvD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fae(e.append)&&((t=h3o(e))==="formdata"||t==="object"&&fae(e.toString)&&e.toString()==="[object FormData]"))},YvD=nWt("URLSearchParams"),[XvD,ZvD,kvD,ebD]=["ReadableStream","Request","Response","Headers"].map(nWt),tbD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),hFn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function _Bp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var LHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hBp=e=>!eEa(e)&&e!==LHi;function RKs(){let{caseless:e}=hBp(this)&&this||{},t={},r=(i,n)=>{let a=e&&_Bp(t,n)||n;p3o(t[a])&&p3o(i)?t[a]=RKs(t[a],i):p3o(i)?t[a]=RKs({},i):hFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&tEa(arguments[i],r);return t}var rbD=(e,t,r,{allOwnKeys:i}={})=>(tEa(t,(n,a)=>{r&&fae(n)?e[a]=kDa(n,r):e[a]=n},{allOwnKeys:i}),e),ibD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nbD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},abD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&NKs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},obD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},ubD=e=>{if(!e)return null;if(hFn(e))return e;let t=e.length;if(!pBp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},sbD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&NKs(Uint8Array)),cbD=(e,t)=>{let i=(e&&e[_3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},lbD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},fbD=nWt("HTMLFormElement"),dbD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),lBp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),pbD=nWt("RegExp"),yBp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};tEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},_bD=e=>{yBp(e,(t,r)=>{if(fae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(fae(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},hbD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return hFn(e)?i(e):i(String(e).split(t)),r},ybD=()=>{},vbD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function bbD(e){return!!(e&&fae(e.append)&&e[fBp]==="FormData"&&e[_3o])}var gbD=e=>{let t=new Array(10),r=(i,n)=>{if(v3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=hFn(i)?[]:{};return tEa(i,(u,l)=>{let d=r(u,n+1);!eEa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},ObD=nWt("AsyncFunction"),mbD=e=>e&&(v3o(e)||fae(e))&&fae(e.then)&&fae(e.catch),vBp=((e,t)=>e?setImmediate:t?((r,i)=>(LHi.addEventListener("message",({source:n,data:a})=>{n===LHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),LHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fae(LHi.postMessage)),PbD=typeof queueMicrotask<"u"?queueMicrotask.bind(LHi):typeof process<"u"&&process.nextTick||vBp,jbD=e=>e!=null&&fae(e[_3o]),os={isArray:hFn,isArrayBuffer:dBp,isBuffer:LvD,isFormData:KvD,isArrayBufferView:UvD,isString:VvD,isNumber:pBp,isBoolean:WvD,isObject:v3o,isPlainObject:p3o,isReadableStream:XvD,isRequest:ZvD,isResponse:kvD,isHeaders:ebD,isUndefined:eEa,isDate:HvD,isFile:$vD,isBlob:GvD,isRegExp:pbD,isFunction:fae,isStream:JvD,isURLSearchParams:YvD,isTypedArray:sbD,isFileList:QvD,forEach:tEa,merge:RKs,extend:rbD,trim:tbD,stripBOM:ibD,inherits:nbD,toFlatObject:abD,kindOf:h3o,kindOfTest:nWt,endsWith:obD,toArray:ubD,forEachEntry:cbD,matchAll:lbD,isHTMLForm:fbD,hasOwnProperty:lBp,hasOwnProp:lBp,reduceDescriptors:yBp,freezeMethods:_bD,toObjectSet:hbD,toCamelCase:dbD,noop:ybD,toFiniteNumber:vbD,findKey:_Bp,global:LHi,isContextDefined:hBp,isSpecCompliantForm:bbD,toJSONObject:gbD,isAsyncFn:ObD,isThenable:mbD,setImmediate:vBp,asap:PbD,isIterable:jbD};function yFn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(yFn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var bBp=yFn.prototype,gBp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{gBp[e]={value:e}});Object.defineProperties(yFn,gBp);Object.defineProperty(bBp,"isAxiosError",{value:!0});yFn.from=(e,t,r,i,n,a)=>{let u=Object.create(bBp);return os.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),yFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=yFn;var OBp=ui(NFo(),1),b3o=OBp.default;function FKs(e){return os.isPlainObject(e)||os.isArray(e)}function PBp(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function mBp(e,t,r){return e?e.concat(t).map(function(n,a){return n=PBp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function wbD(e){return os.isArray(e)&&!e.some(FKs)}var SbD=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function DbD(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(b3o||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(os.isBoolean(O))return O.toString();if(!d&&os.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&wbD(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=PBp(m),E.forEach(function(A,D){!(os.isUndefined(A)||A===null)&&t.append(u===!0?mBp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return FKs(O)?!0:(t.append(mBp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(SbD,{defaultVisitor:o,convertValue:s,isVisitable:FKs});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,q){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var HSi=DbD;function jBp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function wBp(e,t){this._pairs=[],e&&HSi(e,this,t)}var SBp=wBp.prototype;SBp.append=function(t,r){this._pairs.push([t,r])};SBp.toString=function(t){let r=t?function(i){return t.call(this,i,jBp)}:jBp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var DBp=wBp;function EbD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function UHi(e,t,r){if(!t)return e;let i=r&&r.encode||EbD;os.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new DBp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var LKs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},UKs=LKs;var vFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var qBp=ui(require("crypto"),1);var EBp=ui(require("url"),1),MBp=EBp.default.URLSearchParams;var VKs="abcdefghijklmnopqrstuvwxyz",ABp="0123456789",TBp={DIGIT:ABp,ALPHA:VKs,ALPHA_DIGIT:VKs+VKs.toUpperCase()+ABp},MbD=(e=16,t=TBp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);qBp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},CBp={isNode:!0,classes:{URLSearchParams:MBp,FormData:b3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:TBp,generateString:MbD,protocols:["http","https","file","data"]};var $Ks={};mo($Ks,{hasBrowserEnv:()=>HKs,hasStandardBrowserEnv:()=>AbD,hasStandardBrowserWebWorkerEnv:()=>qbD,navigator:()=>WKs,origin:()=>TbD});var HKs=typeof window<"u"&&typeof document<"u",WKs=typeof navigator=="object"&&navigator||void 0,AbD=HKs&&(!WKs||["ReactNative","NativeScript","NS"].indexOf(WKs.product)<0),qbD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",TbD=HKs&&window.location.href||"http://localhost";var aA={...$Ks,...CBp};function GKs(e,t){return HSi(e,new aA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return aA.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function CbD(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function BbD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function IbD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,d?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=BbD(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(CbD(i),n,r,0)}),r}return null}var g3o=IbD;function zbD(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var QKs={transitional:vFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(g3o(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return GKs(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return HSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),zbD(t)):t}],transformResponse:[function(t){let r=this.transitional||QKs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Fp.from(l,Fp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:aA.classes.FormData,Blob:aA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{QKs.headers[e]={}});var bFn=QKs;var xbD=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),BBp=e=>{let t={},r,i,n;return e&&e.split(`
1716
1716
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&xbD[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var IBp=Symbol("internals");function rEa(e){return e&&String(e).trim().toLowerCase()}function O3o(e){return e===!1||e==null?e:os.isArray(e)?e.map(O3o):String(e)}function RbD(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var NbD=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function JKs(e,t,r,i,n){if(os.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!os.isString(t)){if(os.isString(i))return t.indexOf(i)!==-1;if(os.isRegExp(i))return i.test(t)}}function FbD(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function LbD(e,t){let r=os.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var gFn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=rEa(d);if(!o)throw new Error("header name must be a non-empty string");let c=os.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=O3o(l))}let u=(l,d)=>os.forEach(l,(s,o)=>a(s,o,d));if(os.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(os.isString(t)&&(t=t.trim())&&!NbD(t))u(BBp(t),r);else if(os.isObject(t)&&os.isIterable(t)){let l={},d,s;for(let o of t){if(!os.isArray(o))throw TypeError("Object iterator must return a key-value pair");l[s=o[0]]=(d=l[s])?os.isArray(d)?[...d,o[1]]:[d,o[1]]:o[1]}u(l,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=rEa(t),t){let i=os.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return RbD(n);if(os.isFunction(r))return r.call(this,n,i);if(os.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=rEa(t),t){let i=os.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||JKs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=rEa(u),u){let l=os.findKey(i,u);l&&(!r||JKs(i,i[l],l,r))&&(delete i[l],n=!0)}}return os.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||JKs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return os.forEach(this,(n,a)=>{let u=os.findKey(i,a);if(u){r[u]=O3o(n),delete r[a];return}let l=t?FbD(a):String(a).trim();l!==a&&delete r[a],r[l]=O3o(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return os.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&os.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1717
1717
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[IBp]=this[IBp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=rEa(u);i[l]||(LbD(n,u),i[l]=!0)}return os.isArray(t)?t.forEach(a):a(t),this}};gFn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);os.reduceDescriptors(gFn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});os.freezeMethods(gFn);var rR=gFn;function iEa(e,t){let r=this||bFn,i=t||r,n=rR.from(i.headers),a=i.data;return os.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function nEa(e){return!!(e&&e.__CANCEL__)}function zBp(e,t,r){Fp.call(this,e??"canceled",Fp.ERR_CANCELED,t,r),this.name="CanceledError"}os.inherits(zBp,Fp,{__CANCEL__:!0});var REe=zBp;function Vtr(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Fp("Request failed with status code "+r.status,[Fp.ERR_BAD_REQUEST,Fp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function KKs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function YKs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function VHi(e,t,r){let i=!KKs(t);return e&&(i||r==!1)?YKs(e,t):t}var XBp=ui(LDa(),1),ZBp=ui(require("http"),1),kBp=ui(require("https"),1),eIp=ui(require("util"),1),tIp=ui(YJs(),1),ufi=ui(require("zlib"),1);var WHi="1.10.0";function aEa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var UbD=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function XKs(e,t,r){let i=r&&r.Blob||aA.classes.Blob,n=aEa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=UbD.exec(e);if(!a)throw new Fp("Invalid URL",Fp.ERR_INVALID_URL);let u=a[1],l=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),l?"base64":"utf8");if(t){if(!i)throw new Fp("Blob is not supported",Fp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new Fp("Unsupported protocol "+n,Fp.ERR_NOT_SUPPORT)}var $Hi=ui(require("stream"),1);var xBp=ui(require("stream"),1);var ZKs=Symbol("internals"),kKs=class extends xBp.default.Transform{constructor(t){t=os.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!os.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[ZKs]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[ZKs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[ZKs],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,d=1e3/l,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),w=null,E=u,q,A=0;if(a){let D=Date.now();(!n.ts||(A=D-n.ts)>=l)&&(n.ts=D,q=s-n.bytes,n.bytes=q<0?-q:0,A=0),q=s-n.bytes}if(a){if(q<=0)return setTimeout(()=>{O(null,g)},l-A);q<E&&(E=q)}E&&m>E&&m-E>o&&(w=g.subarray(E),g=g.subarray(0,E)),c(g,w?()=>{process.nextTick(O,null,w)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},eYs=kKs;var rIp=require("events");var NBp=ui(require("util"),1),FBp=require("stream");var{asyncIterator:RBp}=Symbol,VbD=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[RBp]?yield*e[RBp]():yield e},m3o=VbD;var WbD=aA.ALPHABET.ALPHA_DIGIT+"-_",oEa=typeof TextEncoder=="function"?new TextEncoder:new NBp.default.TextEncoder,HHi=`\r
1718
1718
  `,HbD=oEa.encode(HHi),$bD=2,tYs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=os.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${HHi}`;n?r=oEa.encode(String(r).replace(/\r?\n|\r\n?/g,HHi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${HHi}`,this.headers=oEa.encode(a+HHi),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+$bD,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;os.isTypedArray(t)?yield t:yield*m3o(t),yield HbD}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},GbD=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+aA.generateString(n,WbD)}=r||{};if(!os.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=oEa.encode("--"+a+HHi),l=oEa.encode("--"+a+"--"+HHi),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new tYs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=os.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),FBp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},LBp=GbD;var UBp=ui(require("stream"),1),rYs=class extends UBp.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},VBp=rYs;var QbD=(e,t)=>os.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,WBp=QbD;function JbD(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var HBp=JbD;function KbD(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var $Bp=KbD;var ofi=(e,t,r=3)=>{let i=0,n=HBp(50,250);return $Bp(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:d,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},OFn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},mFn=e=>(...t)=>os.asap(()=>e(...t));var GBp={flush:ufi.default.constants.Z_SYNC_FLUSH,finishFlush:ufi.default.constants.Z_SYNC_FLUSH},YbD={flush:ufi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:ufi.default.constants.BROTLI_OPERATION_FLUSH},QBp=os.isFunction(ufi.default.createBrotliDecompress),{http:XbD,https:ZbD}=tIp.default,kbD=/https:?/,JBp=aA.protocols.map(e=>e+":"),KBp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function e0D(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function iIp(e,t,r){let i=t;if(!i&&i!==!1){let n=XBp.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){iIp(a,t,a.href)}}var t0D=typeof process<"u"&&os.kindOf(process)==="process",r0D=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},l=d=>{a(d,!0),r(d)};e(u,l,d=>i=d).catch(l)}),i0D=({address:e,family:t})=>{if(!os.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},YBp=(e,t)=>i0D(os.isObject(e)?e:{address:e,family:t}),nIp=t0D&&function(t){return r0D(async function(i,n,a){let{data:u,lookup:l,family:d}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let Oe=WBp(l,Ue=>os.isArray(Ue)?Ue:[Ue]);l=(Ue,wt,De)=>{Oe(Ue,wt,(Te,xt,Pe)=>{if(Te)return De(Te);let ot=os.isArray(xt)?xt.map(at=>YBp(at)):[YBp(xt,Pe)];wt.all?De(Te,ot):De(Te,ot[0].address,ot[0].family)})}}let m=new rIp.EventEmitter,w=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((Oe,Ue)=>{b=!0,Ue&&(g=!0,w())});function E(Oe){m.emit("abort",!Oe||Oe.type?new REe(null,t,O):Oe)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let q=VHi(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(q,aA.hasBrowserEnv?aA.origin:void 0),D=A.protocol||JBp[0];if(D==="data:"){let Oe;if(c!=="GET")return Vtr(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Oe=XKs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Ue){throw Fp.from(Ue,Fp.ERR_BAD_REQUEST,t)}return s==="text"?(Oe=Oe.toString(o),(!o||o==="utf8")&&(Oe=os.stripBOM(Oe))):s==="stream"&&(Oe=$Hi.default.Readable.from(Oe)),Vtr(i,n,{data:Oe,status:200,statusText:"OK",headers:new rR,config:t})}if(JBp.indexOf(D)===-1)return n(new Fp("Unsupported protocol "+D,Fp.ERR_BAD_REQUEST,t));let C=rR.from(t.headers).normalize();C.set("User-Agent","axios/"+WHi,!1);let{onUploadProgress:x,onDownloadProgress:$}=t,I=t.maxRate,F,V;if(os.isSpecCompliantForm(u)){let Oe=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=LBp(u,Ue=>{C.set(Ue)},{tag:`axios-${WHi}-boundary`,boundary:Oe&&Oe[1]||void 0})}else if(os.isFormData(u)&&os.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let Oe=await eIp.default.promisify(u.getLength).call(u);Number.isFinite(Oe)&&Oe>=0&&C.setContentLength(Oe)}catch{}}else if(os.isBlob(u)||os.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=$Hi.default.Readable.from(m3o(u));else if(u&&!os.isStream(u)){if(!Buffer.isBuffer(u))if(os.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(os.isString(u))u=Buffer.from(u,"utf-8");else return n(new Fp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Fp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new Fp("Request body larger than maxBodyLength limit",Fp.ERR_BAD_REQUEST,t))}let K=os.toFiniteNumber(C.getContentLength());os.isArray(I)?(F=I[0],V=I[1]):F=V=I,u&&(x||F)&&(os.isStream(u)||(u=$Hi.default.Readable.from(u,{objectMode:!1})),u=$Hi.default.pipeline([u,new eYs({maxRate:os.toFiniteNumber(F)})],os.noop),x&&u.on("progress",KBp(u,OFn(K,ofi(mFn(x),!1,3)))));let Y;if(t.auth){let Oe=t.auth.username||"",Ue=t.auth.password||"";Y=Oe+":"+Ue}if(!Y&&A.username){let Oe=A.username,Ue=A.password;Y=Oe+":"+Ue}Y&&C.delete("authorization");let Z;try{Z=UHi(A.pathname+A.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Oe){let Ue=new Error(Oe.message);return Ue.config=t,Ue.url=t.url,Ue.exists=!0,n(Ue)}C.set("Accept-Encoding","gzip, compress, deflate"+(QBp?", br":""),!1);let oe={path:Z,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Y,protocol:D,family:d,beforeRedirect:e0D,beforeRedirects:{}};!os.isUndefined(l)&&(oe.lookup=l),t.socketPath?oe.socketPath=t.socketPath:(oe.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,oe.port=A.port,iIp(oe,t.proxy,D+"//"+A.hostname+(A.port?":"+A.port:"")+oe.path));let pe,de=kbD.test(oe.protocol);if(oe.agent=de?t.httpsAgent:t.httpAgent,t.transport?pe=t.transport:t.maxRedirects===0?pe=de?kBp.default:ZBp.default:(t.maxRedirects&&(oe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(oe.beforeRedirects.config=t.beforeRedirect),pe=de?ZbD:XbD),t.maxBodyLength>-1?oe.maxBodyLength=t.maxBodyLength:oe.maxBodyLength=1/0,t.insecureHTTPParser&&(oe.insecureHTTPParser=t.insecureHTTPParser),O=pe.request(oe,function(Ue){if(O.destroyed)return;let wt=[Ue],De=+Ue.headers["content-length"];if($||V){let at=new eYs({maxRate:os.toFiniteNumber(V)});$&&at.on("progress",KBp(at,OFn(De,ofi(mFn($),!0,3)))),wt.push(at)}let Te=Ue,xt=Ue.req||O;if(t.decompress!==!1&&Ue.headers["content-encoding"])switch((c==="HEAD"||Ue.statusCode===204)&&delete Ue.headers["content-encoding"],(Ue.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":wt.push(ufi.default.createUnzip(GBp)),delete Ue.headers["content-encoding"];break;case"deflate":wt.push(new VBp),wt.push(ufi.default.createUnzip(GBp)),delete Ue.headers["content-encoding"];break;case"br":QBp&&(wt.push(ufi.default.createBrotliDecompress(YbD)),delete Ue.headers["content-encoding"])}Te=wt.length>1?$Hi.default.pipeline(wt,os.noop):wt[0];let Pe=$Hi.default.finished(Te,()=>{Pe(),w()}),ot={status:Ue.statusCode,statusText:Ue.statusMessage,headers:new rR(Ue.headers),config:t,request:xt};if(s==="stream")ot.data=Te,Vtr(i,n,ot);else{let at=[],me=0;Te.on("data",function(jt){at.push(jt),me+=jt.length,t.maxContentLength>-1&&me>t.maxContentLength&&(g=!0,Te.destroy(),n(new Fp("maxContentLength size of "+t.maxContentLength+" exceeded",Fp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let jt=new Fp("stream has been aborted",Fp.ERR_BAD_RESPONSE,t,xt);Te.destroy(jt),n(jt)}),Te.on("error",function(jt){O.destroyed||n(Fp.from(jt,null,t,xt))}),Te.on("end",function(){try{let jt=at.length===1?at[0]:Buffer.concat(at);s!=="arraybuffer"&&(jt=jt.toString(o),(!o||o==="utf8")&&(jt=os.stripBOM(jt))),ot.data=jt}catch(jt){return n(Fp.from(jt,null,t,ot.request,ot))}Vtr(i,n,ot)})}m.once("abort",at=>{Te.destroyed||(Te.emit("error",at),Te.destroy())})}),m.once("abort",Oe=>{n(Oe),O.destroy(Oe)}),O.on("error",function(Ue){n(Fp.from(Ue,null,t,O))}),O.on("socket",function(Ue){Ue.setKeepAlive(!0,1e3*60)}),t.timeout){let Oe=parseInt(t.timeout,10);if(Number.isNaN(Oe)){n(new Fp("error trying to parse `config.timeout` to int",Fp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(Oe,function(){if(b)return;let wt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||vFn;t.timeoutErrorMessage&&(wt=t.timeoutErrorMessage),n(new Fp(wt,De.clarifyTimeoutError?Fp.ETIMEDOUT:Fp.ECONNABORTED,t,O)),E()})}if(os.isStream(u)){let Oe=!1,Ue=!1;u.on("end",()=>{Oe=!0}),u.once("error",wt=>{Ue=!0,O.destroy(wt)}),u.on("close",()=>{!Oe&&!Ue&&E(new REe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var aIp=aA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,aA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(aA.origin),aA.navigator&&/(msie|trident)/i.test(aA.navigator.userAgent)):()=>!0;var oIp=aA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];os.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),os.isString(i)&&u.push("path="+i),os.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var uIp=e=>e instanceof rR?{...e}:e;function aWt(e,t){t=t||{};let r={};function i(s,o,c,b){return os.isPlainObject(s)&&os.isPlainObject(o)?os.merge.call({caseless:b},s,o):os.isPlainObject(o)?os.merge({},o):os.isArray(o)?o.slice():o}function n(s,o,c,b){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!os.isUndefined(o))return i(void 0,o)}function u(s,o){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o,c)=>n(uIp(s),uIp(o),c,!0)};return os.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);os.isUndefined(b)&&c!==l||(r[o]=b)}),r}var P3o=e=>{let t=aWt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=rR.from(u),t.url=UHi(VHi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(os.isFormData(r)){if(aA.hasStandardBrowserEnv||aA.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[s,...o]=d?d.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(aA.hasStandardBrowserEnv&&(i&&os.isFunction(i)&&(i=i(t)),i||i!==!1&&aIp(t.url))){let s=n&&a&&oIp.read(a);s&&u.set(n,s)}return t};var n0D=typeof XMLHttpRequest<"u",sIp=n0D&&function(e){return new Promise(function(r,i){let n=P3o(e),a=n.data,u=rR.from(n.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let w=new XMLHttpRequest;w.open(n.method.toUpperCase(),n.url,!0),w.timeout=n.timeout;function E(){if(!w)return;let A=rR.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:A,config:e,request:w};Vtr(function($){r($),m()},function($){i($),m()},C),w=null}"onloadend"in w?w.onloadend=E:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(E)},w.onabort=function(){w&&(i(new Fp("Request aborted",Fp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new Fp("Network Error",Fp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||vFn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new Fp(D,C.clarifyTimeoutError?Fp.ETIMEDOUT:Fp.ECONNABORTED,e,w)),w=null},a===void 0&&u.setContentType(null),"setRequestHeader"in w&&os.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),os.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=ofi(s,!0),w.addEventListener("progress",b)),d&&w.upload&&([c,g]=ofi(d),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=A=>{w&&(i(!A||A.type?new REe(null,e,w):A),w.abort(),w=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let q=aEa(n.url);if(q&&aA.protocols.indexOf(q)===-1){i(new Fp("Unsupported protocol "+q+":",Fp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var a0D=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof Fp?o:new REe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new Fp(`timeout ${t} of ms exceeded`,Fp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>os.asap(l),d}},cIp=a0D;var o0D=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},u0D=async function*(e,t){for await(let r of s0D(e))yield*o0D(r,t)},s0D=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},iYs=(e,t,r,i)=>{let n=u0D(e,t),a=0,u,l=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){l(),d.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}d.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(d){return l(d),n.return()}},{highWaterMark:2})};var w3o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",fIp=w3o&&typeof ReadableStream=="function",c0D=w3o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),dIp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},l0D=fIp&&dIp(()=>{let e=!1,t=new Request(aA.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),lIp=64*1024,nYs=fIp&&dIp(()=>os.isReadableStream(new Response("").body)),j3o={stream:nYs&&(e=>e.body)};w3o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!j3o[t]&&(j3o[t]=os.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new Fp(`Response type '${t}' is not supported`,Fp.ERR_NOT_SUPPORT,i)})})})(new Response);var f0D=async e=>{if(e==null)return 0;if(os.isBlob(e))return e.size;if(os.isSpecCompliantForm(e))return(await new Request(aA.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(os.isArrayBufferView(e)||os.isArrayBuffer(e))return e.byteLength;if(os.isURLSearchParams(e)&&(e=e+""),os.isString(e))return(await c0D(e)).byteLength},d0D=async(e,t)=>{let r=os.toFiniteNumber(e.getContentLength());return r??f0D(t)},pIp=w3o&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:d,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=P3o(e);s=s?(s+"").toLowerCase():"text";let g=cIp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(d&&l0D&&r!=="get"&&r!=="head"&&(w=await d0D(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),x;if(os.isFormData(i)&&(x=C.headers.get("content-type"))&&o.setContentType(x),C.body){let[$,I]=OFn(w,ofi(mFn(d)));i=iYs(C.body,lIp,$,I)}}os.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let q=await fetch(O,b),A=nYs&&(s==="stream"||s==="response");if(nYs&&(l||A&&m)){let C={};["status","statusText","headers"].forEach(F=>{C[F]=q[F]});let x=os.toFiniteNumber(q.headers.get("content-length")),[$,I]=l&&OFn(x,ofi(mFn(l),!0))||[];q=new Response(iYs(q.body,lIp,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await j3o[os.findKey(j3o,s)||"text"](q,e);return!A&&m&&m(),await new Promise((C,x)=>{Vtr(C,x,{data:D,headers:rR.from(q.headers),status:q.status,statusText:q.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/Load failed|fetch/i.test(E.message)?Object.assign(new Fp("Network Error",Fp.ERR_NETWORK,e,O),{cause:E.cause||E}):Fp.from(E,E&&E.code,e,O)}});var aYs={http:nIp,xhr:sIp,fetch:pIp};os.forEach(aYs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var _Ip=e=>`- ${e}`,p0D=e=>os.isFunction(e)||e===null||e===!1,S3o={getAdapter:e=>{e=os.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!p0D(r)&&(i=aYs[(u=String(r)).toLowerCase()],i===void 0))throw new Fp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
@@ -1954,7 +1954,7 @@ ${A}${q}${D}${aKp.default.cursorHide}`});var $Ta=ui(Mwi(),1);function suc(e,t){i
1954
1954
  Run ${Ss.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1955
1955
  Run ${Ss.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),jFn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function guc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!AKp(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
1956
1956
  ${await MUD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Ss.dim(l.currentVersion)+Ss.reset(" \u2192 ")+Ss.green(l.latestVersion);return n+=`
1957
- `,i?jFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function MUD(e){let r=await new MKp.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 AUD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Ewi(o.name,c),g=await XZt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=Ewi(s.name,o),b=await XZt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await qVt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function CKp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=wae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function nUo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await AUD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...CKp(s,d,t.logger));else u.push(...CKp(l.versions,void 0,t.logger))}return u}var kTa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var f4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Ouc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),BKp=typeof globalThis.AbortController=="function",IKp=typeof globalThis.ReadableStream=="function",zKp=typeof globalThis.FormData=="function",aUo=["get","post","put","patch","head","delete"],qUD=()=>{};qUD();var xKp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},oUo=2147483647,RKp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,uUo=Symbol("stop"),NKp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},FKp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var TUD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=RKp,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},LKp=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:l,value:d}=await a.read();if(l){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},UKp=(e,t)=>{let r=TUD(e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(n){let a=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function u(){let{done:l,value:d}=await a.read();if(l){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(r,i)},new Uint8Array),n.close();return}i+=d.byteLength;let s=r===0?0:i/r;(r<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:r},d),n.enqueue(d),await u()}await u()}})})};var d4n=e=>e!==null&&typeof e=="object";var eCa=(...e)=>{for(let t of e)if((!d4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return juc({},...e)},muc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function sUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:juc(e[r]??[],t[r]??[])}var Puc=(e={},t={})=>({beforeRequest:sUo(e,t,"beforeRequest"),beforeRetry:sUo(e,t,"beforeRetry"),afterResponse:sUo(e,t,"afterResponse"),beforeError:sUo(e,t,"beforeError")}),juc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(d4n(n)){for(let[a,u]of Object.entries(n))d4n(u)&&a in t&&(u=juc(t[a],u)),t={...t,[a]:u};d4n(n.hooks)&&(i=Puc(i,n.hooks),t.hooks=i),d4n(n.headers)&&(r=muc(r,n.headers),t.headers=r)}return t};var WKp=e=>aUo.includes(e)?e.toUpperCase():e,CUD=["get","put","head","delete","options","trace"],BUD=[408,413,429,500,502,503,504],IUD=[413,429,503],VKp={limit:2,methods:CUD,statusCodes:BUD,afterStatusCodes:IUD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},HKp=(e={})=>{if(typeof e=="number")return{...VKp,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{...VKp,...e}};async function wuc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new f4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Suc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var $Kp=(e,t)=>{let r={};for(let i in t)!(i in FKp)&&!(i in NKp)&&!(i in e)&&(r[i]=t[i]);return r};var tCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>oUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${oUo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new kTa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!IKp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return LKp(l.clone(),i._options.onDownloadProgress)}return l},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[l,d]of Object.entries(xKp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(l==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:muc(this._input.headers,r.headers),hooks:Puc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:WKp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:HKp(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(BKp){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(Ouc&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(zKp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Ouc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=UKp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof f4n)throw t;if(t instanceof kTa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),oUo);if(this._retryCount<1)throw r;await Suc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===uUo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=$Kp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):wuc(r,t,this.abortController,this._options)}};var Duc=e=>{let t=(r,i)=>tCa.create(r,eCa(e,i));for(let r of aUo)t[r]=(i,n)=>tCa.create(i,eCa(e,n,{method:r}));return t.create=r=>Duc(eCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Duc(eCa(e,r))),t.stop=uUo,t},zUD=Duc(),GKp=zUD;var hYp=ui(_Yp(),1);function Tuc(e){let t=(0,hYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var cXp=ui(sXp(),1),lXp=ui(Mwi(),1),Huc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},$uc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Guc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Tuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,cXp.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,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await GKp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new Huc(e):c}if(t.allVersions)return s;let o=new $uc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=lXp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function uCa(e,t){let{version:r}=await Guc(e.toLowerCase(),t);return r}async function gEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:uCa(e.packageName,{version:t?"prerelease":"latest"})}var fXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],OUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Yv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new iUo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.65.2"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ss.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new c9}failWithoutThrowing(t,r){this.didSucceed=!1,kLo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await _Fn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await qKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1957
+ `,i?jFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function MUD(e){let r=await new MKp.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 AUD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Ewi(o.name,c),g=await XZt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=Ewi(s.name,o),b=await XZt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function TKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await qVt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function CKp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=wae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function nUo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await AUD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...CKp(s,d,t.logger));else u.push(...CKp(l.versions,void 0,t.logger))}return u}var kTa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var f4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Ouc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),BKp=typeof globalThis.AbortController=="function",IKp=typeof globalThis.ReadableStream=="function",zKp=typeof globalThis.FormData=="function",aUo=["get","post","put","patch","head","delete"],qUD=()=>{};qUD();var xKp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},oUo=2147483647,RKp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,uUo=Symbol("stop"),NKp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},FKp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var TUD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=RKp,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},LKp=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:l,value:d}=await a.read();if(l){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},UKp=(e,t)=>{let r=TUD(e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(n){let a=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function u(){let{done:l,value:d}=await a.read();if(l){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(r,i)},new Uint8Array),n.close();return}i+=d.byteLength;let s=r===0?0:i/r;(r<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:r},d),n.enqueue(d),await u()}await u()}})})};var d4n=e=>e!==null&&typeof e=="object";var eCa=(...e)=>{for(let t of e)if((!d4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return juc({},...e)},muc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function sUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:juc(e[r]??[],t[r]??[])}var Puc=(e={},t={})=>({beforeRequest:sUo(e,t,"beforeRequest"),beforeRetry:sUo(e,t,"beforeRetry"),afterResponse:sUo(e,t,"afterResponse"),beforeError:sUo(e,t,"beforeError")}),juc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(d4n(n)){for(let[a,u]of Object.entries(n))d4n(u)&&a in t&&(u=juc(t[a],u)),t={...t,[a]:u};d4n(n.hooks)&&(i=Puc(i,n.hooks),t.hooks=i),d4n(n.headers)&&(r=muc(r,n.headers),t.headers=r)}return t};var WKp=e=>aUo.includes(e)?e.toUpperCase():e,CUD=["get","put","head","delete","options","trace"],BUD=[408,413,429,500,502,503,504],IUD=[413,429,503],VKp={limit:2,methods:CUD,statusCodes:BUD,afterStatusCodes:IUD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},HKp=(e={})=>{if(typeof e=="number")return{...VKp,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{...VKp,...e}};async function wuc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new f4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Suc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var $Kp=(e,t)=>{let r={};for(let i in t)!(i in FKp)&&!(i in NKp)&&!(i in e)&&(r[i]=t[i]);return r};var tCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>oUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${oUo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new kTa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!IKp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return LKp(l.clone(),i._options.onDownloadProgress)}return l},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[l,d]of Object.entries(xKp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(l==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:muc(this._input.headers,r.headers),hooks:Puc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:WKp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:HKp(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(BKp){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(Ouc&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(zKp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Ouc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=UKp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof f4n)throw t;if(t instanceof kTa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),oUo);if(this._retryCount<1)throw r;await Suc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===uUo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=$Kp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):wuc(r,t,this.abortController,this._options)}};var Duc=e=>{let t=(r,i)=>tCa.create(r,eCa(e,i));for(let r of aUo)t[r]=(i,n)=>tCa.create(i,eCa(e,n,{method:r}));return t.create=r=>Duc(eCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Duc(eCa(e,r))),t.stop=uUo,t},zUD=Duc(),GKp=zUD;var hYp=ui(_Yp(),1);function Tuc(e){let t=(0,hYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var cXp=ui(sXp(),1),lXp=ui(Mwi(),1),Huc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},$uc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Guc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Tuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,cXp.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,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await GKp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new Huc(e):c}if(t.allVersions)return s;let o=new $uc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=lXp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function uCa(e,t){let{version:r}=await Guc(e.toLowerCase(),t);return r}async function gEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:uCa(e.packageName,{version:t?"prerelease":"latest"})}var fXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],OUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Yv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new iUo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.65.5"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ss.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new c9}failWithoutThrowing(t,r){this.didSucceed=!1,kLo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await _Fn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await qKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1958
1958
  `)||(r+=`
1959
1959
  `),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=nIs(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new GTa(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new c9}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await _Fn()).sendEvent(t)}logger=fXt((t,...r)=>this.log(t,...r));stderr=fXt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=dXp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?dXp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=fXp[this.numTasks++%fXp.length],u=Ss.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===MB.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let i=t.filter(n=>Nji.indexOf(n.level)>=Nji.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===Yv.Debug,stderr:r})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await gEi({cliEnvironment:this.environment,includePreReleases:t}),i=wae(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await nUo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await iuc({message:t,default:r})}async getInput(t){return await nuc({message:t.message,default:t.default})}};function dXp(e){return`[${e}]:`}var N0_=require("fs/promises");function JNe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Ss.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Ss.dim(r)),i.join(`
1960
1960
  `)}var Up_=require("fs/promises");var FWt=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var nMe=class extends FWt{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var sCa=class{context;constructor(t){this.context=t}};var mUo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?Oy.of(`${n}${QUt}${u}`):Oy.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${QUt}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(QUt))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Oy.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var tQi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new mUo,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return pkt(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))pXp(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(pXp(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:i}){if(t===r)return;let n=i??d_((axe(r)+"/"+FUi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Oy.of(UF))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=ggo(axe(OBn.of(`/${t}`)),OBn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=ggo(axe(OBn.of(`/${t}`)),OBn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===Oy.of(UF))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>b2(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=EN(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:EN(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:EN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===TS?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 pXp(e){return e?.header!=null}var Sae={openapi:e=>({...e,type:"openapi",_visit:function(t){return Sae._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Sae._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 g4n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return g4n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var J9={basic:e=>({...e,type:"basic",_visit:function(t){return J9._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return J9._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return J9._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return J9._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return J9._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 Ag={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Ag._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ag._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Ag._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Ag._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Ag._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Ag._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ag._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Ag._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 r_={int:e=>({value:e,type:"int",_visit:function(t){return r_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return r_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return r_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return r_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return r_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return r_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return r_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return r_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return r_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return r_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return r_._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 O4n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return O4n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return O4n._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 OEi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return OEi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return OEi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var FW={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case FW.GenerallyAvailable:return t.generallyAvailable();case FW.Beta:return t.beta();case FW.Deprecated:return t.deprecated();default:return t._other()}}};var KNe={cursor:e=>({...e,type:"cursor",_visit:function(t){return KNe._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return KNe._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return KNe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);default:return t._other(e)}}};var Xfi={language:e=>({...e,type:"language",_visit:function(t){return Xfi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return Xfi._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 LW={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 LW.Curl:return t.curl();case LW.Python:return t.python();case LW.Javascript:return t.javascript();case LW.Typescript:return t.typescript();case LW.Go:return t.go();case LW.Ruby:return t.ruby();case LW.Csharp:return t.csharp();case LW.Java:return t.java();case LW.Js:return t.js();case LW.Node:return t.node();case LW.Ts:return t.ts();case LW.Nodets:return t.nodets();case LW.Golang:return t.golang();case LW.Dotnet:return t.dotnet();case LW.Jvm:return t.jvm();default:return t._other()}}};var LWt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return LWt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return LWt._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 UWt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return UWt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return UWt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var UW={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case UW.Get:return t.get();case UW.Post:return t.post();case UW.Put:return t.put();case UW.Patch:return t.patch();case UW.Delete:return t.delete();case UW.Head:return t.head();case UW.Options:return t.options();case UW.Trace:return t.trace();default:return t._other()}}};var mEi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return mEi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return mEi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return mEi._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 Zfi={file:e=>({...e,type:"file",_visit:function(t){return Zfi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return Zfi._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 $Q={file:e=>({...e,type:"file",_visit:function(t){return $Q._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return $Q._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return $Q._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return $Q._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return $Q._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return $Q._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return $Q._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Gy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Gy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Gy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Gy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Gy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Gy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Gy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Gy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Gy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Gy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Gy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Gy._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 Yj={int:e=>({...e,type:"int",_visit:function(t){return Yj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Yj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Yj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Yj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Yj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Yj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Yj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Yj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Yj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Yj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Yj._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 sz={boolean:e=>({value:e,type:"boolean",_visit:function(t){return sz._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return sz._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 kfi={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return kfi._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return kfi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var aMe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return aMe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return aMe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return aMe._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 hC={file:e=>({...e,type:"file",_visit:function(t){return hC._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return hC._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return hC._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return hC._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return hC._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return hC._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return hC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Tl={primitive:e=>({...e,type:"primitive",_visit:function(t){return Tl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Tl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Tl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Tl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Tl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Tl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Tl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Tl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Tl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Tl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Tl._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 IZ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return IZ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return IZ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var tp={int:e=>({...e,type:"int",_visit:function(t){return tp._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return tp._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return tp._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return tp._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return tp._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return tp._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return tp._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return tp._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return tp._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return tp._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return tp._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 Cv={};mo(Cv,{AllOfPropertyConflict:()=>W4n,ArraySchema:()=>RVo,ArraySchemaWithExample:()=>fWo,Availability:()=>TUo,Base64WithExample:()=>oWo,BasicSecurityScheme:()=>IUo,BearerSecurityScheme:()=>zUo,BooleanSchema:()=>TVo,BooleanWithExample:()=>uWo,BytesResponse:()=>I4n,CasingOverrides:()=>NUo,CommonProperty:()=>$Vo,CommonPropertyWithExample:()=>OWo,CursorPagination:()=>_Vo,CustomCodeSample:()=>dVo,CustomCodeSampleLanguage:()=>cVo,CustomCodeSampleSdk:()=>fVo,CustomPagination:()=>yVo,DateWithExample:()=>aWo,DatetimeWithExample:()=>nWo,DiscriminatedOneOfSchema:()=>WVo,DiscriminatedOneOfSchemaWithExample:()=>bWo,DoubleSchema:()=>AVo,DoubleWithExample:()=>rWo,Encoding:()=>qUo,Endpoint:()=>vVo,EndpointExample:()=>N4n,EndpointResponseExample:()=>sVo,EndpointSdkName:()=>Crr,EndpointWithExample:()=>WXp,EnumSchema:()=>w4n,EnumSchemaWithExample:()=>cWo,EnumValue:()=>wEi,ErrorExample:()=>iVo,FernExample:()=>aVo,FileResponse:()=>C4n,FileSchema:()=>YUo,FloatWithExample:()=>tWo,FullEndpointExample:()=>pVo,FullExample:()=>Lq,FullObjectExample:()=>$Uo,FullOneOfExample:()=>QUo,GlobalHeader:()=>BVo,Header:()=>DEi,HeaderExample:()=>R4n,HeaderSecurityScheme:()=>xUo,HeaderWithExample:()=>AEi,HttpEndpointServer:()=>z4n,HttpError:()=>nVo,HttpErrorWithExample:()=>YVo,HttpMethod:()=>E4n,IdempotencyHeader:()=>IVo,Int64WithExample:()=>ZVo,IntSchema:()=>EVo,IntWithExample:()=>XVo,JsonRequest:()=>eVo,JsonRequestWithExample:()=>QVo,JsonResponse:()=>B4n,JsonResponseWithExample:()=>G4n,KeyValuePair:()=>GUo,LiteralExample:()=>HUo,LiteralSchema:()=>V4n,LiteralSchemaValue:()=>zVo,LongSchema:()=>MVo,MapSchema:()=>NVo,MapSchemaWithExample:()=>dWo,MultipartRequest:()=>T4n,MultipartRequestProperty:()=>kUo,MultipartRequestPropertyEncoding:()=>ZUo,MultipartSchema:()=>XUo,NamedFullExample:()=>Irr,Namespace:()=>FUo,NamespaceId:()=>WUo,NullableSchema:()=>LVo,NullableSchemaWithExample:()=>_Wo,OauthSecurityScheme:()=>UUo,ObjectProperty:()=>VVo,ObjectPropertyConflictInfo:()=>H4n,ObjectPropertyWithExample:()=>vWo,ObjectSchema:()=>xVo,ObjectSchemaWithExample:()=>hWo,OctetStreamRequest:()=>q4n,OffsetPagination:()=>hVo,OneOfSchema:()=>UVo,OneOfSchemaWithExample:()=>yWo,OpenApiIntermediateRepresentation:()=>UXp,OpenApiSource:()=>DUo,OptionalSchema:()=>FVo,OptionalSchemaWithExample:()=>pWo,Pagination:()=>F4n,PathParameter:()=>M4n,PathParameterExample:()=>oVo,PathParameterWithExample:()=>GVo,PrimitiveExample:()=>D4n,PrimitiveSchema:()=>MEi,PrimitiveSchemaValue:()=>CVo,PrimitiveSchemaValueWithExample:()=>sWo,PrimitiveSchemaWithExample:()=>Q4n,PropertyKey:()=>S4n,ProtobufEncoding:()=>AUo,ProtobufSource:()=>EUo,QueryParameter:()=>A4n,QueryParameterExample:()=>x4n,QueryParameterWithExample:()=>$4n,QuerySecurityScheme:()=>RUo,ReferencedSchema:()=>Brr,Request:()=>tVo,RequestWithExample:()=>JVo,Response:()=>rVo,ResponseWithExample:()=>KVo,Schema:()=>wm,SchemaId:()=>zZ,SchemaWithExample:()=>lA,Schemas:()=>DVo,SdkGroup:()=>LUo,SdkGroupInfo:()=>JUo,SdkGroupName:()=>SEi,SecurityScheme:()=>VUo,SecuritySchemeId:()=>BUo,Server:()=>dCa,Source:()=>MUo,StatusCode:()=>Trr,StreamingResponseExample:()=>uVo,StringSchema:()=>qVo,StringSchemaWithExample:()=>iWo,SupportedSdkLanguage:()=>lVo,Tag:()=>CUo,TagId:()=>xZ,Tags:()=>KUo,TextResponse:()=>EEi,Uint64WithExample:()=>eWo,UintWithExample:()=>kVo,UnDiscriminatedOneOfSchema:()=>HVo,UnDiscriminatedOneOfSchemaWithExample:()=>gWo,UnknownSchemaWithExample:()=>lWo,Webhook:()=>bVo,WebhookExampleCall:()=>U4n,WebhookHttpMethod:()=>L4n,WebhookWithExample:()=>HXp,WebsocketChannel:()=>SVo,WebsocketHandshake:()=>gVo,WebsocketHandshakeWithExample:()=>VXp,WebsocketMessageExample:()=>jVo,WebsocketMessageOrigin:()=>OVo,WebsocketMessageSchema:()=>mVo,WebsocketServer:()=>PVo,WebsocketSessionExample:()=>wVo,WithAvailability:()=>Ch,WithDescription:()=>gf,WithEncoding:()=>Dae,WithInline:()=>VE,WithName:()=>z0,WithNamespace:()=>n0,WithSdkGroupName:()=>um,WithSource:()=>Zh,WithStatusCode:()=>YNe,WithTitle:()=>om,commons:()=>Xuc,example:()=>Zuc,finalIr:()=>kuc,parseIr:()=>esc});var Xuc={};mo(Xuc,{BasicSecurityScheme:()=>IUo,BearerSecurityScheme:()=>zUo,Encoding:()=>qUo,HeaderSecurityScheme:()=>xUo,Namespace:()=>FUo,NamespaceId:()=>WUo,OauthSecurityScheme:()=>UUo,OpenApiSource:()=>DUo,ProtobufEncoding:()=>AUo,ProtobufSource:()=>EUo,QuerySecurityScheme:()=>RUo,SchemaId:()=>zZ,SdkGroup:()=>LUo,SdkGroupName:()=>SEi,SecurityScheme:()=>VUo,SecuritySchemeId:()=>BUo,Server:()=>dCa,Source:()=>MUo,StatusCode:()=>Trr,Tag:()=>CUo,TagId:()=>xZ,WithAvailability:()=>Ch,WithDescription:()=>gf,WithEncoding:()=>Dae,WithInline:()=>VE,WithName:()=>z0,WithNamespace:()=>n0,WithSdkGroupName:()=>um,WithSource:()=>Zh,WithStatusCode:()=>YNe,WithTitle:()=>om});var Mt={};mo(Mt,{JsonError:()=>m4n,ParseError:()=>P4n,any:()=>MXp,bigint:()=>hXp,boolean:()=>AXp,booleanLiteral:()=>EXp,date:()=>yXp,discriminant:()=>NXp,enum_:()=>jUo,getObjectLikeUtils:()=>VWt,getObjectUtils:()=>rQi,getSchemaUtils:()=>Fq,isProperty:()=>jEi,lazy:()=>vXp,lazyObject:()=>wXp,list:()=>SUo,number:()=>qXp,object:()=>wUo,objectWithoutOptionalProperties:()=>jXp,optional:()=>Quc,property:()=>gXp,record:()=>IXp,set:()=>zXp,string:()=>TXp,stringLiteral:()=>DXp,transform:()=>Juc,undiscriminatedUnion:()=>RXp,union:()=>LXp,unknown:()=>CXp,withParsedProperties:()=>Yuc});var Ej={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function cA(e,t){return`Expected ${t}. Received ${UVD(e)}.`}function UVD(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function K9(e){return{...e,json:_Xp(e.json),parse:_Xp(e.parse)}}function _Xp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
@@ -1968,7 +1968,7 @@ plugins:
1968
1968
  - enum_type=string
1969
1969
  - default_response=false
1970
1970
  - source_root=${e}
1971
- `}async function cFe({context:e,specs:t,relativePathToDependency:r}){let i=new cKo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>MPE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u.filter(l=>yv(l))]}async function MPE({generator:e,protobufSpec:t,relativePathToDependency:r}){return t.absoluteFilepathToProtobufTarget==null?void 0:{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var hb_=require("fs"),e5n=require("fs/promises");var yb_=require("os"),vb_=ui(require("path"),1),bb_=require("stream/promises"),gb_=ui(vYo(),1),Ob_=ui(QX(),1);var rbc=ui(TWi(),1);var zP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(zP||(zP={}));var n1E=zli();async function mb_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:zP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:zP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${f1E(s)}`},async o=>{switch(s.type){case"version":l=await c1E({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await s1E({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:jo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var Pb_="dependencies";var a1E="metadata.json",o1E=".fern";function u1E(e){return Ru(ll.of((0,yb_.homedir)()),Na.of(o1E),Na.of(Pb_),Na.of(e.organization),Na.of(e.apiName),Na.of(e.version))}async function s1E({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:Na.of(e.path)},i);return t.logger.info("Loaded..."),u}async function c1E({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=u1E(e),u=Ru(a,Na.of(Pb_)),l=Ru(a,Na.of(a1E)),d;if(!await mf(u)||!await mf(l)){t.logger.info("Downloading manifest...");let c=await n1E.definitionRegistry.get(rbc.FernFiddle.OrganizationId(e.organization),rbc.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=GGi(r),O=GGi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<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 ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,e5n.mkdir)(u,{recursive:!0});try{await l1E({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,e5n.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,e5n.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function l1E({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await VN.get(e,{responseType:"stream"}),i=await Ob_.default.dir(),n=vb_.default.join(i.path,"api.tgz");await(0,bb_.pipeline)(r.data,(0,hb_.createWriteStream)(n)),await(0,gb_.extract)({file:n,cwd:t})}function f1E(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:jo(e)}}var zb_=ui(Mb_(),1);function bYo(e,t){for(let[r,i]of FF(e))p1E({relativeFilepath:r,failure:i,logger:t})}function p1E({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case zP.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 zP.FILE_READ:r.error("Failed to open file: "+e);break;case zP.FILE_MISSING:r.error("Missing file: "+e);break;case zP.FILE_PARSE:t.error instanceof zja?r.error(JNe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case zP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of _1E(i))r.error(JNe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case zP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case zP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${Evo}: `+t.dependencyName);break;case zP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case zP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case zP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(JNe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(JNe({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:jo(t)}}function _1E(e){switch(e.code){case ql.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Ss.underline(e.expected)} but received ${Ss.underline(e.received)}`}];case ql.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Ss.underline(t)}`}));case ql.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Ss.underline(t)).join(", ")}`}];case ql.invalid_union:case ql.invalid_arguments:case ql.invalid_return_type:case ql.invalid_date:case ql.invalid_string:case ql.too_small:case ql.too_big:case ql.invalid_intersection_types:case ql.not_multiple_of:case ql.custom:default:return[{title:e.message}]}}var Ab_=require("fs/promises");async function qb_(e,t){let r=[];for(let i of await cxe(e,t))r.push(await h1E({relativeFilepath:Bq(e,i),absoluteFilepath:i}));return r}async function h1E({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Ab_.readFile)(t)).toString()}}async function Tb_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:md.load(n.fileContents,{schema:md.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:zP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function Cb_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all(FF(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(RA(b)>0)d[s]={type:zP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=Cd(s);if(xUt(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:zP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await mb_({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[Cd(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),RA(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var Bb_=ui(require("path"),1);var abc={};mo(abc,{additionalProperties:()=>g1E,default:()=>m1E,definitions:()=>O1E,properties:()=>v1E,required:()=>b1E,type:()=>y1E});var y1E="object",v1E={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},b1E=["name"],g1E=!1,O1E={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},m1E={type:y1E,properties:v1E,required:b1E,additionalProperties:g1E,definitions:O1E};var obc={};mo(obc,{additionalProperties:()=>w1E,default:()=>D1E,definitions:()=>S1E,properties:()=>j1E,type:()=>P1E});var P1E="object",j1E={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},w1E=!1,S1E={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},D1E={type:P1E,properties:j1E,additionalProperties:w1E,definitions:S1E};var ubc={};mo(ubc,{additionalProperties:()=>A1E,default:()=>T1E,definitions:()=>q1E,properties:()=>M1E,type:()=>E1E});var E1E="object",M1E={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},A1E=!1,q1E={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},T1E={type:E1E,properties:M1E,additionalProperties:A1E,definitions:q1E};function Ib_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of FF(e)){let d=l.contents,s=o=>{a[u]={type:zP.JSONSCHEMA_VALIDATION,error:o}};if(u===UF){let o=VUt(d,abc);if(o.success){let c=BN.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(Bb_.default.basename(u)===TS){let o=VUt(d,ubc);if(o.success){let c=BN.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=VUt(d,obc);if(o.success){let c=BN.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:Ru(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[Na.of(UF)]:{type:zP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var oir=class extends FWt{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,zb_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=Ru(this.absoluteFilePath,Na.of(i9)),l=await $Rs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await qb_(u,"{yml,yaml}"),s=await Tb_(d);if(!s.didSucceed)return bYo(s.failures,a.logger),a.failAndThrow();let o=Ib_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return bYo(o.failures,a.logger),a.failAndThrow();let c=await Cb_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return bYo(c.failures,a.logger),a.failAndThrow();let b={absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions};r?.auth!=null&&(b={...b,rootApiFile:{...b.rootApiFile,contents:{...b.rootApiFile.contents,auth:r?.auth}}}),n=new nMe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:b,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var kb_=require("fs/promises");var C1E=du.object({type:du.string(),channelId:du.string().optional(),messageId:du.string(),value:du.any()}),B1E=du.object({summary:du.string().optional(),description:du.string().optional(),"query-parameters":du.record(du.string()).optional(),headers:du.record(du.string()).optional(),messages:du.array(C1E)}),xb_=du.array(B1E);var gYo=class extends Mg{channel;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t??[],context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=xb_.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(i=>({summary:i.summary,description:i.description,queryParameters:i["query-parameters"],headers:i.headers,messages:i.messages.map(n=>({type:n.type,channelId:n.channelId,messageId:n.messageId,value:n.value}))}))}};var i5n=class extends __{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=i,this.channel=n,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:i}){let a=new gYo({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel}).convert();return a==null?{}:Object.fromEntries(a.map((u,l)=>[l.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:u.queryParameters,headers:u.headers,messages:u.messages.map(d=>({type:i==="v2"?d.type:d.messageId,body:d.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var HMi=class extends wM.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:i,parameterNamePrefix:n}){super({context:t,breadcrumbs:r,parameter:i}),this.parameterNamePrefix=n}convert(){let t,r={},n=new RW.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},l=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:n}).convert();return l!=null&&(t=l.type,r=l.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var OYo=class extends Mg{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var n5n=class extends Mg{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var mYo=class extends i5n{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a})}convert(){let t=[],r=[],i=[],a=new n5n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:i}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let u;this.channel.subscribe!=null&&(u=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let l;this.channel.publish!=null&&(l=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let d=[];u!=null&&d.push(u),l!=null&&d.push(l);let o=new OYo({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),c=this.transformToValidPath(o??this.channelPath),b=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],g=JN(c),O=d_(this.channelPath),m=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(O),displayName:a,baseUrl:b,path:g,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:d,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:c,baseUrl:b,asyncApiVersion:"v2"})}},audiences:m,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:i}){let n,a=i==="server"?"subscribe":"publish",u=[...this.breadcrumbs,a],l=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:u});l!=null&&(r.message=l);let d=uUi(d_(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let o=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:u,schemaOrReference:r.message,schemaIdOverride:d}).convert();o!=null&&o.schema!=null&&(n=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let s=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:u});if(s!=null){let c=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:u,schemaOrReference:s,schemaIdOverride:d}).convert();c!=null&&c.schema!=null&&(n=c.schema,this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes})}}if(n!=null){let s=n,o=Kc.named({fernFilepath:t.createFernFilepath(),name:s.typeDeclaration.name.name,typeId:s.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),c=E9.reference({bodyType:o,docs:r.description}),b=i==="server"?"subscribe":"publish";return{type:b,displayName:b,origin:i,body:c,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[i,n]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(a==null)continue;let l=new HMi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:i,in:"path",description:a.description,required:a.required??!0}}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type==="path"&&r.push(l.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let i=this.channel.bindings.ws.headers.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let u=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(u==null)continue;let d=new HMi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"header",required:i.includes(n),schema:u,description:"description"in u?u.description:void 0}}).convert();d!=null&&d.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},r.push(d.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let i=this.channel.bindings.ws.query.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let u=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(u==null)continue;let d=new HMi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"query",required:i.includes(n),schema:u,description:"description"in u?u.description:void 0,deprecated:u.deprecated??!1}}).convert();d!=null&&d.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},r.push(d.parameter))}}}};var a5n=class extends __{servers;constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r}),this.servers=i}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[i,n]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,i,n);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:ex.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var PYo=class extends a5n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.url),docs:void 0}}};var sbc="$message.",Rb_="#/channels/",Nb_="#/servers/",jYo=class extends i5n{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a,operations:u}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}),this.operations=u}convert(){let t=[],r=[],i=[],a=new n5n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:this.channelPath});let u=Object.entries(this.operations).reduce((b,[g,O])=>{try{this.getChannelPathFromOperation(O)===this.channelPath&&(b[g]=O)}catch{}return b},{}),l=[];for(let[b,g]of Object.entries(u))for(let O of g.messages){let m=this.context.convertReferenceToTypeReference({reference:O});if(m.ok){let w=E9.reference({bodyType:m.reference,docs:g.description});l.push({type:b,displayName:b,origin:g.action==="send"?"client":"server",body:w,availability:this.context.getAvailability({node:g,breadcrumbs:this.breadcrumbs}),docs:g.description})}}let d=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],s=this.transformToValidPath(this.channel.address??this.channelPath),o=JN(s),c=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:d,path:o,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:l,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:s,baseUrl:d,asyncApiVersion:"v3"})}},audiences:c,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:n}){for(let a of Object.values(this.channel.parameters??{})){let u=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(u==null)continue;let l=this.convertChannelParameterLocation(u.location);if(l==null)continue;let{type:d,parameterKey:s}=l,c=new HMi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...u,name:s,in:d},parameterNamePrefix:this.channelPath}).convert();if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":t.push(c.parameter);break;case"query":r.push(c.parameter);break;case"header":i.push(c.parameter);break}}}convertChannelParameterLocation(t){try{let[r,i]=t.split("#/");if(r==null||i==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(sbc)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${sbc} prefix`,path:this.breadcrumbs});return}let n=r.substring(sbc.length);if(n!=="header"&&n!=="path"&&n!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${n}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return n==="payload"?{type:"query",parameterKey:i}:{type:n,parameterKey:i}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(Nb_)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let i=r.$ref.substring(Nb_.length);if(i==null){this.context.errorCollector.collect({message:`Failed to find server with name ${i}`,path:this.breadcrumbs});return}return i}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Rb_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Rb_.length)}};var wYo=class extends a5n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.host),docs:void 0}}};var tza=class extends zWt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,i]of Object.entries(t.channels??{}))for(let[n,a]of Object.entries(i.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let u=["channels",r,"messages",n],l=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:u});if(!this.context.isMessageWithPayload(l))continue;let d=this.context.resolveMaybeReference({schemaOrReference:l.payload,breadcrumbs:u});if(d==null)continue;let s=`${r}_${n}`;this.convertSchema({id:s,breadcrumbs:u,schema:d})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let i=["components","messages",t],n=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:i});n!=null&&this.convertSchema({id:t,breadcrumbs:i,schema:n})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:i}){let a=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:i}).convert();a!=null&&(this.addTypeToRootPackage(t),this.addTypesToIr({...a.inlinedTypes,[t]:a.convertedSchema}))}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new wYo({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new PYo({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let n=new RW.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let l=this.context.spec.operations??{};a=new jYo({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t,operations:l}).convert()}else a=new mYo({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:n}),this.addTypesToIr(a.inlinedTypes))}}};var rza=class extends O3{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a,u=t.$ref.match(/^.*\/schemas\/(.+)$/),l=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),d=t.$ref.match(/^.*\/messages\/(.+)$/);if(u&&u[1])return a=u[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a});if(l&&l[2]){let s=l[1],o=l[2];return a=`${s}_${o}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})}else return d&&d[1]?(a=d[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.name??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.messageId??u.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.messageId??u.value.name??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}};var Wb_=ui(SYo(),1);var DYo=class extends Mg{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};function Fb_({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?__.OPTIONAL_STRING:__.STRING,env:r.env,v2Examples:r.optional?void 0:x1E({header:r,context:t}),availability:void 0,docs:void 0}))}function x1E({header:e,context:t}){let r=new WNe({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:i}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:i}}}var fbc=ui(SYo(),1);var Lb_=["get","post","put","delete","patch","head"];var EYo=class extends Mg{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var R1E=du.object({cursor:du.string(),next_cursor:du.string(),results:du.string()}),N1E=du.object({offset:du.string(),results:du.string(),step:du.string().optional(),"has-next-page":du.string().optional()}),cbc=du.union([du.boolean(),R1E,N1E]);var lbc="$request.",MYo="$response.",AYo=class extends Mg{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i,context:n}){super({breadcrumbs:t,context:n}),this.operation=r,this.document=i}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=cbc.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let i=this.getExtensionValue(this.document);if(i==null)return;if(typeof i=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let n=cbc.safeParse(i);if(!n.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:n.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:O3.maybeTrimPrefix(r.cursor,lbc),nextCursor:O3.maybeTrimPrefix(r.next_cursor,MYo),results:O3.maybeTrimPrefix(r.results,MYo)};let i=t;return{type:"offset",offset:O3.maybeTrimPrefix(i.offset,lbc),results:O3.maybeTrimPrefix(i.results,MYo),step:i.step!=null?O3.maybeTrimPrefix(i.step,lbc):void 0,hasNextPage:i["has-next-page"]!=null?O3.maybeTrimPrefix(i["has-next-page"],MYo):void 0}}};var F1E="$request.",L1E=du.object({"stream-condition":du.string().optional(),format:du.enum(["sse","json"]).optional(),"stream-description":du.string().optional(),"response-stream":du.any(),response:du.any()}),U1E=du.union([du.boolean(),L1E]),qYo=class extends Mg{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=U1E.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:O3.maybeTrimPrefix(r.data["stream-condition"],F1E),responseStream:r.data["response-stream"],response:r.data.response}}};var TYo=class extends Mg{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var CYo=class extends Mg{operation;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:i}){super({breadcrumbs:r,context:t}),this.operation=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).filter(n=>{let a=BN.serialization.ExampleEndpointCallSchema.parse(n);return a.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),a.ok})}};var BYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:i,group:n,method:a,statusCode:u,streamingExtension:l}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseBody=i,this.statusCode=u,this.streamingExtension=l}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,i=[...this.group,this.method,"Response",this.statusCode].join("_"),n=`${i}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:n}),u=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:i});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:u})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let i of r){let n=this.responseBody.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:n,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(n=>n.includes("json"));for(let n of r){let a=this.responseBody.content?.[n];if(a==null)continue;let u=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:n});if(u!=null&&this.shouldReturnJsonResponse(n))return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:u})}let i=Object.keys(this.responseBody.content??{}).filter(n=>!n.includes("json"));for(let n of i){let a=this.responseBody.content?.[n];if(a==null)continue;let u=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:n});if(u!=null){if(this.isBinarySchema(u))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:a}):this.returnFileDownloadResponse({mediaTypeObject:a});if(this.shouldReturnTextResponse(n))return this.returnTextResponse({mediaTypeObject:a})}}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(!(t==null||r==null))return{responseBody:xw.json(j9.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:xw.streaming(w9.json({docs:this.responseBody.description,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:xw.streaming(w9.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:xw.streaming(w9.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:xw.json(j9.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:xw.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:xw.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:xw.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return _M.parse(t)?.isText()??!1}};var IYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;constructor({context:t,breadcrumbs:r,responseError:i,group:n,method:a,methodName:u,statusCode:l}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseError=i,this.statusCode=l,this.methodName=u}convert(){if(!this.responseError.content){let i=UTa[this.statusCode];if(i==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let n=this.getErrorIdFromErrorName(i);return{error:{error:{name:this.context.casingsGenerator.generateName(n),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:n},docs:this.responseError.description},errorType:Kc.unknown(),displayName:i,statusCode:this.statusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(i=>i.includes("json")),r=UTa[this.statusCode];if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let i of[...t]){let n=this.responseError.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:Ub_(`${this.methodName}Request${r}`),contentType:i});if(a==null)continue;let u=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:u,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:u,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:i,convertedSchema:n}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:i,errorId:r},docs:this.responseError.description},errorType:n.type,displayName:t,statusCode:this.statusCode,inlinedTypes:n.inlinedTypes,examples:n.examples}}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?Ub_(`${this.methodName}Request${t}`):t}};function Ub_(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var zYo=class extends wM.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var xYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{requestBody;schemaId;streamingExtension;constructor({context:t,breadcrumbs:r,requestBody:i,group:n,method:a,streamingExtension:u}){super({context:t,breadcrumbs:r,group:n,method:a}),this.requestBody=i,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u}convert(){if(this.requestBody.content)return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){let t=this.getOrderedJsonOrFormContentTypes();for(let r of t){let i=this.handleStreamConditionJsonOrFormContent({contentType:r});if(i!=null)return i}}convertNonStreamConditionRequestBody(){let t=this.getOrderedJsonOrFormContentTypes();for(let n of t){let a=this.handleJsonOrFormContent({contentType:n});if(a!=null)return a}let r=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isMultipart());for(let n of r){let a=this.handleMultipartContent({contentType:n});if(a!=null)return a}let i=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isOctetStream());for(let n of i){let a=this.handleOctetStreamContent({contentType:n});if(a!=null)return a}}getOrderedJsonOrFormContentTypes(){let t=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isJSON()),r=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isURLEncoded()),i=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isPlainText());return[...t,...r,...i]}handleJsonOrFormContent({contentType:t}){let r=this.requestBody.content[t];if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;return n?.type==="object"?{requestBody:tA.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:n.extendedProperties,extends:n.extends,properties:n.properties,extraProperties:n.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes})}:{requestBody:tA.reference({contentType:t,docs:this.requestBody.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.requestBody.content[t];if(r==null||r.schema==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;if(n?.type==="object")return{requestBody:tA.fileUpload({contentType:t,docs:this.requestBody.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:n.properties.map(a=>{let u=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:u})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes}),examples:i.examples}}handleOctetStreamContent({contentType:t}){let r=this.requestBody.content[t];if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:tA.bytes({contentType:t,isOptional:this.requestBody.required===!1,docs:this.requestBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:i}){let{isFile:n,isOptional:a,isArray:u}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return n?u?w6.file(gne.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):w6.file(gne.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):w6.bodyProperty({...t,contentType:i?.contentType??r,style:W1E({property:t,encoding:i}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.requestBody.content[t];if(r==null||r.schema==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(i==null)return;let n=i.properties?.[this.streamingExtension.streamConditionProperty];if(n==null||this.context.isReferenceObject(n))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!0,contentType:t,mediaTypeObject:r}),u=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||u==null))return{requestBody:u.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...u.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:i,contentType:n,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let u={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:i,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},l={...a,schema:u},d=this.parseMediaTypeObject({mediaTypeObject:l,schemaId:this.schemaId,contentType:n});if(d==null)return;let s=d.schema?.typeDeclaration.shape;if(s?.type==="object")return{requestBody:tA.inlinedRequestBody({contentType:n,docs:void 0,name:this.context.casingsGenerator.generateName(i?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:s.extendedProperties,extends:s.extends,properties:s.properties,extraProperties:s.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:l,exampleGenerationStrategy:"request"})}),inlinedTypes:d.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:i}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:i}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:i}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:i??!1}}},V1E={"application/json":"json"};function W1E({property:e,encoding:t}){let r;if(t?.contentType&&(r=V1E[t?.contentType]),r)return r}var H1E=/{([^}]+)}/g,$1E=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),o5n=class extends __{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r}),this.operation=i,this.method=n,this.path=a}convertHttpMethod(){switch(this.method){case"get":return YC.Get;case"post":return YC.Post;case"put":return YC.Put;case"delete":return YC.Delete;case"patch":return YC.Patch;case"head":return YC.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],i=[],n=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n};for(let a of this.operation.parameters){let u=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(u==null)continue;let d=new zYo({context:this.context,breadcrumbs:t,parameter:u}).convert();if(d!=null)switch(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type){case"path":r.push(d.parameter);break;case"query":i.push(d.parameter);break;case"header":{let s=d.parameter.name.name.originalName,o=d.parameter.name.wireValue,c=!1,b=this.context.authOverrides?.["auth-schemes"];if(b!=null){for(let O of Object.values(b))if(K1E(O)&&O.header.toLowerCase()===o.toLowerCase()){c=!0;break}}let g=this.context.globalHeaderNames;if(g!=null){for(let O of g)if(O.toLowerCase()===o.toLowerCase()){c=!0;break}}!$1E.has(s.toLowerCase())&&!c&&n.push(d.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n}}checkMissingPathParameters(t){let i=[...this.path.matchAll(H1E)].map(n=>n[1]).filter(n=>!t.some(a=>a.name.originalName===n));for(let n of i){if(n==null)continue;let a=`${n}_example`;t.push({name:this.context.casingsGenerator.generateName(n),valueType:__.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:n})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.requestBody==null)return;let a=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(a==null)return null;let l=new xYo({context:this.context,breadcrumbs:t,requestBody:a,group:r??[],method:i,streamingExtension:n}).convert();if(l!=null)return this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},{requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}}computeGroupNameAndLocationFromExtensions(){let r=new RW.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,n=new RW.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:n,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?d_(this.operation.summary):d_(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let i=Vb_(t),n=Vb_(r);return b2(i,n)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:n})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:i,methodNameTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:d_(u.join("_"))}}generateStringParameterExample({example:t}){let r=new wM.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:i}=r.convert();return i}};function Vb_(e){let t=G1E(e)?Q1E(e):J1E(e);return t=t.map(r=>r.toLowerCase()),t=Jze(t),t}function G1E(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function Q1E(e){return e.split(/(?=[A-Z])/)}function J1E(e){return e.split(/[^a-zA-Z0-9]+/)}function K1E(e){return e?.header!=null}var RYo=class e extends o5n{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a,idempotent:u,idToAuthScheme:l,topLevelServers:d,streamingExtension:s}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a}),this.idempotent=u,this.idToAuthScheme=l,this.topLevelServers=d,this.streamingExtension=s}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=this.getGroupDisplayName(r),{headers:a,pathParameters:u,queryParameters:l}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),d=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:i,streamingExtension:this.streamingExtension}),s=d?.requestBody,o=d?.streamRequestBody,c=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:i,streamingExtension:this.streamingExtension}),b=c?.response,g=c?.streamResponse,O=c!=null?c.errors:[],m={},w=O.map(K=>K.error),E=JN(this.path),q=this.getEndpointBaseUrl(),A=this.getEndpointBaseUrls(),D=this.convertExamples({httpPath:E,httpMethod:t,baseUrl:q}),C=new Set(this.operation.security?.flatMap(K=>Object.keys(K))??[]),x=this.authSchemeToHeaders(Array.from(C));x.length>0&&a.push(...x);for(let K of O){let Y=K.error,Z=K.errorType,oe=Y.error.errorId;m[oe]={name:Y.error,displayName:K.displayName,discriminantValue:{name:Y.error.name,wireValue:oe},type:Z,statusCode:K.statusCode,docs:Y.docs,examples:[],v2Examples:void 0}}let $=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],I={displayName:this.operation.summary,method:t,baseUrl:q,v2BaseUrls:A,path:E,pathParameters:u,queryParameters:l,headers:a.filter((K,Y,Z)=>Y===Z.findIndex(oe=>oe.name.wireValue===K.name.wireValue)),sdkRequest:void 0,errors:w,auth:this.operation.security!=null||this.context.spec.security!=null,availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:E,allPathParameters:u,pagination:void 0,transport:void 0,source:_Q.openapi(),audiences:$},F=this.context.namespace!=null?[this.context.namespace]:[],V=r?.map(K=>d_(K));return F.push(...V??[]),{audiences:$,group:r,groupDisplayName:n,errors:m,endpoint:{...I,id:`endpoint_${F.join("/")}.${i}`,name:this.context.casingsGenerator.generateName(i),requestBody:s,response:b,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:D.examples}},streamEndpoint:g!=null&&g.body!=null?{...I,id:`endpoint_${F.join("/")}.${i}_stream`,name:this.context.casingsGenerator.generateName(`${i}_stream`),requestBody:o,response:g,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:D.streamExamples}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.responses==null)return;let a,u=!1;for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(!(isNaN(s)||s<200||s>=300&&s<400)){if(a==null&&(a={response:void 0,streamResponse:void 0,errors:[],examples:{}}),s>=200&&s<300&&!u){let o=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:[...t,l]});if(o==null)continue;let b=new BYo({context:this.context,breadcrumbs:[...t,l],responseBody:o,group:r??[],method:i,statusCode:l,streamingExtension:n}).convert();b!=null&&(u=!0,this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},a.response={statusCode:s,body:b.responseBody},a.streamResponse={statusCode:s,body:b.streamResponseBody})}if(s>=400&&s<600){let o=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:[...t,l]});if(o==null)continue;let b=new IYo({context:this.context,breadcrumbs:[...t,l],responseError:o,group:r??[],method:i,methodName:this.evaluateMethodNameFromOperation(),statusCode:s}).convert();b!=null&&(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},a.errors.push(b))}}}return a}authSchemeToHeaders(t){let r=[];for(let i of t){let n=this.idToAuthScheme?.[i];if(n==null)continue;let a={valueType:__.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(n.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:n.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:i}){let a=new CYo({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation}).convert();return a==null?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){let a=n.filter(s=>!(s.response!=null&&"stream"in s.response)),u=n.filter(s=>s.response!=null&&"stream"in s.response),l=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),d=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:u});return{examples:l,streamExamples:d}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){return Object.fromEntries(n.map((a,u)=>[this.getExampleName({example:a,exampleIndex:u}),{request:a.request!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(l=>{let d=("language"in l?l.language:l.sdk)??void 0;return{name:l.name,docs:void 0,language:d,code:l.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return Gs.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return Gs.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let t=this.operation.servers?.[0];if(t==null)return;let i=this.topLevelServers?.find(n=>n.url===t.url)??t;return rMe.getServerName({server:i,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(i=>{let a=this.topLevelServers?.find(u=>u.url===i.url)??i;return rMe.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(i=>`${r[i.pathParameter]?.toString()??i.pathParameter}${i.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(i=>i.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let i=t?.[t.length-1];if(i!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===i?r:void 0}};var u5n=class extends o5n{constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=[...this.breadcrumbs,"Payload"],{headers:a}=this.convertParameters({breadcrumbs:n}),u=this.convertRequestBody({breadcrumbs:n,group:r,method:i,streamingExtension:void 0});if(u==null)return;let{requestBody:l}=u,d;if(l.type==="inlinedRequestBody")d=fW.inlinedPayload({name:l.name,extends:l.extends,properties:l.properties});else if(l.type==="reference")d=fW.reference({payloadType:l.requestBodyType,docs:l.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${i}`,name:this.context.casingsGenerator.generateName(i),displayName:this.operation.summary,method:t,headers:a,payload:d,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(l.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(l.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,{name:r,payload:i}]))}};var NYo=class extends __{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:i,path:n,idToAuthScheme:a,topLevelServers:u}){super({context:t,breadcrumbs:r}),this.pathItem=i,this.path=n,this.idToAuthScheme=a,this.topLevelServers=u}convert(){let t=[],r=[],i={};for(let n of Lb_){let a=this.pathItem[n];if(a==null)continue;let u=[...this.breadcrumbs,n],l=this.tryParseAsWebhook({operationBreadcrumbs:u,operation:a,method:n,context:this.context});if(l!=null){r.push(l),Object.assign(i,l.inlinedTypes);continue}let s=new qYo({breadcrumbs:u,operation:a,context:this.context}).convert(),o=this.tryParseAsHttpEndpoint({operationBreadcrumbs:u,operation:a,method:n,streamingExtension:s});o!=null&&(t.push(o),Object.assign(i,o.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:i}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n}){return new TYo({breadcrumbs:i,operation:t,context:n}).convert()?new u5n({context:this.context,breadcrumbs:i,operation:t,method:fbc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,streamingExtension:n}){new AYo({breadcrumbs:i,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let d=new EYo({breadcrumbs:i,operation:t,context:this.context}).convert();return new RYo({context:this.context,breadcrumbs:i,operation:t,method:fbc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:d,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:n}).convert()}};var FYo=class extends __{securityScheme;constructor({context:t,breadcrumbs:r,securityScheme:i}){super({context:t,breadcrumbs:r}),this.securityScheme=i}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return BT.bearer({token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return BT.basic({username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return BT.header({name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:__.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return BT.bearer({token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var iza=class extends zWt{constructor({breadcrumbs:t,context:r,audiences:i}){super({breadcrumbs:t,context:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec});let t=this.convertSecuritySchemes();this.convertGlobalHeaders(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:r,errors:i}=this.convertPaths({idToAuthScheme:t});this.addErrorsToIr(i);let{defaultUrl:n}=this.convertServers({endpointLevelServers:r});return this.updateEndpointsWithDefaultUrl(n),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new DYo({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let i=Fb_({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(i),this.context.setGlobalHeaders(i)}}convertSecuritySchemes(){if(this.context.authOverrides)return this.addAuthToIR(xoc({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator})),{};let t={},r=[];for(let[i,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let a=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",i]});if(a==null)continue;let l=new FYo({context:this.context,breadcrumbs:["components","securitySchemes",i],securityScheme:a}).convert();l!=null&&(this.shouldAddAuthSchemeToIr({authScheme:l,schemeId:i,currentSecuritySchemes:r})?r.push(l):t[i]=l)}return r.length>0&&this.addAuthToIR({requirement:r.length===1?"ALL":"ANY",schemes:r,docs:void 0}),t}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let n=NTa({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return n!=null&&this.addEnvironmentsToIr({environmentConfig:n.environmentsConfig,audiences:n.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let i=new rMe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&(this.addTypeToPackage(t),this.addTypesToIr({...n.inlinedTypes,[t]:n.convertedSchema}))}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,n=new u5n({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:Wb_.OpenAPIV3.HttpMethods.POST,path:r}).convert();n!=null&&(this.addWebhookToIr({webhook:n.webhook,operationId:r,audiences:n.audiences,group:n.group}),this.addTypesToIr(n.inlinedTypes))}}convertPaths({idToAuthScheme:t}){let r=[],i={};for(let[n,a]of Object.entries(this.context.spec.paths??{})){if(a==null)continue;let l=new NYo({context:this.context,breadcrumbs:["paths",n],topLevelServers:this.context.spec.servers,pathItem:a,path:n}).convert();if(l!=null){for(let d of l.endpoints){if(d.streamEndpoint!=null&&this.addEndpointToIr({endpoint:d.streamEndpoint,audiences:d.audiences,endpointGroup:d.group,endpointGroupDisplayName:d.groupDisplayName}),this.addEndpointToIr({endpoint:d.endpoint,audiences:d.audiences,endpointGroup:d.group,endpointGroupDisplayName:d.groupDisplayName}),d.servers)for(let s of d.servers)this.shouldAddServerToCollectedServers({server:s,currentServers:r})&&r.push(s);if(d.errors)for(let[s,o]of Object.entries(d.errors))i[s]=o}for(let d of l.webhooks){let s=this.context.getGroup({groupParts:d.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:d.webhook,operationId:s.join("."),group:s,audiences:d.audiences})}this.addTypesToIr(l.inlinedTypes)}}return{endpointLevelServers:r,errors:i}}shouldAddAuthSchemeToIr({authScheme:t,schemeId:r,currentSecuritySchemes:i}){let n=i.some(u=>u.type===t.type&&u.type==="bearer"&&t.type==="bearer"?u.token===t.token:!1),a=new Set(this.context.spec.security?.flatMap(u=>Object.keys(u))??[]);return(a.size===0||a.has(r))&&!n}};var LYo=class extends Mg{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:i}){super({breadcrumbs:t,context:i}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var nza=class extends O3{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i);let d;if(a.includes("/")){let o=new wM.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:u.value,id:a}).convert();o!=null&&(d={[a]:o.convertedSchema})}return{ok:!0,reference:Kc.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:l}),inlinedTypes:d}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let n=new LYo({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=n}return this.tagToDisplayName[t]??t}};var UYo=class extends wM.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let n=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();n!=null&&(t=n.type,r=n.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var Y1E=du.object({description:du.string().optional(),required:du.boolean().optional(),deprecated:du.boolean().optional(),allowEmptyValue:du.boolean().optional(),style:du.string().optional(),explode:du.boolean().optional(),allowReserved:du.boolean().optional(),schema:du.any().optional(),example:du.any().optional(),examples:du.record(du.string(),du.any()).optional(),content:du.record(du.string(),du.any()).optional()}),X1E=Y1E.extend({name:du.string(),in:du.string()}),Z1E=du.array(X1E),VYo=class extends Mg{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return Z1E.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var WYo=class extends __{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:i,pathParameters:n=[],queryParameters:a=[],headers:u=[],topLevelServers:l=[]}){super({context:t,breadcrumbs:r}),this.method=i,this.pathParameters=n,this.queryParameters=a,this.headers=u,this.topLevelServers=l}convert(){let t={},r="";for(let s of this.pathParameters)r+=`/{${s.name.originalName}}`;let i=JN(r),n=[];for(let[s,o]of this.method.params.entries()){let c;if(this.context.isReferenceObject(o)){let m=this.context.resolveReference({reference:o});if(m.resolved)c=m.value;else continue}else c=o;let b=[this.method.name,"Param",c.name].join("_"),O=new wM.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",c.name],schemaIdOverride:b,context:this.context,schemaOrReference:c.schema,wrapAsOptional:!c.required}).convert();O!=null&&(n.push({docs:c.description,availability:this.context.getAvailability({node:o,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:c.name,wireValue:c.name}),valueType:O.type,v2Examples:O.schema?.typeDeclaration.v2Examples}),t={...O.inlinedTypes,...t,...O.schema!=null?{[b]:O.schema}:{}})}let a;if(this.method.result!=null){let s=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(s!=null){let o=new wM.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:s.schema}),c=[this.method.name,"Result"].join("_"),b=o.convert();b!=null&&(a={docs:s.description,v2Examples:b.schema?.typeDeclaration.v2Examples,responseBodyType:b.type},t={...b.inlinedTypes,...t,...b.schema!=null?{[c]:b.schema}:{}})}}let u=this.getEndpointBaseUrls(),l=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:u,basePath:void 0,auth:!1,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:i,fullPath:i,requestBody:n.length>0?tA.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:n,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,sdkRequest:void 0,response:a!=null?{body:xw.json(j9.response(a)),statusCode:void 0}:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:_Q.openrpc(),audiences:l},audiences:l,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(i=>i.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(i=>{if(this.topLevelServers.find(l=>l.name===i.name&&l.url!==i.url)!=null)return i.url;let u=this.topLevelServers.find(l=>l.url===i.url)??i;return rMe.getServerName({server:u,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let i of this.method.examples??[]){let n;if(this.context.isReferenceObject(i)){let d=this.context.resolveReference({reference:i});if(d.resolved)n=d.value;else continue}else n=i;let a;if(n.result)if(this.context.isReferenceObject(n.result)){let d=this.context.resolveReference({reference:n.result});d.resolved&&(a=d.value)}else a=n.result;let u=n.name??`Example ${r+1}`,l=[];if(n.params&&Array.isArray(n.params)){l=[];for(let d of n.params)if(this.context.isReferenceObject(d)){let s=this.context.resolveReference({reference:d});if(s.resolved)l.push(s.value);else continue}else l.push(d)}t[u]={request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:l.map(d=>d.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?Gs.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:n.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var aza=class extends zWt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let i=new rMe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&(this.addTypeToPackage(t),this.addTypesToIr({...n.inlinedTypes,[t]:n.convertedSchema}))}}convertMethods(){let t=[],i=new VYo({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),n=[],a=[],u=[];if(i&&i.length>0)for(let[d,s]of i.entries()){let c=new UYo({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${d}]`],parameter:s}).convert();if(c!=null)switch(c.type){case"path":{n.push(c.parameter);break}case"query":{a.push(c.parameter);break}case"header":{u.push(c.parameter);break}}}let l=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let d of this.context.spec.methods??[]){let s=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:["methods"]});if(s==null)continue;let c=new WYo({context:this.context,breadcrumbs:["methods"],method:s,pathParameters:n,queryParameters:a,headers:u,topLevelServers:this.context.spec.servers}).convert();if(c!=null&&(this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:l,serviceName:"service_root"}),this.addTypesToIr(c.inlinedTypes),c.servers))for(let b of c.servers)this.shouldAddServerToCollectedServers({server:b,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(b))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(i=>i.name===t.name&&i.url!==t.url)?{...t,name:t.url}:t}};var oza=class extends O3{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i),{ok:!0,reference:Kc.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}};var Hb_={[gy.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,VC(e)])),[gy.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[gy.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[gy.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[gy.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[gy.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[gy.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[gy.GenerationLanguage.SWIFT]:new Set([])};var k1E=["go","ruby"];function GYo({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:eSE({name:c,keywords:tSE({generationLanguage:e,keywords:t})})}),l=d_(n),d=VC(l),s=oUi(n),o=rUi(l);return r&&(!nSE(o)&&(e==null||k1E.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=HYo(c);if(g!=null)return g;if($Yo(c))return c.toUpperCase()}return c}).join(""),d=VC(o.map((c,b)=>{let g=HYo(c);return g??($Yo(c)?c.toUpperCase():b===0?VC(c):c)}).join(""))),s=n.split(" ").map(c=>c.split(/(\d+)/).map(oUi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function eSE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":iSE(e)?"_"+e:e}function tSE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Hb_[e]}var rSE=/^[0-9]/;function iSE(e){return rSE.test(e)}function nSE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=HYo(i)!=null||$Yo(i),a=HYo(t)!=null||$Yo(t);return n&&a})}function HYo(e){return oSE.get(e.toUpperCase())}function $Yo(e){return aSE.has(e.toUpperCase())}var aSE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),oSE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var $b_=require("fs/promises");async function dbc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,$b_.readFile)(t)).toString(),n;try{n=JSON.parse(i)}catch{n=md.load(i)}return r!=null?await S8n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var GMi=require("fs/promises"),Zb_=ui(QX(),1);var Gb_="buf.gen.yaml",uSE="output",Qb_=`${uSE}/ir.json`,Jb_="protoc-gen-fern",Kb_=`version: v2
1971
+ `}async function cFe({context:e,specs:t,relativePathToDependency:r}){let i=new cKo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>MPE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u.filter(l=>yv(l))]}async function MPE({generator:e,protobufSpec:t,relativePathToDependency:r}){return t.absoluteFilepathToProtobufTarget==null?void 0:{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var hb_=require("fs"),e5n=require("fs/promises");var yb_=require("os"),vb_=ui(require("path"),1),bb_=require("stream/promises"),gb_=ui(vYo(),1),Ob_=ui(QX(),1);var rbc=ui(TWi(),1);var zP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(zP||(zP={}));var n1E=zli();async function mb_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:zP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:zP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${f1E(s)}`},async o=>{switch(s.type){case"version":l=await c1E({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await s1E({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:jo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var Pb_="dependencies";var a1E="metadata.json",o1E=".fern";function u1E(e){return Ru(ll.of((0,yb_.homedir)()),Na.of(o1E),Na.of(Pb_),Na.of(e.organization),Na.of(e.apiName),Na.of(e.version))}async function s1E({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:Na.of(e.path)},i);return t.logger.info("Loaded..."),u}async function c1E({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=u1E(e),u=Ru(a,Na.of(Pb_)),l=Ru(a,Na.of(a1E)),d;if(!await mf(u)||!await mf(l)){t.logger.info("Downloading manifest...");let c=await n1E.definitionRegistry.get(rbc.FernFiddle.OrganizationId(e.organization),rbc.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=GGi(r),O=GGi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<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 ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,e5n.mkdir)(u,{recursive:!0});try{await l1E({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,e5n.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,e5n.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function l1E({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await VN.get(e,{responseType:"stream"}),i=await Ob_.default.dir(),n=vb_.default.join(i.path,"api.tgz");await(0,bb_.pipeline)(r.data,(0,hb_.createWriteStream)(n)),await(0,gb_.extract)({file:n,cwd:t})}function f1E(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:jo(e)}}var zb_=ui(Mb_(),1);function bYo(e,t){for(let[r,i]of FF(e))p1E({relativeFilepath:r,failure:i,logger:t})}function p1E({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case zP.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 zP.FILE_READ:r.error("Failed to open file: "+e);break;case zP.FILE_MISSING:r.error("Missing file: "+e);break;case zP.FILE_PARSE:t.error instanceof zja?r.error(JNe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case zP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of _1E(i))r.error(JNe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case zP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case zP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${Evo}: `+t.dependencyName);break;case zP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case zP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case zP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(JNe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(JNe({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:jo(t)}}function _1E(e){switch(e.code){case ql.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Ss.underline(e.expected)} but received ${Ss.underline(e.received)}`}];case ql.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Ss.underline(t)}`}));case ql.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Ss.underline(t)).join(", ")}`}];case ql.invalid_union:case ql.invalid_arguments:case ql.invalid_return_type:case ql.invalid_date:case ql.invalid_string:case ql.too_small:case ql.too_big:case ql.invalid_intersection_types:case ql.not_multiple_of:case ql.custom:default:return[{title:e.message}]}}var Ab_=require("fs/promises");async function qb_(e,t){let r=[];for(let i of await cxe(e,t))r.push(await h1E({relativeFilepath:Bq(e,i),absoluteFilepath:i}));return r}async function h1E({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Ab_.readFile)(t)).toString()}}async function Tb_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:md.load(n.fileContents,{schema:md.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:zP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function Cb_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all(FF(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(RA(b)>0)d[s]={type:zP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=Cd(s);if(xUt(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:zP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await mb_({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[Cd(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),RA(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var Bb_=ui(require("path"),1);var abc={};mo(abc,{additionalProperties:()=>g1E,default:()=>m1E,definitions:()=>O1E,properties:()=>v1E,required:()=>b1E,type:()=>y1E});var y1E="object",v1E={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},b1E=["name"],g1E=!1,O1E={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},m1E={type:y1E,properties:v1E,required:b1E,additionalProperties:g1E,definitions:O1E};var obc={};mo(obc,{additionalProperties:()=>w1E,default:()=>D1E,definitions:()=>S1E,properties:()=>j1E,type:()=>P1E});var P1E="object",j1E={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},w1E=!1,S1E={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},D1E={type:P1E,properties:j1E,additionalProperties:w1E,definitions:S1E};var ubc={};mo(ubc,{additionalProperties:()=>A1E,default:()=>T1E,definitions:()=>q1E,properties:()=>M1E,type:()=>E1E});var E1E="object",M1E={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},A1E=!1,q1E={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},T1E={type:E1E,properties:M1E,additionalProperties:A1E,definitions:q1E};function Ib_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of FF(e)){let d=l.contents,s=o=>{a[u]={type:zP.JSONSCHEMA_VALIDATION,error:o}};if(u===UF){let o=VUt(d,abc);if(o.success){let c=BN.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(Bb_.default.basename(u)===TS){let o=VUt(d,ubc);if(o.success){let c=BN.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=VUt(d,obc);if(o.success){let c=BN.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:Ru(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[Na.of(UF)]:{type:zP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var oir=class extends FWt{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,zb_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=Ru(this.absoluteFilePath,Na.of(i9)),l=await $Rs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await qb_(u,"{yml,yaml}"),s=await Tb_(d);if(!s.didSucceed)return bYo(s.failures,a.logger),a.failAndThrow();let o=Ib_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return bYo(o.failures,a.logger),a.failAndThrow();let c=await Cb_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return bYo(c.failures,a.logger),a.failAndThrow();let b={absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions};r?.auth!=null&&(b={...b,rootApiFile:{...b.rootApiFile,contents:{...b.rootApiFile.contents,auth:r?.auth}}}),n=new nMe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:b,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var kb_=require("fs/promises");var C1E=du.object({type:du.string(),channelId:du.string().optional(),messageId:du.string(),value:du.any()}),B1E=du.object({summary:du.string().optional(),description:du.string().optional(),"query-parameters":du.record(du.string()).optional(),headers:du.record(du.string()).optional(),messages:du.array(C1E)}),xb_=du.array(B1E);var gYo=class extends Mg{channel;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t??[],context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=xb_.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(i=>({summary:i.summary,description:i.description,queryParameters:i["query-parameters"],headers:i.headers,messages:i.messages.map(n=>({type:n.type,channelId:n.channelId,messageId:n.messageId,value:n.value}))}))}};var i5n=class extends __{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=i,this.channel=n,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:i}){let a=new gYo({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel}).convert();return a==null?{}:Object.fromEntries(a.map((u,l)=>[l.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:u.queryParameters,headers:u.headers,messages:u.messages.map(d=>({type:i==="v2"?d.type:d.messageId,body:d.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var HMi=class extends wM.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:i,parameterNamePrefix:n}){super({context:t,breadcrumbs:r,parameter:i}),this.parameterNamePrefix=n}convert(){let t,r={},n=new RW.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},l=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:n}).convert();return l!=null&&(t=l.type,r=l.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var OYo=class extends Mg{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var n5n=class extends Mg{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:i}){super({breadcrumbs:t,context:i}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var mYo=class extends i5n{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a})}convert(){let t=[],r=[],i=[],a=new n5n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:i}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let u;this.channel.subscribe!=null&&(u=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let l;this.channel.publish!=null&&(l=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let d=[];u!=null&&d.push(u),l!=null&&d.push(l);let o=new OYo({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),c=this.transformToValidPath(o??this.channelPath),b=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],g=JN(c),O=d_(this.channelPath),m=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(O),displayName:a,baseUrl:b,path:g,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:d,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:c,baseUrl:b,asyncApiVersion:"v2"})}},audiences:m,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:i}){let n,a=i==="server"?"subscribe":"publish",u=[...this.breadcrumbs,a],l=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:u});l!=null&&(r.message=l);let d=uUi(d_(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let o=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:u,schemaOrReference:r.message,schemaIdOverride:d}).convert();o!=null&&o.schema!=null&&(n=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let s=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:u});if(s!=null){let c=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:u,schemaOrReference:s,schemaIdOverride:d}).convert();c!=null&&c.schema!=null&&(n=c.schema,this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes})}}if(n!=null){let s=n,o=Kc.named({fernFilepath:t.createFernFilepath(),name:s.typeDeclaration.name.name,typeId:s.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),c=E9.reference({bodyType:o,docs:r.description}),b=i==="server"?"subscribe":"publish";return{type:b,displayName:b,origin:i,body:c,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[i,n]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(a==null)continue;let l=new HMi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:i,in:"path",description:a.description,required:a.required??!0}}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type==="path"&&r.push(l.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let i=this.channel.bindings.ws.headers.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let u=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(u==null)continue;let d=new HMi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"header",required:i.includes(n),schema:u,description:"description"in u?u.description:void 0}}).convert();d!=null&&d.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},r.push(d.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let i=this.channel.bindings.ws.query.required??[];for(let[n,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let u=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,n]});if(u==null)continue;let d=new HMi({context:this.context,breadcrumbs:[...this.breadcrumbs,n],parameter:{name:n,in:"query",required:i.includes(n),schema:u,description:"description"in u?u.description:void 0,deprecated:u.deprecated??!1}}).convert();d!=null&&d.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},r.push(d.parameter))}}}};var a5n=class extends __{servers;constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r}),this.servers=i}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[i,n]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,i,n);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:ex.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var PYo=class extends a5n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.url),docs:void 0}}};var sbc="$message.",Rb_="#/channels/",Nb_="#/servers/",jYo=class extends i5n{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a,operations:u}){super({context:t,breadcrumbs:r,websocketGroup:i,channel:n,channelPath:a}),this.operations=u}convert(){let t=[],r=[],i=[],a=new n5n({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:this.channelPath});let u=Object.entries(this.operations).reduce((b,[g,O])=>{try{this.getChannelPathFromOperation(O)===this.channelPath&&(b[g]=O)}catch{}return b},{}),l=[];for(let[b,g]of Object.entries(u))for(let O of g.messages){let m=this.context.convertReferenceToTypeReference({reference:O});if(m.ok){let w=E9.reference({bodyType:m.reference,docs:g.description});l.push({type:b,displayName:b,origin:g.action==="send"?"client":"server",body:w,availability:this.context.getAvailability({node:g,breadcrumbs:this.breadcrumbs}),docs:g.description})}}let d=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],s=this.transformToValidPath(this.channel.address??this.channelPath),o=JN(s),c=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:d,path:o,auth:!1,headers:i,queryParameters:r,pathParameters:t,messages:l,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:s,baseUrl:d,asyncApiVersion:"v3"})}},audiences:c,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:i,channelPath:n}){for(let a of Object.values(this.channel.parameters??{})){let u=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(u==null)continue;let l=this.convertChannelParameterLocation(u.location);if(l==null)continue;let{type:d,parameterKey:s}=l,c=new HMi({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...u,name:s,in:d},parameterNamePrefix:this.channelPath}).convert();if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":t.push(c.parameter);break;case"query":r.push(c.parameter);break;case"header":i.push(c.parameter);break}}}convertChannelParameterLocation(t){try{let[r,i]=t.split("#/");if(r==null||i==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(sbc)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${sbc} prefix`,path:this.breadcrumbs});return}let n=r.substring(sbc.length);if(n!=="header"&&n!=="path"&&n!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${n}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return n==="payload"?{type:"query",parameterKey:i}:{type:n,parameterKey:i}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(Nb_)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let i=r.$ref.substring(Nb_.length);if(i==null){this.context.errorCollector.collect({message:`Failed to find server with name ${i}`,path:this.breadcrumbs});return}return i}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Rb_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Rb_.length)}};var wYo=class extends a5n{constructor({context:t,breadcrumbs:r,servers:i}){super({context:t,breadcrumbs:r,servers:i})}buildSingleBaseUrlEnvironment(t,r,i){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(i.protocol,i.host),docs:void 0}}};var tza=class extends zWt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,i]of Object.entries(t.channels??{}))for(let[n,a]of Object.entries(i.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let u=["channels",r,"messages",n],l=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:u});if(!this.context.isMessageWithPayload(l))continue;let d=this.context.resolveMaybeReference({schemaOrReference:l.payload,breadcrumbs:u});if(d==null)continue;let s=`${r}_${n}`;this.convertSchema({id:s,breadcrumbs:u,schema:d})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let i=["components","messages",t],n=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:i});n!=null&&this.convertSchema({id:t,breadcrumbs:i,schema:n})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:i}){let a=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:i}).convert();a!=null&&(this.addTypeToRootPackage(t),this.addTypesToIr({...a.inlinedTypes,[t]:a.convertedSchema}))}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new wYo({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new PYo({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let n=new RW.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let l=this.context.spec.operations??{};a=new jYo({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t,operations:l}).convert()}else a=new mYo({context:this.context,breadcrumbs:["channels",t],websocketGroup:n,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:n}),this.addTypesToIr(a.inlinedTypes))}}};var rza=class extends O3{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a,u=t.$ref.match(/^.*\/schemas\/(.+)$/),l=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),d=t.$ref.match(/^.*\/messages\/(.+)$/);if(u&&u[1])return a=u[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a});if(l&&l[2]){let s=l[1],o=l[2];return a=`${s}_${o}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})}else return d&&d[1]?(a=d[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.name??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n,typeId:a}){let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.messageId??u.value.name:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.messageId??u.value.name??i),{ok:!0,reference:Kc.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}};var Wb_=ui(SYo(),1);var DYo=class extends Mg{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:i}){super({breadcrumbs:t,context:i}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};function Fb_({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?__.OPTIONAL_STRING:__.STRING,env:r.env,v2Examples:r.optional?void 0:x1E({header:r,context:t}),availability:void 0,docs:void 0}))}function x1E({header:e,context:t}){let r=new WNe({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:i}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:i}}}var fbc=ui(SYo(),1);var Lb_=["get","post","put","delete","patch","head"];var EYo=class extends Mg{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var R1E=du.object({cursor:du.string(),next_cursor:du.string(),results:du.string()}),N1E=du.object({offset:du.string(),results:du.string(),step:du.string().optional(),"has-next-page":du.string().optional()}),cbc=du.union([du.boolean(),R1E,N1E]);var lbc="$request.",MYo="$response.",AYo=class extends Mg{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i,context:n}){super({breadcrumbs:t,context:n}),this.operation=r,this.document=i}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=cbc.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let i=this.getExtensionValue(this.document);if(i==null)return;if(typeof i=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let n=cbc.safeParse(i);if(!n.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:n.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:O3.maybeTrimPrefix(r.cursor,lbc),nextCursor:O3.maybeTrimPrefix(r.next_cursor,MYo),results:O3.maybeTrimPrefix(r.results,MYo)};let i=t;return{type:"offset",offset:O3.maybeTrimPrefix(i.offset,lbc),results:O3.maybeTrimPrefix(i.results,MYo),step:i.step!=null?O3.maybeTrimPrefix(i.step,lbc):void 0,hasNextPage:i["has-next-page"]!=null?O3.maybeTrimPrefix(i["has-next-page"],MYo):void 0}}};var F1E="$request.",L1E=du.object({"stream-condition":du.string().optional(),format:du.enum(["sse","json"]).optional(),"stream-description":du.string().optional(),"response-stream":du.any(),response:du.any()}),U1E=du.union([du.boolean(),L1E]),qYo=class extends Mg{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=U1E.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:O3.maybeTrimPrefix(r.data["stream-condition"],F1E),responseStream:r.data["response-stream"],response:r.data.response}}};var TYo=class extends Mg{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var CYo=class extends Mg{operation;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:i}){super({breadcrumbs:r,context:t}),this.operation=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).filter(n=>{let a=BN.serialization.ExampleEndpointCallSchema.parse(n);return a.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),a.ok})}};var BYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:i,group:n,method:a,statusCode:u,streamingExtension:l}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseBody=i,this.statusCode=u,this.streamingExtension=l}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,i=[...this.group,this.method,"Response",this.statusCode].join("_"),n=`${i}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:n}),u=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:i});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:u})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let i of r){let n=this.responseBody.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:n,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(n=>n.includes("json"));for(let n of r){let a=this.responseBody.content?.[n];if(a==null)continue;let u=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:n});if(u!=null&&this.shouldReturnJsonResponse(n))return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:u})}let i=Object.keys(this.responseBody.content??{}).filter(n=>!n.includes("json"));for(let n of i){let a=this.responseBody.content?.[n];if(a==null)continue;let u=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:n});if(u!=null){if(this.isBinarySchema(u))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:a}):this.returnFileDownloadResponse({mediaTypeObject:a});if(this.shouldReturnTextResponse(n))return this.returnTextResponse({mediaTypeObject:a})}}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(!(t==null||r==null))return{responseBody:xw.json(j9.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:xw.streaming(w9.json({docs:this.responseBody.description,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:xw.streaming(w9.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:xw.streaming(w9.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:xw.json(j9.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:xw.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:xw.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:xw.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return _M.parse(t)?.isText()??!1}};var IYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;constructor({context:t,breadcrumbs:r,responseError:i,group:n,method:a,methodName:u,statusCode:l}){super({context:t,breadcrumbs:r,group:n,method:a}),this.responseError=i,this.statusCode=l,this.methodName=u}convert(){if(!this.responseError.content){let i=UTa[this.statusCode];if(i==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let n=this.getErrorIdFromErrorName(i);return{error:{error:{name:this.context.casingsGenerator.generateName(n),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:n},docs:this.responseError.description},errorType:Kc.unknown(),displayName:i,statusCode:this.statusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(i=>i.includes("json")),r=UTa[this.statusCode];if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let i of[...t]){let n=this.responseError.content?.[i];if(n==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:n,schemaId:Ub_(`${this.methodName}Request${r}`),contentType:i});if(a==null)continue;let u=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:u,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:u,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:i,convertedSchema:n}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:i,errorId:r},docs:this.responseError.description},errorType:n.type,displayName:t,statusCode:this.statusCode,inlinedTypes:n.inlinedTypes,examples:n.examples}}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?Ub_(`${this.methodName}Request${t}`):t}};function Ub_(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var zYo=class extends wM.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var xYo=class extends wM.AbstractConverters.AbstractMediaTypeObjectConverter{requestBody;schemaId;streamingExtension;constructor({context:t,breadcrumbs:r,requestBody:i,group:n,method:a,streamingExtension:u}){super({context:t,breadcrumbs:r,group:n,method:a}),this.requestBody=i,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u}convert(){if(this.requestBody.content)return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){let t=this.getOrderedJsonOrFormContentTypes();for(let r of t){let i=this.handleStreamConditionJsonOrFormContent({contentType:r});if(i!=null)return i}}convertNonStreamConditionRequestBody(){let t=this.getOrderedJsonOrFormContentTypes();for(let n of t){let a=this.handleJsonOrFormContent({contentType:n});if(a!=null)return a}let r=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isMultipart());for(let n of r){let a=this.handleMultipartContent({contentType:n});if(a!=null)return a}let i=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isOctetStream());for(let n of i){let a=this.handleOctetStreamContent({contentType:n});if(a!=null)return a}}getOrderedJsonOrFormContentTypes(){let t=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isJSON()),r=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isURLEncoded()),i=Object.keys(this.requestBody.content).filter(n=>_M.parse(n)?.isPlainText());return[...t,...r,...i]}handleJsonOrFormContent({contentType:t}){let r=this.requestBody.content[t];if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;return n?.type==="object"?{requestBody:tA.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:n.extendedProperties,extends:n.extends,properties:n.properties,extraProperties:n.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes})}:{requestBody:tA.reference({contentType:t,docs:this.requestBody.description,requestBodyType:i.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.requestBody.content[t];if(r==null||r.schema==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(i==null)return;let n=i.schema?.typeDeclaration.shape;if(n?.type==="object")return{requestBody:tA.fileUpload({contentType:t,docs:this.requestBody.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:n.properties.map(a=>{let u=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:u})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:i.inlinedTypes}),examples:i.examples}}handleOctetStreamContent({contentType:t}){let r=this.requestBody.content[t];if(r==null)return;let i=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:tA.bytes({contentType:t,isOptional:this.requestBody.required===!1,docs:this.requestBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:i?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:i}){let{isFile:n,isOptional:a,isArray:u}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return n?u?w6.file(gne.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):w6.file(gne.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):w6.bodyProperty({...t,contentType:i?.contentType??r,style:W1E({encoding:i}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.requestBody.content[t];if(r==null||r.schema==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(i==null)return;let n=i.properties?.[this.streamingExtension.streamConditionProperty];if(n==null||this.context.isReferenceObject(n))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!0,contentType:t,mediaTypeObject:r}),u=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:n,resolvedMediaTypeSchema:i,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||u==null))return{requestBody:u.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...u.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:i,contentType:n,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let u={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:i,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},l={...a,schema:u},d=this.parseMediaTypeObject({mediaTypeObject:l,schemaId:this.schemaId,contentType:n});if(d==null)return;let s=d.schema?.typeDeclaration.shape;if(s?.type==="object")return{requestBody:tA.inlinedRequestBody({contentType:n,docs:void 0,name:this.context.casingsGenerator.generateName(i?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:s.extendedProperties,extends:s.extends,properties:s.properties,extraProperties:s.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:l,exampleGenerationStrategy:"request"})}),inlinedTypes:d.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:i}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:i}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:i}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:i??!1}}},V1E={"application/json":"json"};function W1E({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return V1E[e.contentType]}}var H1E=/{([^}]+)}/g,$1E=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),o5n=class extends __{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r}),this.operation=i,this.method=n,this.path=a}convertHttpMethod(){switch(this.method){case"get":return YC.Get;case"post":return YC.Post;case"put":return YC.Put;case"delete":return YC.Delete;case"patch":return YC.Patch;case"head":return YC.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],i=[],n=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n};for(let a of this.operation.parameters){let u=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(u==null)continue;let d=new zYo({context:this.context,breadcrumbs:t,parameter:u}).convert();if(d!=null)switch(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type){case"path":r.push(d.parameter);break;case"query":i.push(d.parameter);break;case"header":{let s=d.parameter.name.name.originalName,o=d.parameter.name.wireValue,c=!1,b=this.context.authOverrides?.["auth-schemes"];if(b!=null){for(let O of Object.values(b))if(K1E(O)&&O.header.toLowerCase()===o.toLowerCase()){c=!0;break}}let g=this.context.globalHeaderNames;if(g!=null){for(let O of g)if(O.toLowerCase()===o.toLowerCase()){c=!0;break}}!$1E.has(s.toLowerCase())&&!c&&n.push(d.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:i,headers:n}}checkMissingPathParameters(t){let i=[...this.path.matchAll(H1E)].map(n=>n[1]).filter(n=>!t.some(a=>a.name.originalName===n));for(let n of i){if(n==null)continue;let a=`${n}_example`;t.push({name:this.context.casingsGenerator.generateName(n),valueType:__.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:n})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.requestBody==null)return;let a=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(a==null)return null;let l=new xYo({context:this.context,breadcrumbs:t,requestBody:a,group:r??[],method:i,streamingExtension:n}).convert();if(l!=null)return this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},{requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}}computeGroupNameAndLocationFromExtensions(){let r=new RW.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,n=new RW.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:n,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?d_(this.operation.summary):d_(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let i=Vb_(t),n=Vb_(r);return b2(i,n)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:n})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:i,methodNameTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:d_(u.join("_"))}}generateStringParameterExample({example:t}){let r=new wM.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:i}=r.convert();return i}};function Vb_(e){let t=G1E(e)?Q1E(e):J1E(e);return t=t.map(r=>r.toLowerCase()),t=Jze(t),t}function G1E(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function Q1E(e){return e.split(/(?=[A-Z])/)}function J1E(e){return e.split(/[^a-zA-Z0-9]+/)}function K1E(e){return e?.header!=null}var RYo=class e extends o5n{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a,idempotent:u,idToAuthScheme:l,topLevelServers:d,streamingExtension:s}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a}),this.idempotent=u,this.idToAuthScheme=l,this.topLevelServers=d,this.streamingExtension=s}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=this.getGroupDisplayName(r),{headers:a,pathParameters:u,queryParameters:l}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),d=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:i,streamingExtension:this.streamingExtension}),s=d?.requestBody,o=d?.streamRequestBody,c=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:i,streamingExtension:this.streamingExtension}),b=c?.response,g=c?.streamResponse,O=c!=null?c.errors:[],m={},w=O.map(K=>K.error),E=JN(this.path),q=this.getEndpointBaseUrl(),A=this.getEndpointBaseUrls(),D=this.convertExamples({httpPath:E,httpMethod:t,baseUrl:q}),C=new Set(this.operation.security?.flatMap(K=>Object.keys(K))??[]),x=this.authSchemeToHeaders(Array.from(C));x.length>0&&a.push(...x);for(let K of O){let Y=K.error,Z=K.errorType,oe=Y.error.errorId;m[oe]={name:Y.error,displayName:K.displayName,discriminantValue:{name:Y.error.name,wireValue:oe},type:Z,statusCode:K.statusCode,docs:Y.docs,examples:[],v2Examples:void 0}}let $=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],I={displayName:this.operation.summary,method:t,baseUrl:q,v2BaseUrls:A,path:E,pathParameters:u,queryParameters:l,headers:a.filter((K,Y,Z)=>Y===Z.findIndex(oe=>oe.name.wireValue===K.name.wireValue)),sdkRequest:void 0,errors:w,auth:this.operation.security!=null||this.context.spec.security!=null,availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:E,allPathParameters:u,pagination:void 0,transport:void 0,source:_Q.openapi(),audiences:$},F=this.context.namespace!=null?[this.context.namespace]:[],V=r?.map(K=>d_(K));return F.push(...V??[]),{audiences:$,group:r,groupDisplayName:n,errors:m,endpoint:{...I,id:`endpoint_${F.join("/")}.${i}`,name:this.context.casingsGenerator.generateName(i),requestBody:s,response:b,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:D.examples}},streamEndpoint:g!=null&&g.body!=null?{...I,id:`endpoint_${F.join("/")}.${i}_stream`,name:this.context.casingsGenerator.generateName(`${i}_stream`),requestBody:o,response:g,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:D.streamExamples}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:i,streamingExtension:n}){if(this.operation.responses==null)return;let a,u=!1;for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(!(isNaN(s)||s<200||s>=300&&s<400)){if(a==null&&(a={response:void 0,streamResponse:void 0,errors:[],examples:{}}),s>=200&&s<300&&!u){let o=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:[...t,l]});if(o==null)continue;let b=new BYo({context:this.context,breadcrumbs:[...t,l],responseBody:o,group:r??[],method:i,statusCode:l,streamingExtension:n}).convert();b!=null&&(u=!0,this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},a.response={statusCode:s,body:b.responseBody},a.streamResponse={statusCode:s,body:b.streamResponseBody})}if(s>=400&&s<600){let o=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:[...t,l]});if(o==null)continue;let b=new IYo({context:this.context,breadcrumbs:[...t,l],responseError:o,group:r??[],method:i,methodName:this.evaluateMethodNameFromOperation(),statusCode:s}).convert();b!=null&&(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},a.errors.push(b))}}}return a}authSchemeToHeaders(t){let r=[];for(let i of t){let n=this.idToAuthScheme?.[i];if(n==null)continue;let a={valueType:__.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(n.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:n.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:i}){let a=new CYo({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation}).convert();return a==null?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){let a=n.filter(s=>!(s.response!=null&&"stream"in s.response)),u=n.filter(s=>s.response!=null&&"stream"in s.response),l=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:a}),d=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:u});return{examples:l,streamExamples:d}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:i,fernExamples:n}){return Object.fromEntries(n.map((a,u)=>[this.getExampleName({example:a,exampleIndex:u}),{request:a.request!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(l=>{let d=("language"in l?l.language:l.sdk)??void 0;return{name:l.name,docs:void 0,language:d,code:l.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return Gs.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return Gs.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let t=this.operation.servers?.[0];if(t==null)return;let i=this.topLevelServers?.find(n=>n.url===t.url)??t;return rMe.getServerName({server:i,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(i=>{let a=this.topLevelServers?.find(u=>u.url===i.url)??i;return rMe.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(i=>`${r[i.pathParameter]?.toString()??i.pathParameter}${i.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(i=>i.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let i=t?.[t.length-1];if(i!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===i?r:void 0}};var u5n=class extends o5n{constructor({context:t,breadcrumbs:r,operation:i,method:n,path:a}){super({context:t,breadcrumbs:r,operation:i,method:n,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:i}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),n=[...this.breadcrumbs,"Payload"],{headers:a}=this.convertParameters({breadcrumbs:n}),u=this.convertRequestBody({breadcrumbs:n,group:r,method:i,streamingExtension:void 0});if(u==null)return;let{requestBody:l}=u,d;if(l.type==="inlinedRequestBody")d=fW.inlinedPayload({name:l.name,extends:l.extends,properties:l.properties});else if(l.type==="reference")d=fW.reference({payloadType:l.requestBodyType,docs:l.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${i}`,name:this.context.casingsGenerator.generateName(i),displayName:this.operation.summary,method:t,headers:a,payload:d,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(l.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(l.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,{name:r,payload:i}]))}};var NYo=class extends __{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:i,path:n,idToAuthScheme:a,topLevelServers:u}){super({context:t,breadcrumbs:r}),this.pathItem=i,this.path=n,this.idToAuthScheme=a,this.topLevelServers=u}convert(){let t=[],r=[],i={};for(let n of Lb_){let a=this.pathItem[n];if(a==null)continue;let u=[...this.breadcrumbs,n],l=this.tryParseAsWebhook({operationBreadcrumbs:u,operation:a,method:n,context:this.context});if(l!=null){r.push(l),Object.assign(i,l.inlinedTypes);continue}let s=new qYo({breadcrumbs:u,operation:a,context:this.context}).convert(),o=this.tryParseAsHttpEndpoint({operationBreadcrumbs:u,operation:a,method:n,streamingExtension:s});o!=null&&(t.push(o),Object.assign(i,o.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:i}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n}){return new TYo({breadcrumbs:i,operation:t,context:n}).convert()?new u5n({context:this.context,breadcrumbs:i,operation:t,method:fbc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,streamingExtension:n}){new AYo({breadcrumbs:i,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let d=new EYo({breadcrumbs:i,operation:t,context:this.context}).convert();return new RYo({context:this.context,breadcrumbs:i,operation:t,method:fbc.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:d,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:n}).convert()}};var FYo=class extends __{securityScheme;constructor({context:t,breadcrumbs:r,securityScheme:i}){super({context:t,breadcrumbs:r}),this.securityScheme=i}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return BT.bearer({token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return BT.basic({username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return BT.header({name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:__.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return BT.bearer({token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var iza=class extends zWt{constructor({breadcrumbs:t,context:r,audiences:i}){super({breadcrumbs:t,context:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec});let t=this.convertSecuritySchemes();this.convertGlobalHeaders(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:r,errors:i}=this.convertPaths({idToAuthScheme:t});this.addErrorsToIr(i);let{defaultUrl:n}=this.convertServers({endpointLevelServers:r});return this.updateEndpointsWithDefaultUrl(n),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new DYo({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let i=Fb_({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(i),this.context.setGlobalHeaders(i)}}convertSecuritySchemes(){if(this.context.authOverrides)return this.addAuthToIR(xoc({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator})),{};let t={},r=[];for(let[i,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let a=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",i]});if(a==null)continue;let l=new FYo({context:this.context,breadcrumbs:["components","securitySchemes",i],securityScheme:a}).convert();l!=null&&(this.shouldAddAuthSchemeToIr({authScheme:l,schemeId:i,currentSecuritySchemes:r})?r.push(l):t[i]=l)}return r.length>0&&this.addAuthToIR({requirement:r.length===1?"ALL":"ANY",schemes:r,docs:void 0}),t}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let n=NTa({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return n!=null&&this.addEnvironmentsToIr({environmentConfig:n.environmentsConfig,audiences:n.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let i=new rMe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&(this.addTypeToPackage(t),this.addTypesToIr({...n.inlinedTypes,[t]:n.convertedSchema}))}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,n=new u5n({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:Wb_.OpenAPIV3.HttpMethods.POST,path:r}).convert();n!=null&&(this.addWebhookToIr({webhook:n.webhook,operationId:r,audiences:n.audiences,group:n.group}),this.addTypesToIr(n.inlinedTypes))}}convertPaths({idToAuthScheme:t}){let r=[],i={};for(let[n,a]of Object.entries(this.context.spec.paths??{})){if(a==null)continue;let l=new NYo({context:this.context,breadcrumbs:["paths",n],topLevelServers:this.context.spec.servers,pathItem:a,path:n}).convert();if(l!=null){for(let d of l.endpoints){if(d.streamEndpoint!=null&&this.addEndpointToIr({endpoint:d.streamEndpoint,audiences:d.audiences,endpointGroup:d.group,endpointGroupDisplayName:d.groupDisplayName}),this.addEndpointToIr({endpoint:d.endpoint,audiences:d.audiences,endpointGroup:d.group,endpointGroupDisplayName:d.groupDisplayName}),d.servers)for(let s of d.servers)this.shouldAddServerToCollectedServers({server:s,currentServers:r})&&r.push(s);if(d.errors)for(let[s,o]of Object.entries(d.errors))i[s]=o}for(let d of l.webhooks){let s=this.context.getGroup({groupParts:d.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:d.webhook,operationId:s.join("."),group:s,audiences:d.audiences})}this.addTypesToIr(l.inlinedTypes)}}return{endpointLevelServers:r,errors:i}}shouldAddAuthSchemeToIr({authScheme:t,schemeId:r,currentSecuritySchemes:i}){let n=i.some(u=>u.type===t.type&&u.type==="bearer"&&t.type==="bearer"?u.token===t.token:!1),a=new Set(this.context.spec.security?.flatMap(u=>Object.keys(u))??[]);return(a.size===0||a.has(r))&&!n}};var LYo=class extends Mg{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:i}){super({breadcrumbs:t,context:i}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var nza=class extends O3{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i);let d;if(a.includes("/")){let o=new wM.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:u.value,id:a}).convert();o!=null&&(d={[a]:o.convertedSchema})}return{ok:!0,reference:Kc.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:l}),inlinedTypes:d}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let n=new LYo({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=n}return this.tagToDisplayName[t]??t}};var UYo=class extends wM.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:i}){super({context:t,breadcrumbs:r,parameter:i})}convert(){let t,r={};if(this.parameter.schema!=null){let n=new wM.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();n!=null&&(t=n.type,r=n.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var Y1E=du.object({description:du.string().optional(),required:du.boolean().optional(),deprecated:du.boolean().optional(),allowEmptyValue:du.boolean().optional(),style:du.string().optional(),explode:du.boolean().optional(),allowReserved:du.boolean().optional(),schema:du.any().optional(),example:du.any().optional(),examples:du.record(du.string(),du.any()).optional(),content:du.record(du.string(),du.any()).optional()}),X1E=Y1E.extend({name:du.string(),in:du.string()}),Z1E=du.array(X1E),VYo=class extends Mg{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:i}){super({breadcrumbs:t,context:i}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return Z1E.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var WYo=class extends __{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:i,pathParameters:n=[],queryParameters:a=[],headers:u=[],topLevelServers:l=[]}){super({context:t,breadcrumbs:r}),this.method=i,this.pathParameters=n,this.queryParameters=a,this.headers=u,this.topLevelServers=l}convert(){let t={},r="";for(let s of this.pathParameters)r+=`/{${s.name.originalName}}`;let i=JN(r),n=[];for(let[s,o]of this.method.params.entries()){let c;if(this.context.isReferenceObject(o)){let m=this.context.resolveReference({reference:o});if(m.resolved)c=m.value;else continue}else c=o;let b=[this.method.name,"Param",c.name].join("_"),O=new wM.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",c.name],schemaIdOverride:b,context:this.context,schemaOrReference:c.schema,wrapAsOptional:!c.required}).convert();O!=null&&(n.push({docs:c.description,availability:this.context.getAvailability({node:o,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:c.name,wireValue:c.name}),valueType:O.type,v2Examples:O.schema?.typeDeclaration.v2Examples}),t={...O.inlinedTypes,...t,...O.schema!=null?{[b]:O.schema}:{}})}let a;if(this.method.result!=null){let s=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(s!=null){let o=new wM.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:s.schema}),c=[this.method.name,"Result"].join("_"),b=o.convert();b!=null&&(a={docs:s.description,v2Examples:b.schema?.typeDeclaration.v2Examples,responseBodyType:b.type},t={...b.inlinedTypes,...t,...b.schema!=null?{[c]:b.schema}:{}})}}let u=this.getEndpointBaseUrls(),l=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:u,basePath:void 0,auth:!1,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:i,fullPath:i,requestBody:n.length>0?tA.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:n,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,sdkRequest:void 0,response:a!=null?{body:xw.json(j9.response(a)),statusCode:void 0}:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:_Q.openrpc(),audiences:l},audiences:l,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(i=>i.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(i=>{if(this.topLevelServers.find(l=>l.name===i.name&&l.url!==i.url)!=null)return i.url;let u=this.topLevelServers.find(l=>l.url===i.url)??i;return rMe.getServerName({server:u,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let i of this.method.examples??[]){let n;if(this.context.isReferenceObject(i)){let d=this.context.resolveReference({reference:i});if(d.resolved)n=d.value;else continue}else n=i;let a;if(n.result)if(this.context.isReferenceObject(n.result)){let d=this.context.resolveReference({reference:n.result});d.resolved&&(a=d.value)}else a=n.result;let u=n.name??`Example ${r+1}`,l=[];if(n.params&&Array.isArray(n.params)){l=[];for(let d of n.params)if(this.context.isReferenceObject(d)){let s=this.context.resolveReference({reference:d});if(s.resolved)l.push(s.value);else continue}else l.push(d)}t[u]={request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:l.map(d=>d.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?Gs.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:n.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var aza=class extends zWt{constructor({context:t,breadcrumbs:r,audiences:i}){super({context:t,breadcrumbs:r,audiences:i})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let i=new rMe({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:i?.value}),{defaultUrl:i?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let n=new wM.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();n!=null&&(this.addTypeToPackage(t),this.addTypesToIr({...n.inlinedTypes,[t]:n.convertedSchema}))}}convertMethods(){let t=[],i=new VYo({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),n=[],a=[],u=[];if(i&&i.length>0)for(let[d,s]of i.entries()){let c=new UYo({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${d}]`],parameter:s}).convert();if(c!=null)switch(c.type){case"path":{n.push(c.parameter);break}case"query":{a.push(c.parameter);break}case"header":{u.push(c.parameter);break}}}let l=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let d of this.context.spec.methods??[]){let s=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:["methods"]});if(s==null)continue;let c=new WYo({context:this.context,breadcrumbs:["methods"],method:s,pathParameters:n,queryParameters:a,headers:u,topLevelServers:this.context.spec.servers}).convert();if(c!=null&&(this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:l,serviceName:"service_root"}),this.addTypesToIr(c.inlinedTypes),c.servers))for(let b of c.servers)this.shouldAddServerToCollectedServers({server:b,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(b))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(i=>i.name===t.name&&i.url!==t.url)?{...t,name:t.url}:t}};var oza=class extends O3{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:i,displayNameOverrideSource:n}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let u=this.resolveReference({reference:t,breadcrumbs:r});if(!u.resolved)return{ok:!1};let l;return n==="reference_identifier"?l=i??u.value.title:(n==="discriminator_key"||n==="schema_identifier")&&(l=u.value.title??i),{ok:!0,reference:Kc.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:l,default:void 0,inline:!1})}}};var Hb_={[gy.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,VC(e)])),[gy.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[gy.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[gy.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[gy.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[gy.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[gy.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[gy.GenerationLanguage.SWIFT]:new Set([])};var k1E=["go","ruby"];function GYo({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:eSE({name:c,keywords:tSE({generationLanguage:e,keywords:t})})}),l=d_(n),d=VC(l),s=oUi(n),o=rUi(l);return r&&(!nSE(o)&&(e==null||k1E.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=HYo(c);if(g!=null)return g;if($Yo(c))return c.toUpperCase()}return c}).join(""),d=VC(o.map((c,b)=>{let g=HYo(c);return g??($Yo(c)?c.toUpperCase():b===0?VC(c):c)}).join(""))),s=n.split(" ").map(c=>c.split(/(\d+)/).map(oUi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function eSE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":iSE(e)?"_"+e:e}function tSE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Hb_[e]}var rSE=/^[0-9]/;function iSE(e){return rSE.test(e)}function nSE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=HYo(i)!=null||$Yo(i),a=HYo(t)!=null||$Yo(t);return n&&a})}function HYo(e){return oSE.get(e.toUpperCase())}function $Yo(e){return aSE.has(e.toUpperCase())}var aSE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),oSE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var $b_=require("fs/promises");async function dbc({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,$b_.readFile)(t)).toString(),n;try{n=JSON.parse(i)}catch{n=md.load(i)}return r!=null?await S8n({absoluteFilePathToOverrides:r,context:e,data:n}):n}var GMi=require("fs/promises"),Zb_=ui(QX(),1);var Gb_="buf.gen.yaml",uSE="output",Qb_=`${uSE}/ir.json`,Jb_="protoc-gen-fern",Kb_=`version: v2
1972
1972
  plugins:
1973
1973
  - local: ["bash", "./protoc-gen-fern"]
1974
1974
  out: output
@@ -2041,7 +2041,7 @@ ${a}]`:`[${e.join(u)}]`},wko=(e,t,r)=>`let ${e} = ${HOc(t,r)}`,HOc=(e,t,r)=>{swi
2041
2041
  `)}];if(t["base-properties"]!=null){let A=Object.fromEntries(Object.entries(c).filter(([C])=>t["base-properties"]?.[C]!=null)),D=cKi({typeName:e,typeNameForBreadcrumb:e,rawObject:{properties:t["base-properties"]},file:a,example:A,typeResolver:i,exampleResolver:n,workspace:u,breadcrumbs:l,depth:d+1});if(D.length>0)return D}let g=typeof b=="string"?b:b.type;if(typeof g!="string")return pI_(c);let O=i.resolveType({type:g,file:a});if(O==null)return[];if(O._type==="named"&&xS(O.declaration)){let A=Object.fromEntries(Object.entries(c).filter(([D])=>t["base-properties"]?.[D]==null));return cKi({typeName:e,typeNameForBreadcrumb:e,rawObject:O.declaration,file:O.file,example:A,typeResolver:i,exampleResolver:n,workspace:u,breadcrumbs:l,depth:d+1})}let m=typeof b!="string"&&typeof b.key=="string"?b.key:void 0;if(m==null)return[];let{[m]:w,...E}=c,q=[];return w==null?q.push({message:`Missing property "${m}"`}):q.push(...cL({rawTypeReference:g,example:w,typeResolver:i,exampleResolver:n,file:a,workspace:u,breadcrumbs:l,depth:d+1})),q.push(...pI_(E)),q}function pI_(e){return Object.keys(e).map(t=>({severity:"fatal",message:`Unexpected property "${t}"`}))}function yeu({typeName:e,typeDeclaration:t,file:r,typeResolver:i,exampleResolver:n,example:a,workspace:u,breadcrumbs:l,depth:d}){return a3(t,{alias:s=>oI_({rawAlias:s,file:r,typeResolver:i,exampleResolver:n,example:a,workspace:u,breadcrumbs:l,depth:d}),enum:s=>uI_({rawEnum:s,example:a,breadcrumbs:l}),object:s=>cKi({typeName:e,typeNameForBreadcrumb:e,rawObject:s,example:a,file:r,typeResolver:i,exampleResolver:n,workspace:u,breadcrumbs:l,depth:d}),discriminatedUnion:s=>_I_({typeName:e,rawUnion:s,example:a,file:r,typeResolver:i,exampleResolver:n,workspace:u,breadcrumbs:l,depth:d}),undiscriminatedUnion:s=>sI_({rawUnion:s,example:a,file:r,typeResolver:i,exampleResolver:n,workspace:u,breadcrumbs:l,depth:d})})}var jI_=/^([+-]?\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)?)?)?)?$/,f6E=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,d6E=/^\d{4}-\d{2}-\d{2}$/,p6E=128;function cL({rawTypeReference:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:u,depth:l}){if(l>p6E)return[{message:"Example is too deeply nested. This may indicate a circular reference."}];if(typeof t=="string"&&t.startsWith(ZZt)){let d=r.resolveType({type:e,file:n});if(d==null)return[];let s=i.parseExampleReference(t);if(s==null)return[];let o=r.resolveNamedType({referenceToNamedType:s.rawTypeReference,file:n});return o==null?[]:u9n({expected:d,actual:o})?[]:[{message:`Expected example to be: ${e}. Example is ${t}.`}]}return uWi({type:e,_default:void 0,validation:void 0,visitor:{primitive:d=>_6E({primitiveType:d,example:t}),named:d=>{let s=r.getDeclarationOfNamedType({referenceToNamedType:d,file:n});return s==null?[]:yeu({typeName:s.typeName,typeDeclaration:s.declaration,file:s.file,example:t,typeResolver:r,exampleResolver:i,workspace:a,breadcrumbs:u,depth:l+1})},map:({keyType:d,valueType:s})=>Gj(t)?Object.entries(t).flatMap(([o,c])=>[...cL({rawTypeReference:d,example:o,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:[...u,o],depth:l+1}),...cL({rawTypeReference:s,example:c,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:[...u,o],depth:l+1})]):OFe(t,"a map"),list:d=>Array.isArray(t)?t.flatMap((s,o)=>cL({rawTypeReference:d,example:s,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:[...u,`${o}`],depth:l+1})):OFe(t,"a list"),set:d=>{if(!Array.isArray(t))return OFe(t,"a list");let s=LBs(t);return s.length>0?[{severity:"fatal",message:`Set has duplicate elements:
2042
2042
  `+s.map(o=>` - ${JSON.stringify(o)}`).join(`
2043
2043
  `)}]:t.flatMap((o,c)=>cL({rawTypeReference:d,example:o,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:[...u,`${c}`],depth:l+1}))},optional:d=>t==null?[]:cL({rawTypeReference:d,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:u,depth:l+1}),nullable:d=>t==null?[]:cL({rawTypeReference:d,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a,breadcrumbs:u,depth:l+1}),unknown:()=>[],literal:d=>{switch(d.type){case"boolean":return OMe(s=>s===d.boolean,d.boolean.toString())(t);case"string":return OMe(s=>s===d.string,`"${d.string}"`)(t);default:jo(d)}}}})}function _6E({primitiveType:e,example:t}){return e.v2!=null?Ed._visit(e.v2,{integer:r=>h6E({example:t,rules:r.validation}),long:()=>bI_(t),uint:()=>hI_(t),uint64:()=>yI_(t),double:r=>y6E({example:t,rules:r.validation}),float:()=>vI_(t),boolean:()=>gI_(t),string:r=>v6E({example:t,rules:r.validation}),uuid:()=>OI_(t),date:()=>PI_(t),dateTime:()=>mI_(t),base64:()=>o9n(t),bigInteger:()=>o9n(t),_other:()=>{throw new Error("Unknown primitive type v2: "+e.v2)}}):Uh._visit(e.v1,{integer:()=>wI_(t),long:()=>bI_(t),uint:()=>hI_(t),uint64:()=>yI_(t),double:()=>SI_(t),float:()=>vI_(t),boolean:()=>gI_(t),string:()=>o9n(t),uuid:()=>OI_(t),dateTime:()=>mI_(t),date:()=>PI_(t),base64:()=>o9n(t),bigInteger:()=>o9n(t),_other:()=>{throw new Error("Unknown primitive type: "+e.v1)}})}function h6E({example:e,rules:t}){let r=wI_(e);if(r.length>0||t==null)return r;let i=e;return t.min!=null&&(t.exclusiveMin&&i<=t.min||!t.exclusiveMin&&i<t.min)?[{message:`Expected integer to be greater than or equal to ${t.min}. Example is ${e}.`}]:t.max!=null&&(t.exclusiveMax&&i>=t.max||!t.exclusiveMax&&i>t.max)?[{message:`Expected integer to be less than or equal to ${t.max}. Example is ${e}.`}]:t.multipleOf!=null&&i%t.multipleOf!==0?[{message:`Expected integer to be a multiple of ${t.multipleOf}. Example is ${e}.`}]:[]}function y6E({example:e,rules:t}){let r=SI_(e);if(r.length>0||t==null)return r;let i=e;return t.min!=null&&(t.exclusiveMin&&i<=t.min||!t.exclusiveMin&&i<t.min)?[{message:`Expected double to be greater than or equal to ${t.min}. Example is ${e}.`}]:t.max!=null&&(t.exclusiveMax&&i>=t.max||!t.exclusiveMax&&i>t.max)?[{message:`Expected double to be less than or equal to ${t.max}. Example is ${e}.`}]:t.multipleOf!=null&&i%t.multipleOf!==0?[{message:`Expected double to be a multiple of ${t.multipleOf}. Example is ${e}.`}]:[]}function v6E({example:e,rules:t}){let r=o9n(e);if(r.length>0||t==null)return r;let i=e;return t.minLength!=null&&i.length<t.minLength?[{message:`Expected string length to be greater than or equal to ${t.minLength}. Example is ${e}, which is of length ${i.length}.`}]:t.maxLength!=null&&i.length>t.maxLength?[{message:`Expected string length to be less than or equal to ${t.maxLength}. Example is ${e}, which is of length ${i.length}.`}]:t.pattern!=null&&!new RegExp(t.pattern).test(i)?[{message:`Expected string to match pattern ${t.pattern}. Example is ${e}.`}]:[]}var o9n=OMe(e=>typeof e=="string","a string"),wI_=OMe(e=>Number.isInteger(e),"an integer"),hI_=OMe(e=>Number.isInteger(e)&&typeof e=="number"&&e>=0,"a uint"),yI_=OMe(e=>Number.isInteger(e)&&typeof e=="number"&&e>=0,"a uint64"),vI_=OMe(e=>typeof e=="number","a float"),SI_=OMe(e=>typeof e=="number","a double"),bI_=OMe(e=>Number.isInteger(e),"an integer"),gI_=OMe(e=>typeof e=="boolean","a boolean"),OI_=OMe(e=>typeof e=="string"&&f6E.test(e),"a UUID"),mI_=OMe(e=>typeof e=="string"&&jI_.test(e),"an ISO 8601 timestamp"),PI_=OMe(e=>typeof e=="string"&&d6E.test(e)&&jI_.test(e),"a date");function OMe(e,t){return r=>e(r)?[]:OFe(r,t)}function u9n({expected:e,actual:t}){if(e._type==="unknown")return!0;if(e._type==="primitive")return t._type==="primitive"&&e.primitive.v1===t.primitive.v1;if(e._type==="container")switch(e.container._type){case"list":case"set":return t._type==="container"&&t.container._type===e.container._type&&u9n({expected:e.container.itemType,actual:t.container.itemType});case"optional":return u9n({expected:e.container.itemType,actual:t._type==="container"&&t.container._type==="optional"?t.container.itemType:t});case"nullable":return u9n({expected:e.container.itemType,actual:t._type==="container"&&t.container._type==="nullable"?t.container.itemType:t});case"map":return t._type==="container"&&t.container._type===e.container._type&&u9n({expected:e.container.keyType,actual:t.container.keyType})&&u9n({expected:e.container.valueType,actual:t.container.valueType});case"literal":return t._type!=="container"||t.container._type!==e.container._type?!1:b6E({expected:e.container.literal,actual:t.container.literal});default:jo(e.container)}if(e._type==="named")return t._type==="named"&&t.filepath===e.filepath&&t.rawName===e.rawName;jo(e)}function b6E({expected:e,actual:t}){switch(e.type){case"boolean":return t.type==="boolean"?e.boolean===t.boolean:!1;case"string":return t.type==="string"?e.string===t.string:!1;default:jo(e)}}function veu({_enum:e,file:t}){let r=e.enum.map(n=>({...lJ(n),name:t.casingsGenerator.generateNameAndWireValue({wireValue:typeof n=="string"?n:n.value,name:s9n(n).name,opts:{casingOverrides:typeof n!="string"?n.casing:void 0}})})),i;if(e.default!=null&&(i=r.find(n=>n.name.wireValue===e.default),i==null))throw new Error(`Default value ${e.default} not found in enum values`);return{default:i,values:r}}function DI_(e,t){let r=t.enum.find(i=>typeof i=="string"?!1:i.value===e);return{name:typeof r=="string"?e:r?.name??e,wasExplicitlySet:!1}}function s9n(e){return typeof e=="string"?{name:e,wasExplicitlySet:!1}:e.name==null?{name:e.value,wasExplicitlySet:!1}:{name:e.name,wasExplicitlySet:!0}}function Fjc({typeName:e,typeDeclaration:t,example:r,typeResolver:i,exampleResolver:n,fileContainingType:a,fileContainingExample:u,workspace:l}){return a3(t,{alias:d=>Rw.alias({value:GE({example:r,rawTypeBeingExemplified:typeof d=="string"?d:d.type,fileContainingRawTypeReference:a,fileContainingExample:u,typeResolver:i,exampleResolver:n,workspace:l})}),object:d=>EI_({typeName:e,rawObject:d,example:r,fileContainingType:a,fileContainingExample:u,typeResolver:i,exampleResolver:n,workspace:l}),discriminatedUnion:d=>{let s=lKi(d);if(!Gj(r))throw new Error("Example is not an object");let o=r[s];if(o==null)throw new Error("Example is missing discriminant: "+s);if(typeof o!="string")throw new Error("Discriminant value is not a string");let c=d.union[o];if(c==null)throw new Error(`${o} is not one of the specified discriminant values.`);let b=typeof c=="string"?c:typeof c.type=="string"?c.type:void 0;return Rw.union({discriminant:u.casingsGenerator.generateNameAndWireValue({name:gAi(d).name,wireValue:s}),singleUnionType:O6E({rawValueType:b,rawSingleUnionType:c,fileContainingType:a,fileContainingExample:u,typeResolver:i,exampleResolver:n,example:r,discriminant:s,discriminantValueForExample:o,workspace:l})})},enum:d=>{if(typeof r!="string"){let s=d.enum.map(o=>typeof o=="string"?o:o.value).join(", ");throw new Error(`Expected one of ${s}. Received ${r}`)}return Rw.enum({value:u.casingsGenerator.generateNameAndWireValue({name:DI_(r,d).name,wireValue:r})})},undiscriminatedUnion:d=>{for(let[c,b]of d.union.entries())if(cL({rawTypeReference:typeof b=="string"?b:b.type,example:r,typeResolver:i,exampleResolver:n,file:a,workspace:l,breadcrumbs:[],depth:0}).length===0)return Rw.undiscriminatedUnion({index:c,singleUnionType:GE({example:r,rawTypeBeingExemplified:typeof b=="string"?b:b.type,fileContainingRawTypeReference:a,fileContainingExample:u,typeResolver:i,exampleResolver:n,workspace:l})});let o=d.union.map(c=>typeof c=="string"?c:c.type).join(", ");throw new Error(`Expected one of ${o}. Received ${r}`)}})}function GE({example:e,fileContainingExample:t,rawTypeBeingExemplified:r,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u}){let{resolvedExample:l,file:d}=a.resolveExampleOrThrow({example:e,file:t}),s=a.resolveAllReferencesInExampleOrThrow({example:e,file:t}).resolvedExample;return{shape:uWi({type:r,_default:void 0,validation:void 0,visitor:{primitive:c=>g6E({example:l,typeBeingExemplified:c.v1}),map:({keyType:c,valueType:b})=>{if(!Gj(l))throw new Error("Example is not an object");return Vh.container(mm.map({map:Object.entries(l).map(([g,O])=>({key:GE({example:g,fileContainingExample:d,rawTypeBeingExemplified:c,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u}),value:GE({example:O,fileContainingExample:d,rawTypeBeingExemplified:b,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u})})),keyType:i.parseTypeReference(c),valueType:i.parseTypeReference(b)}))},list:c=>{if(!Array.isArray(l))throw new Error("Example is not a list");return Vh.container(mm.list({list:l.map(b=>GE({example:b,fileContainingExample:d,rawTypeBeingExemplified:c,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u})),itemType:i.parseTypeReference(c)}))},set:c=>{if(!Array.isArray(l))throw new Error("Example is not a list");return Vh.container(mm.set({set:l.map(b=>GE({example:b,fileContainingExample:d,rawTypeBeingExemplified:c,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u})),itemType:i.parseTypeReference(c)}))},optional:c=>Vh.container(mm.optional({optional:l!=null?GE({example:l,fileContainingExample:d,rawTypeBeingExemplified:c,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u}):void 0,valueType:i.parseTypeReference(c)})),nullable:c=>Vh.container(mm.nullable({nullable:l!=null?GE({example:l,fileContainingExample:d,rawTypeBeingExemplified:c,fileContainingRawTypeReference:i,typeResolver:n,exampleResolver:a,workspace:u}):void 0,valueType:i.parseTypeReference(c)})),literal:c=>{switch(c.type){case"boolean":return Vh.container(mm.literal({literal:Fd.boolean(c.boolean)}));case"string":return Vh.container(mm.literal({literal:Fd.string({original:c.string})}));default:jo(c)}},named:c=>{let b=n.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:r,file:i}),g=i.parseTypeReference(c);if(g.type!=="named")throw new Error("Type reference is not to a named type.");let O={typeId:g.typeId,fernFilepath:g.fernFilepath,name:g.name,displayName:g.displayName};return Vh.named({typeName:O,shape:Fjc({typeName:O,typeDeclaration:b.declaration,fileContainingType:b.file,fileContainingExample:d,example:l,typeResolver:n,exampleResolver:a,workspace:u})})},unknown:()=>Vh.unknown(s)}}),jsonExample:s}}function g6E({example:e,typeBeingExemplified:t}){return Uh._visit(t,{string:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.STRING})):Vh.primitive(Fd.string({original:e})),dateTime:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.DATE_TIME})):Vh.primitive(Fd.datetime({datetime:new Date(e),raw:e})),date:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.DATE})):Vh.primitive(Fd.date(e)),base64:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.BASE64})):Vh.primitive(Fd.string({original:e})),uint:()=>typeof e!="number"?Vh.primitive(Fd.uint(ky.UINT)):Vh.primitive(Fd.uint(e)),uint64:()=>typeof e!="number"?Vh.primitive(Fd.uint64(ky.UINT64)):Vh.primitive(Fd.uint64(e)),integer:()=>typeof e!="number"?Vh.primitive(Fd.integer(ky.INT)):Vh.primitive(Fd.integer(e)),float:()=>typeof e!="number"?Vh.primitive(Fd.float(ky.FLOAT)):Vh.primitive(Fd.float(e)),double:()=>typeof e!="number"?Vh.primitive(Fd.double(ky.DOUBLE)):Vh.primitive(Fd.double(e)),long:()=>typeof e!="number"?Vh.primitive(Fd.long(ky.UINT)):Vh.primitive(Fd.long(e)),boolean:()=>typeof e!="boolean"?Vh.primitive(Fd.boolean(ky.BOOLEAN)):Vh.primitive(Fd.boolean(e)),uuid:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.UUID})):Vh.primitive(Fd.uuid(e)),bigInteger:()=>typeof e!="string"?Vh.primitive(Fd.string({original:ky.BIG_INTEGER})):Vh.primitive(Fd.string({original:e})),_other:()=>{throw new Error("Unknown primitive type: "+t)}})}function EI_({typeName:e,rawObject:t,example:r,fileContainingType:i,fileContainingExample:n,typeResolver:a,exampleResolver:u,workspace:l}){if(!Gj(r))throw new Error(`Example is not an object. Got: ${JSON.stringify(r)}`);return Rw.object({properties:t.properties!=null||t.extends!=null?Object.entries(r).reduce((d,[s,o])=>{let c=MI_({typeName:e,wirePropertyKey:s,rawObject:t,typeResolver:a,file:i});if(c==null)return d;let b=GE({example:o,fileContainingExample:n,rawTypeBeingExemplified:typeof c.rawPropertyType=="string"?c.rawPropertyType:c.rawPropertyType.type,fileContainingRawTypeReference:c.file,typeResolver:a,exampleResolver:u,workspace:l});return d.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:s,property:c.rawPropertyType}).name,wireValue:s}),value:b,originalTypeDeclaration:c.typeName}),d},[]):[]})}function MI_({typeName:e,wirePropertyKey:t,rawObject:r,typeResolver:i,file:n}){let a=r.properties?.[t];return a!=null?{typeName:e,rawPropertyType:a,file:n}:Jxa({wirePropertyKey:t,extends_:r.extends,typeResolver:i,file:n})}function Jxa({wirePropertyKey:e,extends_:t,typeResolver:r,file:i}){if(t!=null){let n=typeof t=="string"?[t]:t;for(let a of n){let u=r.resolveNamedTypeOrThrow({referenceToNamedType:a,file:i});if(u._type!=="named"||!xS(u.declaration))throw new Error("Extension is not of a named object");let l=MI_({wirePropertyKey:e,rawObject:u.declaration,typeResolver:r,typeName:u.name,file:u.file});if(l!=null)return l}}}function O6E({rawValueType:e,rawSingleUnionType:t,fileContainingType:r,fileContainingExample:i,typeResolver:n,exampleResolver:a,example:u,discriminant:l,discriminantValueForExample:d,workspace:s}){let o=i.casingsGenerator.generateNameAndWireValue({name:a9n({unionKey:d,rawSingleUnionType:t}).name,wireValue:d});if(e==null)return{wireDiscriminantValue:o,shape:i3.noProperties()};let c=Njc({rawSingleUnionType:t,rawValueType:e,parsedValueType:r.parseTypeReference(e),file:r,typeResolver:n});switch(c.propertiesType){case"singleProperty":{if(!Gj(u))throw new Error("Example is not an object");return{wireDiscriminantValue:o,shape:i3.singleProperty(GE({example:u[c.name.wireValue],rawTypeBeingExemplified:e,typeResolver:n,exampleResolver:a,fileContainingRawTypeReference:r,fileContainingExample:i,workspace:s}))}}case"samePropertiesAsObject":{if(!Gj(u))throw new Error("Example is not an object");let{[l]:b,...g}=u,O=n.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:e,file:r});for(;l1i(O.declaration);)O=n.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:typeof O.declaration=="string"?O.declaration:O.declaration.type,file:r});if(!xS(O.declaration))throw new Error(`${e} is not an object`);let m={typeId:c.typeId,fernFilepath:c.fernFilepath,name:c.name,displayName:c.displayName};return{wireDiscriminantValue:o,shape:i3.samePropertiesAsObject({typeId:jm.generateTypeId(m),object:EI_({rawObject:O.declaration,example:g,fileContainingType:O.file,fileContainingExample:i,typeResolver:n,exampleResolver:a,typeName:m,workspace:s})})}}default:jo(c)}}function beu({file:e,queryParameterKey:t,queryParameter:r}){let{name:i}=dpi({queryParameterKey:t,queryParameter:r}),n=e.parseTypeReference(r);return{...lJ(r),name:e.casingsGenerator.generateNameAndWireValue({wireValue:t,name:i}),valueType:n,allowMultiple:typeof r!="string"&&r["allow-multiple"]!=null?r["allow-multiple"]:!1,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function dpi({queryParameterKey:e,queryParameter:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function AI_({service:e,endpoint:t,example:r,typeResolver:i,errorResolver:n,exampleResolver:a,variableResolver:u,file:l,workspace:d}){let s=P6E({service:e,endpoint:t,example:r,typeResolver:i,exampleResolver:a,variableResolver:u,file:l,workspace:d});return{id:r.name??ITa(r),name:r.name!=null?l.casingsGenerator.generateName(r.name):void 0,docs:r.docs,url:E6E({file:l,service:e,endpoint:t,example:r,pathParams:s}),...s,...j6E({service:e,endpoint:t,example:r,typeResolver:i,exampleResolver:a,file:l,workspace:d}),queryParameters:r["query-parameters"]!=null?Object.entries(r["query-parameters"]).map(([o,c])=>{let b=typeof t.request!="string"?t.request?.["query-parameters"]?.[o]:void 0;if(b==null)throw new Error(`Query parameter ${o} does not exist`);return{name:l.casingsGenerator.generateNameAndWireValue({name:dpi({queryParameterKey:o,queryParameter:b}).name,wireValue:o}),value:GE({example:c,rawTypeBeingExemplified:typeof b=="string"?b:b.type,typeResolver:i,exampleResolver:a,fileContainingRawTypeReference:l,fileContainingExample:l,workspace:d}),shape:m6E({queryParameter:b})}}):[],request:w6E({endpoint:t,example:r,typeResolver:i,exampleResolver:a,file:l,workspace:d}),response:S6E({endpoint:t,example:r,typeResolver:i,errorResolver:n,exampleResolver:a,file:l,workspace:d})}}function m6E({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?A2.exploded():A2.single()}function P6E({service:e,endpoint:t,example:r,typeResolver:i,exampleResolver:n,variableResolver:a,file:u,workspace:l}){let d=[],s=[],o=[],c=({name:b,pathParameterDeclaration:g,examplePathParameter:O})=>{let m=Kxa({parameter:g,variableResolver:a,file:u});return{name:b,value:GE({example:O,rawTypeBeingExemplified:m.rawType,typeResolver:i,exampleResolver:n,fileContainingRawTypeReference:m.file,fileContainingExample:u,workspace:l})}};if(r["path-parameters"]!=null){let b=vHt(t);for(let[g,O]of Object.entries(r["path-parameters"])){let m=u.rootApiFile["path-parameters"]?.[g],w=e["path-parameters"]?.[g],E=b[g];if(m!=null)d.push(c({name:u.casingsGenerator.generateName(g),pathParameterDeclaration:m,examplePathParameter:O}));else if(E!=null)o.push(c({name:u.casingsGenerator.generateName(g),pathParameterDeclaration:E,examplePathParameter:O}));else if(w!=null)s.push(c({name:u.casingsGenerator.generateName(g),pathParameterDeclaration:w,examplePathParameter:O}));else throw new Error(`Path parameter ${g} does not exist`)}}return{rootPathParameters:d,endpointPathParameters:o,servicePathParameters:s}}function j6E({service:e,endpoint:t,example:r,typeResolver:i,exampleResolver:n,file:a,workspace:u}){let l=[],d=[];if(r.headers!=null)for(let[s,o]of Object.entries(r.headers)){let c=typeof t.request!="string"?t.request?.headers?.[s]:void 0,b=e.headers?.[s];c!=null?d.push({name:a.casingsGenerator.generateNameAndWireValue({name:Air({headerKey:s,header:c}).name,wireValue:s}),value:GE({example:o,rawTypeBeingExemplified:typeof c=="string"?c:c.type,typeResolver:i,exampleResolver:n,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:u})}):b!=null&&l.push({name:a.casingsGenerator.generateNameAndWireValue({name:Air({headerKey:s,header:b}).name,wireValue:s}),value:GE({example:o,rawTypeBeingExemplified:typeof b=="string"?b:b.type,typeResolver:i,exampleResolver:n,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:u})})}return{endpointHeaders:d,serviceHeaders:l}}function w6E({endpoint:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){let u=typeof e.request!="string"?e.request?.body:e.request;if(u==null||typeof u=="string"&&f1a(u)!=null)return;if(!KC(u))return yQ.reference(GE({example:t.request,rawTypeBeingExemplified:typeof u!="string"?u.type:u,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}));if(!t.request)return;if(!Gj(t.request))throw new Error(`Example is not an object. Got: ${JSON.stringify(t.request)}`);let l=[];for(let[d,s]of Object.entries(t.request)){let o=u.properties?.[d],c=typeof o=="string"?o:o?.type;if(!(c!=null&&Zxe(c)!=null))if(o!=null)l.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:d,property:o}).name,wireValue:d}),value:GE({example:s,rawTypeBeingExemplified:typeof o!="string"?o.type:o,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}),originalTypeDeclaration:void 0});else{let b=Jxa({extends_:u.extends,wirePropertyKey:d,typeResolver:r,file:n});if(b==null)throw new Error("Could not find original type declaration for property: "+d);l.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:d,property:b.rawPropertyType}).name,wireValue:d}),value:GE({example:s,rawTypeBeingExemplified:typeof b.rawPropertyType=="string"?b.rawPropertyType:b.rawPropertyType.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:b.file,fileContainingExample:n,workspace:a}),originalTypeDeclaration:b.typeName})}}return yQ.inlinedRequestBody({jsonExample:i.resolveAllReferencesInExampleOrThrow({example:t.request,file:n}).resolvedExample,properties:l})}function S6E({endpoint:e,example:t,typeResolver:r,errorResolver:i,exampleResolver:n,file:a,workspace:u}){return t.response==null?IT.ok(XC.body(void 0)):cWi(e,t.response,{body:l=>{if(l.error!=null){let d=i.getDeclarationOrThrow(l.error,a);return IT.error({error:vAi({errorName:l.error,file:a}),body:d.declaration.type!=null?GE({example:l.body,rawTypeBeingExemplified:d.declaration.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:d.file,fileContainingExample:a,workspace:u}):void 0})}return IT.ok(XC.body(D6E({endpoint:e,example:l,typeResolver:r,exampleResolver:n,file:a,workspace:u})))},stream:l=>{let d=typeof e["response-stream"]=="string"?e["response-stream"]:e["response-stream"]?.type;return IT.ok(XC.stream(l.stream.map(s=>{if(d!=null)return GE({example:s,rawTypeBeingExemplified:d,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:u})}).filter(yv)))},events:l=>{let d=typeof e["response-stream"]=="string"?e["response-stream"]:e["response-stream"]?.type;return IT.ok(XC.sse(l.stream.map(({event:s,data:o})=>{if(d==null)return;let c=GE({example:o,rawTypeBeingExemplified:d,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:u});return{event:s,data:c}}).filter(yv)))}})}function D6E({endpoint:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){let u=typeof e.response!="string"?e.response?.type:e.response;if(u!=null&&t.body!=null)return GE({example:t.body,rawTypeBeingExemplified:u,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a})}function E6E({file:e,service:t,endpoint:r,example:i,pathParams:n}){let a=lb(e.rootApiFile["base-path"]??"",t["base-path"],r.path);if(i["path-parameters"]!=null)for(let u of[...n.endpointPathParameters,...n.servicePathParameters,...n.rootPathParameters])a=a.replaceAll(`{${u.name.originalName}}`,encodeURIComponent(`${u.value.jsonExample}`));return a=a.replaceAll("//","/"),a.startsWith("/")||(a=`/${a}`),a}function qI_({endpoint:e,file:t,typeResolver:r}){return{body:M6E({endpoint:e,file:t,typeResolver:r}),statusCode:typeof e.response!="string"?e.response?.["status-code"]:void 0}}function M6E({endpoint:e,file:t,typeResolver:r}){let i=A6E({endpoint:e,file:t,typeResolver:r}),n=q6E({endpoint:e,file:t,typeResolver:r});if(i!=null&&n!=null){let a;switch(i.type){case"fileDownload":{a=cW.fileDownload({...i});break}case"json":{a=cW.json({...i.value});break}case"text":{a=cW.text({...i});break}case"bytes":{a=cW.bytes({...i});break}default:jo(i)}return xw.streamParameter({nonStreamResponse:a,streamResponse:n})}else{if(i!=null)return i;if(n!=null)return xw.streaming(n)}}function A6E({endpoint:e,file:t,typeResolver:r}){let{response:i}=e;if(i!=null){let n=typeof i!="string"?i.docs:void 0,a=typeof i=="string"?i:i.type;if(a!=null)return Zxe(a)!=null?xw.fileDownload({docs:n,v2Examples:void 0}):d1a(a)!=null?xw.text({docs:n,v2Examples:void 0}):dkt(a)!=null?xw.bytes({docs:n,v2Examples:void 0}):T6E(i,n,t,r)}}function q6E({endpoint:e,file:t,typeResolver:r}){let{["response-stream"]:i}=e;if(i!=null){let n=typeof i!="string"?i.docs:void 0,a=typeof i=="string"?i:i.type,u=typeof i=="string"?"json":i.format??"json";return _zn(a)?w9.text({docs:n,v2Examples:void 0}):typeof i!="string"&&u==="sse"?w9.sse({docs:n,payload:t.parseTypeReference(a),terminator:typeof i!="string"?i.terminator:void 0,v2Examples:void 0}):w9.json({docs:n,payload:t.parseTypeReference(a),terminator:typeof i!="string"?i.terminator:void 0,v2Examples:void 0})}}function T6E(e,t,r,i){let n=typeof e!="string"?e.type:e;if(n==null)return;let a=r.parseTypeReference(typeof e=="string"?e:{...e,type:n}),u=i.resolveTypeOrThrow({type:n,file:r}),l=typeof e!="string"?e.property:void 0;return l!=null?xw.json(j9.nestedPropertyAsResponse({docs:t,responseBodyType:a,responseProperty:Hxa({typeResolver:i,file:r,resolvedType:u,property:l}),v2Examples:void 0})):xw.json(j9.response({docs:t,responseBodyType:a,v2Examples:void 0}))}function TI_({propertyResolver:e,file:t,endpointName:r,endpointSchema:i,paginationPropertyComponents:n}){return hQ.cursor({page:e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:n.cursor}),next:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.next_cursor}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.results})})}function CI_({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:i}){return hQ.custom({results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i.results})})}function BI_({propertyResolver:e,file:t,endpointName:r,endpointSchema:i,paginationPropertyComponents:n}){return hQ.offset({page:e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:n.offset}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.results}),step:n.step!=null?e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:n.step}):void 0,hasNextPage:n.hasNextPage!=null?e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.hasNextPage}):void 0})}function II_(e){if(B6E(e))return{type:"offset",offset:yHt(e.offset),results:Mir(e.results),step:e.step!=null?yHt(e.step):void 0,hasNextPage:e["has-next-page"]!=null?Mir(e["has-next-page"]):void 0};if(C6E(e))return{type:"cursor",cursor:yHt(e.cursor),next_cursor:Mir(e.next_cursor),results:Mir(e.results)};if(I6E(e))return{type:"custom",results:Mir(e.results)};throw new Error("Invalid pagination schema")}function C6E(e){return e.cursor!=null}function B6E(e){return e.offset!=null&&e.results!=null}function I6E(e){return"type"in e&&e.type==="custom"}function zI_({propertyResolver:e,file:t,endpointName:r,endpointSchema:i}){let n=typeof i.pagination=="boolean"?t.rootApiFile.pagination:i.pagination;if(!n)return;let a=II_(n);switch(a.type){case"cursor":return TI_({propertyResolver:e,file:t,endpointName:r,endpointSchema:i,paginationPropertyComponents:a});case"offset":return BI_({propertyResolver:e,file:t,endpointName:r,endpointSchema:i,paginationPropertyComponents:a});case"custom":return CI_({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:a});default:jo(a)}}function xI_({errors:e,file:t}){return e==null?[]:Object.values(e).map(r=>{let i=typeof r=="string"?r:r.error,n=vAi({errorName:i,file:t});return{docs:typeof r!="string"?r.docs:void 0,error:n}})}function geu({source:e}){return{filepath:e.relativeFilePath,packageName:e.packageName,options:e.csharpNamespace!=null?{csharp:{namespace:e.csharpNamespace}}:void 0}}function RI_({source:e,serviceNameOverride:t}){let r=t??e.serviceName;if(r!=null)return{file:geu({source:e}),name:bAi.generateName(r)}}function NI_({file:e,serviceDeclaration:t,sourceResolver:r}){return tkt(t.source)?LI_(e,t.source,r,t.transport?.grpc?.["service-name"]):$xe.http()}function FI_({file:e,serviceTransport:t,endpointDeclaration:r,sourceResolver:i}){let n=t.type==="grpc",a=t.type==="http",u=tkt(r.source),l=!u;if(n){if(a&&u)throw new Error("Cannot have a grpc endpoint on an http service");if(n&&l)return $xe.http();if(n&&u){let d=r.source,s=r.transport?.grpc?.["service-name"];return s?LI_(e,d,i,s):void 0}throw new Error(`Internal error; failed to determine endpoint transport for
2044
- ${JSON.stringify(r)}"`)}}function LI_(e,t,r,i){let n=r.resolveSourceOrThrow({source:t,relativeFilepath:e.relativeFilepath});if(n==null||n.type!=="protobuf")throw new Error(`Expected a protobuf source for ${t.proto}.`);let a=RI_({source:n,serviceNameOverride:i});if(a==null)throw new Error(`Failed to resolve service name from ${n.relativeFilePath}.`);return $xe.grpc({service:a})}function UI_({rootDefaultUrl:e,rootPathParameters:t,serviceDefinition:r,file:i,errorResolver:n,typeResolver:a,propertyResolver:u,exampleResolver:l,variableResolver:d,sourceResolver:s,globalErrors:o,workspace:c}){let b=c9n({pathParameters:r["path-parameters"],location:Gxe.Service,file:i,variableResolver:d}),g=NI_({file:i,serviceDeclaration:r,sourceResolver:s}),O={fernFilepath:i.fernFilepath};return{availability:Gae(r.availability),name:O,displayName:r["display-name"]??void 0,basePath:JN(r["base-path"]),headers:r.headers!=null?Object.entries(r.headers).map(([w,E])=>mFe({headerKey:w,header:E,file:i})):[],pathParameters:b,encoding:N6E(g,r),transport:g,endpoints:Object.entries(r.endpoints).map(([w,E])=>{let q=c9n({pathParameters:vHt(E),location:Gxe.Endpoint,file:i,variableResolver:d}),A={...lJ(E),id:"",name:i.casingsGenerator.generateName(w),displayName:E["display-name"],auth:E.auth??r.auth,idempotent:E.idempotent??r.idempotent??!1,baseUrl:E.url??r.url??e,v2BaseUrls:void 0,method:E.method!=null?R6E(E.method):YC.Post,basePath:E["base-path"]!=null?JN(E["base-path"]):void 0,path:JN(E.path),fullPath:JN(E["base-path"]!=null?lb(E["base-path"],E.path):i.rootApiFile["base-path"]!=null?lb(i.rootApiFile["base-path"],r["base-path"],E.path):lb(r["base-path"],E.path)),pathParameters:q,allPathParameters:E["base-path"]!=null?q:[...t,...b,...q],queryParameters:typeof E.request!="string"&&E.request?.["query-parameters"]!=null?Object.entries(E.request["query-parameters"]).map(([D,C])=>beu({file:i,queryParameterKey:D,queryParameter:C})):[],headers:typeof E.request!="string"&&E.request?.headers!=null?Object.entries(E.request.headers).map(([D,C])=>mFe({headerKey:D,header:C,file:i})):[],requestBody:kB_({request:E.request,file:i}),sdkRequest:nI_({service:r,request:E.request,endpoint:E,endpointKey:w,file:i,typeResolver:a,propertyResolver:u}),response:qI_({endpoint:E,file:i,typeResolver:a}),errors:[...xI_({errors:E.errors,file:i}),...o],userSpecifiedExamples:E.examples!=null?E.examples.map(D=>({example:AI_({service:r,endpoint:E,example:D,typeResolver:a,errorResolver:n,exampleResolver:l,variableResolver:d,file:i,workspace:c}),codeSamples:D["code-samples"]?.map(C=>aI_({codeSample:C,file:i}))})):[],autogeneratedExamples:[],pagination:zI_({propertyResolver:u,file:i,endpointName:w,endpointSchema:E}),transport:FI_({file:i,serviceTransport:g,endpointDeclaration:E,sourceResolver:s}),v2Examples:void 0,source:void 0,audiences:E.audiences};return A.id=jm.generateEndpointId(O,A),A}),audiences:r.audiences}}function c9n({pathParameters:e,location:t,file:r,variableResolver:i}){return e==null?[]:Object.entries(e).map(([n,a])=>z6E({parameterName:n,parameter:a,location:t,file:r,variableResolver:i}))}function z6E({parameterName:e,parameter:t,location:r,file:i,variableResolver:n}){return{...lJ(t),name:i.casingsGenerator.generateName(e),valueType:x6E({parameter:t,variableResolver:n,file:i}),location:r,variable:dxn(t)?n.getVariableIdOrThrow(typeof t=="string"?t:t.variable):void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function x6E({parameter:e,variableResolver:t,file:r}){let i=Kxa({parameter:e,variableResolver:t,file:r});return i.file.parseTypeReference(i.rawType)}function Kxa({parameter:e,variableResolver:t,file:r}){let i=Oeu({parameter:e,variableResolver:t,file:r});if(i==null)throw new Error("Cannot resolve path parameter");return i}function Oeu({parameter:e,variableResolver:t,file:r}){if(dxn(e)){let i=typeof e=="string"?e:e.variable,n=t.getDeclaration(i,r);return n==null?void 0:{rawType:typeof n.declaration=="string"?n.declaration:n.declaration.type,file:n.file}}else return{file:r,rawType:typeof e=="string"?e:e.type}}function R6E(e){switch(e){case"GET":return YC.Get;case"POST":return YC.Post;case"PUT":return YC.Put;case"PATCH":return YC.Patch;case"DELETE":return YC.Delete;case"HEAD":return YC.Head;default:jo(e)}}function mFe({headerKey:e,header:t,file:r}){let{name:i}=Air({headerKey:e,header:t});return{...lJ(t),name:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:i}),valueType:r.parseTypeReference(t),env:typeof t=="string"?void 0:t.env,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function Air({headerKey:e,header:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function N6E(e,t){switch(e.type){case"http":return{json:{},proto:void 0};case"grpc":return{json:void 0,proto:{}};default:jo(e)}}var VI_="1.0.0";var meu=class{ir;casingsGenerator;auth;authValues;generatorConfig;constructor(t){this.ir=t.ir,this.generatorConfig=t.generatorConfig,this.casingsGenerator=BZ({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??!1,keywords:void 0}),this.auth=this.convertAuth(this.ir.auth),this.authValues=this.getAuthValues(this.ir.auth)}convert({disableExamples:t}){return{version:VI_,types:this.convertNamedTypes(),headers:this.convertHeaders(),endpoints:this.convertEndpoints({disableExamples:t}),pathParameters:this.convertPathParameters({pathParameters:this.ir.pathParameters}),environments:this.ir.environments,generatorConfig:this.generatorConfig}}convertNamedTypes(){return Object.fromEntries(Object.entries(this.ir.types).map(([t,r])=>[t,this.convertTypeDeclaration(r)]))}convertHeaders(){return this.convertWireValueParameters({wireValueParameters:this.ir.headers})}convertEndpoints({disableExamples:t}){let r=this.getAllHttpEndpoints();return Object.fromEntries(r.map(i=>[i.id,this.convertEndpoint({endpoint:i,disableExamples:t})]))}convertEndpoint({endpoint:t,disableExamples:r}){let i=this.convertEndpointLocation({endpoint:t});return{auth:this.auth,declaration:this.convertDeclaration({name:t.name,fernFilepath:t.fernFilepath}),location:i,request:this.convertRequest({endpoint:t}),response:bs.Response.json(),examples:r?void 0:this.getEndpointSnippetRequests({endpoint:t,location:i})}}convertRequest({endpoint:t}){let r=this.convertPathParameters({pathParameters:[...t.servicePathParameters,...t.pathParameters]});if(t.sdkRequest==null&&t.requestBody==null)return bs.Request.body({pathParameters:r,body:void 0});if(t.sdkRequest==null)throw new Error(`Internal error; endpoint "${t.id}" has a request body but no SDK request`);switch(t.sdkRequest.shape.type){case"justRequestBody":return bs.Request.body({pathParameters:r,body:this.convertReferencedRequestBodyType({body:t.sdkRequest.shape.value})});case"wrapper":return this.convertInlinedRequest({fernFilepath:t.fernFilepath,wrapper:t.sdkRequest.shape,pathParameters:r,queryParameters:this.convertQueryParameters({queryParameters:t.queryParameters}),headers:this.convertWireValueParameters({wireValueParameters:[...t.serviceHeaders,...t.headers]}),body:t.requestBody});default:jo(t.sdkRequest.shape)}}convertReferencedRequestBodyType({body:t}){switch(t.type){case"bytes":return bs.ReferencedRequestBodyType.bytes();case"typeReference":return bs.ReferencedRequestBodyType.typeReference(this.convertTypeReference(t.requestBodyType));default:jo(t)}}convertInlinedRequest({fernFilepath:t,wrapper:r,pathParameters:i,queryParameters:n,headers:a,body:u}){return bs.Request.inlined({declaration:this.convertDeclaration({name:r.wrapperName,fernFilepath:t}),pathParameters:i,queryParameters:n,headers:a,body:u!=null?this.convertInlinedRequestBody({wrapper:r,body:u}):void 0,metadata:this.convertInlinedRequestMetadata({wrapper:r})})}convertInlinedRequestMetadata({wrapper:t}){return{includePathParameters:t.includePathParameters??!1,onlyPathParameters:t.onlyPathParameters??!1}}convertInlinedRequestBody({wrapper:t,body:r}){switch(r.type){case"inlinedRequestBody":{let i=[...r.extendedProperties??[],...r.properties];return bs.InlinedRequestBody.properties(this.convertWireValueParameters({wireValueParameters:i}))}case"reference":return bs.InlinedRequestBody.referenced({bodyKey:t.bodyKey,bodyType:bs.ReferencedRequestBodyType.typeReference(this.convertTypeReference(r.requestBodyType))});case"bytes":return bs.InlinedRequestBody.referenced({bodyKey:t.bodyKey,bodyType:bs.ReferencedRequestBodyType.bytes()});case"fileUpload":return this.convertFileUploadRequestBody({properties:r.properties});default:jo(r)}}convertFileUploadRequestBody({properties:t}){return bs.InlinedRequestBody.fileUpload({properties:this.convertFileUploadRequestBodyProperties({properties:t})})}convertFileUploadRequestBodyProperties({properties:t}){return t.map(r=>{switch(r.type){case"file":return this.convertFileUploadRequestBodyFileProperty({fileProperty:r.value});case"bodyProperty":return bs.FileUploadRequestBodyProperty.bodyProperty({name:r.name,typeReference:this.convertTypeReference(r.valueType)});default:jo(r)}})}convertFileUploadRequestBodyFileProperty({fileProperty:t}){switch(t.type){case"file":return bs.FileUploadRequestBodyProperty.file(t.key);case"fileArray":return bs.FileUploadRequestBodyProperty.fileArray(t.key);default:jo(t)}}convertPathParameters({pathParameters:t}){return t.map(r=>({name:{name:r.name,wireValue:r.name.originalName},typeReference:this.convertTypeReference(r.valueType)}))}convertWireValueParameters({wireValueParameters:t}){return t.map(r=>({name:{name:r.name.name,wireValue:r.name.wireValue},typeReference:this.convertTypeReference(r.valueType)}))}convertQueryParameters({queryParameters:t}){let r=[];for(let i of t){let n=this.convertTypeReference(i.valueType);i.allowMultiple&&(n=bs.TypeReference.list(n)),r.push({name:{name:i.name.name,wireValue:i.name.wireValue},typeReference:n})}return r}convertTypeReference(t){switch(t.type){case"container":return this.convertContainerType(t.container);case"named":return this.convertNamedType(t);case"primitive":return this.convertPrimitiveType(t.primitive);case"unknown":return this.convertUnknownType();default:jo(t)}}convertContainerType(t){switch(t.type){case"list":return bs.TypeReference.list(this.convertTypeReference(t.list));case"map":return bs.TypeReference.map({key:this.convertTypeReference(t.keyType),value:this.convertTypeReference(t.valueType)});case"optional":return bs.TypeReference.optional(this.convertTypeReference(t.optional));case"nullable":return bs.TypeReference.nullable(this.convertTypeReference(t.nullable));case"set":return bs.TypeReference.set(this.convertTypeReference(t.set));case"literal":return bs.TypeReference.literal(this.convertLiteral(t.literal));default:jo(t)}}convertNamedType(t){return bs.TypeReference.named(t.typeId)}convertTypeDeclaration(t){let r=this.convertDeclaration(t.name);switch(t.shape.type){case"alias":return this.convertAlias({declaration:r,alias:t.shape});case"enum":return this.convertEnum({declaration:r,enum_:t.shape});case"object":return this.convertObject({declaration:r,object:t.shape});case"union":return this.convertDiscriminatedUnion({declaration:r,union:t.shape});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({declaration:r,union:t.shape});default:jo(t.shape)}}convertAlias({declaration:t,alias:r}){return bs.NamedType.alias({declaration:t,typeReference:this.convertTypeReference(r.aliasOf)})}convertEnum({declaration:t,enum_:r}){return bs.NamedType.enum({declaration:t,values:r.values.map(i=>i.name)})}convertObject({declaration:t,object:r}){let i=[...r.extendedProperties??[],...r.properties];return this.convertObjectProperties({declaration:t,properties:i,additionalProperties:r.extraProperties})}convertObjectProperties({declaration:t,properties:r,additionalProperties:i}){return bs.NamedType.object({declaration:t,properties:this.convertWireValueParameters({wireValueParameters:r}),additionalProperties:i})}convertDiscriminatedUnion({declaration:t,union:r}){let i=[...this.resolveProperties(r.extends),...r.baseProperties];return bs.NamedType.discriminatedUnion({declaration:t,discriminant:r.discriminant,types:Object.fromEntries(r.types.map(n=>[n.discriminantValue.wireValue,this.convertDiscriminatedUnionType({inheritedProperties:i,discriminantValue:n.discriminantValue,singleUnionTypeProperties:n.shape})]))})}convertDiscriminatedUnionType({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperties:i}){switch(i.propertiesType){case"samePropertiesAsObject":return this.convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:i});case"singleProperty":return this.convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:i});case"noProperties":return this.convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r});default:jo(i)}}convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:i}){return bs.SingleDiscriminatedUnionType.samePropertiesAsObject({typeId:i.typeId,discriminantValue:r,properties:this.convertWireValueParameters({wireValueParameters:t})})}convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:i}){return bs.SingleDiscriminatedUnionType.singleProperty({typeReference:this.convertTypeReference(i.type),discriminantValue:r,properties:t.length>0?this.convertWireValueParameters({wireValueParameters:t}):void 0})}convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r}){return bs.SingleDiscriminatedUnionType.noProperties({discriminantValue:r,properties:t.length>0?this.convertWireValueParameters({wireValueParameters:t}):void 0})}convertUndiscriminatedUnion({declaration:t,union:r}){return bs.NamedType.undiscriminatedUnion({declaration:t,types:r.members.map(i=>this.convertTypeReference(i.type))})}convertLiteral(t){switch(t.type){case"boolean":return bs.LiteralType.boolean(t.boolean);case"string":return bs.LiteralType.string(t.string);default:jo(t)}}convertPrimitiveType(t){return bs.TypeReference.primitive(t.v1)}convertUnknownType(){return bs.TypeReference.unknown()}convertAuth(t){if(t.schemes[0]==null)return;let r=t.schemes[0];switch(r.type){case"basic":return bs.Auth.basic(r);case"bearer":return bs.Auth.bearer(r);case"header":return bs.Auth.header({header:{name:r.name,typeReference:this.convertTypeReference(r.valueType)}});case"oauth":return bs.Auth.oauth({clientId:this.casingsGenerator.generateName("clientId"),clientSecret:this.casingsGenerator.generateName("clientSecret")});default:jo(r)}}getAuthValues(t){let r=t.schemes[0];if(r!=null)switch(r.type){case"bearer":return bs.AuthValues.bearer({token:"<token>"});case"basic":return bs.AuthValues.basic({username:"<username>",password:"<password>"});case"header":return bs.AuthValues.header({value:"<value>"});case"oauth":return bs.AuthValues.oauth({clientId:"<clientId>",clientSecret:"<clientSecret>"});default:jo(r)}}convertDeclaration({name:t,fernFilepath:r}){return{name:t,fernFilepath:r}}convertEndpointLocation({endpoint:t}){return{method:t.method,path:this.getFullPathForEndpoint(t)}}getAllHttpEndpoints(){return Object.values(this.ir.services).flatMap(t=>t.endpoints.map(r=>({...r,servicePathParameters:t.pathParameters,serviceHeaders:t.headers,fernFilepath:t.name.fernFilepath})))}resolveProperties(t){let r=[];for(let i of t){let n=this.resolveObjectTypeOrThrow(i.typeId);r.push(...this.resolveProperties(n.extends)),r.push(...n.properties)}return Object.values(r)}resolveObjectTypeOrThrow(t){let r=this.ir.types[t];if(r==null)throw new Error(`Internal error; type "${t}" not found`);if(r.shape.type!=="object")throw new Error(`Internal error; type "${t}" is not an object`);return r.shape}getFullPathForEndpoint(t){let r="";t.fullPath.head.length>0&&(r=lb(r,t.fullPath.head));for(let i of t.fullPath.parts)r=lb(r,"{"+i.pathParameter+"}"),i.tail.length>0&&(r=lb(r,i.tail));return r.startsWith("/")?r:`/${r}`}getEndpointSnippetRequests({endpoint:t,location:r}){let i=[];for(let n of[...t.userSpecifiedExamples,...t.autogeneratedExamples])i.push({id:n?.example?.id??lae(),name:n?.example?.name?.originalName,endpoint:r,baseUrl:void 0,environment:void 0,auth:this.authValues,headers:Object.fromEntries([...n.example?.serviceHeaders??[],...n.example?.endpointHeaders??[]].map(a=>[a.name.wireValue,a.value.jsonExample])),pathParameters:Object.fromEntries([...n.example?.rootPathParameters??[],...n.example?.servicePathParameters??[],...n.example?.endpointPathParameters??[]].map(a=>[a.name.originalName,a.value.jsonExample])),queryParameters:Object.fromEntries([...n.example?.queryParameters??[]].map(a=>[a.name.wireValue,a.value.jsonExample])),requestBody:n.example?.request?.jsonExample});return i}};function WI_({ir:e,generationLanguage:t,smartCasing:r,disableExamples:i,generatorConfig:n}){return new meu({ir:e,generationLanguage:t,smartCasing:r,generatorConfig:n}).convert({disableExamples:i})}var fJ={};mo(fJ,{validateObjectExample:()=>cKi,validateTypeExample:()=>yeu,validateTypeReferenceExample:()=>cL});var Peu=class{subpackages={};rootPackage={docs:void 0,fernFilepath:{allParts:[],packagePath:[],file:void 0},websocket:void 0,service:void 0,types:[],errors:[],subpackages:[],webhooks:void 0,navigationConfig:void 0};addPackageRedirection({from:t,to:r}){let i=this.getPackageForFernFilepath(t);if(i.navigationConfig!=null)throw new Error("Found duplicate navigationConfig for package");i.navigationConfig={pointsTo:jm.generateSubpackageId(r)}}addDocs(t,r){let i=this.getPackageForFernFilepath(t);if(i.docs!=null)throw new Error("Found duplicate docs for package");i.docs=r}addSubpackage(t){this.getPackageForFernFilepath(t)}addType(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).types.push(t)}addError(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).errors.push(t)}addService(t,r){let i=this.getPackageForFernFilepath(r.name.fernFilepath);if(i.service!=null)throw new Error("Found duplicate service for "+t);i.service=t}addWebhookGroup(t,r){let i=this.getPackageForFernFilepath(r);if(i.webhooks!=null)throw new Error("Found duplicate webhook group for "+t);i.webhooks=t}addWebSocketChannel(t,r){let i=this.getPackageForFernFilepath(r);if(i.webhooks!=null)throw new Error("Found duplicate webhook group for "+t);i.websocket=t}build(t){t!=null&&(Object.entries(this.subpackages).forEach(([i,n])=>{t.hasSubpackageId(i)?this.subpackages[i]={...n,types:n.types.filter(a=>t.hasTypeId(a)),errors:n.errors.filter(a=>t.hasErrorId(a)),service:n.service!=null&&t.hasServiceId(n.service)?n.service:void 0,websocket:n.websocket!=null&&t.hasChannel(n.websocket)?n.websocket:void 0,subpackages:n.subpackages.filter(a=>t.hasSubpackageId(a))}:delete this.subpackages[i]}),this.rootPackage={...this.rootPackage,types:this.rootPackage.types.filter(i=>t.hasTypeId(i)),errors:this.rootPackage.errors.filter(i=>t.hasErrorId(i)),service:this.rootPackage.service!=null&&t.hasServiceId(this.rootPackage.service)?this.rootPackage.service:void 0,subpackages:this.rootPackage.subpackages.filter(i=>t.hasSubpackageId(i)),webhooks:this.rootPackage.webhooks!=null?this.rootPackage.webhooks:void 0});let r=new Set(this.getAllChildrenWithEndpoints(this.rootPackage));return{subpackages:fd(this.subpackages,(i,n)=>({...i,hasEndpointsInTree:r.has(n)})),rootPackage:{...this.rootPackage,hasEndpointsInTree:r.size>0||this.rootPackage.service!=null}}}sortRootPackage(t){if(!HI_(this.rootPackage.subpackages,t))throw new Error("Sorted subpackages differ from unsorted packages in root");this.rootPackage.subpackages=t}sortSubpackage(t,r){let i=this.subpackages[t];if(i==null)throw new Error("Subpackage does not exist: "+t);if(!HI_(i.subpackages,r))throw new Error("Sorted subpackages differ from unsorted packages");i.subpackages=r}getAllSubpackagesWithEndpoints(t){let r=this.subpackages[t];if(r==null)throw new Error("Subpackage does not exist: "+t);let i=this.getAllChildrenWithEndpoints(r);return(i.length>0||r.service!=null)&&i.push(t),i}getAllChildrenWithEndpoints(t){return t.subpackages.flatMap(r=>[...this.getAllSubpackagesWithEndpoints(r)])}getPackageForFernFilepath(t,r=0,i=this.rootPackage){let n=t.allParts[r];if(n==null)return i;let a=i.subpackages.map(s=>{let o=this.subpackages[s];if(o==null)throw new Error("Subpackage ID is invalid: "+s);return o}),u=r+1,l={allParts:t.allParts.slice(0,u),packagePath:t.packagePath.slice(0,u),file:u===t.allParts.length?t.file:void 0},d=a.find(s=>s.name.originalName===n.originalName);if(d==null){let s=jm.generateSubpackageId(l),o={docs:void 0,fernFilepath:l,name:n,service:void 0,types:[],errors:[],subpackages:[],navigationConfig:void 0,webhooks:void 0,websocket:void 0};this.subpackages[s]=o,i.subpackages.push(s),d=o}return this.getPackageForFernFilepath(t,u,d)}};function HI_(e,t){if(e.length!==t.length)return!1;let r=new Set(e);for(let i of t)if(!r.has(i))return!1;return!0}function $I_(e){return{errorInstanceIdKey:e.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}}var jeu=e=>{let t=tMe(e.file.fernFilepath),r=e.endpointId;return`endpoint_${t}.${r}`};function weu({fernFilePath:e}){return e.packagePath.length===0&&e.file==null}function GI_({endpointResolver:e,propertyResolver:t,file:r,refreshTokenEndpoint:i}){let n=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:r}),a;try{a=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:jeu(n),serviceId:jm.generateServiceIdFromFernFilepath(n.file.fernFilepath),subpackageId:weu({fernFilePath:n.file.fernFilepath})?void 0:jm.generateSubpackageId(n.file.fernFilepath)},requestProperties:{refreshToken:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.refresh_token})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:a,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}function QI_({endpointResolver:e,propertyResolver:t,file:r,tokenEndpoint:i}){let n=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:r}),a=typeof n.endpoint.request=="object"&&n.endpoint.request.body!=null&&typeof n.endpoint.request.body=="object"&&"properties"in n.endpoint.request.body?n.endpoint.request.body.properties??{}:{},u;try{u=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:jeu(n),serviceId:jm.generateServiceIdFromFernFilepath(n.file.fernFilepath),subpackageId:weu({fernFilePath:n.file.fernFilepath})?void 0:jm.generateSubpackageId(n.file.fernFilepath)},requestProperties:{clientId:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_id}),clientSecret:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_secret}),scopes:i.requestProperties.scopes!=null?t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.scopes}):void 0,customProperties:F6E({requestBodyProperties:a,tokenEndpoint:i,file:r,propertyResolver:t})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:u,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}var F6E=({requestBodyProperties:e,tokenEndpoint:t,file:r,propertyResolver:i})=>{let n=Object.keys(e).filter(a=>!t.requestProperties.client_id.includes(a)&&!t.requestProperties.client_secret.includes(a)&&(t.requestProperties.scopes==null||!t.requestProperties.scopes.includes(a)));return n.length>0?n.map(a=>i.resolveRequestPropertyOrThrow({file:r,endpoint:t.endpoint,propertyComponents:[a]})):void 0};function JI_({propertyResolver:e,endpointResolver:t,file:r,oauthScheme:i,tokenEndpoint:n,refreshTokenEndpoint:a}){let u=QI_({propertyResolver:e,endpointResolver:t,file:r,tokenEndpoint:n});if(u==null)throw new Error("Failed to convert OAuth token endpoint.");let l=a!=null?GI_({propertyResolver:e,endpointResolver:t,file:r,refreshTokenEndpoint:a}):void 0;return{clientIdEnvVar:i["client-id-env"],clientSecretEnvVar:i["client-secret-env"],tokenPrefix:i["token-prefix"],tokenHeader:i["token-header"],scopes:i.scopes,tokenEndpoint:u,refreshEndpoint:l}}var Yxa={requestProperties:{type:"access_token",client_id:["client_id"],client_secret:["client_secret"],scopes:void 0},responseProperties:{type:"access_token",access_token:["access_token"],expires_in:["expires_in"],refresh_token:void 0}},Ljc={requestProperties:{type:"refresh_token",refresh_token:["refresh_token"]},responseProperties:{type:"access_token",access_token:["access_token"],refresh_token:void 0,expires_in:["expires_in"]}};function KI_(e){return{endpoint:e["get-token"].endpoint,requestProperties:L6E({requestProperties:e["get-token"]?.["request-properties"]}),responseProperties:U6E({responseProperties:e["get-token"]?.["response-properties"]})}}function YI_(e){if(e["refresh-token"]!=null)return{endpoint:e["refresh-token"].endpoint,requestProperties:V6E({requestProperties:e["refresh-token"]?.["request-properties"]}),responseProperties:W6E({responseProperties:e["refresh-token"]?.["response-properties"]})}}function L6E({requestProperties:e}){if(e==null)return Yxa.requestProperties;let t=e["client-id"],r=e["client-secret"],i=e.scopes;return{type:"access_token",client_id:t!=null?yHt(t):Yxa.requestProperties.client_id,client_secret:r!=null?yHt(r):Yxa.requestProperties.client_secret,scopes:i!=null?yHt(i):Yxa.requestProperties.scopes}}function U6E({responseProperties:e}){return XI_({responseProperties:e,defaultValue:Yxa.responseProperties})}function V6E({requestProperties:e}){if(e==null)return Ljc.requestProperties;let t=e["refresh-token"];return{type:"refresh_token",refresh_token:t!=null?yHt(t):Ljc.requestProperties.refresh_token}}function W6E({responseProperties:e}){return XI_({responseProperties:e,defaultValue:Ljc.responseProperties})}function XI_({responseProperties:e,defaultValue:t}){if(e==null)return t;let r=e["access-token"],i=e["expires-in"],n=e["refresh-token"];return{type:"access_token",access_token:r!=null?Mir(r):t.access_token,expires_in:i!=null?Mir(i):t.expires_in,refresh_token:n!=null?Mir(n):t.refresh_token}}function rz_({rawApiFileSchema:e,file:t,propertyResolver:r,endpointResolver:i}){if(e.auth==null)return{docs:void 0,requirement:bne.All,schemes:[]};let n=typeof e.auth!="string"?e.auth.docs:void 0;return lWi(e.auth,{single:a=>{let u=ZI_({reference:a,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:i});return{docs:n,requirement:bne.All,schemes:[u]}},any:({any:a})=>({docs:n,requirement:bne.Any,schemes:a.map(u=>ZI_({reference:u,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:i}))})})}function ZI_({reference:e,authSchemeDeclarations:t,file:r,propertyResolver:i,endpointResolver:n}){let a=(l,d)=>{let s=t?.[l];if(s==null)throw new Error("Unknown auth scheme: "+l);return p1a(s,{header:o=>BT.header({docs:d,name:r.casingsGenerator.generateNameAndWireValue({name:o.name??l,wireValue:o.header}),valueType:r.parseTypeReference(o.type??"string"),prefix:o.prefix,headerEnvVar:o.env}),basic:o=>ez_({file:r,docs:d,rawScheme:o}),bearer:o=>kI_({file:r,docs:d,rawScheme:o}),oauth:o=>tz_({file:r,docs:d,rawScheme:o,propertyResolver:i,endpointResolver:n})})},u=typeof e=="string"?e:e.scheme;switch(u){case"bearer":return kI_({file:r,docs:void 0,rawScheme:void 0});case"basic":return ez_({file:r,docs:void 0,rawScheme:void 0});case"oauth":return tz_({file:r,docs:void 0,rawScheme:void 0,propertyResolver:i,endpointResolver:n});default:return a(u,typeof e!="string"?e.docs:void 0)}}function kI_({file:e,docs:t,rawScheme:r}){return BT.bearer({docs:t,token:e.casingsGenerator.generateName(r?.token?.name??"token"),tokenEnvVar:r?.token?.env})}function ez_({file:e,docs:t,rawScheme:r}){return BT.basic({docs:t,username:e.casingsGenerator.generateName(r?.username?.name??"username"),usernameEnvVar:r?.username?.env,password:e.casingsGenerator.generateName(r?.password?.name??"password"),passwordEnvVar:r?.password?.env})}function tz_({file:e,docs:t,rawScheme:r,propertyResolver:i,endpointResolver:n}){switch(r?.type){case"client-credentials":return BT.oauth({docs:t,configuration:kwi.clientCredentials(JI_({propertyResolver:i,endpointResolver:n,file:e,oauthScheme:r,tokenEndpoint:KI_(r),refreshTokenEndpoint:YI_(r)}))});default:throw new Error(`Unknown OAuth type: '${r?.type}'`)}}function iz_({file:e,rawApiFileSchema:t}){if(t.version!=null)return r1i.header({header:H6E({file:e,header:t.version.header}),value:$6E({file:e,versionDeclaration:t.version})})}function H6E({file:e,header:t}){return typeof t=="string"?mFe({file:e,headerKey:t,header:{type:"string"}}):mFe({file:e,headerKey:t.value,header:{type:"string",name:t.name,env:t.env}})}function $6E({file:e,versionDeclaration:t}){return veu({_enum:{default:t.default,enum:t.values},file:e})}function nz_({channel:e,typeResolver:t,exampleResolver:r,variableResolver:i,file:n,workspace:a}){let u=[];for(let[l,d]of Object.entries(e.messages??{}))u.push({type:l,availability:Gae(d.availability),docs:d.docs,origin:d.origin,body:J6E({body:d.body,file:n}),displayName:d["display-name"]});return{availability:Gae(e.availability),path:JN(e.path),baseUrl:e.url,auth:e.auth,name:n.fernFilepath.file??n.casingsGenerator.generateName(e["display-name"]??e.path),displayName:e["display-name"],headers:e.headers!=null?Object.entries(e.headers).map(([l,d])=>mFe({headerKey:l,header:d,file:n})):[],docs:e.docs,pathParameters:e["path-parameters"]!=null?c9n({pathParameters:e["path-parameters"],location:Gxe.Endpoint,file:n,variableResolver:i}):[],queryParameters:e["query-parameters"]!=null?Object.entries(e["query-parameters"]).map(([l,d])=>{let{name:s}=dpi({queryParameterKey:l,queryParameter:d}),o=n.parseTypeReference(d);return{...lJ(d),name:n.casingsGenerator.generateNameAndWireValue({wireValue:l,name:s}),valueType:o,allowMultiple:typeof d!="string"&&d["allow-multiple"]!=null?d["allow-multiple"]:!1,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}):[],messages:Object.values(u),examples:(e.examples??[]).map(l=>{let d=Y6E({channel:e,example:l,typeResolver:t,exampleResolver:r,variableResolver:i,file:n,workspace:a});return{name:l.name!=null?n.casingsGenerator.generateName(l.name):void 0,docs:l.docs,url:Z6E({channel:e,example:l,pathParams:d}),...d,...X6E({channel:e,example:l,typeResolver:t,exampleResolver:r,file:n,workspace:a}),queryParameters:l["query-parameters"]!=null?Object.entries(l["query-parameters"]).map(([s,o])=>{let c=e["query-parameters"]?.[s];if(c==null)throw new Error(`Query parameter ${s} does not exist`);return{name:n.casingsGenerator.generateNameAndWireValue({name:dpi({queryParameterKey:s,queryParameter:c}).name,wireValue:s}),value:GE({example:o,rawTypeBeingExemplified:typeof c=="string"?c:c.type,typeResolver:t,exampleResolver:r,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}),shape:G6E({queryParameter:c})}}):[],messages:l.messages.map(s=>{let o=e.messages?.[s.type];if(o==null)throw new Error(`Message ${s.type} does not exist`);return{type:s.type,body:Q6E({message:o,example:s.body,typeResolver:t,exampleResolver:r,file:n,workspace:a})}})}}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function G6E({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?A2.exploded():A2.single()}function Q6E({message:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){if(!k6E(e.body))return DEe.reference(GE({example:t,rawTypeBeingExemplified:typeof e.body!="string"?e.body.type:e.body,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}));if(!Gj(t))throw new Error("Example must be an object");let u=[];for(let[l,d]of Object.entries(t)){let s=e.body.properties?.[l];if(s!=null)u.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:l,property:s}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof s!="string"?s.type:s,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}),originalTypeDeclaration:void 0});else{let o=Jxa({extends_:e.body.extends,wirePropertyKey:l,typeResolver:r,file:n});if(o==null)throw new Error("Could not find original type declaration for property: "+l);u.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:l,property:o.rawPropertyType}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof o.rawPropertyType=="string"?o.rawPropertyType:o.rawPropertyType.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:o.file,fileContainingExample:n,workspace:a}),originalTypeDeclaration:o.typeName})}}return DEe.inlinedBody({jsonExample:i.resolveAllReferencesInExampleOrThrow({example:t,file:n}).resolvedExample,properties:u})}function J6E({body:e,file:t}){return typeof e=="string"?E9.reference({docs:void 0,bodyType:t.parseTypeReference(e)}):K6E(e)?E9.reference({docs:void 0,bodyType:t.parseTypeReference(e.type)}):E9.inlinedBody({name:t.casingsGenerator.generateName(e.name),extends:hHt(e.extends??[]).map(r=>uL({typeName:r,file:t})),properties:Object.entries(e.properties??{}).map(([r,i])=>({name:t.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:r,property:i}).name,wireValue:r}),value:t.parseTypeReference(i),valueType:t.parseTypeReference(i),availability:void 0,docs:void 0}))})}function K6E(e){return e.type!=null}function Y6E({channel:e,example:t,typeResolver:r,exampleResolver:i,variableResolver:n,file:a,workspace:u}){let l=[],d=({name:s,pathParameterDeclaration:o,examplePathParameter:c})=>{let b=Kxa({parameter:o,variableResolver:n,file:a});return{name:s,value:GE({example:c,rawTypeBeingExemplified:b.rawType,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:b.file,fileContainingExample:a,workspace:u})}};if(t["path-parameters"]!=null){let s=vHt(e);for(let[o,c]of Object.entries(t["path-parameters"])){let b=s[o];if(b!=null)l.push(d({name:a.casingsGenerator.generateName(o),pathParameterDeclaration:b,examplePathParameter:c}));else throw new Error(`Path parameter ${o} does not exist`)}}return{pathParameters:l}}function X6E({channel:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){let u=[];if(t.headers!=null)for(let[l,d]of Object.entries(t.headers)){let s=e.headers?.[l];if(s!=null)u.push({name:n.casingsGenerator.generateNameAndWireValue({name:Air({headerKey:l,header:s}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof s=="string"?s:s.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a})});else throw new Error(`Heder ${l} does not exist`)}return{headers:u}}function Z6E({channel:e,example:t,pathParams:r}){let i=e.path;if(t["path-parameters"]!=null)for(let n of[...r.pathParameters])i=i.replaceAll(`{${n.name.originalName}}`,encodeURIComponent(`${n.value.jsonExample}`));return i}function k6E(e){return typeof e=="string"?!1:e.extends!=null||e.properties!=null}function az_({errorName:e,errorDeclaration:t,file:r,typeResolver:i,exampleResolver:n,workspace:a}){let u=[];if(t.type!=null&&t.examples!=null)for(let l of t.examples)u.push({name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,docs:l.docs,jsonExample:n.resolveAllReferencesInExampleOrThrow({example:l.value,file:r}).resolvedExample,shape:GE({example:l.value,rawTypeBeingExemplified:t.type,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})});return{name:vAi({errorName:e,file:r}),discriminantValue:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:e}),docs:typeof t!="string"?t.docs:void 0,statusCode:t["status-code"],type:t.type!=null?r.parseTypeReference(t.type):void 0,examples:u,v2Examples:void 0,displayName:void 0}}var oz_="content";function uz_(e,t){if(e==null||e.strategy==="status-code")return SEe.statusCode();switch(e.strategy){case"property":return SEe.property({discriminant:t.casingsGenerator.generateNameAndWireValue({name:e["property-name"],wireValue:e["property-name"]}),contentProperty:t.casingsGenerator.generateNameAndWireValue({name:oz_,wireValue:oz_})});default:jo(e)}}function sz_({readme:e,services:t}){let r=new Ujc(t);return{apiReferenceLink:e.apiReferenceLink,bannerLink:e.bannerLink,introduction:e.introduction,defaultEndpoint:e.defaultEndpoint!=null?r.getEndpointForReadmeOrThrow(e.defaultEndpoint).id:void 0,features:e.features!=null?Object.fromEntries(Object.entries(e.features).map(([i,n])=>[i,n.map(a=>r.getEndpointForReadmeOrThrow(a).id)])):void 0}}var Ujc=class{endpoints={};constructor(t){this.endpoints=this.buildEndpoints(t)}getEndpointForReadme(t){let r=t4E({endpoint:t}),i=this.getEndpointKeyForReadmeEndpoint(r);return this.endpoints[i]}getEndpointForReadmeOrThrow(t){let r=this.getEndpointForReadme(t);if(r==null)throw new Error(`Endpoint not found for ${JSON.stringify(t)}`);return r}buildEndpoints(t){let r={};for(let i of Object.values(t))for(let n of i.endpoints)r[this.getEndpointKeyForHttpEndpoint(n)]=n;return r}getEndpointKeyForReadmeEndpoint(t){return this.getEndpointKey({method:t.method,path:t.path,stream:t.stream??!1})}getEndpointKeyForHttpEndpoint(t){return this.getEndpointKey({method:t.method,path:e4E(t),stream:t.response?.body?.type==="streaming"})}getEndpointKey({method:t,path:r,stream:i}){return`${t}|${r}|${i}`}};function e4E(e){let t="";e.fullPath.head.length>0&&(t=lb(t,e.fullPath.head));for(let r of e.fullPath.parts)t=lb(t,"{"+r.pathParameter+"}"),r.tail.length>0&&(t=lb(t,r.tail));return t.startsWith("/")?t:`/${t}`}function t4E({endpoint:e}){if(typeof e=="string"){let t=e.split(" ");if(t.length!==2||t[0]==null||t[1]==null)throw new Error(`invalid endpoint string: ${e}`);return{method:t[0],path:t[1]}}return e}function cz_({webhooks:e,file:t,typeResolver:r,exampleResolver:i,workspace:n}){let a=[];for(let[u,l]of Object.entries(e))a.push({id:jm.generateWebhookId(t.fernFilepath,u),availability:Gae(l.availability),displayName:l["display-name"],docs:l.docs,method:l.method,name:t.casingsGenerator.generateName(u),headers:l.headers!=null?Object.entries(l.headers).map(([d,s])=>mFe({headerKey:d,header:s,file:t})):[],payload:r4E({payload:l.payload,file:t}),examples:l.examples!=null?n4E({webhook:l,examples:l.examples,file:t,typeResolver:r,exampleResolver:i,workspace:n}):void 0,v2Examples:void 0});return a}function r4E({payload:e,file:t}){return typeof e=="string"?fW.reference({docs:void 0,payloadType:t.parseTypeReference(e)}):Z6n(e)?fW.reference({docs:void 0,payloadType:t.parseTypeReference(e.type)}):fW.inlinedPayload({name:t.casingsGenerator.generateName(e.name),extends:hHt(e.extends).map(r=>uL({typeName:r,file:t})),properties:e.properties!=null?Object.entries(e.properties).map(([r,i])=>i4E({propertyKey:r,propertyDefinition:i,docs:typeof i!="string"?i.docs:void 0,availability:typeof i!="string"?Gae(i.availability):void 0,file:t})):[]})}function i4E({propertyKey:e,propertyDefinition:t,docs:r,availability:i,file:n}){return{docs:r,availability:i,name:n.casingsGenerator.generateNameAndWireValue({wireValue:e,name:sL({propertyKey:e,property:t}).name}),valueType:n.parseTypeReference(t)}}function n4E({webhook:e,examples:t,file:r,typeResolver:i,exampleResolver:n,workspace:a}){let u=typeof e.payload=="string"?e.payload:Z6n(e.payload)?e.payload.type:void 0;if(u!=null)return t.map(l=>({docs:e.docs,name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,payload:GE({example:l.payload,rawTypeBeingExemplified:u,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})}));if(!Gj(e.payload))throw new Error(`Example webhook payload is not an object. Got: ${JSON.stringify(e.payload)}`);return t.map(l=>({docs:e.docs,name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,payload:GE({example:l.payload,rawTypeBeingExemplified:"map<string, unknown>",fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})}))}function lz_({name:e,source:t}){return Kj.userDefined({file:geu({source:t}),name:bAi.generateName(e)})}function fz_({encoding:e}){if(e.proto!=null&&e.proto.type!=null){let t=a4E({type:e.proto.type});if(t!=null)return t}}function a4E({type:e}){switch(e){case"google.protobuf.Any":return Kj.wellKnown(id.any());case"google.protobuf.Api":return Kj.wellKnown(id.api());case"google.protobuf.BoolValue":return Kj.wellKnown(id.boolValue());case"google.protobuf.BytesValue":return Kj.wellKnown(id.bytesValue());case"google.protobuf.DoubleValue":return Kj.wellKnown(id.doubleValue());case"google.protobuf.Duration":return Kj.wellKnown(id.duration());case"google.protobuf.Empty":return Kj.wellKnown(id.empty());case"google.protobuf.Enum":return Kj.wellKnown(id.enum());case"google.protobuf.EnumValue":return Kj.wellKnown(id.enumValue());case"google.protobuf.Field":return Kj.wellKnown(id.field());case"google.protobuf.FieldCardinality":return Kj.wellKnown(id.fieldCardinality());case"google.protobuf.FieldKind":return Kj.wellKnown(id.fieldKind());case"google.protobuf.FieldMask":return Kj.wellKnown(id.fieldMask());case"google.protobuf.FloatVlaue":return Kj.wellKnown(id.floatValue());case"google.protobuf.Int32Value":return Kj.wellKnown(id.int32Value());case"google.protobuf.Int64Value":return Kj.wellKnown(id.int64Value());case"google.protobuf.ListValue":return Kj.wellKnown(id.listValue());case"google.protobuf.Method":return Kj.wellKnown(id.method());case"google.protobuf.Mixin":return Kj.wellKnown(id.mixin());case"google.protobuf.NullValue":return Kj.wellKnown(id.nullValue());case"google.protobuf.Option":return Kj.wellKnown(id.option());case"google.protobuf.SourceContext":return Kj.wellKnown(id.sourceContext());case"google.protobuf.StringValue":return Kj.wellKnown(id.stringValue());case"google.protobuf.Struct":return Kj.wellKnown(id.struct());case"google.protobuf.Syntax":return Kj.wellKnown(id.syntax());case"google.protobuf.Timestamp":return Kj.wellKnown(id.timestamp());case"google.protobuf.Type":return Kj.wellKnown(id.type());case"google.protobuf.Uint32Value":return Kj.wellKnown(id.uint32Value());case"google.protobuf.Uint64Value":return Kj.wellKnown(id.uint64Value());case"google.protobuf.Value":return Kj.wellKnown(id.value())}}function dz_({generic:e,file:t,typeResolver:r}){let i=typeof e=="string"?e:e.type,n=Zx(i);if(n==null)throw new Error(`Invalid generic type definition: ${i}`);let a=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:i,file:t});if(n.arguments&&xS(a.declaration)){let u=Zx(a.typeName)?.arguments??[],l=Object.entries(a.declaration.properties??{}).map(([d,s])=>{let o=s;return typeof s=="string"&&u?.includes(s)&&(o=n.arguments?.[u.indexOf(s)]??s),[d,o]});return Sb.object({extends:hHt(a.declaration.extends).map(d=>uL({typeName:d,file:t})),properties:Wxa({properties:Object.fromEntries(l)},t),extraProperties:a.declaration["extra-properties"]??!1,extendedProperties:void 0})}throw new Error(`Generic type definition not supported: ${i}`)}function pz_({alias:e,file:t,typeResolver:r}){let i=typeof e=="string"?e:e.type;return Wxe(i)?dz_({generic:i,file:t,typeResolver:r}):Sb.alias({aliasOf:t.parseTypeReference(e),resolvedType:o4E({aliasOf:i,file:t,typeResolver:r})})}function o4E({aliasOf:e,file:t,typeResolver:r}){let i=r.resolveTypeOrThrow({type:e,file:t});switch(i._type){case"primitive":return lW.primitive(i.originalTypeReference.primitive);case"container":return lW.container(i.originalTypeReference.container);case"unknown":return lW.unknown();case"named":{let n=xS(i.declaration)?jVt.Object:f1i(i.declaration)?jVt.Union:EVt(i.declaration)?jVt.Enum:pxn(i.declaration)?jVt.UndiscriminatedUnion:jo(i.declaration);return lW.named({name:i.name,shape:n})}}}function _z_({union:e,file:t}){let r=e.union.filter((i,n)=>{let a=typeof i=="string"?i:i.type;return e.union.findIndex(u=>(typeof u=="string"?u:u.type)===a)===n});return Sb.undiscriminatedUnion({members:r.map(i=>{let n=t.parseTypeReference(typeof i=="string"?i:i.type);return{type:n.type==="named"?{...n,displayName:typeof i=="string"?Lyo(n.name.originalName):i["display-name"]??Lyo(n.name.originalName)}:n,docs:typeof i=="string"?void 0:i.docs}})})}function hz_(e){let t=[];if(e.extends!=null){let r=typeof e.extends=="string"?[e.extends]:e.extends;t.push(...r)}return e.properties!=null&&t.push(...Object.values(e.properties).map(r=>typeof r=="string"?r:r.type)),t}function Wjc({typeDeclaration:e,file:t,typeResolver:r,seenTypeNames:i=new Vjc}){let n=a3(e,{alias:u=>{let l=typeof u=="string"?u:u.type,d=Zx(l);if(d!=null){let s=new Set(d.arguments??[]),o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:l,file:t}),c=Zx(o.typeName)?.arguments;if(xS(o.declaration)){let b=hz_(o.declaration);c&&b.filter(g=>!c.includes(g)).forEach(g=>s.add(g))}return Array.from(s)}return[l]},object:u=>hz_(u),discriminatedUnion:u=>{let l=[];return u["base-properties"]!=null&&l.push(...Object.values(u["base-properties"]).map(d=>typeof d=="string"?d:d.type)),l.push(...Object.values(u.union).reduce((d,s)=>{let o=typeof s=="string"?s:s.type;return typeof o=="string"&&d.push(o),d},[])),l},undiscriminatedUnion:u=>Object.values(u.union).reduce((l,d)=>{let s=typeof d=="string"?d:d.type;return typeof s=="string"&&l.push(s),l},[]),enum:()=>[]}),a=[];for(let u of n){let l=q2({type:u,_default:void 0,validation:void 0,visitor:{primitive:()=>[],map:({keyType:d,valueType:s})=>[...d,...s],list:d=>d,optional:d=>d,nullable:d=>d,set:d=>d,named:d=>[d],literal:()=>[],unknown:()=>[]}});for(let d of l){let s=uL({typeName:d,file:t});if(!i.hasTypeNameBeenSeen(s)){i.addTypeName(s),a.push(s);let o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:d,file:t});if(Wxe(o.typeName))continue;a.push(...Wjc({typeDeclaration:o.declaration,file:o.file,typeResolver:r,seenTypeNames:i}))}}}return a}var Vjc=class{cache=new Set;addTypeName(t){this.cache.add(this.computeCacheKey(t))}hasTypeNameBeenSeen(t){return this.cache.has(this.computeCacheKey(t))}computeCacheKey(t){return t.fernFilepath.allParts.map(r=>r.originalName).join("/")+":"+t.name.originalName}};function yz_({typeName:e,typeDeclaration:t,file:r,typeResolver:i,exampleResolver:n,sourceResolver:a,workspace:u}){let l=lJ(t),d=uL({typeName:e,file:r}),s=Wjc({typeDeclaration:t,file:r,typeResolver:i}),o={};xS(t)&&(o=NGi(t.properties??{}));let c=s4E({file:r,typeDeclaration:t,typeName:e,sourceResolver:a});return{propertiesByAudience:o,typeDeclaration:{...l,inline:d4E(t),name:d,shape:u4E({typeDeclaration:t,file:r,typeResolver:i}),referencedTypes:new Set(s.map(b=>b.typeId)),encoding:c4E({typeDeclaration:t,source:c}),source:c,userProvidedExamples:typeof t!="string"&&t.examples!=null?t.examples.map(b=>({name:b.name!=null?r.casingsGenerator.generateName(b.name):void 0,docs:b.docs,jsonExample:n.resolveAllReferencesInExampleOrThrow({example:b.value,file:r}).resolvedExample,shape:Fjc({typeName:d,example:b.value,typeResolver:i,exampleResolver:n,typeDeclaration:t,fileContainingType:r,fileContainingExample:r,workspace:u})})):[],autogeneratedExamples:[],v2Examples:void 0},descendantFilepaths:new Set(s.map(b=>b.fernFilepath))}}function u4E({typeDeclaration:e,file:t,typeResolver:r}){return a3(e,{alias:i=>pz_({alias:i,file:t,typeResolver:r}),object:i=>XB_({object:i,file:t}),discriminatedUnion:i=>dI_({union:i,file:t,typeResolver:r}),undiscriminatedUnion:i=>_z_({union:i,file:t}),enum:i=>Sb.enum(veu({_enum:i,file:t}))})}function s4E({file:e,typeDeclaration:t,typeName:r,sourceResolver:i}){if(typeof t=="string"||t.source==null&&t.encoding==null)return;if(t.encoding!=null){let a=fz_({encoding:t.encoding});if(a!=null)return _li.proto(a)}if(t.source==null)return;let n=i.resolveSourceOrThrow({source:t.source,relativeFilepath:e.relativeFilepath});if(!(n==null||n.type!=="protobuf"))return _li.proto(lz_({source:n,name:r}))}function c4E({typeDeclaration:e,source:t}){return typeof e!="string"&&e.encoding!=null?l4E(e.encoding):f4E(t)}function l4E(e){return e.proto!=null?{json:void 0,proto:{}}:{json:{},proto:void 0}}function f4E(e){return e!=null&&e.type==="proto"?{json:void 0,proto:{}}:{json:{},proto:void 0}}function d4E(e){if(typeof e!="string"&&"inline"in e)return e.inline}function vz_(e,t){let r=t[e];if(r==null)throw new Wci(`Illegal Error: Failed to load type declaration for type ${e}`);return r}function bz_(e){e.types=Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,_4E({typeDeclaration:r,ir:e})])),e.services=Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>p4E({endpoint:i,ir:e}))}]))}function p4E({endpoint:e,ir:t}){return e.requestBody?.type!=="inlinedRequestBody"?e:{...e,requestBody:{...e.requestBody,extendedProperties:e.requestBody.extends.flatMap(r=>gz_(r,t))}}}function _4E({typeDeclaration:e,ir:t}){switch(e.shape.type){case"object":return{...e,shape:{...e.shape,extendedProperties:e.shape.extends.flatMap(r=>gz_(r,t))}}}return e}function gz_(e,t){let r=Hjc(e.typeId,t);return Oz_({objectTypeDeclaration:r,ir:t})}function Hjc(e,t){let r=vz_(e,t.types);switch(r.shape.type){case"object":return r.shape;case"alias":if(r.shape.resolvedType.type==="named")return Hjc(r.shape.resolvedType.name.typeId,t)}throw new Wci(`Unexpected error: ${e} is extended but has shape ${r.shape.type}`)}function Oz_({objectTypeDeclaration:e,ir:t}){let r=e.extends.flatMap(i=>{let n=Hjc(i.typeId,t);return Oz_({objectTypeDeclaration:n,ir:t})});return[...e.properties,...r]}function mz_({reference:e,referencedIn:t,imports:r}){let[i,n,...a]=e.split(".");if(i==null||a.length>0)return;if(n==null)return{endpointName:i,relativeFilepath:t};let l=r[i];if(l!=null)return{endpointName:n,relativeFilepath:yAi({referencedIn:t,importPath:l})}}var fKi=class{workspace;constructor(t){this.workspace=t}resolveEndpointOrThrow({endpoint:t,file:r}){let i=this.resolveEndpoint({endpoint:t,file:r});if(i==null)throw new Error("Cannot resolve endpoint: "+t+" in file "+r.relativeFilepath);return i}resolveEndpointByMethodAndPath({method:t,path:r}){let i;return E3(this.workspace,(n,a,u)=>{let l=M0({relativeFilepath:n,definitionFile:a,casingsGenerator:bAi,rootApiFile:this.workspace.definition.rootApiFile.contents,defaultUrl:u.defaultUrl});for(let[d,s]of Object.entries(a.service?.endpoints??{}))s.method===t&&s.path===r&&(i={endpointId:d,endpoint:s,file:l})}),CQi(this.workspace,(n,a)=>{let u=M0({relativeFilepath:n,definitionFile:a,casingsGenerator:bAi,rootApiFile:this.workspace.definition.rootApiFile.contents});for(let[l,d]of Object.entries(a.service?.endpoints??{}))d.method===t&&d.path===r&&(i={endpointId:l,endpoint:d,file:u})}),i}resolveEndpoint({endpoint:t,file:r}){let n=new fWi().tryParse(t);if(n!=null)return this.resolveEndpointByMethodAndPath(n);let a=this.getDeclarationOfEndpoint({referenceToEndpoint:t,file:r});if(a==null)return;let u=a.file.definitionFile.service?.endpoints?.[a.endpointName];if(u!=null)return{endpointId:a.endpointName,endpoint:u,file:a.file}}getDeclarationOfEndpoint({referenceToEndpoint:t,file:r}){let i=mz_({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(!(n==null||n.service?.endpoints?.[i.endpointName]==null))return{endpointName:i.endpointName,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var dKi=class{workspace;constructor(t){this.workspace=t}getDeclarationOrThrow(t,r){let i=this.getDeclaration(t,r);if(i==null)throw new Error("Error does not exist: "+t);return i}getDeclaration(t,r){let i=gMe({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(n==null)return;let a=n.errors?.[i.typeName];if(a!=null)return{declaration:a,file:M0({definitionFile:n,relativeFilepath:i.relativeFilepath,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var mMe=class{typeResolver;constructor(t){this.typeResolver=t}resolveAllReferencesInExample({example:t,file:r}){if(typeof t=="string"){let i=this.resolveExample({example:t,file:r});return i==null||typeof i.resolvedExample=="string"?i:this.resolveAllReferencesInExample({example:i.resolvedExample,file:i.file})}else if(Gj(t)){let i={};for(let[n,a]of Object.entries(t)){let u=this.resolveAllReferencesInExample({example:a,file:r});if(u==null)return;i[n]=u.resolvedExample}return{resolvedExample:i}}else if(Array.isArray(t)){let i=[];for(let n of t){let a=this.resolveAllReferencesInExample({example:n,file:r});if(a==null)return;i.push(a.resolvedExample)}return{resolvedExample:i}}return{resolvedExample:t}}resolveAllReferencesInExampleOrThrow({example:t,file:r}){let i=this.resolveAllReferencesInExample({example:t,file:r});if(i==null)throw new Error("Failed to resolve examples");return i}resolveExample({example:t,file:r}){if(typeof t!="string")return{resolvedExample:t,file:r};if(t.startsWith(`\\${ZZt}`))return{resolvedExample:t.slice(1),file:r};if(!t.startsWith(ZZt))return{resolvedExample:t,file:r};let i=this.parseExampleReference(t);if(i==null)return;let n=this.typeResolver.getDeclarationOfNamedType({referenceToNamedType:i.rawTypeReference,file:r});if(n==null||typeof n.declaration=="string"||n.declaration.examples==null)return;let a=n.declaration.examples.find(u=>u.name===i.exampleName);if(a!=null)return this.resolveExample({example:a.value,file:n.file})}resolveExampleOrThrow({example:t,file:r}){let i=this.resolveExample({example:t,file:r});if(i==null)throw new Error("Cannot resolve example: "+t);return i}parseExampleReference(t){let[r,i,n,...a]=t.split(".");if(!(r==null||i==null||a.length>0))return n==null?{rawTypeReference:r.slice(ZZt.length),exampleName:i}:{rawTypeReference:`${r}.${i}`.slice(ZZt.length),exampleName:n}}};var Seu=class{typeResolver;endpointResolver;constructor(t,r){this.typeResolver=t,this.endpointResolver=r,this.typeResolver=t,this.endpointResolver=r}resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:i}){let n=this.resolveRequestProperty({file:t,endpoint:r,propertyComponents:i});if(n==null)throw new Error("Cannot resolve request property from endpoint: "+r+" in file "+t.relativeFilepath);return n}resolveRequestProperty({file:t,endpoint:r,propertyComponents:i}){let n=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t});if(n.endpoint.request==null)return;if(typeof n.endpoint.request!="string")return this.resolveRequestPropertyFromInlinedRequest({typeResolver:this.typeResolver,file:n.file,requestType:n.endpoint.request,propertyComponents:i});let a=this.resolveObjectProperty({file:n.file,typeName:n.endpoint.request,propertyComponents:i});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:t}),property:One.body(a)}}resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i}){let n=this.resolveResponseProperty({file:t,endpoint:r,propertyComponents:i});if(n==null)throw new Error("Cannot resolve response property from endpoint: "+r+" in file "+t.relativeFilepath);return n}resolveResponseProperty({file:t,endpoint:r,propertyComponents:i}){let n=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t}),a=this.resolveObjectProperty({file:n.file,typeName:(typeof n.endpoint.response!="string"?n.endpoint.response?.type:n.endpoint.response)??"",propertyComponents:i});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:t}),property:a}}resolveRequestPropertyFromInlinedRequest({typeResolver:t,file:r,requestType:i,propertyComponents:n}){if(n.length===1){let a=n[0]??"",u=i["query-parameters"]?.[a]??void 0;if(u!=null)return{property:One.query(beu({file:r,queryParameterKey:a,queryParameter:u})),propertyPath:void 0}}return this.resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:i,propertyComponents:n})}resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:i,propertyComponents:n}){if(i.body==null)return;if(typeof i.body=="string"){let u=this.resolveObjectProperty({file:r,typeName:i.body,propertyComponents:n});return u==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(u)}}if(KC(i.body)){let u=zjc({typeResolver:t,file:r,objectSchema:i.body,propertyComponents:n});return u==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(u)}}let a=this.resolveObjectProperty({file:r,typeName:i.body.type,propertyComponents:n});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(a)}}resolveObjectProperty({file:t,typeName:r,propertyComponents:i}){let n=this.typeResolver.resolveTypeOrThrow({type:r,file:t});return Ijc({typeResolver:this.typeResolver,file:$xa(n)??t,resolvedType:n,propertyComponents:i})}propertyPathFromPropertyComponents({propertyComponents:t,file:r}){return t.length<=1?[]:t.slice(0,-1).map(i=>r.casingsGenerator.generateName(i))}};var H1=class{workspace;constructor(t){this.workspace=t}resolveTypeOrThrow({type:t,file:r}){let i=this.resolveType({type:t,file:r});if(i==null)throw new Error("Cannot resolve type: "+t+" in file "+r.relativeFilepath);return i}getDeclarationOfNamedTypeOrThrow({referenceToNamedType:t,file:r}){let i=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(i==null)throw new Error("Cannot find declaration of type: "+t+" in file "+r.relativeFilepath);return i}getDeclarationOfNamedType({referenceToNamedType:t,file:r}){let i=gMe({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(n==null)return;let a=n.types?.[i.typeName];if(a==null){let u=Zx(i.typeName);if(u!=null){for(let l of Object.keys(n.types??{})??[])if(u.name&&l.startsWith(u.name)&&l.endsWith(">")){let d=n.types?.[l];return d!=null?{typeName:l,declaration:d,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}:void 0}}return}return{typeName:i.typeName,declaration:a,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}resolveType({type:t,file:r,objectPath:i=[]}){return q2({type:t,_default:void 0,validation:void 0,visitor:{primitive:n=>({_type:"primitive",primitive:n,originalTypeReference:Kc.primitive(n)}),unknown:()=>({_type:"unknown",originalTypeReference:Kc.unknown()}),map:({keyType:n,valueType:a})=>n!=null&&a!=null?{_type:"container",container:{_type:"map",keyType:n,valueType:a},originalTypeReference:Kc.container(Py.map({keyType:n.originalTypeReference,valueType:a.originalTypeReference}))}:void 0,list:n=>n!=null?{_type:"container",container:{_type:"list",itemType:n},originalTypeReference:Kc.container(Py.list(n.originalTypeReference))}:void 0,optional:n=>n!=null?{_type:"container",container:{_type:"optional",itemType:n},originalTypeReference:Kc.container(Py.optional(n.originalTypeReference))}:void 0,nullable:n=>n!=null?{_type:"container",container:{_type:"nullable",itemType:n},originalTypeReference:Kc.container(Py.nullable(n.originalTypeReference))}:void 0,set:n=>n!=null?{_type:"container",container:{_type:"set",itemType:n},originalTypeReference:Kc.container(Py.set(n.originalTypeReference))}:void 0,literal:n=>({_type:"container",container:{_type:"literal",literal:n},originalTypeReference:Kc.container(Py.literal(n))}),named:n=>{let a=this.getDeclarationOfNamedType({referenceToNamedType:n,file:r});if(a==null)return;let u={typeName:a.typeName,file:a.file.relativeFilepath,reference:n};if(!i.some(l=>l.file===u.file&&l.typeName===u.typeName))return this.resolveNamedTypeFromDeclaration({referenceToNamedType:n,referencedIn:r,rawDeclaration:a,objectPath:[...i,u]})}}})}resolveNamedTypeOrThrow({referenceToNamedType:t,file:r}){let i=this.resolveNamedType({referenceToNamedType:t,file:r});if(i==null)throw new Error("Cannot resolve type: "+t);return i}resolveNamedType({referenceToNamedType:t,file:r}){let i=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(i!=null)return this.resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:i})}resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:i,objectPath:n=[]}){let{declaration:a,file:u}=i;if(l1i(a))return this.resolveType({type:typeof a=="string"?a:a.type,file:u,objectPath:n});let l=Qxa({type:t,_default:void 0,validation:void 0,file:r});if(!(l.type!=="named"||zae(this.workspace,u.relativeFilepath)==null))return{_type:"named",rawName:i.typeName,name:l,declaration:a,filepath:u.relativeFilepath,objectPath:n,originalTypeReference:l,file:u}}};var gHt=class e{static VARIABLE_PREFIX="$";getDeclarationOrThrow(t,r){let i=this.getDeclaration(t,r);if(i==null)throw new Error("Variable does not exist: "+t);return i}getDeclaration(t,r){if(!t.startsWith(e.VARIABLE_PREFIX))return;let i=r.rootApiFile.variables?.[t.substring(1)];if(i!=null)return{declaration:i,file:fpi({casingsGenerator:r.casingsGenerator,rootApiFile:r.rootApiFile})}}getVariableIdOrThrow(t){let r=this.getVariableId(t);if(r==null)throw new Error("Variable reference does not start with "+e.VARIABLE_PREFIX);return r}getVariableId(t){if(t.startsWith(e.VARIABLE_PREFIX))return t.substring(e.VARIABLE_PREFIX.length)}};function Deu(e,t){if(t){for(let[r,i]of Object.entries(t))if(typeof i!="string"&&r===e)return i.audiences}}function hR({workspace:e,generationLanguage:t,keywords:r,smartCasing:i,exampleGeneration:n,audiences:a,readme:u,packageName:l,version:d,fdrApiDefinitionId:s,sourceResolver:o,disableDynamicExamples:c,dynamicGeneratorConfig:b}){let g=BZ({generationLanguage:t,keywords:r,smartCasing:i}),O=new FGi(a),m=fpi({casingsGenerator:g,rootApiFile:e.definition.rootApiFile.contents}),w=(e.definition.rootApiFile.contents.errors??[]).map(ot=>({error:vAi({errorName:ot,file:m}),docs:void 0})),E=new H1(e),q=new fKi(e),A=new Seu(E,q),D=new dKi(e),C=new mMe(E),x=new gHt,I=NTa({casingsGenerator:g,rawApiFileSchema:e.definition.rootApiFile.contents})?.environmentsConfig,F={selfHosted:!1,fdrApiDefinitionId:s,apiVersion:iz_({file:m,rawApiFileSchema:e.definition.rootApiFile.contents}),apiName:g.generateName(e.definition.rootApiFile.contents.name),apiDisplayName:e.definition.rootApiFile.contents["display-name"],apiDocs:Vxa(e.definition.rootApiFile.contents.docs),auth:rz_({rawApiFileSchema:e.definition.rootApiFile.contents,file:m,propertyResolver:A,endpointResolver:q}),headers:e.definition.rootApiFile.contents.headers!=null?Object.entries(e.definition.rootApiFile.contents.headers).map(([ot,at])=>mFe({headerKey:ot,header:at,file:m})):[],idempotencyHeaders:e.definition.rootApiFile.contents["idempotency-headers"]!=null?Object.entries(e.definition.rootApiFile.contents["idempotency-headers"]).map(([ot,at])=>mFe({headerKey:ot,header:at,file:m})):[],types:{},errors:{},services:{},constants:$I_(g),environments:I,errorDiscriminationStrategy:uz_(e.definition.rootApiFile.contents["error-discrimination"],m),basePath:e.definition.rootApiFile.contents["base-path"]!=null?JN(e.definition.rootApiFile.contents["base-path"]):void 0,pathParameters:c9n({pathParameters:e.definition.rootApiFile.contents["path-parameters"],file:m,location:Gxe.Root,variableResolver:x}),variables:e.definition.rootApiFile.contents.variables!=null?Object.entries(e.definition.rootApiFile.contents.variables).map(([ot,at])=>({docs:typeof at!="string"?at.docs:void 0,id:ot,name:m.casingsGenerator.generateName(ot),type:m.parseTypeReference(at)})):[],serviceTypeReferenceInfo:{typesReferencedOnlyByService:{},sharedTypes:[]},webhookGroups:{},websocketChannels:{},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,audiences:e.definition.rootApiFile.contents.audiences},V=new Peu,K=ot=>{V.addSubpackage(ot.fernFilepath),Cw(ot.definitionFile,{imports:Go,docs:at=>{at!=null&&V.addDocs(ot.fernFilepath,at)},types:at=>{if(at!=null)for(let[me,we]of Object.entries(at)){if(Wxe(me))continue;let jt=yz_({typeName:me,typeDeclaration:we,file:ot,typeResolver:E,exampleResolver:C,sourceResolver:o,workspace:e}),gt=jt.typeDeclaration;n.disabled&&(gt.userProvidedExamples=[],gt.autogeneratedExamples=[]);let qr=jt.descendantFilepaths,lr=jm.generateTypeId(gt.name);F.types[lr]=gt,V.addType(lr,gt),O.addType({declaredTypeName:gt.name,descendantTypeIds:gt.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:jt.propertiesByAudience,descendantFilepaths:qr}),O.markTypeForAudiences(gt.name,YB_(we))}},errors:at=>{if(at==null)return;if(e.definition.rootApiFile.contents["error-discrimination"]==null)throw new Error("error-discrimination is missing in api.yml but there are declared errors.");for(let[we,jt]of Object.entries(at)){let gt=az_({errorName:we,errorDeclaration:jt,file:ot,typeResolver:E,exampleResolver:C,workspace:e}),qr=jm.generateErrorId(gt.name);F.errors[qr]=gt,V.addError(qr,gt),O.addError(gt)}},service:at=>{if(at==null)return;let me=UI_({rootDefaultUrl:ot.defaultUrl??e.definition.rootApiFile.contents["default-url"],rootPathParameters:F.pathParameters,serviceDefinition:at,file:ot,errorResolver:D,typeResolver:E,propertyResolver:A,exampleResolver:C,sourceResolver:o,globalErrors:w,variableResolver:x,workspace:e}),we=jm.generateServiceId(me.name);F.services[we]=me,V.addService(we,me);let jt={};me.endpoints.forEach(gt=>{n.disabled&&(gt.autogeneratedExamples=[],gt.userSpecifiedExamples=[]);let qr=at.endpoints[gt.name.originalName];O.addEndpoint(me,gt,qr),jt[gt.name.originalName]=gt}),at.audiences!=null&&O.markEndpointForAudience(me.name,me.endpoints,at.audiences),Object.entries(at.endpoints).map(([gt,qr])=>{let lr=jt[gt];lr!=null&&qr.audiences!=null&&O.markEndpointForAudience(me.name,[lr],qr.audiences)})},webhooks:at=>{if(at==null)return;let me=jm.generateWebhookGroupId(ot.fernFilepath),we=cz_({webhooks:at,file:ot,typeResolver:E,exampleResolver:C,workspace:e}),jt={};for(let gt of we)jt[gt.name.originalName]=gt;Object.entries(at).forEach(([gt,qr])=>{let lr=jt[gt];lr!=null&&(O.addWebhook(ot.fernFilepath,lr,qr),qr.audiences!=null&&O.markWebhookForAudiences(ot.fernFilepath,lr,qr.audiences))}),F.webhookGroups[me]=we,V.addWebhookGroup(me,ot.fernFilepath)},channel:at=>{if(at==null)return;let me=jm.generateWebSocketChannelId(ot.fernFilepath),we=nz_({channel:at,file:ot,variableResolver:x,typeResolver:E,exampleResolver:C,workspace:e});O.addChannel(ot.fernFilepath,me,we,at),at.audiences!=null&&O.markChannelForAudiences(ot.fernFilepath,me,at.audiences),F.websocketChannels!=null&&(F.websocketChannels[me]=we,V.addWebSocketChannel(me,ot.fernFilepath))}})};E3(e,(ot,at,me)=>{K(M0({relativeFilepath:ot,definitionFile:at,casingsGenerator:g,rootApiFile:e.definition.rootApiFile.contents,defaultUrl:me.defaultUrl}))}),CQi(e,(ot,at)=>{if(at.navigation!=null)if(typeof at.navigation=="string")V.addPackageRedirection({from:$ae({relativeFilepath:ot,casingsGenerator:g}),to:$ae({relativeFilepath:EN(axe(ot),Oy.of(at.navigation)),casingsGenerator:g})});else{let me=at.navigation.map(we=>jm.generateSubpackageId($ae({relativeFilepath:EN(axe(ot),Oy.of(we)),casingsGenerator:g})));ot===TS?V.sortRootPackage(me):V.sortSubpackage(jm.generateSubpackageId($ae({relativeFilepath:ot,casingsGenerator:g})),me)}}),F.serviceTypeReferenceInfo=y4E(O),bz_(F);let Y=n.disabled?F:RTa({ir:F,exampleGeneration:n}),Z=e.definition.rootApiFile.contents,oe=I?.environments._visit({singleBaseUrl:ot=>ot.environments.filter(at=>Deu(at.id,Z.environments)!=null).length===0,multipleBaseUrls:ot=>ot.environments.filter(at=>Deu(at.id,Z.environments)!=null).length===0,_other:()=>!1});I?.environments.environments.forEach(ot=>{O.markEnvironmentForAudiences(ot,Deu(ot.id,Z.environments)??[],oe)});let pe=O.hasNoAudiences()?void 0:O.build(),de=Loc(Y,pe),Oe=e.definition.rootApiFile.contents.auth!=null&&Object.values(de.services).every(ot=>ot.endpoints.every(at=>at.auth)),Ue=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.response?.body?.type==="streaming")),wt=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.pagination!=null)),De=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.response?.body?.type==="fileDownload")),Te={isAuthMandatory:Oe,hasStreamingEndpoints:Ue,hasPaginatedEndpoints:wt,hasFileDownloadEndpoints:De,platformHeaders:{language:"X-Fern-Language",sdkName:"X-Fern-SDK-Name",sdkVersion:"X-Fern-SDK-Version",userAgent:d!=null&&l!=null?{header:"User-Agent",value:`${l}/${d}`}:void 0}},xt=u!=null?sz_({readme:u,services:F.services}):void 0,Pe=h4E({...de,...V.build(pe),sdkConfig:Te,readmeConfig:xt});return{...Pe,dynamic:WI_({ir:Pe,generatorConfig:b,disableExamples:c,generationLanguage:t,smartCasing:i})}}function h4E(e){let t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(t);for(let i in r){let n=r[i];i==="docs"&&typeof n=="string"?r[i]=Vxa(n):n&&typeof n=="object"&&t(n)}return r};return t(e)}function y4E(e){let t={},r=[],i=e.getTypesReferencedByService();for(let[n,a]of Object.entries(i)){if(a.size===1){let u=a.values().next().value;if(u==null)break;t[u]===void 0&&(t[u]=[]),t[u]?.push(n);continue}r.push(n)}return{typesReferencedOnlyByService:t,sharedTypes:r}}function Pz_(e){throw new Error("Unexpected value: "+JSON.stringify(e))}var wz_=ui(SCn(),1);var jz_=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function OHt(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,wz_.default)(e,{special:jz_}).replace(/V\s(\d)/g,"V$1")}function Xxa(e,t="type"){return{_visit:r=>{let i=r[e[t]];return i!=null?i(e):(r._other==null&&Pz_(e),r._other(e))}}}function qir(e){return typeof e.subpackageId=="string"}function l9n(e,t){return`${e} ${rB(t)}`}function rB(e){return e.map(t=>t.type==="literal"?t.value:`{${t.value}}`).join("")}function PFe(e){return e.map(t=>t.type==="literal"?t.value:`:${t.value}`).join("")}var $jc="__package__",OAi=class e{api;context;static create(t,r){return new e(t,r)}#e=new Map;#t=new Map;#r=new Map;#n=new Map;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#f=new Map;#u=new Map;#l=new Map;static getSubpackageId(t){return qir(t)?t.subpackageId:$jc}getSubpackageByIdOrLocator(t){if(t==null)return;let r=Y6.SubpackageId(t),i=Y6.SubpackageId(`subpackage_${d_(t)}`);return r===$jc?this.api.rootPackage:this.api.subpackages[r]??this.#l.get(r)??this.api.subpackages[i]??this.#l.get(i)}resolveSubpackage(t){if(t!=null){for(;t?.pointsTo!=null;)t=this.api.subpackages[t.pointsTo];return t}}constructor(t,r){this.api=t,this.context=r,[t.rootPackage,...Object.values(t.subpackages)].forEach(i=>{let n=Y6.SubpackageId(e.getSubpackageId(i)),a={endpoints:new Map,webSockets:new Map,webhooks:new Map};this.#o.set(n,a),i.endpoints.forEach(u=>{a.endpoints.set(u.id,u);let l=e.createEndpointId(u,n);this.#e.set(l,u);let d=[],s=[u.method];u.response?.type.type==="stream"&&s.push("STREAM"),s.forEach(o=>{d.push(`${o} ${rB(u.path.parts)}`),d.push(`${o} ${PFe(u.path.parts)}`),u.environments.forEach(c=>{d.push(`${o} ${lb(c.baseUrl,rB(u.path.parts))}`),d.push(`${o} ${lb(c.baseUrl,PFe(u.path.parts))}`);let b=Eeu(c);b!=null&&(d.push(`${o} ${lb(b,rB(u.path.parts))}`),d.push(`${o} ${lb(b,PFe(u.path.parts))}`))})}),d.forEach(o=>{this.context?.logger.trace(`Registering endpoint locator: ${o}`),this.#s.set(o,u)})}),i.websockets.forEach(u=>{a.webSockets.set(u.id,u);let l=e.createWebSocketId(u,n);this.#t.set(l,u);let d=[];["GET","WSS"].forEach(o=>{d.push(`${o} ${rB(u.path.parts)}`),d.push(`${o} ${PFe(u.path.parts)}`),u.environments.forEach(c=>{d.push(`${o} ${lb(c.baseUrl,rB(u.path.parts))}`),d.push(`${o} ${lb(c.baseUrl,PFe(u.path.parts))}`);let b=Eeu(c);b!=null&&(d.push(`${o} ${lb(b,rB(u.path.parts))}`),d.push(`${o} ${lb(b,PFe(u.path.parts))}`))})}),d.forEach(o=>{this.context?.logger.trace(`Registering websocket locator: ${o}`),this.#f.set(o,u)})}),i.webhooks.forEach(u=>{a.webhooks.set(u.id,u),this.#r.set(e.createWebhookId(u,n),u)})}),this.#e.forEach((i,n)=>{this.#n.set(i,n)}),this.#t.forEach((i,n)=>{this.#i.set(i,n)}),this.#r.forEach((i,n)=>{this.#a.set(i,n)}),this.#c(t.rootPackage,[])}#c(t,r){if(t==null)return;let i=qir(t)?[...r,t.name]:r,n=i.length===0?[$jc]:i;if([n.join("."),n.join("/"),`${n.join(".")}.yml`].forEach(u=>{this.context?.logger.trace(`Registering subpackage locator: ${u}`),this.#l.set(u,t)}),t.pointsTo!=null)return this.#c(this.api.subpackages[t.pointsTo],i);t.endpoints.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering endpoint locator: ${s}`),this.#s.set(s,u)})}),t.websockets.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering websocket locator: ${s}`),this.#f.set(s,u)})}),t.webhooks.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering webhook locator: ${s}`),this.#u.set(s,u)})}),t.subpackages.forEach(u=>{this.#c(this.api.subpackages[u],i)})}get endpoints(){return this.#e}get webSockets(){return this.#t}get webhooks(){return this.#r}get endpointsByLocator(){return this.#s}get webSocketsByLocator(){return this.#f}get webhooksByLocator(){return this.#u}get subpackages(){return this.#o}get subpackagesByLocator(){return this.#l}getEndpointId(t){return this.#n.get(t)}getWebSocketId(t){return this.#i.get(t)}getWebhookId(t){return this.#a.get(t)}static createEndpointId(t,r){return So.EndpointId(t.originalEndpointId??`${r}.${t.id}`)}static createWebSocketId(t,r){return So.WebSocketId(`${r}.${t.id}`)}static createWebhookId(t,r){return So.WebhookId(`${r}.${t.id}`)}};function Eeu(e){if(e!=null){if(e.baseUrl.startsWith("/"))return e.baseUrl;if(e.baseUrl.startsWith("http")||e.baseUrl.startsWith("ws"))try{return new URL(e.baseUrl).pathname}catch{return}}}var f9n=ui(hZo(),1),Dz_=ui(yZo(),1);function Sz_(e){let t=e.split(".")[0];if(t==null)return;let i=/(^\d{1,4})-(\d{1,2})-(\d{1,4})/.exec(t)?.[0];if(i!=null)try{return new Date(i)}catch{}}f9n.default.extend(Dz_.default);var v4E="Changelog",b4E=["summary","index","overview"],ppi=class{markdownToFullSlug;markdownToNoIndex;changelogFiles;docsWorkspace;idgen;constructor(t,r,i,n,a){this.markdownToFullSlug=t,this.markdownToNoIndex=r,this.changelogFiles=i,this.docsWorkspace=n,this.idgen=a}toChangelogNode(t){let r=t.title??v4E,i=[],n;for(let b of this.changelogFiles??[]){let g=kBs(b.split("/"));if(g==null)continue;let O=Sz_(g);if(O==null){let w=g.split(".")[0]?.toLowerCase();w!=null&&b4E.includes(w)&&(n=b);continue}let m=this.toRelativeFilepath(b);i.push({date:O,pageId:So.PageId(m),absoluteFilepath:b})}let a=t.parentSlug.apply({fullSlug:n!=null?this.markdownToFullSlug.get(n)?.split("/"):void 0,skipUrlSlug:!1,urlSlug:t.slug??Tq(r)}),u=n!=null?this.markdownToNoIndex.get(n):void 0,l=i.map(b=>{let g=f9n.default.utc(b.date);return{id:this.idgen.get(b.pageId),type:"changelogEntry",title:g.format("MMMM D, YYYY"),slug:a.apply({fullSlug:this.markdownToFullSlug.get(b.absoluteFilepath)?.split("/"),urlSlug:g.format("YYYY/M/D")}).get(),icon:void 0,hidden:void 0,date:b.date.toISOString(),pageId:b.pageId,noindex:this.markdownToNoIndex.get(b.absoluteFilepath),authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),d=Gjc(l,b=>b.date,"desc"),s=n!=null?So.PageId(this.toRelativeFilepath(n)):void 0,o=this.idgen.get(s??"changelog"),c=this.groupByYear(o,d,a);return{id:o,type:"changelog",title:r,slug:a.get(),icon:t.icon,hidden:t.hidden,children:c,overviewPageId:s,noindex:u,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:void 0}}orUndefined(){return this.changelogFiles!=null&&this.changelogFiles.length>0?this:void 0}groupByYear(t,r,i){let n=new Map;for(let a of r){let u=f9n.default.utc(a.date).year(),l=n.get(u)??[];l.push(a),n.set(u,l)}return Gjc(Array.from(n.entries()).map(([a,u])=>{let l=i.append(a.toString()).get(),d=this.idgen.get(`${t}/year/${a}`);return{id:d,type:"changelogYear",title:a.toString(),year:a,slug:l,icon:void 0,hidden:void 0,children:this.groupByMonth(d,u,i),authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),"year","desc")}groupByMonth(t,r,i){let n=new Map;for(let a of r){let u=f9n.default.utc(a.date).month()+1,l=n.get(u)??[];l.push(a),n.set(u,l)}return Gjc(Array.from(n.entries()).map(([a,u])=>{let l=(0,f9n.default)(new Date(0,a-1));return{id:this.idgen.get(`${t}/month/${a}`),type:"changelogMonth",title:l.format("MMMM YYYY"),month:a,slug:i.append(a.toString()).get(),icon:void 0,hidden:void 0,children:u,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),"month","desc")}toRelativeFilepath(t){if(t!=null)return Bq(this.docsWorkspace.absoluteFilePath,t)}};function Gjc(e,t,r="asc"){return e.concat().sort((i,n)=>{let a=typeof t=="function"?t(i):i[t],u=typeof t=="function"?t(n):n[t];return a<u?r==="asc"?-1:1:a>u?r==="asc"?1:-1:0})}function Meu(e){if(e)return{environments:e.environments!=null&&e.environments.length>0?e.environments.map(t=>So.V1.EnvironmentId(t)):void 0,button:e.button!=null&&e.button.href?{href:So.V1.Url(e.button.href)}:void 0,"limit-websocket-messages-per-connection":e.limitWebsocketMessagesPerConnection!=null?e.limitWebsocketMessagesPerConnection:void 0}}function Zxa({child:e,nodeIdToSubpackageId:t,convertApiDefinitionPackageId:r,mergeAndFilterChildren:i}){if(e.type==="apiPackage"){let n=So.V1.SlugGenerator.init(e.slug),u=(t.get(e.id)??[]).flatMap(s=>r(s,n)),l=e.children.map(s=>Zxa({child:s,nodeIdToSubpackageId:t,convertApiDefinitionPackageId:r,mergeAndFilterChildren:i})),d=i(l,u);return{...e,children:d,pointsTo:void 0}}return e}function d9n({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:i,apiDefinitionId:n}){if(i)return e;let a=[],u=new Map;return e.forEach(l=>{if(l.type!=="endpoint"){a.push(l);return}let d=t(l.endpointId);if(d==null)throw new Error(`Endpoint ${l.endpointId} not found`);let s=`${d.method} ${r(d)}`,o=u.get(s);if(u.set(s,l),o==null||o.isResponseStream===l.isResponseStream){a.push(l);return}let c=a.indexOf(o),b=l.isResponseStream?l:o,g=l.isResponseStream?o:l,O={id:So.V1.NodeId(`${n}:${g.endpointId}+${b.endpointId}`),type:"endpointPair",stream:b,nonStream:g};a[c]=O}),a}function Aeu({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:i,disableEndpointPairs:n,apiDefinitionId:a}){return d9n({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:i,disableEndpointPairs:n,apiDefinitionId:a}).filter(u=>u.type==="apiPackage"?u.children.length>0:!0)}function Tir(e,t){if(t!=null)return Bq(e.absoluteFilePath,t)}function qeu({docsWorkspace:e,page:t,parentSlug:r,idgen:i,markdownFilesToFullSlugs:n,markdownFilesToNoIndex:a,hideChildren:u}){let l=So.V1.PageId(Tir(e,t.absolutePath)),d=r.apply({fullSlug:n.get(t.absolutePath)?.split("/"),urlSlug:t.slug??Tq(t.title)});return{id:i.get(l),type:"page",pageId:l,title:t.title,slug:d.get(),icon:t.icon,hidden:u||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}var Teu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;workspace;hideChildren;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Map;#o=[];#s;#f;#u;disableEndpointPairs;constructor(t,r,i,n,a,u,l,d,s,o){this.apiSection=t,this.docsWorkspace=n,this.taskContext=a,this.markdownFilesToFullSlugs=u,this.markdownFilesToNoIndex=l,this.workspace=s,this.hideChildren=o,this.disableEndpointPairs=n.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=So.V1.ApiDefinitionId(r.id),this.#e=OAi.create(r,a),this.#u=d,this.#s=this.apiSection.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let c=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#f=i.apply({fullSlug:c?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??Tq(this.apiSection.title)}),this.apiSection.navigation!=null&&(this.#o=this.#l(this.apiSection.navigation,this.#e.api.rootPackage,this.#f)),this.#o=this.#O(this.#o.map(b=>this.#v(b)),this.#P(this.#e.api.rootPackage,this.#f))}get(){let t=So.V1.followRedirects(this.#o),r=new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.workspace?.changelog?.files.map(i=>i.absoluteFilepath),this.docsWorkspace,this.#u).orUndefined();return{id:this.#u.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#f.get(),icon:this.apiSection.icon,hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#f,viewers:void 0,hidden:this.hideChildren}),children:this.#o,availability:void 0,pointsTo:t,noindex:void 0,playground:this.#g(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#l(t,r,i){r=this.#e.resolveSubpackage(r);let n=r!=null?OAi.getSubpackageId(r):void 0;return t.map(a=>Xxa(a)._visit({link:u=>({id:this.#u.get(u.url),type:"link",title:u.text,icon:u.icon,url:So.Url(u.url)}),page:u=>this.#c(u,i),package:u=>this.#p(u,i),section:u=>this.#h(u,i),item:({value:u})=>this.#_(u,n,i),endpoint:u=>this.#y(u,n,i)})).filter(yv)}#c(t,r){return qeu({page:t,parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#u,hideChildren:this.hideChildren})}#p(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#e.getSubpackageByIdOrLocator(t.package);if(a!=null){let u=OAi.getSubpackageId(a),l=this.#u.get(i??`${this.apiDefinitionId}:${u}`);this.#i.has(u)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${u}`),this.#i.add(u),this.#a.set(l,[u]);let d=t.slug??(qir(a)?a.urlSlug:this.apiSection.slug??Tq(this.apiSection.title)),s=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:d}),o=this.#l(t.contents,a,s);return{id:l,type:"apiPackage",children:o,title:t.title??(qir(a)?a.displayName??OHt(a.name):this.apiSection.title),slug:s.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(`Subpackage ${t.package} not found in ${this.apiDefinitionId}, treating it as a section`);let u=t.slug??Tq(t.package),l=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),d=this.#l(t.contents,void 0,l);return{id:this.#u.get(i??`${this.apiDefinitionId}:${Tq(t.package)}`),type:"apiPackage",children:d,title:t.title??t.package,slug:l.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#h(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,u=this.#u.get(i??n??r.get()),l=t.referencedSubpackages.map(c=>{let b=this.#e.getSubpackageByIdOrLocator(c);return b!=null?OAi.getSubpackageId(b):void 0}).filter(c=>(c==null&&this.taskContext.logger.error(`Subpackage ${c} not found in ${this.apiDefinitionId}`),c!=null)).filter(yv);this.#a.set(u,l),l.forEach(c=>{this.#i.has(c)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${c}`),this.#i.add(c)});let d=t.slug??Tq(t.title),s=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:d}),o=this.#l(t.contents,void 0,s);return{id:u,type:"apiPackage",children:o,title:t.title,slug:s.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:a,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#_(t,r,i){t=t.trim();let n=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator(d_(t));if(n!=null){let a=OAi.getSubpackageId(n),u=this.#u.get(`${this.apiDefinitionId}:${a}`);this.#i.has(a)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a}`),this.#i.add(a),this.#a.set(u,[a]);let l=qir(n)?n.urlSlug:"",d=i.apply({urlSlug:l});return{id:u,type:"apiPackage",children:[],title:qir(n)?n.displayName??OHt(n.name):this.apiSection.title,slug:d.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#y({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,i)}#y(t,r,i){let n=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.endpoints.get(Y6.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(n!=null){let l=this.#e.getEndpointId(n);if(l==null)this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path.parts)}. Got undefined.`);else{this.#t.has(l)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${l}`),this.#t.add(l);let d=t.slug!=null?i.append(t.slug):i.apply(n);return{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"endpoint",method:n.method,endpointId:l,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.response?.type.type==="stream",title:t.title??n.name??rB(n.path.parts),slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let a=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.webSockets.get(Y6.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(a!=null){let l=this.#e.getWebSocketId(a);if(l==null)this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);else return this.#r.has(l)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${l}`),this.#r.add(l),{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"webSocket",webSocketId:l,title:t.title??a.name??rB(a.path.parts),slug:(t.slug!=null?i.append(t.slug):i.apply(a)).get(),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(a.availability),playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let u=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.webhooks.get(Y6.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(So.V1.WebhookId(t.endpoint));if(u!=null){let l=this.#e.getWebhookId(u);if(l==null)this.taskContext.logger.error(`Expected Webhook ID for ${u.id}. Got undefined.`);else return this.#n.has(l)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${l}`),this.#n.add(l),{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"webhook",webhookId:l,method:u.method,title:t.title??u.name??lb("/",...u.path),slug:(t.slug!=null?i.append(t.slug):i.apply(u)).get(),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#O(t,r){return Aeu({left:t,right:r,findEndpointById:i=>this.#e.endpoints.get(i),stringifyEndpointPathParts:i=>rB(i.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#v(t){return Zxa({child:t,nodeIdToSubpackageId:this.#a,convertApiDefinitionPackageId:(r,i)=>this.#j(r,i),mergeAndFilterChildren:this.#O.bind(this)})}#P(t,r){let i=[];return t.endpoints.forEach(n=>{let a=this.#e.getEndpointId(n);if(a==null){this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path.parts)}. Got undefined.`);return}if(this.#t.has(a))return;let u=r.apply(n);i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"endpoint",method:n.method,endpointId:a,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.response?.type.type==="stream",title:n.name??rB(n.path.parts),slug:u.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.websockets.forEach(n=>{let a=this.#e.getWebSocketId(n);if(a==null){this.taskContext.logger.error(`Expected WebSocket ID for ${n.id}. Got undefined.`);return}this.#r.has(a)||i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"webSocket",webSocketId:a,title:n.name??rB(n.path.parts),slug:r.apply(n).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(n=>{let a=this.#e.getWebhookId(n);if(a==null){this.taskContext.logger.error(`Expected Webhook ID for ${n.id}. Got undefined.`);return}this.#n.has(a)||i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"webhook",webhookId:a,method:n.method,title:n.name??OHt(n.id),slug:r.apply(n).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(n=>{if(this.#i.has(n))return;let a=this.#e.getSubpackageByIdOrLocator(n);if(a==null){this.taskContext.logger.error(`Subpackage ${n} not found in ${this.apiDefinitionId}`);return}let u=qir(a)?r.apply(a):r,l=this.#j(n,u);l.length>0&&i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${n}`),type:"apiPackage",children:l,title:qir(a)?a.displayName??OHt(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((n,a)=>{let u=n.type==="endpointPair"?n.nonStream.title:n.title,l=a.type==="endpointPair"?a.nonStream.title:a.title;return u.localeCompare(l)})),i}#j(t,r){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.error(`Subpackage ${t} not found in ${this.apiDefinitionId}`),[]):this.#P(i,r)}#g(t){return Meu(t)}mergeEndpointPairs(t){return d9n({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>rB(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}};var Ceu=class{#e={};#t={};#r={};#n={};constructor(t){for(let[r,i]of Object.entries(t.subpackages))this.#e[d_(r).toLowerCase()]=i,this.#e[`subpackage_${d_(r).toLowerCase()}`]=i;for(let[r,i]of Object.entries(t.endpoints)){this.#r[r]=i,this.#r[r.replace("endpoint_","")]=i,this.#r[r.replace("endpoint_","subpackage_")]=i;for(let n of[i.method,"STREAM"])i.environments?.forEach(a=>{this.#r[`${n} ${lb(a.baseUrl,rB(i.path))}`]=i,this.#r[`${n} ${lb(a.baseUrl,PFe(i.path))}`]=i;let u=Eeu(a);u!=null&&(this.#r[`${n} ${lb(u,rB(i.path))}`]=i,this.#r[`${n} ${lb(u,PFe(i.path))}`]=i)}),this.#r[`${i.method} ${rB(i.path)}`]=i,this.#r[`${i.method} ${PFe(i.path)}`]=i}for(let[r,i]of Object.entries(t.webhooks))this.#t[r]=i,this.#t[r.replace("webhook_","")]=i,this.#t[r.replace("webhook_","subpackage_")]=i,this.#t[`${i.method} ${i.path.join("/")}`]=i;for(let[r,i]of Object.entries(t.websockets))this.#n[r]=i,this.#n[r.replace("websocket_","")]=i,this.#n[r.replace("websocket_","subpackage_")]=i,this.#n[`STREAM ${rB(i.path)}`]=i,this.#n[`STREAM ${PFe(i.path)}`]=i}getSubpackageByLocator(t){if(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"].some(i=>t.includes(i)))return;let r=t.replace(".yml","").replace(".yaml","");return this.#e[r]}getWebhookByLocator(t,r){return this.#t[t]??this.#t[`${r}.${t}`]??this.#t[`webhook_${r}.${t}`]}getEndpointByLocator(t,r){return this.#r[t]??this.#r[`${r}.${t}`]??this.#r[`endpoint_${r}.${t}`]}getWebSocketByLocator(t,r){return this.#n[t]??this.#n[`${r}.${t}`]??this.#n[`websocket_${r}.${t}`]}};function kxa({item:e,parentSlug:t}){return t.apply({urlSlug:Tq(e.id.split(".").pop()??"")}).get()}var eRa=class{apiSection;workspace;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;hideChildren;apiDefinitionId;#e;#t;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#s=[];#f;#u;#l;#c=new Map;disableEndpointPairs;constructor(t,r,i,n,a,u,l,d,s,o){this.apiSection=t,this.workspace=n,this.docsWorkspace=a,this.taskContext=u,this.markdownFilesToFullSlugs=l,this.markdownFilesToNoIndex=d,this.hideChildren=o,this.#e=r,this.#t=new Ceu(r),this.disableEndpointPairs=a.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=So.V1.ApiDefinitionId(r.id),this.#l=s,this.#f=this.apiSection.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let c=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#u=i.apply({fullSlug:c?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??Tq(this.apiSection.title)}),this.apiSection.navigation!=null&&(this.#s=this.#p(this.apiSection.navigation,void 0,this.#u)),this.#s=this.#P(this.#s.map(b=>this.#j(b)),this.#g(this.#e,this.#u))}get(){let t=So.V1.followRedirects(this.#s),r=new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.workspace?.changelog?.files.map(i=>i.absoluteFilepath),this.docsWorkspace,this.#l).orUndefined();return{id:this.#l.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#f,paginated:this.apiSection.paginated,slug:this.#u.get(),icon:this.apiSection.icon,hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#u,viewers:void 0,hidden:this.hideChildren}),children:this.#s,availability:void 0,pointsTo:t,noindex:void 0,playground:this.#S(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#p(t,r,i){return t.map(n=>Xxa(n)._visit({link:a=>({id:this.#l.get(a.url),type:"link",title:a.text,icon:a.icon,url:So.Url(a.url)}),page:a=>this.#h(a,i),package:a=>this.#_(a,i),section:a=>this.#y(a,i),item:({value:a})=>this.#O(a,r,i),endpoint:a=>this.#v(a,r,i)})).filter(yv)}#h(t,r){return qeu({docsWorkspace:this.docsWorkspace,page:t,parentSlug:r,idgen:this.#l,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex})}#_(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#t.getSubpackageByLocator(t.package);if(a!=null){let u=this.#l.get(i??`${this.apiDefinitionId}:${a.id}`);this.#a.has(a.id)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a.id}`),this.#a.add(a.id),this.#o.set(u,[a.id]);let l=t.slug??Tq(a.name),d=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:l}),s=this.#p(t.contents,a.id,d),o={id:u,type:"apiPackage",children:s,title:t.title??a.displayName??OHt(a.name),slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return this.#c.set(a.id,o),o}else{this.taskContext.logger.warn(`Subpackage ${t.package} not found in ${this.apiDefinitionId}, treating it as a section`);let u=t.slug??Tq(t.package),l=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),d=this.#p(t.contents,t.package,l),s={id:this.#l.get(i??`${this.apiDefinitionId}:${Tq(t.package)}`),type:"apiPackage",children:d,title:t.title??t.package,slug:l.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return this.#c.set(t.package,s),s}}#y(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#l.get(i??n??r.get()),u=t.referencedSubpackages.map(c=>{let b=this.#t.getSubpackageByLocator(c);return b?.id}).filter(c=>(c==null&&this.taskContext.logger.error(`Subpackage ${c} not found in ${this.apiDefinitionId}`),c!=null)).filter(yv);this.#o.set(a,u),u.forEach(c=>{this.#a.has(c)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${c}`),this.#a.add(c)});let l=t.slug??Tq(t.title),d=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:l}),s=this.#p(t.contents,t.title,d),o={id:a,type:"apiPackage",children:s,title:t.title,slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return u.forEach(c=>{this.#c.set(c,o)}),o}#O(t,r,i){t=t.trim();let n=this.#t.getSubpackageByLocator(t);if(n!=null){let a=n.id,u=this.#l.get(`${this.apiDefinitionId}:${a}`);this.#a.has(a)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a}`),this.#a.add(a),this.#o.set(u,[a]);let l=Tq(n.name),d=i.apply({urlSlug:l}),s={id:u,type:"apiPackage",children:[],title:n.displayName??OHt(n.name),slug:d.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};return this.#c.set(a,s),s}return this.#v({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,i)}#v(t,r,i){let n=this.#t.getEndpointByLocator(t.endpoint,r);if(n!=null)if(this.#r.has(n.id)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${n.id}`),n.id==null)this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path)}. Got undefined.`);else{this.#r.add(n.id);let l=t.slug!=null?i.append(t.slug).get():kxa({item:n,parentSlug:i});return{id:this.#l.get(`${this.apiDefinitionId}:${n.id}`),type:"endpoint",method:n.method,endpointId:n.id,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.responses?.[0]?.body.type==="stream",title:t.title??n.displayName??rB(n.path),slug:l,icon:t.icon,hidden:this.hideChildren||t.hidden,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let a=this.#t.getWebSocketByLocator(t.endpoint,r);if(a!=null)if(this.#n.has(a.id)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${a.id}`),a.id==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}else return this.#n.add(a.id),{id:this.#l.get(`${this.apiDefinitionId}:${a.id}`),type:"webSocket",webSocketId:a.id,title:t.title??a.displayName??rB(a.path),slug:t.slug!=null?i.append(t.slug).get():kxa({item:a,parentSlug:i}),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(a.availability),playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};let u=this.#t.getWebhookByLocator(t.endpoint,r);if(u!=null)if(this.#i.has(u.id)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${u.id}`),u.id==null)this.taskContext.logger.error(`Expected Webhook ID for ${u.id}. Got undefined.`);else return this.#i.add(u.id),{id:this.#l.get(`${this.apiDefinitionId}:${u.id}`),type:"webhook",webhookId:u.id,method:u.method,title:t.title??u.displayName??lb("/",...u.path),slug:t.slug!=null?i.append(t.slug).get():kxa({item:u,parentSlug:i}),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#P(t,r){return Aeu({left:t,right:r,findEndpointById:i=>this.#t.getEndpointByLocator(i,void 0),stringifyEndpointPathParts:i=>rB(i.path),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#j(t){return Zxa({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(r,i)=>this.#E(r,i),mergeAndFilterChildren:this.#P.bind(this)})}#g(t,r){let i=[];return Object.entries(t.subpackages).forEach(([n,a])=>{if(!this.#a.has(n)){let u=this.#w(n,a,r);u!=null&&i.push(u)}}),Object.entries(t.endpoints).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected Endpoint ID for ${a.id} at path: ${l9n(a.method,a.path)}. Got undefined.`);return}!this.#r.has(JA.EndpointId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#m(n,a,r,i)}),Object.entries(t.websockets).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}!this.#n.has(JA.WebSocketId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#A(n,a,r,i)}),Object.entries(t.webhooks).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}!this.#i.has(JA.WebhookId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#d(n,a,r,i)}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&i.sort((n,a)=>{let u=n.type==="endpointPair"?n.nonStream.title:n.title,l=a.type==="endpointPair"?a.nonStream.title:a.title;return u.localeCompare(l)}),i}#w(t,r,i){let n=So.V1.SlugGenerator.init(i.get()).apply({urlSlug:Tq(r.name)}),a=this.#E(t,n),u={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"apiPackage",children:a,title:r.displayName??OHt(r.name),slug:n.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};return this.#c.set(t,u),a.length>0?u:void 0}#D(t,r,i,n){r.slug=kxa({item:t,parentSlug:i}),n.push(r)}#m(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"endpoint",method:r.method,endpointId:JA.EndpointId(t),apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(r.availability),isResponseStream:r.responses?.[0]?.body.type==="stream",title:r.displayName??rB(r.path),slug:i.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#A(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"webSocket",webSocketId:JA.WebSocketId(t),title:r.displayName??rB(r.path),slug:i.get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(r.availability),playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#d(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"webhook",webhookId:JA.WebhookId(t),method:r.method,title:r.displayName??OHt(r.id),slug:i.get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#T(t){let r=Object.fromEntries(Object.entries(this.#e?.subpackages??{}).filter(([u,l])=>t===this.#e.id?l.id.split(".").length===1:l.id!=null&&l.id.includes(t)&&l.id!==t&&l.id.split(".").length===t.split(".").length+1)),i=Object.fromEntries(Object.entries(this.#e?.endpoints??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t))),n=Object.fromEntries(Object.entries(this.#e?.websockets??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t))),a=Object.fromEntries(Object.entries(this.#e?.webhooks??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t)));return{id:JA.ApiDefinitionId(t),endpoints:i,websockets:n,webhooks:a,types:{},subpackages:r,auths:{},globalHeaders:void 0,snippetsConfiguration:void 0}}#E(t,r){let i=t!=null?this.#T(t):void 0;return i==null?(this.taskContext.logger.error(`Subpackage ${t} not found in ${this.apiDefinitionId}`),[]):this.#g(i,r)}#S(t){return Meu(t)}mergeEndpointPairs(t){return d9n({children:t,findEndpointById:r=>this.#e?.endpoints[r],stringifyEndpointPathParts:r=>rB(r.path),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}};var Ez_=ui(require("crypto"),1);function g4E(e){return Ez_.default.createHash("sha256").update(e).digest("hex")}var Beu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),g4E(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),i=0;for(;this.#t.has(r);)if(r=this.#r(t),i++,i>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return So.V1.NodeId(this.#n(t))}};function Ieu(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0}}var zeu=ui(PEe(),1);var Qjc=ui(PEe(),1);function Mz_(e,t,r){if(e.schemes.length>0&&e.schemes[0]!=null){let i=e.schemes[0];switch(i.type){case"basic":return{type:"basicAuth",passwordName:i.password.originalName,usernameName:i.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:i.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:i.name.wireValue,nameOverride:i.name.name.originalName,prefix:i.prefix,description:e.docs};case"oauth":{let n=i.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(a=>a.originalName).join(".")||"$.body.access_token";return r?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Qjc.FernRegistry.EndpointId(i.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:Qjc.FernRegistry.JqString(n),headerName:i.configuration.tokenHeader,tokenPrefix:i.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:jo(i)}}}var cm=ui(PEe(),1);var mAi=ui(PEe(),1);function qz_(e){return e._visit({alias:t=>({type:"alias",value:jE(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:e4(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>mAi.FernRegistry.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:mAi.FernRegistry.PropertyKey(r.name.wireValue),valueType:jE(r.valueType),availability:e4(r.availability),propertyAccess:r.propertyAccess})),extraProperties:P4E(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(i=>({key:mAi.FernRegistry.PropertyKey(i.name.wireValue),valueType:jE(i.valueType),availability:e4(i.availability),description:i.docs,propertyAccess:i.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(i=>({description:i.docs??void 0,discriminantValue:i.discriminantValue.wireValue,displayName:i.displayName,availability:i.availability!=null?e4(i.availability):void 0,additionalProperties:Gs.types.SingleUnionTypeProperties._visit(i.shape,{samePropertiesAsObject:n=>({extends:[mAi.FernRegistry.TypeId(n.typeId)],properties:r,extraProperties:void 0}),singleProperty:n=>({extends:[],properties:[{key:mAi.FernRegistry.PropertyKey(n.name.wireValue),valueType:jE(n.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+i.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:jE(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function jE(e){return e._visit({container:t=>Gs.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:jE(r)}),map:({keyType:r,valueType:i})=>({type:"map",keyType:jE(r),valueType:jE(i)}),optional:r=>({type:"optional",itemType:jE(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:jE(r)}),set:r=>({type:"set",itemType:jE(r)}),literal:r=>Gs.types.Literal._visit(r,{boolean:i=>({type:"literal",value:{type:"booleanLiteral",value:i}}),string:i=>({type:"literal",value:{type:"stringLiteral",value:i}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:mAi.FernRegistry.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:Gs.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>m4E(t.v2),float:()=>Az_(t.v2),double:()=>Az_(t.v2),string:()=>O4E(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function O4E(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function m4E(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function Az_(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function P4E(e){return typeof e=="boolean"?e?Kc.unknown():void 0:typeof e=="string"?{type:"id",value:mAi.FernRegistry.TypeId(e),default:void 0}:jE(e)}function Kjc(e,t){let r=e.service!=null?t.services[e.service]:void 0,i=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,n=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?w4E(r,t):[],webhooks:i!=null?j4E(i):[],websockets:n!=null?[S4E(n,t)]:[],types:e.types.map(a=>cm.FernRegistry.TypeId(a)),subpackages:e.subpackages.map(a=>cm.FernRegistry.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?cm.FernRegistry.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function j4E(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(i=>({payload:i.payload.jsonExample}))??[]),{description:t.docs??void 0,id:cm.FernRegistry.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??uUi(t.name.originalName),headers:t.headers.map(i=>({description:i.docs??void 0,key:i.name.wireValue,type:jE(i.valueType),availability:e4(i.availability)})),payload:B4E(t.payload),examples:r}})}function w4E(e,t){let r=[];for(let i of e.endpoints){let n=i.autogeneratedExamples[0],a=[];if(i.v2Examples!=null){let l,d=i.v2Examples.userSpecifiedExamples,s=i.v2Examples.autogeneratedExamples,o=Object.keys(d).length>1;for(let[b,g]of Object.entries(d))l=Tz_({shouldUseExampleName:o,exampleName:b,example:g,irEndpoint:i}),l!=null&&a.push(l);let c=Object.keys(s).length>1;for(let[b,g]of Object.entries(s))l=Tz_({shouldUseExampleName:c,exampleName:b,example:g,irEndpoint:i}),l!=null&&a.push(l)}else if(i.userSpecifiedExamples.length>0)a.push(...i.userSpecifiedExamples.map(l=>Jjc({userSpecifiedExample:l,...n!=null&&{autogeneratedExample:n},irEndpoint:i,ir:t})).filter(yv));else if(n!=null){let l=Jjc({autogeneratedExample:n,irEndpoint:i,ir:t});l!=null&&a.push(l)}else if(i.response?.body?.type==="fileDownload"){let l=zTa({ir:t,service:e,endpoint:{...i,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(l.type==="success"){let d=Jjc({autogeneratedExample:l,irEndpoint:i,ir:t});if(d!=null){let s={...d,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(s)}}}let u={slug:void 0,availability:e4(i.availability??e.availability),auth:i.auth,description:i.docs??void 0,method:A4E(i.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?cm.FernRegistry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?D4E({environmentsConfig:t.environments,endpoint:i}):void 0,id:cm.FernRegistry.EndpointId(i.name.originalName),originalEndpointId:i.id,name:i.displayName??uUi(i.name.originalName),path:i.basePath!=null?{pathParameters:i.pathParameters.map(l=>({description:l.docs??void 0,key:cm.FernRegistry.PropertyKey(l.name.originalName),type:jE(l.valueType),availability:void 0})),parts:[...p9n(i.basePath),...p9n(i.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...i.pathParameters].map(l=>({description:l.docs??void 0,key:cm.FernRegistry.PropertyKey(l.name.originalName),type:jE(l.valueType),availability:void 0})),parts:[...t.basePath!=null?p9n(t.basePath):[],...p9n(e.basePath),...p9n(i.path)]},queryParameters:i.queryParameters.map(l=>({description:l.docs??void 0,key:l.name.wireValue,type:jE(l.valueType),availability:e4(l.availability)})),headers:[...e.headers,...i.headers].map(l=>({description:l.docs??void 0,key:l.name.wireValue,type:jE(l.valueType),availability:e4(l.availability)})),request:i.requestBody!=null?q4E(i.requestBody):void 0,response:i.response!=null?T4E(i.response):void 0,errors:void 0,errorsV2:C4E(i.errors,t),examples:a,protocol:i.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:i.id}),proto:l=>({type:"grpc",methodName:i.id,methodType:l.methodType}),_other:()=>{}})};r.push(u)}return r}function S4E(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let i=Object.values(e.v2Examples.userSpecifiedExamples),n=Object.values(e.v2Examples.autogeneratedExamples),a=i.length>0?i[0]:n[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(u=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(u.type),body:u.body}))??[]})}else r=e.examples.map(i=>({name:i.name?.originalName,description:i.docs,path:i.url,pathParameters:i.pathParameters.reduce((n,a)=>(n[cm.FernRegistry.PropertyKey(a.name.originalName)]=a.value.jsonExample,n),{}),queryParameters:i.queryParameters.reduce((n,a)=>(n[a.name.wireValue]=a.value.jsonExample,n),{}),headers:i.headers.reduce((n,a)=>(n[a.name.wireValue]=a.value.jsonExample,n),{}),messages:i.messages.map(n=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(n.type),body:n.body.jsonExample}))}));return{auth:e.auth,availability:e4(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?cm.FernRegistry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?E4E({environmentsConfig:t.environments,channel:e}):[],id:cm.FernRegistry.WebSocketId(e.name.originalName),name:e.displayName??uUi(e.name.originalName),path:{pathParameters:e.pathParameters.map(i=>({description:i.docs??void 0,key:cm.FernRegistry.PropertyKey(i.name.originalName),type:jE(i.valueType),availability:void 0})),parts:p9n(e.path)},headers:e.headers.map(i=>({key:i.name.wireValue,type:jE(i.valueType),description:i.docs,availability:e4(i.availability)})),queryParameters:e.queryParameters.map(i=>({description:i.docs??void 0,key:i.name.wireValue,type:jE(i.valueType),availability:e4(i.availability)})),messages:e.messages.map(i=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(i.type),displayName:i.displayName,origin:i.origin,body:I4E(i.body),description:i.docs,availability:e4(i.availability)})),examples:r}}function e4(e){if(e!=null)switch(e.status){case"DEPRECATED":return cm.FernRegistry.Availability.Deprecated;case"PRE_RELEASE":return cm.FernRegistry.Availability.Beta;case"GENERAL_AVAILABILITY":return cm.FernRegistry.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return cm.FernRegistry.Availability.Beta;default:jo(e.status)}}function D4E({environmentsConfig:e,endpoint:t}){let r=e.environments,i=t.baseUrl,n=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:cm.FernRegistry.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(n!=null)return n.flatMap(u=>r.environments.map(l=>{let d=l.urls[u];if(d==null)throw new Error(`Expected environment ${l.id} to contain url for ${u}`);return{id:cm.FernRegistry.EnvironmentId(u),baseUrl:d}})).filter((u,l,d)=>l===d.findIndex(s=>s.id===u.id&&s.baseUrl===u.baseUrl));if(i==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let u=a.urls[i];if(u==null)throw new Error(`Expected environment ${a.id} to contain url for ${i}`);return{id:cm.FernRegistry.EnvironmentId(a.id),baseUrl:u}});default:jo(r)}}function E4E({environmentsConfig:e,channel:t}){let r=e.environments,i=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(n=>({id:cm.FernRegistry.EnvironmentId(n.id),baseUrl:M4E(n.url,"wss")}));case"multipleBaseUrls":if(i==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(n=>{let a=n.urls[i];if(a==null)throw new Error(`Expected environment ${n.id} to contain url for ${i}`);return{id:cm.FernRegistry.EnvironmentId(n.id),baseUrl:a}});default:jo(r)}}function M4E(e,t){return e.replace(/^[^:]+/,t)}function A4E(e){return Gs.http.HttpMethod._visit(e,{get:()=>cm.FernRegistry.HttpMethod.Get,post:()=>cm.FernRegistry.HttpMethod.Post,put:()=>cm.FernRegistry.HttpMethod.Put,patch:()=>cm.FernRegistry.HttpMethod.Patch,delete:()=>cm.FernRegistry.HttpMethod.Delete,head:()=>cm.FernRegistry.HttpMethod.Get,_other:()=>{throw new Error("Unknown http method: "+e)}})}function p9n(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:cm.FernRegistry.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function q4E(e){let t=Gs.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??_M.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(i=>cm.FernRegistry.TypeId(i.typeId)),properties:r.properties.map(i=>({description:i.docs??void 0,key:cm.FernRegistry.PropertyKey(i.name.wireValue),valueType:jE(i.valueType),availability:e4(i.availability),propertyAccess:void 0})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??_M.APPLICATION_JSON,shape:{type:"reference",value:jE(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(i=>i._visit({file:n=>{let a=n._visit({file:u=>({type:"file",key:cm.FernRegistry.PropertyKey(u.key.wireValue),isOptional:u.isOptional,contentType:u.contentType,description:u.docs??void 0,availability:void 0}),fileArray:u=>({type:"fileArray",key:cm.FernRegistry.PropertyKey(u.key.wireValue),isOptional:u.isOptional,contentType:u.contentType,description:u.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:n=>({type:"bodyProperty",key:cm.FernRegistry.PropertyKey(n.name.wireValue),valueType:jE(n.valueType),contentType:n.contentType,description:n.docs??void 0,availability:e4(n.availability),exploded:n.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(yv)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function T4E(e){if(e.body==null)return;let t,r=Gs.http.HttpResponseBody._visit(e.body,{fileDownload:i=>(t=i.docs,{type:"fileDownload",contentType:void 0}),json:i=>(t=i.docs,{type:"reference",value:jE(i.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:i=>{if(i.type==="text")return t=i.docs,{type:"streamingText"};if(i.type==="json")return t=i.docs,{type:"stream",shape:{type:"reference",value:jE(i.payload)},terminator:i.terminator};if(i.type==="sse")return t=i.docs,{type:"stream",shape:{type:"reference",value:jE(i.payload)},terminator:i.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function C4E(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let i of e){let n=t.errors[i.error.errorId];n&&r.push({type:n.type==null?void 0:{type:"alias",value:jE(n.type)},statusCode:n.statusCode,description:n.docs??void 0,name:n.displayName??n.name.name.originalName,availability:void 0,examples:n.examples.map(a=>({name:a.name?.originalName,responseBody:{type:"json",value:a.jsonExample},description:a.docs}))})}else for(let i of e){let n=t.errors[i.error.errorId];if(n){let a=[{key:cm.FernRegistry.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:n.discriminantValue.name.originalName}},description:n.docs,availability:void 0,propertyAccess:void 0}];n.type!=null&&a.push({key:cm.FernRegistry.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:jE(n.type),description:n.docs,availability:void 0,propertyAccess:void 0}),r.push({type:n.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:n.statusCode,description:n.docs??void 0,availability:void 0,name:n.displayName??n.name.name.originalName,examples:n.examples.map(u=>({name:u.name?.originalName,responseBody:{type:"json",value:u.jsonExample},description:u.docs}))})}}return r}function Tz_({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:i}){if(r==null)return;let n=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:r.request?.headers??{},requestBody:r.request?.requestBody,requestBodyV3:i.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:a=>{if(r.request==null)return;let u={};if(Gj(r.request.requestBody)){let l=r.request.requestBody;for(let d of a.properties)d._visit({file:s=>{let o=l[s.key.wireValue];if(s.type==="file")u[s.key.wireValue]={type:"filename",value:typeof o=="string"?o:"<file1>"};else if(s.type==="fileArray"){let c=(Array.isArray(o)?o:[o]).filter(b=>typeof b=="string");u[s.key.wireValue]={type:"filenames",value:c}}},bodyProperty:s=>{if(s.style==="exploded"){let o=l[s.name.wireValue];u[s.name.wireValue]={type:"exploded",value:Array.isArray(o)?o:[o]}}else u[s.name.wireValue]={type:"json",value:l[s.name.wireValue]}},_other:Qze})}return{type:"form",value:u}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??i.response?.statusCode??200,responseBody:n??void 0,responseBodyV3:n!=null?r.response?.body?._visit({json:a=>({type:"json",value:a}),stream:a=>({type:"stream",value:a.map(u=>({type:"json",value:u}))}),error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(a=>({name:a.name,description:a.docs??void 0,install:void 0,language:a.language,code:a.code})).filter(yv)}}function Jjc({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:i}){let n=i.headers.map(l=>{let d=l.valueType.type==="container"&&l.valueType.container.type==="literal"?l.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}}):void 0;if(d!=null)return{name:l.name,value:{jsonExample:d,shape:Gs.ExampleTypeReferenceShape.primitive(Gs.ExamplePrimitive.string({original:d}))}}}).filter(yv),a=e?.example??t?.example;if(a==null)return;let{codeSamples:u}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((l,d)=>(l[cm.FernRegistry.PropertyKey(d.name.originalName)]=d.value.jsonExample,l),{}),queryParameters:a.queryParameters.reduce((l,d)=>(l[d.name.wireValue]=d.value.jsonExample,l),{}),headers:[...n,...a.serviceHeaders,...a.endpointHeaders].reduce((l,d)=>(l[d.name.wireValue]=d.value.jsonExample,l),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:l=>{if(a.request==null)return;let d={};if(Gj(a.request.jsonExample)){let s=a.request.jsonExample;for(let o of l.properties)o._visit({file:c=>{let b=s[c.key.wireValue];if(c.type==="file")d[c.key.wireValue]={type:"filename",value:typeof b=="string"?b:"<file1>"};else if(c.type==="fileArray"){let g=(Array.isArray(b)?b:[b]).filter(O=>typeof O=="string");d[c.key.wireValue]={type:"filenames",value:g}}},bodyProperty:c=>{if(c.style==="exploded"){let b=s[c.name.wireValue];d[c.name.wireValue]={type:"exploded",value:Array.isArray(b)?b:[b]}}else d[c.name.wireValue]={type:"json",value:s[c.name.wireValue]}},_other:Qze})}return{type:"form",value:d}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??Gs.http.ExampleResponse._visit(a.response,{ok:l=>l._visit({body:d=>d!=null?200:204,stream:d=>d.length>0?200:204,sse:d=>d.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+l.type)}}),error:({error:l})=>{let d=i.errors[l.errorId];if(d==null)throw new Error("Cannot find error "+l.errorId);return d.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:l=>l._visit({body:d=>d?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:l=>l.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:l=>l._visit({body:d=>d!=null?{type:"json",value:d.jsonExample}:void 0,stream:d=>({type:"stream",value:d.map(s=>s.jsonExample)}),sse:d=>({type:"sse",value:d.map(({event:s,data:o})=>({event:s,data:o.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+l.type)}}),error:l=>l.body!=null?{type:"json",value:l.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:u?.map(l=>wEe._visit(l,{language:d=>({language:d.language,code:d.code,name:d.name?.originalName,description:d.docs??void 0,install:d.install}),sdk:d=>({language:d.sdk,code:d.code,name:d.name?.originalName,description:d.docs??void 0,install:void 0}),_other:()=>{}})).filter(yv)}}function B4E(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>cm.FernRegistry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:cm.FernRegistry.PropertyKey(t.name.wireValue),valueType:jE(t.valueType),availability:e4(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:jE(e.payloadType)},description:e.docs};default:jo(e)}}function I4E(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>cm.FernRegistry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:cm.FernRegistry.PropertyKey(t.name.wireValue),valueType:jE(t.valueType),availability:e4(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:jE(e.bodyType)};default:jo(e)}}function ZZ({ir:e,snippetsConfig:t,playgroundConfig:r}){let i={types:{},subpackages:{},rootPackage:Kjc(e.rootPackage,e),auth:Mz_(e.auth,e,r),snippetsConfiguration:t,globalHeaders:e.headers.map(n=>({availability:e4(n.availability),description:n.docs??void 0,key:n.name.wireValue,type:jE(n.valueType)})),navigation:void 0};for(let[n,a]of Object.entries(e.types))i.types[zeu.FernRegistry.TypeId(n)]={description:a.docs??void 0,name:a.name.name.originalName,shape:qz_(a.shape),availability:e4(a.availability),displayName:a.name.displayName};for(let[n,a]of Object.entries(e.subpackages)){let u=a.service!=null?e.services[a.service]:void 0;i.subpackages[zeu.FernRegistry.api.v1.SubpackageId(n)]={subpackageId:zeu.FernRegistry.api.v1.SubpackageId(n),displayName:u?.displayName,name:a.name.originalName,description:a.docs??void 0,...Kjc(a,e)}}return i}var Yjc=ui(PEe(),1);async function Xjc({organization:e,workspace:t,context:r,token:i,audiences:n,snippetsConfig:a,playgroundConfig:u}){let l=hR({workspace:t,audiences:n,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new _R(r,t)}),d=zWi({token:i.value}),s=ZZ({ir:l,snippetsConfig:a,playgroundConfig:u}),o=await d.api.v1.register.registerApiDefinition({orgId:Yjc.FernRegistry.OrgId(e),apiId:Yjc.FernRegistry.ApiId(l.apiName.originalName),definition:s});if(o.ok)return r.logger.debug(`Registered API Definition ${o.body.apiDefinitionId}`),{id:o.body.apiDefinitionId,ir:l};switch(o.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",o.error)}}var z4E=new rKi({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function tRa(e,t,r){return Sxa(Pxa(ZZ({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0},playgroundConfig:r}),Y6.ApiDefinitionId(t),z4E))}var uh={};mo(uh,{AlgoliaSearchIndex:()=>Cz_,ApiDefinitionId:()=>kz_,ApiId:()=>ix_,Availability:()=>bx_,DocsConfigId:()=>nx_,EndpointId:()=>ox_,EndpointPathLiteral:()=>yx_,EnvironmentId:()=>ax_,FileId:()=>fx_,HttpMethod:()=>vx_,IndexSegmentId:()=>Bz_,JqString:()=>px_,OrgId:()=>tx_,PageId:()=>lx_,PayloadLocation:()=>$x_,PropertyKey:()=>_x_,PullRequestState:()=>Lx_,RoleId:()=>hx_,TokenId:()=>rx_,TypeId:()=>cx_,Url:()=>dx_,VersionId:()=>ex_,WebSocketId:()=>ux_,WebhookId:()=>sx_,algolia:()=>Zjc,api:()=>swc,commons:()=>cwc,diff:()=>gx_,docs:()=>bwc,generators:()=>Owc,git:()=>mwc,navigation:()=>wwc,sdks:()=>Dwc,snippets:()=>Wx_,snippetsFactory:()=>Hx_,templates:()=>Ewc,tokens:()=>Gx_});var Zjc={};mo(Zjc,{AlgoliaSearchIndex:()=>Cz_,IndexSegmentId:()=>Bz_});function Cz_(e){return e}function Bz_(e){return e}var swc={};mo(swc,{latest:()=>twc,v1:()=>uwc});var twc={};mo(twc,{AuthSchemeId:()=>Iz_,WebhookHttpMethod:()=>Nz_,auth:()=>kjc,commons:()=>zz_,endpoint:()=>xz_,type_:()=>Rz_,webhook:()=>ewc,websocket:()=>Fz_});var kjc={};mo(kjc,{AuthSchemeId:()=>Iz_});function Iz_(e){return e}var zz_={};var xz_={};var Rz_={};var ewc={};mo(ewc,{WebhookHttpMethod:()=>Nz_});var Nz_={Get:"GET",Post:"POST"};var Fz_={};var uwc={};mo(uwc,{SubpackageId:()=>Kz_,WebSocketMessageId:()=>Yz_,WebSocketMessageOrigin:()=>Xz_,WebhookHttpMethod:()=>Zz_,commons:()=>owc,db:()=>rwc,read:()=>nwc,register:()=>awc});var rwc={};mo(rwc,{endpoint:()=>Lz_});var Lz_={};var nwc={};mo(nwc,{SupportedLanguage:()=>Uz_,endpoint:()=>iwc,type_:()=>Vz_,webhook:()=>Wz_,websocket:()=>Hz_});var iwc={};mo(iwc,{SupportedLanguage:()=>Uz_});var Uz_={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var Vz_={};var Wz_={};var Hz_={};var awc={};mo(awc,{SourceId:()=>x4E,endpoint:()=>$z_,type_:()=>Gz_,webhook:()=>Qz_,websocket:()=>Jz_});var $z_={};var Gz_={};var Qz_={};var Jz_={};function x4E(e){return e}var owc={};mo(owc,{SubpackageId:()=>Kz_,WebSocketMessageId:()=>Yz_,WebSocketMessageOrigin:()=>Xz_,WebhookHttpMethod:()=>Zz_});function Kz_(e){return e}function Yz_(e){return e}var Xz_={Client:"client",Server:"server"};var Zz_={Get:"GET",Post:"POST"};var cwc={};mo(cwc,{ApiDefinitionId:()=>kz_,ApiId:()=>ix_,Availability:()=>bx_,DocsConfigId:()=>nx_,EndpointId:()=>ox_,EndpointPathLiteral:()=>yx_,EnvironmentId:()=>ax_,FileId:()=>fx_,HttpMethod:()=>vx_,JqString:()=>px_,OrgId:()=>tx_,PageId:()=>lx_,PropertyKey:()=>_x_,RoleId:()=>hx_,TokenId:()=>rx_,TypeId:()=>cx_,Url:()=>dx_,VersionId:()=>ex_,WebSocketId:()=>ux_,WebhookId:()=>sx_});function kz_(e){return e}function ex_(e){return e}function tx_(e){return e}function rx_(e){return e}function ix_(e){return e}function nx_(e){return e}function ax_(e){return e}function ox_(e){return e}function ux_(e){return e}function sx_(e){return e}function cx_(e){return e}function lx_(e){return e}function fx_(e){return e}function dx_(e){return e}function px_(e){return e}function _x_(e){return e}function hx_(e){return e}function yx_(e){return e}var vx_={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var bx_={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var gx_={};var bwc={};mo(bwc,{latest:()=>dwc,v1:()=>ywc,v2:()=>vwc});var dwc={};mo(dwc,{Layout:()=>mx_,MdxEngine:()=>R4E,TwitterCardSetting:()=>Px_,commons:()=>Ox_,frontmatter:()=>lwc,seo:()=>fwc});var R4E={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var Ox_={};var lwc={};mo(lwc,{Layout:()=>mx_});var mx_={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var fwc={};mo(fwc,{TwitterCardSetting:()=>Px_});var Px_={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var ywc={};mo(ywc,{commons:()=>hwc,db:()=>jx_,read:()=>wx_,write:()=>pwc});var jx_={};var wx_={};var pwc={};mo(pwc,{DocsRegistrationId:()=>F4E,FilePath:()=>N4E});function N4E(e){return e}function F4E(e){return e}var hwc={};mo(hwc,{ContentAlignment:()=>Mx_,FontDisplay:()=>Bx_,FontStyle:()=>Cx_,HeaderPosition:()=>Ax_,JsScriptStrategy:()=>Tx_,ProgrammingLanguage:()=>Sx_,SearchbarPlacement:()=>Dx_,TabsPlacement:()=>Ex_,TwitterCardSetting:()=>qx_,commons:()=>_wc});var _wc={};mo(_wc,{ContentAlignment:()=>Mx_,FontDisplay:()=>Bx_,FontStyle:()=>Cx_,HeaderPosition:()=>Ax_,JsScriptStrategy:()=>Tx_,ProgrammingLanguage:()=>Sx_,SearchbarPlacement:()=>Dx_,TabsPlacement:()=>Ex_,TwitterCardSetting:()=>qx_});var Sx_={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var Dx_={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var Ex_={Header:"HEADER",Sidebar:"SIDEBAR"};var Mx_={Center:"CENTER",Left:"LEFT"};var Ax_={Fixed:"FIXED",Absolute:"ABSOLUTE"};var qx_={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var Tx_={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var Cx_={Normal:"normal",Italic:"italic"};var Bx_={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var vwc={};mo(vwc,{read:()=>Ix_,write:()=>zx_});var Ix_={};var zx_={};var Owc={};mo(Owc,{ChangelogEntryType:()=>Rx_,GeneratorId:()=>L4E,GeneratorLanguage:()=>U4E,ReleaseType:()=>Nx_,cli:()=>xx_,commons:()=>gwc,versions:()=>Fx_});var xx_={};var gwc={};mo(gwc,{ChangelogEntryType:()=>Rx_,ReleaseType:()=>Nx_});var Rx_={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var Nx_={Ga:"GA",Rc:"RC"};var Fx_={};function L4E(e){return e}var U4E={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var mwc={};mo(mwc,{PullRequestState:()=>Lx_});var Lx_={Open:"open",Closed:"closed",Merged:"merged"};var wwc={};mo(wwc,{latest:()=>Pwc,v1:()=>jwc});var Pwc={};mo(Pwc,{NodeId:()=>H4E,ProductId:()=>$4E,Slug:()=>V4E,TabId:()=>W4E});function V4E(e){return e}function W4E(e){return e}function H4E(e){return e}function $4E(e){return e}var jwc={};mo(jwc,{NavigationV1Availability:()=>Y4E,NodeId:()=>J4E,ProductId:()=>K4E,Slug:()=>G4E,TabId:()=>Q4E});function G4E(e){return e}function Q4E(e){return e}function J4E(e){return e}function K4E(e){return e}var Y4E={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var Dwc={};mo(Dwc,{Language:()=>Ux_,VersionBump:()=>Vx_,versions:()=>Swc});var Swc={};mo(Swc,{Language:()=>Ux_,VersionBump:()=>Vx_});var Ux_={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var Vx_={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var Wx_={};var Hx_={};var Ewc={};mo(Ewc,{PayloadLocation:()=>$x_});var $x_={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var Gx_={};var _9n=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function Gd(e){return e!=null}var Jx_=ui(SCn(),1);var Qx_=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function Cir(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,Jx_.default)(e,{special:Qx_}).replace(/V\s(\d)/g,"V$1")}function xeu({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(i=>{let n=[];i.namespace?.forEach(a=>{let u=[...n,a],l=uh.api.v1.SubpackageId(u.join("."));r[l]={id:l,name:a,displayName:Cir(a)},n.push(a)})}),r}var Reu=class{errors=new _9n},h9n=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function Kx_(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var Neu=class extends Reu{},n_=class extends h9n{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){if(super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,n!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((u,l)=>u===this.accessPath[this.accessPath.length-a.length+l])||this.accessPath.push(...a)}r.logger.debug(`Processing ${Kx_(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},x3=class extends n_{},Qae=class extends x3{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var Yx_="x-fern-base-path",Xx_="x-fern-availability",Feu="x-fern-sdk-group-name",Zx_="x-fern-global-headers",kx_="x-fern-sdk-method-name";var eR_="x-fern-webhook",tR_="x-fern-access-token-locator",rR_="x-fern-basic",iR_="x-fern-username-variable-name",nR_="x-fern-password-variable-name",aR_="x-fern-bearer",oR_="x-fern-token-variable-name",uR_="x-fern-header",sR_="x-fern-header-variable-name",cR_="x-fern-server-name",lR_="x-fern-examples";var Leu=class extends n_{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[cR_]}convert(){if(this.serverName!=null)return this.serverName}};var Ueu=class extends n_{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,i])=>t.replace(`{${r}}`,i.default),this.input.url)??this.input.url,this.serverName=new Leu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:uh.EnvironmentId(t),baseUrl:this.url}}};function Bir(e,t,r,i){let n=e??[],a=new Set(n.map(l=>l.url)),u=(t??[]).filter(l=>!a.has(l.url)).map((l,d)=>new Ueu({input:l,context:r,accessPath:i,pathId:["servers",`${d}`]}));return[...n,...u]}function LS(e){return typeof e=="object"&&Gd(e)&&"$ref"in e&&typeof e.$ref=="string"}function iH(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(LS(n)&&(n=iH(n,t,r)),n)}function Veu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return LS(r)?iH(r,t,void 0):r}var PR_=ui(lz());var Weu=class extends n_{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[rR_];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var Heu=class extends n_{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[nR_]}convert(){return this.passwordVariableName}};var $eu=class extends n_{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[iR_]}convert(){return this.usernameVariableName}};var Geu=class extends n_{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[aR_];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var Qeu=class extends n_{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[oR_]}convert(){return this.tokenVariableName}};function fR_(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var dR_="x-bearer-format",pR_="x-code-samples",_R_="x-codeSamples";var Jeu=class extends n_{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[dR_]}convert(){return this.bearerFormat}};var Keu=class extends n_{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[uR_];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var Yeu=class extends n_{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[sR_]}convert(){return this.headerVariableName}};function hR_(e){return e.type==="apiKey"}var y9n=class extends n_{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){hR_(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new Keu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new Yeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new Jeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function yR_(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function vR_(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function bR_(e){let t=[],r=e.length;if(r===0)return t;let i=0,n="",a="",u=!1;for(e.charCodeAt(0)===46&&(t.push(""),i++);i<r;){let l=e[i];a?l==="\\"&&i+1<r?(i++,n+=e[i]):l===a?a="":n+=l:u?l==='"'||l==="'"?a=l:l==="]"?(u=!1,t.push(n),n=""):n+=l:l==="["?(u=!0,n&&(t.push(n),n="")):l==="."?n&&(t.push(n),n=""):n+=l,i++}return n&&t.push(n),t}function Mwc(e,t,r){if(e==null)return r;switch(typeof t){case"string":{let i=e[t];return i===void 0?yR_(t)?Mwc(e,bR_(t),r):r:i}case"number":case"symbol":{typeof t=="number"&&(t=vR_(t));let i=e[t];return i===void 0?r:i}default:{if(Array.isArray(t))return X4E(e,t,r);Object.is(t?.valueOf(),-0)?t="-0":t=String(t);let i=e[t];return i===void 0?r:i}}}function X4E(e,t,r){if(t.length===0)return r;let i=e;for(let n=0;n<t.length;n++){if(i==null)return r;i=i[t[n]]}return i===void 0?r:i}function gR_(e){return function(t){return Mwc(t,e)}}function Awc(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(Awc).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Xeu(e,t){switch(t=t??ST_,typeof t){case"string":case"symbol":case"number":case"object":return aL(e,gR_(t));case"function":return aL(e,t)}}function OR_(e){return typeof e!="string"&&(e=Awc(e)),e.replace(/['\u2019]/g,"")}function mHt(e){return tE_(OR_(e))}function yA(e){if(e!=null)return Array.isArray(e)?e:[e]}function Zeu({namespace:e,path:t,method:r,sdkMethodName:i,operationId:n,displayName:a,isWebhook:u}){if(t==null)return;let l=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(i==null&&n==null&&a==null&&l==null))return`${Z4E(u)}${k4E(e)}.${e2E(i,n,a,l)}`}function Z4E(e){return e?"webhook_":"endpoint_"}function k4E(e){return e!=null?yA(e)?.map(t=>mHt(t)).join("/"):""}function e2E(e,t,r,i){return e||t||mHt(r??"")||mHt(i??"")}function mR_(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var keu=class extends n_{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[tR_],this.accessTokenLocator!=null&&(mR_(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var etu=class extends n_{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new y9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new keu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=Zeu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:uh.EndpointId(r),accessTokenLocator:uh.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var v9n=class extends n_{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new Weu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new $eu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new Heu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new Geu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new Qeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{fR_(this.input)?(this.authScheme="header",this.headerAuthNode=new y9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new etu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new PR_.UnreachableCaseError(this.authScheme);return}}};var b9n=class extends n_{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(i=>{let n=Veu(i,this.context.document);if(n==null){this.context.errors.warning({message:`No auth scheme found for ${i}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new v9n({input:n,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[i]=a):this.context.errors.warning({message:`No auth scheme found for ${i}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[t,i]}).filter(Gd))}};var ttu=class extends n_{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[Yx_],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function jR_(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function wR_(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function g9n(e,t){return e==null?void 0:Object.entries(e).map(([i,n])=>yA(n.convert())?.map(u=>((t!=null&&!t.includes(i)||t==null&&!jR_(n))&&(u=wR_(u,u.type==="enum"?u.default:void 0)),{key:uh.PropertyKey(i),valueShape:u,description:n.description,availability:n.availability?.convert()})).filter(Gd)).filter(Gd).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(u=>[...a,u]):[[...a]]),[[]])}function rtu(e,t){return LS(e)?iH(e,t,void 0):e}function PAi(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function SR_(e,t){let r={...e};for(let[i,n]of Object.entries(t??{}))r[i]=[...r[i]??[],...n];return Object.keys(r).length>0?r:void 0}function DR_(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let i of e)for(let n of t)r.push({path:i.path??n.path,responseStatusCode:i.responseStatusCode??n.responseStatusCode,name:i.name??n.name,description:i.description??n.description,pathParameters:i.pathParameters??n.pathParameters,queryParameters:i.queryParameters??n.queryParameters,headers:i.headers??n.headers,requestBody:i.requestBody??n.requestBody,responseBody:i.responseBody??n.responseBody,snippets:{...n.snippets,...i.snippets}});return r}var ER_=ui(lz());var qwc=["decimal","decimal128","double-int","double","float","sf-decimal"],Twc=["int16","int32","int64","int8","sf-integer","uint8"],Cwc=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],Bwc=["beta","pre-release","in-development","generally-available","deprecated"];function R3(e,t){return LS(e)?iH(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var jFe=class extends n_{availability;constructor(t){super(t),this.safeParse()}parse(){if(R3(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[Xx_];r!=null&&(Bwc.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${Bwc.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return uh.Availability.Beta;case"in-development":return uh.Availability.InDevelopment;case"generally-available":return uh.Availability.GenerallyAvailable;case"deprecated":return uh.Availability.Deprecated;case void 0:return;default:new ER_.UnreachableCaseError(this.availability);return}}};var ntu=ui(lz());function MR_(e){return typeof e=="object"&&e!=null&&"language"in e}function AR_(e){return typeof e=="object"&&e!=null&&"sdk"in e}function qR_(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function TR_(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function itu(e){return typeof e=="object"&&e!=null&&"event"in e}function Iwc(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(itu)}function jAi(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function CR_(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var atu=class extends n_{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,i,n,a){super(t),this.path=r,this.successResponseStatusCode=i,this.requestBodyByContentType=n,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[lR_]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([n,a])=>{let u=typeof r=="object"?r[n]:void 0;switch(a.multipartType){case"file":return jAi(u)?[n,{type:"filenameWithData",filename:u.filename,data:uh.FileId(u.data)}]:u!=null?[n,{type:"filename",value:u}]:void 0;case"files":{if(Array.isArray(u)){if(u.every(l=>jAi(l)))return[n,{type:"filenamesWithData",value:u.map(l=>({filename:l.filename,data:uh.FileId(l.data)}))}];if(u.every(l=>typeof l=="string"))return[n,{type:"filenames",value:u}]}return}case"property":return[n,{type:"json",value:u}];case void 0:return;default:new ntu.UnreachableCaseError(a.multipartType);return}}).filter(Gd))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(i=>{let n=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(n!=null)switch(n.contentType){case"form-data":a=CR_(r.request)?this.convertFormDataExampleRequest(n,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new ntu.UnreachableCaseError(n.contentType);break}let u;switch(i.contentType){case"application/json":{qR_(r.response)&&(u={type:"json",value:r.response.body});break}case"text/event-stream":{Iwc(r.response)&&(u={type:"sse",value:r.response.stream.map(c=>({event:c.event,data:c.data}))});break}case"application/octet-stream":!Iwc(r.response)&&TR_(r.response)&&(u={type:"stream",value:r.response.stream});break;case void 0:break;default:new ntu.UnreachableCaseError(i.contentType);break}let l={};r["code-samples"]?.forEach(c=>{MR_(c)?c.language!=null&&(l[c.language]??=[],l[c.language]?.push({name:c.name,language:c.language,install:c.install,code:c.code,generated:!1,description:c.docs})):AR_(c)&&c.sdk!=null&&(l[c.sdk]??=[],l[c.sdk]?.push({name:c.name,language:c.sdk,install:void 0,code:c.code,generated:!1,description:c.docs}))});let d=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([c,b])=>[uh.PropertyKey(c),b])),s=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([c,b])=>[uh.PropertyKey(c),b])),o=Object.fromEntries(Object.entries(r.headers??{}).map(([c,b])=>[uh.PropertyKey(c),b]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,headers:Object.keys(o).length>0?o:void 0,requestBody:a,responseBody:u,snippets:l}}))}};var rRa=class extends n_{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[Feu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>uh.api.v1.SubpackageId(mHt(r)))}};var otu=class extends n_{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[kx_]}convert(){return this.sdkMethodName}};var utu=class extends n_{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[eR_]}convert(){return this.isWebhook}};var stu=class extends n_{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[pR_]??[],...this.input[_R_]??[]],this.codeSamples.forEach(t=>{[...Object.values(uh.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var pKi=ui(lz());function zwc(e,t){return LS(e)?iH(e,t,void 0):e}function BR_(e,t){return e.replace(/{(\w+)}/g,(r,i)=>t[i]!=null&&typeof t[i]=="string"||typeof t[i]=="number"||typeof t[i]=="boolean"?`${t[i]}`:r)}var lL="",Iir=class extends n_{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,i,n,a){super(t),this.path=r,this.responseStatusCode=i,this.name=n,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,i])=>{let n=this.resolvedRequestInput?.value[r];switch(i.multipartType){case"file":return t&&(jAi(n)||typeof n=="string");case"files":return t&&Array.isArray(n)&&n.every(a=>jAi(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new pKi.UnreachableCaseError(i.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=zwc(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=zwc(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(itu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,i])=>{let n=this.resolvedRequestInput?.value?.[r];switch(i.multipartType){case"file":return jAi(n)?[r,{type:"filenameWithData",filename:n.filename,data:uh.FileId(n.data)}]:[r,{type:"filename",value:n}];case"files":{if(Array.isArray(n)){if(n.every(a=>jAi(a)))return[r,{type:"filenamesWithData",value:n.map(a=>({filename:a.filename,data:uh.FileId(a.data)}))}];if(n.every(a=>typeof a=="string"))return[r,{type:"filenames",value:n}]}return}case"property":return[r,{type:"json",value:n}];case void 0:return;default:new pKi.UnreachableCaseError(i.multipartType);return}}).filter(Gd))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new pKi.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let i=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([u,l])=>[u,l.example({includeOptionals:!1,override:u})]));i=Object.keys(i).length>0?i:void 0;let n=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([u,l])=>l.required||l.inputExample!=null?[u,l.example({includeOptionals:!1,override:u})]:void 0).filter(Gd));n=Object.keys(n).length>0?n:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([u,l])=>l.required||l.inputExample!=null?[u,l.example({includeOptionals:!1,override:u})]:void 0).filter(Gd));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&n==null&&i==null))return{path:BR_(this.path,i??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?Cir(this.name):this.summary!=null?Cir(this.summary):void 0,description:this.convertDescription(),pathParameters:i,queryParameters:n,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function IR_(e,t){return LS(e)?iH(e,t,void 0):e}var QR_=ui(lz());var zR_="#/components/schemas/";function O9n(e){if(e.$ref.startsWith(zR_))return e.$ref.replace(zR_,"")}function _pi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function wAi(e){return typeof e.type=="string"&&e.type==="array"}function xR_(e){return e.type==="boolean"}function RR_(e){return e.type==="integer"}function SAi(e){return!Array.isArray(e.type)&&!wAi(e)}function NR_(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||SAi(t)||wAi(t))}function FR_(e){return"nullable"in e&&typeof e.nullable=="boolean"}function LR_(e){return e.type==="null"}function UR_(e){return e.type==="number"}function xwc(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function VR_(e){return e.type==="string"}var ctu=class extends Qae{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new Gq({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return yA(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var ltu=class extends x3{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var ftu=class extends Qae{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new Gq({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(Gd)}convert(){if(this.typeNodes==null)return;let i=this.typeNodes.map(n=>yA(n.convert())?.map(u=>({displayName:n.name,shape:u,description:n.description,availability:n.availability?.convert()}))).filter(Gd).reduce((n,a)=>n.flatMap(u=>a.length>0?a.map(l=>[...u,l]):[[...u]]),[[]]).map(n=>({type:"undiscriminatedUnion",variants:n}));return this.nullable?i.map(_pi).filter(Gd):i}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function dtu(e){return e!=null&&e.length>0?e:[void 0]}var m9n=class extends Qae{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new Gq({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(LS(t))return O9n(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([i,n])=>[i,new Gq({input:n,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",i],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(Gd))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return g9n(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:yA(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(Gd)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(i=>dtu(r).map(n=>(this.extends==null||this.extends.length===0)&&i.length===0&&n!=null?{type:"alias",value:n}:{type:"object",extends:this.extends.map(a=>uh.TypeId(a)),properties:i,extraProperties:n}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(i=>{let n=R3(i,this.context.document);n!=null&&(r={...r,...Object.fromEntries(Object.entries(n.properties??{}).map(([a,u])=>[a,new Gq({input:u,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((i,n)=>{let a=r?.[n];return i[n]=a?.example({includeOptionals:t,override:n}),i},{}):Object.entries(r).reduce((i,[n,a])=>(i[n]=a?.example({includeOptionals:t,override:n}),i),{}))}};var ptu=class extends Qae{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>R3(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>R3(t,this.context.document)?.type!=="null"?new Gq({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(Gd);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([i,n])=>{let a=R3({$ref:n},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${n}`,path:[...this.accessPath,"discriminator","mapping",i]});return}r[i]=new Gq({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",i],pathId:i,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let n=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(Gd);return this.isNullable&&n!=null?n.map(_pi).filter(Gd):n}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:uh.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([n,a])=>yA(a.convert())?.map(l=>{if(!(l==null||l.type!=="object"))return{discriminantValue:n,displayName:a.name??Cir(n),availability:a.availability?.convert(),description:a.description,...l}}).filter(Gd)).filter(Gd)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(n=>yA(n.convert())?.map(u=>{if(u==null)return;t+=1;let l=u.type==="object"?Cir(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:n.name??(u.type==="alias"&&u.value.type==="id"?Cir(u.value.id):l),shape:u,description:n.description,availability:n.availability?.convert()}}).filter(Gd)).filter(Gd)}:void 0,i=this.isNullable?_pi(r):r;return i!=null?[i]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var _tu=class extends x3{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var DAi=class extends x3{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,i)=>{if(t){if(LS(r)){let n=R3(r,this.context.document);r=typeof n=="string"?n:typeof n?.default=="string"?n?.default:typeof n?.example=="string"?n.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${i}]`]}),t=!1;return}return r}}).filter(Gd),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var WR_=ui(lz());function t2E(e){return Twc.includes(e)}var htu=class extends x3{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(t2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${Twc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new WR_.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var ytu=class extends x3{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return _pi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var HR_=ui(lz());function r2E(e){return qwc.includes(e)}var vtu=class extends x3{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(r2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${qwc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new HR_.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var $R_=ui(lz());function i2E(e){return Cwc.includes(e)}var btu=class extends x3{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new $R_.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(i2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${Cwc.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new DAi({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var GR_=ui(lz());var gtu=class extends x3{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,GR_.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var _Ki=class extends Qae{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=O9n(this.input);let t=R3(this.input,this.context.document);t?.enum!=null&&SAi(t)&&(this.maybeEnumConverterNode=new DAi({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:uh.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=R3(this.input,this.context.document);if(r!=null)return new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var Gq=class e extends Qae{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),SAi(this.input)&&FR_(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),LS(this.input)){let t=O9n(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new _Ki({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new ltu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(NR_(this.input))this.typeShapeNode=new ftu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(SAi(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new ptu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(xwc(this.input)&&this.input.allOf!=null)this.typeShapeNode=new m9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(SAi(this.input)&&this.input.enum!=null)this.typeShapeNode=new DAi({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":xwc(this.input)&&(this.typeShapeNode=new m9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":wAi(this.input)&&(this.typeShapeNode=new ctu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":xR_(this.input)&&(this.typeShapeNode=new _tu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":RR_(this.input)&&(this.typeShapeNode=new htu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":UR_(this.input)&&(this.typeShapeNode=new vtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":VR_(this.input)&&(this.typeShapeNode=new btu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":LR_(this.input)&&(this.typeShapeNode=new ytu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new QR_.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new m9n({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new gtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!LS(this.input)&&(!wAi(this.input)&&this.input==null||wAi(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=yA(t)?.map(i=>this.nullable?_pi(i):i).filter(Gd);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function EAi(e){if(e!=null)return g9n(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(Gd))}var zir=class extends x3{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;LS(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new jFe({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let i=IR_(this.input,this.context.document);this.inputExample=i?.example??Object.values(i?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function JR_(e,t){return LS(e)?iH(e,t,void 0):e}var Rwc=ui(lz());function Otu(e){let{uniqueId:t,type:r,contextTypes:i,description:n,availability:a}=e;i[uh.TypeId(t)]={name:t,shape:r,description:n,availability:a}}var KR_=ui(WBs(),1),P9n=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,u){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=u}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=KR_.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function n2E(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var j9n=class extends n_{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),n2E(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],i)=>{let n;if(LS(r)?n=Veu(r.$ref,this.context.document):n=r,n!=null)return[t,new v9n({input:n,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${i}`]})]}).filter(Gd)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[uh.api.latest.AuthSchemeId(t),i]}).filter(Gd)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let i=r.name??t,n=yA(r.convert());return n==null?[t,void 0]:[uh.TypeId(t),{name:i,shape:n[0],description:r.description,availability:void 0}]}).filter(([t,r])=>Gd(r))):void 0}}};var mtu=class extends Gq{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=R3(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${LS(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=R3(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var Ptu=class extends n_{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let i=R3(this.input.schema,this.context.document);this.availability=new jFe({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=LS(this.input.schema)?new _Ki({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let n=P9n.parse(t);n?.containsJSON()?(this.contentType="json",this.schema=this.schema??new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):n?.isOctetStream()?(this.contentType="bytes",this.isOptional=i?.required==null):n?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=i?.required,this.fields=Object.fromEntries(Object.entries(i?.properties??{}).map(([a,u])=>{if(u!=null)return[a,new mtu({input:u,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(Gd))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[lL]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[lL]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:yA(t)?.map(i=>{let n=i.type;switch(n){case"object":case"alias":return i;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=mHt([this.method,this.path,this.contentType,"request"].join("_"));return Otu({uniqueId:a,type:i,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:uh.TypeId(a),default:i.type==="enum"&&i.default!=null?{type:"enum",value:i.default}:void 0}}}case void 0:return;default:new Rwc.UnreachableCaseError(n);return}}).filter(Gd)}convert(){if(this.schema instanceof _Ki)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([i,n])=>{switch(n.multipartType){case"file":return[{type:n.multipartType,key:uh.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"files":return[{type:n.multipartType,key:uh.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"property":{let a=yA(n.convert()),u=n.multipartType;return a?.map(l=>({type:u,key:uh.PropertyKey(i),contentType:n.contentType,exploded:void 0,valueShape:l,description:n.description,availability:n.availability?.convert()}))}case void 0:return[];default:return new Rwc.UnreachableCaseError(n.multipartType),[]}}).filter(Gd).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(u=>[...a,u]):[[...a]]),[[]]).map(i=>({type:"formData",fields:i,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var jtu=class extends n_{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let i=JR_(this.input,this.context.document);if(i==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(i.content).forEach(([n,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[n]=new Ptu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:n,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>yA(r.convert())?.map(n=>({description:this.description,contentType:t,body:n}))).filter(Gd)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>yA(t.convert())?.map(i=>{if(!(i.type!=="alias"&&i.type!=="object"))return{description:this.description,shape:i}})).filter(Gd)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var YR_={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function XR_(e,t){if(LS(e)){let r=iH(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var wtu=ui(lz());var ZR_="application/json";var kR_="application/octet-stream";function eN_(e,t){return e===t||t===lL||e===lL}var iRa=class extends n_{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,i,n,a,u,l,d){super(t),this.streamingFormat=i,this.path=n,this.method=a,this.statusCode=u,this.requests=l,this.shapes=d,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,i){for(let n of t)for(let[a,u]of Object.entries(n?.examples??{}))for(let[l,d]of Object.entries(r))for(let s of d)eN_(l,a)&&(i.add(l),this.examples?.push(new Iir({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,PAi(a,l),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let i=0;for(let n of t){let a=0;for(let[u,l]of r){if(a===i){let[d,s,o]=n??[void 0,void 0,void 0];this.examples?.push(...l.map(c=>new Iir({input:{requestExample:o,responseExample:c},context:this.context,accessPath:this.accessPath,pathId:s!=null&&s!==""?["examples",s]:"examples"},this.path,this.statusCode,PAi(s,u),{requestBody:d,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}i++}if(t.length>r.length)for(let n of t.slice(r.length)){let[a,u]=r[r.length-1]??[void 0,void 0],[l,d,s]=n??[void 0,void 0,void 0];this.examples?.push(...(u??[void 0]).map(o=>new Iir({input:{requestExample:s,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:d!=null&&d!==""?["examples",d]:"examples"},this.path,this.statusCode,PAi(d,a),{requestBody:l,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[n,a,u]=t[t.length-1]??[void 0,void 0,void 0];for(let[l,d]of r.slice(t.length))this.examples?.push(...d.map(s=>new Iir({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,PAi(a,l),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,i,n){let a=t[lL];if(a!=null)for(let u of a)this.examples?.push(new Iir({input:{requestExample:n,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:i!=null&&i!==""?["examples",i]:"examples"},this.path,this.statusCode,PAi(i,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let i of t)if(Object.keys(i.examples??{}).length===0)this.pushResponseExample(r,i,void 0,void 0);else for(let[n,a]of Object.entries(i.examples??{}))this.pushResponseExample(r,i,n,a)}parse(t){if(t==="empty")this.empty=!0;else{let l=P9n.parse(t);if(l?.isJSON()||l?.isEventStream())this.contentType=ZR_,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(l?.isOctetStream())this.contentType=kR_,this.contentSubtype=R3(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=Xeu(this.input.examples,l=>[l])),this.input.example!=null&&Object.keys(r).length===0&&(r[lL]??=[],r[lL]=[{value:this.input.example}]);let i=R3(this.input.schema,this.context.document);if(i!=null&&(i.examples!=null&&Object.keys(r).length===0&&(r=Xeu(i.examples,l=>[l])),i.example!=null&&Object.keys(r).length===0&&(r[lL]??=[],r[lL]?.push({value:i.example}))),Object.keys(r).length===0){let l=this.schema?.example({includeOptionals:!0,override:void 0});r[lL]??=[],r[lL]?.push(l!=null?{value:l}:void 0)}this.examples??=[];let n=new Set;this.matchRequestResponseExamplesByName(this.requests,r,n);let a=[];for(let l of this.requests)a.push(...Object.entries(l.examples??{}).filter(([d])=>!n.has(d)&&d!==lL).map(([d,s])=>[l,d,s]));let u=Object.entries(r).filter(([l,d])=>!n.has(l)&&Gd(d)&&l!==lL);Object.keys(r).every(l=>l===lL)||this.matchExamplesByIndex(a,u),!n.has(lL)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return yA(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new wtu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return yA(this.schema?.convert())?.map(r=>{let i=r.type;switch(i){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let n=mHt([this.method,this.path,this.statusCode,"response"].join("_"));return Otu({uniqueId:n,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:uh.TypeId(n),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new wtu.UnreachableCaseError(i);return}}).filter(Gd)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new wtu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var nRa=class extends n_{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,i,n,a,u){super(t),this.path=r,this.method=i,this.statusCode=n,this.requests=a,this.shapes=u,this.safeParse()}parse(t){this.description=this.input.description;let r=XR_(this.input,this.context.document);if(r==null){this.context.errors.error({message:LS(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([i,n])=>{this.headers??={},this.headers[i]=new zir({input:n,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:i})}),r.content==null?(this.responses??=[],this.responses.push(new iRa({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([i,n])=>{this.responses??=[],this.responses.push(new iRa({input:n,context:this.context,accessPath:this.accessPath,pathId:["content",i]},i,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(Gd)}};var Stu=class extends n_{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,i,n,a){super(t),this.path=r,this.method=i,this.requests=n,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,i])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new nRa({input:{...t,...i},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new nRa({input:i,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let i=r.convert();if(i!=null)return dtu(EAi(r.headers)).flatMap(n=>i?.map(a=>({headers:n,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(u=>(u.examples??[]).map(l=>l.convert()).filter(Gd))})))}).filter(Gd)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(i=>{let n=i.schema,a=yA(n?.convert());if(n!=null)return a?.map(u=>({statusCode:parseInt(t),shape:u,description:r.description??n.description,availability:n.availability?.convert(),name:n.name??YR_[parseInt(t)]??"UNKNOWN ERROR",examples:i.examples?.map(l=>{let d=l.convert();if(d!=null&&d.responseBody?.type==="json")return{name:d.name,description:d.description,responseBody:d.responseBody}}).filter(Gd)})).filter(Gd)})).filter(Gd)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var MAi=class extends n_{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,i){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new Iir({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,PAi(i,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=Bir(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new utu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((i,n)=>{if(LS(i)){let a=rtu(i,this.context.document);if(a!=null)i=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${i.$ref}`,path:[...this.accessPath,`parameters[${n}]`]});return}}i.in==="path"?i.schema!=null&&(this.pathParameters??={},this.pathParameters[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="query"?i.schema!=null&&(this.queryParameters??={},this.queryParameters[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="header"&&i.schema!=null&&(this.requestHeaders??={},this.requestHeaders[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name}))});for(let i of this.extractPathParameterIds()??[])this.pathParameters?.[i]==null&&this.context.errors.warning({message:`Path parameter not defined: ${i}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new stu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new jtu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new Stu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let i=this.requests?.requestBodiesByContentType;i==null||Object.keys(i).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(i).forEach(n=>{if(Object.keys(n.examples??{}).length===0){let a=n.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},n,void 0)}else Object.entries(n.examples??{}).forEach(([a,u])=>{this.pushEmptyResponseExample(u,n,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(i=>Number(i)>=200&&Number(i)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new b9n({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new rRa({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(i=>i.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((i,n)=>new rRa({input:{[Feu]:i},context:this.context,accessPath:this.accessPath,pathId:["tags",`${n}`]})));let r=new otu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(i=>Zeu({namespace:yA(i?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(Gd),this.xFernExamplesNode=new atu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(Gd)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((n,a)=>(n.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?n.push({type:"pathParameter",value:uh.PropertyKey(a.slice(1,-1).trim())}):n.push({type:"literal",value:a}),n),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},i=this.emptyResponseExamples?.map(o=>o.convert()).filter(Gd),n=DR_(this.xFernExamplesNode?.convert(),[...i??[],...t?.flatMap(o=>o.examples)??[]])?.map(o=>({...o,snippets:SR_(o.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((o,c)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:uh.WebhookId(o),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[c]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(b=>b.value.toString())??[],queryParameters:EAi(this.queryParameters)?.flat(),headers:EAi(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(Gd)}}).filter(Gd);let a=this.servers?.map(o=>o.convert()).filter(Gd),u=this.convertPathToPathParts();if(u==null)return;let l,d=this.auth?.convert();d!=null&&(l=Object.keys(d));let s=t?.flatMap(o=>o.headers).filter(Gd);return this.endpointIds.map((o,c)=>({id:uh.EndpointId(o),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[c]?.convert()?.map(b=>uh.api.v1.SubpackageId(b)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:u,auth:l?.map(b=>uh.api.latest.AuthSchemeId(b)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:EAi(this.pathParameters)?.flat(),queryParameters:EAi(this.queryParameters)?.flat(),requestHeaders:EAi(this.requestHeaders)?.flat(),responseHeaders:s!=null&&s.length>0?s:void 0,requests:this.requests?.convert(),responses:t?.map(b=>b.response),errors:r,examples:n,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var w9n=class extends n_{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i,isWebhook:n}){this.description=this.input.description;let a=Bir(t,this.input.servers,this.context,this.accessPath),u=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new MAi({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:u,method:"GET",basePath:i,isWebhook:n})),this.input.post!=null&&(this.post=new MAi({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:u,method:"POST",basePath:i,isWebhook:n})),this.input.put!=null&&(this.put=new MAi({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:u,method:"PUT",basePath:i,isWebhook:!1})),this.input.patch!=null&&(this.patch=new MAi({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:u,method:"PATCH",basePath:i,isWebhook:!1})),this.input.delete!=null&&(this.delete=new MAi({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:u,method:"DELETE",basePath:i,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(Gd)}};function Dtu(e){return"payloads"in e}var Etu=class extends n_{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.paths=Object.entries(this.input).map(([n,a])=>{if(a!=null)return new w9n({input:a,context:this.context,accessPath:this.accessPath,pathId:n,servers:Bir(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:i,isWebhook:void 0})}).filter(Gd)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(i=>{let n=i.convert();n?.forEach(a=>{Dtu(a)?r[uh.WebhookId(a.id)]=a:t[uh.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var Mtu=class extends n_{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Zx_]?.map(r=>{let{header:i,...n}=r;return(n.optional!=null&&!n.optional||rtu(n,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(i)),[i,new zir({input:n,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:i})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return g9n(this.globalHeaders,this.requiredProperties)?.flat()}};function tN_(e,t){if(LS(e)){let r=iH(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var Atu=class extends n_{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.webhooks=Object.entries(this.input??{}).map(([n,a])=>{let u=tN_(a,this.context.document);if(u!=null)return new w9n({input:u,context:this.context,accessPath:this.accessPath,pathId:n,servers:t,globalAuth:r,basePath:i,isWebhook:!0})}).filter(Gd)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(i=>{Dtu(i)&&(t[uh.WebhookId(i.id)]=i)}),t),{})}};var qtu=class extends n_{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=Bir(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new b9n({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new ttu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new Etu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new Atu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new j9n({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new Mtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=lae(),{webhookEndpoints:r,endpoints:i}=this.paths?.convert()??{},n={...this.webhooks?.convert()??{},...r??{}},a=xeu({endpoints:i,webhookEndpoints:n}),{types:u,auths:l}=this.components?.convert()??{};return{id:uh.ApiDefinitionId(t),endpoints:i??{},websockets:{},webhooks:n,types:{...u,...this.context.generatedTypes},subpackages:a,auths:{...l,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};var S9n=class extends h9n{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,this.pathId&&this.pathId!==this.accessPath[this.accessPath.length-1]&&(this.accessPath.push(this.pathId),r.logger.debug(`Processing #/${this.accessPath.join("/")}`))}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}};function wFe(e){return typeof e=="object"&&Gd(e)&&"$ref"in e&&typeof e.$ref=="string"}function PHt(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(wFe(n)&&(n=PHt(n,t,r)),n)}function rN_(e,t){return wFe(e)?PHt(e,t,{name:"",params:[],result:{name:"",schema:{type:"object"}}}):e}var oN_=ui(lz());function hpi(e){if(typeof e=="boolean")return e;if(e.enum!=null&&e.enum.length>0)return e.enum[0];if(e.const!=null)return e.const;if(e.examples!=null&&e.examples.length>0)return e.examples[0];if(e.type==="object"){let t={};if(e.properties!=null)for(let[r,i]of Object.entries(e.properties))t[r]=hpi(i);return t}if(e.type==="array")return e.items==null?[]:Array.isArray(e.items)?e.items.map(t=>hpi(t)):[hpi(e.items)];if(e.type==="string")return e.default??"string";if(e.type==="number"||e.type==="integer")return e.default??0;if(e.type==="boolean")return e.default??!1;if(e.type==="null")return null;if(e.oneOf?.[0]!=null)return hpi(e.oneOf[0]);if(e.anyOf?.[0]!=null)return hpi(e.anyOf[0]);if(e.allOf!=null&&e.allOf.length>0){let t={};for(let r of e.allOf)r!=null&&Object.assign(t,hpi(r));return t}}function aRa(e,t){return wFe(e)?PHt(e,t,{name:"",schema:{type:"object"}}):e}function iN_(e,t){return wFe(e)?PHt(e,t,void 0):e}function nN_(e,t){return wFe(e)?PHt(e,t,void 0):e}function aN_(e,t){return wFe(e)?PHt(e,t,void 0):e}var a2E={key:uh.PropertyKey("apiKey"),description:void 0,availability:void 0,valueShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}}},Ttu=class extends S9n{method;servers=[];constructor(t,r){super(t),this.method=t.input,this.servers=r,this.safeParse()}parse(){}convert(){try{let t=this.method.result?aRa(this.method.result,this.context.openrpc):void 0,r=t?new Gq({input:t.schema,context:this.context,accessPath:this.accessPath,pathId:"result",seenSchemas:new Set,nullable:void 0,schemaName:"Result"}).convert():void 0,n=this.method.params?.map(l=>aRa(l,this.context.openrpc)).filter(Gd)?.map(l=>{let d=new Gq({input:l.schema,context:this.context,accessPath:this.accessPath,pathId:["params",l.name],seenSchemas:new Set,nullable:void 0,schemaName:l.name}).convert();if(!d)return;let s=Array.isArray(d)?d[0]:d;if(s)return{key:uh.PropertyKey(l.name),valueShape:l.required?s:{type:"alias",value:{type:"optional",shape:s,default:void 0}},description:l.description,availability:void 0}}).filter(Gd),a=n.length>0?{contentType:"application/json",body:{type:"object",extends:[],properties:n,extraProperties:void 0},description:void 0}:void 0,u=this.method.examples?.map(l=>{let d=nN_(l,this.context.openrpc);if(d)return{name:d.name??"Example",path:"",description:void 0,snippets:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:d.params.length>0?{type:"json",value:Object.fromEntries(d.params.map(s=>{let o=iN_(s,this.context.openrpc);if(o)return[o.name??"",o.value]}).filter(Gd))}:void 0,responseStatusCode:200,responseBody:d.result?{type:"json",value:d.result}:void 0}}).filter(Gd)??[];if(u.length<=0){let l=hpi({type:"object",properties:Object.fromEntries(this.method.params?.map(s=>{let o=aRa(s,this.context.openrpc);return[o?.name??"",o?.schema??{}]})??[])}),d={name:"Example",path:"",pathParameters:{},queryParameters:{},headers:{},requestBody:{type:"json",value:l},responseStatusCode:200,responseBody:{type:"json",value:hpi(aRa(this.method.result,this.context.openrpc)?.schema??{})},snippets:void 0,description:void 0};u.push(d)}return{protocol:{type:"openrpc",methodName:this.input.name},id:uh.EndpointId(this.input.name),displayName:this.input.name,method:"POST",path:[{type:"pathParameter",value:uh.PropertyKey("apiKey")}],auth:void 0,pathParameters:[a2E],queryParameters:[],requests:a!=null?[a]:void 0,responses:r!=null?[this.convertToHttpResponse(r,this.input.description)].filter(Gd):[],errors:[],examples:u,description:this.input.description??this.input.summary,operationId:this.input.name,defaultEnvironment:void 0,environments:this.servers.map(l=>l.convert()).filter(Gd),availability:this.method.deprecated?"Deprecated":void 0,requestHeaders:[],responseHeaders:[],snippetTemplates:void 0,namespace:this.getNamespace()}}catch{this.context.errors.error({message:"Failed to convert method",path:this.accessPath});return}}getNamespace(){if(this.method.tags?.[0]==null)return;let t=aN_(this.method.tags[0],this.context.openrpc);if(t?.name!=null)return[uh.api.v1.SubpackageId(t.name)]}convertToHttpResponse(t,r){if(t==null)return;let n=yA(t)?.map(a=>{let u=a.type;switch(u){case"alias":return a;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":return;case"object":return a;default:new oN_.UnreachableCaseError(u);return}}).filter(Gd)[0];if(n)return{statusCode:200,body:n,description:r}}};var oRa=class extends S9n{servers=[];methods=[];components;constructor(t){super(t),this.safeParse()}parse(){if(this.context.openrpc.servers!=null&&(this.servers=Bir(this.servers,this.input.servers,this.context,this.accessPath)),this.input.methods!=null)for(let t of this.input.methods){let r=rN_(t,this.context.openrpc);r!=null&&this.methods.push(new Ttu({input:r,context:this.context,accessPath:this.accessPath,pathId:"methods"},this.servers))}this.context.openrpc.components!=null&&(this.components=new j9n({input:this.context.openrpc.components,context:this.context,accessPath:this.accessPath,pathId:"components"}))}convert(){let t=lae(),{types:r}=this.components?.convert()??{},i=this.methods?.map(u=>u.convert()).filter(Gd),n=Object.fromEntries(i?.map(u=>[u.id,u])??[]),a=xeu({endpoints:n});return{id:uh.ApiDefinitionId(t),types:r??{},endpoints:n,websockets:{},webhooks:{},subpackages:a,auths:{},globalHeaders:[],snippetsConfiguration:void 0}}};var uRa=class extends Neu{openrpc;logger;generatedTypes;constructor(t){super(),this.openrpc=t.openrpc,this.logger=t.logger,this.generatedTypes={}}get document(){return{openapi:"3.1.0",info:{title:"Mock API",version:"1.0.0"},paths:{},components:this.openrpc.components}}};async function sRa(e,t){if(e instanceof oir){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof fR))return;let r=new rHt(e.absoluteFilePath),i=await cFe({context:t,specs:e.specs}),n=await r.loadDocuments({context:t,specs:i}),a;for(let u of n){if(u.type!=="openapi")continue;let l={document:u.value,logger:t.logger,errors:new _9n,generatedTypes:{}},d=new qtu({input:u.value,context:l,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=aIs(a,d.convert())}return a}var uN_=require("fs/promises");async function sN_(e,t){let r=await(0,uN_.readFile)(e,"utf-8"),i=JSON.parse(r),n=new uRa({openrpc:i,logger:t.logger});return new oRa({input:i,context:n,accessPath:[],pathId:"openrpc"}).convert()}function o2E(e){return e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function u2E(e){return/^(https?:)?\/\//.test(e)}async function s2E({pathToImage:e,absolutePathToFernFolder:t}){if(e==null||u2E(e))return;let r=Gv(t,Na.of(e));if(await mf(r))return r}async function D9n({iconPath:e,filepaths:t,docsWorkspace:r}){if(o2E(e)){let i=await s2E({pathToImage:e,absolutePathToFernFolder:r.absoluteFilePath});i&&t.add(i)}}async function cN_({parsedDocsConfig:e,docsWorkspace:t}){let r=new Set;return e.logo?.dark!=null&&r.add(e.logo.dark),e.logo?.light!=null&&r.add(e.logo.light),e.favicon!=null&&r.add(e.favicon),e.backgroundImage?.dark!=null&&r.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&r.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&r.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&r.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&r.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&r.add(n.image)}),(await Nwc({navigation:e.navigation,docsWorkspace:t})).forEach(n=>{r.add(n)}),e.js!=null&&e.js.files.forEach(n=>{r.add(n.absolutePath)}),r}async function Nwc({navigation:e,docsWorkspace:t}){let r=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(i=>cRa({item:i,filepaths:r,docsWorkspace:t})));break;case"tabbed":await Promise.all(e.items.map(async i=>{i.icon!=null&&await D9n({iconPath:i.icon,filepaths:r,docsWorkspace:t}),i.child.type==="layout"&&i.child.layout!=null&&await Promise.all(i.child.layout.map(n=>cRa({item:n,filepaths:r,docsWorkspace:t})))}));break;case"versioned":await Promise.all(e.versions.map(async i=>{i.landingPage!=null&&await cRa({item:i.landingPage,filepaths:r,docsWorkspace:t}),(await Nwc({navigation:i.navigation,docsWorkspace:t})).forEach(a=>r.add(a))}));break;case"productgroup":await Promise.all(e.products.map(async i=>{i.landingPage!=null&&await cRa({item:i.landingPage,filepaths:r,docsWorkspace:t}),(await Nwc({navigation:i.navigation,docsWorkspace:t})).forEach(a=>r.add(a))}));break}return r}async function cRa({item:e,filepaths:t,docsWorkspace:r}){switch(e.type){case"page":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"section":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r}),await Promise.all(e.contents.map(i=>cRa({item:i,filepaths:t,docsWorkspace:r})));break;case"apiSection":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"link":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"changelog":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break}}async function lN_({navigation:e,apiWorkspaces:t,visitor:r,context:i}){l2E(e)?await Promise.all(e.map(async n=>{n.layout!=null&&await Promise.all(n.layout.map(async a=>{await Fwc({navigationItem:a,visitor:r,apiWorkspaces:t,context:i})}))})):await Promise.all(e.map(async n=>{await Fwc({navigationItem:n,visitor:r,apiWorkspaces:t,context:i})}))}async function Fwc({navigationItem:e,visitor:t,apiWorkspaces:r,context:i}){if(await WYt(e,{alphabetized:Go,api:Go,apiName:Go,audiences:Go,displayErrors:Go,snippets:Go,summary:Go,title:Go,layout:Go,icon:Go,slug:Go,hidden:Go,skipSlug:Go,paginated:Go,playground:Go,flattened:Go,path:Go,page:Go,featureFlag:Go,openrpc:Go,contents:async n=>{n!=null&&await Promise.all(n.map(async a=>{await Fwc({navigationItem:a,visitor:t,apiWorkspaces:r,context:i})}))},viewers:Go,orphaned:Go}),c2E(e)){let n=r.find(a=>a.workspaceName===e.apiName);n!=null&&await t.apiSection?.({config:e,workspace:n,context:i})}}function c2E(e){return e.api!=null}function l2E(e){return e[0]?.tab!=null}function kZ(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}fN_.default.extend(dN_.default);var f2E=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),Ctu=0,d2E=async({ir:e})=>(Ctu++,`${e.apiName.snakeCase.unsafeName}-${Ctu}`),p2E=async({api:e})=>(Ctu++,`${e.id}-${Ctu}`),jHt=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;registerApiV2;constructor(t,r,i,n,a,u,l=f2E,d=d2E,s=p2E){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=i,this.apiWorkspaces=n,this.taskContext=a,this.editThisPage=u,this.uploadFiles=l,this.registerApi=d,this.registerApiV2=s}#e=Beu.init();_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;async resolve(){this._parsedDocsConfig=await e6s({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig});let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await lN_({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:o})=>{(await o.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(b=>{let g=Bq(this.docsWorkspace.absoluteFilePath,b.absoluteFilepath);this.parsedDocsConfig.pages[g]=b.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages);for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=await vgc({markdown:c,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(o),context:this.taskContext});for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=await ygc({markdown:c,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(o),context:this.taskContext});let i=await cN_({parsedDocsConfig:this.parsedDocsConfig,docsWorkspace:this.docsWorkspace});for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:b,markdown:g}=exa(c,{absolutePathToMarkdownFile:this.resolveFilepath(o),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[Na.of(o)]=g;for(let O of b)i.add(O)}catch(b){throw this.taskContext.logger.error(`Failed to parse ${o}: ${b instanceof Error?b.message:String(b)}`),b}let n=Array.from(i).map(o=>({absoluteFilePath:o,relativeFilePath:this.toRelativeFilepath(o)}));(await this.uploadFiles(n)).forEach(o=>{this.collectedFileIds.set(o.absoluteFilePath,o.fileId)});let u=await this.getMarkdownFilesToFullyQualifiedPathNames();for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=hgc(c,this.collectedFileIds,u,{absolutePathToMarkdownFile:this.resolveFilepath(o),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let l={};Object.entries(this.parsedDocsConfig.pages).forEach(([o,c])=>{let b=_2E(this.editThisPage,o);l[_Ht.PageId(o)]={markdown:c,editThisPageUrl:b?_Ht.Url(b):void 0}});let d=await this.convertDocsConfiguration(),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let o=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async c=>{let b=Gv(this.docsWorkspace.absoluteFilePath,c);(await(0,Btu.stat)(b)).isDirectory()?(await cxe(b,"{js,ts,jsx,tsx,md,mdx}")).forEach(m=>{o.add(m)}):b.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&o.add(b)})),s=Object.fromEntries(await Promise.all([...o].map(async c=>{let b=this.toRelativeFilepath(c),g=(await(0,Btu.readFile)(c)).toString();return[b,g]})))}return{config:d,pages:l,jsFiles:s}}resolveFilepath(t){if(t!=null)return Gv(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return Bq(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[i,n]of Object.entries(t)){let u=(0,Lwc.default)(n).data.slug;typeof u=="string"&&u.trim().length>0&&r.set(this.resolveFilepath(i),u.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[i,n]of Object.entries(t)){let u=(0,Lwc.default)(n).data.noindex;typeof u=="boolean"&&r.set(this.resolveFilepath(i),u)}return r}async getMarkdownFilesToFullyQualifiedPathNames(){let t={},r=So.migrate.FernNavigationV1ToLatest.create().root(await this.toRootNode());return So.NodeCollector.collect(r).slugMap.forEach((n,a)=>{if(n==null||!So.isPage(n))return;let u=So.getPageId(n);if(u==null)return;let l=Ru(this.docsWorkspace.absoluteFilePath,Na.of(u));t[l]=a}),t}getDocsBasePath(){return new URL(kZ(this.domain)).pathname}async convertDocsConfiguration(){let t=await this.toRootNode();return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?_Ht.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(i=>({...i,url:_Ht.Url(i.url)})),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(i=>({...i,value:_Ht.Url(i.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];if(t.apiName!=null){let i=this.apiWorkspaces.find(n=>n.workspaceName===t.apiName);if(i!=null)return i}let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}getOpenApiWorkspaceForApiSection(t){if(this.ossWorkspaces.length===1&&this.ossWorkspaces[0]!=null)return this.ossWorkspaces[0];if(t.apiName!=null){let i=this.ossWorkspaces.find(n=>n.workspaceName===t.apiName);if(i!=null)return i}let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}async toRootNode(){let t=So.V1.SlugGenerator.init(So.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),i=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:i,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(n=>So.RoleId(n)),featureFlags:void 0}}async toRootChild(t){return iCn(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let i=So.PageId(this.toRelativeFilepath(t.absolutePath)),n=r.apply({urlSlug:t.slug??Tq(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(i),title:t.title,slug:n.get(),icon:t.icon,hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:i,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:i}){let n=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,i):void 0,u=r.type==="tabbed"?await this.convertTabbedNavigation(n,r.items,i):await this.toSidebarRootNode(n,r.items,i);return{type:"unversioned",id:n,landingPage:a,child:u}}async toVersionedNode(t,r){return{id:this.#e.get("versioned"),type:"versioned",children:await Promise.all(t.versions.map((n,a)=>this.toVersionNode(n,r,a===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:i}){let n=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,i):void 0;return{id:n,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(u=>this.toProductNode(u,i)))}}async toProductNode(t,r){let i=r.setProductSlug(t.slug??Tq(t.product)),n;switch(t.navigation.type){case"tabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,i)};break;case"untabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,i)};break;case"versioned":n=await this.toVersionedNode(t.navigation,i);break;default:jo(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:So.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:i.get(),child:n,default:!1,hidden:void 0,authed:void 0,icon:t.icon,image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}async toVersionNode(t,r,i){let n=this.#e.get(t.version),a=r.setVersionSlug(t.slug??Tq(t.version)),u=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(n,t.navigation.items,a):await this.toSidebarRootNode(n,t.navigation.items,a);return{type:"version",id:n,versionId:So.VersionId(t.version),title:t.version,slug:a.get(),child:u,default:i,availability:t.availability!=null?h2E(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags}}async toSidebarRootNode(t,r,i){let n=this.#e.get(`${t}/root`),a=await Promise.all(r.map(l=>this.toNavigationChild(n,l,i))),u=[];return a.forEach(l=>{if(l.type==="apiReference"){u.push(l);return}if(l.type==="section"&&!l.collapsed){u.push(l);return}let d=u.length>0?u[u.length-1]:void 0,s;d?.type==="sidebarGroup"?s=d:(s={id:this.#e.get(`${n}/group`),type:"sidebarGroup",children:[]},u.push(s)),s.children.push(l)}),{type:"sidebarRoot",id:n,children:u}}async toNavigationChild(t,r,i,n){return iCn(r)._visit({page:async a=>this.toPageNode(a,i,n),apiSection:async a=>this.toApiSectionNode(a,i,n),section:async a=>this.toSectionNode(t,a,i,n),link:async a=>this.toLinkNode(a),changelog:async a=>this.toChangelogNode(a,i,n)})}async toApiSectionNode(t,r,i){if(t.openrpc!=null){let b=Gv(this.docsWorkspace.absoluteFilePath,Na.of(t.openrpc));if(!await mf(b))throw new Error(`OpenRPC file does not exist at path: ${b}`);let g=await sN_(b,this.taskContext);if(g==null)throw new Error("Failed to generate API Definition from OpenRPC document");return await this.registerApiV2({api:g,apiName:t.apiName,snippetsConfig:Ieu(t.snippetsConfiguration)}),new eRa(t,g,r,void 0,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,i).get()}if(this.parsedDocsConfig.experimental?.openapiParserV2){let b=this.getOpenApiWorkspaceForApiSection(t),g=Ieu(t.snippetsConfiguration),O=await sRa(b,this.taskContext);if(O==null)throw new Error("Failed to generate API Definition from OpenAPI workspace");return await this.registerApiV2({api:O,snippetsConfig:g,apiName:t.apiName}),new eRa(t,O,r,b,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,i).get()}let n=Ieu(t.snippetsConfiguration),a,u,l=this.parsedDocsConfig.experimental?.openapiParserV3;if(l==null||l)try{a=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1})}catch{}a==null&&(u=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),a=hR({workspace:u,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new _R(this.taskContext,u)}));let s=await this.registerApi({ir:a,snippetsConfig:n,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName}),o=tRa(a,s,{oauth:t.playground?.oauth});return new Teu(t,o,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,u,i).get()}async toChangelogNode(t,r,i){return new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:t.icon,viewers:t.viewers,hidden:i||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:So.V1.Url(t.url),icon:t.icon}}async toPageNode(t,r,i){let n=So.PageId(this.toRelativeFilepath(t.absolutePath)),a=r.apply({urlSlug:t.slug??Tq(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(n),type:"page",slug:a.get(),title:t.title,icon:t.icon,hidden:i||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:n,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toSectionNode(t,r,i,n){let a=this.toRelativeFilepath(r.overviewAbsolutePath),u=a?So.PageId(a):void 0,l=this.#e.get(u??`${t}/section`),d=i.apply({urlSlug:r.slug??Tq(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),s=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,o=n||r.hidden;return{id:l,type:"section",overviewPageId:u,slug:d.get(),title:r.title,icon:r.icon,collapsed:r.collapsed,hidden:o,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(c=>this.toNavigationChild(l,c,d,o))),authed:void 0,pointsTo:void 0,noindex:s,featureFlags:r.featureFlags}}async convertTabbedNavigation(t,r,i){let n=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:n,children:await Promise.all(r.map(a=>this.toTabChild(n,a,i)))}}async toTabChild(t,r,i){return iCn(r.child)._visit({link:({href:n})=>this.toTabLinkNode(r,n),layout:({layout:n})=>this.toTabNode(t,r,n,i),changelog:({changelog:n})=>this.toTabChangelogNode(r,n,i)})}async toTabChangelogNode(t,r,i){return new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:i,title:t.title,icon:t.icon,viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r){return{type:"link",id:this.#e.get(r),title:t.title,url:So.V1.Url(r),icon:t.icon}}async toTabNode(t,r,i,n){let a=this.#e.get(`${t}/tab`),u=n.apply({urlSlug:r.slug??Tq(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:u.get(),icon:r.icon,hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,i,u),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):_Ht.FileId(r)}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:i}=this.parsedDocsConfig,n=r?.[t],a=i?.[t];return{logo:this.getFileId(n),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let i=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${i}`,variants:t.variants.map(n=>({fontFile:this.getFileId(n.absolutePath),weight:n.weight,style:n.style!=null?[n.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(yv),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:_Ht.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":i,...n}=this.parsedDocsConfig.metadata;return{...n,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(i)}}convertFileIdOrUrl(t){if(t!=null)return iCn(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:_Ht.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function _2E(e,t){if(e?.github==null)return;let{owner:r,repo:i,branch:n="main",host:a="https://github.com"}=e.github;return`${kZ(a)}/${r}/${i}/blob/${n}/fern/${t}?plain=1`}function h2E(e){switch(e){case"beta":return So.V1.NavigationV1Availability.Beta;case"deprecated":return So.V1.NavigationV1Availability.Deprecated;case"ga":return So.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return So.V1.NavigationV1Availability.Stable;default:jo(e)}}async function nH(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof fR?t:null))).filter(yv)}async function Uwc(e,t,r){if(e instanceof oir){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof fR))return;let i=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1});return ZZ({ir:i,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0},playgroundConfig:{oauth:!0}})}var l6_=ui(aru(),1),SMe=require("fs/promises"),Pru=require("os"),f6_=ui(QX(),1),d6_=ui(c6_(),1);var s9E="etag",R1c="preview",N1c="app-preview",c9E="bundle",l9E=".next",F1c=".fern";function f9E({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c))}function OKi({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c),Na.of(e?l9E:c9E))}function d9E({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c),Na.of(s9E))}async function ARa({bucketUrl:e,logger:t,preferCached:r,app:i=!1,tryTar:n=!1}){t.debug("Setting up docs preview bundle...");let a=await fetch(e);if(!a.ok)return{type:"failure"};let u=await a.text(),d=await new d6_.default.Parser().parseStringPromise(u),s=d?.ListBucketResult?.Contents?.[0]?.ETag?.[0],o=d?.ListBucketResult?.Contents?.[0]?.Key?.[0],c=d9E({app:i});if(r){let m=await mf(c),w;if(m&&(t.debug("Reading existing ETag"),w=(await(0,SMe.readFile)(c)).toString()),w!=null&&w===s)return t.debug("ETag matches. Using already downloaded bundle"),{type:"success"};t.debug("ETag is different. Downloading latest preview bundle"),i&&t.info(`Setting up docs preview bundle...
2044
+ ${JSON.stringify(r)}"`)}}function LI_(e,t,r,i){let n=r.resolveSourceOrThrow({source:t,relativeFilepath:e.relativeFilepath});if(n==null||n.type!=="protobuf")throw new Error(`Expected a protobuf source for ${t.proto}.`);let a=RI_({source:n,serviceNameOverride:i});if(a==null)throw new Error(`Failed to resolve service name from ${n.relativeFilePath}.`);return $xe.grpc({service:a})}function UI_({rootDefaultUrl:e,rootPathParameters:t,serviceDefinition:r,file:i,errorResolver:n,typeResolver:a,propertyResolver:u,exampleResolver:l,variableResolver:d,sourceResolver:s,globalErrors:o,workspace:c}){let b=c9n({pathParameters:r["path-parameters"],location:Gxe.Service,file:i,variableResolver:d}),g=NI_({file:i,serviceDeclaration:r,sourceResolver:s}),O={fernFilepath:i.fernFilepath};return{availability:Gae(r.availability),name:O,displayName:r["display-name"]??void 0,basePath:JN(r["base-path"]),headers:r.headers!=null?Object.entries(r.headers).map(([w,E])=>mFe({headerKey:w,header:E,file:i})):[],pathParameters:b,encoding:N6E(g,r),transport:g,endpoints:Object.entries(r.endpoints).map(([w,E])=>{let q=c9n({pathParameters:vHt(E),location:Gxe.Endpoint,file:i,variableResolver:d}),A={...lJ(E),id:"",name:i.casingsGenerator.generateName(w),displayName:E["display-name"],auth:E.auth??r.auth,idempotent:E.idempotent??r.idempotent??!1,baseUrl:E.url??r.url??e,v2BaseUrls:void 0,method:E.method!=null?R6E(E.method):YC.Post,basePath:E["base-path"]!=null?JN(E["base-path"]):void 0,path:JN(E.path),fullPath:JN(E["base-path"]!=null?lb(E["base-path"],E.path):i.rootApiFile["base-path"]!=null?lb(i.rootApiFile["base-path"],r["base-path"],E.path):lb(r["base-path"],E.path)),pathParameters:q,allPathParameters:E["base-path"]!=null?q:[...t,...b,...q],queryParameters:typeof E.request!="string"&&E.request?.["query-parameters"]!=null?Object.entries(E.request["query-parameters"]).map(([D,C])=>beu({file:i,queryParameterKey:D,queryParameter:C})):[],headers:typeof E.request!="string"&&E.request?.headers!=null?Object.entries(E.request.headers).map(([D,C])=>mFe({headerKey:D,header:C,file:i})):[],requestBody:kB_({request:E.request,file:i}),sdkRequest:nI_({service:r,request:E.request,endpoint:E,endpointKey:w,file:i,typeResolver:a,propertyResolver:u}),response:qI_({endpoint:E,file:i,typeResolver:a}),errors:[...xI_({errors:E.errors,file:i}),...o],userSpecifiedExamples:E.examples!=null?E.examples.map(D=>({example:AI_({service:r,endpoint:E,example:D,typeResolver:a,errorResolver:n,exampleResolver:l,variableResolver:d,file:i,workspace:c}),codeSamples:D["code-samples"]?.map(C=>aI_({codeSample:C,file:i}))})):[],autogeneratedExamples:[],pagination:zI_({propertyResolver:u,file:i,endpointName:w,endpointSchema:E}),transport:FI_({file:i,serviceTransport:g,endpointDeclaration:E,sourceResolver:s}),v2Examples:void 0,source:void 0,audiences:E.audiences};return A.id=jm.generateEndpointId(O,A),A}),audiences:r.audiences}}function c9n({pathParameters:e,location:t,file:r,variableResolver:i}){return e==null?[]:Object.entries(e).map(([n,a])=>z6E({parameterName:n,parameter:a,location:t,file:r,variableResolver:i}))}function z6E({parameterName:e,parameter:t,location:r,file:i,variableResolver:n}){return{...lJ(t),name:i.casingsGenerator.generateName(e),valueType:x6E({parameter:t,variableResolver:n,file:i}),location:r,variable:dxn(t)?n.getVariableIdOrThrow(typeof t=="string"?t:t.variable):void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function x6E({parameter:e,variableResolver:t,file:r}){let i=Kxa({parameter:e,variableResolver:t,file:r});return i.file.parseTypeReference(i.rawType)}function Kxa({parameter:e,variableResolver:t,file:r}){let i=Oeu({parameter:e,variableResolver:t,file:r});if(i==null)throw new Error("Cannot resolve path parameter");return i}function Oeu({parameter:e,variableResolver:t,file:r}){if(dxn(e)){let i=typeof e=="string"?e:e.variable,n=t.getDeclaration(i,r);return n==null?void 0:{rawType:typeof n.declaration=="string"?n.declaration:n.declaration.type,file:n.file}}else return{file:r,rawType:typeof e=="string"?e:e.type}}function R6E(e){switch(e){case"GET":return YC.Get;case"POST":return YC.Post;case"PUT":return YC.Put;case"PATCH":return YC.Patch;case"DELETE":return YC.Delete;case"HEAD":return YC.Head;default:jo(e)}}function mFe({headerKey:e,header:t,file:r}){let{name:i}=Air({headerKey:e,header:t});return{...lJ(t),name:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:i}),valueType:r.parseTypeReference(t),env:typeof t=="string"?void 0:t.env,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function Air({headerKey:e,header:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function N6E(e,t){switch(e.type){case"http":return{json:{},proto:void 0};case"grpc":return{json:void 0,proto:{}};default:jo(e)}}var VI_="1.0.0";var meu=class{ir;casingsGenerator;auth;authValues;generatorConfig;constructor(t){this.ir=t.ir,this.generatorConfig=t.generatorConfig,this.casingsGenerator=BZ({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??!1,keywords:void 0}),this.auth=this.convertAuth(this.ir.auth),this.authValues=this.getAuthValues(this.ir.auth)}convert({disableExamples:t}){return{version:VI_,types:this.convertNamedTypes(),headers:this.convertHeaders(),endpoints:this.convertEndpoints({disableExamples:t}),pathParameters:this.convertPathParameters({pathParameters:this.ir.pathParameters}),environments:this.ir.environments,generatorConfig:this.generatorConfig}}convertNamedTypes(){return Object.fromEntries(Object.entries(this.ir.types).map(([t,r])=>[t,this.convertTypeDeclaration(r)]))}convertHeaders(){return this.convertWireValueParameters({wireValueParameters:this.ir.headers})}convertEndpoints({disableExamples:t}){let r=this.getAllHttpEndpoints();return Object.fromEntries(r.map(i=>[i.id,this.convertEndpoint({endpoint:i,disableExamples:t})]))}convertEndpoint({endpoint:t,disableExamples:r}){let i=this.convertEndpointLocation({endpoint:t});return{auth:this.auth,declaration:this.convertDeclaration({name:t.name,fernFilepath:t.fernFilepath}),location:i,request:this.convertRequest({endpoint:t}),response:bs.Response.json(),examples:r?void 0:this.getEndpointSnippetRequests({endpoint:t,location:i})}}convertRequest({endpoint:t}){let r=this.convertPathParameters({pathParameters:[...t.servicePathParameters,...t.pathParameters]});if(t.sdkRequest==null&&t.requestBody==null)return bs.Request.body({pathParameters:r,body:void 0});if(t.sdkRequest==null)throw new Error(`Internal error; endpoint "${t.id}" has a request body but no SDK request`);switch(t.sdkRequest.shape.type){case"justRequestBody":return bs.Request.body({pathParameters:r,body:this.convertReferencedRequestBodyType({body:t.sdkRequest.shape.value})});case"wrapper":return this.convertInlinedRequest({fernFilepath:t.fernFilepath,wrapper:t.sdkRequest.shape,pathParameters:r,queryParameters:this.convertQueryParameters({queryParameters:t.queryParameters}),headers:this.convertWireValueParameters({wireValueParameters:[...t.serviceHeaders,...t.headers]}),body:t.requestBody});default:jo(t.sdkRequest.shape)}}convertReferencedRequestBodyType({body:t}){switch(t.type){case"bytes":return bs.ReferencedRequestBodyType.bytes();case"typeReference":return bs.ReferencedRequestBodyType.typeReference(this.convertTypeReference(t.requestBodyType));default:jo(t)}}convertInlinedRequest({fernFilepath:t,wrapper:r,pathParameters:i,queryParameters:n,headers:a,body:u}){return bs.Request.inlined({declaration:this.convertDeclaration({name:r.wrapperName,fernFilepath:t}),pathParameters:i,queryParameters:n,headers:a,body:u!=null?this.convertInlinedRequestBody({wrapper:r,body:u}):void 0,metadata:this.convertInlinedRequestMetadata({wrapper:r})})}convertInlinedRequestMetadata({wrapper:t}){return{includePathParameters:t.includePathParameters??!1,onlyPathParameters:t.onlyPathParameters??!1}}convertInlinedRequestBody({wrapper:t,body:r}){switch(r.type){case"inlinedRequestBody":{let i=[...r.extendedProperties??[],...r.properties];return bs.InlinedRequestBody.properties(this.convertWireValueParameters({wireValueParameters:i}))}case"reference":return bs.InlinedRequestBody.referenced({bodyKey:t.bodyKey,bodyType:bs.ReferencedRequestBodyType.typeReference(this.convertTypeReference(r.requestBodyType))});case"bytes":return bs.InlinedRequestBody.referenced({bodyKey:t.bodyKey,bodyType:bs.ReferencedRequestBodyType.bytes()});case"fileUpload":return this.convertFileUploadRequestBody({properties:r.properties});default:jo(r)}}convertFileUploadRequestBody({properties:t}){return bs.InlinedRequestBody.fileUpload({properties:this.convertFileUploadRequestBodyProperties({properties:t})})}convertFileUploadRequestBodyProperties({properties:t}){return t.map(r=>{switch(r.type){case"file":return this.convertFileUploadRequestBodyFileProperty({fileProperty:r.value});case"bodyProperty":return bs.FileUploadRequestBodyProperty.bodyProperty({name:r.name,typeReference:this.convertTypeReference(r.valueType)});default:jo(r)}})}convertFileUploadRequestBodyFileProperty({fileProperty:t}){switch(t.type){case"file":return bs.FileUploadRequestBodyProperty.file(t.key);case"fileArray":return bs.FileUploadRequestBodyProperty.fileArray(t.key);default:jo(t)}}convertPathParameters({pathParameters:t}){return t.map(r=>({name:{name:r.name,wireValue:r.name.originalName},typeReference:this.convertTypeReference(r.valueType)}))}convertWireValueParameters({wireValueParameters:t}){return t.map(r=>({name:{name:r.name.name,wireValue:r.name.wireValue},typeReference:this.convertTypeReference(r.valueType)}))}convertQueryParameters({queryParameters:t}){let r=[];for(let i of t){let n=this.convertTypeReference(i.valueType);i.allowMultiple&&(n=bs.TypeReference.list(n)),r.push({name:{name:i.name.name,wireValue:i.name.wireValue},typeReference:n})}return r}convertTypeReference(t){switch(t.type){case"container":return this.convertContainerType(t.container);case"named":return this.convertNamedType(t);case"primitive":return this.convertPrimitiveType(t.primitive);case"unknown":return this.convertUnknownType();default:jo(t)}}convertContainerType(t){switch(t.type){case"list":return bs.TypeReference.list(this.convertTypeReference(t.list));case"map":return bs.TypeReference.map({key:this.convertTypeReference(t.keyType),value:this.convertTypeReference(t.valueType)});case"optional":return bs.TypeReference.optional(this.convertTypeReference(t.optional));case"nullable":return bs.TypeReference.nullable(this.convertTypeReference(t.nullable));case"set":return bs.TypeReference.set(this.convertTypeReference(t.set));case"literal":return bs.TypeReference.literal(this.convertLiteral(t.literal));default:jo(t)}}convertNamedType(t){return bs.TypeReference.named(t.typeId)}convertTypeDeclaration(t){let r=this.convertDeclaration(t.name);switch(t.shape.type){case"alias":return this.convertAlias({declaration:r,alias:t.shape});case"enum":return this.convertEnum({declaration:r,enum_:t.shape});case"object":return this.convertObject({declaration:r,object:t.shape});case"union":return this.convertDiscriminatedUnion({declaration:r,union:t.shape});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({declaration:r,union:t.shape});default:jo(t.shape)}}convertAlias({declaration:t,alias:r}){return bs.NamedType.alias({declaration:t,typeReference:this.convertTypeReference(r.aliasOf)})}convertEnum({declaration:t,enum_:r}){return bs.NamedType.enum({declaration:t,values:r.values.map(i=>i.name)})}convertObject({declaration:t,object:r}){let i=[...r.extendedProperties??[],...r.properties];return this.convertObjectProperties({declaration:t,properties:i,additionalProperties:r.extraProperties})}convertObjectProperties({declaration:t,properties:r,additionalProperties:i}){return bs.NamedType.object({declaration:t,properties:this.convertWireValueParameters({wireValueParameters:r}),additionalProperties:i})}convertDiscriminatedUnion({declaration:t,union:r}){let i=[...this.resolveProperties(r.extends),...r.baseProperties];return bs.NamedType.discriminatedUnion({declaration:t,discriminant:r.discriminant,types:Object.fromEntries(r.types.map(n=>[n.discriminantValue.wireValue,this.convertDiscriminatedUnionType({inheritedProperties:i,discriminantValue:n.discriminantValue,singleUnionTypeProperties:n.shape})]))})}convertDiscriminatedUnionType({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperties:i}){switch(i.propertiesType){case"samePropertiesAsObject":return this.convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:i});case"singleProperty":return this.convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:i});case"noProperties":return this.convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r});default:jo(i)}}convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:i}){return bs.SingleDiscriminatedUnionType.samePropertiesAsObject({typeId:i.typeId,discriminantValue:r,properties:this.convertWireValueParameters({wireValueParameters:t})})}convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:i}){return bs.SingleDiscriminatedUnionType.singleProperty({typeReference:this.convertTypeReference(i.type),discriminantValue:r,properties:t.length>0?this.convertWireValueParameters({wireValueParameters:t}):void 0})}convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r}){return bs.SingleDiscriminatedUnionType.noProperties({discriminantValue:r,properties:t.length>0?this.convertWireValueParameters({wireValueParameters:t}):void 0})}convertUndiscriminatedUnion({declaration:t,union:r}){return bs.NamedType.undiscriminatedUnion({declaration:t,types:r.members.map(i=>this.convertTypeReference(i.type))})}convertLiteral(t){switch(t.type){case"boolean":return bs.LiteralType.boolean(t.boolean);case"string":return bs.LiteralType.string(t.string);default:jo(t)}}convertPrimitiveType(t){return bs.TypeReference.primitive(t.v1)}convertUnknownType(){return bs.TypeReference.unknown()}convertAuth(t){if(t.schemes[0]==null)return;let r=t.schemes[0];switch(r.type){case"basic":return bs.Auth.basic(r);case"bearer":return bs.Auth.bearer(r);case"header":return bs.Auth.header({header:{name:r.name,typeReference:this.convertTypeReference(r.valueType)}});case"oauth":return bs.Auth.oauth({clientId:this.casingsGenerator.generateName("clientId"),clientSecret:this.casingsGenerator.generateName("clientSecret")});default:jo(r)}}getAuthValues(t){let r=t.schemes[0];if(r!=null)switch(r.type){case"bearer":return bs.AuthValues.bearer({token:"<token>"});case"basic":return bs.AuthValues.basic({username:"<username>",password:"<password>"});case"header":return bs.AuthValues.header({value:"<value>"});case"oauth":return bs.AuthValues.oauth({clientId:"<clientId>",clientSecret:"<clientSecret>"});default:jo(r)}}convertDeclaration({name:t,fernFilepath:r}){return{name:t,fernFilepath:r}}convertEndpointLocation({endpoint:t}){return{method:t.method,path:this.getFullPathForEndpoint(t)}}getAllHttpEndpoints(){return Object.values(this.ir.services).flatMap(t=>t.endpoints.map(r=>({...r,servicePathParameters:t.pathParameters,serviceHeaders:t.headers,fernFilepath:t.name.fernFilepath})))}resolveProperties(t){let r=[];for(let i of t){let n=this.resolveObjectTypeOrThrow(i.typeId);r.push(...this.resolveProperties(n.extends)),r.push(...n.properties)}return Object.values(r)}resolveObjectTypeOrThrow(t){let r=this.ir.types[t];if(r==null)throw new Error(`Internal error; type "${t}" not found`);if(r.shape.type!=="object")throw new Error(`Internal error; type "${t}" is not an object`);return r.shape}getFullPathForEndpoint(t){let r="";t.fullPath.head.length>0&&(r=lb(r,t.fullPath.head));for(let i of t.fullPath.parts)r=lb(r,"{"+i.pathParameter+"}"),i.tail.length>0&&(r=lb(r,i.tail));return r.startsWith("/")?r:`/${r}`}getEndpointSnippetRequests({endpoint:t,location:r}){let i=[];for(let n of[...t.userSpecifiedExamples,...t.autogeneratedExamples])i.push({id:n?.example?.id??lae(),name:n?.example?.name?.originalName,endpoint:r,baseUrl:void 0,environment:void 0,auth:this.authValues,headers:Object.fromEntries([...n.example?.serviceHeaders??[],...n.example?.endpointHeaders??[]].map(a=>[a.name.wireValue,a.value.jsonExample])),pathParameters:Object.fromEntries([...n.example?.rootPathParameters??[],...n.example?.servicePathParameters??[],...n.example?.endpointPathParameters??[]].map(a=>[a.name.originalName,a.value.jsonExample])),queryParameters:Object.fromEntries([...n.example?.queryParameters??[]].map(a=>[a.name.wireValue,a.value.jsonExample])),requestBody:n.example?.request?.jsonExample});return i}};function WI_({ir:e,generationLanguage:t,smartCasing:r,disableExamples:i,generatorConfig:n}){return new meu({ir:e,generationLanguage:t,smartCasing:r,generatorConfig:n}).convert({disableExamples:i})}var fJ={};mo(fJ,{validateObjectExample:()=>cKi,validateTypeExample:()=>yeu,validateTypeReferenceExample:()=>cL});var Peu=class{subpackages={};rootPackage={docs:void 0,fernFilepath:{allParts:[],packagePath:[],file:void 0},websocket:void 0,service:void 0,types:[],errors:[],subpackages:[],webhooks:void 0,navigationConfig:void 0};addPackageRedirection({from:t,to:r}){let i=this.getPackageForFernFilepath(t);if(i.navigationConfig!=null)throw new Error("Found duplicate navigationConfig for package");i.navigationConfig={pointsTo:jm.generateSubpackageId(r)}}addDocs(t,r){let i=this.getPackageForFernFilepath(t);if(i.docs!=null)throw new Error("Found duplicate docs for package");i.docs=r}addSubpackage(t){this.getPackageForFernFilepath(t)}addType(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).types.push(t)}addError(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).errors.push(t)}addService(t,r){let i=this.getPackageForFernFilepath(r.name.fernFilepath);if(i.service!=null)throw new Error("Found duplicate service for "+t);i.service=t}addWebhookGroup(t,r){let i=this.getPackageForFernFilepath(r);if(i.webhooks!=null)throw new Error("Found duplicate webhook group for "+t);i.webhooks=t}addWebSocketChannel(t,r){let i=this.getPackageForFernFilepath(r);if(i.webhooks!=null)throw new Error("Found duplicate webhook group for "+t);i.websocket=t}build(t){t!=null&&(Object.entries(this.subpackages).forEach(([i,n])=>{t.hasSubpackageId(i)?this.subpackages[i]={...n,types:n.types.filter(a=>t.hasTypeId(a)),errors:n.errors.filter(a=>t.hasErrorId(a)),service:n.service!=null&&t.hasServiceId(n.service)?n.service:void 0,websocket:n.websocket!=null&&t.hasChannel(n.websocket)?n.websocket:void 0,subpackages:n.subpackages.filter(a=>t.hasSubpackageId(a))}:delete this.subpackages[i]}),this.rootPackage={...this.rootPackage,types:this.rootPackage.types.filter(i=>t.hasTypeId(i)),errors:this.rootPackage.errors.filter(i=>t.hasErrorId(i)),service:this.rootPackage.service!=null&&t.hasServiceId(this.rootPackage.service)?this.rootPackage.service:void 0,subpackages:this.rootPackage.subpackages.filter(i=>t.hasSubpackageId(i)),webhooks:this.rootPackage.webhooks!=null?this.rootPackage.webhooks:void 0});let r=new Set(this.getAllChildrenWithEndpoints(this.rootPackage));return{subpackages:fd(this.subpackages,(i,n)=>({...i,hasEndpointsInTree:r.has(n)})),rootPackage:{...this.rootPackage,hasEndpointsInTree:r.size>0||this.rootPackage.service!=null}}}sortRootPackage(t){if(!HI_(this.rootPackage.subpackages,t))throw new Error("Sorted subpackages differ from unsorted packages in root");this.rootPackage.subpackages=t}sortSubpackage(t,r){let i=this.subpackages[t];if(i==null)throw new Error("Subpackage does not exist: "+t);if(!HI_(i.subpackages,r))throw new Error("Sorted subpackages differ from unsorted packages");i.subpackages=r}getAllSubpackagesWithEndpoints(t){let r=this.subpackages[t];if(r==null)throw new Error("Subpackage does not exist: "+t);let i=this.getAllChildrenWithEndpoints(r);return(i.length>0||r.service!=null)&&i.push(t),i}getAllChildrenWithEndpoints(t){return t.subpackages.flatMap(r=>[...this.getAllSubpackagesWithEndpoints(r)])}getPackageForFernFilepath(t,r=0,i=this.rootPackage){let n=t.allParts[r];if(n==null)return i;let a=i.subpackages.map(s=>{let o=this.subpackages[s];if(o==null)throw new Error("Subpackage ID is invalid: "+s);return o}),u=r+1,l={allParts:t.allParts.slice(0,u),packagePath:t.packagePath.slice(0,u),file:u===t.allParts.length?t.file:void 0},d=a.find(s=>s.name.originalName===n.originalName);if(d==null){let s=jm.generateSubpackageId(l),o={docs:void 0,fernFilepath:l,name:n,service:void 0,types:[],errors:[],subpackages:[],navigationConfig:void 0,webhooks:void 0,websocket:void 0};this.subpackages[s]=o,i.subpackages.push(s),d=o}return this.getPackageForFernFilepath(t,u,d)}};function HI_(e,t){if(e.length!==t.length)return!1;let r=new Set(e);for(let i of t)if(!r.has(i))return!1;return!0}function $I_(e){return{errorInstanceIdKey:e.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}}var jeu=e=>{let t=tMe(e.file.fernFilepath),r=e.endpointId;return`endpoint_${t}.${r}`};function weu({fernFilePath:e}){return e.packagePath.length===0&&e.file==null}function GI_({endpointResolver:e,propertyResolver:t,file:r,refreshTokenEndpoint:i}){let n=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:r}),a;try{a=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:jeu(n),serviceId:jm.generateServiceIdFromFernFilepath(n.file.fernFilepath),subpackageId:weu({fernFilePath:n.file.fernFilepath})?void 0:jm.generateSubpackageId(n.file.fernFilepath)},requestProperties:{refreshToken:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.refresh_token})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:a,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}function QI_({endpointResolver:e,propertyResolver:t,file:r,tokenEndpoint:i}){let n=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:r}),a=typeof n.endpoint.request=="object"&&n.endpoint.request.body!=null&&typeof n.endpoint.request.body=="object"&&"properties"in n.endpoint.request.body?n.endpoint.request.body.properties??{}:{},u;try{u=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:jeu(n),serviceId:jm.generateServiceIdFromFernFilepath(n.file.fernFilepath),subpackageId:weu({fernFilePath:n.file.fernFilepath})?void 0:jm.generateSubpackageId(n.file.fernFilepath)},requestProperties:{clientId:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_id}),clientSecret:t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_secret}),scopes:i.requestProperties.scopes!=null?t.resolveRequestPropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.requestProperties.scopes}):void 0,customProperties:F6E({requestBodyProperties:a,tokenEndpoint:i,file:r,propertyResolver:t})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:u,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}var F6E=({requestBodyProperties:e,tokenEndpoint:t,file:r,propertyResolver:i})=>{let n=Object.keys(e).filter(a=>!t.requestProperties.client_id.includes(a)&&!t.requestProperties.client_secret.includes(a)&&(t.requestProperties.scopes==null||!t.requestProperties.scopes.includes(a)));return n.length>0?n.map(a=>i.resolveRequestPropertyOrThrow({file:r,endpoint:t.endpoint,propertyComponents:[a]})):void 0};function JI_({propertyResolver:e,endpointResolver:t,file:r,oauthScheme:i,tokenEndpoint:n,refreshTokenEndpoint:a}){let u=QI_({propertyResolver:e,endpointResolver:t,file:r,tokenEndpoint:n});if(u==null)throw new Error("Failed to convert OAuth token endpoint.");let l=a!=null?GI_({propertyResolver:e,endpointResolver:t,file:r,refreshTokenEndpoint:a}):void 0;return{clientIdEnvVar:i["client-id-env"],clientSecretEnvVar:i["client-secret-env"],tokenPrefix:i["token-prefix"],tokenHeader:i["token-header"],scopes:i.scopes,tokenEndpoint:u,refreshEndpoint:l}}var Yxa={requestProperties:{type:"access_token",client_id:["client_id"],client_secret:["client_secret"],scopes:void 0},responseProperties:{type:"access_token",access_token:["access_token"],expires_in:["expires_in"],refresh_token:void 0}},Ljc={requestProperties:{type:"refresh_token",refresh_token:["refresh_token"]},responseProperties:{type:"access_token",access_token:["access_token"],refresh_token:void 0,expires_in:["expires_in"]}};function KI_(e){return{endpoint:e["get-token"].endpoint,requestProperties:L6E({requestProperties:e["get-token"]?.["request-properties"]}),responseProperties:U6E({responseProperties:e["get-token"]?.["response-properties"]})}}function YI_(e){if(e["refresh-token"]!=null)return{endpoint:e["refresh-token"].endpoint,requestProperties:V6E({requestProperties:e["refresh-token"]?.["request-properties"]}),responseProperties:W6E({responseProperties:e["refresh-token"]?.["response-properties"]})}}function L6E({requestProperties:e}){if(e==null)return Yxa.requestProperties;let t=e["client-id"],r=e["client-secret"],i=e.scopes;return{type:"access_token",client_id:t!=null?yHt(t):Yxa.requestProperties.client_id,client_secret:r!=null?yHt(r):Yxa.requestProperties.client_secret,scopes:i!=null?yHt(i):Yxa.requestProperties.scopes}}function U6E({responseProperties:e}){return XI_({responseProperties:e,defaultValue:Yxa.responseProperties})}function V6E({requestProperties:e}){if(e==null)return Ljc.requestProperties;let t=e["refresh-token"];return{type:"refresh_token",refresh_token:t!=null?yHt(t):Ljc.requestProperties.refresh_token}}function W6E({responseProperties:e}){return XI_({responseProperties:e,defaultValue:Ljc.responseProperties})}function XI_({responseProperties:e,defaultValue:t}){if(e==null)return t;let r=e["access-token"],i=e["expires-in"],n=e["refresh-token"];return{type:"access_token",access_token:r!=null?Mir(r):t.access_token,expires_in:i!=null?Mir(i):t.expires_in,refresh_token:n!=null?Mir(n):t.refresh_token}}function rz_({rawApiFileSchema:e,file:t,propertyResolver:r,endpointResolver:i}){if(e.auth==null)return{docs:void 0,requirement:bne.All,schemes:[]};let n=typeof e.auth!="string"?e.auth.docs:void 0;return lWi(e.auth,{single:a=>{let u=ZI_({reference:a,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:i});return{docs:n,requirement:bne.All,schemes:[u]}},any:({any:a})=>({docs:n,requirement:bne.Any,schemes:a.map(u=>ZI_({reference:u,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:i}))})})}function ZI_({reference:e,authSchemeDeclarations:t,file:r,propertyResolver:i,endpointResolver:n}){let a=(l,d)=>{let s=t?.[l];if(s==null)throw new Error("Unknown auth scheme: "+l);return p1a(s,{header:o=>BT.header({docs:d,name:r.casingsGenerator.generateNameAndWireValue({name:o.name??l,wireValue:o.header}),valueType:r.parseTypeReference(o.type??"string"),prefix:o.prefix,headerEnvVar:o.env}),basic:o=>ez_({file:r,docs:d,rawScheme:o}),bearer:o=>kI_({file:r,docs:d,rawScheme:o}),oauth:o=>tz_({file:r,docs:d,rawScheme:o,propertyResolver:i,endpointResolver:n})})},u=typeof e=="string"?e:e.scheme;switch(u){case"bearer":return kI_({file:r,docs:void 0,rawScheme:void 0});case"basic":return ez_({file:r,docs:void 0,rawScheme:void 0});case"oauth":return tz_({file:r,docs:void 0,rawScheme:void 0,propertyResolver:i,endpointResolver:n});default:return a(u,typeof e!="string"?e.docs:void 0)}}function kI_({file:e,docs:t,rawScheme:r}){return BT.bearer({docs:t,token:e.casingsGenerator.generateName(r?.token?.name??"token"),tokenEnvVar:r?.token?.env})}function ez_({file:e,docs:t,rawScheme:r}){return BT.basic({docs:t,username:e.casingsGenerator.generateName(r?.username?.name??"username"),usernameEnvVar:r?.username?.env,password:e.casingsGenerator.generateName(r?.password?.name??"password"),passwordEnvVar:r?.password?.env})}function tz_({file:e,docs:t,rawScheme:r,propertyResolver:i,endpointResolver:n}){switch(r?.type){case"client-credentials":return BT.oauth({docs:t,configuration:kwi.clientCredentials(JI_({propertyResolver:i,endpointResolver:n,file:e,oauthScheme:r,tokenEndpoint:KI_(r),refreshTokenEndpoint:YI_(r)}))});default:throw new Error(`Unknown OAuth type: '${r?.type}'`)}}function iz_({file:e,rawApiFileSchema:t}){if(t.version!=null)return r1i.header({header:H6E({file:e,header:t.version.header}),value:$6E({file:e,versionDeclaration:t.version})})}function H6E({file:e,header:t}){return typeof t=="string"?mFe({file:e,headerKey:t,header:{type:"string"}}):mFe({file:e,headerKey:t.value,header:{type:"string",name:t.name,env:t.env}})}function $6E({file:e,versionDeclaration:t}){return veu({_enum:{default:t.default,enum:t.values},file:e})}function nz_({channel:e,typeResolver:t,exampleResolver:r,variableResolver:i,file:n,workspace:a}){let u=[];for(let[l,d]of Object.entries(e.messages??{}))u.push({type:l,availability:Gae(d.availability),docs:d.docs,origin:d.origin,body:J6E({body:d.body,file:n}),displayName:d["display-name"]});return{availability:Gae(e.availability),path:JN(e.path),baseUrl:e.url,auth:e.auth,name:n.fernFilepath.file??n.casingsGenerator.generateName(e["display-name"]??e.path),displayName:e["display-name"],headers:e.headers!=null?Object.entries(e.headers).map(([l,d])=>mFe({headerKey:l,header:d,file:n})):[],docs:e.docs,pathParameters:e["path-parameters"]!=null?c9n({pathParameters:e["path-parameters"],location:Gxe.Endpoint,file:n,variableResolver:i}):[],queryParameters:e["query-parameters"]!=null?Object.entries(e["query-parameters"]).map(([l,d])=>{let{name:s}=dpi({queryParameterKey:l,queryParameter:d}),o=n.parseTypeReference(d);return{...lJ(d),name:n.casingsGenerator.generateNameAndWireValue({wireValue:l,name:s}),valueType:o,allowMultiple:typeof d!="string"&&d["allow-multiple"]!=null?d["allow-multiple"]:!1,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}):[],messages:Object.values(u),examples:(e.examples??[]).map(l=>{let d=Y6E({channel:e,example:l,typeResolver:t,exampleResolver:r,variableResolver:i,file:n,workspace:a});return{name:l.name!=null?n.casingsGenerator.generateName(l.name):void 0,docs:l.docs,url:Z6E({channel:e,example:l,pathParams:d}),...d,...X6E({channel:e,example:l,typeResolver:t,exampleResolver:r,file:n,workspace:a}),queryParameters:l["query-parameters"]!=null?Object.entries(l["query-parameters"]).map(([s,o])=>{let c=e["query-parameters"]?.[s];if(c==null)throw new Error(`Query parameter ${s} does not exist`);return{name:n.casingsGenerator.generateNameAndWireValue({name:dpi({queryParameterKey:s,queryParameter:c}).name,wireValue:s}),value:GE({example:o,rawTypeBeingExemplified:typeof c=="string"?c:c.type,typeResolver:t,exampleResolver:r,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}),shape:G6E({queryParameter:c})}}):[],messages:l.messages.map(s=>{let o=e.messages?.[s.type];if(o==null)throw new Error(`Message ${s.type} does not exist`);return{type:s.type,body:Q6E({message:o,example:s.body,typeResolver:t,exampleResolver:r,file:n,workspace:a})}})}}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function G6E({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?A2.exploded():A2.single()}function Q6E({message:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){if(!k6E(e.body))return DEe.reference(GE({example:t,rawTypeBeingExemplified:typeof e.body!="string"?e.body.type:e.body,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}));if(!Gj(t))throw new Error("Example must be an object");let u=[];for(let[l,d]of Object.entries(t)){let s=e.body.properties?.[l];if(s!=null)u.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:l,property:s}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof s!="string"?s.type:s,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a}),originalTypeDeclaration:void 0});else{let o=Jxa({extends_:e.body.extends,wirePropertyKey:l,typeResolver:r,file:n});if(o==null)throw new Error("Could not find original type declaration for property: "+l);u.push({name:n.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:l,property:o.rawPropertyType}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof o.rawPropertyType=="string"?o.rawPropertyType:o.rawPropertyType.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:o.file,fileContainingExample:n,workspace:a}),originalTypeDeclaration:o.typeName})}}return DEe.inlinedBody({jsonExample:i.resolveAllReferencesInExampleOrThrow({example:t,file:n}).resolvedExample,properties:u})}function J6E({body:e,file:t}){return typeof e=="string"?E9.reference({docs:void 0,bodyType:t.parseTypeReference(e)}):K6E(e)?E9.reference({docs:void 0,bodyType:t.parseTypeReference(e.type)}):E9.inlinedBody({name:t.casingsGenerator.generateName(e.name),extends:hHt(e.extends??[]).map(r=>uL({typeName:r,file:t})),properties:Object.entries(e.properties??{}).map(([r,i])=>({name:t.casingsGenerator.generateNameAndWireValue({name:sL({propertyKey:r,property:i}).name,wireValue:r}),value:t.parseTypeReference(i),valueType:t.parseTypeReference(i),availability:void 0,docs:void 0}))})}function K6E(e){return e.type!=null}function Y6E({channel:e,example:t,typeResolver:r,exampleResolver:i,variableResolver:n,file:a,workspace:u}){let l=[],d=({name:s,pathParameterDeclaration:o,examplePathParameter:c})=>{let b=Kxa({parameter:o,variableResolver:n,file:a});return{name:s,value:GE({example:c,rawTypeBeingExemplified:b.rawType,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:b.file,fileContainingExample:a,workspace:u})}};if(t["path-parameters"]!=null){let s=vHt(e);for(let[o,c]of Object.entries(t["path-parameters"])){let b=s[o];if(b!=null)l.push(d({name:a.casingsGenerator.generateName(o),pathParameterDeclaration:b,examplePathParameter:c}));else throw new Error(`Path parameter ${o} does not exist`)}}return{pathParameters:l}}function X6E({channel:e,example:t,typeResolver:r,exampleResolver:i,file:n,workspace:a}){let u=[];if(t.headers!=null)for(let[l,d]of Object.entries(t.headers)){let s=e.headers?.[l];if(s!=null)u.push({name:n.casingsGenerator.generateNameAndWireValue({name:Air({headerKey:l,header:s}).name,wireValue:l}),value:GE({example:d,rawTypeBeingExemplified:typeof s=="string"?s:s.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:n,fileContainingExample:n,workspace:a})});else throw new Error(`Heder ${l} does not exist`)}return{headers:u}}function Z6E({channel:e,example:t,pathParams:r}){let i=e.path;if(t["path-parameters"]!=null)for(let n of[...r.pathParameters])i=i.replaceAll(`{${n.name.originalName}}`,encodeURIComponent(`${n.value.jsonExample}`));return i}function k6E(e){return typeof e=="string"?!1:e.extends!=null||e.properties!=null}function az_({errorName:e,errorDeclaration:t,file:r,typeResolver:i,exampleResolver:n,workspace:a}){let u=[];if(t.type!=null&&t.examples!=null)for(let l of t.examples)u.push({name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,docs:l.docs,jsonExample:n.resolveAllReferencesInExampleOrThrow({example:l.value,file:r}).resolvedExample,shape:GE({example:l.value,rawTypeBeingExemplified:t.type,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})});return{name:vAi({errorName:e,file:r}),discriminantValue:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:e}),docs:typeof t!="string"?t.docs:void 0,statusCode:t["status-code"],type:t.type!=null?r.parseTypeReference(t.type):void 0,examples:u,v2Examples:void 0,displayName:void 0}}var oz_="content";function uz_(e,t){if(e==null||e.strategy==="status-code")return SEe.statusCode();switch(e.strategy){case"property":return SEe.property({discriminant:t.casingsGenerator.generateNameAndWireValue({name:e["property-name"],wireValue:e["property-name"]}),contentProperty:t.casingsGenerator.generateNameAndWireValue({name:oz_,wireValue:oz_})});default:jo(e)}}function sz_({readme:e,services:t}){let r=new Ujc(t);return{apiReferenceLink:e.apiReferenceLink,bannerLink:e.bannerLink,introduction:e.introduction,defaultEndpoint:e.defaultEndpoint!=null?r.getEndpointForReadmeOrThrow(e.defaultEndpoint).id:void 0,features:e.features!=null?Object.fromEntries(Object.entries(e.features).map(([i,n])=>[i,n.map(a=>r.getEndpointForReadmeOrThrow(a).id)])):void 0}}var Ujc=class{endpoints={};constructor(t){this.endpoints=this.buildEndpoints(t)}getEndpointForReadme(t){let r=t4E({endpoint:t}),i=this.getEndpointKeyForReadmeEndpoint(r);return this.endpoints[i]}getEndpointForReadmeOrThrow(t){let r=this.getEndpointForReadme(t);if(r==null)throw new Error(`Endpoint not found for ${JSON.stringify(t)}`);return r}buildEndpoints(t){let r={};for(let i of Object.values(t))for(let n of i.endpoints)r[this.getEndpointKeyForHttpEndpoint(n)]=n;return r}getEndpointKeyForReadmeEndpoint(t){return this.getEndpointKey({method:t.method,path:t.path,stream:t.stream??!1})}getEndpointKeyForHttpEndpoint(t){return this.getEndpointKey({method:t.method,path:e4E(t),stream:t.response?.body?.type==="streaming"})}getEndpointKey({method:t,path:r,stream:i}){return`${t}|${r}|${i}`}};function e4E(e){let t="";e.fullPath.head.length>0&&(t=lb(t,e.fullPath.head));for(let r of e.fullPath.parts)t=lb(t,"{"+r.pathParameter+"}"),r.tail.length>0&&(t=lb(t,r.tail));return t.startsWith("/")?t:`/${t}`}function t4E({endpoint:e}){if(typeof e=="string"){let t=e.split(" ");if(t.length!==2||t[0]==null||t[1]==null)throw new Error(`invalid endpoint string: ${e}`);return{method:t[0],path:t[1]}}return e}function cz_({webhooks:e,file:t,typeResolver:r,exampleResolver:i,workspace:n}){let a=[];for(let[u,l]of Object.entries(e))a.push({id:jm.generateWebhookId(t.fernFilepath,u),availability:Gae(l.availability),displayName:l["display-name"],docs:l.docs,method:l.method,name:t.casingsGenerator.generateName(u),headers:l.headers!=null?Object.entries(l.headers).map(([d,s])=>mFe({headerKey:d,header:s,file:t})):[],payload:r4E({payload:l.payload,file:t}),examples:l.examples!=null?n4E({webhook:l,examples:l.examples,file:t,typeResolver:r,exampleResolver:i,workspace:n}):void 0,v2Examples:void 0});return a}function r4E({payload:e,file:t}){return typeof e=="string"?fW.reference({docs:void 0,payloadType:t.parseTypeReference(e)}):Z6n(e)?fW.reference({docs:void 0,payloadType:t.parseTypeReference(e.type)}):fW.inlinedPayload({name:t.casingsGenerator.generateName(e.name),extends:hHt(e.extends).map(r=>uL({typeName:r,file:t})),properties:e.properties!=null?Object.entries(e.properties).map(([r,i])=>i4E({propertyKey:r,propertyDefinition:i,docs:typeof i!="string"?i.docs:void 0,availability:typeof i!="string"?Gae(i.availability):void 0,file:t})):[]})}function i4E({propertyKey:e,propertyDefinition:t,docs:r,availability:i,file:n}){return{docs:r,availability:i,name:n.casingsGenerator.generateNameAndWireValue({wireValue:e,name:sL({propertyKey:e,property:t}).name}),valueType:n.parseTypeReference(t)}}function n4E({webhook:e,examples:t,file:r,typeResolver:i,exampleResolver:n,workspace:a}){let u=typeof e.payload=="string"?e.payload:Z6n(e.payload)?e.payload.type:void 0;if(u!=null)return t.map(l=>({docs:e.docs,name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,payload:GE({example:l.payload,rawTypeBeingExemplified:u,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})}));if(!Gj(e.payload))throw new Error(`Example webhook payload is not an object. Got: ${JSON.stringify(e.payload)}`);return t.map(l=>({docs:e.docs,name:l.name!=null?r.casingsGenerator.generateName(l.name):void 0,payload:GE({example:l.payload,rawTypeBeingExemplified:"map<string, unknown>",fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:i,exampleResolver:n,workspace:a})}))}function lz_({name:e,source:t}){return Kj.userDefined({file:geu({source:t}),name:bAi.generateName(e)})}function fz_({encoding:e}){if(e.proto!=null&&e.proto.type!=null){let t=a4E({type:e.proto.type});if(t!=null)return t}}function a4E({type:e}){switch(e){case"google.protobuf.Any":return Kj.wellKnown(id.any());case"google.protobuf.Api":return Kj.wellKnown(id.api());case"google.protobuf.BoolValue":return Kj.wellKnown(id.boolValue());case"google.protobuf.BytesValue":return Kj.wellKnown(id.bytesValue());case"google.protobuf.DoubleValue":return Kj.wellKnown(id.doubleValue());case"google.protobuf.Duration":return Kj.wellKnown(id.duration());case"google.protobuf.Empty":return Kj.wellKnown(id.empty());case"google.protobuf.Enum":return Kj.wellKnown(id.enum());case"google.protobuf.EnumValue":return Kj.wellKnown(id.enumValue());case"google.protobuf.Field":return Kj.wellKnown(id.field());case"google.protobuf.FieldCardinality":return Kj.wellKnown(id.fieldCardinality());case"google.protobuf.FieldKind":return Kj.wellKnown(id.fieldKind());case"google.protobuf.FieldMask":return Kj.wellKnown(id.fieldMask());case"google.protobuf.FloatVlaue":return Kj.wellKnown(id.floatValue());case"google.protobuf.Int32Value":return Kj.wellKnown(id.int32Value());case"google.protobuf.Int64Value":return Kj.wellKnown(id.int64Value());case"google.protobuf.ListValue":return Kj.wellKnown(id.listValue());case"google.protobuf.Method":return Kj.wellKnown(id.method());case"google.protobuf.Mixin":return Kj.wellKnown(id.mixin());case"google.protobuf.NullValue":return Kj.wellKnown(id.nullValue());case"google.protobuf.Option":return Kj.wellKnown(id.option());case"google.protobuf.SourceContext":return Kj.wellKnown(id.sourceContext());case"google.protobuf.StringValue":return Kj.wellKnown(id.stringValue());case"google.protobuf.Struct":return Kj.wellKnown(id.struct());case"google.protobuf.Syntax":return Kj.wellKnown(id.syntax());case"google.protobuf.Timestamp":return Kj.wellKnown(id.timestamp());case"google.protobuf.Type":return Kj.wellKnown(id.type());case"google.protobuf.Uint32Value":return Kj.wellKnown(id.uint32Value());case"google.protobuf.Uint64Value":return Kj.wellKnown(id.uint64Value());case"google.protobuf.Value":return Kj.wellKnown(id.value())}}function dz_({generic:e,file:t,typeResolver:r}){let i=typeof e=="string"?e:e.type,n=Zx(i);if(n==null)throw new Error(`Invalid generic type definition: ${i}`);let a=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:i,file:t});if(n.arguments&&xS(a.declaration)){let u=Zx(a.typeName)?.arguments??[],l=Object.entries(a.declaration.properties??{}).map(([d,s])=>{let o=s;return typeof s=="string"&&u?.includes(s)&&(o=n.arguments?.[u.indexOf(s)]??s),[d,o]});return Sb.object({extends:hHt(a.declaration.extends).map(d=>uL({typeName:d,file:t})),properties:Wxa({properties:Object.fromEntries(l)},t),extraProperties:a.declaration["extra-properties"]??!1,extendedProperties:void 0})}throw new Error(`Generic type definition not supported: ${i}`)}function pz_({alias:e,file:t,typeResolver:r}){let i=typeof e=="string"?e:e.type;return Wxe(i)?dz_({generic:i,file:t,typeResolver:r}):Sb.alias({aliasOf:t.parseTypeReference(e),resolvedType:o4E({aliasOf:i,file:t,typeResolver:r})})}function o4E({aliasOf:e,file:t,typeResolver:r}){let i=r.resolveTypeOrThrow({type:e,file:t});switch(i._type){case"primitive":return lW.primitive(i.originalTypeReference.primitive);case"container":return lW.container(i.originalTypeReference.container);case"unknown":return lW.unknown();case"named":{let n=xS(i.declaration)?jVt.Object:f1i(i.declaration)?jVt.Union:EVt(i.declaration)?jVt.Enum:pxn(i.declaration)?jVt.UndiscriminatedUnion:jo(i.declaration);return lW.named({name:i.name,shape:n})}}}function _z_({union:e,file:t}){let r=e.union.filter((i,n)=>{let a=typeof i=="string"?i:i.type;return e.union.findIndex(u=>(typeof u=="string"?u:u.type)===a)===n});return Sb.undiscriminatedUnion({members:r.map(i=>{let n=t.parseTypeReference(typeof i=="string"?i:i.type);return{type:n.type==="named"?{...n,displayName:typeof i=="string"?Lyo(n.name.originalName):i["display-name"]??Lyo(n.name.originalName)}:n,docs:typeof i=="string"?void 0:i.docs}})})}function hz_(e){let t=[];if(e.extends!=null){let r=typeof e.extends=="string"?[e.extends]:e.extends;t.push(...r)}return e.properties!=null&&t.push(...Object.values(e.properties).map(r=>typeof r=="string"?r:r.type)),t}function Wjc({typeDeclaration:e,file:t,typeResolver:r,seenTypeNames:i=new Vjc}){let n=a3(e,{alias:u=>{let l=typeof u=="string"?u:u.type,d=Zx(l);if(d!=null){let s=new Set(d.arguments??[]),o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:l,file:t}),c=Zx(o.typeName)?.arguments;if(xS(o.declaration)){let b=hz_(o.declaration);c&&b.filter(g=>!c.includes(g)).forEach(g=>s.add(g))}return Array.from(s)}return[l]},object:u=>hz_(u),discriminatedUnion:u=>{let l=[];return u["base-properties"]!=null&&l.push(...Object.values(u["base-properties"]).map(d=>typeof d=="string"?d:d.type)),l.push(...Object.values(u.union).reduce((d,s)=>{let o=typeof s=="string"?s:s.type;return typeof o=="string"&&d.push(o),d},[])),l},undiscriminatedUnion:u=>Object.values(u.union).reduce((l,d)=>{let s=typeof d=="string"?d:d.type;return typeof s=="string"&&l.push(s),l},[]),enum:()=>[]}),a=[];for(let u of n){let l=q2({type:u,_default:void 0,validation:void 0,visitor:{primitive:()=>[],map:({keyType:d,valueType:s})=>[...d,...s],list:d=>d,optional:d=>d,nullable:d=>d,set:d=>d,named:d=>[d],literal:()=>[],unknown:()=>[]}});for(let d of l){let s=uL({typeName:d,file:t});if(!i.hasTypeNameBeenSeen(s)){i.addTypeName(s),a.push(s);let o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:d,file:t});if(Wxe(o.typeName))continue;a.push(...Wjc({typeDeclaration:o.declaration,file:o.file,typeResolver:r,seenTypeNames:i}))}}}return a}var Vjc=class{cache=new Set;addTypeName(t){this.cache.add(this.computeCacheKey(t))}hasTypeNameBeenSeen(t){return this.cache.has(this.computeCacheKey(t))}computeCacheKey(t){return t.fernFilepath.allParts.map(r=>r.originalName).join("/")+":"+t.name.originalName}};function yz_({typeName:e,typeDeclaration:t,file:r,typeResolver:i,exampleResolver:n,sourceResolver:a,workspace:u}){let l=lJ(t),d=uL({typeName:e,file:r}),s=Wjc({typeDeclaration:t,file:r,typeResolver:i}),o={};xS(t)&&(o=NGi(t.properties??{}));let c=s4E({file:r,typeDeclaration:t,typeName:e,sourceResolver:a});return{propertiesByAudience:o,typeDeclaration:{...l,inline:d4E(t),name:d,shape:u4E({typeDeclaration:t,file:r,typeResolver:i}),referencedTypes:new Set(s.map(b=>b.typeId)),encoding:c4E({typeDeclaration:t,source:c}),source:c,userProvidedExamples:typeof t!="string"&&t.examples!=null?t.examples.map(b=>({name:b.name!=null?r.casingsGenerator.generateName(b.name):void 0,docs:b.docs,jsonExample:n.resolveAllReferencesInExampleOrThrow({example:b.value,file:r}).resolvedExample,shape:Fjc({typeName:d,example:b.value,typeResolver:i,exampleResolver:n,typeDeclaration:t,fileContainingType:r,fileContainingExample:r,workspace:u})})):[],autogeneratedExamples:[],v2Examples:void 0},descendantFilepaths:new Set(s.map(b=>b.fernFilepath))}}function u4E({typeDeclaration:e,file:t,typeResolver:r}){return a3(e,{alias:i=>pz_({alias:i,file:t,typeResolver:r}),object:i=>XB_({object:i,file:t}),discriminatedUnion:i=>dI_({union:i,file:t,typeResolver:r}),undiscriminatedUnion:i=>_z_({union:i,file:t}),enum:i=>Sb.enum(veu({_enum:i,file:t}))})}function s4E({file:e,typeDeclaration:t,typeName:r,sourceResolver:i}){if(typeof t=="string"||t.source==null&&t.encoding==null)return;if(t.encoding!=null){let a=fz_({encoding:t.encoding});if(a!=null)return _li.proto(a)}if(t.source==null)return;let n=i.resolveSourceOrThrow({source:t.source,relativeFilepath:e.relativeFilepath});if(!(n==null||n.type!=="protobuf"))return _li.proto(lz_({source:n,name:r}))}function c4E({typeDeclaration:e,source:t}){return typeof e!="string"&&e.encoding!=null?l4E(e.encoding):f4E(t)}function l4E(e){return e.proto!=null?{json:void 0,proto:{}}:{json:{},proto:void 0}}function f4E(e){return e!=null&&e.type==="proto"?{json:void 0,proto:{}}:{json:{},proto:void 0}}function d4E(e){if(typeof e!="string"&&"inline"in e)return e.inline}function vz_(e,t){let r=t[e];if(r==null)throw new Wci(`Illegal Error: Failed to load type declaration for type ${e}`);return r}function bz_(e){e.types=Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,_4E({typeDeclaration:r,ir:e})])),e.services=Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>p4E({endpoint:i,ir:e}))}]))}function p4E({endpoint:e,ir:t}){return e.requestBody?.type!=="inlinedRequestBody"?e:{...e,requestBody:{...e.requestBody,extendedProperties:e.requestBody.extends.flatMap(r=>gz_(r,t))}}}function _4E({typeDeclaration:e,ir:t}){switch(e.shape.type){case"object":return{...e,shape:{...e.shape,extendedProperties:e.shape.extends.flatMap(r=>gz_(r,t))}}}return e}function gz_(e,t){let r=Hjc(e.typeId,t);return Oz_({objectTypeDeclaration:r,ir:t})}function Hjc(e,t){let r=vz_(e,t.types);switch(r.shape.type){case"object":return r.shape;case"alias":if(r.shape.resolvedType.type==="named")return Hjc(r.shape.resolvedType.name.typeId,t)}throw new Wci(`Unexpected error: ${e} is extended but has shape ${r.shape.type}`)}function Oz_({objectTypeDeclaration:e,ir:t}){let r=e.extends.flatMap(i=>{let n=Hjc(i.typeId,t);return Oz_({objectTypeDeclaration:n,ir:t})});return[...e.properties,...r]}function mz_({reference:e,referencedIn:t,imports:r}){let[i,n,...a]=e.split(".");if(i==null||a.length>0)return;if(n==null)return{endpointName:i,relativeFilepath:t};let l=r[i];if(l!=null)return{endpointName:n,relativeFilepath:yAi({referencedIn:t,importPath:l})}}var fKi=class{workspace;constructor(t){this.workspace=t}resolveEndpointOrThrow({endpoint:t,file:r}){let i=this.resolveEndpoint({endpoint:t,file:r});if(i==null)throw new Error("Cannot resolve endpoint: "+t+" in file "+r.relativeFilepath);return i}resolveEndpointByMethodAndPath({method:t,path:r}){let i;return E3(this.workspace,(n,a,u)=>{let l=M0({relativeFilepath:n,definitionFile:a,casingsGenerator:bAi,rootApiFile:this.workspace.definition.rootApiFile.contents,defaultUrl:u.defaultUrl});for(let[d,s]of Object.entries(a.service?.endpoints??{}))s.method===t&&s.path===r&&(i={endpointId:d,endpoint:s,file:l})}),CQi(this.workspace,(n,a)=>{let u=M0({relativeFilepath:n,definitionFile:a,casingsGenerator:bAi,rootApiFile:this.workspace.definition.rootApiFile.contents});for(let[l,d]of Object.entries(a.service?.endpoints??{}))d.method===t&&d.path===r&&(i={endpointId:l,endpoint:d,file:u})}),i}resolveEndpoint({endpoint:t,file:r}){let n=new fWi().tryParse(t);if(n!=null)return this.resolveEndpointByMethodAndPath(n);let a=this.getDeclarationOfEndpoint({referenceToEndpoint:t,file:r});if(a==null)return;let u=a.file.definitionFile.service?.endpoints?.[a.endpointName];if(u!=null)return{endpointId:a.endpointName,endpoint:u,file:a.file}}getDeclarationOfEndpoint({referenceToEndpoint:t,file:r}){let i=mz_({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(!(n==null||n.service?.endpoints?.[i.endpointName]==null))return{endpointName:i.endpointName,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var dKi=class{workspace;constructor(t){this.workspace=t}getDeclarationOrThrow(t,r){let i=this.getDeclaration(t,r);if(i==null)throw new Error("Error does not exist: "+t);return i}getDeclaration(t,r){let i=gMe({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(n==null)return;let a=n.errors?.[i.typeName];if(a!=null)return{declaration:a,file:M0({definitionFile:n,relativeFilepath:i.relativeFilepath,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var mMe=class{typeResolver;constructor(t){this.typeResolver=t}resolveAllReferencesInExample({example:t,file:r}){if(typeof t=="string"){let i=this.resolveExample({example:t,file:r});return i==null||typeof i.resolvedExample=="string"?i:this.resolveAllReferencesInExample({example:i.resolvedExample,file:i.file})}else if(Gj(t)){let i={};for(let[n,a]of Object.entries(t)){let u=this.resolveAllReferencesInExample({example:a,file:r});if(u==null)return;i[n]=u.resolvedExample}return{resolvedExample:i}}else if(Array.isArray(t)){let i=[];for(let n of t){let a=this.resolveAllReferencesInExample({example:n,file:r});if(a==null)return;i.push(a.resolvedExample)}return{resolvedExample:i}}return{resolvedExample:t}}resolveAllReferencesInExampleOrThrow({example:t,file:r}){let i=this.resolveAllReferencesInExample({example:t,file:r});if(i==null)throw new Error("Failed to resolve examples");return i}resolveExample({example:t,file:r}){if(typeof t!="string")return{resolvedExample:t,file:r};if(t.startsWith(`\\${ZZt}`))return{resolvedExample:t.slice(1),file:r};if(!t.startsWith(ZZt))return{resolvedExample:t,file:r};let i=this.parseExampleReference(t);if(i==null)return;let n=this.typeResolver.getDeclarationOfNamedType({referenceToNamedType:i.rawTypeReference,file:r});if(n==null||typeof n.declaration=="string"||n.declaration.examples==null)return;let a=n.declaration.examples.find(u=>u.name===i.exampleName);if(a!=null)return this.resolveExample({example:a.value,file:n.file})}resolveExampleOrThrow({example:t,file:r}){let i=this.resolveExample({example:t,file:r});if(i==null)throw new Error("Cannot resolve example: "+t);return i}parseExampleReference(t){let[r,i,n,...a]=t.split(".");if(!(r==null||i==null||a.length>0))return n==null?{rawTypeReference:r.slice(ZZt.length),exampleName:i}:{rawTypeReference:`${r}.${i}`.slice(ZZt.length),exampleName:n}}};var Seu=class{typeResolver;endpointResolver;constructor(t,r){this.typeResolver=t,this.endpointResolver=r,this.typeResolver=t,this.endpointResolver=r}resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:i}){let n=this.resolveRequestProperty({file:t,endpoint:r,propertyComponents:i});if(n==null)throw new Error("Cannot resolve request property from endpoint: "+r+" in file "+t.relativeFilepath);return n}resolveRequestProperty({file:t,endpoint:r,propertyComponents:i}){let n=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t});if(n.endpoint.request==null)return;if(typeof n.endpoint.request!="string")return this.resolveRequestPropertyFromInlinedRequest({typeResolver:this.typeResolver,file:n.file,requestType:n.endpoint.request,propertyComponents:i});let a=this.resolveObjectProperty({file:n.file,typeName:n.endpoint.request,propertyComponents:i});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:t}),property:One.body(a)}}resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i}){let n=this.resolveResponseProperty({file:t,endpoint:r,propertyComponents:i});if(n==null)throw new Error("Cannot resolve response property from endpoint: "+r+" in file "+t.relativeFilepath);return n}resolveResponseProperty({file:t,endpoint:r,propertyComponents:i}){let n=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t}),a=this.resolveObjectProperty({file:n.file,typeName:(typeof n.endpoint.response!="string"?n.endpoint.response?.type:n.endpoint.response)??"",propertyComponents:i});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:t}),property:a}}resolveRequestPropertyFromInlinedRequest({typeResolver:t,file:r,requestType:i,propertyComponents:n}){if(n.length===1){let a=n[0]??"",u=i["query-parameters"]?.[a]??void 0;if(u!=null)return{property:One.query(beu({file:r,queryParameterKey:a,queryParameter:u})),propertyPath:void 0}}return this.resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:i,propertyComponents:n})}resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:i,propertyComponents:n}){if(i.body==null)return;if(typeof i.body=="string"){let u=this.resolveObjectProperty({file:r,typeName:i.body,propertyComponents:n});return u==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(u)}}if(KC(i.body)){let u=zjc({typeResolver:t,file:r,objectSchema:i.body,propertyComponents:n});return u==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(u)}}let a=this.resolveObjectProperty({file:r,typeName:i.body.type,propertyComponents:n});if(a!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:r}),property:One.body(a)}}resolveObjectProperty({file:t,typeName:r,propertyComponents:i}){let n=this.typeResolver.resolveTypeOrThrow({type:r,file:t});return Ijc({typeResolver:this.typeResolver,file:$xa(n)??t,resolvedType:n,propertyComponents:i})}propertyPathFromPropertyComponents({propertyComponents:t,file:r}){return t.length<=1?[]:t.slice(0,-1).map(i=>r.casingsGenerator.generateName(i))}};var H1=class{workspace;constructor(t){this.workspace=t}resolveTypeOrThrow({type:t,file:r}){let i=this.resolveType({type:t,file:r});if(i==null)throw new Error("Cannot resolve type: "+t+" in file "+r.relativeFilepath);return i}getDeclarationOfNamedTypeOrThrow({referenceToNamedType:t,file:r}){let i=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(i==null)throw new Error("Cannot find declaration of type: "+t+" in file "+r.relativeFilepath);return i}getDeclarationOfNamedType({referenceToNamedType:t,file:r}){let i=gMe({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(i==null)return;let n=zae(this.workspace,i.relativeFilepath);if(n==null)return;let a=n.types?.[i.typeName];if(a==null){let u=Zx(i.typeName);if(u!=null){for(let l of Object.keys(n.types??{})??[])if(u.name&&l.startsWith(u.name)&&l.endsWith(">")){let d=n.types?.[l];return d!=null?{typeName:l,declaration:d,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}:void 0}}return}return{typeName:i.typeName,declaration:a,file:M0({relativeFilepath:i.relativeFilepath,definitionFile:n,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}resolveType({type:t,file:r,objectPath:i=[]}){return q2({type:t,_default:void 0,validation:void 0,visitor:{primitive:n=>({_type:"primitive",primitive:n,originalTypeReference:Kc.primitive(n)}),unknown:()=>({_type:"unknown",originalTypeReference:Kc.unknown()}),map:({keyType:n,valueType:a})=>n!=null&&a!=null?{_type:"container",container:{_type:"map",keyType:n,valueType:a},originalTypeReference:Kc.container(Py.map({keyType:n.originalTypeReference,valueType:a.originalTypeReference}))}:void 0,list:n=>n!=null?{_type:"container",container:{_type:"list",itemType:n},originalTypeReference:Kc.container(Py.list(n.originalTypeReference))}:void 0,optional:n=>n!=null?{_type:"container",container:{_type:"optional",itemType:n},originalTypeReference:Kc.container(Py.optional(n.originalTypeReference))}:void 0,nullable:n=>n!=null?{_type:"container",container:{_type:"nullable",itemType:n},originalTypeReference:Kc.container(Py.nullable(n.originalTypeReference))}:void 0,set:n=>n!=null?{_type:"container",container:{_type:"set",itemType:n},originalTypeReference:Kc.container(Py.set(n.originalTypeReference))}:void 0,literal:n=>({_type:"container",container:{_type:"literal",literal:n},originalTypeReference:Kc.container(Py.literal(n))}),named:n=>{let a=this.getDeclarationOfNamedType({referenceToNamedType:n,file:r});if(a==null)return;let u={typeName:a.typeName,file:a.file.relativeFilepath,reference:n};if(!i.some(l=>l.file===u.file&&l.typeName===u.typeName))return this.resolveNamedTypeFromDeclaration({referenceToNamedType:n,referencedIn:r,rawDeclaration:a,objectPath:[...i,u]})}}})}resolveNamedTypeOrThrow({referenceToNamedType:t,file:r}){let i=this.resolveNamedType({referenceToNamedType:t,file:r});if(i==null)throw new Error("Cannot resolve type: "+t);return i}resolveNamedType({referenceToNamedType:t,file:r}){let i=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(i!=null)return this.resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:i})}resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:i,objectPath:n=[]}){let{declaration:a,file:u}=i;if(l1i(a))return this.resolveType({type:typeof a=="string"?a:a.type,file:u,objectPath:n});let l=Qxa({type:t,_default:void 0,validation:void 0,file:r});if(!(l.type!=="named"||zae(this.workspace,u.relativeFilepath)==null))return{_type:"named",rawName:i.typeName,name:l,declaration:a,filepath:u.relativeFilepath,objectPath:n,originalTypeReference:l,file:u}}};var gHt=class e{static VARIABLE_PREFIX="$";getDeclarationOrThrow(t,r){let i=this.getDeclaration(t,r);if(i==null)throw new Error("Variable does not exist: "+t);return i}getDeclaration(t,r){if(!t.startsWith(e.VARIABLE_PREFIX))return;let i=r.rootApiFile.variables?.[t.substring(1)];if(i!=null)return{declaration:i,file:fpi({casingsGenerator:r.casingsGenerator,rootApiFile:r.rootApiFile})}}getVariableIdOrThrow(t){let r=this.getVariableId(t);if(r==null)throw new Error("Variable reference does not start with "+e.VARIABLE_PREFIX);return r}getVariableId(t){if(t.startsWith(e.VARIABLE_PREFIX))return t.substring(e.VARIABLE_PREFIX.length)}};function Deu(e,t){if(t){for(let[r,i]of Object.entries(t))if(typeof i!="string"&&r===e)return i.audiences}}function hR({workspace:e,generationLanguage:t,keywords:r,smartCasing:i,exampleGeneration:n,audiences:a,readme:u,packageName:l,version:d,fdrApiDefinitionId:s,sourceResolver:o,disableDynamicExamples:c,dynamicGeneratorConfig:b}){let g=BZ({generationLanguage:t,keywords:r,smartCasing:i}),O=new FGi(a),m=fpi({casingsGenerator:g,rootApiFile:e.definition.rootApiFile.contents}),w=(e.definition.rootApiFile.contents.errors??[]).map(ot=>({error:vAi({errorName:ot,file:m}),docs:void 0})),E=new H1(e),q=new fKi(e),A=new Seu(E,q),D=new dKi(e),C=new mMe(E),x=new gHt,I=NTa({casingsGenerator:g,rawApiFileSchema:e.definition.rootApiFile.contents})?.environmentsConfig,F={selfHosted:!1,fdrApiDefinitionId:s,apiVersion:iz_({file:m,rawApiFileSchema:e.definition.rootApiFile.contents}),apiName:g.generateName(e.definition.rootApiFile.contents.name),apiDisplayName:e.definition.rootApiFile.contents["display-name"],apiDocs:Vxa(e.definition.rootApiFile.contents.docs),auth:rz_({rawApiFileSchema:e.definition.rootApiFile.contents,file:m,propertyResolver:A,endpointResolver:q}),headers:e.definition.rootApiFile.contents.headers!=null?Object.entries(e.definition.rootApiFile.contents.headers).map(([ot,at])=>mFe({headerKey:ot,header:at,file:m})):[],idempotencyHeaders:e.definition.rootApiFile.contents["idempotency-headers"]!=null?Object.entries(e.definition.rootApiFile.contents["idempotency-headers"]).map(([ot,at])=>mFe({headerKey:ot,header:at,file:m})):[],types:{},errors:{},services:{},constants:$I_(g),environments:I,errorDiscriminationStrategy:uz_(e.definition.rootApiFile.contents["error-discrimination"],m),basePath:e.definition.rootApiFile.contents["base-path"]!=null?JN(e.definition.rootApiFile.contents["base-path"]):void 0,pathParameters:c9n({pathParameters:e.definition.rootApiFile.contents["path-parameters"],file:m,location:Gxe.Root,variableResolver:x}),variables:e.definition.rootApiFile.contents.variables!=null?Object.entries(e.definition.rootApiFile.contents.variables).map(([ot,at])=>({docs:typeof at!="string"?at.docs:void 0,id:ot,name:m.casingsGenerator.generateName(ot),type:m.parseTypeReference(at)})):[],serviceTypeReferenceInfo:{typesReferencedOnlyByService:{},sharedTypes:[]},webhookGroups:{},websocketChannels:{},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,audiences:e.definition.rootApiFile.contents.audiences},V=new Peu,K=ot=>{V.addSubpackage(ot.fernFilepath),Cw(ot.definitionFile,{imports:Go,docs:at=>{at!=null&&V.addDocs(ot.fernFilepath,at)},types:at=>{if(at!=null)for(let[me,we]of Object.entries(at)){if(Wxe(me))continue;let jt=yz_({typeName:me,typeDeclaration:we,file:ot,typeResolver:E,exampleResolver:C,sourceResolver:o,workspace:e}),gt=jt.typeDeclaration;n.disabled&&(gt.userProvidedExamples=[],gt.autogeneratedExamples=[]);let qr=jt.descendantFilepaths,lr=jm.generateTypeId(gt.name);F.types[lr]=gt,V.addType(lr,gt),O.addType({declaredTypeName:gt.name,descendantTypeIds:gt.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:jt.propertiesByAudience,descendantFilepaths:qr}),O.markTypeForAudiences(gt.name,YB_(we))}},errors:at=>{if(at==null)return;if(e.definition.rootApiFile.contents["error-discrimination"]==null)throw new Error("error-discrimination is missing in api.yml but there are declared errors.");for(let[we,jt]of Object.entries(at)){let gt=az_({errorName:we,errorDeclaration:jt,file:ot,typeResolver:E,exampleResolver:C,workspace:e}),qr=jm.generateErrorId(gt.name);F.errors[qr]=gt,V.addError(qr,gt),O.addError(gt)}},service:at=>{if(at==null)return;let me=UI_({rootDefaultUrl:ot.defaultUrl??e.definition.rootApiFile.contents["default-url"],rootPathParameters:F.pathParameters,serviceDefinition:at,file:ot,errorResolver:D,typeResolver:E,propertyResolver:A,exampleResolver:C,sourceResolver:o,globalErrors:w,variableResolver:x,workspace:e}),we=jm.generateServiceId(me.name);F.services[we]=me,V.addService(we,me);let jt={};me.endpoints.forEach(gt=>{n.disabled&&(gt.autogeneratedExamples=[],gt.userSpecifiedExamples=[]);let qr=at.endpoints[gt.name.originalName];O.addEndpoint(me,gt,qr),jt[gt.name.originalName]=gt}),at.audiences!=null&&O.markEndpointForAudience(me.name,me.endpoints,at.audiences),Object.entries(at.endpoints).map(([gt,qr])=>{let lr=jt[gt];lr!=null&&qr.audiences!=null&&O.markEndpointForAudience(me.name,[lr],qr.audiences)})},webhooks:at=>{if(at==null)return;let me=jm.generateWebhookGroupId(ot.fernFilepath),we=cz_({webhooks:at,file:ot,typeResolver:E,exampleResolver:C,workspace:e}),jt={};for(let gt of we)jt[gt.name.originalName]=gt;Object.entries(at).forEach(([gt,qr])=>{let lr=jt[gt];lr!=null&&(O.addWebhook(ot.fernFilepath,lr,qr),qr.audiences!=null&&O.markWebhookForAudiences(ot.fernFilepath,lr,qr.audiences))}),F.webhookGroups[me]=we,V.addWebhookGroup(me,ot.fernFilepath)},channel:at=>{if(at==null)return;let me=jm.generateWebSocketChannelId(ot.fernFilepath),we=nz_({channel:at,file:ot,variableResolver:x,typeResolver:E,exampleResolver:C,workspace:e});O.addChannel(ot.fernFilepath,me,we,at),at.audiences!=null&&O.markChannelForAudiences(ot.fernFilepath,me,at.audiences),F.websocketChannels!=null&&(F.websocketChannels[me]=we,V.addWebSocketChannel(me,ot.fernFilepath))}})};E3(e,(ot,at,me)=>{K(M0({relativeFilepath:ot,definitionFile:at,casingsGenerator:g,rootApiFile:e.definition.rootApiFile.contents,defaultUrl:me.defaultUrl}))}),CQi(e,(ot,at)=>{if(at.navigation!=null)if(typeof at.navigation=="string")V.addPackageRedirection({from:$ae({relativeFilepath:ot,casingsGenerator:g}),to:$ae({relativeFilepath:EN(axe(ot),Oy.of(at.navigation)),casingsGenerator:g})});else{let me=at.navigation.map(we=>jm.generateSubpackageId($ae({relativeFilepath:EN(axe(ot),Oy.of(we)),casingsGenerator:g})));ot===TS?V.sortRootPackage(me):V.sortSubpackage(jm.generateSubpackageId($ae({relativeFilepath:ot,casingsGenerator:g})),me)}}),F.serviceTypeReferenceInfo=y4E(O),bz_(F);let Y=n.disabled?F:RTa({ir:F,exampleGeneration:n}),Z=e.definition.rootApiFile.contents,oe=I?.environments._visit({singleBaseUrl:ot=>ot.environments.filter(at=>Deu(at.id,Z.environments)!=null).length===0,multipleBaseUrls:ot=>ot.environments.filter(at=>Deu(at.id,Z.environments)!=null).length===0,_other:()=>!1});I?.environments.environments.forEach(ot=>{O.markEnvironmentForAudiences(ot,Deu(ot.id,Z.environments)??[],oe)});let pe=O.hasNoAudiences()?void 0:O.build(),de=Loc(Y,pe),Oe=e.definition.rootApiFile.contents.auth!=null&&Object.values(de.services).every(ot=>ot.endpoints.every(at=>at.auth)),Ue=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.response?.body?.type==="streaming")),wt=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.pagination!=null)),De=Object.values(de.services).some(ot=>ot.endpoints.some(at=>at.response?.body?.type==="fileDownload")),Te={isAuthMandatory:Oe,hasStreamingEndpoints:Ue,hasPaginatedEndpoints:wt,hasFileDownloadEndpoints:De,platformHeaders:{language:"X-Fern-Language",sdkName:"X-Fern-SDK-Name",sdkVersion:"X-Fern-SDK-Version",userAgent:d!=null&&l!=null?{header:"User-Agent",value:`${l}/${d}`}:void 0}},xt=u!=null?sz_({readme:u,services:F.services}):void 0,Pe=h4E({...de,...V.build(pe),sdkConfig:Te,readmeConfig:xt});return{...Pe,dynamic:WI_({ir:Pe,generatorConfig:b,disableExamples:c,generationLanguage:t,smartCasing:i})}}function h4E(e){let t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(t);for(let i in r){let n=r[i];i==="docs"&&typeof n=="string"?r[i]=Vxa(n):n&&typeof n=="object"&&t(n)}return r};return t(e)}function y4E(e){let t={},r=[],i=e.getTypesReferencedByService();for(let[n,a]of Object.entries(i)){if(a.size===1){let u=a.values().next().value;if(u==null)break;t[u]===void 0&&(t[u]=[]),t[u]?.push(n);continue}r.push(n)}return{typesReferencedOnlyByService:t,sharedTypes:r}}function Pz_(e){throw new Error("Unexpected value: "+JSON.stringify(e))}var wz_=ui(SCn(),1);var jz_=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function OHt(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,wz_.default)(e,{special:jz_}).replace(/V\s(\d)/g,"V$1")}function Xxa(e,t="type"){return{_visit:r=>{let i=r[e[t]];return i!=null?i(e):(r._other==null&&Pz_(e),r._other(e))}}}function qir(e){return typeof e.subpackageId=="string"}function l9n(e,t){return`${e} ${rB(t)}`}function rB(e){return e.map(t=>t.type==="literal"?t.value:`{${t.value}}`).join("")}function PFe(e){return e.map(t=>t.type==="literal"?t.value:`:${t.value}`).join("")}var $jc="__package__",OAi=class e{api;context;static create(t,r){return new e(t,r)}#e=new Map;#t=new Map;#r=new Map;#n=new Map;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#f=new Map;#u=new Map;#l=new Map;static getSubpackageId(t){return qir(t)?t.subpackageId:$jc}getSubpackageByIdOrLocator(t){if(t==null)return;let r=Y6.SubpackageId(t),i=Y6.SubpackageId(`subpackage_${d_(t)}`);return r===$jc?this.api.rootPackage:this.api.subpackages[r]??this.#l.get(r)??this.api.subpackages[i]??this.#l.get(i)}resolveSubpackage(t){if(t!=null){for(;t?.pointsTo!=null;)t=this.api.subpackages[t.pointsTo];return t}}constructor(t,r){this.api=t,this.context=r,[t.rootPackage,...Object.values(t.subpackages)].forEach(i=>{let n=Y6.SubpackageId(e.getSubpackageId(i)),a={endpoints:new Map,webSockets:new Map,webhooks:new Map};this.#o.set(n,a),i.endpoints.forEach(u=>{a.endpoints.set(u.id,u);let l=e.createEndpointId(u,n);this.#e.set(l,u);let d=[],s=[u.method];u.response?.type.type==="stream"&&s.push("STREAM"),s.forEach(o=>{d.push(`${o} ${rB(u.path.parts)}`),d.push(`${o} ${PFe(u.path.parts)}`),u.environments.forEach(c=>{d.push(`${o} ${lb(c.baseUrl,rB(u.path.parts))}`),d.push(`${o} ${lb(c.baseUrl,PFe(u.path.parts))}`);let b=Eeu(c);b!=null&&(d.push(`${o} ${lb(b,rB(u.path.parts))}`),d.push(`${o} ${lb(b,PFe(u.path.parts))}`))})}),d.forEach(o=>{this.context?.logger.trace(`Registering endpoint locator: ${o}`),this.#s.set(o,u)})}),i.websockets.forEach(u=>{a.webSockets.set(u.id,u);let l=e.createWebSocketId(u,n);this.#t.set(l,u);let d=[];["GET","WSS"].forEach(o=>{d.push(`${o} ${rB(u.path.parts)}`),d.push(`${o} ${PFe(u.path.parts)}`),u.environments.forEach(c=>{d.push(`${o} ${lb(c.baseUrl,rB(u.path.parts))}`),d.push(`${o} ${lb(c.baseUrl,PFe(u.path.parts))}`);let b=Eeu(c);b!=null&&(d.push(`${o} ${lb(b,rB(u.path.parts))}`),d.push(`${o} ${lb(b,PFe(u.path.parts))}`))})}),d.forEach(o=>{this.context?.logger.trace(`Registering websocket locator: ${o}`),this.#f.set(o,u)})}),i.webhooks.forEach(u=>{a.webhooks.set(u.id,u),this.#r.set(e.createWebhookId(u,n),u)})}),this.#e.forEach((i,n)=>{this.#n.set(i,n)}),this.#t.forEach((i,n)=>{this.#i.set(i,n)}),this.#r.forEach((i,n)=>{this.#a.set(i,n)}),this.#c(t.rootPackage,[])}#c(t,r){if(t==null)return;let i=qir(t)?[...r,t.name]:r,n=i.length===0?[$jc]:i;if([n.join("."),n.join("/"),`${n.join(".")}.yml`].forEach(u=>{this.context?.logger.trace(`Registering subpackage locator: ${u}`),this.#l.set(u,t)}),t.pointsTo!=null)return this.#c(this.api.subpackages[t.pointsTo],i);t.endpoints.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering endpoint locator: ${s}`),this.#s.set(s,u)})}),t.websockets.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering websocket locator: ${s}`),this.#f.set(s,u)})}),t.webhooks.forEach(u=>{let l=[...i,u.id];[l.join("."),l.join("/")].forEach(s=>{this.context?.logger.trace(`Registering webhook locator: ${s}`),this.#u.set(s,u)})}),t.subpackages.forEach(u=>{this.#c(this.api.subpackages[u],i)})}get endpoints(){return this.#e}get webSockets(){return this.#t}get webhooks(){return this.#r}get endpointsByLocator(){return this.#s}get webSocketsByLocator(){return this.#f}get webhooksByLocator(){return this.#u}get subpackages(){return this.#o}get subpackagesByLocator(){return this.#l}getEndpointId(t){return this.#n.get(t)}getWebSocketId(t){return this.#i.get(t)}getWebhookId(t){return this.#a.get(t)}static createEndpointId(t,r){return So.EndpointId(t.originalEndpointId??`${r}.${t.id}`)}static createWebSocketId(t,r){return So.WebSocketId(`${r}.${t.id}`)}static createWebhookId(t,r){return So.WebhookId(`${r}.${t.id}`)}};function Eeu(e){if(e!=null){if(e.baseUrl.startsWith("/"))return e.baseUrl;if(e.baseUrl.startsWith("http")||e.baseUrl.startsWith("ws"))try{return new URL(e.baseUrl).pathname}catch{return}}}var f9n=ui(hZo(),1),Dz_=ui(yZo(),1);function Sz_(e){let t=e.split(".")[0];if(t==null)return;let i=/(^\d{1,4})-(\d{1,2})-(\d{1,4})/.exec(t)?.[0];if(i!=null)try{return new Date(i)}catch{}}f9n.default.extend(Dz_.default);var v4E="Changelog",b4E=["summary","index","overview"],ppi=class{markdownToFullSlug;markdownToNoIndex;changelogFiles;docsWorkspace;idgen;constructor(t,r,i,n,a){this.markdownToFullSlug=t,this.markdownToNoIndex=r,this.changelogFiles=i,this.docsWorkspace=n,this.idgen=a}toChangelogNode(t){let r=t.title??v4E,i=[],n;for(let b of this.changelogFiles??[]){let g=kBs(b.split("/"));if(g==null)continue;let O=Sz_(g);if(O==null){let w=g.split(".")[0]?.toLowerCase();w!=null&&b4E.includes(w)&&(n=b);continue}let m=this.toRelativeFilepath(b);i.push({date:O,pageId:So.PageId(m),absoluteFilepath:b})}let a=t.parentSlug.apply({fullSlug:n!=null?this.markdownToFullSlug.get(n)?.split("/"):void 0,skipUrlSlug:!1,urlSlug:t.slug??Tq(r)}),u=n!=null?this.markdownToNoIndex.get(n):void 0,l=i.map(b=>{let g=f9n.default.utc(b.date);return{id:this.idgen.get(b.pageId),type:"changelogEntry",title:g.format("MMMM D, YYYY"),slug:a.apply({fullSlug:this.markdownToFullSlug.get(b.absoluteFilepath)?.split("/"),urlSlug:g.format("YYYY/M/D")}).get(),icon:void 0,hidden:void 0,date:b.date.toISOString(),pageId:b.pageId,noindex:this.markdownToNoIndex.get(b.absoluteFilepath),authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),d=Gjc(l,b=>b.date,"desc"),s=n!=null?So.PageId(this.toRelativeFilepath(n)):void 0,o=this.idgen.get(s??"changelog"),c=this.groupByYear(o,d,a);return{id:o,type:"changelog",title:r,slug:a.get(),icon:t.icon,hidden:t.hidden,children:c,overviewPageId:s,noindex:u,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:void 0}}orUndefined(){return this.changelogFiles!=null&&this.changelogFiles.length>0?this:void 0}groupByYear(t,r,i){let n=new Map;for(let a of r){let u=f9n.default.utc(a.date).year(),l=n.get(u)??[];l.push(a),n.set(u,l)}return Gjc(Array.from(n.entries()).map(([a,u])=>{let l=i.append(a.toString()).get(),d=this.idgen.get(`${t}/year/${a}`);return{id:d,type:"changelogYear",title:a.toString(),year:a,slug:l,icon:void 0,hidden:void 0,children:this.groupByMonth(d,u,i),authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),"year","desc")}groupByMonth(t,r,i){let n=new Map;for(let a of r){let u=f9n.default.utc(a.date).month()+1,l=n.get(u)??[];l.push(a),n.set(u,l)}return Gjc(Array.from(n.entries()).map(([a,u])=>{let l=(0,f9n.default)(new Date(0,a-1));return{id:this.idgen.get(`${t}/month/${a}`),type:"changelogMonth",title:l.format("MMMM YYYY"),month:a,slug:i.append(a.toString()).get(),icon:void 0,hidden:void 0,children:u,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}),"month","desc")}toRelativeFilepath(t){if(t!=null)return Bq(this.docsWorkspace.absoluteFilePath,t)}};function Gjc(e,t,r="asc"){return e.concat().sort((i,n)=>{let a=typeof t=="function"?t(i):i[t],u=typeof t=="function"?t(n):n[t];return a<u?r==="asc"?-1:1:a>u?r==="asc"?1:-1:0})}function Meu(e){if(e)return{environments:e.environments!=null&&e.environments.length>0?e.environments.map(t=>So.V1.EnvironmentId(t)):void 0,button:e.button!=null&&e.button.href?{href:So.V1.Url(e.button.href)}:void 0,"limit-websocket-messages-per-connection":e.limitWebsocketMessagesPerConnection!=null?e.limitWebsocketMessagesPerConnection:void 0}}function Zxa({child:e,nodeIdToSubpackageId:t,convertApiDefinitionPackageId:r,mergeAndFilterChildren:i}){if(e.type==="apiPackage"){let n=So.V1.SlugGenerator.init(e.slug),u=(t.get(e.id)??[]).flatMap(s=>r(s,n)),l=e.children.map(s=>Zxa({child:s,nodeIdToSubpackageId:t,convertApiDefinitionPackageId:r,mergeAndFilterChildren:i})),d=i(l,u);return{...e,children:d,pointsTo:void 0}}return e}function d9n({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:i,apiDefinitionId:n}){if(i)return e;let a=[],u=new Map;return e.forEach(l=>{if(l.type!=="endpoint"){a.push(l);return}let d=t(l.endpointId);if(d==null)throw new Error(`Endpoint ${l.endpointId} not found`);let s=`${d.method} ${r(d)}`,o=u.get(s);if(u.set(s,l),o==null||o.isResponseStream===l.isResponseStream){a.push(l);return}let c=a.indexOf(o),b=l.isResponseStream?l:o,g=l.isResponseStream?o:l,O={id:So.V1.NodeId(`${n}:${g.endpointId}+${b.endpointId}`),type:"endpointPair",stream:b,nonStream:g};a[c]=O}),a}function Aeu({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:i,disableEndpointPairs:n,apiDefinitionId:a}){return d9n({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:i,disableEndpointPairs:n,apiDefinitionId:a}).filter(u=>u.type==="apiPackage"?u.children.length>0:!0)}function Tir(e,t){if(t!=null)return Bq(e.absoluteFilePath,t)}function qeu({docsWorkspace:e,page:t,parentSlug:r,idgen:i,markdownFilesToFullSlugs:n,markdownFilesToNoIndex:a,hideChildren:u}){let l=So.V1.PageId(Tir(e,t.absolutePath)),d=r.apply({fullSlug:n.get(t.absolutePath)?.split("/"),urlSlug:t.slug??Tq(t.title)});return{id:i.get(l),type:"page",pageId:l,title:t.title,slug:d.get(),icon:t.icon,hidden:u||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}var Teu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;workspace;hideChildren;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Map;#o=[];#s;#f;#u;disableEndpointPairs;constructor(t,r,i,n,a,u,l,d,s,o){this.apiSection=t,this.docsWorkspace=n,this.taskContext=a,this.markdownFilesToFullSlugs=u,this.markdownFilesToNoIndex=l,this.workspace=s,this.hideChildren=o,this.disableEndpointPairs=n.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=So.V1.ApiDefinitionId(r.id),this.#e=OAi.create(r,a),this.#u=d,this.#s=this.apiSection.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let c=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#f=i.apply({fullSlug:c?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??Tq(this.apiSection.title)}),this.apiSection.navigation!=null&&(this.#o=this.#l(this.apiSection.navigation,this.#e.api.rootPackage,this.#f)),this.#o=this.#O(this.#o.map(b=>this.#v(b)),this.#P(this.#e.api.rootPackage,this.#f))}get(){let t=So.V1.followRedirects(this.#o),r=new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.workspace?.changelog?.files.map(i=>i.absoluteFilepath),this.docsWorkspace,this.#u).orUndefined();return{id:this.#u.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#f.get(),icon:this.apiSection.icon,hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#f,viewers:void 0,hidden:this.hideChildren}),children:this.#o,availability:void 0,pointsTo:t,noindex:void 0,playground:this.#g(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#l(t,r,i){r=this.#e.resolveSubpackage(r);let n=r!=null?OAi.getSubpackageId(r):void 0;return t.map(a=>Xxa(a)._visit({link:u=>({id:this.#u.get(u.url),type:"link",title:u.text,icon:u.icon,url:So.Url(u.url)}),page:u=>this.#c(u,i),package:u=>this.#p(u,i),section:u=>this.#h(u,i),item:({value:u})=>this.#_(u,n,i),endpoint:u=>this.#y(u,n,i)})).filter(yv)}#c(t,r){return qeu({page:t,parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#u,hideChildren:this.hideChildren})}#p(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#e.getSubpackageByIdOrLocator(t.package);if(a!=null){let u=OAi.getSubpackageId(a),l=this.#u.get(i??`${this.apiDefinitionId}:${u}`);this.#i.has(u)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${u}`),this.#i.add(u),this.#a.set(l,[u]);let d=t.slug??(qir(a)?a.urlSlug:this.apiSection.slug??Tq(this.apiSection.title)),s=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:d}),o=this.#l(t.contents,a,s);return{id:l,type:"apiPackage",children:o,title:t.title??(qir(a)?a.displayName??OHt(a.name):this.apiSection.title),slug:s.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(`Subpackage ${t.package} not found in ${this.apiDefinitionId}, treating it as a section`);let u=t.slug??Tq(t.package),l=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),d=this.#l(t.contents,void 0,l);return{id:this.#u.get(i??`${this.apiDefinitionId}:${Tq(t.package)}`),type:"apiPackage",children:d,title:t.title??t.package,slug:l.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#h(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,u=this.#u.get(i??n??r.get()),l=t.referencedSubpackages.map(c=>{let b=this.#e.getSubpackageByIdOrLocator(c);return b!=null?OAi.getSubpackageId(b):void 0}).filter(c=>(c==null&&this.taskContext.logger.error(`Subpackage ${c} not found in ${this.apiDefinitionId}`),c!=null)).filter(yv);this.#a.set(u,l),l.forEach(c=>{this.#i.has(c)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${c}`),this.#i.add(c)});let d=t.slug??Tq(t.title),s=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:d}),o=this.#l(t.contents,void 0,s);return{id:u,type:"apiPackage",children:o,title:t.title,slug:s.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:a,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#_(t,r,i){t=t.trim();let n=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator(d_(t));if(n!=null){let a=OAi.getSubpackageId(n),u=this.#u.get(`${this.apiDefinitionId}:${a}`);this.#i.has(a)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a}`),this.#i.add(a),this.#a.set(u,[a]);let l=qir(n)?n.urlSlug:"",d=i.apply({urlSlug:l});return{id:u,type:"apiPackage",children:[],title:qir(n)?n.displayName??OHt(n.name):this.apiSection.title,slug:d.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#y({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,i)}#y(t,r,i){let n=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.endpoints.get(Y6.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(n!=null){let l=this.#e.getEndpointId(n);if(l==null)this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path.parts)}. Got undefined.`);else{this.#t.has(l)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${l}`),this.#t.add(l);let d=t.slug!=null?i.append(t.slug):i.apply(n);return{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"endpoint",method:n.method,endpointId:l,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.response?.type.type==="stream",title:t.title??n.name??rB(n.path.parts),slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let a=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.webSockets.get(Y6.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(a!=null){let l=this.#e.getWebSocketId(a);if(l==null)this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);else return this.#r.has(l)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${l}`),this.#r.add(l),{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"webSocket",webSocketId:l,title:t.title??a.name??rB(a.path.parts),slug:(t.slug!=null?i.append(t.slug):i.apply(a)).get(),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(a.availability),playground:this.#g(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let u=(r!=null?this.#e.subpackages.get(Y6.SubpackageId(r))?.webhooks.get(Y6.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(So.V1.WebhookId(t.endpoint));if(u!=null){let l=this.#e.getWebhookId(u);if(l==null)this.taskContext.logger.error(`Expected Webhook ID for ${u.id}. Got undefined.`);else return this.#n.has(l)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${l}`),this.#n.add(l),{id:this.#u.get(`${this.apiDefinitionId}:${l}`),type:"webhook",webhookId:l,method:u.method,title:t.title??u.name??lb("/",...u.path),slug:(t.slug!=null?i.append(t.slug):i.apply(u)).get(),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#O(t,r){return Aeu({left:t,right:r,findEndpointById:i=>this.#e.endpoints.get(i),stringifyEndpointPathParts:i=>rB(i.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#v(t){return Zxa({child:t,nodeIdToSubpackageId:this.#a,convertApiDefinitionPackageId:(r,i)=>this.#j(r,i),mergeAndFilterChildren:this.#O.bind(this)})}#P(t,r){let i=[];return t.endpoints.forEach(n=>{let a=this.#e.getEndpointId(n);if(a==null){this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path.parts)}. Got undefined.`);return}if(this.#t.has(a))return;let u=r.apply(n);i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"endpoint",method:n.method,endpointId:a,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.response?.type.type==="stream",title:n.name??rB(n.path.parts),slug:u.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.websockets.forEach(n=>{let a=this.#e.getWebSocketId(n);if(a==null){this.taskContext.logger.error(`Expected WebSocket ID for ${n.id}. Got undefined.`);return}this.#r.has(a)||i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"webSocket",webSocketId:a,title:n.name??rB(n.path.parts),slug:r.apply(n).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(n=>{let a=this.#e.getWebhookId(n);if(a==null){this.taskContext.logger.error(`Expected Webhook ID for ${n.id}. Got undefined.`);return}this.#n.has(a)||i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"webhook",webhookId:a,method:n.method,title:n.name??OHt(n.id),slug:r.apply(n).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(n=>{if(this.#i.has(n))return;let a=this.#e.getSubpackageByIdOrLocator(n);if(a==null){this.taskContext.logger.error(`Subpackage ${n} not found in ${this.apiDefinitionId}`);return}let u=qir(a)?r.apply(a):r,l=this.#j(n,u);l.length>0&&i.push({id:So.V1.NodeId(`${this.apiDefinitionId}:${n}`),type:"apiPackage",children:l,title:qir(a)?a.displayName??OHt(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((n,a)=>{let u=n.type==="endpointPair"?n.nonStream.title:n.title,l=a.type==="endpointPair"?a.nonStream.title:a.title;return u.localeCompare(l)})),i}#j(t,r){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.error(`Subpackage ${t} not found in ${this.apiDefinitionId}`),[]):this.#P(i,r)}#g(t){return Meu(t)}mergeEndpointPairs(t){return d9n({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>rB(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}};var Ceu=class{#e={};#t={};#r={};#n={};constructor(t){for(let[r,i]of Object.entries(t.subpackages))this.#e[d_(r).toLowerCase()]=i,this.#e[`subpackage_${d_(r).toLowerCase()}`]=i;for(let[r,i]of Object.entries(t.endpoints)){this.#r[r]=i,this.#r[r.replace("endpoint_","")]=i,this.#r[r.replace("endpoint_","subpackage_")]=i;for(let n of[i.method,"STREAM"])i.environments?.forEach(a=>{this.#r[`${n} ${lb(a.baseUrl,rB(i.path))}`]=i,this.#r[`${n} ${lb(a.baseUrl,PFe(i.path))}`]=i;let u=Eeu(a);u!=null&&(this.#r[`${n} ${lb(u,rB(i.path))}`]=i,this.#r[`${n} ${lb(u,PFe(i.path))}`]=i)}),this.#r[`${i.method} ${rB(i.path)}`]=i,this.#r[`${i.method} ${PFe(i.path)}`]=i}for(let[r,i]of Object.entries(t.webhooks))this.#t[r]=i,this.#t[r.replace("webhook_","")]=i,this.#t[r.replace("webhook_","subpackage_")]=i,this.#t[`${i.method} ${i.path.join("/")}`]=i;for(let[r,i]of Object.entries(t.websockets))this.#n[r]=i,this.#n[r.replace("websocket_","")]=i,this.#n[r.replace("websocket_","subpackage_")]=i,this.#n[`STREAM ${rB(i.path)}`]=i,this.#n[`STREAM ${PFe(i.path)}`]=i}getSubpackageByLocator(t){if(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"].some(i=>t.includes(i)))return;let r=t.replace(".yml","").replace(".yaml","");return this.#e[r]}getWebhookByLocator(t,r){return this.#t[t]??this.#t[`${r}.${t}`]??this.#t[`webhook_${r}.${t}`]}getEndpointByLocator(t,r){return this.#r[t]??this.#r[`${r}.${t}`]??this.#r[`endpoint_${r}.${t}`]}getWebSocketByLocator(t,r){return this.#n[t]??this.#n[`${r}.${t}`]??this.#n[`websocket_${r}.${t}`]}};function kxa({item:e,parentSlug:t}){return t.apply({urlSlug:Tq(e.id.split(".").pop()??"")}).get()}var eRa=class{apiSection;workspace;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;hideChildren;apiDefinitionId;#e;#t;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#s=[];#f;#u;#l;#c=new Map;disableEndpointPairs;constructor(t,r,i,n,a,u,l,d,s,o){this.apiSection=t,this.workspace=n,this.docsWorkspace=a,this.taskContext=u,this.markdownFilesToFullSlugs=l,this.markdownFilesToNoIndex=d,this.hideChildren=o,this.#e=r,this.#t=new Ceu(r),this.disableEndpointPairs=a.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=So.V1.ApiDefinitionId(r.id),this.#l=s,this.#f=this.apiSection.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let c=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#u=i.apply({fullSlug:c?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??Tq(this.apiSection.title)}),this.apiSection.navigation!=null&&(this.#s=this.#p(this.apiSection.navigation,void 0,this.#u)),this.#s=this.#P(this.#s.map(b=>this.#j(b)),this.#g(this.#e,this.#u))}get(){let t=So.V1.followRedirects(this.#s),r=new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.workspace?.changelog?.files.map(i=>i.absoluteFilepath),this.docsWorkspace,this.#l).orUndefined();return{id:this.#l.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#f,paginated:this.apiSection.paginated,slug:this.#u.get(),icon:this.apiSection.icon,hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#u,viewers:void 0,hidden:this.hideChildren}),children:this.#s,availability:void 0,pointsTo:t,noindex:void 0,playground:this.#S(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#p(t,r,i){return t.map(n=>Xxa(n)._visit({link:a=>({id:this.#l.get(a.url),type:"link",title:a.text,icon:a.icon,url:So.Url(a.url)}),page:a=>this.#h(a,i),package:a=>this.#_(a,i),section:a=>this.#y(a,i),item:({value:a})=>this.#O(a,r,i),endpoint:a=>this.#v(a,r,i)})).filter(yv)}#h(t,r){return qeu({docsWorkspace:this.docsWorkspace,page:t,parentSlug:r,idgen:this.#l,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex})}#_(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#t.getSubpackageByLocator(t.package);if(a!=null){let u=this.#l.get(i??`${this.apiDefinitionId}:${a.id}`);this.#a.has(a.id)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a.id}`),this.#a.add(a.id),this.#o.set(u,[a.id]);let l=t.slug??Tq(a.name),d=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:l}),s=this.#p(t.contents,a.id,d),o={id:u,type:"apiPackage",children:s,title:t.title??a.displayName??OHt(a.name),slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return this.#c.set(a.id,o),o}else{this.taskContext.logger.warn(`Subpackage ${t.package} not found in ${this.apiDefinitionId}, treating it as a section`);let u=t.slug??Tq(t.package),l=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),d=this.#p(t.contents,t.package,l),s={id:this.#l.get(i??`${this.apiDefinitionId}:${Tq(t.package)}`),type:"apiPackage",children:d,title:t.title??t.package,slug:l.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return this.#c.set(t.package,s),s}}#y(t,r){let i=t.overviewAbsolutePath!=null?So.V1.PageId(Tir(this.docsWorkspace,t.overviewAbsolutePath)):void 0,n=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,a=this.#l.get(i??n??r.get()),u=t.referencedSubpackages.map(c=>{let b=this.#t.getSubpackageByLocator(c);return b?.id}).filter(c=>(c==null&&this.taskContext.logger.error(`Subpackage ${c} not found in ${this.apiDefinitionId}`),c!=null)).filter(yv);this.#o.set(a,u),u.forEach(c=>{this.#a.has(c)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${c}`),this.#a.add(c)});let l=t.slug??Tq(t.title),d=r.apply({fullSlug:n?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:l}),s=this.#p(t.contents,t.title,d),o={id:a,type:"apiPackage",children:s,title:t.title,slug:d.get(),icon:t.icon,hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};return u.forEach(c=>{this.#c.set(c,o)}),o}#O(t,r,i){t=t.trim();let n=this.#t.getSubpackageByLocator(t);if(n!=null){let a=n.id,u=this.#l.get(`${this.apiDefinitionId}:${a}`);this.#a.has(a)&&this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${a}`),this.#a.add(a),this.#o.set(u,[a]);let l=Tq(n.name),d=i.apply({urlSlug:l}),s={id:u,type:"apiPackage",children:[],title:n.displayName??OHt(n.name),slug:d.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};return this.#c.set(a,s),s}return this.#v({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,i)}#v(t,r,i){let n=this.#t.getEndpointByLocator(t.endpoint,r);if(n!=null)if(this.#r.has(n.id)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${n.id}`),n.id==null)this.taskContext.logger.error(`Expected Endpoint ID for ${n.id} at path: ${l9n(n.method,n.path)}. Got undefined.`);else{this.#r.add(n.id);let l=t.slug!=null?i.append(t.slug).get():kxa({item:n,parentSlug:i});return{id:this.#l.get(`${this.apiDefinitionId}:${n.id}`),type:"endpoint",method:n.method,endpointId:n.id,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(n.availability),isResponseStream:n.responses?.[0]?.body.type==="stream",title:t.title??n.displayName??rB(n.path),slug:l,icon:t.icon,hidden:this.hideChildren||t.hidden,playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let a=this.#t.getWebSocketByLocator(t.endpoint,r);if(a!=null)if(this.#n.has(a.id)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${a.id}`),a.id==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}else return this.#n.add(a.id),{id:this.#l.get(`${this.apiDefinitionId}:${a.id}`),type:"webSocket",webSocketId:a.id,title:t.title??a.displayName??rB(a.path),slug:t.slug!=null?i.append(t.slug).get():kxa({item:a,parentSlug:i}),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(a.availability),playground:this.#S(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};let u=this.#t.getWebhookByLocator(t.endpoint,r);if(u!=null)if(this.#i.has(u.id)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${u.id}`),u.id==null)this.taskContext.logger.error(`Expected Webhook ID for ${u.id}. Got undefined.`);else return this.#i.add(u.id),{id:this.#l.get(`${this.apiDefinitionId}:${u.id}`),type:"webhook",webhookId:u.id,method:u.method,title:t.title??u.displayName??lb("/",...u.path),slug:t.slug!=null?i.append(t.slug).get():kxa({item:u,parentSlug:i}),icon:t.icon,hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags};this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#P(t,r){return Aeu({left:t,right:r,findEndpointById:i=>this.#t.getEndpointByLocator(i,void 0),stringifyEndpointPathParts:i=>rB(i.path),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#j(t){return Zxa({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(r,i)=>this.#E(r,i),mergeAndFilterChildren:this.#P.bind(this)})}#g(t,r){let i=[];return Object.entries(t.subpackages).forEach(([n,a])=>{if(!this.#a.has(n)){let u=this.#w(n,a,r);u!=null&&i.push(u)}}),Object.entries(t.endpoints).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected Endpoint ID for ${a.id} at path: ${l9n(a.method,a.path)}. Got undefined.`);return}!this.#r.has(JA.EndpointId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#m(n,a,r,i)}),Object.entries(t.websockets).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}!this.#n.has(JA.WebSocketId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#A(n,a,r,i)}),Object.entries(t.webhooks).forEach(([n,a])=>{if(n==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}!this.#i.has(JA.WebhookId(n))&&(a.namespace?.join(".")??this.#e.id)===t.id&&this.#d(n,a,r,i)}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&i.sort((n,a)=>{let u=n.type==="endpointPair"?n.nonStream.title:n.title,l=a.type==="endpointPair"?a.nonStream.title:a.title;return u.localeCompare(l)}),i}#w(t,r,i){let n=So.V1.SlugGenerator.init(i.get()).apply({urlSlug:Tq(r.name)}),a=this.#E(t,n),u={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"apiPackage",children:a,title:r.displayName??OHt(r.name),slug:n.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:void 0,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};return this.#c.set(t,u),a.length>0?u:void 0}#D(t,r,i,n){r.slug=kxa({item:t,parentSlug:i}),n.push(r)}#m(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"endpoint",method:r.method,endpointId:JA.EndpointId(t),apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(r.availability),isResponseStream:r.responses?.[0]?.body.type==="stream",title:r.displayName??rB(r.path),slug:i.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#A(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"webSocket",webSocketId:JA.WebSocketId(t),title:r.displayName??rB(r.path),slug:i.get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:So.V1.convertAvailability(r.availability),playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#d(t,r,i,n){let a={id:So.V1.NodeId(`${this.apiDefinitionId}:${t}`),type:"webhook",webhookId:JA.WebhookId(t),method:r.method,title:r.displayName??OHt(r.id),slug:i.get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0};this.#D(r,a,i,n)}#T(t){let r=Object.fromEntries(Object.entries(this.#e?.subpackages??{}).filter(([u,l])=>t===this.#e.id?l.id.split(".").length===1:l.id!=null&&l.id.includes(t)&&l.id!==t&&l.id.split(".").length===t.split(".").length+1)),i=Object.fromEntries(Object.entries(this.#e?.endpoints??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t))),n=Object.fromEntries(Object.entries(this.#e?.websockets??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t))),a=Object.fromEntries(Object.entries(this.#e?.webhooks??{}).filter(([u,l])=>l.namespace!=null&&l.namespace.join(".")===JA.api.v1.SubpackageId(t)));return{id:JA.ApiDefinitionId(t),endpoints:i,websockets:n,webhooks:a,types:{},subpackages:r,auths:{},globalHeaders:void 0,snippetsConfiguration:void 0}}#E(t,r){let i=t!=null?this.#T(t):void 0;return i==null?(this.taskContext.logger.error(`Subpackage ${t} not found in ${this.apiDefinitionId}`),[]):this.#g(i,r)}#S(t){return Meu(t)}mergeEndpointPairs(t){return d9n({children:t,findEndpointById:r=>this.#e?.endpoints[r],stringifyEndpointPathParts:r=>rB(r.path),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}};var Ez_=ui(require("crypto"),1);function g4E(e){return Ez_.default.createHash("sha256").update(e).digest("hex")}var Beu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),g4E(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),i=0;for(;this.#t.has(r);)if(r=this.#r(t),i++,i>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return So.V1.NodeId(this.#n(t))}};function Ieu(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0}}var zeu=ui(PEe(),1);var Qjc=ui(PEe(),1);function Mz_(e,t,r){if(e.schemes.length>0&&e.schemes[0]!=null){let i=e.schemes[0];switch(i.type){case"basic":return{type:"basicAuth",passwordName:i.password.originalName,usernameName:i.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:i.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:i.name.wireValue,nameOverride:i.name.name.originalName,prefix:i.prefix,description:e.docs};case"oauth":{let n=i.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(a=>a.originalName).join(".")||"$.body.access_token";return r?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Qjc.FernRegistry.EndpointId(i.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:Qjc.FernRegistry.JqString(n),headerName:i.configuration.tokenHeader,tokenPrefix:i.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:jo(i)}}}var cm=ui(PEe(),1);var mAi=ui(PEe(),1);function qz_(e){return e._visit({alias:t=>({type:"alias",value:jE(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:e4(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>mAi.FernRegistry.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:mAi.FernRegistry.PropertyKey(r.name.wireValue),valueType:jE(r.valueType),availability:e4(r.availability),propertyAccess:r.propertyAccess})),extraProperties:P4E(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(i=>({key:mAi.FernRegistry.PropertyKey(i.name.wireValue),valueType:jE(i.valueType),availability:e4(i.availability),description:i.docs,propertyAccess:i.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(i=>({description:i.docs??void 0,discriminantValue:i.discriminantValue.wireValue,displayName:i.displayName,availability:i.availability!=null?e4(i.availability):void 0,additionalProperties:Gs.types.SingleUnionTypeProperties._visit(i.shape,{samePropertiesAsObject:n=>({extends:[mAi.FernRegistry.TypeId(n.typeId)],properties:r,extraProperties:void 0}),singleProperty:n=>({extends:[],properties:[{key:mAi.FernRegistry.PropertyKey(n.name.wireValue),valueType:jE(n.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+i.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:jE(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function jE(e){return e._visit({container:t=>Gs.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:jE(r)}),map:({keyType:r,valueType:i})=>({type:"map",keyType:jE(r),valueType:jE(i)}),optional:r=>({type:"optional",itemType:jE(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:jE(r)}),set:r=>({type:"set",itemType:jE(r)}),literal:r=>Gs.types.Literal._visit(r,{boolean:i=>({type:"literal",value:{type:"booleanLiteral",value:i}}),string:i=>({type:"literal",value:{type:"stringLiteral",value:i}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:mAi.FernRegistry.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:Gs.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>m4E(t.v2),float:()=>Az_(t.v2),double:()=>Az_(t.v2),string:()=>O4E(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function O4E(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function m4E(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function Az_(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function P4E(e){return typeof e=="boolean"?e?Kc.unknown():void 0:typeof e=="string"?{type:"id",value:mAi.FernRegistry.TypeId(e),default:void 0}:jE(e)}function Kjc(e,t){let r=e.service!=null?t.services[e.service]:void 0,i=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,n=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?w4E(r,t):[],webhooks:i!=null?j4E(i):[],websockets:n!=null?[S4E(n,t)]:[],types:e.types.map(a=>cm.FernRegistry.TypeId(a)),subpackages:e.subpackages.map(a=>cm.FernRegistry.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?cm.FernRegistry.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function j4E(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(i=>({payload:i.payload.jsonExample}))??[]),{description:t.docs??void 0,id:cm.FernRegistry.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??uUi(t.name.originalName),headers:t.headers.map(i=>({description:i.docs??void 0,key:i.name.wireValue,type:jE(i.valueType),availability:e4(i.availability)})),payload:B4E(t.payload),examples:r}})}function w4E(e,t){let r=[];for(let i of e.endpoints){let n=i.autogeneratedExamples[0],a=[];if(i.v2Examples!=null){let l,d=i.v2Examples.userSpecifiedExamples,s=i.v2Examples.autogeneratedExamples,o=Object.keys(d).length>1;for(let[b,g]of Object.entries(d))l=Tz_({shouldUseExampleName:o,exampleName:b,example:g,irEndpoint:i}),l!=null&&a.push(l);let c=Object.keys(s).length>1;for(let[b,g]of Object.entries(s))l=Tz_({shouldUseExampleName:c,exampleName:b,example:g,irEndpoint:i}),l!=null&&a.push(l)}else if(i.userSpecifiedExamples.length>0)a.push(...i.userSpecifiedExamples.map(l=>Jjc({userSpecifiedExample:l,...n!=null&&{autogeneratedExample:n},irEndpoint:i,ir:t})).filter(yv));else if(n!=null){let l=Jjc({autogeneratedExample:n,irEndpoint:i,ir:t});l!=null&&a.push(l)}else if(i.response?.body?.type==="fileDownload"){let l=zTa({ir:t,service:e,endpoint:{...i,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(l.type==="success"){let d=Jjc({autogeneratedExample:l,irEndpoint:i,ir:t});if(d!=null){let s={...d,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(s)}}}let u={slug:void 0,availability:e4(i.availability??e.availability),auth:i.auth,description:i.docs??void 0,method:A4E(i.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?cm.FernRegistry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?D4E({environmentsConfig:t.environments,endpoint:i}):void 0,id:cm.FernRegistry.EndpointId(i.name.originalName),originalEndpointId:i.id,name:i.displayName??uUi(i.name.originalName),path:i.basePath!=null?{pathParameters:i.pathParameters.map(l=>({description:l.docs??void 0,key:cm.FernRegistry.PropertyKey(l.name.originalName),type:jE(l.valueType),availability:void 0})),parts:[...p9n(i.basePath),...p9n(i.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...i.pathParameters].map(l=>({description:l.docs??void 0,key:cm.FernRegistry.PropertyKey(l.name.originalName),type:jE(l.valueType),availability:void 0})),parts:[...t.basePath!=null?p9n(t.basePath):[],...p9n(e.basePath),...p9n(i.path)]},queryParameters:i.queryParameters.map(l=>({description:l.docs??void 0,key:l.name.wireValue,type:jE(l.valueType),availability:e4(l.availability)})),headers:[...e.headers,...i.headers].map(l=>({description:l.docs??void 0,key:l.name.wireValue,type:jE(l.valueType),availability:e4(l.availability)})),request:i.requestBody!=null?q4E(i.requestBody):void 0,response:i.response!=null?T4E(i.response):void 0,errors:void 0,errorsV2:C4E(i.errors,t),examples:a,protocol:i.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:i.id}),proto:l=>({type:"grpc",methodName:i.id,methodType:l.methodType}),_other:()=>{}})};r.push(u)}return r}function S4E(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let i=Object.values(e.v2Examples.userSpecifiedExamples),n=Object.values(e.v2Examples.autogeneratedExamples),a=i.length>0?i[0]:n[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(u=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(u.type),body:u.body}))??[]})}else r=e.examples.map(i=>({name:i.name?.originalName,description:i.docs,path:i.url,pathParameters:i.pathParameters.reduce((n,a)=>(n[cm.FernRegistry.PropertyKey(a.name.originalName)]=a.value.jsonExample,n),{}),queryParameters:i.queryParameters.reduce((n,a)=>(n[a.name.wireValue]=a.value.jsonExample,n),{}),headers:i.headers.reduce((n,a)=>(n[a.name.wireValue]=a.value.jsonExample,n),{}),messages:i.messages.map(n=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(n.type),body:n.body.jsonExample}))}));return{auth:e.auth,availability:e4(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?cm.FernRegistry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?E4E({environmentsConfig:t.environments,channel:e}):[],id:cm.FernRegistry.WebSocketId(e.name.originalName),name:e.displayName??uUi(e.name.originalName),path:{pathParameters:e.pathParameters.map(i=>({description:i.docs??void 0,key:cm.FernRegistry.PropertyKey(i.name.originalName),type:jE(i.valueType),availability:void 0})),parts:p9n(e.path)},headers:e.headers.map(i=>({key:i.name.wireValue,type:jE(i.valueType),description:i.docs,availability:e4(i.availability)})),queryParameters:e.queryParameters.map(i=>({description:i.docs??void 0,key:i.name.wireValue,type:jE(i.valueType),availability:e4(i.availability)})),messages:e.messages.map(i=>({type:cm.FernRegistry.api.v1.WebSocketMessageId(i.type),displayName:i.displayName,origin:i.origin,body:I4E(i.body),description:i.docs,availability:e4(i.availability)})),examples:r}}function e4(e){if(e!=null)switch(e.status){case"DEPRECATED":return cm.FernRegistry.Availability.Deprecated;case"PRE_RELEASE":return cm.FernRegistry.Availability.Beta;case"GENERAL_AVAILABILITY":return cm.FernRegistry.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return cm.FernRegistry.Availability.Beta;default:jo(e.status)}}function D4E({environmentsConfig:e,endpoint:t}){let r=e.environments,i=t.baseUrl,n=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:cm.FernRegistry.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(n!=null)return n.flatMap(u=>r.environments.map(l=>{let d=l.urls[u];if(d==null)throw new Error(`Expected environment ${l.id} to contain url for ${u}`);return{id:cm.FernRegistry.EnvironmentId(u),baseUrl:d}})).filter((u,l,d)=>l===d.findIndex(s=>s.id===u.id&&s.baseUrl===u.baseUrl));if(i==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let u=a.urls[i];if(u==null)throw new Error(`Expected environment ${a.id} to contain url for ${i}`);return{id:cm.FernRegistry.EnvironmentId(a.id),baseUrl:u}});default:jo(r)}}function E4E({environmentsConfig:e,channel:t}){let r=e.environments,i=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(n=>({id:cm.FernRegistry.EnvironmentId(n.id),baseUrl:M4E(n.url,"wss")}));case"multipleBaseUrls":if(i==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(n=>{let a=n.urls[i];if(a==null)throw new Error(`Expected environment ${n.id} to contain url for ${i}`);return{id:cm.FernRegistry.EnvironmentId(n.id),baseUrl:a}});default:jo(r)}}function M4E(e,t){return e.replace(/^[^:]+/,t)}function A4E(e){return Gs.http.HttpMethod._visit(e,{get:()=>cm.FernRegistry.HttpMethod.Get,post:()=>cm.FernRegistry.HttpMethod.Post,put:()=>cm.FernRegistry.HttpMethod.Put,patch:()=>cm.FernRegistry.HttpMethod.Patch,delete:()=>cm.FernRegistry.HttpMethod.Delete,head:()=>cm.FernRegistry.HttpMethod.Get,_other:()=>{throw new Error("Unknown http method: "+e)}})}function p9n(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:cm.FernRegistry.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function q4E(e){let t=Gs.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??_M.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(i=>cm.FernRegistry.TypeId(i.typeId)),properties:r.properties.map(i=>({description:i.docs??void 0,key:cm.FernRegistry.PropertyKey(i.name.wireValue),valueType:jE(i.valueType),availability:e4(i.availability),propertyAccess:void 0})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??_M.APPLICATION_JSON,shape:{type:"reference",value:jE(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(i=>i._visit({file:n=>{let a=n._visit({file:u=>({type:"file",key:cm.FernRegistry.PropertyKey(u.key.wireValue),isOptional:u.isOptional,contentType:u.contentType,description:u.docs??void 0,availability:void 0}),fileArray:u=>({type:"fileArray",key:cm.FernRegistry.PropertyKey(u.key.wireValue),isOptional:u.isOptional,contentType:u.contentType,description:u.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:n=>({type:"bodyProperty",key:cm.FernRegistry.PropertyKey(n.name.wireValue),valueType:jE(n.valueType),contentType:n.contentType,description:n.docs??void 0,availability:e4(n.availability),exploded:n.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(yv)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function T4E(e){if(e.body==null)return;let t,r=Gs.http.HttpResponseBody._visit(e.body,{fileDownload:i=>(t=i.docs,{type:"fileDownload",contentType:void 0}),json:i=>(t=i.docs,{type:"reference",value:jE(i.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:i=>{if(i.type==="text")return t=i.docs,{type:"streamingText"};if(i.type==="json")return t=i.docs,{type:"stream",shape:{type:"reference",value:jE(i.payload)},terminator:i.terminator};if(i.type==="sse")return t=i.docs,{type:"stream",shape:{type:"reference",value:jE(i.payload)},terminator:i.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function C4E(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let i of e){let n=t.errors[i.error.errorId];n&&r.push({type:n.type==null?void 0:{type:"alias",value:jE(n.type)},statusCode:n.statusCode,description:n.docs??void 0,name:n.displayName??n.name.name.originalName,availability:void 0,examples:n.examples.map(a=>({name:a.name?.originalName,responseBody:{type:"json",value:a.jsonExample},description:a.docs}))})}else for(let i of e){let n=t.errors[i.error.errorId];if(n){let a=[{key:cm.FernRegistry.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:n.discriminantValue.name.originalName}},description:n.docs,availability:void 0,propertyAccess:void 0}];n.type!=null&&a.push({key:cm.FernRegistry.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:jE(n.type),description:n.docs,availability:void 0,propertyAccess:void 0}),r.push({type:n.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:n.statusCode,description:n.docs??void 0,availability:void 0,name:n.displayName??n.name.name.originalName,examples:n.examples.map(u=>({name:u.name?.originalName,responseBody:{type:"json",value:u.jsonExample},description:u.docs}))})}}return r}function Tz_({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:i}){if(r==null)return;let n=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:r.request?.headers??{},requestBody:r.request?.requestBody,requestBodyV3:i.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:a=>{if(r.request==null)return;let u={};if(Gj(r.request.requestBody)){let l=r.request.requestBody;for(let d of a.properties)d._visit({file:s=>{let o=l[s.key.wireValue];if(s.type==="file")u[s.key.wireValue]={type:"filename",value:typeof o=="string"?o:"<file1>"};else if(s.type==="fileArray"){let c=(Array.isArray(o)?o:[o]).filter(b=>typeof b=="string");u[s.key.wireValue]={type:"filenames",value:c}}},bodyProperty:s=>{if(s.style==="exploded"){let o=l[s.name.wireValue];u[s.name.wireValue]={type:"exploded",value:Array.isArray(o)?o:[o]}}else u[s.name.wireValue]={type:"json",value:l[s.name.wireValue]}},_other:Qze})}return{type:"form",value:u}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??i.response?.statusCode??200,responseBody:n??void 0,responseBodyV3:n!=null?r.response?.body?._visit({json:a=>({type:"json",value:a}),stream:a=>({type:"stream",value:a.map(u=>({type:"json",value:u}))}),error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(a=>({name:a.name,description:a.docs??void 0,install:void 0,language:a.language,code:a.code})).filter(yv)}}function Jjc({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:i}){let n=i.headers.map(l=>{let d=l.valueType.type==="container"&&l.valueType.container.type==="literal"?l.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}}):void 0;if(d!=null)return{name:l.name,value:{jsonExample:d,shape:Gs.ExampleTypeReferenceShape.primitive(Gs.ExamplePrimitive.string({original:d}))}}}).filter(yv),a=e?.example??t?.example;if(a==null)return;let{codeSamples:u}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((l,d)=>(l[cm.FernRegistry.PropertyKey(d.name.originalName)]=d.value.jsonExample,l),{}),queryParameters:a.queryParameters.reduce((l,d)=>(l[d.name.wireValue]=d.value.jsonExample,l),{}),headers:[...n,...a.serviceHeaders,...a.endpointHeaders].reduce((l,d)=>(l[d.name.wireValue]=d.value.jsonExample,l),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:l=>{if(a.request==null)return;let d={};if(Gj(a.request.jsonExample)){let s=a.request.jsonExample;for(let o of l.properties)o._visit({file:c=>{let b=s[c.key.wireValue];if(c.type==="file")d[c.key.wireValue]={type:"filename",value:typeof b=="string"?b:"<file1>"};else if(c.type==="fileArray"){let g=(Array.isArray(b)?b:[b]).filter(O=>typeof O=="string");d[c.key.wireValue]={type:"filenames",value:g}}},bodyProperty:c=>{if(c.style==="exploded"){let b=s[c.name.wireValue];d[c.name.wireValue]={type:"exploded",value:Array.isArray(b)?b:[b]}}else d[c.name.wireValue]={type:"json",value:s[c.name.wireValue]}},_other:Qze})}return{type:"form",value:d}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??Gs.http.ExampleResponse._visit(a.response,{ok:l=>l._visit({body:d=>d!=null?200:204,stream:d=>d.length>0?200:204,sse:d=>d.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+l.type)}}),error:({error:l})=>{let d=i.errors[l.errorId];if(d==null)throw new Error("Cannot find error "+l.errorId);return d.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:l=>l._visit({body:d=>d?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:l=>l.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:l=>l._visit({body:d=>d!=null?{type:"json",value:d.jsonExample}:void 0,stream:d=>({type:"stream",value:d.map(s=>s.jsonExample)}),sse:d=>({type:"sse",value:d.map(({event:s,data:o})=>({event:s,data:o.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+l.type)}}),error:l=>l.body!=null?{type:"json",value:l.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:u?.map(l=>wEe._visit(l,{language:d=>({language:d.language,code:d.code,name:d.name?.originalName,description:d.docs??void 0,install:d.install}),sdk:d=>({language:d.sdk,code:d.code,name:d.name?.originalName,description:d.docs??void 0,install:void 0}),_other:()=>{}})).filter(yv)}}function B4E(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>cm.FernRegistry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:cm.FernRegistry.PropertyKey(t.name.wireValue),valueType:jE(t.valueType),availability:e4(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:jE(e.payloadType)},description:e.docs};default:jo(e)}}function I4E(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>cm.FernRegistry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:cm.FernRegistry.PropertyKey(t.name.wireValue),valueType:jE(t.valueType),availability:e4(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:jE(e.bodyType)};default:jo(e)}}function ZZ({ir:e,snippetsConfig:t,playgroundConfig:r}){let i={types:{},subpackages:{},rootPackage:Kjc(e.rootPackage,e),auth:Mz_(e.auth,e,r),snippetsConfiguration:t,globalHeaders:e.headers.map(n=>({availability:e4(n.availability),description:n.docs??void 0,key:n.name.wireValue,type:jE(n.valueType)})),navigation:void 0};for(let[n,a]of Object.entries(e.types))i.types[zeu.FernRegistry.TypeId(n)]={description:a.docs??void 0,name:a.name.name.originalName,shape:qz_(a.shape),availability:e4(a.availability),displayName:a.name.displayName};for(let[n,a]of Object.entries(e.subpackages)){let u=a.service!=null?e.services[a.service]:void 0;i.subpackages[zeu.FernRegistry.api.v1.SubpackageId(n)]={subpackageId:zeu.FernRegistry.api.v1.SubpackageId(n),displayName:u?.displayName,name:a.name.originalName,description:a.docs??void 0,...Kjc(a,e)}}return i}var Yjc=ui(PEe(),1);async function Xjc({organization:e,workspace:t,context:r,token:i,audiences:n,snippetsConfig:a,playgroundConfig:u}){let l=hR({workspace:t,audiences:n,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new _R(r,t)}),d=zWi({token:i.value}),s=ZZ({ir:l,snippetsConfig:a,playgroundConfig:u}),o=await d.api.v1.register.registerApiDefinition({orgId:Yjc.FernRegistry.OrgId(e),apiId:Yjc.FernRegistry.ApiId(l.apiName.originalName),definition:s});if(o.ok)return r.logger.debug(`Registered API Definition ${o.body.apiDefinitionId}`),{id:o.body.apiDefinitionId,ir:l};switch(o.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",o.error)}}var z4E=new rKi({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function tRa(e,t,r){return Sxa(Pxa(ZZ({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0},playgroundConfig:r}),Y6.ApiDefinitionId(t),z4E))}var uh={};mo(uh,{AlgoliaSearchIndex:()=>Cz_,ApiDefinitionId:()=>kz_,ApiId:()=>ix_,Availability:()=>bx_,DocsConfigId:()=>nx_,EndpointId:()=>ox_,EndpointPathLiteral:()=>yx_,EnvironmentId:()=>ax_,FileId:()=>fx_,HttpMethod:()=>vx_,IndexSegmentId:()=>Bz_,JqString:()=>px_,OrgId:()=>tx_,PageId:()=>lx_,PayloadLocation:()=>$x_,PropertyKey:()=>_x_,PullRequestState:()=>Lx_,RoleId:()=>hx_,TokenId:()=>rx_,TypeId:()=>cx_,Url:()=>dx_,VersionId:()=>ex_,WebSocketId:()=>ux_,WebhookId:()=>sx_,algolia:()=>Zjc,api:()=>swc,commons:()=>cwc,diff:()=>gx_,docs:()=>bwc,generators:()=>Owc,git:()=>mwc,navigation:()=>wwc,sdks:()=>Dwc,snippets:()=>Wx_,snippetsFactory:()=>Hx_,templates:()=>Ewc,tokens:()=>Gx_});var Zjc={};mo(Zjc,{AlgoliaSearchIndex:()=>Cz_,IndexSegmentId:()=>Bz_});function Cz_(e){return e}function Bz_(e){return e}var swc={};mo(swc,{latest:()=>twc,v1:()=>uwc});var twc={};mo(twc,{AuthSchemeId:()=>Iz_,WebhookHttpMethod:()=>Nz_,auth:()=>kjc,commons:()=>zz_,endpoint:()=>xz_,type_:()=>Rz_,webhook:()=>ewc,websocket:()=>Fz_});var kjc={};mo(kjc,{AuthSchemeId:()=>Iz_});function Iz_(e){return e}var zz_={};var xz_={};var Rz_={};var ewc={};mo(ewc,{WebhookHttpMethod:()=>Nz_});var Nz_={Get:"GET",Post:"POST"};var Fz_={};var uwc={};mo(uwc,{SubpackageId:()=>Kz_,WebSocketMessageId:()=>Yz_,WebSocketMessageOrigin:()=>Xz_,WebhookHttpMethod:()=>Zz_,commons:()=>owc,db:()=>rwc,read:()=>nwc,register:()=>awc});var rwc={};mo(rwc,{endpoint:()=>Lz_});var Lz_={};var nwc={};mo(nwc,{SupportedLanguage:()=>Uz_,endpoint:()=>iwc,type_:()=>Vz_,webhook:()=>Wz_,websocket:()=>Hz_});var iwc={};mo(iwc,{SupportedLanguage:()=>Uz_});var Uz_={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var Vz_={};var Wz_={};var Hz_={};var awc={};mo(awc,{SourceId:()=>x4E,endpoint:()=>$z_,type_:()=>Gz_,webhook:()=>Qz_,websocket:()=>Jz_});var $z_={};var Gz_={};var Qz_={};var Jz_={};function x4E(e){return e}var owc={};mo(owc,{SubpackageId:()=>Kz_,WebSocketMessageId:()=>Yz_,WebSocketMessageOrigin:()=>Xz_,WebhookHttpMethod:()=>Zz_});function Kz_(e){return e}function Yz_(e){return e}var Xz_={Client:"client",Server:"server"};var Zz_={Get:"GET",Post:"POST"};var cwc={};mo(cwc,{ApiDefinitionId:()=>kz_,ApiId:()=>ix_,Availability:()=>bx_,DocsConfigId:()=>nx_,EndpointId:()=>ox_,EndpointPathLiteral:()=>yx_,EnvironmentId:()=>ax_,FileId:()=>fx_,HttpMethod:()=>vx_,JqString:()=>px_,OrgId:()=>tx_,PageId:()=>lx_,PropertyKey:()=>_x_,RoleId:()=>hx_,TokenId:()=>rx_,TypeId:()=>cx_,Url:()=>dx_,VersionId:()=>ex_,WebSocketId:()=>ux_,WebhookId:()=>sx_});function kz_(e){return e}function ex_(e){return e}function tx_(e){return e}function rx_(e){return e}function ix_(e){return e}function nx_(e){return e}function ax_(e){return e}function ox_(e){return e}function ux_(e){return e}function sx_(e){return e}function cx_(e){return e}function lx_(e){return e}function fx_(e){return e}function dx_(e){return e}function px_(e){return e}function _x_(e){return e}function hx_(e){return e}function yx_(e){return e}var vx_={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var bx_={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var gx_={};var bwc={};mo(bwc,{latest:()=>dwc,v1:()=>ywc,v2:()=>vwc});var dwc={};mo(dwc,{Layout:()=>mx_,MdxEngine:()=>R4E,TwitterCardSetting:()=>Px_,commons:()=>Ox_,frontmatter:()=>lwc,seo:()=>fwc});var R4E={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var Ox_={};var lwc={};mo(lwc,{Layout:()=>mx_});var mx_={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var fwc={};mo(fwc,{TwitterCardSetting:()=>Px_});var Px_={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var ywc={};mo(ywc,{commons:()=>hwc,db:()=>jx_,read:()=>wx_,write:()=>pwc});var jx_={};var wx_={};var pwc={};mo(pwc,{DocsRegistrationId:()=>F4E,FilePath:()=>N4E});function N4E(e){return e}function F4E(e){return e}var hwc={};mo(hwc,{ContentAlignment:()=>Mx_,FontDisplay:()=>Bx_,FontStyle:()=>Cx_,HeaderPosition:()=>Ax_,JsScriptStrategy:()=>Tx_,ProgrammingLanguage:()=>Sx_,SearchbarPlacement:()=>Dx_,TabsPlacement:()=>Ex_,TwitterCardSetting:()=>qx_,commons:()=>_wc});var _wc={};mo(_wc,{ContentAlignment:()=>Mx_,FontDisplay:()=>Bx_,FontStyle:()=>Cx_,HeaderPosition:()=>Ax_,JsScriptStrategy:()=>Tx_,ProgrammingLanguage:()=>Sx_,SearchbarPlacement:()=>Dx_,TabsPlacement:()=>Ex_,TwitterCardSetting:()=>qx_});var Sx_={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var Dx_={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var Ex_={Header:"HEADER",Sidebar:"SIDEBAR"};var Mx_={Center:"CENTER",Left:"LEFT"};var Ax_={Fixed:"FIXED",Absolute:"ABSOLUTE"};var qx_={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var Tx_={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var Cx_={Normal:"normal",Italic:"italic"};var Bx_={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var vwc={};mo(vwc,{read:()=>Ix_,write:()=>zx_});var Ix_={};var zx_={};var Owc={};mo(Owc,{ChangelogEntryType:()=>Rx_,GeneratorId:()=>L4E,GeneratorLanguage:()=>U4E,ReleaseType:()=>Nx_,cli:()=>xx_,commons:()=>gwc,versions:()=>Fx_});var xx_={};var gwc={};mo(gwc,{ChangelogEntryType:()=>Rx_,ReleaseType:()=>Nx_});var Rx_={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var Nx_={Ga:"GA",Rc:"RC"};var Fx_={};function L4E(e){return e}var U4E={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var mwc={};mo(mwc,{PullRequestState:()=>Lx_});var Lx_={Open:"open",Closed:"closed",Merged:"merged"};var wwc={};mo(wwc,{latest:()=>Pwc,v1:()=>jwc});var Pwc={};mo(Pwc,{NodeId:()=>H4E,ProductId:()=>$4E,Slug:()=>V4E,TabId:()=>W4E});function V4E(e){return e}function W4E(e){return e}function H4E(e){return e}function $4E(e){return e}var jwc={};mo(jwc,{NavigationV1Availability:()=>Y4E,NodeId:()=>J4E,ProductId:()=>K4E,Slug:()=>G4E,TabId:()=>Q4E});function G4E(e){return e}function Q4E(e){return e}function J4E(e){return e}function K4E(e){return e}var Y4E={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var Dwc={};mo(Dwc,{Language:()=>Ux_,VersionBump:()=>Vx_,versions:()=>Swc});var Swc={};mo(Swc,{Language:()=>Ux_,VersionBump:()=>Vx_});var Ux_={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var Vx_={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var Wx_={};var Hx_={};var Ewc={};mo(Ewc,{PayloadLocation:()=>$x_});var $x_={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var Gx_={};var _9n=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function Gd(e){return e!=null}var Jx_=ui(SCn(),1);var Qx_=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function Cir(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,Jx_.default)(e,{special:Qx_}).replace(/V\s(\d)/g,"V$1")}function xeu({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(i=>{let n=[];i.namespace?.forEach(a=>{let u=[...n,a],l=uh.api.v1.SubpackageId(u.join("."));r[l]={id:l,name:a,displayName:Cir(a)},n.push(a)})}),r}var Reu=class{errors=new _9n},h9n=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function Kx_(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var Neu=class extends Reu{},n_=class extends h9n{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){if(super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,n!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((u,l)=>u===this.accessPath[this.accessPath.length-a.length+l])||this.accessPath.push(...a)}r.logger.debug(`Processing ${Kx_(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},x3=class extends n_{},Qae=class extends x3{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var Yx_="x-fern-base-path",Xx_="x-fern-availability",Feu="x-fern-sdk-group-name",Zx_="x-fern-global-headers",kx_="x-fern-sdk-method-name";var eR_="x-fern-webhook",tR_="x-fern-access-token-locator",rR_="x-fern-basic",iR_="x-fern-username-variable-name",nR_="x-fern-password-variable-name",aR_="x-fern-bearer",oR_="x-fern-token-variable-name",uR_="x-fern-header",sR_="x-fern-header-variable-name",cR_="x-fern-server-name",lR_="x-fern-examples";var Leu=class extends n_{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[cR_]}convert(){if(this.serverName!=null)return this.serverName}};var Ueu=class extends n_{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,i])=>t.replace(`{${r}}`,i.default),this.input.url)??this.input.url,this.serverName=new Leu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:uh.EnvironmentId(t),baseUrl:this.url}}};function Bir(e,t,r,i){let n=e??[],a=new Set(n.map(l=>l.url)),u=(t??[]).filter(l=>!a.has(l.url)).map((l,d)=>new Ueu({input:l,context:r,accessPath:i,pathId:["servers",`${d}`]}));return[...n,...u]}function LS(e){return typeof e=="object"&&Gd(e)&&"$ref"in e&&typeof e.$ref=="string"}function iH(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(LS(n)&&(n=iH(n,t,r)),n)}function Veu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return LS(r)?iH(r,t,void 0):r}var PR_=ui(lz());var Weu=class extends n_{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[rR_];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var Heu=class extends n_{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[nR_]}convert(){return this.passwordVariableName}};var $eu=class extends n_{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[iR_]}convert(){return this.usernameVariableName}};var Geu=class extends n_{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[aR_];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var Qeu=class extends n_{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[oR_]}convert(){return this.tokenVariableName}};function fR_(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var dR_="x-bearer-format",pR_="x-code-samples",_R_="x-codeSamples";var Jeu=class extends n_{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[dR_]}convert(){return this.bearerFormat}};var Keu=class extends n_{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[uR_];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var Yeu=class extends n_{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[sR_]}convert(){return this.headerVariableName}};function hR_(e){return e.type==="apiKey"}var y9n=class extends n_{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){hR_(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new Keu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new Yeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new Jeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function yR_(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function vR_(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function bR_(e){let t=[],r=e.length;if(r===0)return t;let i=0,n="",a="",u=!1;for(e.charCodeAt(0)===46&&(t.push(""),i++);i<r;){let l=e[i];a?l==="\\"&&i+1<r?(i++,n+=e[i]):l===a?a="":n+=l:u?l==='"'||l==="'"?a=l:l==="]"?(u=!1,t.push(n),n=""):n+=l:l==="["?(u=!0,n&&(t.push(n),n="")):l==="."?n&&(t.push(n),n=""):n+=l,i++}return n&&t.push(n),t}function Mwc(e,t,r){if(e==null)return r;switch(typeof t){case"string":{let i=e[t];return i===void 0?yR_(t)?Mwc(e,bR_(t),r):r:i}case"number":case"symbol":{typeof t=="number"&&(t=vR_(t));let i=e[t];return i===void 0?r:i}default:{if(Array.isArray(t))return X4E(e,t,r);Object.is(t?.valueOf(),-0)?t="-0":t=String(t);let i=e[t];return i===void 0?r:i}}}function X4E(e,t,r){if(t.length===0)return r;let i=e;for(let n=0;n<t.length;n++){if(i==null)return r;i=i[t[n]]}return i===void 0?r:i}function gR_(e){return function(t){return Mwc(t,e)}}function Awc(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(Awc).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Xeu(e,t){switch(t=t??ST_,typeof t){case"string":case"symbol":case"number":case"object":return aL(e,gR_(t));case"function":return aL(e,t)}}function OR_(e){return typeof e!="string"&&(e=Awc(e)),e.replace(/['\u2019]/g,"")}function mHt(e){return tE_(OR_(e))}function yA(e){if(e!=null)return Array.isArray(e)?e:[e]}function Zeu({namespace:e,path:t,method:r,sdkMethodName:i,operationId:n,displayName:a,isWebhook:u}){if(t==null)return;let l=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(i==null&&n==null&&a==null&&l==null))return`${Z4E(u)}${k4E(e)}.${e2E(i,n,a,l)}`}function Z4E(e){return e?"webhook_":"endpoint_"}function k4E(e){return e!=null?yA(e)?.map(t=>mHt(t)).join("/"):""}function e2E(e,t,r,i){return e||t||mHt(r??"")||mHt(i??"")}function mR_(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var keu=class extends n_{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[tR_],this.accessTokenLocator!=null&&(mR_(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var etu=class extends n_{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new y9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new keu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=Zeu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:uh.EndpointId(r),accessTokenLocator:uh.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var v9n=class extends n_{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new Weu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new $eu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new Heu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new Geu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new Qeu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{fR_(this.input)?(this.authScheme="header",this.headerAuthNode=new y9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new etu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new PR_.UnreachableCaseError(this.authScheme);return}}};var b9n=class extends n_{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(i=>{let n=Veu(i,this.context.document);if(n==null){this.context.errors.warning({message:`No auth scheme found for ${i}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new v9n({input:n,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[i]=a):this.context.errors.warning({message:`No auth scheme found for ${i}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[t,i]}).filter(Gd))}};var ttu=class extends n_{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[Yx_],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function jR_(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function wR_(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function g9n(e,t){return e==null?void 0:Object.entries(e).map(([i,n])=>yA(n.convert())?.map(u=>((t!=null&&!t.includes(i)||t==null&&!jR_(n))&&(u=wR_(u,u.type==="enum"?u.default:void 0)),{key:uh.PropertyKey(i),valueShape:u,description:n.description,availability:n.availability?.convert()})).filter(Gd)).filter(Gd).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(u=>[...a,u]):[[...a]]),[[]])}function rtu(e,t){return LS(e)?iH(e,t,void 0):e}function PAi(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function SR_(e,t){let r={...e};for(let[i,n]of Object.entries(t??{}))r[i]=[...r[i]??[],...n];return Object.keys(r).length>0?r:void 0}function DR_(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let i of e)for(let n of t)r.push({path:i.path??n.path,responseStatusCode:i.responseStatusCode??n.responseStatusCode,name:i.name??n.name,description:i.description??n.description,pathParameters:i.pathParameters??n.pathParameters,queryParameters:i.queryParameters??n.queryParameters,headers:i.headers??n.headers,requestBody:i.requestBody??n.requestBody,responseBody:i.responseBody??n.responseBody,snippets:{...n.snippets,...i.snippets}});return r}var ER_=ui(lz());var qwc=["decimal","decimal128","double-int","double","float","sf-decimal"],Twc=["int16","int32","int64","int8","sf-integer","uint8"],Cwc=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],Bwc=["beta","pre-release","in-development","generally-available","deprecated"];function R3(e,t){return LS(e)?iH(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var jFe=class extends n_{availability;constructor(t){super(t),this.safeParse()}parse(){if(R3(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[Xx_];r!=null&&(Bwc.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${Bwc.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return uh.Availability.Beta;case"in-development":return uh.Availability.InDevelopment;case"generally-available":return uh.Availability.GenerallyAvailable;case"deprecated":return uh.Availability.Deprecated;case void 0:return;default:new ER_.UnreachableCaseError(this.availability);return}}};var ntu=ui(lz());function MR_(e){return typeof e=="object"&&e!=null&&"language"in e}function AR_(e){return typeof e=="object"&&e!=null&&"sdk"in e}function qR_(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function TR_(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function itu(e){return typeof e=="object"&&e!=null&&"event"in e}function Iwc(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(itu)}function jAi(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function CR_(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var atu=class extends n_{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,i,n,a){super(t),this.path=r,this.successResponseStatusCode=i,this.requestBodyByContentType=n,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[lR_]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([n,a])=>{let u=typeof r=="object"?r[n]:void 0;switch(a.multipartType){case"file":return jAi(u)?[n,{type:"filenameWithData",filename:u.filename,data:uh.FileId(u.data)}]:u!=null?[n,{type:"filename",value:u}]:void 0;case"files":{if(Array.isArray(u)){if(u.every(l=>jAi(l)))return[n,{type:"filenamesWithData",value:u.map(l=>({filename:l.filename,data:uh.FileId(l.data)}))}];if(u.every(l=>typeof l=="string"))return[n,{type:"filenames",value:u}]}return}case"property":return[n,{type:"json",value:u}];case void 0:return;default:new ntu.UnreachableCaseError(a.multipartType);return}}).filter(Gd))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(i=>{let n=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(n!=null)switch(n.contentType){case"form-data":a=CR_(r.request)?this.convertFormDataExampleRequest(n,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new ntu.UnreachableCaseError(n.contentType);break}let u;switch(i.contentType){case"application/json":{qR_(r.response)&&(u={type:"json",value:r.response.body});break}case"text/event-stream":{Iwc(r.response)&&(u={type:"sse",value:r.response.stream.map(c=>({event:c.event,data:c.data}))});break}case"application/octet-stream":!Iwc(r.response)&&TR_(r.response)&&(u={type:"stream",value:r.response.stream});break;case void 0:break;default:new ntu.UnreachableCaseError(i.contentType);break}let l={};r["code-samples"]?.forEach(c=>{MR_(c)?c.language!=null&&(l[c.language]??=[],l[c.language]?.push({name:c.name,language:c.language,install:c.install,code:c.code,generated:!1,description:c.docs})):AR_(c)&&c.sdk!=null&&(l[c.sdk]??=[],l[c.sdk]?.push({name:c.name,language:c.sdk,install:void 0,code:c.code,generated:!1,description:c.docs}))});let d=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([c,b])=>[uh.PropertyKey(c),b])),s=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([c,b])=>[uh.PropertyKey(c),b])),o=Object.fromEntries(Object.entries(r.headers??{}).map(([c,b])=>[uh.PropertyKey(c),b]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,headers:Object.keys(o).length>0?o:void 0,requestBody:a,responseBody:u,snippets:l}}))}};var rRa=class extends n_{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[Feu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>uh.api.v1.SubpackageId(mHt(r)))}};var otu=class extends n_{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[kx_]}convert(){return this.sdkMethodName}};var utu=class extends n_{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[eR_]}convert(){return this.isWebhook}};var stu=class extends n_{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[pR_]??[],...this.input[_R_]??[]],this.codeSamples.forEach(t=>{[...Object.values(uh.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var pKi=ui(lz());function zwc(e,t){return LS(e)?iH(e,t,void 0):e}function BR_(e,t){return e.replace(/{(\w+)}/g,(r,i)=>t[i]!=null&&typeof t[i]=="string"||typeof t[i]=="number"||typeof t[i]=="boolean"?`${t[i]}`:r)}var lL="",Iir=class extends n_{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,i,n,a){super(t),this.path=r,this.responseStatusCode=i,this.name=n,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,i])=>{let n=this.resolvedRequestInput?.value[r];switch(i.multipartType){case"file":return t&&(jAi(n)||typeof n=="string");case"files":return t&&Array.isArray(n)&&n.every(a=>jAi(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new pKi.UnreachableCaseError(i.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=zwc(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=zwc(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(itu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,i])=>{let n=this.resolvedRequestInput?.value?.[r];switch(i.multipartType){case"file":return jAi(n)?[r,{type:"filenameWithData",filename:n.filename,data:uh.FileId(n.data)}]:[r,{type:"filename",value:n}];case"files":{if(Array.isArray(n)){if(n.every(a=>jAi(a)))return[r,{type:"filenamesWithData",value:n.map(a=>({filename:a.filename,data:uh.FileId(a.data)}))}];if(n.every(a=>typeof a=="string"))return[r,{type:"filenames",value:n}]}return}case"property":return[r,{type:"json",value:n}];case void 0:return;default:new pKi.UnreachableCaseError(i.multipartType);return}}).filter(Gd))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new pKi.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new pKi.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let i=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([u,l])=>[u,l.example({includeOptionals:!1,override:u})]));i=Object.keys(i).length>0?i:void 0;let n=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([u,l])=>l.required||l.inputExample!=null?[u,l.example({includeOptionals:!1,override:u})]:void 0).filter(Gd));n=Object.keys(n).length>0?n:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([u,l])=>l.required||l.inputExample!=null?[u,l.example({includeOptionals:!1,override:u})]:void 0).filter(Gd));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&n==null&&i==null))return{path:BR_(this.path,i??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?Cir(this.name):this.summary!=null?Cir(this.summary):void 0,description:this.convertDescription(),pathParameters:i,queryParameters:n,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function IR_(e,t){return LS(e)?iH(e,t,void 0):e}var QR_=ui(lz());var zR_="#/components/schemas/";function O9n(e){if(e.$ref.startsWith(zR_))return e.$ref.replace(zR_,"")}function _pi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function wAi(e){return typeof e.type=="string"&&e.type==="array"}function xR_(e){return e.type==="boolean"}function RR_(e){return e.type==="integer"}function SAi(e){return!Array.isArray(e.type)&&!wAi(e)}function NR_(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||SAi(t)||wAi(t))}function FR_(e){return"nullable"in e&&typeof e.nullable=="boolean"}function LR_(e){return e.type==="null"}function UR_(e){return e.type==="number"}function xwc(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function VR_(e){return e.type==="string"}var ctu=class extends Qae{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new Gq({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return yA(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var ltu=class extends x3{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var ftu=class extends Qae{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new Gq({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(Gd)}convert(){if(this.typeNodes==null)return;let i=this.typeNodes.map(n=>yA(n.convert())?.map(u=>({displayName:n.name,shape:u,description:n.description,availability:n.availability?.convert()}))).filter(Gd).reduce((n,a)=>n.flatMap(u=>a.length>0?a.map(l=>[...u,l]):[[...u]]),[[]]).map(n=>({type:"undiscriminatedUnion",variants:n}));return this.nullable?i.map(_pi).filter(Gd):i}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function dtu(e){return e!=null&&e.length>0?e:[void 0]}var m9n=class extends Qae{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new Gq({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(LS(t))return O9n(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([i,n])=>[i,new Gq({input:n,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",i],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(Gd))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return g9n(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:yA(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(Gd)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(i=>dtu(r).map(n=>(this.extends==null||this.extends.length===0)&&i.length===0&&n!=null?{type:"alias",value:n}:{type:"object",extends:this.extends.map(a=>uh.TypeId(a)),properties:i,extraProperties:n}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(i=>{let n=R3(i,this.context.document);n!=null&&(r={...r,...Object.fromEntries(Object.entries(n.properties??{}).map(([a,u])=>[a,new Gq({input:u,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((i,n)=>{let a=r?.[n];return i[n]=a?.example({includeOptionals:t,override:n}),i},{}):Object.entries(r).reduce((i,[n,a])=>(i[n]=a?.example({includeOptionals:t,override:n}),i),{}))}};var ptu=class extends Qae{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>R3(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>R3(t,this.context.document)?.type!=="null"?new Gq({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(Gd);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([i,n])=>{let a=R3({$ref:n},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${n}`,path:[...this.accessPath,"discriminator","mapping",i]});return}r[i]=new Gq({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",i],pathId:i,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let n=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(Gd);return this.isNullable&&n!=null?n.map(_pi).filter(Gd):n}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:uh.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([n,a])=>yA(a.convert())?.map(l=>{if(!(l==null||l.type!=="object"))return{discriminantValue:n,displayName:a.name??Cir(n),availability:a.availability?.convert(),description:a.description,...l}}).filter(Gd)).filter(Gd)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(n=>yA(n.convert())?.map(u=>{if(u==null)return;t+=1;let l=u.type==="object"?Cir(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:n.name??(u.type==="alias"&&u.value.type==="id"?Cir(u.value.id):l),shape:u,description:n.description,availability:n.availability?.convert()}}).filter(Gd)).filter(Gd)}:void 0,i=this.isNullable?_pi(r):r;return i!=null?[i]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var _tu=class extends x3{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var DAi=class extends x3{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,i)=>{if(t){if(LS(r)){let n=R3(r,this.context.document);r=typeof n=="string"?n:typeof n?.default=="string"?n?.default:typeof n?.example=="string"?n.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${i}]`]}),t=!1;return}return r}}).filter(Gd),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var WR_=ui(lz());function t2E(e){return Twc.includes(e)}var htu=class extends x3{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(t2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${Twc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new WR_.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var ytu=class extends x3{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return _pi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var HR_=ui(lz());function r2E(e){return qwc.includes(e)}var vtu=class extends x3{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(r2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${qwc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new HR_.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var $R_=ui(lz());function i2E(e){return Cwc.includes(e)}var btu=class extends x3{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new $R_.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(i2E(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${Cwc.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new DAi({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var GR_=ui(lz());var gtu=class extends x3{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,GR_.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var _Ki=class extends Qae{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=O9n(this.input);let t=R3(this.input,this.context.document);t?.enum!=null&&SAi(t)&&(this.maybeEnumConverterNode=new DAi({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:uh.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=R3(this.input,this.context.document);if(r!=null)return new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var Gq=class e extends Qae{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),SAi(this.input)&&FR_(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),LS(this.input)){let t=O9n(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new _Ki({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new ltu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(NR_(this.input))this.typeShapeNode=new ftu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(SAi(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new ptu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(xwc(this.input)&&this.input.allOf!=null)this.typeShapeNode=new m9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(SAi(this.input)&&this.input.enum!=null)this.typeShapeNode=new DAi({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":xwc(this.input)&&(this.typeShapeNode=new m9n({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":wAi(this.input)&&(this.typeShapeNode=new ctu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":xR_(this.input)&&(this.typeShapeNode=new _tu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":RR_(this.input)&&(this.typeShapeNode=new htu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":UR_(this.input)&&(this.typeShapeNode=new vtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":VR_(this.input)&&(this.typeShapeNode=new btu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":LR_(this.input)&&(this.typeShapeNode=new ytu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new QR_.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new m9n({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new gtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!LS(this.input)&&(!wAi(this.input)&&this.input==null||wAi(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=yA(t)?.map(i=>this.nullable?_pi(i):i).filter(Gd);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function EAi(e){if(e!=null)return g9n(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(Gd))}var zir=class extends x3{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;LS(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new jFe({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let i=IR_(this.input,this.context.document);this.inputExample=i?.example??Object.values(i?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function JR_(e,t){return LS(e)?iH(e,t,void 0):e}var Rwc=ui(lz());function Otu(e){let{uniqueId:t,type:r,contextTypes:i,description:n,availability:a}=e;i[uh.TypeId(t)]={name:t,shape:r,description:n,availability:a}}var KR_=ui(WBs(),1),P9n=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,u){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=u}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=KR_.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function n2E(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var j9n=class extends n_{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new Gq({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),n2E(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],i)=>{let n;if(LS(r)?n=Veu(r.$ref,this.context.document):n=r,n!=null)return[t,new v9n({input:n,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${i}`]})]}).filter(Gd)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[uh.api.latest.AuthSchemeId(t),i]}).filter(Gd)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let i=r.name??t,n=yA(r.convert());return n==null?[t,void 0]:[uh.TypeId(t),{name:i,shape:n[0],description:r.description,availability:void 0}]}).filter(([t,r])=>Gd(r))):void 0}}};var mtu=class extends Gq{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=R3(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${LS(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=R3(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var Ptu=class extends n_{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let i=R3(this.input.schema,this.context.document);this.availability=new jFe({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=LS(this.input.schema)?new _Ki({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let n=P9n.parse(t);n?.containsJSON()?(this.contentType="json",this.schema=this.schema??new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):n?.isOctetStream()?(this.contentType="bytes",this.isOptional=i?.required==null):n?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=i?.required,this.fields=Object.fromEntries(Object.entries(i?.properties??{}).map(([a,u])=>{if(u!=null)return[a,new mtu({input:u,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(Gd))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[lL]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[lL]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:yA(t)?.map(i=>{let n=i.type;switch(n){case"object":case"alias":return i;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=mHt([this.method,this.path,this.contentType,"request"].join("_"));return Otu({uniqueId:a,type:i,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:uh.TypeId(a),default:i.type==="enum"&&i.default!=null?{type:"enum",value:i.default}:void 0}}}case void 0:return;default:new Rwc.UnreachableCaseError(n);return}}).filter(Gd)}convert(){if(this.schema instanceof _Ki)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([i,n])=>{switch(n.multipartType){case"file":return[{type:n.multipartType,key:uh.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"files":return[{type:n.multipartType,key:uh.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"property":{let a=yA(n.convert()),u=n.multipartType;return a?.map(l=>({type:u,key:uh.PropertyKey(i),contentType:n.contentType,exploded:void 0,valueShape:l,description:n.description,availability:n.availability?.convert()}))}case void 0:return[];default:return new Rwc.UnreachableCaseError(n.multipartType),[]}}).filter(Gd).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(u=>[...a,u]):[[...a]]),[[]]).map(i=>({type:"formData",fields:i,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var jtu=class extends n_{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let i=JR_(this.input,this.context.document);if(i==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(i.content).forEach(([n,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[n]=new Ptu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:n,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>yA(r.convert())?.map(n=>({description:this.description,contentType:t,body:n}))).filter(Gd)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>yA(t.convert())?.map(i=>{if(!(i.type!=="alias"&&i.type!=="object"))return{description:this.description,shape:i}})).filter(Gd)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var YR_={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function XR_(e,t){if(LS(e)){let r=iH(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var wtu=ui(lz());var ZR_="application/json";var kR_="application/octet-stream";function eN_(e,t){return e===t||t===lL||e===lL}var iRa=class extends n_{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,i,n,a,u,l,d){super(t),this.streamingFormat=i,this.path=n,this.method=a,this.statusCode=u,this.requests=l,this.shapes=d,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,i){for(let n of t)for(let[a,u]of Object.entries(n?.examples??{}))for(let[l,d]of Object.entries(r))for(let s of d)eN_(l,a)&&(i.add(l),this.examples?.push(new Iir({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,PAi(a,l),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let i=0;for(let n of t){let a=0;for(let[u,l]of r){if(a===i){let[d,s,o]=n??[void 0,void 0,void 0];this.examples?.push(...l.map(c=>new Iir({input:{requestExample:o,responseExample:c},context:this.context,accessPath:this.accessPath,pathId:s!=null&&s!==""?["examples",s]:"examples"},this.path,this.statusCode,PAi(s,u),{requestBody:d,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}i++}if(t.length>r.length)for(let n of t.slice(r.length)){let[a,u]=r[r.length-1]??[void 0,void 0],[l,d,s]=n??[void 0,void 0,void 0];this.examples?.push(...(u??[void 0]).map(o=>new Iir({input:{requestExample:s,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:d!=null&&d!==""?["examples",d]:"examples"},this.path,this.statusCode,PAi(d,a),{requestBody:l,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[n,a,u]=t[t.length-1]??[void 0,void 0,void 0];for(let[l,d]of r.slice(t.length))this.examples?.push(...d.map(s=>new Iir({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,PAi(a,l),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,i,n){let a=t[lL];if(a!=null)for(let u of a)this.examples?.push(new Iir({input:{requestExample:n,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:i!=null&&i!==""?["examples",i]:"examples"},this.path,this.statusCode,PAi(i,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let i of t)if(Object.keys(i.examples??{}).length===0)this.pushResponseExample(r,i,void 0,void 0);else for(let[n,a]of Object.entries(i.examples??{}))this.pushResponseExample(r,i,n,a)}parse(t){if(t==="empty")this.empty=!0;else{let l=P9n.parse(t);if(l?.isJSON()||l?.isEventStream())this.contentType=ZR_,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(l?.isOctetStream())this.contentType=kR_,this.contentSubtype=R3(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new Gq({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=Xeu(this.input.examples,l=>[l])),this.input.example!=null&&Object.keys(r).length===0&&(r[lL]??=[],r[lL]=[{value:this.input.example}]);let i=R3(this.input.schema,this.context.document);if(i!=null&&(i.examples!=null&&Object.keys(r).length===0&&(r=Xeu(i.examples,l=>[l])),i.example!=null&&Object.keys(r).length===0&&(r[lL]??=[],r[lL]?.push({value:i.example}))),Object.keys(r).length===0){let l=this.schema?.example({includeOptionals:!0,override:void 0});r[lL]??=[],r[lL]?.push(l!=null?{value:l}:void 0)}this.examples??=[];let n=new Set;this.matchRequestResponseExamplesByName(this.requests,r,n);let a=[];for(let l of this.requests)a.push(...Object.entries(l.examples??{}).filter(([d])=>!n.has(d)&&d!==lL).map(([d,s])=>[l,d,s]));let u=Object.entries(r).filter(([l,d])=>!n.has(l)&&Gd(d)&&l!==lL);Object.keys(r).every(l=>l===lL)||this.matchExamplesByIndex(a,u),!n.has(lL)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return yA(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new wtu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return yA(this.schema?.convert())?.map(r=>{let i=r.type;switch(i){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let n=mHt([this.method,this.path,this.statusCode,"response"].join("_"));return Otu({uniqueId:n,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:uh.TypeId(n),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new wtu.UnreachableCaseError(i);return}}).filter(Gd)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new wtu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var nRa=class extends n_{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,i,n,a,u){super(t),this.path=r,this.method=i,this.statusCode=n,this.requests=a,this.shapes=u,this.safeParse()}parse(t){this.description=this.input.description;let r=XR_(this.input,this.context.document);if(r==null){this.context.errors.error({message:LS(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([i,n])=>{this.headers??={},this.headers[i]=new zir({input:n,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:i})}),r.content==null?(this.responses??=[],this.responses.push(new iRa({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([i,n])=>{this.responses??=[],this.responses.push(new iRa({input:n,context:this.context,accessPath:this.accessPath,pathId:["content",i]},i,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(Gd)}};var Stu=class extends n_{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,i,n,a){super(t),this.path=r,this.method=i,this.requests=n,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,i])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new nRa({input:{...t,...i},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new nRa({input:i,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let i=r.convert();if(i!=null)return dtu(EAi(r.headers)).flatMap(n=>i?.map(a=>({headers:n,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(u=>(u.examples??[]).map(l=>l.convert()).filter(Gd))})))}).filter(Gd)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(i=>{let n=i.schema,a=yA(n?.convert());if(n!=null)return a?.map(u=>({statusCode:parseInt(t),shape:u,description:r.description??n.description,availability:n.availability?.convert(),name:n.name??YR_[parseInt(t)]??"UNKNOWN ERROR",examples:i.examples?.map(l=>{let d=l.convert();if(d!=null&&d.responseBody?.type==="json")return{name:d.name,description:d.description,responseBody:d.responseBody}}).filter(Gd)})).filter(Gd)})).filter(Gd)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var MAi=class extends n_{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,i){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new Iir({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,PAi(i,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new jFe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=Bir(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new utu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((i,n)=>{if(LS(i)){let a=rtu(i,this.context.document);if(a!=null)i=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${i.$ref}`,path:[...this.accessPath,`parameters[${n}]`]});return}}i.in==="path"?i.schema!=null&&(this.pathParameters??={},this.pathParameters[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="query"?i.schema!=null&&(this.queryParameters??={},this.queryParameters[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="header"&&i.schema!=null&&(this.requestHeaders??={},this.requestHeaders[i.name]=new zir({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name}))});for(let i of this.extractPathParameterIds()??[])this.pathParameters?.[i]==null&&this.context.errors.warning({message:`Path parameter not defined: ${i}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new stu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new jtu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new Stu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let i=this.requests?.requestBodiesByContentType;i==null||Object.keys(i).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(i).forEach(n=>{if(Object.keys(n.examples??{}).length===0){let a=n.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},n,void 0)}else Object.entries(n.examples??{}).forEach(([a,u])=>{this.pushEmptyResponseExample(u,n,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(i=>Number(i)>=200&&Number(i)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new b9n({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new rRa({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(i=>i.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((i,n)=>new rRa({input:{[Feu]:i},context:this.context,accessPath:this.accessPath,pathId:["tags",`${n}`]})));let r=new otu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(i=>Zeu({namespace:yA(i?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(Gd),this.xFernExamplesNode=new atu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(Gd)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((n,a)=>(n.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?n.push({type:"pathParameter",value:uh.PropertyKey(a.slice(1,-1).trim())}):n.push({type:"literal",value:a}),n),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},i=this.emptyResponseExamples?.map(o=>o.convert()).filter(Gd),n=DR_(this.xFernExamplesNode?.convert(),[...i??[],...t?.flatMap(o=>o.examples)??[]])?.map(o=>({...o,snippets:SR_(o.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((o,c)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:uh.WebhookId(o),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[c]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(b=>b.value.toString())??[],queryParameters:EAi(this.queryParameters)?.flat(),headers:EAi(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(Gd)}}).filter(Gd);let a=this.servers?.map(o=>o.convert()).filter(Gd),u=this.convertPathToPathParts();if(u==null)return;let l,d=this.auth?.convert();d!=null&&(l=Object.keys(d));let s=t?.flatMap(o=>o.headers).filter(Gd);return this.endpointIds.map((o,c)=>({id:uh.EndpointId(o),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[c]?.convert()?.map(b=>uh.api.v1.SubpackageId(b)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:u,auth:l?.map(b=>uh.api.latest.AuthSchemeId(b)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:EAi(this.pathParameters)?.flat(),queryParameters:EAi(this.queryParameters)?.flat(),requestHeaders:EAi(this.requestHeaders)?.flat(),responseHeaders:s!=null&&s.length>0?s:void 0,requests:this.requests?.convert(),responses:t?.map(b=>b.response),errors:r,examples:n,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var w9n=class extends n_{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i,isWebhook:n}){this.description=this.input.description;let a=Bir(t,this.input.servers,this.context,this.accessPath),u=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new MAi({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:u,method:"GET",basePath:i,isWebhook:n})),this.input.post!=null&&(this.post=new MAi({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:u,method:"POST",basePath:i,isWebhook:n})),this.input.put!=null&&(this.put=new MAi({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:u,method:"PUT",basePath:i,isWebhook:!1})),this.input.patch!=null&&(this.patch=new MAi({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:u,method:"PATCH",basePath:i,isWebhook:!1})),this.input.delete!=null&&(this.delete=new MAi({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:u,method:"DELETE",basePath:i,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(Gd)}};function Dtu(e){return"payloads"in e}var Etu=class extends n_{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.paths=Object.entries(this.input).map(([n,a])=>{if(a!=null)return new w9n({input:a,context:this.context,accessPath:this.accessPath,pathId:n,servers:Bir(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:i,isWebhook:void 0})}).filter(Gd)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(i=>{let n=i.convert();n?.forEach(a=>{Dtu(a)?r[uh.WebhookId(a.id)]=a:t[uh.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var Mtu=class extends n_{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Zx_]?.map(r=>{let{header:i,...n}=r;return(n.optional!=null&&!n.optional||rtu(n,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(i)),[i,new zir({input:n,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:i})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return g9n(this.globalHeaders,this.requiredProperties)?.flat()}};function tN_(e,t){if(LS(e)){let r=iH(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var Atu=class extends n_{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.webhooks=Object.entries(this.input??{}).map(([n,a])=>{let u=tN_(a,this.context.document);if(u!=null)return new w9n({input:u,context:this.context,accessPath:this.accessPath,pathId:n,servers:t,globalAuth:r,basePath:i,isWebhook:!0})}).filter(Gd)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(i=>{Dtu(i)&&(t[uh.WebhookId(i.id)]=i)}),t),{})}};var qtu=class extends n_{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=Bir(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new b9n({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new ttu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new Etu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new Atu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new j9n({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new Mtu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=lae(),{webhookEndpoints:r,endpoints:i}=this.paths?.convert()??{},n={...this.webhooks?.convert()??{},...r??{}},a=xeu({endpoints:i,webhookEndpoints:n}),{types:u,auths:l}=this.components?.convert()??{};return{id:uh.ApiDefinitionId(t),endpoints:i??{},websockets:{},webhooks:n,types:{...u,...this.context.generatedTypes},subpackages:a,auths:{...l,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};var S9n=class extends h9n{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,this.pathId&&this.pathId!==this.accessPath[this.accessPath.length-1]&&(this.accessPath.push(this.pathId),r.logger.debug(`Processing #/${this.accessPath.join("/")}`))}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}};function wFe(e){return typeof e=="object"&&Gd(e)&&"$ref"in e&&typeof e.$ref=="string"}function PHt(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(wFe(n)&&(n=PHt(n,t,r)),n)}function rN_(e,t){return wFe(e)?PHt(e,t,{name:"",params:[],result:{name:"",schema:{type:"object"}}}):e}var oN_=ui(lz());function hpi(e){if(typeof e=="boolean")return e;if(e.enum!=null&&e.enum.length>0)return e.enum[0];if(e.const!=null)return e.const;if(e.examples!=null&&e.examples.length>0)return e.examples[0];if(e.type==="object"){let t={};if(e.properties!=null)for(let[r,i]of Object.entries(e.properties))t[r]=hpi(i);return t}if(e.type==="array")return e.items==null?[]:Array.isArray(e.items)?e.items.map(t=>hpi(t)):[hpi(e.items)];if(e.type==="string")return e.default??"string";if(e.type==="number"||e.type==="integer")return e.default??0;if(e.type==="boolean")return e.default??!1;if(e.type==="null")return null;if(e.oneOf?.[0]!=null)return hpi(e.oneOf[0]);if(e.anyOf?.[0]!=null)return hpi(e.anyOf[0]);if(e.allOf!=null&&e.allOf.length>0){let t={};for(let r of e.allOf)r!=null&&Object.assign(t,hpi(r));return t}}function aRa(e,t){return wFe(e)?PHt(e,t,{name:"",schema:{type:"object"}}):e}function iN_(e,t){return wFe(e)?PHt(e,t,void 0):e}function nN_(e,t){return wFe(e)?PHt(e,t,void 0):e}function aN_(e,t){return wFe(e)?PHt(e,t,void 0):e}var a2E={key:uh.PropertyKey("apiKey"),description:void 0,availability:void 0,valueShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}}},Ttu=class extends S9n{method;servers=[];constructor(t,r){super(t),this.method=t.input,this.servers=r,this.safeParse()}parse(){}convert(){try{let t=this.method.result?aRa(this.method.result,this.context.openrpc):void 0,r=t?new Gq({input:t.schema,context:this.context,accessPath:this.accessPath,pathId:"result",seenSchemas:new Set,nullable:void 0,schemaName:"Result"}).convert():void 0,n=this.method.params?.map(l=>aRa(l,this.context.openrpc)).filter(Gd)?.map(l=>{let d=new Gq({input:l.schema,context:this.context,accessPath:this.accessPath,pathId:["params",l.name],seenSchemas:new Set,nullable:void 0,schemaName:l.name}).convert();if(!d)return;let s=Array.isArray(d)?d[0]:d;if(s)return{key:uh.PropertyKey(l.name),valueShape:l.required?s:{type:"alias",value:{type:"optional",shape:s,default:void 0}},description:l.description,availability:void 0}}).filter(Gd),a=n.length>0?{contentType:"application/json",body:{type:"object",extends:[],properties:n,extraProperties:void 0},description:void 0}:void 0,u=this.method.examples?.map(l=>{let d=nN_(l,this.context.openrpc);if(d)return{name:d.name??"Example",path:"",description:void 0,snippets:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:d.params.length>0?{type:"json",value:Object.fromEntries(d.params.map(s=>{let o=iN_(s,this.context.openrpc);if(o)return[o.name??"",o.value]}).filter(Gd))}:void 0,responseStatusCode:200,responseBody:d.result?{type:"json",value:d.result}:void 0}}).filter(Gd)??[];if(u.length<=0){let l=hpi({type:"object",properties:Object.fromEntries(this.method.params?.map(s=>{let o=aRa(s,this.context.openrpc);return[o?.name??"",o?.schema??{}]})??[])}),d={name:"Example",path:"",pathParameters:{},queryParameters:{},headers:{},requestBody:{type:"json",value:l},responseStatusCode:200,responseBody:{type:"json",value:hpi(aRa(this.method.result,this.context.openrpc)?.schema??{})},snippets:void 0,description:void 0};u.push(d)}return{protocol:{type:"openrpc",methodName:this.input.name},id:uh.EndpointId(this.input.name),displayName:this.input.name,method:"POST",path:[{type:"pathParameter",value:uh.PropertyKey("apiKey")}],auth:void 0,pathParameters:[a2E],queryParameters:[],requests:a!=null?[a]:void 0,responses:r!=null?[this.convertToHttpResponse(r,this.input.description)].filter(Gd):[],errors:[],examples:u,description:this.input.description??this.input.summary,operationId:this.input.name,defaultEnvironment:void 0,environments:this.servers.map(l=>l.convert()).filter(Gd),availability:this.method.deprecated?"Deprecated":void 0,requestHeaders:[],responseHeaders:[],snippetTemplates:void 0,namespace:this.getNamespace()}}catch{this.context.errors.error({message:"Failed to convert method",path:this.accessPath});return}}getNamespace(){if(this.method.tags?.[0]==null)return;let t=aN_(this.method.tags[0],this.context.openrpc);if(t?.name!=null)return[uh.api.v1.SubpackageId(t.name)]}convertToHttpResponse(t,r){if(t==null)return;let n=yA(t)?.map(a=>{let u=a.type;switch(u){case"alias":return a;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":return;case"object":return a;default:new oN_.UnreachableCaseError(u);return}}).filter(Gd)[0];if(n)return{statusCode:200,body:n,description:r}}};var oRa=class extends S9n{servers=[];methods=[];components;constructor(t){super(t),this.safeParse()}parse(){if(this.context.openrpc.servers!=null&&(this.servers=Bir(this.servers,this.input.servers,this.context,this.accessPath)),this.input.methods!=null)for(let t of this.input.methods){let r=rN_(t,this.context.openrpc);r!=null&&this.methods.push(new Ttu({input:r,context:this.context,accessPath:this.accessPath,pathId:"methods"},this.servers))}this.context.openrpc.components!=null&&(this.components=new j9n({input:this.context.openrpc.components,context:this.context,accessPath:this.accessPath,pathId:"components"}))}convert(){let t=lae(),{types:r}=this.components?.convert()??{},i=this.methods?.map(u=>u.convert()).filter(Gd),n=Object.fromEntries(i?.map(u=>[u.id,u])??[]),a=xeu({endpoints:n});return{id:uh.ApiDefinitionId(t),types:r??{},endpoints:n,websockets:{},webhooks:{},subpackages:a,auths:{},globalHeaders:[],snippetsConfiguration:void 0}}};var uRa=class extends Neu{openrpc;logger;generatedTypes;constructor(t){super(),this.openrpc=t.openrpc,this.logger=t.logger,this.generatedTypes={}}get document(){return{openapi:"3.1.0",info:{title:"Mock API",version:"1.0.0"},paths:{},components:this.openrpc.components}}};async function sRa(e,t){if(e instanceof oir){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof fR))return;let r=new rHt(e.absoluteFilePath),i=await cFe({context:t,specs:e.specs}),n=await r.loadDocuments({context:t,specs:i}),a;for(let u of n){if(u.type!=="openapi")continue;let l={document:u.value,logger:t.logger,errors:new _9n,generatedTypes:{}},d=new qtu({input:u.value,context:l,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=aIs(a,d.convert())}return a}var uN_=require("fs/promises");async function sN_(e,t){let r=await(0,uN_.readFile)(e,"utf-8"),i=JSON.parse(r),n=new uRa({openrpc:i,logger:t.logger});return new oRa({input:i,context:n,accessPath:[],pathId:"openrpc"}).convert()}function o2E(e){return e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function u2E(e){return/^(https?:)?\/\//.test(e)}async function s2E({pathToImage:e,absolutePathToFernFolder:t}){if(e==null||u2E(e))return;let r=Gv(t,Na.of(e));if(await mf(r))return r}async function D9n({iconPath:e,filepaths:t,docsWorkspace:r}){if(o2E(e)){let i=await s2E({pathToImage:e,absolutePathToFernFolder:r.absoluteFilePath});i&&t.add(i)}}async function cN_({parsedDocsConfig:e,docsWorkspace:t}){let r=new Set;return e.logo?.dark!=null&&r.add(e.logo.dark),e.logo?.light!=null&&r.add(e.logo.light),e.favicon!=null&&r.add(e.favicon),e.backgroundImage?.dark!=null&&r.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&r.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&r.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&r.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&r.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{r.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&r.add(n.image)}),(await Nwc({navigation:e.navigation,docsWorkspace:t})).forEach(n=>{r.add(n)}),e.js!=null&&e.js.files.forEach(n=>{r.add(n.absolutePath)}),r}async function Nwc({navigation:e,docsWorkspace:t}){let r=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(i=>cRa({item:i,filepaths:r,docsWorkspace:t})));break;case"tabbed":await Promise.all(e.items.map(async i=>{i.icon!=null&&await D9n({iconPath:i.icon,filepaths:r,docsWorkspace:t}),i.child.type==="layout"&&i.child.layout!=null&&await Promise.all(i.child.layout.map(n=>cRa({item:n,filepaths:r,docsWorkspace:t})))}));break;case"versioned":await Promise.all(e.versions.map(async i=>{i.landingPage!=null&&await cRa({item:i.landingPage,filepaths:r,docsWorkspace:t}),(await Nwc({navigation:i.navigation,docsWorkspace:t})).forEach(a=>r.add(a))}));break;case"productgroup":await Promise.all(e.products.map(async i=>{i.landingPage!=null&&await cRa({item:i.landingPage,filepaths:r,docsWorkspace:t}),(await Nwc({navigation:i.navigation,docsWorkspace:t})).forEach(a=>r.add(a))}));break}return r}async function cRa({item:e,filepaths:t,docsWorkspace:r}){switch(e.type){case"page":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"section":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r}),await Promise.all(e.contents.map(i=>cRa({item:i,filepaths:t,docsWorkspace:r})));break;case"apiSection":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"link":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break;case"changelog":e.icon!=null&&await D9n({iconPath:e.icon,filepaths:t,docsWorkspace:r});break}}async function lN_({navigation:e,apiWorkspaces:t,visitor:r,context:i}){l2E(e)?await Promise.all(e.map(async n=>{n.layout!=null&&await Promise.all(n.layout.map(async a=>{await Fwc({navigationItem:a,visitor:r,apiWorkspaces:t,context:i})}))})):await Promise.all(e.map(async n=>{await Fwc({navigationItem:n,visitor:r,apiWorkspaces:t,context:i})}))}async function Fwc({navigationItem:e,visitor:t,apiWorkspaces:r,context:i}){if(await WYt(e,{alphabetized:Go,api:Go,apiName:Go,audiences:Go,displayErrors:Go,snippets:Go,summary:Go,title:Go,layout:Go,icon:Go,slug:Go,hidden:Go,skipSlug:Go,paginated:Go,playground:Go,flattened:Go,path:Go,page:Go,featureFlag:Go,openrpc:Go,contents:async n=>{n!=null&&await Promise.all(n.map(async a=>{await Fwc({navigationItem:a,visitor:t,apiWorkspaces:r,context:i})}))},viewers:Go,orphaned:Go}),c2E(e)){let n=r.find(a=>a.workspaceName===e.apiName);n!=null&&await t.apiSection?.({config:e,workspace:n,context:i})}}function c2E(e){return e.api!=null}function l2E(e){return e[0]?.tab!=null}function kZ(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}fN_.default.extend(dN_.default);var f2E=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),Ctu=0,d2E=async({ir:e})=>(Ctu++,`${e.apiName.snakeCase.unsafeName}-${Ctu}`),p2E=async({api:e})=>(Ctu++,`${e.id}-${Ctu}`),jHt=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;registerApiV2;constructor(t,r,i,n,a,u,l=f2E,d=d2E,s=p2E){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=i,this.apiWorkspaces=n,this.taskContext=a,this.editThisPage=u,this.uploadFiles=l,this.registerApi=d,this.registerApiV2=s}#e=Beu.init();_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;async resolve(){this._parsedDocsConfig=await e6s({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig});let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await lN_({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:o})=>{(await o.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(b=>{let g=Bq(this.docsWorkspace.absoluteFilePath,b.absoluteFilepath);this.parsedDocsConfig.pages[g]=b.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages);for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=await vgc({markdown:c,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(o),context:this.taskContext});for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=await ygc({markdown:c,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(o),context:this.taskContext});let i=await cN_({parsedDocsConfig:this.parsedDocsConfig,docsWorkspace:this.docsWorkspace});for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:b,markdown:g}=exa(c,{absolutePathToMarkdownFile:this.resolveFilepath(o),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[Na.of(o)]=g;for(let O of b)i.add(O)}catch(b){throw this.taskContext.logger.error(`Failed to parse ${o}: ${b instanceof Error?b.message:String(b)}`),b}let n=Array.from(i).map(o=>({absoluteFilePath:o,relativeFilePath:this.toRelativeFilepath(o)}));(await this.uploadFiles(n)).forEach(o=>{this.collectedFileIds.set(o.absoluteFilePath,o.fileId)});let u=await this.getMarkdownFilesToFullyQualifiedPathNames();for(let[o,c]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[Na.of(o)]=hgc(c,this.collectedFileIds,u,{absolutePathToMarkdownFile:this.resolveFilepath(o),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let l={};Object.entries(this.parsedDocsConfig.pages).forEach(([o,c])=>{let b=_2E(this.editThisPage,o);l[_Ht.PageId(o)]={markdown:c,editThisPageUrl:b?_Ht.Url(b):void 0}});let d=await this.convertDocsConfiguration(),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let o=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async c=>{let b=Gv(this.docsWorkspace.absoluteFilePath,c);(await(0,Btu.stat)(b)).isDirectory()?(await cxe(b,"{js,ts,jsx,tsx,md,mdx}")).forEach(m=>{o.add(m)}):b.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&o.add(b)})),s=Object.fromEntries(await Promise.all([...o].map(async c=>{let b=this.toRelativeFilepath(c),g=(await(0,Btu.readFile)(c)).toString();return[b,g]})))}return{config:d,pages:l,jsFiles:s}}resolveFilepath(t){if(t!=null)return Gv(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return Bq(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[i,n]of Object.entries(t)){let u=(0,Lwc.default)(n).data.slug;typeof u=="string"&&u.trim().length>0&&r.set(this.resolveFilepath(i),u.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[i,n]of Object.entries(t)){let u=(0,Lwc.default)(n).data.noindex;typeof u=="boolean"&&r.set(this.resolveFilepath(i),u)}return r}async getMarkdownFilesToFullyQualifiedPathNames(){let t={},r=So.migrate.FernNavigationV1ToLatest.create().root(await this.toRootNode());return So.NodeCollector.collect(r).slugMap.forEach((n,a)=>{if(n==null||!So.isPage(n))return;let u=So.getPageId(n);if(u==null)return;let l=Ru(this.docsWorkspace.absoluteFilePath,Na.of(u));t[l]=a}),t}getDocsBasePath(){return new URL(kZ(this.domain)).pathname}async convertDocsConfiguration(){let t=await this.toRootNode();return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?_Ht.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(i=>({...i,url:_Ht.Url(i.url)})),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(i=>({...i,value:_Ht.Url(i.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(t.apiName!=null){let i=this.apiWorkspaces.find(n=>n.workspaceName===t.apiName);if(i!=null)return i}else if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}getOpenApiWorkspaceForApiSection(t){if(t.apiName!=null){let i=this.ossWorkspaces.find(n=>n.workspaceName===t.apiName);if(i!=null)return i}else if(this.ossWorkspaces.length===1&&this.ossWorkspaces[0]!=null)return this.ossWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}async toRootNode(){let t=So.V1.SlugGenerator.init(So.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),i=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:i,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(n=>So.RoleId(n)),featureFlags:void 0}}async toRootChild(t){return iCn(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let i=So.PageId(this.toRelativeFilepath(t.absolutePath)),n=r.apply({urlSlug:t.slug??Tq(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(i),title:t.title,slug:n.get(),icon:t.icon,hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:i,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:i}){let n=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,i):void 0,u=r.type==="tabbed"?await this.convertTabbedNavigation(n,r.items,i):await this.toSidebarRootNode(n,r.items,i);return{type:"unversioned",id:n,landingPage:a,child:u}}async toVersionedNode(t,r){return{id:this.#e.get("versioned"),type:"versioned",children:await Promise.all(t.versions.map((n,a)=>this.toVersionNode(n,r,a===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:i}){let n=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,i):void 0;return{id:n,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(u=>this.toProductNode(u,i)))}}async toProductNode(t,r){let i=r.setProductSlug(t.slug??Tq(t.product)),n;switch(t.navigation.type){case"tabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,i)};break;case"untabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,i)};break;case"versioned":n=await this.toVersionedNode(t.navigation,i);break;default:jo(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:So.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:i.get(),child:n,default:!1,hidden:void 0,authed:void 0,icon:t.icon,image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}async toVersionNode(t,r,i){let n=this.#e.get(t.version),a=r.setVersionSlug(t.slug??Tq(t.version)),u=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(n,t.navigation.items,a):await this.toSidebarRootNode(n,t.navigation.items,a);return{type:"version",id:n,versionId:So.VersionId(t.version),title:t.version,slug:a.get(),child:u,default:i,availability:t.availability!=null?h2E(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags}}async toSidebarRootNode(t,r,i){let n=this.#e.get(`${t}/root`),a=await Promise.all(r.map(l=>this.toNavigationChild(n,l,i))),u=[];return a.forEach(l=>{if(l.type==="apiReference"){u.push(l);return}if(l.type==="section"&&!l.collapsed){u.push(l);return}let d=u.length>0?u[u.length-1]:void 0,s;d?.type==="sidebarGroup"?s=d:(s={id:this.#e.get(`${n}/group`),type:"sidebarGroup",children:[]},u.push(s)),s.children.push(l)}),{type:"sidebarRoot",id:n,children:u}}async toNavigationChild(t,r,i,n){return iCn(r)._visit({page:async a=>this.toPageNode(a,i,n),apiSection:async a=>this.toApiSectionNode(a,i,n),section:async a=>this.toSectionNode(t,a,i,n),link:async a=>this.toLinkNode(a),changelog:async a=>this.toChangelogNode(a,i,n)})}async toApiSectionNode(t,r,i){if(t.openrpc!=null){let b=Gv(this.docsWorkspace.absoluteFilePath,Na.of(t.openrpc));if(!await mf(b))throw new Error(`OpenRPC file does not exist at path: ${b}`);let g=await sN_(b,this.taskContext);if(g==null)throw new Error("Failed to generate API Definition from OpenRPC document");return await this.registerApiV2({api:g,apiName:t.apiName,snippetsConfig:Ieu(t.snippetsConfiguration)}),new eRa(t,g,r,void 0,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,i).get()}if(this.parsedDocsConfig.experimental?.openapiParserV2){let b=this.getOpenApiWorkspaceForApiSection(t),g=Ieu(t.snippetsConfiguration),O=await sRa(b,this.taskContext);if(O==null)throw new Error("Failed to generate API Definition from OpenAPI workspace");return await this.registerApiV2({api:O,snippetsConfig:g,apiName:t.apiName}),new eRa(t,O,r,b,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,i).get()}let n=Ieu(t.snippetsConfiguration),a,u,l=this.parsedDocsConfig.experimental?.openapiParserV3;if(l==null||l)try{a=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1})}catch{}a==null&&(u=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),a=hR({workspace:u,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new _R(this.taskContext,u)}));let s=await this.registerApi({ir:a,snippetsConfig:n,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName}),o=tRa(a,s,{oauth:t.playground?.oauth});return new Teu(t,o,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.#e,u,i).get()}async toChangelogNode(t,r,i){return new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:t.icon,viewers:t.viewers,hidden:i||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:So.V1.Url(t.url),icon:t.icon}}async toPageNode(t,r,i){let n=So.PageId(this.toRelativeFilepath(t.absolutePath)),a=r.apply({urlSlug:t.slug??Tq(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(n),type:"page",slug:a.get(),title:t.title,icon:t.icon,hidden:i||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:n,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toSectionNode(t,r,i,n){let a=this.toRelativeFilepath(r.overviewAbsolutePath),u=a?So.PageId(a):void 0,l=this.#e.get(u??`${t}/section`),d=i.apply({urlSlug:r.slug??Tq(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),s=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,o=n||r.hidden;return{id:l,type:"section",overviewPageId:u,slug:d.get(),title:r.title,icon:r.icon,collapsed:r.collapsed,hidden:o,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(c=>this.toNavigationChild(l,c,d,o))),authed:void 0,pointsTo:void 0,noindex:s,featureFlags:r.featureFlags}}async convertTabbedNavigation(t,r,i){let n=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:n,children:await Promise.all(r.map(a=>this.toTabChild(n,a,i)))}}async toTabChild(t,r,i){return iCn(r.child)._visit({link:({href:n})=>this.toTabLinkNode(r,n),layout:({layout:n})=>this.toTabNode(t,r,n,i),changelog:({changelog:n})=>this.toTabChangelogNode(r,n,i)})}async toTabChangelogNode(t,r,i){return new ppi(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:i,title:t.title,icon:t.icon,viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r){return{type:"link",id:this.#e.get(r),title:t.title,url:So.V1.Url(r),icon:t.icon}}async toTabNode(t,r,i,n){let a=this.#e.get(`${t}/tab`),u=n.apply({urlSlug:r.slug??Tq(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:u.get(),icon:r.icon,hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,i,u),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):_Ht.FileId(r)}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:i}=this.parsedDocsConfig,n=r?.[t],a=i?.[t];return{logo:this.getFileId(n),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let i=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${i}`,variants:t.variants.map(n=>({fontFile:this.getFileId(n.absolutePath),weight:n.weight,style:n.style!=null?[n.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(yv),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:_Ht.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":i,...n}=this.parsedDocsConfig.metadata;return{...n,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(i)}}convertFileIdOrUrl(t){if(t!=null)return iCn(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:_Ht.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function _2E(e,t){if(e?.github==null)return;let{owner:r,repo:i,branch:n="main",host:a="https://github.com"}=e.github;return`${kZ(a)}/${r}/${i}/blob/${n}/fern/${t}?plain=1`}function h2E(e){switch(e){case"beta":return So.V1.NavigationV1Availability.Beta;case"deprecated":return So.V1.NavigationV1Availability.Deprecated;case"ga":return So.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return So.V1.NavigationV1Availability.Stable;default:jo(e)}}async function nH(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof fR?t:null))).filter(yv)}async function Uwc(e,t,r){if(e instanceof oir){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof fR))return;let i=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1});return ZZ({ir:i,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0},playgroundConfig:{oauth:!0}})}var l6_=ui(aru(),1),SMe=require("fs/promises"),Pru=require("os"),f6_=ui(QX(),1),d6_=ui(c6_(),1);var s9E="etag",R1c="preview",N1c="app-preview",c9E="bundle",l9E=".next",F1c=".fern";function f9E({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c))}function OKi({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c),Na.of(e?l9E:c9E))}function d9E({app:e=!1}){return Ru(ll.of((0,Pru.homedir)()),Na.of(F1c),Na.of(e?N1c:R1c),Na.of(s9E))}async function ARa({bucketUrl:e,logger:t,preferCached:r,app:i=!1,tryTar:n=!1}){t.debug("Setting up docs preview bundle...");let a=await fetch(e);if(!a.ok)return{type:"failure"};let u=await a.text(),d=await new d6_.default.Parser().parseStringPromise(u),s=d?.ListBucketResult?.Contents?.[0]?.ETag?.[0],o=d?.ListBucketResult?.Contents?.[0]?.Key?.[0],c=d9E({app:i});if(r){let m=await mf(c),w;if(m&&(t.debug("Reading existing ETag"),w=(await(0,SMe.readFile)(c)).toString()),w!=null&&w===s)return t.debug("ETag matches. Using already downloaded bundle"),{type:"success"};t.debug("ETag is different. Downloading latest preview bundle"),i&&t.info(`Setting up docs preview bundle...
2045
2045
  Please wait while the installation completes. This may take a few minutes depending on your connection speed.`)}t.debug("Creating tmp directory to download docs preview bundle");let b=await f6_.default.dir({prefix:"fern"}),g=ll.of(b.path),O=new URL(o,e).href;t.debug(`Downloading docs preview bundle from ${O}`);try{let m=await fetch(O);if(!m.ok)return t.error(`Failed to download docs preview bundle. Status code: ${m.status}`),{type:"failure"};let w=Ru(g,Na.of(n?"output.tar.gz":"output.zip"));if(m.body==null)return{type:"failure"};let E=Buffer.from(await m.arrayBuffer());await(0,SMe.writeFile)(w,new Uint8Array(E)),t.debug(`Wrote ${n?"output.tar.gz":"output.zip"} to ${w}`);let q=f9E({app:i});await mf(q)&&await(0,SMe.rm)(q,{recursive:!0}),await(0,SMe.mkdir)(q,{recursive:!0}),t.debug(`rm -rf ${q}`);let A=OKi({app:i});if(await(0,SMe.mkdir)(A,{recursive:!0}),await(0,l6_.default)(w,A),await(0,SMe.writeFile)(c,s),t.debug(`Downloaded bundle to ${A}`),i){t.debug("Checking if pnpm is installed");try{await ZN(t,process.platform==="win32"?"where":"which",["pnpm"],{cwd:A,doNotPipeOutput:!0})}catch{t.debug("pnpm not found, installing pnpm"),await ZN(t,"npm",["install","-g","pnpm"],{doNotPipeOutput:!0})}try{await ZN(t,process.platform==="win32"?"where":"which",["pnpm"],{cwd:A,doNotPipeOutput:!0})}catch{return t.error("Requires [pnpm] to run local development. Please run: npm install -g pnpm, and then: fern docs dev"),await mf(q)&&await(0,SMe.rm)(q,{recursive:!0}),t.debug(`rm -rf ${q}`),{type:"failure"}}try{t.debug("Installing esbuild"),await ZN(t,"pnpm",["i","esbuild"],{cwd:A,doNotPipeOutput:!0})}catch{return t.error("Failed to install required package. Please reach out to support@buildwithfern.com."),await mf(q)&&await(0,SMe.rm)(q,{recursive:!0}),t.debug(`rm -rf ${q}`),{type:"failure"}}try{t.debug("Resolve esbuild imports"),await ZN(t,"node",["install-esbuild.js"],{cwd:A,doNotPipeOutput:!0})}catch{return t.error("Failed to resolve imports. Please reach out to support@buildwithfern.com."),await mf(q)&&await(0,SMe.rm)(q,{recursive:!0}),t.debug(`rm -rf ${q}`),{type:"failure"}}}return{type:"success"}}catch(m){return t.error(`Failed to download docs preview bundle. Error: ${m}`),{type:"failure"}}}var E6_=require("fs/promises");var W1c=ui(Ytr(),1),g6_=require("path");var F9n=ui(PEe(),1);function jru(e){if(e==null)return;let t=[],r=!1;if(hir(e,{enter(i){(i.type==="FunctionDeclaration"||i.type==="ArrowFunctionExpression"||i.type==="JSXOpeningElement"||i.type==="JSXOpeningFragment"||i.type==="Identifier")&&(r=!0,this.skip()),i.type==="Literal"&&t.push(i.value)}}),!r)return t.length===1?t[0]:void 0}function L1c(e){if(typeof e=="string")return e;if(e?.type==="mdxJsxAttributeValueExpression")return jru(e.data?.estree)}function p6_(e){return e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"}function _6_(e){return e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"}function U1c(e){return e.type==="mdxJsxAttribute"}function h6_(e){return e.type==="mdxJsxExpressionAttribute"}var y6_=ui(Ytr(),1);function v6_(e){let{content:t}=(0,y6_.default)(e);return Yza(t,{extensions:[u3n(),e3n(),Zza()],mdastExtensions:[y$i(),f$i(),Xza()]})}function b6_(e,t){hir(e,{enter(r){r.type==="JSXElement"&&r.openingElement.attributes.forEach(i=>{i.type==="JSXAttribute"&&i.name.type==="JSXIdentifier"&&t[i.name.name]&&t[i.name.name]?.(i,r)})}})}function O6_(e,{absolutePathToFernFolder:t,absolutePathToMarkdownFile:r}){return e==null||m6_(e)||P6_(e)?void 0:Gv(e.startsWith("/")?t:Cd(r),Na.of(e.replace(/^\//,"")))}function m6_(e){return/^(https?:)?\/\//.test(e)}function P6_(e){return e.startsWith("data:")}function j6_({href:e,metadata:t,markdownFilesToPathName:r}){if(e!=null&&(e.endsWith(".md")||e.endsWith(".mdx"))){let i=O6_(e,t);if(i!=null){let n=r[i];return n!=null?{type:"replace",slug:n.startsWith("/")?n:"/"+n,href:e}:{type:"missing-reference",path:i,href:e}}}}function H1c(e,t,r,i,n){let{content:a,data:u}=(0,W1c.default)(e,{}),l=a,d=v6_(a),s=0;function o(c){if(c==null||m6_(c)||P6_(c))return;if((0,g6_.isAbsolute)(c)){let g=ll.of(c),O=t.get(g);return O?`file:${O}`:void 0}let b=O6_(c,i);if(b){let g=t.get(b);return g?`file:${g}`:void 0}}return _9E(u,["image","og:image","og:logo","twitter:image"],o),y9E(u,o),Ff(d,c=>{if(c.position==null)return;let{start:b,length:g}=p9E(a,c.position),O=l.slice(b+s,b+s+g),m=O;function w(A){let D=o(A);A&&D&&(m=m.replace(A,D))}function E(A){let D=j6_({href:A,markdownFilesToPathName:r,metadata:i});A!=null&&D!=null&&D.type==="replace"&&(m=m.replace(A,D.slug))}function q(A){b6_(A,{src:D=>w(IAi(jru(D.value))),href:D=>E(IAi(jru(D.value)))})}if(c.type==="image"){let A=IAi(c.url);w(IAi(A))}if(c.type==="link"&&E(IAi(c.url)),p6_(c)){let A=c.attributes.filter(U1c).find(C=>C.name==="src");w(IAi(L1c(A?.value)));let D=c.attributes.find(C=>C.type==="mdxJsxAttribute"&&C.name==="href");E(IAi(L1c(D?.value))),c.attributes.forEach(C=>{U1c(C)&&typeof C.value!="string"&&C.value!=null&&C.value.data?.estree?q(C.value.data.estree):h6_(C)&&C.data?.estree&&q(C.data.estree)})}if(_6_(c)&&c.data?.estree&&q(c.data.estree),m!==O)return l=l.slice(0,b+s)+m+l.slice(b+s+g),s+=m.length-g,_p}),W1c.default.stringify(l,u)}function p9E(e,t){let r=e.split(`
2046
2046
  `),i=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let u=r[a];if(u==null)break;i+=u.length+1}let n=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let u=r[a];if(u==null)break;n+=u.length+1}return{start:i,length:n}}function IAi(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function _9E(e,t,r){for(let i of t){let n=e[i];if(n!=null){if(typeof n=="object")n.type==="fileId"&&(e[i]={type:"fileId",value:F9n.FernRegistry.FileId(r(n.value)??n.value)});else if(typeof n=="string"){let a=r(n);e[i]=a?{type:"fileId",value:F9n.FernRegistry.FileId(a)}:{type:"url",value:F9n.FernRegistry.Url(n)}}}}}var h9E=du.union([du.string(),du.object({light:du.string().optional(),dark:du.string().optional()})]);function V1c(e,t){let r=t(e);return r?{type:"fileId",value:F9n.FernRegistry.FileId(r)}:{type:"url",value:F9n.FernRegistry.Url(e)}}function y9E(e,t){let r=h9E.safeParse(e.logo);if(!r.success)return;let i=r.data;typeof i=="string"?e.logo=V1c(i,t):(i.light!=null&&(e.logo.light=V1c(i.light,t)),i.dark!=null&&(e.logo.dark=V1c(i.dark,t)))}var w6_=require("fs/promises");async function v9E(e){return(await(0,w6_.readFile)(e)).toString()}async function $1c({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:i,fileLoader:n=v9E}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,u=e,l;for(;(l=a.exec(e))!=null;){let d=l[0],s=l[1],o=l[2];if(d==null||o==null)throw new Error(`Failed to parse regex "${l}" in ${r}`);let c=Gv(o.startsWith("/")?t:Cd(r),Na.of(o.replace(/^\//,"")));try{let b=await n(c),g="",O=c.split(".").pop();O!=null&&(g+=O);let m=c.split("/").pop();m!=null&&(g+=` title={"${m}"}`);let w=l[3]?.trim()||"";if(w){let q=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,A;for(;(A=q.exec(w))!==null;){let D=A[1],C=A[2]||A[3];D&&C&&D!=="src"&&(g+=` ${D}=${C.includes("{")?C:`{${C}}`}`)}}let E=d?.split("src=")[0]?.trim()??"";if(E){let q=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,A;for(;(A=q.exec(E))!==null;){let D=A[1],C=A[2]||A[3];D&&C&&D!=="src"&&(g+=` ${D}=${C.includes("{")?C:`{${C}}`}`)}}b=`\`\`\`${g}
2047
2047
  ${b}