fern-api 0.57.3 → 0.57.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +4 -4
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -20,7 +20,7 @@
20
20
  `+Object.keys(i).map(n=>`${n}: ${i[n]}`).join(`\r
21
21
  `)+`\r
22
22
  \r
23
- `+r)}function cCi(e,t,r,i,n){if(e.listenerCount("wsClientError")){let a=new Error(n);Error.captureStackTrace(a,cCi),e.emit("wsClientError",a,r,t)}else Uia(r,i,n)}});var p4f=f((xH3,d4f)=>{"use strict";var QGr=LYa();QGr.createWebSocketStream=cps();QGr.Server=fps();QGr.Receiver=BYa();QGr.Sender=IYa();QGr.WebSocket=QGr;QGr.WebSocketServer=QGr.Server;d4f.exports=QGr});var _4f=f(_ui=>{"use strict";Object.defineProperty(_ui,"__esModule",{value:!0});_ui.CloseEvent=_ui.ErrorEvent=_ui.Event=void 0;var Via=class{target;type;constructor(t,r){this.target=r,this.type=t}};_ui.Event=Via;var dps=class extends Via{message;error;constructor(t,r){super("error",r),this.message=t.message,this.error=t}};_ui.ErrorEvent=dps;var pps=class extends Via{code;reason;wasClean=!0;constructor(t=1e3,r="",i){super("close",i),this.code=t,this.reason=r}};_ui.CloseEvent=pps});var y4f=f(Z$t=>{"use strict";var ht1=Z$t&&Z$t.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),yt1=Z$t&&Z$t.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vt1=Z$t&&Z$t.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var i=e(t),n=0;n<i.length;n++)i[n]!=="default"&&ht1(r,t,i[n]);return yt1(r,t),r}}();Object.defineProperty(Z$t,"__esModule",{value:!0});Z$t.ReconnectingWebSocket=void 0;var bt1=p4f(),gt1=WTi(),h4f=vt1(_4f()),Ot1=()=>{if(typeof WebSocket<"u")return WebSocket;if(gt1.RUNTIME.type==="node")return bt1.WebSocket},mt1=e=>typeof e<"u"&&!!e&&e.CLOSING===2,lCi={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},_ps=class e{_ws;_listeners={error:[],message:[],open:[],close:[]};_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType="blob";_closeCalled=!1;_messageQueue=[];_url;_protocols;_options;_headers;constructor(t,r,i={},n){this._url=t,this._protocols=r,this._options=i,this._headers=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((r,i)=>(typeof i=="string"?r+=i.length:i instanceof Blob?r+=i.size:r+=i.byteLength,r),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:""}onclose=null;onerror=null;onmessage=null;onopen=null;close(t=1e3,r){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,r)}reconnect(t,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,r),this._connect())}send(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{let{maxEnqueuedMessages:r=lCi.maxEnqueuedMessages}=this._options;this._messageQueue.length<r&&(this._debug("enqueue",t),this._messageQueue.push(t))}}addEventListener(t,r){this._listeners[t]&&this._listeners[t].push(r)}dispatchEvent(t){let r=this._listeners[t.type];if(r)for(let i of r)this._callEventListener(t,i);return!0}removeEventListener(t,r){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(i=>i!==r))}_debug(...t){this._options.debug&&console.log.apply(console,["RWS>",...t])}_getNextDelay(){let{reconnectionDelayGrowFactor:t=lCi.reconnectionDelayGrowFactor,minReconnectionDelay:r=lCi.minReconnectionDelay,maxReconnectionDelay:i=lCi.maxReconnectionDelay}=this._options,n=0;return this._retryCount>0&&(n=r*Math.pow(t,this._retryCount-1),n>i&&(n=i)),this._debug("next delay",n),n}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_getNextUrl(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){let r=t();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;let{maxRetries:t=lCi.maxRetries,connectionTimeout:r=lCi.connectionTimeout,WebSocket:i=Ot1()}=this._options;if(this._retryCount>=t){this._debug("max retries reached",this._retryCount,">=",t);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!mt1(i))throw Error("No valid WebSocket class provided");this._wait().then(()=>this._getNextUrl(this._url)).then(n=>{if(this._closeCalled)return;let a={};this._headers?.length>0&&(a.headers=this._headers),this._ws=new i(n,this._protocols,a),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),r)})}_handleTimeout(){this._debug("timeout event"),this._handleError(new h4f.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,r){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,r),this._handleClose(new h4f.CloseEvent(t,r,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_callEventListener(t,r){"handleEvent"in r?r.handleEvent(t):r(t)}_handleOpen=t=>{this._debug("open event");let{minUptime:r=lCi.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),r),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(i=>this._ws?.send(i)),this._messageQueue=[],this.onopen&&this.onopen(t),this._listeners.open.forEach(i=>this._callEventListener(t,i))};_handleMessage=t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this._listeners.message.forEach(r=>this._callEventListener(t,r))};_handleError=t=>{this._debug("error event",t.message),this._disconnect(void 0,t.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(t),this._debug("exec error listeners"),this._listeners.error.forEach(r=>this._callEventListener(t,r)),this._connect()};_handleClose=t=>{this._debug("close event"),this._clearTimeouts(),t.code===1e3&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this._listeners.close.forEach(r=>this._callEventListener(t,r))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};Z$t.ReconnectingWebSocket=_ps});var v4f=f(fCi=>{"use strict";var Pt1=fCi&&fCi.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),jt1=fCi&&fCi.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Pt1(t,e,r)};Object.defineProperty(fCi,"__esModule",{value:!0});jt1(y4f(),fCi)});var hps=f(k1e=>{"use strict";var wt1=k1e&&k1e.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),dCi=k1e&&k1e.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&wt1(t,e,r)};Object.defineProperty(k1e,"__esModule",{value:!0});dCi(oFf(),k1e);dCi(a2f(),k1e);dCi(u2f(),k1e);dCi(c2f(),k1e);dCi(WTi(),k1e);dCi(d2f(),k1e);dCi(v4f(),k1e)});var Dps=f((w$3,W4f)=>{"use strict";var wps=require("fs"),$t1=require("util"),Gt1=require("path"),N4t,Sps=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=t.shift(),i=function(){};return typeof t[t.length-1]=="function"&&(i=t.pop()),i=i||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i(),N4t.format.apply(N4t.format,[this.cache[this.locale][r]||r].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),r=t.shift(),i=t.shift(),n=t.shift(),a=function(){};typeof t[t.length-1]=="function"&&(a=t.pop()),this.cache[this.locale]||this._readLocaleFile();let u=n===1?r:i;this.cache[this.locale][r]&&(u=this.cache[this.locale][r][n===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:i},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:a})):a();let l=[u];return~u.indexOf("%d")&&l.push(n),N4t.format.apply(N4t.format,l.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(this.cache[this.locale][r]=t[r])}_taggedLiteral(t,...r){let i="";return t.forEach(function(n,a){let u=r[a+1];i+=n,typeof u<"u"&&(i+="%s")}),this.__.apply(this,[i].concat([].slice.call(r,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,r=this.writeQueue[0],i=r.directory,n=r.locale,a=r.cb,u=this._resolveLocaleFile(i,n),l=JSON.stringify(this.cache[n],null,2);N4t.fs.writeFile(u,l,"utf-8",function(d){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),a(d)})}_readLocaleFile(){let t={},r=this._resolveLocaleFile(this.directory,this.locale);try{N4t.fs.readFileSync&&(t=JSON.parse(N4t.fs.readFileSync(r,"utf-8")))}catch(i){if(i instanceof SyntaxError&&(i.message="syntax error in "+r),i.code==="ENOENT")t={};else throw i}this.cache[this.locale]=t}_resolveLocaleFile(t,r){let i=N4t.resolve(t,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(i)&&~r.lastIndexOf("_")){let n=N4t.resolve(t,"./",r.split("_")[0]+".json");this._fileExistsSync(n)&&(i=n)}return i}_fileExistsSync(t){return N4t.exists(t)}};function Qt1(e,t){N4t=t;let r=new Sps(e);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var Jt1={fs:{readFileSync:wps.readFileSync,writeFile:wps.writeFile},format:$t1.format,resolve:Gt1.resolve,exists:e=>{try{return wps.statSync(e).isFile()}catch{return!1}}},Kt1=e=>Qt1(e,Jt1);W4f.exports=Kt1});var Yia=f((S$3,X4f)=>{"use strict";var Yt1=require("util"),H4f=require("path"),Xt1=require("fs");function Jia(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let r="",i=!1,n=e.match(/^-+/);for(let a=n?n[0].length:0;a<e.length;a++){let u=e.charAt(a);i&&(i=!1,u=u.toUpperCase()),a!==0&&(u==="-"||u==="_")?i=!0:u!=="-"&&u!=="_"&&(r+=u)}return r}}function J4f(e,t){let r=e.toLowerCase();t=t||"-";let i="";for(let n=0;n<e.length;n++){let a=r.charAt(n),u=e.charAt(n);a!==u&&n>0?i+=`${t}${r.charAt(n)}`:i+=u}return i}function K4f(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function Zt1(e){if(Array.isArray(e))return e.map(u=>typeof u!="string"?u+"":u);e=e.trim();let t=0,r=null,i=null,n=null,a=[];for(let u=0;u<e.length;u++){if(r=i,i=e.charAt(u),i===" "&&!n){r!==" "&&t++;continue}i===n?n=null:(i==="'"||i==='"')&&!n&&(n=i),a[t]||(a[t]=""),a[t]+=i}return a}var F4t;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(F4t||(F4t={}));var KGr,Tps=class{constructor(t){KGr=t}parse(t,r){let i=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),n=Zt1(t),a=typeof t=="string",u=kt1(Object.assign(Object.create(null),i.alias)),l=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},i.configuration),d=Object.assign(Object.create(null),i.default),s=i.configObjects||[],o=i.envPrefix,c=l["populate--"],b=c?"--":"_",g=Object.create(null),O=Object.create(null),m=i.__||KGr.format,P={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},E=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,A=new RegExp("^--"+l["negation-prefix"]+"(.+)");[].concat(i.array||[]).filter(Boolean).forEach(function(kt){let Tt=typeof kt=="object"?kt.key:kt,cr=Object.keys(kt).map(function(er){return{boolean:"bools",string:"strings",number:"numbers"}[er]}).filter(Boolean).pop();cr&&(P[cr][Tt]=!0),P.arrays[Tt]=!0,P.keys.push(Tt)}),[].concat(i.boolean||[]).filter(Boolean).forEach(function(kt){P.bools[kt]=!0,P.keys.push(kt)}),[].concat(i.string||[]).filter(Boolean).forEach(function(kt){P.strings[kt]=!0,P.keys.push(kt)}),[].concat(i.number||[]).filter(Boolean).forEach(function(kt){P.numbers[kt]=!0,P.keys.push(kt)}),[].concat(i.count||[]).filter(Boolean).forEach(function(kt){P.counts[kt]=!0,P.keys.push(kt)}),[].concat(i.normalize||[]).filter(Boolean).forEach(function(kt){P.normalize[kt]=!0,P.keys.push(kt)}),typeof i.narg=="object"&&Object.entries(i.narg).forEach(([kt,Tt])=>{typeof Tt=="number"&&(P.nargs[kt]=Tt,P.keys.push(kt))}),typeof i.coerce=="object"&&Object.entries(i.coerce).forEach(([kt,Tt])=>{typeof Tt=="function"&&(P.coercions[kt]=Tt,P.keys.push(kt))}),typeof i.config<"u"&&(Array.isArray(i.config)||typeof i.config=="string"?[].concat(i.config).filter(Boolean).forEach(function(kt){P.configs[kt]=!0}):typeof i.config=="object"&&Object.entries(i.config).forEach(([kt,Tt])=>{(typeof Tt=="boolean"||typeof Tt=="function")&&(P.configs[kt]=Tt)})),Pe(i.key,u,i.default,P.arrays),Object.keys(d).forEach(function(kt){(P.aliases[kt]||[]).forEach(function(Tt){d[Tt]=d[kt]})});let q=null;Bn();let D=[],C=Object.assign(Object.create(null),{_:[]}),z={};for(let kt=0;kt<n.length;kt++){let Tt=n[kt],cr=Tt.replace(/^-{3,}/,"---"),er,Rt,qi,Tr,ti,an;if(Tt!=="--"&&/^-/.test(Tt)&&bt(Tt))$(Tt);else if(cr.match(/^---+(=|$)/)){$(Tt);continue}else if(Tt.match(/^--.+=/)||!l["short-option-groups"]&&Tt.match(/^-.+=/))Tr=Tt.match(/^--?([^=]+)=([\s\S]*)$/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=3&&(Ot(Tr[1],P.arrays)?kt=L(kt,Tr[1],n,Tr[2]):Ot(Tr[1],P.nargs)!==!1?kt=x(kt,Tr[1],n,Tr[2]):V(Tr[1],Tr[2],!0));else if(Tt.match(A)&&l["boolean-negation"])Tr=Tt.match(A),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],V(Rt,Ot(Rt,P.arrays)?[!1]:!1));else if(Tt.match(/^--.+/)||!l["short-option-groups"]&&Tt.match(/^-[^-]+/))Tr=Tt.match(/^--?(.+)/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],Ot(Rt,P.arrays)?kt=L(kt,Rt,n):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n):(ti=n[kt+1],ti!==void 0&&(!ti.match(/^-/)||ti.match(E))&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)||/^(true|false)$/.test(ti)?(V(Rt,ti),kt++):V(Rt,sr(Rt))));else if(Tt.match(/^-.\..+=/))Tr=Tt.match(/^-([^=]+)=([\s\S]*)$/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=3&&V(Tr[1],Tr[2]);else if(Tt.match(/^-.\..+/)&&!Tt.match(E))ti=n[kt+1],Tr=Tt.match(/^-(.\..+)/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],ti!==void 0&&!ti.match(/^-/)&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)?(V(Rt,ti),kt++):V(Rt,sr(Rt)));else if(Tt.match(/^-[^-]+/)&&!Tt.match(E)){qi=Tt.slice(1,-1).split(""),er=!1;for(let ja=0;ja<qi.length;ja++){if(ti=Tt.slice(ja+2),qi[ja+1]&&qi[ja+1]==="="){an=Tt.slice(ja+3),Rt=qi[ja],Ot(Rt,P.arrays)?kt=L(kt,Rt,n,an):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n,an):V(Rt,an),er=!0;break}if(ti==="-"){V(qi[ja],ti);continue}if(/[A-Za-z]/.test(qi[ja])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(ti)&&Ot(ti,P.bools)===!1){V(qi[ja],ti),er=!0;break}if(qi[ja+1]&&qi[ja+1].match(/\W/)){V(qi[ja],ti),er=!0;break}else V(qi[ja],sr(qi[ja]))}Rt=Tt.slice(-1)[0],!er&&Rt!=="-"&&(Ot(Rt,P.arrays)?kt=L(kt,Rt,n):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n):(ti=n[kt+1],ti!==void 0&&(!/^(-|--)[^-]/.test(ti)||ti.match(E))&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)||/^(true|false)$/.test(ti)?(V(Rt,ti),kt++):V(Rt,sr(Rt))))}else if(Tt.match(/^-[0-9]$/)&&Tt.match(E)&&Ot(Tt.slice(1),P.bools))Rt=Tt.slice(1),V(Rt,sr(Rt));else if(Tt==="--"){D=n.slice(kt+1);break}else if(l["halt-at-non-option"]){D=n.slice(kt);break}else $(Tt)}Se(C,!0),Se(C,!1),le(C),_e(),Ee(C,P.aliases,d,!0),Qe(C),l["set-placeholder-key"]&&St(C),Object.keys(P.counts).forEach(function(kt){Te(C,kt.split("."))||V(kt,0)}),c&&D.length&&(C[b]=[]),D.forEach(function(kt){C[b].push(kt)}),l["camel-case-expansion"]&&l["strip-dashed"]&&Object.keys(C).filter(kt=>kt!=="--"&&kt.includes("-")).forEach(kt=>{delete C[kt]}),l["strip-aliased"]&&[].concat(...Object.keys(u).map(kt=>u[kt])).forEach(kt=>{l["camel-case-expansion"]&&kt.includes("-")&&delete C[kt.split(".").map(Tt=>Jia(Tt)).join(".")],delete C[kt]});function $(kt){let Tt=X("_",kt);(typeof Tt=="string"||typeof Tt=="number")&&C._.push(Tt)}function x(kt,Tt,cr,er){let Rt,qi=Ot(Tt,P.nargs);if(qi=typeof qi!="number"||isNaN(qi)?1:qi,qi===0)return mn(er)||(q=Error(m("Argument unexpected for: %s",Tt))),V(Tt,sr(Tt)),kt;let Tr=mn(er)?0:1;if(l["nargs-eats-options"])cr.length-(kt+1)+Tr<qi&&(q=Error(m("Not enough arguments following: %s",Tt))),Tr=qi;else{for(Rt=kt+1;Rt<cr.length&&(!cr[Rt].match(/^-[^0-9]/)||cr[Rt].match(E)||bt(cr[Rt]));Rt++)Tr++;Tr<qi&&(q=Error(m("Not enough arguments following: %s",Tt)))}let ti=Math.min(Tr,qi);for(!mn(er)&&ti>0&&(V(Tt,er),ti--),Rt=kt+1;Rt<ti+kt+1;Rt++)V(Tt,cr[Rt]);return kt+ti}function L(kt,Tt,cr,er){let Rt=[],qi=er||cr[kt+1],Tr=Ot(Tt,P.nargs);if(Ot(Tt,P.bools)&&!/^(true|false)$/.test(qi))Rt.push(!0);else if(mn(qi)||mn(er)&&/^-/.test(qi)&&!E.test(qi)&&!bt(qi)){if(d[Tt]!==void 0){let ti=d[Tt];Rt=Array.isArray(ti)?ti:[ti]}}else{mn(er)||Rt.push(K(Tt,er,!0));for(let ti=kt+1;ti<cr.length&&!(!l["greedy-arrays"]&&Rt.length>0||Tr&&typeof Tr=="number"&&Rt.length>=Tr||(qi=cr[ti],/^-/.test(qi)&&!E.test(qi)&&!bt(qi)));ti++)kt=ti,Rt.push(K(Tt,qi,a))}return typeof Tr=="number"&&(Tr&&Rt.length<Tr||isNaN(Tr)&&Rt.length===0)&&(q=Error(m("Not enough arguments following: %s",Tt))),V(Tt,Rt),kt}function V(kt,Tt,cr=a){if(/-/.test(kt)&&l["camel-case-expansion"]){let qi=kt.split(".").map(function(Tr){return Jia(Tr)}).join(".");Z(kt,qi)}let er=K(kt,Tt,cr),Rt=kt.split(".");xt(C,Rt,er),P.aliases[kt]&&P.aliases[kt].forEach(function(qi){let Tr=qi.split(".");xt(C,Tr,er)}),Rt.length>1&&l["dot-notation"]&&(P.aliases[Rt[0]]||[]).forEach(function(qi){let Tr=qi.split("."),ti=[].concat(Rt);ti.shift(),Tr=Tr.concat(ti),(P.aliases[kt]||[]).includes(Tr.join("."))||xt(C,Tr,er)}),Ot(kt,P.normalize)&&!Ot(kt,P.arrays)&&[kt].concat(P.aliases[kt]||[]).forEach(function(Tr){Object.defineProperty(z,Tr,{enumerable:!0,get(){return Tt},set(ti){Tt=typeof ti=="string"?KGr.normalize(ti):ti}})})}function Z(kt,Tt){P.aliases[kt]&&P.aliases[kt].length||(P.aliases[kt]=[Tt],g[Tt]=!0),P.aliases[Tt]&&P.aliases[Tt].length||Z(Tt,kt)}function K(kt,Tt,cr){cr&&(Tt=er1(Tt)),(Ot(kt,P.bools)||Ot(kt,P.counts))&&typeof Tt=="string"&&(Tt=Tt==="true");let er=Array.isArray(Tt)?Tt.map(function(Rt){return X(kt,Rt)}):X(kt,Tt);return Ot(kt,P.counts)&&(mn(er)||typeof er=="boolean")&&(er=Eps()),Ot(kt,P.normalize)&&Ot(kt,P.arrays)&&(Array.isArray(Tt)?er=Tt.map(Rt=>KGr.normalize(Rt)):er=KGr.normalize(Tt)),er}function X(kt,Tt){return!l["parse-positional-numbers"]&&kt==="_"||!Ot(kt,P.strings)&&!Ot(kt,P.bools)&&!Array.isArray(Tt)&&(K4f(Tt)&&l["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${Tt}`)))||!mn(Tt)&&Ot(kt,P.numbers))&&(Tt=Number(Tt)),Tt}function le(kt){let Tt=Object.create(null);Ee(Tt,P.aliases,d),Object.keys(P.configs).forEach(function(cr){let er=kt[cr]||Tt[cr];if(er)try{let Rt=null,qi=KGr.resolve(KGr.cwd(),er),Tr=P.configs[cr];if(typeof Tr=="function"){try{Rt=Tr(qi)}catch(ti){Rt=ti}if(Rt instanceof Error){q=Rt;return}}else Rt=KGr.require(qi);ge(Rt)}catch(Rt){Rt.name==="PermissionDenied"?q=Rt:kt[cr]&&(q=Error(m("Invalid JSON config file: %s",er)))}})}function ge(kt,Tt){Object.keys(kt).forEach(function(cr){let er=kt[cr],Rt=Tt?Tt+"."+cr:cr;typeof er=="object"&&er!==null&&!Array.isArray(er)&&l["dot-notation"]?ge(er,Rt):(!Te(C,Rt.split("."))||Ot(Rt,P.arrays)&&l["combine-arrays"])&&V(Rt,er)})}function _e(){typeof s<"u"&&s.forEach(function(kt){ge(kt)})}function Se(kt,Tt){if(typeof o>"u")return;let cr=typeof o=="string"?o:"",er=KGr.env();Object.keys(er).forEach(function(Rt){if(cr===""||Rt.lastIndexOf(cr,0)===0){let qi=Rt.split("__").map(function(Tr,ti){return ti===0&&(Tr=Tr.substring(cr.length)),Jia(Tr)});(Tt&&P.configs[qi.join(".")]||!Tt)&&!Te(kt,qi)&&V(qi.join("."),er[Rt])}})}function Qe(kt){let Tt,cr=new Set;Object.keys(kt).forEach(function(er){if(!cr.has(er)&&(Tt=Ot(er,P.coercions),typeof Tt=="function"))try{let Rt=X(er,Tt(kt[er]));[].concat(P.aliases[er]||[],er).forEach(qi=>{cr.add(qi),kt[qi]=Rt})}catch(Rt){q=Rt}})}function St(kt){return P.keys.forEach(Tt=>{~Tt.indexOf(".")||typeof kt[Tt]>"u"&&(kt[Tt]=void 0)}),kt}function Ee(kt,Tt,cr,er=!1){Object.keys(cr).forEach(function(Rt){Te(kt,Rt.split("."))||(xt(kt,Rt.split("."),cr[Rt]),er&&(O[Rt]=!0),(Tt[Rt]||[]).forEach(function(qi){Te(kt,qi.split("."))||xt(kt,qi.split("."),cr[Rt])}))})}function Te(kt,Tt){let cr=kt;l["dot-notation"]||(Tt=[Tt.join(".")]),Tt.slice(0,-1).forEach(function(Rt){cr=cr[Rt]||{}});let er=Tt[Tt.length-1];return typeof cr!="object"?!1:er in cr}function xt(kt,Tt,cr){let er=kt;l["dot-notation"]||(Tt=[Tt.join(".")]),Tt.slice(0,-1).forEach(function(an){an=$4f(an),typeof er=="object"&&er[an]===void 0&&(er[an]={}),typeof er[an]!="object"||Array.isArray(er[an])?(Array.isArray(er[an])?er[an].push({}):er[an]=[er[an],{}],er=er[an][er[an].length-1]):er=er[an]});let Rt=$4f(Tt[Tt.length-1]),qi=Ot(Tt.join("."),P.arrays),Tr=Array.isArray(cr),ti=l["duplicate-arguments-array"];!ti&&Ot(Rt,P.nargs)&&(ti=!0,(!mn(er[Rt])&&P.nargs[Rt]===1||Array.isArray(er[Rt])&&er[Rt].length===P.nargs[Rt])&&(er[Rt]=void 0)),cr===Eps()?er[Rt]=Eps(er[Rt]):Array.isArray(er[Rt])?ti&&qi&&Tr?er[Rt]=l["flatten-duplicate-arrays"]?er[Rt].concat(cr):(Array.isArray(er[Rt][0])?er[Rt]:[er[Rt]]).concat([cr]):!ti&&!!qi==!!Tr?er[Rt]=cr:er[Rt]=er[Rt].concat([cr]):er[Rt]===void 0&&qi?er[Rt]=Tr?cr:[cr]:ti&&!(er[Rt]===void 0||Ot(Rt,P.counts)||Ot(Rt,P.bools))?er[Rt]=[er[Rt],cr]:er[Rt]=cr}function Pe(...kt){kt.forEach(function(Tt){Object.keys(Tt||{}).forEach(function(cr){P.aliases[cr]||(P.aliases[cr]=[].concat(u[cr]||[]),P.aliases[cr].concat(cr).forEach(function(er){if(/-/.test(er)&&l["camel-case-expansion"]){let Rt=Jia(er);Rt!==cr&&P.aliases[cr].indexOf(Rt)===-1&&(P.aliases[cr].push(Rt),g[Rt]=!0)}}),P.aliases[cr].concat(cr).forEach(function(er){if(er.length>1&&/[A-Z]/.test(er)&&l["camel-case-expansion"]){let Rt=J4f(er,"-");Rt!==cr&&P.aliases[cr].indexOf(Rt)===-1&&(P.aliases[cr].push(Rt),g[Rt]=!0)}}),P.aliases[cr].forEach(function(er){P.aliases[er]=[cr].concat(P.aliases[cr].filter(function(Rt){return er!==Rt}))}))})})}function Ot(kt,Tt){let cr=[].concat(P.aliases[kt]||[],kt),er=Object.keys(Tt),Rt=cr.find(qi=>er.includes(qi));return Rt?Tt[Rt]:!1}function at(kt){let Tt=Object.keys(P);return[].concat(Tt.map(er=>P[er])).some(function(er){return Array.isArray(er)?er.includes(kt):er[kt]})}function he(kt,...Tt){return[].concat(...Tt).some(function(er){let Rt=kt.match(er);return Rt&&at(Rt[1])})}function je(kt){if(kt.match(E)||!kt.match(/^-[^-]+/))return!1;let Tt=!0,cr,er=kt.slice(1).split("");for(let Rt=0;Rt<er.length;Rt++){if(cr=kt.slice(Rt+2),!at(er[Rt])){Tt=!1;break}if(er[Rt+1]&&er[Rt+1]==="="||cr==="-"||/[A-Za-z]/.test(er[Rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(cr)||er[Rt+1]&&er[Rt+1].match(/\W/))break}return Tt}function bt(kt){return l["unknown-options-as-args"]&&Dt(kt)}function Dt(kt){return kt=kt.replace(/^-{3,}/,"--"),kt.match(E)||je(kt)?!1:!he(kt,/^-+([^=]+?)=[\s\S]*$/,A,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function sr(kt){return!Ot(kt,P.bools)&&!Ot(kt,P.counts)&&`${kt}`in d?d[kt]:ur(ni(kt))}function ur(kt){return{[F4t.BOOLEAN]:!0,[F4t.STRING]:"",[F4t.NUMBER]:void 0,[F4t.ARRAY]:[]}[kt]}function ni(kt){let Tt=F4t.BOOLEAN;return Ot(kt,P.strings)?Tt=F4t.STRING:Ot(kt,P.numbers)?Tt=F4t.NUMBER:Ot(kt,P.bools)?Tt=F4t.BOOLEAN:Ot(kt,P.arrays)&&(Tt=F4t.ARRAY),Tt}function mn(kt){return kt===void 0}function Bn(){Object.keys(P.counts).find(kt=>Ot(kt,P.arrays)?(q=Error(m("Invalid configuration: %s, opts.count excludes opts.array.",kt)),!0):Ot(kt,P.nargs)?(q=Error(m("Invalid configuration: %s, opts.count excludes opts.narg.",kt)),!0):!1)}return{aliases:Object.assign({},P.aliases),argv:Object.assign(z,C),configuration:l,defaulted:Object.assign({},O),error:q,newAliases:Object.assign({},g)}}};function kt1(e){let t=[],r=Object.create(null),i=!0;for(Object.keys(e).forEach(function(n){t.push([].concat(e[n],n))});i;){i=!1;for(let n=0;n<t.length;n++)for(let a=n+1;a<t.length;a++)if(t[n].filter(function(l){return t[a].indexOf(l)!==-1}).length){t[n]=t[n].concat(t[a]),t.splice(a,1),i=!0;break}}return t.forEach(function(n){n=n.filter(function(u,l,d){return d.indexOf(u)===l});let a=n.pop();a!==void 0&&typeof a=="string"&&(r[a]=n)}),r}function Eps(e){return e!==void 0?e+1:1}function $4f(e){return e==="__proto__"?"___proto___":e}function er1(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}var Mps,Aps,qps,G4f=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Q4f=(Aps=(Mps=process==null?void 0:process.versions)===null||Mps===void 0?void 0:Mps.node)!==null&&Aps!==void 0?Aps:(qps=process==null?void 0:process.version)===null||qps===void 0?void 0:qps.slice(1);if(Q4f&&Number(Q4f.match(/^([^.]+)/)[1])<G4f)throw Error(`yargs parser supports a minimum Node.js version of ${G4f}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var tr1=process?process.env:{},Y4f=new Tps({cwd:process.cwd,env:()=>tr1,format:Yt1.format,normalize:H4f.normalize,resolve:H4f.resolve,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Xt1.readFileSync(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),Kia=function(t,r){return Y4f.parse(t.slice(),r).argv};Kia.detailed=function(e,t){return Y4f.parse(e.slice(),t)};Kia.camelCase=Jia;Kia.decamelize=J4f;Kia.looksLikeNumber=K4f;X4f.exports=Kia});var k4f=f((D$3,Z4f)=>{"use strict";Z4f.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var hui=f((E$3,e8f)=>{"use strict";var rr1=k4f();e8f.exports=e=>typeof e=="string"?e.replace(rr1(),""):e});var r8f=f((M$3,Cps)=>{"use strict";var t8f=e=>Number.isNaN(e)?!1:e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141);Cps.exports=t8f;Cps.exports.default=t8f});var n8f=f((A$3,i8f)=>{"use strict";i8f.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var yui=f((q$3,Bps)=>{"use strict";var ir1=hui(),nr1=r8f(),ar1=n8f(),a8f=e=>{if(typeof e!="string"||e.length===0||(e=ir1(e),e.length===0))return 0;e=e.replace(ar1()," ");let t=0;for(let r=0;r<e.length;r++){let i=e.codePointAt(r);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&r++,t+=nr1(i)?2:1)}return t};Bps.exports=a8f;Bps.exports.default=a8f});var u8f=f((T$3,o8f)=>{"use strict";o8f.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var xps=f((C$3,c8f)=>{"use strict";var Xia=u8f(),s8f={};for(let e of Object.keys(Xia))s8f[Xia[e]]=e;var by={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};c8f.exports=by;for(let e of Object.keys(by)){if(!("channels"in by[e]))throw new Error("missing channels property: "+e);if(!("labels"in by[e]))throw new Error("missing channel labels property: "+e);if(by[e].labels.length!==by[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=by[e];delete by[e].channels,delete by[e].labels,Object.defineProperty(by[e],"channels",{value:t}),Object.defineProperty(by[e],"labels",{value:r})}by.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.min(t,r,i),a=Math.max(t,r,i),u=a-n,l,d;a===n?l=0:t===a?l=(r-i)/u:r===a?l=2+(i-t)/u:i===a&&(l=4+(t-r)/u),l=Math.min(l*60,360),l<0&&(l+=360);let s=(n+a)/2;return a===n?d=0:s<=.5?d=u/(a+n):d=u/(2-a-n),[l,d*100,s*100]};by.rgb.hsv=function(e){let t,r,i,n,a,u=e[0]/255,l=e[1]/255,d=e[2]/255,s=Math.max(u,l,d),o=s-Math.min(u,l,d),c=function(b){return(s-b)/6/o+1/2};return o===0?(n=0,a=0):(a=o/s,t=c(u),r=c(l),i=c(d),u===s?n=i-r:l===s?n=1/3+t-i:d===s&&(n=2/3+r-t),n<0?n+=1:n>1&&(n-=1)),[n*360,a*100,s*100]};by.rgb.hwb=function(e){let t=e[0],r=e[1],i=e[2],n=by.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(r,i));return i=1-1/255*Math.max(t,Math.max(r,i)),[n,a*100,i*100]};by.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.min(1-t,1-r,1-i),a=(1-t-n)/(1-n)||0,u=(1-r-n)/(1-n)||0,l=(1-i-n)/(1-n)||0;return[a*100,u*100,l*100,n*100]};function or1(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}by.rgb.keyword=function(e){let t=s8f[e];if(t)return t;let r=1/0,i;for(let n of Object.keys(Xia)){let a=Xia[n],u=or1(e,a);u<r&&(r=u,i=n)}return i};by.keyword.rgb=function(e){return Xia[e]};by.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let n=t*.4124+r*.3576+i*.1805,a=t*.2126+r*.7152+i*.0722,u=t*.0193+r*.1192+i*.9505;return[n*100,a*100,u*100]};by.rgb.lab=function(e){let t=by.rgb.xyz(e),r=t[0],i=t[1],n=t[2];r/=95.047,i/=100,n/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let a=116*i-16,u=500*(r-i),l=200*(i-n);return[a,u,l]};by.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100,n,a,u;if(r===0)return u=i*255,[u,u,u];i<.5?n=i*(1+r):n=i+r-i*r;let l=2*i-n,d=[0,0,0];for(let s=0;s<3;s++)a=t+1/3*-(s-1),a<0&&a++,a>1&&a--,6*a<1?u=l+(n-l)*6*a:2*a<1?u=n:3*a<2?u=l+(n-l)*(2/3-a)*6:u=l,d[s]=u*255;return d};by.hsl.hsv=function(e){let t=e[0],r=e[1]/100,i=e[2]/100,n=r,a=Math.max(i,.01);i*=2,r*=i<=1?i:2-i,n*=a<=1?a:2-a;let u=(i+r)/2,l=i===0?2*n/(a+n):2*r/(i+r);return[t,l*100,u*100]};by.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,i=e[2]/100,n=Math.floor(t)%6,a=t-Math.floor(t),u=255*i*(1-r),l=255*i*(1-r*a),d=255*i*(1-r*(1-a));switch(i*=255,n){case 0:return[i,d,u];case 1:return[l,i,u];case 2:return[u,i,d];case 3:return[u,l,i];case 4:return[d,u,i];case 5:return[i,u,l]}};by.hsv.hsl=function(e){let t=e[0],r=e[1]/100,i=e[2]/100,n=Math.max(i,.01),a,u;u=(2-r)*i;let l=(2-r)*n;return a=r*n,a/=l<=1?l:2-l,a=a||0,u/=2,[t,a*100,u*100]};by.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100,n=r+i,a;n>1&&(r/=n,i/=n);let u=Math.floor(6*t),l=1-i;a=6*t-u,u&1&&(a=1-a);let d=r+a*(l-r),s,o,c;switch(u){default:case 6:case 0:s=l,o=d,c=r;break;case 1:s=d,o=l,c=r;break;case 2:s=r,o=l,c=d;break;case 3:s=r,o=d,c=l;break;case 4:s=d,o=r,c=l;break;case 5:s=l,o=r,c=d;break}return[s*255,o*255,c*255]};by.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,i=e[2]/100,n=e[3]/100,a=1-Math.min(1,t*(1-n)+n),u=1-Math.min(1,r*(1-n)+n),l=1-Math.min(1,i*(1-n)+n);return[a*255,u*255,l*255]};by.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,i=e[2]/100,n,a,u;return n=t*3.2406+r*-1.5372+i*-.4986,a=t*-.9689+r*1.8758+i*.0415,u=t*.0557+r*-.204+i*1.057,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,n=Math.min(Math.max(0,n),1),a=Math.min(Math.max(0,a),1),u=Math.min(Math.max(0,u),1),[n*255,a*255,u*255]};by.xyz.lab=function(e){let t=e[0],r=e[1],i=e[2];t/=95.047,r/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let n=116*r-16,a=500*(t-r),u=200*(r-i);return[n,a,u]};by.lab.xyz=function(e){let t=e[0],r=e[1],i=e[2],n,a,u;a=(t+16)/116,n=r/500+a,u=a-i/200;let l=a**3,d=n**3,s=u**3;return a=l>.008856?l:(a-16/116)/7.787,n=d>.008856?d:(n-16/116)/7.787,u=s>.008856?s:(u-16/116)/7.787,n*=95.047,a*=100,u*=108.883,[n,a,u]};by.lab.lch=function(e){let t=e[0],r=e[1],i=e[2],n;n=Math.atan2(i,r)*360/2/Math.PI,n<0&&(n+=360);let u=Math.sqrt(r*r+i*i);return[t,u,n]};by.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,a=r*Math.cos(n),u=r*Math.sin(n);return[t,a,u]};by.rgb.ansi16=function(e,t=null){let[r,i,n]=e,a=t===null?by.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let u=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(r/255));return a===2&&(u+=60),u};by.hsv.ansi16=function(e){return by.rgb.ansi16(by.hsv.rgb(e),e[2])};by.rgb.ansi256=function(e){let t=e[0],r=e[1],i=e[2];return t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5)};by.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(~~(e>50)+1)*.5,i=(t&1)*r*255,n=(t>>1&1)*r*255,a=(t>>2&1)*r*255;return[i,n,a]};by.ansi256.rgb=function(e){if(e>=232){let a=(e-232)*10+8;return[a,a,a]}e-=16;let t,r=Math.floor(e/36)/5*255,i=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,i,n]};by.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};by.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=r.split("").map(l=>l+l).join(""));let i=parseInt(r,16),n=i>>16&255,a=i>>8&255,u=i&255;return[n,a,u]};by.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.max(Math.max(t,r),i),a=Math.min(Math.min(t,r),i),u=n-a,l,d;return u<1?l=a/(1-u):l=0,u<=0?d=0:n===t?d=(r-i)/u%6:n===r?d=2+(i-t)/u:d=4+(t-r)/u,d/=6,d%=1,[d*360,u*100,l*100]};by.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,i=r<.5?2*t*r:2*t*(1-r),n=0;return i<1&&(n=(r-.5*i)/(1-i)),[e[0],i*100,n*100]};by.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,i=t*r,n=0;return i<1&&(n=(r-i)/(1-i)),[e[0],i*100,n*100]};by.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100;if(r===0)return[i*255,i*255,i*255];let n=[0,0,0],a=t%1*6,u=a%1,l=1-u,d=0;switch(Math.floor(a)){case 0:n[0]=1,n[1]=u,n[2]=0;break;case 1:n[0]=l,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=u;break;case 3:n[0]=0,n[1]=l,n[2]=1;break;case 4:n[0]=u,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=l}return d=(1-r)*i,[(r*n[0]+d)*255,(r*n[1]+d)*255,(r*n[2]+d)*255]};by.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,i=t+r*(1-t),n=0;return i>0&&(n=t/i),[e[0],n*100,i*100]};by.hcg.hsl=function(e){let t=e[1]/100,i=e[2]/100*(1-t)+.5*t,n=0;return i>0&&i<.5?n=t/(2*i):i>=.5&&i<1&&(n=t/(2*(1-i))),[e[0],n*100,i*100]};by.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,i=t+r*(1-t);return[e[0],(i-t)*100,(1-i)*100]};by.hwb.hcg=function(e){let t=e[1]/100,i=1-e[2]/100,n=i-t,a=0;return n<1&&(a=(i-n)/(1-n)),[e[0],n*100,a*100]};by.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};by.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};by.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};by.gray.hsl=function(e){return[0,0,e[0]]};by.gray.hsv=by.gray.hsl;by.gray.hwb=function(e){return[0,100,e[0]]};by.gray.cmyk=function(e){return[0,0,0,e[0]]};by.gray.lab=function(e){return[e[0],0,0]};by.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(i.length)+i};by.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var f8f=f((B$3,l8f)=>{"use strict";var kYa=xps();function ur1(){let e={},t=Object.keys(kYa);for(let r=t.length,i=0;i<r;i++)e[t[i]]={distance:-1,parent:null};return e}function sr1(e){let t=ur1(),r=[e];for(t[e].distance=0;r.length;){let i=r.pop(),n=Object.keys(kYa[i]);for(let a=n.length,u=0;u<a;u++){let l=n[u],d=t[l];d.distance===-1&&(d.distance=t[i].distance+1,d.parent=i,r.unshift(l))}}return t}function cr1(e,t){return function(r){return t(e(r))}}function lr1(e,t){let r=[t[e].parent,e],i=kYa[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),i=cr1(kYa[t[n].parent][n],i),n=t[n].parent;return i.conversion=r,i}l8f.exports=function(e){let t=sr1(e),r={},i=Object.keys(t);for(let n=i.length,a=0;a<n;a++){let u=i[a];t[u].parent!==null&&(r[u]=lr1(u,t))}return r}});var p8f=f((x$3,d8f)=>{"use strict";var Ips=xps(),fr1=f8f(),qhn={},dr1=Object.keys(Ips);function pr1(e){let t=function(...r){let i=r[0];return i==null?i:(i.length>1&&(r=i),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function _r1(e){let t=function(...r){let i=r[0];if(i==null)return i;i.length>1&&(r=i);let n=e(r);if(typeof n=="object")for(let a=n.length,u=0;u<a;u++)n[u]=Math.round(n[u]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}dr1.forEach(e=>{qhn[e]={},Object.defineProperty(qhn[e],"channels",{value:Ips[e].channels}),Object.defineProperty(qhn[e],"labels",{value:Ips[e].labels});let t=fr1(e);Object.keys(t).forEach(i=>{let n=t[i];qhn[e][i]=_r1(n),qhn[e][i].raw=pr1(n)})});d8f.exports=qhn});var tXa=f((I$3,b8f)=>{"use strict";var _8f=(e,t)=>(...r)=>`\x1B[${e(...r)+t}m`,h8f=(e,t)=>(...r)=>{let i=e(...r);return`\x1B[${38+t};5;${i}m`},y8f=(e,t)=>(...r)=>{let i=e(...r);return`\x1B[${38+t};2;${i[0]};${i[1]};${i[2]}m`},eXa=e=>e,v8f=(e,t,r)=>[e,t,r],Thn=(e,t,r)=>{Object.defineProperty(e,t,{get:()=>{let i=r();return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0}),i},enumerable:!0,configurable:!0})},zps,Chn=(e,t,r,i)=>{zps===void 0&&(zps=p8f());let n=i?10:0,a={};for(let[u,l]of Object.entries(zps)){let d=u==="ansi16"?"ansi":u;u===t?a[d]=e(r,n):typeof l=="object"&&(a[d]=e(l[t],n))}return a};function hr1(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,i]of Object.entries(t)){for(let[n,a]of Object.entries(i))t[n]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},i[n]=t[n],e.set(a[0],a[1]);Object.defineProperty(t,r,{value:i,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",Thn(t.color,"ansi",()=>Chn(_8f,"ansi16",eXa,!1)),Thn(t.color,"ansi256",()=>Chn(h8f,"ansi256",eXa,!1)),Thn(t.color,"ansi16m",()=>Chn(y8f,"rgb",v8f,!1)),Thn(t.bgColor,"ansi",()=>Chn(_8f,"ansi16",eXa,!0)),Thn(t.bgColor,"ansi256",()=>Chn(h8f,"ansi256",eXa,!0)),Thn(t.bgColor,"ansi16m",()=>Chn(y8f,"rgb",v8f,!0)),t}Object.defineProperty(b8f,"exports",{enumerable:!0,get:hr1})});var w8f=f((z$3,j8f)=>{"use strict";var Zia=yui(),yr1=hui(),vr1=tXa(),rXa=new Set(["\x1B","\x9B"]),br1=39,Nps="\x07",m8f="[",gr1="]",P8f="m",Fps=`${gr1}8;;`,g8f=e=>`${rXa.values().next().value}${m8f}${e}${P8f}`,O8f=e=>`${rXa.values().next().value}${Fps}${e}${Nps}`,Or1=e=>e.split(" ").map(t=>Zia(t)),Rps=(e,t,r)=>{let i=[...t],n=!1,a=!1,u=Zia(yr1(e[e.length-1]));for(let[l,d]of i.entries()){let s=Zia(d);if(u+s<=r?e[e.length-1]+=d:(e.push(d),u=0),rXa.has(d)&&(n=!0,a=i.slice(l+1).join("").startsWith(Fps)),n){a?d===Nps&&(n=!1,a=!1):d===P8f&&(n=!1);continue}u+=s,u===r&&l<i.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},mr1=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(Zia(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Pr1=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a,u=Or1(e),l=[""];for(let[s,o]of e.split(" ").entries()){r.trim!==!1&&(l[l.length-1]=l[l.length-1].trimStart());let c=Zia(l[l.length-1]);if(s!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(l.push(""),c=0),(c>0||r.trim===!1)&&(l[l.length-1]+=" ",c++)),r.hard&&u[s]>t){let b=t-c,g=1+Math.floor((u[s]-b-1)/t);Math.floor((u[s]-1)/t)<g&&l.push(""),Rps(l,o,t);continue}if(c+u[s]>t&&c>0&&u[s]>0){if(r.wordWrap===!1&&c<t){Rps(l,o,t);continue}l.push("")}if(c+u[s]>t&&r.wordWrap===!1){Rps(l,o,t);continue}l[l.length-1]+=o}r.trim!==!1&&(l=l.map(mr1));let d=[...l.join(`
23
+ `+r)}function cCi(e,t,r,i,n){if(e.listenerCount("wsClientError")){let a=new Error(n);Error.captureStackTrace(a,cCi),e.emit("wsClientError",a,r,t)}else Uia(r,i,n)}});var p4f=f((xH3,d4f)=>{"use strict";var QGr=LYa();QGr.createWebSocketStream=cps();QGr.Server=fps();QGr.Receiver=BYa();QGr.Sender=IYa();QGr.WebSocket=QGr;QGr.WebSocketServer=QGr.Server;d4f.exports=QGr});var _4f=f(_ui=>{"use strict";Object.defineProperty(_ui,"__esModule",{value:!0});_ui.CloseEvent=_ui.ErrorEvent=_ui.Event=void 0;var Via=class{target;type;constructor(t,r){this.target=r,this.type=t}};_ui.Event=Via;var dps=class extends Via{message;error;constructor(t,r){super("error",r),this.message=t.message,this.error=t}};_ui.ErrorEvent=dps;var pps=class extends Via{code;reason;wasClean=!0;constructor(t=1e3,r="",i){super("close",i),this.code=t,this.reason=r}};_ui.CloseEvent=pps});var y4f=f(Z$t=>{"use strict";var ht1=Z$t&&Z$t.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),yt1=Z$t&&Z$t.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vt1=Z$t&&Z$t.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var i=e(t),n=0;n<i.length;n++)i[n]!=="default"&&ht1(r,t,i[n]);return yt1(r,t),r}}();Object.defineProperty(Z$t,"__esModule",{value:!0});Z$t.ReconnectingWebSocket=void 0;var bt1=p4f(),gt1=WTi(),h4f=vt1(_4f()),Ot1=()=>{if(typeof WebSocket<"u")return WebSocket;if(gt1.RUNTIME.type==="node")return bt1.WebSocket},mt1=e=>typeof e<"u"&&!!e&&e.CLOSING===2,lCi={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},_ps=class e{_ws;_listeners={error:[],message:[],open:[],close:[]};_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType="blob";_closeCalled=!1;_messageQueue=[];_url;_protocols;_options;_headers;constructor(t,r,i={},n){this._url=t,this._protocols=r,this._options=i,this._headers=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((r,i)=>(typeof i=="string"?r+=i.length:i instanceof Blob?r+=i.size:r+=i.byteLength,r),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:""}onclose=null;onerror=null;onmessage=null;onopen=null;close(t=1e3,r){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,r)}reconnect(t,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,r),this._connect())}send(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{let{maxEnqueuedMessages:r=lCi.maxEnqueuedMessages}=this._options;this._messageQueue.length<r&&(this._debug("enqueue",t),this._messageQueue.push(t))}}addEventListener(t,r){this._listeners[t]&&this._listeners[t].push(r)}dispatchEvent(t){let r=this._listeners[t.type];if(r)for(let i of r)this._callEventListener(t,i);return!0}removeEventListener(t,r){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(i=>i!==r))}_debug(...t){this._options.debug&&console.log.apply(console,["RWS>",...t])}_getNextDelay(){let{reconnectionDelayGrowFactor:t=lCi.reconnectionDelayGrowFactor,minReconnectionDelay:r=lCi.minReconnectionDelay,maxReconnectionDelay:i=lCi.maxReconnectionDelay}=this._options,n=0;return this._retryCount>0&&(n=r*Math.pow(t,this._retryCount-1),n>i&&(n=i)),this._debug("next delay",n),n}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_getNextUrl(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){let r=t();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;let{maxRetries:t=lCi.maxRetries,connectionTimeout:r=lCi.connectionTimeout,WebSocket:i=Ot1()}=this._options;if(this._retryCount>=t){this._debug("max retries reached",this._retryCount,">=",t);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!mt1(i))throw Error("No valid WebSocket class provided");this._wait().then(()=>this._getNextUrl(this._url)).then(n=>{if(this._closeCalled)return;let a={};this._headers&&(a.headers=this._headers),this._ws=new i(n,this._protocols,a),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),r)})}_handleTimeout(){this._debug("timeout event"),this._handleError(new h4f.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,r){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,r),this._handleClose(new h4f.CloseEvent(t,r,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_callEventListener(t,r){"handleEvent"in r?r.handleEvent(t):r(t)}_handleOpen=t=>{this._debug("open event");let{minUptime:r=lCi.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),r),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(i=>this._ws?.send(i)),this._messageQueue=[],this.onopen&&this.onopen(t),this._listeners.open.forEach(i=>this._callEventListener(t,i))};_handleMessage=t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this._listeners.message.forEach(r=>this._callEventListener(t,r))};_handleError=t=>{this._debug("error event",t.message),this._disconnect(void 0,t.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(t),this._debug("exec error listeners"),this._listeners.error.forEach(r=>this._callEventListener(t,r)),this._connect()};_handleClose=t=>{this._debug("close event"),this._clearTimeouts(),t.code===1e3&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this._listeners.close.forEach(r=>this._callEventListener(t,r))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};Z$t.ReconnectingWebSocket=_ps});var v4f=f(fCi=>{"use strict";var Pt1=fCi&&fCi.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),jt1=fCi&&fCi.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Pt1(t,e,r)};Object.defineProperty(fCi,"__esModule",{value:!0});jt1(y4f(),fCi)});var hps=f(k1e=>{"use strict";var wt1=k1e&&k1e.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),dCi=k1e&&k1e.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&wt1(t,e,r)};Object.defineProperty(k1e,"__esModule",{value:!0});dCi(oFf(),k1e);dCi(a2f(),k1e);dCi(u2f(),k1e);dCi(c2f(),k1e);dCi(WTi(),k1e);dCi(d2f(),k1e);dCi(v4f(),k1e)});var Dps=f((w$3,W4f)=>{"use strict";var wps=require("fs"),$t1=require("util"),Gt1=require("path"),N4t,Sps=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=t.shift(),i=function(){};return typeof t[t.length-1]=="function"&&(i=t.pop()),i=i||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i(),N4t.format.apply(N4t.format,[this.cache[this.locale][r]||r].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),r=t.shift(),i=t.shift(),n=t.shift(),a=function(){};typeof t[t.length-1]=="function"&&(a=t.pop()),this.cache[this.locale]||this._readLocaleFile();let u=n===1?r:i;this.cache[this.locale][r]&&(u=this.cache[this.locale][r][n===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:i},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:a})):a();let l=[u];return~u.indexOf("%d")&&l.push(n),N4t.format.apply(N4t.format,l.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(this.cache[this.locale][r]=t[r])}_taggedLiteral(t,...r){let i="";return t.forEach(function(n,a){let u=r[a+1];i+=n,typeof u<"u"&&(i+="%s")}),this.__.apply(this,[i].concat([].slice.call(r,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,r=this.writeQueue[0],i=r.directory,n=r.locale,a=r.cb,u=this._resolveLocaleFile(i,n),l=JSON.stringify(this.cache[n],null,2);N4t.fs.writeFile(u,l,"utf-8",function(d){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),a(d)})}_readLocaleFile(){let t={},r=this._resolveLocaleFile(this.directory,this.locale);try{N4t.fs.readFileSync&&(t=JSON.parse(N4t.fs.readFileSync(r,"utf-8")))}catch(i){if(i instanceof SyntaxError&&(i.message="syntax error in "+r),i.code==="ENOENT")t={};else throw i}this.cache[this.locale]=t}_resolveLocaleFile(t,r){let i=N4t.resolve(t,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(i)&&~r.lastIndexOf("_")){let n=N4t.resolve(t,"./",r.split("_")[0]+".json");this._fileExistsSync(n)&&(i=n)}return i}_fileExistsSync(t){return N4t.exists(t)}};function Qt1(e,t){N4t=t;let r=new Sps(e);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var Jt1={fs:{readFileSync:wps.readFileSync,writeFile:wps.writeFile},format:$t1.format,resolve:Gt1.resolve,exists:e=>{try{return wps.statSync(e).isFile()}catch{return!1}}},Kt1=e=>Qt1(e,Jt1);W4f.exports=Kt1});var Yia=f((S$3,X4f)=>{"use strict";var Yt1=require("util"),H4f=require("path"),Xt1=require("fs");function Jia(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let r="",i=!1,n=e.match(/^-+/);for(let a=n?n[0].length:0;a<e.length;a++){let u=e.charAt(a);i&&(i=!1,u=u.toUpperCase()),a!==0&&(u==="-"||u==="_")?i=!0:u!=="-"&&u!=="_"&&(r+=u)}return r}}function J4f(e,t){let r=e.toLowerCase();t=t||"-";let i="";for(let n=0;n<e.length;n++){let a=r.charAt(n),u=e.charAt(n);a!==u&&n>0?i+=`${t}${r.charAt(n)}`:i+=u}return i}function K4f(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function Zt1(e){if(Array.isArray(e))return e.map(u=>typeof u!="string"?u+"":u);e=e.trim();let t=0,r=null,i=null,n=null,a=[];for(let u=0;u<e.length;u++){if(r=i,i=e.charAt(u),i===" "&&!n){r!==" "&&t++;continue}i===n?n=null:(i==="'"||i==='"')&&!n&&(n=i),a[t]||(a[t]=""),a[t]+=i}return a}var F4t;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(F4t||(F4t={}));var KGr,Tps=class{constructor(t){KGr=t}parse(t,r){let i=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),n=Zt1(t),a=typeof t=="string",u=kt1(Object.assign(Object.create(null),i.alias)),l=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},i.configuration),d=Object.assign(Object.create(null),i.default),s=i.configObjects||[],o=i.envPrefix,c=l["populate--"],b=c?"--":"_",g=Object.create(null),O=Object.create(null),m=i.__||KGr.format,P={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},E=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,A=new RegExp("^--"+l["negation-prefix"]+"(.+)");[].concat(i.array||[]).filter(Boolean).forEach(function(kt){let Tt=typeof kt=="object"?kt.key:kt,cr=Object.keys(kt).map(function(er){return{boolean:"bools",string:"strings",number:"numbers"}[er]}).filter(Boolean).pop();cr&&(P[cr][Tt]=!0),P.arrays[Tt]=!0,P.keys.push(Tt)}),[].concat(i.boolean||[]).filter(Boolean).forEach(function(kt){P.bools[kt]=!0,P.keys.push(kt)}),[].concat(i.string||[]).filter(Boolean).forEach(function(kt){P.strings[kt]=!0,P.keys.push(kt)}),[].concat(i.number||[]).filter(Boolean).forEach(function(kt){P.numbers[kt]=!0,P.keys.push(kt)}),[].concat(i.count||[]).filter(Boolean).forEach(function(kt){P.counts[kt]=!0,P.keys.push(kt)}),[].concat(i.normalize||[]).filter(Boolean).forEach(function(kt){P.normalize[kt]=!0,P.keys.push(kt)}),typeof i.narg=="object"&&Object.entries(i.narg).forEach(([kt,Tt])=>{typeof Tt=="number"&&(P.nargs[kt]=Tt,P.keys.push(kt))}),typeof i.coerce=="object"&&Object.entries(i.coerce).forEach(([kt,Tt])=>{typeof Tt=="function"&&(P.coercions[kt]=Tt,P.keys.push(kt))}),typeof i.config<"u"&&(Array.isArray(i.config)||typeof i.config=="string"?[].concat(i.config).filter(Boolean).forEach(function(kt){P.configs[kt]=!0}):typeof i.config=="object"&&Object.entries(i.config).forEach(([kt,Tt])=>{(typeof Tt=="boolean"||typeof Tt=="function")&&(P.configs[kt]=Tt)})),Pe(i.key,u,i.default,P.arrays),Object.keys(d).forEach(function(kt){(P.aliases[kt]||[]).forEach(function(Tt){d[Tt]=d[kt]})});let q=null;Bn();let D=[],C=Object.assign(Object.create(null),{_:[]}),z={};for(let kt=0;kt<n.length;kt++){let Tt=n[kt],cr=Tt.replace(/^-{3,}/,"---"),er,Rt,qi,Tr,ti,an;if(Tt!=="--"&&/^-/.test(Tt)&&bt(Tt))$(Tt);else if(cr.match(/^---+(=|$)/)){$(Tt);continue}else if(Tt.match(/^--.+=/)||!l["short-option-groups"]&&Tt.match(/^-.+=/))Tr=Tt.match(/^--?([^=]+)=([\s\S]*)$/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=3&&(Ot(Tr[1],P.arrays)?kt=L(kt,Tr[1],n,Tr[2]):Ot(Tr[1],P.nargs)!==!1?kt=x(kt,Tr[1],n,Tr[2]):V(Tr[1],Tr[2],!0));else if(Tt.match(A)&&l["boolean-negation"])Tr=Tt.match(A),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],V(Rt,Ot(Rt,P.arrays)?[!1]:!1));else if(Tt.match(/^--.+/)||!l["short-option-groups"]&&Tt.match(/^-[^-]+/))Tr=Tt.match(/^--?(.+)/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],Ot(Rt,P.arrays)?kt=L(kt,Rt,n):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n):(ti=n[kt+1],ti!==void 0&&(!ti.match(/^-/)||ti.match(E))&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)||/^(true|false)$/.test(ti)?(V(Rt,ti),kt++):V(Rt,sr(Rt))));else if(Tt.match(/^-.\..+=/))Tr=Tt.match(/^-([^=]+)=([\s\S]*)$/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=3&&V(Tr[1],Tr[2]);else if(Tt.match(/^-.\..+/)&&!Tt.match(E))ti=n[kt+1],Tr=Tt.match(/^-(.\..+)/),Tr!==null&&Array.isArray(Tr)&&Tr.length>=2&&(Rt=Tr[1],ti!==void 0&&!ti.match(/^-/)&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)?(V(Rt,ti),kt++):V(Rt,sr(Rt)));else if(Tt.match(/^-[^-]+/)&&!Tt.match(E)){qi=Tt.slice(1,-1).split(""),er=!1;for(let ja=0;ja<qi.length;ja++){if(ti=Tt.slice(ja+2),qi[ja+1]&&qi[ja+1]==="="){an=Tt.slice(ja+3),Rt=qi[ja],Ot(Rt,P.arrays)?kt=L(kt,Rt,n,an):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n,an):V(Rt,an),er=!0;break}if(ti==="-"){V(qi[ja],ti);continue}if(/[A-Za-z]/.test(qi[ja])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(ti)&&Ot(ti,P.bools)===!1){V(qi[ja],ti),er=!0;break}if(qi[ja+1]&&qi[ja+1].match(/\W/)){V(qi[ja],ti),er=!0;break}else V(qi[ja],sr(qi[ja]))}Rt=Tt.slice(-1)[0],!er&&Rt!=="-"&&(Ot(Rt,P.arrays)?kt=L(kt,Rt,n):Ot(Rt,P.nargs)!==!1?kt=x(kt,Rt,n):(ti=n[kt+1],ti!==void 0&&(!/^(-|--)[^-]/.test(ti)||ti.match(E))&&!Ot(Rt,P.bools)&&!Ot(Rt,P.counts)||/^(true|false)$/.test(ti)?(V(Rt,ti),kt++):V(Rt,sr(Rt))))}else if(Tt.match(/^-[0-9]$/)&&Tt.match(E)&&Ot(Tt.slice(1),P.bools))Rt=Tt.slice(1),V(Rt,sr(Rt));else if(Tt==="--"){D=n.slice(kt+1);break}else if(l["halt-at-non-option"]){D=n.slice(kt);break}else $(Tt)}Se(C,!0),Se(C,!1),le(C),_e(),Ee(C,P.aliases,d,!0),Qe(C),l["set-placeholder-key"]&&St(C),Object.keys(P.counts).forEach(function(kt){Te(C,kt.split("."))||V(kt,0)}),c&&D.length&&(C[b]=[]),D.forEach(function(kt){C[b].push(kt)}),l["camel-case-expansion"]&&l["strip-dashed"]&&Object.keys(C).filter(kt=>kt!=="--"&&kt.includes("-")).forEach(kt=>{delete C[kt]}),l["strip-aliased"]&&[].concat(...Object.keys(u).map(kt=>u[kt])).forEach(kt=>{l["camel-case-expansion"]&&kt.includes("-")&&delete C[kt.split(".").map(Tt=>Jia(Tt)).join(".")],delete C[kt]});function $(kt){let Tt=X("_",kt);(typeof Tt=="string"||typeof Tt=="number")&&C._.push(Tt)}function x(kt,Tt,cr,er){let Rt,qi=Ot(Tt,P.nargs);if(qi=typeof qi!="number"||isNaN(qi)?1:qi,qi===0)return mn(er)||(q=Error(m("Argument unexpected for: %s",Tt))),V(Tt,sr(Tt)),kt;let Tr=mn(er)?0:1;if(l["nargs-eats-options"])cr.length-(kt+1)+Tr<qi&&(q=Error(m("Not enough arguments following: %s",Tt))),Tr=qi;else{for(Rt=kt+1;Rt<cr.length&&(!cr[Rt].match(/^-[^0-9]/)||cr[Rt].match(E)||bt(cr[Rt]));Rt++)Tr++;Tr<qi&&(q=Error(m("Not enough arguments following: %s",Tt)))}let ti=Math.min(Tr,qi);for(!mn(er)&&ti>0&&(V(Tt,er),ti--),Rt=kt+1;Rt<ti+kt+1;Rt++)V(Tt,cr[Rt]);return kt+ti}function L(kt,Tt,cr,er){let Rt=[],qi=er||cr[kt+1],Tr=Ot(Tt,P.nargs);if(Ot(Tt,P.bools)&&!/^(true|false)$/.test(qi))Rt.push(!0);else if(mn(qi)||mn(er)&&/^-/.test(qi)&&!E.test(qi)&&!bt(qi)){if(d[Tt]!==void 0){let ti=d[Tt];Rt=Array.isArray(ti)?ti:[ti]}}else{mn(er)||Rt.push(K(Tt,er,!0));for(let ti=kt+1;ti<cr.length&&!(!l["greedy-arrays"]&&Rt.length>0||Tr&&typeof Tr=="number"&&Rt.length>=Tr||(qi=cr[ti],/^-/.test(qi)&&!E.test(qi)&&!bt(qi)));ti++)kt=ti,Rt.push(K(Tt,qi,a))}return typeof Tr=="number"&&(Tr&&Rt.length<Tr||isNaN(Tr)&&Rt.length===0)&&(q=Error(m("Not enough arguments following: %s",Tt))),V(Tt,Rt),kt}function V(kt,Tt,cr=a){if(/-/.test(kt)&&l["camel-case-expansion"]){let qi=kt.split(".").map(function(Tr){return Jia(Tr)}).join(".");Z(kt,qi)}let er=K(kt,Tt,cr),Rt=kt.split(".");xt(C,Rt,er),P.aliases[kt]&&P.aliases[kt].forEach(function(qi){let Tr=qi.split(".");xt(C,Tr,er)}),Rt.length>1&&l["dot-notation"]&&(P.aliases[Rt[0]]||[]).forEach(function(qi){let Tr=qi.split("."),ti=[].concat(Rt);ti.shift(),Tr=Tr.concat(ti),(P.aliases[kt]||[]).includes(Tr.join("."))||xt(C,Tr,er)}),Ot(kt,P.normalize)&&!Ot(kt,P.arrays)&&[kt].concat(P.aliases[kt]||[]).forEach(function(Tr){Object.defineProperty(z,Tr,{enumerable:!0,get(){return Tt},set(ti){Tt=typeof ti=="string"?KGr.normalize(ti):ti}})})}function Z(kt,Tt){P.aliases[kt]&&P.aliases[kt].length||(P.aliases[kt]=[Tt],g[Tt]=!0),P.aliases[Tt]&&P.aliases[Tt].length||Z(Tt,kt)}function K(kt,Tt,cr){cr&&(Tt=er1(Tt)),(Ot(kt,P.bools)||Ot(kt,P.counts))&&typeof Tt=="string"&&(Tt=Tt==="true");let er=Array.isArray(Tt)?Tt.map(function(Rt){return X(kt,Rt)}):X(kt,Tt);return Ot(kt,P.counts)&&(mn(er)||typeof er=="boolean")&&(er=Eps()),Ot(kt,P.normalize)&&Ot(kt,P.arrays)&&(Array.isArray(Tt)?er=Tt.map(Rt=>KGr.normalize(Rt)):er=KGr.normalize(Tt)),er}function X(kt,Tt){return!l["parse-positional-numbers"]&&kt==="_"||!Ot(kt,P.strings)&&!Ot(kt,P.bools)&&!Array.isArray(Tt)&&(K4f(Tt)&&l["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${Tt}`)))||!mn(Tt)&&Ot(kt,P.numbers))&&(Tt=Number(Tt)),Tt}function le(kt){let Tt=Object.create(null);Ee(Tt,P.aliases,d),Object.keys(P.configs).forEach(function(cr){let er=kt[cr]||Tt[cr];if(er)try{let Rt=null,qi=KGr.resolve(KGr.cwd(),er),Tr=P.configs[cr];if(typeof Tr=="function"){try{Rt=Tr(qi)}catch(ti){Rt=ti}if(Rt instanceof Error){q=Rt;return}}else Rt=KGr.require(qi);ge(Rt)}catch(Rt){Rt.name==="PermissionDenied"?q=Rt:kt[cr]&&(q=Error(m("Invalid JSON config file: %s",er)))}})}function ge(kt,Tt){Object.keys(kt).forEach(function(cr){let er=kt[cr],Rt=Tt?Tt+"."+cr:cr;typeof er=="object"&&er!==null&&!Array.isArray(er)&&l["dot-notation"]?ge(er,Rt):(!Te(C,Rt.split("."))||Ot(Rt,P.arrays)&&l["combine-arrays"])&&V(Rt,er)})}function _e(){typeof s<"u"&&s.forEach(function(kt){ge(kt)})}function Se(kt,Tt){if(typeof o>"u")return;let cr=typeof o=="string"?o:"",er=KGr.env();Object.keys(er).forEach(function(Rt){if(cr===""||Rt.lastIndexOf(cr,0)===0){let qi=Rt.split("__").map(function(Tr,ti){return ti===0&&(Tr=Tr.substring(cr.length)),Jia(Tr)});(Tt&&P.configs[qi.join(".")]||!Tt)&&!Te(kt,qi)&&V(qi.join("."),er[Rt])}})}function Qe(kt){let Tt,cr=new Set;Object.keys(kt).forEach(function(er){if(!cr.has(er)&&(Tt=Ot(er,P.coercions),typeof Tt=="function"))try{let Rt=X(er,Tt(kt[er]));[].concat(P.aliases[er]||[],er).forEach(qi=>{cr.add(qi),kt[qi]=Rt})}catch(Rt){q=Rt}})}function St(kt){return P.keys.forEach(Tt=>{~Tt.indexOf(".")||typeof kt[Tt]>"u"&&(kt[Tt]=void 0)}),kt}function Ee(kt,Tt,cr,er=!1){Object.keys(cr).forEach(function(Rt){Te(kt,Rt.split("."))||(xt(kt,Rt.split("."),cr[Rt]),er&&(O[Rt]=!0),(Tt[Rt]||[]).forEach(function(qi){Te(kt,qi.split("."))||xt(kt,qi.split("."),cr[Rt])}))})}function Te(kt,Tt){let cr=kt;l["dot-notation"]||(Tt=[Tt.join(".")]),Tt.slice(0,-1).forEach(function(Rt){cr=cr[Rt]||{}});let er=Tt[Tt.length-1];return typeof cr!="object"?!1:er in cr}function xt(kt,Tt,cr){let er=kt;l["dot-notation"]||(Tt=[Tt.join(".")]),Tt.slice(0,-1).forEach(function(an){an=$4f(an),typeof er=="object"&&er[an]===void 0&&(er[an]={}),typeof er[an]!="object"||Array.isArray(er[an])?(Array.isArray(er[an])?er[an].push({}):er[an]=[er[an],{}],er=er[an][er[an].length-1]):er=er[an]});let Rt=$4f(Tt[Tt.length-1]),qi=Ot(Tt.join("."),P.arrays),Tr=Array.isArray(cr),ti=l["duplicate-arguments-array"];!ti&&Ot(Rt,P.nargs)&&(ti=!0,(!mn(er[Rt])&&P.nargs[Rt]===1||Array.isArray(er[Rt])&&er[Rt].length===P.nargs[Rt])&&(er[Rt]=void 0)),cr===Eps()?er[Rt]=Eps(er[Rt]):Array.isArray(er[Rt])?ti&&qi&&Tr?er[Rt]=l["flatten-duplicate-arrays"]?er[Rt].concat(cr):(Array.isArray(er[Rt][0])?er[Rt]:[er[Rt]]).concat([cr]):!ti&&!!qi==!!Tr?er[Rt]=cr:er[Rt]=er[Rt].concat([cr]):er[Rt]===void 0&&qi?er[Rt]=Tr?cr:[cr]:ti&&!(er[Rt]===void 0||Ot(Rt,P.counts)||Ot(Rt,P.bools))?er[Rt]=[er[Rt],cr]:er[Rt]=cr}function Pe(...kt){kt.forEach(function(Tt){Object.keys(Tt||{}).forEach(function(cr){P.aliases[cr]||(P.aliases[cr]=[].concat(u[cr]||[]),P.aliases[cr].concat(cr).forEach(function(er){if(/-/.test(er)&&l["camel-case-expansion"]){let Rt=Jia(er);Rt!==cr&&P.aliases[cr].indexOf(Rt)===-1&&(P.aliases[cr].push(Rt),g[Rt]=!0)}}),P.aliases[cr].concat(cr).forEach(function(er){if(er.length>1&&/[A-Z]/.test(er)&&l["camel-case-expansion"]){let Rt=J4f(er,"-");Rt!==cr&&P.aliases[cr].indexOf(Rt)===-1&&(P.aliases[cr].push(Rt),g[Rt]=!0)}}),P.aliases[cr].forEach(function(er){P.aliases[er]=[cr].concat(P.aliases[cr].filter(function(Rt){return er!==Rt}))}))})})}function Ot(kt,Tt){let cr=[].concat(P.aliases[kt]||[],kt),er=Object.keys(Tt),Rt=cr.find(qi=>er.includes(qi));return Rt?Tt[Rt]:!1}function at(kt){let Tt=Object.keys(P);return[].concat(Tt.map(er=>P[er])).some(function(er){return Array.isArray(er)?er.includes(kt):er[kt]})}function he(kt,...Tt){return[].concat(...Tt).some(function(er){let Rt=kt.match(er);return Rt&&at(Rt[1])})}function je(kt){if(kt.match(E)||!kt.match(/^-[^-]+/))return!1;let Tt=!0,cr,er=kt.slice(1).split("");for(let Rt=0;Rt<er.length;Rt++){if(cr=kt.slice(Rt+2),!at(er[Rt])){Tt=!1;break}if(er[Rt+1]&&er[Rt+1]==="="||cr==="-"||/[A-Za-z]/.test(er[Rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(cr)||er[Rt+1]&&er[Rt+1].match(/\W/))break}return Tt}function bt(kt){return l["unknown-options-as-args"]&&Dt(kt)}function Dt(kt){return kt=kt.replace(/^-{3,}/,"--"),kt.match(E)||je(kt)?!1:!he(kt,/^-+([^=]+?)=[\s\S]*$/,A,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function sr(kt){return!Ot(kt,P.bools)&&!Ot(kt,P.counts)&&`${kt}`in d?d[kt]:ur(ni(kt))}function ur(kt){return{[F4t.BOOLEAN]:!0,[F4t.STRING]:"",[F4t.NUMBER]:void 0,[F4t.ARRAY]:[]}[kt]}function ni(kt){let Tt=F4t.BOOLEAN;return Ot(kt,P.strings)?Tt=F4t.STRING:Ot(kt,P.numbers)?Tt=F4t.NUMBER:Ot(kt,P.bools)?Tt=F4t.BOOLEAN:Ot(kt,P.arrays)&&(Tt=F4t.ARRAY),Tt}function mn(kt){return kt===void 0}function Bn(){Object.keys(P.counts).find(kt=>Ot(kt,P.arrays)?(q=Error(m("Invalid configuration: %s, opts.count excludes opts.array.",kt)),!0):Ot(kt,P.nargs)?(q=Error(m("Invalid configuration: %s, opts.count excludes opts.narg.",kt)),!0):!1)}return{aliases:Object.assign({},P.aliases),argv:Object.assign(z,C),configuration:l,defaulted:Object.assign({},O),error:q,newAliases:Object.assign({},g)}}};function kt1(e){let t=[],r=Object.create(null),i=!0;for(Object.keys(e).forEach(function(n){t.push([].concat(e[n],n))});i;){i=!1;for(let n=0;n<t.length;n++)for(let a=n+1;a<t.length;a++)if(t[n].filter(function(l){return t[a].indexOf(l)!==-1}).length){t[n]=t[n].concat(t[a]),t.splice(a,1),i=!0;break}}return t.forEach(function(n){n=n.filter(function(u,l,d){return d.indexOf(u)===l});let a=n.pop();a!==void 0&&typeof a=="string"&&(r[a]=n)}),r}function Eps(e){return e!==void 0?e+1:1}function $4f(e){return e==="__proto__"?"___proto___":e}function er1(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}var Mps,Aps,qps,G4f=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Q4f=(Aps=(Mps=process==null?void 0:process.versions)===null||Mps===void 0?void 0:Mps.node)!==null&&Aps!==void 0?Aps:(qps=process==null?void 0:process.version)===null||qps===void 0?void 0:qps.slice(1);if(Q4f&&Number(Q4f.match(/^([^.]+)/)[1])<G4f)throw Error(`yargs parser supports a minimum Node.js version of ${G4f}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var tr1=process?process.env:{},Y4f=new Tps({cwd:process.cwd,env:()=>tr1,format:Yt1.format,normalize:H4f.normalize,resolve:H4f.resolve,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Xt1.readFileSync(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),Kia=function(t,r){return Y4f.parse(t.slice(),r).argv};Kia.detailed=function(e,t){return Y4f.parse(e.slice(),t)};Kia.camelCase=Jia;Kia.decamelize=J4f;Kia.looksLikeNumber=K4f;X4f.exports=Kia});var k4f=f((D$3,Z4f)=>{"use strict";Z4f.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var hui=f((E$3,e8f)=>{"use strict";var rr1=k4f();e8f.exports=e=>typeof e=="string"?e.replace(rr1(),""):e});var r8f=f((M$3,Cps)=>{"use strict";var t8f=e=>Number.isNaN(e)?!1:e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141);Cps.exports=t8f;Cps.exports.default=t8f});var n8f=f((A$3,i8f)=>{"use strict";i8f.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var yui=f((q$3,Bps)=>{"use strict";var ir1=hui(),nr1=r8f(),ar1=n8f(),a8f=e=>{if(typeof e!="string"||e.length===0||(e=ir1(e),e.length===0))return 0;e=e.replace(ar1()," ");let t=0;for(let r=0;r<e.length;r++){let i=e.codePointAt(r);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&r++,t+=nr1(i)?2:1)}return t};Bps.exports=a8f;Bps.exports.default=a8f});var u8f=f((T$3,o8f)=>{"use strict";o8f.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var xps=f((C$3,c8f)=>{"use strict";var Xia=u8f(),s8f={};for(let e of Object.keys(Xia))s8f[Xia[e]]=e;var by={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};c8f.exports=by;for(let e of Object.keys(by)){if(!("channels"in by[e]))throw new Error("missing channels property: "+e);if(!("labels"in by[e]))throw new Error("missing channel labels property: "+e);if(by[e].labels.length!==by[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=by[e];delete by[e].channels,delete by[e].labels,Object.defineProperty(by[e],"channels",{value:t}),Object.defineProperty(by[e],"labels",{value:r})}by.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.min(t,r,i),a=Math.max(t,r,i),u=a-n,l,d;a===n?l=0:t===a?l=(r-i)/u:r===a?l=2+(i-t)/u:i===a&&(l=4+(t-r)/u),l=Math.min(l*60,360),l<0&&(l+=360);let s=(n+a)/2;return a===n?d=0:s<=.5?d=u/(a+n):d=u/(2-a-n),[l,d*100,s*100]};by.rgb.hsv=function(e){let t,r,i,n,a,u=e[0]/255,l=e[1]/255,d=e[2]/255,s=Math.max(u,l,d),o=s-Math.min(u,l,d),c=function(b){return(s-b)/6/o+1/2};return o===0?(n=0,a=0):(a=o/s,t=c(u),r=c(l),i=c(d),u===s?n=i-r:l===s?n=1/3+t-i:d===s&&(n=2/3+r-t),n<0?n+=1:n>1&&(n-=1)),[n*360,a*100,s*100]};by.rgb.hwb=function(e){let t=e[0],r=e[1],i=e[2],n=by.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(r,i));return i=1-1/255*Math.max(t,Math.max(r,i)),[n,a*100,i*100]};by.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.min(1-t,1-r,1-i),a=(1-t-n)/(1-n)||0,u=(1-r-n)/(1-n)||0,l=(1-i-n)/(1-n)||0;return[a*100,u*100,l*100,n*100]};function or1(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}by.rgb.keyword=function(e){let t=s8f[e];if(t)return t;let r=1/0,i;for(let n of Object.keys(Xia)){let a=Xia[n],u=or1(e,a);u<r&&(r=u,i=n)}return i};by.keyword.rgb=function(e){return Xia[e]};by.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let n=t*.4124+r*.3576+i*.1805,a=t*.2126+r*.7152+i*.0722,u=t*.0193+r*.1192+i*.9505;return[n*100,a*100,u*100]};by.rgb.lab=function(e){let t=by.rgb.xyz(e),r=t[0],i=t[1],n=t[2];r/=95.047,i/=100,n/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let a=116*i-16,u=500*(r-i),l=200*(i-n);return[a,u,l]};by.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100,n,a,u;if(r===0)return u=i*255,[u,u,u];i<.5?n=i*(1+r):n=i+r-i*r;let l=2*i-n,d=[0,0,0];for(let s=0;s<3;s++)a=t+1/3*-(s-1),a<0&&a++,a>1&&a--,6*a<1?u=l+(n-l)*6*a:2*a<1?u=n:3*a<2?u=l+(n-l)*(2/3-a)*6:u=l,d[s]=u*255;return d};by.hsl.hsv=function(e){let t=e[0],r=e[1]/100,i=e[2]/100,n=r,a=Math.max(i,.01);i*=2,r*=i<=1?i:2-i,n*=a<=1?a:2-a;let u=(i+r)/2,l=i===0?2*n/(a+n):2*r/(i+r);return[t,l*100,u*100]};by.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,i=e[2]/100,n=Math.floor(t)%6,a=t-Math.floor(t),u=255*i*(1-r),l=255*i*(1-r*a),d=255*i*(1-r*(1-a));switch(i*=255,n){case 0:return[i,d,u];case 1:return[l,i,u];case 2:return[u,i,d];case 3:return[u,l,i];case 4:return[d,u,i];case 5:return[i,u,l]}};by.hsv.hsl=function(e){let t=e[0],r=e[1]/100,i=e[2]/100,n=Math.max(i,.01),a,u;u=(2-r)*i;let l=(2-r)*n;return a=r*n,a/=l<=1?l:2-l,a=a||0,u/=2,[t,a*100,u*100]};by.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100,n=r+i,a;n>1&&(r/=n,i/=n);let u=Math.floor(6*t),l=1-i;a=6*t-u,u&1&&(a=1-a);let d=r+a*(l-r),s,o,c;switch(u){default:case 6:case 0:s=l,o=d,c=r;break;case 1:s=d,o=l,c=r;break;case 2:s=r,o=l,c=d;break;case 3:s=r,o=d,c=l;break;case 4:s=d,o=r,c=l;break;case 5:s=l,o=r,c=d;break}return[s*255,o*255,c*255]};by.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,i=e[2]/100,n=e[3]/100,a=1-Math.min(1,t*(1-n)+n),u=1-Math.min(1,r*(1-n)+n),l=1-Math.min(1,i*(1-n)+n);return[a*255,u*255,l*255]};by.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,i=e[2]/100,n,a,u;return n=t*3.2406+r*-1.5372+i*-.4986,a=t*-.9689+r*1.8758+i*.0415,u=t*.0557+r*-.204+i*1.057,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,n=Math.min(Math.max(0,n),1),a=Math.min(Math.max(0,a),1),u=Math.min(Math.max(0,u),1),[n*255,a*255,u*255]};by.xyz.lab=function(e){let t=e[0],r=e[1],i=e[2];t/=95.047,r/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let n=116*r-16,a=500*(t-r),u=200*(r-i);return[n,a,u]};by.lab.xyz=function(e){let t=e[0],r=e[1],i=e[2],n,a,u;a=(t+16)/116,n=r/500+a,u=a-i/200;let l=a**3,d=n**3,s=u**3;return a=l>.008856?l:(a-16/116)/7.787,n=d>.008856?d:(n-16/116)/7.787,u=s>.008856?s:(u-16/116)/7.787,n*=95.047,a*=100,u*=108.883,[n,a,u]};by.lab.lch=function(e){let t=e[0],r=e[1],i=e[2],n;n=Math.atan2(i,r)*360/2/Math.PI,n<0&&(n+=360);let u=Math.sqrt(r*r+i*i);return[t,u,n]};by.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,a=r*Math.cos(n),u=r*Math.sin(n);return[t,a,u]};by.rgb.ansi16=function(e,t=null){let[r,i,n]=e,a=t===null?by.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let u=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(r/255));return a===2&&(u+=60),u};by.hsv.ansi16=function(e){return by.rgb.ansi16(by.hsv.rgb(e),e[2])};by.rgb.ansi256=function(e){let t=e[0],r=e[1],i=e[2];return t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5)};by.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(~~(e>50)+1)*.5,i=(t&1)*r*255,n=(t>>1&1)*r*255,a=(t>>2&1)*r*255;return[i,n,a]};by.ansi256.rgb=function(e){if(e>=232){let a=(e-232)*10+8;return[a,a,a]}e-=16;let t,r=Math.floor(e/36)/5*255,i=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,i,n]};by.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};by.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=r.split("").map(l=>l+l).join(""));let i=parseInt(r,16),n=i>>16&255,a=i>>8&255,u=i&255;return[n,a,u]};by.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,i=e[2]/255,n=Math.max(Math.max(t,r),i),a=Math.min(Math.min(t,r),i),u=n-a,l,d;return u<1?l=a/(1-u):l=0,u<=0?d=0:n===t?d=(r-i)/u%6:n===r?d=2+(i-t)/u:d=4+(t-r)/u,d/=6,d%=1,[d*360,u*100,l*100]};by.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,i=r<.5?2*t*r:2*t*(1-r),n=0;return i<1&&(n=(r-.5*i)/(1-i)),[e[0],i*100,n*100]};by.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,i=t*r,n=0;return i<1&&(n=(r-i)/(1-i)),[e[0],i*100,n*100]};by.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,i=e[2]/100;if(r===0)return[i*255,i*255,i*255];let n=[0,0,0],a=t%1*6,u=a%1,l=1-u,d=0;switch(Math.floor(a)){case 0:n[0]=1,n[1]=u,n[2]=0;break;case 1:n[0]=l,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=u;break;case 3:n[0]=0,n[1]=l,n[2]=1;break;case 4:n[0]=u,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=l}return d=(1-r)*i,[(r*n[0]+d)*255,(r*n[1]+d)*255,(r*n[2]+d)*255]};by.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,i=t+r*(1-t),n=0;return i>0&&(n=t/i),[e[0],n*100,i*100]};by.hcg.hsl=function(e){let t=e[1]/100,i=e[2]/100*(1-t)+.5*t,n=0;return i>0&&i<.5?n=t/(2*i):i>=.5&&i<1&&(n=t/(2*(1-i))),[e[0],n*100,i*100]};by.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,i=t+r*(1-t);return[e[0],(i-t)*100,(1-i)*100]};by.hwb.hcg=function(e){let t=e[1]/100,i=1-e[2]/100,n=i-t,a=0;return n<1&&(a=(i-n)/(1-n)),[e[0],n*100,a*100]};by.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};by.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};by.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};by.gray.hsl=function(e){return[0,0,e[0]]};by.gray.hsv=by.gray.hsl;by.gray.hwb=function(e){return[0,100,e[0]]};by.gray.cmyk=function(e){return[0,0,0,e[0]]};by.gray.lab=function(e){return[e[0],0,0]};by.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(i.length)+i};by.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var f8f=f((B$3,l8f)=>{"use strict";var kYa=xps();function ur1(){let e={},t=Object.keys(kYa);for(let r=t.length,i=0;i<r;i++)e[t[i]]={distance:-1,parent:null};return e}function sr1(e){let t=ur1(),r=[e];for(t[e].distance=0;r.length;){let i=r.pop(),n=Object.keys(kYa[i]);for(let a=n.length,u=0;u<a;u++){let l=n[u],d=t[l];d.distance===-1&&(d.distance=t[i].distance+1,d.parent=i,r.unshift(l))}}return t}function cr1(e,t){return function(r){return t(e(r))}}function lr1(e,t){let r=[t[e].parent,e],i=kYa[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),i=cr1(kYa[t[n].parent][n],i),n=t[n].parent;return i.conversion=r,i}l8f.exports=function(e){let t=sr1(e),r={},i=Object.keys(t);for(let n=i.length,a=0;a<n;a++){let u=i[a];t[u].parent!==null&&(r[u]=lr1(u,t))}return r}});var p8f=f((x$3,d8f)=>{"use strict";var Ips=xps(),fr1=f8f(),qhn={},dr1=Object.keys(Ips);function pr1(e){let t=function(...r){let i=r[0];return i==null?i:(i.length>1&&(r=i),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function _r1(e){let t=function(...r){let i=r[0];if(i==null)return i;i.length>1&&(r=i);let n=e(r);if(typeof n=="object")for(let a=n.length,u=0;u<a;u++)n[u]=Math.round(n[u]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}dr1.forEach(e=>{qhn[e]={},Object.defineProperty(qhn[e],"channels",{value:Ips[e].channels}),Object.defineProperty(qhn[e],"labels",{value:Ips[e].labels});let t=fr1(e);Object.keys(t).forEach(i=>{let n=t[i];qhn[e][i]=_r1(n),qhn[e][i].raw=pr1(n)})});d8f.exports=qhn});var tXa=f((I$3,b8f)=>{"use strict";var _8f=(e,t)=>(...r)=>`\x1B[${e(...r)+t}m`,h8f=(e,t)=>(...r)=>{let i=e(...r);return`\x1B[${38+t};5;${i}m`},y8f=(e,t)=>(...r)=>{let i=e(...r);return`\x1B[${38+t};2;${i[0]};${i[1]};${i[2]}m`},eXa=e=>e,v8f=(e,t,r)=>[e,t,r],Thn=(e,t,r)=>{Object.defineProperty(e,t,{get:()=>{let i=r();return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0}),i},enumerable:!0,configurable:!0})},zps,Chn=(e,t,r,i)=>{zps===void 0&&(zps=p8f());let n=i?10:0,a={};for(let[u,l]of Object.entries(zps)){let d=u==="ansi16"?"ansi":u;u===t?a[d]=e(r,n):typeof l=="object"&&(a[d]=e(l[t],n))}return a};function hr1(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,i]of Object.entries(t)){for(let[n,a]of Object.entries(i))t[n]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},i[n]=t[n],e.set(a[0],a[1]);Object.defineProperty(t,r,{value:i,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",Thn(t.color,"ansi",()=>Chn(_8f,"ansi16",eXa,!1)),Thn(t.color,"ansi256",()=>Chn(h8f,"ansi256",eXa,!1)),Thn(t.color,"ansi16m",()=>Chn(y8f,"rgb",v8f,!1)),Thn(t.bgColor,"ansi",()=>Chn(_8f,"ansi16",eXa,!0)),Thn(t.bgColor,"ansi256",()=>Chn(h8f,"ansi256",eXa,!0)),Thn(t.bgColor,"ansi16m",()=>Chn(y8f,"rgb",v8f,!0)),t}Object.defineProperty(b8f,"exports",{enumerable:!0,get:hr1})});var w8f=f((z$3,j8f)=>{"use strict";var Zia=yui(),yr1=hui(),vr1=tXa(),rXa=new Set(["\x1B","\x9B"]),br1=39,Nps="\x07",m8f="[",gr1="]",P8f="m",Fps=`${gr1}8;;`,g8f=e=>`${rXa.values().next().value}${m8f}${e}${P8f}`,O8f=e=>`${rXa.values().next().value}${Fps}${e}${Nps}`,Or1=e=>e.split(" ").map(t=>Zia(t)),Rps=(e,t,r)=>{let i=[...t],n=!1,a=!1,u=Zia(yr1(e[e.length-1]));for(let[l,d]of i.entries()){let s=Zia(d);if(u+s<=r?e[e.length-1]+=d:(e.push(d),u=0),rXa.has(d)&&(n=!0,a=i.slice(l+1).join("").startsWith(Fps)),n){a?d===Nps&&(n=!1,a=!1):d===P8f&&(n=!1);continue}u+=s,u===r&&l<i.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},mr1=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(Zia(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Pr1=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a,u=Or1(e),l=[""];for(let[s,o]of e.split(" ").entries()){r.trim!==!1&&(l[l.length-1]=l[l.length-1].trimStart());let c=Zia(l[l.length-1]);if(s!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(l.push(""),c=0),(c>0||r.trim===!1)&&(l[l.length-1]+=" ",c++)),r.hard&&u[s]>t){let b=t-c,g=1+Math.floor((u[s]-b-1)/t);Math.floor((u[s]-1)/t)<g&&l.push(""),Rps(l,o,t);continue}if(c+u[s]>t&&c>0&&u[s]>0){if(r.wordWrap===!1&&c<t){Rps(l,o,t);continue}l.push("")}if(c+u[s]>t&&r.wordWrap===!1){Rps(l,o,t);continue}l[l.length-1]+=o}r.trim!==!1&&(l=l.map(mr1));let d=[...l.join(`
24
24
  `)];for(let[s,o]of d.entries()){if(i+=o,rXa.has(o)){let{groups:b}=new RegExp(`(?:\\${m8f}(?<code>\\d+)m|\\${Fps}(?<uri>.*)${Nps})`).exec(d.slice(s).join(""))||{groups:{}};if(b.code!==void 0){let g=Number.parseFloat(b.code);n=g===br1?void 0:g}else b.uri!==void 0&&(a=b.uri.length===0?void 0:b.uri)}let c=vr1.codes.get(Number(n));d[s+1]===`
25
25
  `?(a&&(i+=O8f("")),n&&c&&(i+=g8f(c))):o===`
26
26
  `&&(n&&c&&(i+=g8f(n)),a&&(i+=O8f(a)))}return i};j8f.exports=(e,t,r)=>String(e).normalize().replace(/\r\n/g,`
@@ -1701,7 +1701,7 @@ ${c.indent}`:""}${BQf(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
1701
1701
  `}),r.replaceAll(/\n$/g,"")}function o5S(e){return e?k_.green(P7.radioOn):P7.radioOff}var pmo=di(NSe(),1);function mup(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var Pca=class extends T2{_run(t){this.done=t;let r=fV(this.rl),i=r.line.pipe((0,pmo.map)(this.filterInput.bind(this))),n=this.handleSubmitEvents(i);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,pmo.takeUntil)(n.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),i="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(i=`
1702
1702
  `+k_.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?k_.cyan(mup(t,this.opt.mask)):k_.italic.dim("[hidden]"):this.opt.mask?mup(t,this.opt.mask):k_.italic.dim("[input is hidden] ")}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var $sp=di(Sxs(),1),Gsp=di(NSe(),1);var Cca=class extends T2{_run(t){this.done=t,this.editorResult=new Gsp.Subject;let r=fV(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"?k_.dim("Received"):k_.dim("Press <enter> to launch your preferred editor."),t&&(r=k_.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,$sp.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 Ecp=di(Pcp(),1);var Scp=di(require("readline"),1),Dcp=di(wcp(),1),JIi=class{constructor(t){this.rl||=Scp.default.createInterface(P9S(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 P9S(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 Dcp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var Ica=class extends JIi{constructor(t={}){super(t),this.log=(0,Ecp.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return _ca(this.rl,this.bottomBar.split(`
1703
1703
  `).length),this}updateBottomBar(t){return _ca(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+`
1704
- `}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&&cmo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Rcp=di(qcp(),1),Ncp=di(BCs(),1),Fcp=di(Icp(),1),YA=di(NSe(),1),Lcp=di(jsa(),1);var Nmo=di(NSe(),1),zcp=di(jsa(),1),Fmo=function(e,t,r){return typeof e[t]!="function"?(0,Nmo.of)(e):(0,Nmo.from)((0,zcp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var zca={isPlainObject:Rcp.default,set:Fcp.default,get:Ncp.default},$mn=class extends JIi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=zca.isPlainObject(r)?{...r}:{},zca.isPlainObject(t)&&(t=Object.values(t).every(n=>zca.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,YA.from)(t):t;return this.process=i.pipe((0,YA.concatMap)(this.processQuestion.bind(this)),(0,YA.publish)()),this.process.connect(),this.process.pipe((0,YA.reduce)((n,a)=>(zca.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,YA.defer)(()=>(0,YA.of)(t).pipe((0,YA.concatMap)(this.setDefaultType.bind(this)),(0,YA.concatMap)(this.filterIfRunnable.bind(this)),(0,YA.concatMap)(()=>Fmo(t,"message",this.answers)),(0,YA.concatMap)(()=>Fmo(t,"default",this.answers)),(0,YA.concatMap)(()=>Fmo(t,"choices",this.answers)),(0,YA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,YA.defer)(()=>(0,YA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,YA.defer)(()=>(0,YA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&zca.get(this.answers,t.name)!==void 0)return(0,YA.empty)();if(t.when===!1)return(0,YA.empty)();if(typeof t.when!="function")return(0,YA.of)(t);let{answers:r}=this;return(0,YA.defer)(()=>(0,YA.from)((0,Lcp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,YA.filter)(i=>i!=null)))}};function Ucp(e){let t=function(r,i){let n;try{n=new $mn(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",yca),this.registerPrompt("input",NIi),this.registerPrompt("number",vca),this.registerPrompt("confirm",bca),this.registerPrompt("rawlist",gca),this.registerPrompt("expand",Oca),this.registerPrompt("checkbox",mca),this.registerPrompt("password",Pca),this.registerPrompt("editor",Cca)},t.restoreDefaultPrompts(),t}var Ixs=Ucp();function L9S(e,t){Ixs.registerPrompt(e,t)}function U9S(){Ixs.restoreDefaultPrompts()}var V9S={prompt:Ixs,ui:{BottomBar:Ica,Prompt:$mn},createPromptModule:Ucp,registerPrompt:L9S,restoreDefaultPrompts:U9S,Separator:Die},Lmo=V9S;var Xlp=di(Vcp()),hVS="4.2.1",h5t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(h5t||(h5t={}));function yVS(e,t){if(!e)throw new Error(t)}function vVS(e){return e?.replace(/\/+$/,"")}async function bVS(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 gVS(){return new Date().getTime()}function Wlp(){return new Date().toISOString()}function Zlp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Qca=String.fromCharCode,Hlp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tPo={};function OVS(e,t){if(!tPo[e]){tPo[e]={};for(let r=0;r<e.length;r++)tPo[e][e.charAt(r)]=r}return tPo[e][t]}var Jca={compressToBase64:function(e){if(e==null)return"";let t=Jca._compress(e,6,function(r){return Hlp.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:Jca._decompress(e.length,32,function(t){return OVS(Hlp,e.charAt(t))})},compress:function(e){return Jca._compress(e,16,function(t){return Qca(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,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),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:Jca._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,P;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;P=Qca(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;P=Qca(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){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(P=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++]=Qca(b),P=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++]=Qca(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===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++)}}},gIs=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)}};var rPo="0123456789abcdef",iPo=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+=rPo.charAt(this.bytes[r]>>>4),t+=rPo.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+=rPo.charAt(this.bytes[r]>>>4),t+=rPo.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}},OIs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??mVS()}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 iPo.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,iPo.ofInner(t)}},mVS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),$lp,Glp=()=>PVS().toString(),PVS=()=>($lp||($lp=new OIs)).generate(),nPo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},Kca=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function Qlp(e){return typeof e=="object"&&(e instanceof nPo||e instanceof Kca)}var mIs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new gIs,this._isInitialized=!1,yVS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=vVS(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.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:Qlp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??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(h5t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(h5t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(h5t.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}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=Glp();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)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("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)})}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 getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={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.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}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={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Wlp(),uuid:i?.uuid?i.uuid:Glp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(h5t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(h5t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Zlp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(h5t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(h5t.Queue)||[];this.setPersistedProperty(h5t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:Wlp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${gVS()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(Jca.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof Kca||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await bVS(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new Kca(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new nPo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(h5t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!Qlp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},PIs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},jIs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!jIs){let e=Vlp();jIs=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 klp=jIs,jVS=1152921504606847e3,wVS=["is_not"],aPo=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},C2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},wIs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,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||klp,this.onError=l.onError,this.customHeaders=u,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=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof C2?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 this.featureFlags.map(async d=>{try{let s=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 C2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new C2("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 C2("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 this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}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(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof C2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new C2("Can't determine if feature flag is enabled or not with given properties");return!1}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=tfp(l,n,this.cohorts,this.debugMode):s=efp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Jlp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Jlp(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()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new aPo("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),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}catch(t){t instanceof aPo&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Zlp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Jlp(e,t,r=""){let i=(0,Xlp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/jVS}function efp(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 C2("Operator is_not_set is not supported")}else throw new C2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!wVS.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 Klp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return Klp(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=SVS(String(n));if(s==null&&(s=Ylp(n)),s==null)throw new C2(`Invalid date: ${n}`);let o=Ylp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new C2(`Unknown operator: ${a}`)}}function tfp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new C2("can't match cohort without a given cohort property value");let a=r[n];return rfp(a,t,r,i)}function rfp(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=rfp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof C2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new C2("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=tfp(l,t,r,i):d=efp(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 C2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new C2("can't match cohort without a given cohort property value");return n==="AND"}}function Klp(e){try{return new RegExp(e),!0}catch{return!1}}function Ylp(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 C2(`${e} is in an invalid date format`)}else throw new C2(`The date provided ${e} must be a string, number, or date object`)}function SVS(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 DVS=30*1e3,EVS=50*1e3,Zmn=class extends mIs{constructor(t,r={}){super(t,r),this._memoryStorage=new PIs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new wIs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:DVS,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||EVS}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):klp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return hVS}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}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;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},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 i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),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 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}}},SIs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};SIs.POSTHOG_ID_TAG="posthog_distinct_id";var oPo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Zmn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.57.3",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Yca=class{async sendEvent(){}async identify(){}async flush(){}};var kmn=require("fs/promises"),ofp=require("os"),ufp=require("path");var ifp=di(require("crypto")),sPo=new Uint8Array(256),uPo=sPo.length;function DIs(){return uPo>sPo.length-16&&(ifp.default.randomFillSync(sPo),uPo=0),sPo.slice(uPo,uPo+=16)}var _V=[];for(let e=0;e<256;++e)_V.push((e+256).toString(16).slice(1));function nfp(e,t=0){return _V[e[t+0]]+_V[e[t+1]]+_V[e[t+2]]+_V[e[t+3]]+"-"+_V[e[t+4]]+_V[e[t+5]]+"-"+_V[e[t+6]]+_V[e[t+7]]+"-"+_V[e[t+8]]+_V[e[t+9]]+"-"+_V[e[t+10]]+_V[e[t+11]]+_V[e[t+12]]+_V[e[t+13]]+_V[e[t+14]]+_V[e[t+15]]}var afp=di(require("crypto")),EIs={randomUUID:afp.default.randomUUID};function MVS(e,t,r){if(EIs.randomUUID&&!t&&!e)return EIs.randomUUID();e=e||{};let i=e.random||(e.rng||DIs)();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 nfp(i)}var Tie=MVS;var AVS="id",qVS=".fern",Xca=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new Zmn(r),this.userId=t==null?void 0:zEs(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.57.3",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=es(Wl.of((0,ofp.homedir)()),uo.of(qVS),uo.of(AVS));await Cf(t)||(await(0,kmn.mkdir)((0,ufp.dirname)(t),{recursive:!0}),await(0,kmn.writeFile)(t,Tie())),this.persistedDistinctId=(await(0,kmn.readFile)(t)).toString()}return this.persistedDistinctId}};var MIs;async function ePn(){return MIs==null&&(MIs=await TVS()),MIs}async function TVS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Yca;let r=await cyo();return r!=null?new Xca({token:r,posthogApiKey:e}):await syo()!=null?new oPo({posthogApiKey:e}):new Xca({token:void 0,posthogApiKey:e})}catch{return new Yca}}function Zca(e,t){return function(){return e.apply(t,arguments)}}var{toString:CVS}=Object.prototype,{getPrototypeOf:qIs}=Object,lPo=(e=>t=>{let r=CVS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),y5t=e=>(e=e.toLowerCase(),t=>lPo(t)===e),fPo=e=>t=>typeof t===e,{isArray:tPn}=Array,kca=fPo("undefined");function BVS(e){return e!==null&&!kca(e)&&e.constructor!==null&&!kca(e.constructor)&&LSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var cfp=y5t("ArrayBuffer");function xVS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&cfp(e.buffer),t}var IVS=fPo("string"),LSe=fPo("function"),lfp=fPo("number"),dPo=e=>e!==null&&typeof e=="object",zVS=e=>e===!0||e===!1,cPo=e=>{if(lPo(e)!=="object")return!1;let t=qIs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},RVS=y5t("Date"),NVS=y5t("File"),FVS=y5t("Blob"),LVS=y5t("FileList"),UVS=e=>dPo(e)&&LSe(e.pipe),VVS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||LSe(e.append)&&((t=lPo(e))==="formdata"||t==="object"&&LSe(e.toString)&&e.toString()==="[object FormData]"))},WVS=y5t("URLSearchParams"),[HVS,$VS,GVS,QVS]=["ReadableStream","Request","Response","Headers"].map(y5t),JVS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ela(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),tPn(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 ffp(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 kIi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dfp=e=>!kca(e)&&e!==kIi;function AIs(){let{caseless:e}=dfp(this)&&this||{},t={},r=(i,n)=>{let a=e&&ffp(t,n)||n;cPo(t[a])&&cPo(i)?t[a]=AIs(t[a],i):cPo(i)?t[a]=AIs({},i):tPn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&ela(arguments[i],r);return t}var KVS=(e,t,r,{allOwnKeys:i}={})=>(ela(t,(n,a)=>{r&&LSe(n)?e[a]=Zca(n,r):e[a]=n},{allOwnKeys:i}),e),YVS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),XVS=(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)},ZVS=(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&&qIs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kVS=(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},eWS=e=>{if(!e)return null;if(tPn(e))return e;let t=e.length;if(!lfp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},tWS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qIs(Uint8Array)),rWS=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},iWS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},nWS=y5t("HTMLFormElement"),aWS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),sfp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),oWS=y5t("RegExp"),pfp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ela(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},uWS=e=>{pfp(e,(t,r)=>{if(LSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(LSe(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+"'")})}})},sWS=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return tPn(e)?i(e):i(String(e).split(t)),r},cWS=()=>{},lWS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function fWS(e){return!!(e&&LSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var dWS=e=>{let t=new Array(10),r=(i,n)=>{if(dPo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=tPn(i)?[]:{};return ela(i,(u,l)=>{let d=r(u,n+1);!kca(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},pWS=y5t("AsyncFunction"),_WS=e=>e&&(dPo(e)||LSe(e))&&LSe(e.then)&&LSe(e.catch),_fp=((e,t)=>e?setImmediate:t?((r,i)=>(kIi.addEventListener("message",({source:n,data:a})=>{n===kIi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),kIi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",LSe(kIi.postMessage)),hWS=typeof queueMicrotask<"u"?queueMicrotask.bind(kIi):typeof process<"u"&&process.nextTick||_fp,ds={isArray:tPn,isArrayBuffer:cfp,isBuffer:BVS,isFormData:VVS,isArrayBufferView:xVS,isString:IVS,isNumber:lfp,isBoolean:zVS,isObject:dPo,isPlainObject:cPo,isReadableStream:HVS,isRequest:$VS,isResponse:GVS,isHeaders:QVS,isUndefined:kca,isDate:RVS,isFile:NVS,isBlob:FVS,isRegExp:oWS,isFunction:LSe,isStream:UVS,isURLSearchParams:WVS,isTypedArray:tWS,isFileList:LVS,forEach:ela,merge:AIs,extend:KVS,trim:JVS,stripBOM:YVS,inherits:XVS,toFlatObject:ZVS,kindOf:lPo,kindOfTest:y5t,endsWith:kVS,toArray:eWS,forEachEntry:rWS,matchAll:iWS,isHTMLForm:nWS,hasOwnProperty:sfp,hasOwnProp:sfp,reduceDescriptors:pfp,freezeMethods:uWS,toObjectSet:sWS,toCamelCase:aWS,noop:cWS,toFiniteNumber:lWS,findKey:ffp,global:kIi,isContextDefined:dfp,isSpecCompliantForm:fWS,toJSONObject:dWS,isAsyncFn:pWS,isThenable:_WS,setImmediate:_fp,asap:hWS};function rPn(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)}ds.inherits(rPn,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:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var hfp=rPn.prototype,yfp={};["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=>{yfp[e]={value:e}});Object.defineProperties(rPn,yfp);Object.defineProperty(hfp,"isAxiosError",{value:!0});rPn.from=(e,t,r,i,n,a)=>{let u=Object.create(hfp);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),rPn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var wp=rPn;var vfp=di(qia(),1),pPo=vfp.default;function TIs(e){return ds.isPlainObject(e)||ds.isArray(e)}function gfp(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function bfp(e,t,r){return e?e.concat(t).map(function(n,a){return n=gfp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function yWS(e){return ds.isArray(e)&&!e.some(TIs)}var vWS=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function bWS(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(pPo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ds.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new wp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&yWS(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=gfp(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?bfp([m],D,a):u===null?m:m+"[]",s(q))}),!1}return TIs(O)?!0:(t.append(bfp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(vWS,{defaultVisitor:o,convertValue:s,isVisitable:TIs});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var mfi=bWS;function Ofp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function mfp(e,t){this._pairs=[],e&&mfi(e,this,t)}var Pfp=mfp.prototype;Pfp.append=function(t,r){this._pairs.push([t,r])};Pfp.toString=function(t){let r=t?function(i){return t.call(this,i,Ofp)}:Ofp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var jfp=mfp;function gWS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ezi(e,t,r){if(!t)return e;let i=r&&r.encode||gWS;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new jfp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var CIs=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){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},BIs=CIs;var iPn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Efp=di(require("crypto"),1);var wfp=di(require("url"),1),Sfp=wfp.default.URLSearchParams;var xIs="abcdefghijklmnopqrstuvwxyz",Dfp="0123456789",Mfp={DIGIT:Dfp,ALPHA:xIs,ALPHA_DIGIT:xIs+xIs.toUpperCase()+Dfp},OWS=(e=16,t=Mfp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);Efp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},Afp={isNode:!0,classes:{URLSearchParams:Sfp,FormData:pPo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Mfp,generateString:OWS,protocols:["http","https","file","data"]};var RIs={};Eo(RIs,{hasBrowserEnv:()=>zIs,hasStandardBrowserEnv:()=>mWS,hasStandardBrowserWebWorkerEnv:()=>PWS,navigator:()=>IIs,origin:()=>jWS});var zIs=typeof window<"u"&&typeof document<"u",IIs=typeof navigator=="object"&&navigator||void 0,mWS=zIs&&(!IIs||["ReactNative","NativeScript","NS"].indexOf(IIs.product)<0),PWS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jWS=zIs&&window.location.href||"http://localhost";var SM={...RIs,...Afp};function NIs(e,t){return mfi(e,new SM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return SM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function wWS(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function SWS(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 DWS(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&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=SWS(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(wWS(i),n,r,0)}),r}return null}var _Po=DWS;function EWS(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var FIs={transitional:iPn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(_Po(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.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 NIs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return mfi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),EWS(t)):t}],transformResponse:[function(t){let r=this.transitional||FIs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.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"?wp.from(l,wp.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:SM.classes.FormData,Blob:SM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{FIs.headers[e]={}});var nPn=FIs;var MWS=ds.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"]),qfp=e=>{let t={},r,i,n;return e&&e.split(`
1704
+ `}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&&cmo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Rcp=di(qcp(),1),Ncp=di(BCs(),1),Fcp=di(Icp(),1),YA=di(NSe(),1),Lcp=di(jsa(),1);var Nmo=di(NSe(),1),zcp=di(jsa(),1),Fmo=function(e,t,r){return typeof e[t]!="function"?(0,Nmo.of)(e):(0,Nmo.from)((0,zcp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var zca={isPlainObject:Rcp.default,set:Fcp.default,get:Ncp.default},$mn=class extends JIi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=zca.isPlainObject(r)?{...r}:{},zca.isPlainObject(t)&&(t=Object.values(t).every(n=>zca.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,YA.from)(t):t;return this.process=i.pipe((0,YA.concatMap)(this.processQuestion.bind(this)),(0,YA.publish)()),this.process.connect(),this.process.pipe((0,YA.reduce)((n,a)=>(zca.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,YA.defer)(()=>(0,YA.of)(t).pipe((0,YA.concatMap)(this.setDefaultType.bind(this)),(0,YA.concatMap)(this.filterIfRunnable.bind(this)),(0,YA.concatMap)(()=>Fmo(t,"message",this.answers)),(0,YA.concatMap)(()=>Fmo(t,"default",this.answers)),(0,YA.concatMap)(()=>Fmo(t,"choices",this.answers)),(0,YA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,YA.defer)(()=>(0,YA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,YA.defer)(()=>(0,YA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&zca.get(this.answers,t.name)!==void 0)return(0,YA.empty)();if(t.when===!1)return(0,YA.empty)();if(typeof t.when!="function")return(0,YA.of)(t);let{answers:r}=this;return(0,YA.defer)(()=>(0,YA.from)((0,Lcp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,YA.filter)(i=>i!=null)))}};function Ucp(e){let t=function(r,i){let n;try{n=new $mn(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",yca),this.registerPrompt("input",NIi),this.registerPrompt("number",vca),this.registerPrompt("confirm",bca),this.registerPrompt("rawlist",gca),this.registerPrompt("expand",Oca),this.registerPrompt("checkbox",mca),this.registerPrompt("password",Pca),this.registerPrompt("editor",Cca)},t.restoreDefaultPrompts(),t}var Ixs=Ucp();function L9S(e,t){Ixs.registerPrompt(e,t)}function U9S(){Ixs.restoreDefaultPrompts()}var V9S={prompt:Ixs,ui:{BottomBar:Ica,Prompt:$mn},createPromptModule:Ucp,registerPrompt:L9S,restoreDefaultPrompts:U9S,Separator:Die},Lmo=V9S;var Xlp=di(Vcp()),hVS="4.2.1",h5t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(h5t||(h5t={}));function yVS(e,t){if(!e)throw new Error(t)}function vVS(e){return e?.replace(/\/+$/,"")}async function bVS(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 gVS(){return new Date().getTime()}function Wlp(){return new Date().toISOString()}function Zlp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Qca=String.fromCharCode,Hlp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tPo={};function OVS(e,t){if(!tPo[e]){tPo[e]={};for(let r=0;r<e.length;r++)tPo[e][e.charAt(r)]=r}return tPo[e][t]}var Jca={compressToBase64:function(e){if(e==null)return"";let t=Jca._compress(e,6,function(r){return Hlp.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:Jca._decompress(e.length,32,function(t){return OVS(Hlp,e.charAt(t))})},compress:function(e){return Jca._compress(e,16,function(t){return Qca(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,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),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:Jca._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,P;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;P=Qca(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;P=Qca(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){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(P=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++]=Qca(b),P=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++]=Qca(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===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++)}}},gIs=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)}};var rPo="0123456789abcdef",iPo=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+=rPo.charAt(this.bytes[r]>>>4),t+=rPo.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+=rPo.charAt(this.bytes[r]>>>4),t+=rPo.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}},OIs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??mVS()}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 iPo.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,iPo.ofInner(t)}},mVS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),$lp,Glp=()=>PVS().toString(),PVS=()=>($lp||($lp=new OIs)).generate(),nPo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},Kca=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function Qlp(e){return typeof e=="object"&&(e instanceof nPo||e instanceof Kca)}var mIs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new gIs,this._isInitialized=!1,yVS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=vVS(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.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:Qlp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??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(h5t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(h5t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(h5t.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}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=Glp();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)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("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)})}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 getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={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.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}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={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Wlp(),uuid:i?.uuid?i.uuid:Glp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(h5t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(h5t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Zlp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(h5t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(h5t.Queue)||[];this.setPersistedProperty(h5t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:Wlp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${gVS()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(Jca.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof Kca||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await bVS(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new Kca(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new nPo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(h5t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!Qlp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},PIs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},jIs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!jIs){let e=Vlp();jIs=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 klp=jIs,jVS=1152921504606847e3,wVS=["is_not"],aPo=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},C2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},wIs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,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||klp,this.onError=l.onError,this.customHeaders=u,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=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof C2?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 this.featureFlags.map(async d=>{try{let s=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 C2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new C2("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 C2("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 this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}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(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof C2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new C2("Can't determine if feature flag is enabled or not with given properties");return!1}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=tfp(l,n,this.cohorts,this.debugMode):s=efp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Jlp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Jlp(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()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new aPo("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),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}catch(t){t instanceof aPo&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Zlp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Jlp(e,t,r=""){let i=(0,Xlp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/jVS}function efp(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 C2("Operator is_not_set is not supported")}else throw new C2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!wVS.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 Klp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return Klp(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=SVS(String(n));if(s==null&&(s=Ylp(n)),s==null)throw new C2(`Invalid date: ${n}`);let o=Ylp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new C2(`Unknown operator: ${a}`)}}function tfp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new C2("can't match cohort without a given cohort property value");let a=r[n];return rfp(a,t,r,i)}function rfp(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=rfp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof C2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new C2("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=tfp(l,t,r,i):d=efp(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 C2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new C2("can't match cohort without a given cohort property value");return n==="AND"}}function Klp(e){try{return new RegExp(e),!0}catch{return!1}}function Ylp(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 C2(`${e} is in an invalid date format`)}else throw new C2(`The date provided ${e} must be a string, number, or date object`)}function SVS(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 DVS=30*1e3,EVS=50*1e3,Zmn=class extends mIs{constructor(t,r={}){super(t,r),this._memoryStorage=new PIs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new wIs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:DVS,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||EVS}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):klp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return hVS}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}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;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},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 i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),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 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}}},SIs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};SIs.POSTHOG_ID_TAG="posthog_distinct_id";var oPo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Zmn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.57.4",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Yca=class{async sendEvent(){}async identify(){}async flush(){}};var kmn=require("fs/promises"),ofp=require("os"),ufp=require("path");var ifp=di(require("crypto")),sPo=new Uint8Array(256),uPo=sPo.length;function DIs(){return uPo>sPo.length-16&&(ifp.default.randomFillSync(sPo),uPo=0),sPo.slice(uPo,uPo+=16)}var _V=[];for(let e=0;e<256;++e)_V.push((e+256).toString(16).slice(1));function nfp(e,t=0){return _V[e[t+0]]+_V[e[t+1]]+_V[e[t+2]]+_V[e[t+3]]+"-"+_V[e[t+4]]+_V[e[t+5]]+"-"+_V[e[t+6]]+_V[e[t+7]]+"-"+_V[e[t+8]]+_V[e[t+9]]+"-"+_V[e[t+10]]+_V[e[t+11]]+_V[e[t+12]]+_V[e[t+13]]+_V[e[t+14]]+_V[e[t+15]]}var afp=di(require("crypto")),EIs={randomUUID:afp.default.randomUUID};function MVS(e,t,r){if(EIs.randomUUID&&!t&&!e)return EIs.randomUUID();e=e||{};let i=e.random||(e.rng||DIs)();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 nfp(i)}var Tie=MVS;var AVS="id",qVS=".fern",Xca=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new Zmn(r),this.userId=t==null?void 0:zEs(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.57.4",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=es(Wl.of((0,ofp.homedir)()),uo.of(qVS),uo.of(AVS));await Cf(t)||(await(0,kmn.mkdir)((0,ufp.dirname)(t),{recursive:!0}),await(0,kmn.writeFile)(t,Tie())),this.persistedDistinctId=(await(0,kmn.readFile)(t)).toString()}return this.persistedDistinctId}};var MIs;async function ePn(){return MIs==null&&(MIs=await TVS()),MIs}async function TVS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Yca;let r=await cyo();return r!=null?new Xca({token:r,posthogApiKey:e}):await syo()!=null?new oPo({posthogApiKey:e}):new Xca({token:void 0,posthogApiKey:e})}catch{return new Yca}}function Zca(e,t){return function(){return e.apply(t,arguments)}}var{toString:CVS}=Object.prototype,{getPrototypeOf:qIs}=Object,lPo=(e=>t=>{let r=CVS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),y5t=e=>(e=e.toLowerCase(),t=>lPo(t)===e),fPo=e=>t=>typeof t===e,{isArray:tPn}=Array,kca=fPo("undefined");function BVS(e){return e!==null&&!kca(e)&&e.constructor!==null&&!kca(e.constructor)&&LSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var cfp=y5t("ArrayBuffer");function xVS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&cfp(e.buffer),t}var IVS=fPo("string"),LSe=fPo("function"),lfp=fPo("number"),dPo=e=>e!==null&&typeof e=="object",zVS=e=>e===!0||e===!1,cPo=e=>{if(lPo(e)!=="object")return!1;let t=qIs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},RVS=y5t("Date"),NVS=y5t("File"),FVS=y5t("Blob"),LVS=y5t("FileList"),UVS=e=>dPo(e)&&LSe(e.pipe),VVS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||LSe(e.append)&&((t=lPo(e))==="formdata"||t==="object"&&LSe(e.toString)&&e.toString()==="[object FormData]"))},WVS=y5t("URLSearchParams"),[HVS,$VS,GVS,QVS]=["ReadableStream","Request","Response","Headers"].map(y5t),JVS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ela(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),tPn(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 ffp(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 kIi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dfp=e=>!kca(e)&&e!==kIi;function AIs(){let{caseless:e}=dfp(this)&&this||{},t={},r=(i,n)=>{let a=e&&ffp(t,n)||n;cPo(t[a])&&cPo(i)?t[a]=AIs(t[a],i):cPo(i)?t[a]=AIs({},i):tPn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&ela(arguments[i],r);return t}var KVS=(e,t,r,{allOwnKeys:i}={})=>(ela(t,(n,a)=>{r&&LSe(n)?e[a]=Zca(n,r):e[a]=n},{allOwnKeys:i}),e),YVS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),XVS=(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)},ZVS=(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&&qIs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kVS=(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},eWS=e=>{if(!e)return null;if(tPn(e))return e;let t=e.length;if(!lfp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},tWS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qIs(Uint8Array)),rWS=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},iWS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},nWS=y5t("HTMLFormElement"),aWS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),sfp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),oWS=y5t("RegExp"),pfp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ela(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},uWS=e=>{pfp(e,(t,r)=>{if(LSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(LSe(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+"'")})}})},sWS=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return tPn(e)?i(e):i(String(e).split(t)),r},cWS=()=>{},lWS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function fWS(e){return!!(e&&LSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var dWS=e=>{let t=new Array(10),r=(i,n)=>{if(dPo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=tPn(i)?[]:{};return ela(i,(u,l)=>{let d=r(u,n+1);!kca(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},pWS=y5t("AsyncFunction"),_WS=e=>e&&(dPo(e)||LSe(e))&&LSe(e.then)&&LSe(e.catch),_fp=((e,t)=>e?setImmediate:t?((r,i)=>(kIi.addEventListener("message",({source:n,data:a})=>{n===kIi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),kIi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",LSe(kIi.postMessage)),hWS=typeof queueMicrotask<"u"?queueMicrotask.bind(kIi):typeof process<"u"&&process.nextTick||_fp,ds={isArray:tPn,isArrayBuffer:cfp,isBuffer:BVS,isFormData:VVS,isArrayBufferView:xVS,isString:IVS,isNumber:lfp,isBoolean:zVS,isObject:dPo,isPlainObject:cPo,isReadableStream:HVS,isRequest:$VS,isResponse:GVS,isHeaders:QVS,isUndefined:kca,isDate:RVS,isFile:NVS,isBlob:FVS,isRegExp:oWS,isFunction:LSe,isStream:UVS,isURLSearchParams:WVS,isTypedArray:tWS,isFileList:LVS,forEach:ela,merge:AIs,extend:KVS,trim:JVS,stripBOM:YVS,inherits:XVS,toFlatObject:ZVS,kindOf:lPo,kindOfTest:y5t,endsWith:kVS,toArray:eWS,forEachEntry:rWS,matchAll:iWS,isHTMLForm:nWS,hasOwnProperty:sfp,hasOwnProp:sfp,reduceDescriptors:pfp,freezeMethods:uWS,toObjectSet:sWS,toCamelCase:aWS,noop:cWS,toFiniteNumber:lWS,findKey:ffp,global:kIi,isContextDefined:dfp,isSpecCompliantForm:fWS,toJSONObject:dWS,isAsyncFn:pWS,isThenable:_WS,setImmediate:_fp,asap:hWS};function rPn(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)}ds.inherits(rPn,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:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var hfp=rPn.prototype,yfp={};["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=>{yfp[e]={value:e}});Object.defineProperties(rPn,yfp);Object.defineProperty(hfp,"isAxiosError",{value:!0});rPn.from=(e,t,r,i,n,a)=>{let u=Object.create(hfp);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),rPn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var wp=rPn;var vfp=di(qia(),1),pPo=vfp.default;function TIs(e){return ds.isPlainObject(e)||ds.isArray(e)}function gfp(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function bfp(e,t,r){return e?e.concat(t).map(function(n,a){return n=gfp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function yWS(e){return ds.isArray(e)&&!e.some(TIs)}var vWS=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function bWS(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(pPo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ds.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new wp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&yWS(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=gfp(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?bfp([m],D,a):u===null?m:m+"[]",s(q))}),!1}return TIs(O)?!0:(t.append(bfp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(vWS,{defaultVisitor:o,convertValue:s,isVisitable:TIs});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var mfi=bWS;function Ofp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function mfp(e,t){this._pairs=[],e&&mfi(e,this,t)}var Pfp=mfp.prototype;Pfp.append=function(t,r){this._pairs.push([t,r])};Pfp.toString=function(t){let r=t?function(i){return t.call(this,i,Ofp)}:Ofp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var jfp=mfp;function gWS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ezi(e,t,r){if(!t)return e;let i=r&&r.encode||gWS;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new jfp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var CIs=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){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},BIs=CIs;var iPn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Efp=di(require("crypto"),1);var wfp=di(require("url"),1),Sfp=wfp.default.URLSearchParams;var xIs="abcdefghijklmnopqrstuvwxyz",Dfp="0123456789",Mfp={DIGIT:Dfp,ALPHA:xIs,ALPHA_DIGIT:xIs+xIs.toUpperCase()+Dfp},OWS=(e=16,t=Mfp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);Efp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},Afp={isNode:!0,classes:{URLSearchParams:Sfp,FormData:pPo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Mfp,generateString:OWS,protocols:["http","https","file","data"]};var RIs={};Eo(RIs,{hasBrowserEnv:()=>zIs,hasStandardBrowserEnv:()=>mWS,hasStandardBrowserWebWorkerEnv:()=>PWS,navigator:()=>IIs,origin:()=>jWS});var zIs=typeof window<"u"&&typeof document<"u",IIs=typeof navigator=="object"&&navigator||void 0,mWS=zIs&&(!IIs||["ReactNative","NativeScript","NS"].indexOf(IIs.product)<0),PWS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jWS=zIs&&window.location.href||"http://localhost";var SM={...RIs,...Afp};function NIs(e,t){return mfi(e,new SM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return SM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function wWS(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function SWS(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 DWS(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&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=SWS(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(wWS(i),n,r,0)}),r}return null}var _Po=DWS;function EWS(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var FIs={transitional:iPn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(_Po(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.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 NIs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return mfi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),EWS(t)):t}],transformResponse:[function(t){let r=this.transitional||FIs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.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"?wp.from(l,wp.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:SM.classes.FormData,Blob:SM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{FIs.headers[e]={}});var nPn=FIs;var MWS=ds.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"]),qfp=e=>{let t={},r,i,n;return e&&e.split(`
1705
1705
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&MWS[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var Tfp=Symbol("internals");function tla(e){return e&&String(e).trim().toLowerCase()}function hPo(e){return e===!1||e==null?e:ds.isArray(e)?e.map(hPo):String(e)}function AWS(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 qWS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function LIs(e,t,r,i,n){if(ds.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!ds.isString(t)){if(ds.isString(i))return t.indexOf(i)!==-1;if(ds.isRegExp(i))return i.test(t)}}function TWS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function CWS(e,t){let r=ds.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 aPn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=tla(d);if(!o)throw new Error("header name must be a non-empty string");let c=ds.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=hPo(l))}let u=(l,d)=>ds.forEach(l,(s,o)=>a(s,o,d));if(ds.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(ds.isString(t)&&(t=t.trim())&&!qWS(t))u(qfp(t),r);else if(ds.isHeaders(t))for(let[l,d]of t.entries())a(d,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=tla(t),t){let i=ds.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return AWS(n);if(ds.isFunction(r))return r.call(this,n,i);if(ds.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=tla(t),t){let i=ds.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||LIs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=tla(u),u){let l=ds.findKey(i,u);l&&(!r||LIs(i,i[l],l,r))&&(delete i[l],n=!0)}}return ds.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||LIs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return ds.forEach(this,(n,a)=>{let u=ds.findKey(i,a);if(u){r[u]=hPo(n),delete r[a];return}let l=t?TWS(a):String(a).trim();l!==a&&delete r[a],r[l]=hPo(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return ds.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&ds.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(`
1706
1706
  `)}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[Tfp]=this[Tfp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=tla(u);i[l]||(CWS(n,u),i[l]=!0)}return ds.isArray(t)?t.forEach(a):a(t),this}};aPn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ds.reduceDescriptors(aPn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});ds.freezeMethods(aPn);var pz=aPn;function rla(e,t){let r=this||nPn,i=t||r,n=pz.from(i.headers),a=i.data;return ds.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function ila(e){return!!(e&&e.__CANCEL__)}function Cfp(e,t,r){wp.call(this,e??"canceled",wp.ERR_CANCELED,t,r),this.name="CanceledError"}ds.inherits(Cfp,wp,{__CANCEL__:!0});var USe=Cfp;function WYt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new wp("Request failed with status code "+r.status,[wp.ERR_BAD_REQUEST,wp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function UIs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function VIs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function tzi(e,t,r){let i=!UIs(t);return e&&i||r==!1?VIs(e,t):t}var Jfp=di(Nca(),1),Kfp=di(require("http"),1),Yfp=di(require("https"),1),Xfp=di(require("util"),1),Zfp=di(Kxs(),1),BJr=di(require("zlib"),1);var rzi="1.8.2";function nla(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var BWS=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function WIs(e,t,r){let i=r&&r.Blob||SM.classes.Blob,n=nla(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=BWS.exec(e);if(!a)throw new wp("Invalid URL",wp.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 wp("Blob is not supported",wp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new wp("Unsupported protocol "+n,wp.ERR_NOT_SUPPORT)}var izi=di(require("stream"),1);var Bfp=di(require("stream"),1);var HIs=Symbol("internals"),$Is=class extends Bfp.default.Transform{constructor(t){t=ds.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!ds.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[HIs]={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[HIs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[HIs],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),P=null,E=u,A,q=0;if(a){let D=Date.now();(!n.ts||(q=D-n.ts)>=l)&&(n.ts=D,A=s-n.bytes,n.bytes=A<0?-A:0,q=0),A=s-n.bytes}if(a){if(A<=0)return setTimeout(()=>{O(null,g)},l-q);A<E&&(E=A)}E&&m>E&&m-E>o&&(P=g.subarray(E),g=g.subarray(0,E)),c(g,P?()=>{process.nextTick(O,null,P)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},GIs=$Is;var kfp=require("events");var Ifp=di(require("util"),1),zfp=require("stream");var{asyncIterator:xfp}=Symbol,xWS=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[xfp]?yield*e[xfp]():yield e},yPo=xWS;var IWS=SM.ALPHABET.ALPHA_DIGIT+"-_",ala=typeof TextEncoder=="function"?new TextEncoder:new Ifp.default.TextEncoder,Pfi=`\r
1707
1707
  `,zWS=ala.encode(Pfi),RWS=2,QIs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=ds.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${Pfi}`;n?r=ala.encode(String(r).replace(/\r?\n|\r\n?/g,Pfi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${Pfi}`,this.headers=ala.encode(a+Pfi),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+RWS,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;ds.isTypedArray(t)?yield t:yield*yPo(t),yield zWS}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},NWS=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+SM.generateString(n,IWS)}=r||{};if(!ds.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=ala.encode("--"+a+Pfi),l=ala.encode("--"+a+"--"+Pfi+Pfi),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new QIs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=ds.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),zfp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},Rfp=NWS;var Nfp=di(require("stream"),1),JIs=class extends Nfp.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)}},Ffp=JIs;var FWS=(e,t)=>ds.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,Lfp=FWS;function LWS(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 Ufp=LWS;function UWS(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 Vfp=UWS;var CJr=(e,t,r=3)=>{let i=0,n=Ufp(50,250);return Vfp(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)},oPn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},uPn=e=>(...t)=>ds.asap(()=>e(...t));var Wfp={flush:BJr.default.constants.Z_SYNC_FLUSH,finishFlush:BJr.default.constants.Z_SYNC_FLUSH},VWS={flush:BJr.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:BJr.default.constants.BROTLI_OPERATION_FLUSH},Hfp=ds.isFunction(BJr.default.createBrotliDecompress),{http:WWS,https:HWS}=Zfp.default,$WS=/https:?/,$fp=SM.protocols.map(e=>e+":"),Gfp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function GWS(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function edp(e,t,r){let i=t;if(!i&&i!==!1){let n=Jfp.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){edp(a,t,a.href)}}var QWS=typeof process<"u"&&ds.kindOf(process)==="process",JWS=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)}),KWS=({address:e,family:t})=>{if(!ds.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},Qfp=(e,t)=>KWS(ds.isObject(e)?e:{address:e,family:t}),tdp=QWS&&function(t){return JWS(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 Se=Lfp(l,Qe=>ds.isArray(Qe)?Qe:[Qe]);l=(Qe,St,Ee)=>{Se(Qe,St,(Te,xt,Pe)=>{if(Te)return Ee(Te);let Ot=ds.isArray(xt)?xt.map(at=>Qfp(at)):[Qfp(xt,Pe)];St.all?Ee(Te,Ot):Ee(Te,Ot[0].address,Ot[0].family)})}}let m=new kfp.EventEmitter,P=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((Se,Qe)=>{b=!0,Qe&&(g=!0,P())});function E(Se){m.emit("abort",!Se||Se.type?new USe(null,t,O):Se)}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 A=tzi(t.baseURL,t.url,t.allowAbsoluteUrls),q=new URL(A,SM.hasBrowserEnv?SM.origin:void 0),D=q.protocol||$fp[0];if(D==="data:"){let Se;if(c!=="GET")return WYt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=WIs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Qe){throw wp.from(Qe,wp.ERR_BAD_REQUEST,t)}return s==="text"?(Se=Se.toString(o),(!o||o==="utf8")&&(Se=ds.stripBOM(Se))):s==="stream"&&(Se=izi.default.Readable.from(Se)),WYt(i,n,{data:Se,status:200,statusText:"OK",headers:new pz,config:t})}if($fp.indexOf(D)===-1)return n(new wp("Unsupported protocol "+D,wp.ERR_BAD_REQUEST,t));let C=pz.from(t.headers).normalize();C.set("User-Agent","axios/"+rzi,!1);let{onUploadProgress:z,onDownloadProgress:$}=t,x=t.maxRate,L,V;if(ds.isSpecCompliantForm(u)){let Se=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=Rfp(u,Qe=>{C.set(Qe)},{tag:`axios-${rzi}-boundary`,boundary:Se&&Se[1]||void 0})}else if(ds.isFormData(u)&&ds.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let Se=await Xfp.default.promisify(u.getLength).call(u);Number.isFinite(Se)&&Se>=0&&C.setContentLength(Se)}catch{}}else if(ds.isBlob(u)||ds.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=izi.default.Readable.from(yPo(u));else if(u&&!ds.isStream(u)){if(!Buffer.isBuffer(u))if(ds.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(ds.isString(u))u=Buffer.from(u,"utf-8");else return n(new wp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",wp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new wp("Request body larger than maxBodyLength limit",wp.ERR_BAD_REQUEST,t))}let Z=ds.toFiniteNumber(C.getContentLength());ds.isArray(x)?(L=x[0],V=x[1]):L=V=x,u&&(z||L)&&(ds.isStream(u)||(u=izi.default.Readable.from(u,{objectMode:!1})),u=izi.default.pipeline([u,new GIs({maxRate:ds.toFiniteNumber(L)})],ds.noop),z&&u.on("progress",Gfp(u,oPn(Z,CJr(uPn(z),!1,3)))));let K;if(t.auth){let Se=t.auth.username||"",Qe=t.auth.password||"";K=Se+":"+Qe}if(!K&&q.username){let Se=q.username,Qe=q.password;K=Se+":"+Qe}K&&C.delete("authorization");let X;try{X=ezi(q.pathname+q.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let Qe=new Error(Se.message);return Qe.config=t,Qe.url=t.url,Qe.exists=!0,n(Qe)}C.set("Accept-Encoding","gzip, compress, deflate"+(Hfp?", br":""),!1);let le={path:X,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:K,protocol:D,family:d,beforeRedirect:GWS,beforeRedirects:{}};!ds.isUndefined(l)&&(le.lookup=l),t.socketPath?le.socketPath=t.socketPath:(le.hostname=q.hostname.startsWith("[")?q.hostname.slice(1,-1):q.hostname,le.port=q.port,edp(le,t.proxy,D+"//"+q.hostname+(q.port?":"+q.port:"")+le.path));let ge,_e=$WS.test(le.protocol);if(le.agent=_e?t.httpsAgent:t.httpAgent,t.transport?ge=t.transport:t.maxRedirects===0?ge=_e?Yfp.default:Kfp.default:(t.maxRedirects&&(le.maxRedirects=t.maxRedirects),t.beforeRedirect&&(le.beforeRedirects.config=t.beforeRedirect),ge=_e?HWS:WWS),t.maxBodyLength>-1?le.maxBodyLength=t.maxBodyLength:le.maxBodyLength=1/0,t.insecureHTTPParser&&(le.insecureHTTPParser=t.insecureHTTPParser),O=ge.request(le,function(Qe){if(O.destroyed)return;let St=[Qe],Ee=+Qe.headers["content-length"];if($||V){let at=new GIs({maxRate:ds.toFiniteNumber(V)});$&&at.on("progress",Gfp(at,oPn(Ee,CJr(uPn($),!0,3)))),St.push(at)}let Te=Qe,xt=Qe.req||O;if(t.decompress!==!1&&Qe.headers["content-encoding"])switch((c==="HEAD"||Qe.statusCode===204)&&delete Qe.headers["content-encoding"],(Qe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":St.push(BJr.default.createUnzip(Wfp)),delete Qe.headers["content-encoding"];break;case"deflate":St.push(new Ffp),St.push(BJr.default.createUnzip(Wfp)),delete Qe.headers["content-encoding"];break;case"br":Hfp&&(St.push(BJr.default.createBrotliDecompress(VWS)),delete Qe.headers["content-encoding"])}Te=St.length>1?izi.default.pipeline(St,ds.noop):St[0];let Pe=izi.default.finished(Te,()=>{Pe(),P()}),Ot={status:Qe.statusCode,statusText:Qe.statusMessage,headers:new pz(Qe.headers),config:t,request:xt};if(s==="stream")Ot.data=Te,WYt(i,n,Ot);else{let at=[],he=0;Te.on("data",function(bt){at.push(bt),he+=bt.length,t.maxContentLength>-1&&he>t.maxContentLength&&(g=!0,Te.destroy(),n(new wp("maxContentLength size of "+t.maxContentLength+" exceeded",wp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let bt=new wp("stream has been aborted",wp.ERR_BAD_RESPONSE,t,xt);Te.destroy(bt),n(bt)}),Te.on("error",function(bt){O.destroyed||n(wp.from(bt,null,t,xt))}),Te.on("end",function(){try{let bt=at.length===1?at[0]:Buffer.concat(at);s!=="arraybuffer"&&(bt=bt.toString(o),(!o||o==="utf8")&&(bt=ds.stripBOM(bt))),Ot.data=bt}catch(bt){return n(wp.from(bt,null,t,Ot.request,Ot))}WYt(i,n,Ot)})}m.once("abort",at=>{Te.destroyed||(Te.emit("error",at),Te.destroy())})}),m.once("abort",Se=>{n(Se),O.destroy(Se)}),O.on("error",function(Qe){n(wp.from(Qe,null,t,O))}),O.on("socket",function(Qe){Qe.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){n(new wp("error trying to parse `config.timeout` to int",wp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(Se,function(){if(b)return;let St=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Ee=t.transitional||iPn;t.timeoutErrorMessage&&(St=t.timeoutErrorMessage),n(new wp(St,Ee.clarifyTimeoutError?wp.ETIMEDOUT:wp.ECONNABORTED,t,O)),E()})}if(ds.isStream(u)){let Se=!1,Qe=!1;u.on("end",()=>{Se=!0}),u.once("error",St=>{Qe=!0,O.destroy(St)}),u.on("close",()=>{!Se&&!Qe&&E(new USe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var rdp=SM.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,SM.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(SM.origin),SM.navigator&&/(msie|trident)/i.test(SM.navigator.userAgent)):()=>!0;var idp=SM.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];ds.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),ds.isString(i)&&u.push("path="+i),ds.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 ndp=e=>e instanceof pz?{...e}:e;function v5t(e,t){t=t||{};let r={};function i(s,o,c,b){return ds.isPlainObject(s)&&ds.isPlainObject(o)?ds.merge.call({caseless:b},s,o):ds.isPlainObject(o)?ds.merge({},o):ds.isArray(o)?o.slice():o}function n(s,o,c,b){if(ds.isUndefined(o)){if(!ds.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!ds.isUndefined(o))return i(void 0,o)}function u(s,o){if(ds.isUndefined(o)){if(!ds.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(ndp(s),ndp(o),c,!0)};return ds.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);ds.isUndefined(b)&&c!==l||(r[o]=b)}),r}var vPo=e=>{let t=v5t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=pz.from(u),t.url=ezi(tzi(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(ds.isFormData(r)){if(SM.hasStandardBrowserEnv||SM.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(SM.hasStandardBrowserEnv&&(i&&ds.isFunction(i)&&(i=i(t)),i||i!==!1&&rdp(t.url))){let s=n&&a&&idp.read(a);s&&u.set(n,s)}return t};var YWS=typeof XMLHttpRequest<"u",adp=YWS&&function(e){return new Promise(function(r,i){let n=vPo(e),a=n.data,u=pz.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 P=new XMLHttpRequest;P.open(n.method.toUpperCase(),n.url,!0),P.timeout=n.timeout;function E(){if(!P)return;let q=pz.from("getAllResponseHeaders"in P&&P.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?P.responseText:P.response,status:P.status,statusText:P.statusText,headers:q,config:e,request:P};WYt(function($){r($),m()},function($){i($),m()},C),P=null}"onloadend"in P?P.onloadend=E:P.onreadystatechange=function(){!P||P.readyState!==4||P.status===0&&!(P.responseURL&&P.responseURL.indexOf("file:")===0)||setTimeout(E)},P.onabort=function(){P&&(i(new wp("Request aborted",wp.ECONNABORTED,e,P)),P=null)},P.onerror=function(){i(new wp("Network Error",wp.ERR_NETWORK,e,P)),P=null},P.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||iPn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new wp(D,C.clarifyTimeoutError?wp.ETIMEDOUT:wp.ECONNABORTED,e,P)),P=null},a===void 0&&u.setContentType(null),"setRequestHeader"in P&&ds.forEach(u.toJSON(),function(D,C){P.setRequestHeader(C,D)}),ds.isUndefined(n.withCredentials)||(P.withCredentials=!!n.withCredentials),l&&l!=="json"&&(P.responseType=n.responseType),s&&([b,O]=CJr(s,!0),P.addEventListener("progress",b)),d&&P.upload&&([c,g]=CJr(d),P.upload.addEventListener("progress",c),P.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=q=>{P&&(i(!q||q.type?new USe(null,e,P):q),P.abort(),P=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let A=nla(n.url);if(A&&SM.protocols.indexOf(A)===-1){i(new wp("Unsupported protocol "+A+":",wp.ERR_BAD_REQUEST,e));return}P.send(a||null)})};var XWS=(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 wp?o:new USe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new wp(`timeout ${t} of ms exceeded`,wp.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=()=>ds.asap(l),d}},odp=XWS;var ZWS=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},kWS=async function*(e,t){for await(let r of eHS(e))yield*ZWS(r,t)},eHS=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()}},KIs=(e,t,r,i)=>{let n=kWS(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 gPo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",sdp=gPo&&typeof ReadableStream=="function",tHS=gPo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),cdp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},rHS=sdp&&cdp(()=>{let e=!1,t=new Request(SM.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),udp=64*1024,YIs=sdp&&cdp(()=>ds.isReadableStream(new Response("").body)),bPo={stream:YIs&&(e=>e.body)};gPo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!bPo[t]&&(bPo[t]=ds.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new wp(`Response type '${t}' is not supported`,wp.ERR_NOT_SUPPORT,i)})})})(new Response);var iHS=async e=>{if(e==null)return 0;if(ds.isBlob(e))return e.size;if(ds.isSpecCompliantForm(e))return(await new Request(SM.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ds.isArrayBufferView(e)||ds.isArrayBuffer(e))return e.byteLength;if(ds.isURLSearchParams(e)&&(e=e+""),ds.isString(e))return(await tHS(e)).byteLength},nHS=async(e,t)=>{let r=ds.toFiniteNumber(e.getContentLength());return r??iHS(t)},ldp=gPo&&(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}=vPo(e);s=s?(s+"").toLowerCase():"text";let g=odp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),P;try{if(d&&rHS&&r!=="get"&&r!=="head"&&(P=await nHS(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),z;if(ds.isFormData(i)&&(z=C.headers.get("content-type"))&&o.setContentType(z),C.body){let[$,x]=oPn(P,CJr(uPn(d)));i=KIs(C.body,udp,$,x)}}ds.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 A=await fetch(O),q=YIs&&(s==="stream"||s==="response");if(YIs&&(l||q&&m)){let C={};["status","statusText","headers"].forEach(L=>{C[L]=A[L]});let z=ds.toFiniteNumber(A.headers.get("content-length")),[$,x]=l&&oPn(z,CJr(uPn(l),!0))||[];A=new Response(KIs(A.body,udp,$,()=>{x&&x(),m&&m()}),C)}s=s||"text";let D=await bPo[ds.findKey(bPo,s)||"text"](A,e);return!q&&m&&m(),await new Promise((C,z)=>{WYt(C,z,{data:D,headers:pz.from(A.headers),status:A.status,statusText:A.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new wp("Network Error",wp.ERR_NETWORK,e,O),{cause:E.cause||E}):wp.from(E,E&&E.code,e,O)}});var XIs={http:tdp,xhr:adp,fetch:ldp};ds.forEach(XIs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var fdp=e=>`- ${e}`,aHS=e=>ds.isFunction(e)||e===null||e===!1,OPo={getAdapter:e=>{e=ds.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,!aHS(r)&&(i=XIs[(u=String(r)).toLowerCase()],i===void 0))throw new wp(`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 :
@@ -1939,7 +1939,7 @@ ${q}${A}${D}${VFp.default.cursorHide}`});var Y_a=di(axi(),1);function WLs(e,t){i
1939
1939
  Run ${Js.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1940
1940
  Run ${Js.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),cPn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function eUs({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!d3p(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+=`
1941
1941
  ${await zMD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Js.dim(l.currentVersion)+Js.reset(" \u2192 ")+Js.green(l.latestVersion);return n+=`
1942
- `,i?cPn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function zMD(e){let r=await new f3p.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 RMD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await _3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Xsi(o.name,c),g=await iJt({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 _3p({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=Xsi(s.name,o),b=await iJt({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 _3p({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 L8t({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 h3p(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=Vie(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 Oqo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await RMD({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(...h3p(s,d,t.logger));else u.push(...h3p(l.versions,void 0,t.logger))}return u}var nha=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 X1n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Z1n=e=>e!==null&&typeof e=="object";var aha=(...e)=>{for(let t of e)if((!Z1n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return iUs({},...e)},tUs=(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 mqo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:iUs(e[r]??[],t[r]??[])}var rUs=(e={},t={})=>({beforeRequest:mqo(e,t,"beforeRequest"),beforeRetry:mqo(e,t,"beforeRetry"),afterResponse:mqo(e,t,"afterResponse"),beforeError:mqo(e,t,"beforeError")}),iUs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Z1n(n)){for(let[a,u]of Object.entries(n))Z1n(u)&&a in t&&(u=iUs(t[a],u)),t={...t,[a]:u};Z1n(n.hooks)&&(i=rUs(i,n.hooks),t.hooks=i),Z1n(n.headers)&&(r=tUs(r,n.headers),t.headers=r)}return t};var y3p=(()=>{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})(),v3p=typeof globalThis.AbortController=="function",b3p=typeof globalThis.ReadableStream=="function",g3p=typeof globalThis.FormData=="function",Pqo=["get","post","put","patch","head","delete"],NMD=()=>{};NMD();var O3p={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},jqo=2147483647,wqo=Symbol("stop"),m3p={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},P3p={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 w3p=e=>Pqo.includes(e)?e.toUpperCase():e,FMD=["get","put","head","delete","options","trace"],LMD=[408,413,429,500,502,503,504],UMD=[413,429,503],j3p={limit:2,methods:FMD,statusCodes:LMD,afterStatusCodes:UMD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},S3p=(e={})=>{if(typeof e=="number")return{...j3p,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{...j3p,...e}};async function nUs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new X1n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function aUs(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 D3p=(e,t)=>{let r={};for(let i in t)!(i in P3p)&&!(i in m3p)&&!(i in e)&&(r[i]=t[i]);return r};var oha=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>jqo)throw new RangeError(`The \`timeout\` option cannot be greater than ${jqo}`);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 nha(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(!b3p)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(O3p))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:tUs(this._input.headers,r.headers),hooks:rUs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:w3p(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:S3p(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(v3p){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(y3p&&(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);(g3p&&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)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof X1n)throw t;if(t instanceof nha){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),jqo);if(this._retryCount<1)throw r;await aUs(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})===wqo)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=D3p(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):nUs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var oUs=e=>{let t=(r,i)=>oha.create(r,aha(e,i));for(let r of Pqo)t[r]=(i,n)=>oha.create(i,aha(e,n,{method:r}));return t.create=r=>oUs(aha(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),oUs(aha(e,r))),t.stop=wqo,t},VMD=oUs(),E3p=VMD;var Y3p=di(K3p(),1);function fUs(e){let t=(0,Y3p.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var H7p=di(W7p(),1),$7p=di(axi(),1),SUs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},DUs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function EUs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??fUs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,H7p.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 E3p(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new SUs(e):c}if(t.allVersions)return s;let o=new DUs(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=$7p.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 dha(e,t){let{version:r}=await EUs(e.toLowerCase(),t);return r}async function Qdi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:dha(e.packageName,{version:t?"prerelease":"latest"})}var G7p=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],zqo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=V0.Info;constructor(t){this.ttyAwareLogger=new gqo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.57.3"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new ure}failWithoutThrowing(t,r){this.didSucceed=!1,hqo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await ePn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await p3p({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1942
+ `,i?cPn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function zMD(e){let r=await new f3p.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 RMD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await _3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Xsi(o.name,c),g=await iJt({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 _3p({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=Xsi(s.name,o),b=await iJt({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 _3p({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 L8t({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 h3p(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=Vie(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 Oqo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await RMD({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(...h3p(s,d,t.logger));else u.push(...h3p(l.versions,void 0,t.logger))}return u}var nha=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 X1n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Z1n=e=>e!==null&&typeof e=="object";var aha=(...e)=>{for(let t of e)if((!Z1n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return iUs({},...e)},tUs=(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 mqo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:iUs(e[r]??[],t[r]??[])}var rUs=(e={},t={})=>({beforeRequest:mqo(e,t,"beforeRequest"),beforeRetry:mqo(e,t,"beforeRetry"),afterResponse:mqo(e,t,"afterResponse"),beforeError:mqo(e,t,"beforeError")}),iUs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Z1n(n)){for(let[a,u]of Object.entries(n))Z1n(u)&&a in t&&(u=iUs(t[a],u)),t={...t,[a]:u};Z1n(n.hooks)&&(i=rUs(i,n.hooks),t.hooks=i),Z1n(n.headers)&&(r=tUs(r,n.headers),t.headers=r)}return t};var y3p=(()=>{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})(),v3p=typeof globalThis.AbortController=="function",b3p=typeof globalThis.ReadableStream=="function",g3p=typeof globalThis.FormData=="function",Pqo=["get","post","put","patch","head","delete"],NMD=()=>{};NMD();var O3p={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},jqo=2147483647,wqo=Symbol("stop"),m3p={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},P3p={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 w3p=e=>Pqo.includes(e)?e.toUpperCase():e,FMD=["get","put","head","delete","options","trace"],LMD=[408,413,429,500,502,503,504],UMD=[413,429,503],j3p={limit:2,methods:FMD,statusCodes:LMD,afterStatusCodes:UMD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},S3p=(e={})=>{if(typeof e=="number")return{...j3p,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{...j3p,...e}};async function nUs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new X1n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function aUs(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 D3p=(e,t)=>{let r={};for(let i in t)!(i in P3p)&&!(i in m3p)&&!(i in e)&&(r[i]=t[i]);return r};var oha=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>jqo)throw new RangeError(`The \`timeout\` option cannot be greater than ${jqo}`);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 nha(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(!b3p)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(O3p))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:tUs(this._input.headers,r.headers),hooks:rUs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:w3p(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:S3p(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(v3p){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(y3p&&(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);(g3p&&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)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof X1n)throw t;if(t instanceof nha){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),jqo);if(this._retryCount<1)throw r;await aUs(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})===wqo)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=D3p(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):nUs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var oUs=e=>{let t=(r,i)=>oha.create(r,aha(e,i));for(let r of Pqo)t[r]=(i,n)=>oha.create(i,aha(e,n,{method:r}));return t.create=r=>oUs(aha(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),oUs(aha(e,r))),t.stop=wqo,t},VMD=oUs(),E3p=VMD;var Y3p=di(K3p(),1);function fUs(e){let t=(0,Y3p.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var H7p=di(W7p(),1),$7p=di(axi(),1),SUs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},DUs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function EUs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??fUs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,H7p.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 E3p(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new SUs(e):c}if(t.allVersions)return s;let o=new DUs(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=$7p.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 dha(e,t){let{version:r}=await EUs(e.toLowerCase(),t);return r}async function Qdi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:dha(e.packageName,{version:t?"prerelease":"latest"})}var G7p=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],zqo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=V0.Info;constructor(t){this.ttyAwareLogger=new gqo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.57.4"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new ure}failWithoutThrowing(t,r){this.didSucceed=!1,hqo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await ePn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await p3p({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1943
1943
  `)||(r+=`
1944
1944
  `),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=B_s(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 X_a(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 ure}finally{i.finish()}return n}async instrumentPostHogEvent(t){(await ePn()).sendEvent(t)}logger=vQr(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Q7p(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Q7p(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=G7p[this.numTasks++%G7p.length],u=Js.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===BC.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logImmediately(t){let r=t.filter(i=>_si.indexOf(i.level)>=_si.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===V0.Debug})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await Qdi({cliEnvironment:this.environment,includePreReleases:t}),i=Vie(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await Oqo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await RLs({message:t,default:r})}async getInput(t){return await NLs({message:t.message,default:t.default})}};function Q7p(e){return`[${e}]:`}var pt_=require("fs/promises");function Wie({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Js.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Js.dim(r)),i.join(`
1945
1945
  `)}var mKp=require("fs/promises");var Y5t=class e{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;type=e.Type;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 oDe=class extends Y5t{definition;sources;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 pha=class{context;constructor(t){this.context=t}};var Rqo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?Yh.of(`${n}${t8t}${u}`):Yh.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${t8t}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(t8t))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Yh.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 dNi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new Rqo,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 LQr(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"]))QAD(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}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)}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??L0((QBe(r)+"/"+uBi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Yh.of(QN))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=Ato(QBe(rvn.of(`/${t}`)),rvn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=Ato(QBe(rvn.of(`/${t}`)),rvn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===Yh.of(QN))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=>oSe(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=xR(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:xR(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:xR(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===iS?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 QAD(e){return e?.header!=null}var Hie={openapi:e=>({...e,type:"openapi",_visit:function(t){return Hie._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Hie._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 aSn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return aSn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var C5={basic:e=>({...e,type:"basic",_visit:function(t){return C5._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return C5._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return C5._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return C5._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return C5._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 ig={primitive:e=>({value:e,type:"primitive",_visit:function(t){return ig._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ig._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return ig._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return ig._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return ig._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return ig._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ig._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return ig._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 s_={int:e=>({value:e,type:"int",_visit:function(t){return s_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return s_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return s_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return s_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return s_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return s_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return s_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return s_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return s_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return s_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return s_._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 oSn={boolean:e=>({value:e,type:"boolean",_visit:function(t){return oSn._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return oSn._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 Jdi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return Jdi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return Jdi._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 EV={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case EV.GenerallyAvailable:return t.generallyAvailable();case EV.Beta:return t.beta();case EV.Deprecated:return t.deprecated();default:return t._other()}}};var Cze={cursor:e=>({...e,type:"cursor",_visit:function(t){return Cze._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Cze._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Cze._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 DKr={language:e=>({...e,type:"language",_visit:function(t){return DKr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return DKr._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 MV={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 MV.Curl:return t.curl();case MV.Python:return t.python();case MV.Javascript:return t.javascript();case MV.Typescript:return t.typescript();case MV.Go:return t.go();case MV.Ruby:return t.ruby();case MV.Csharp:return t.csharp();case MV.Java:return t.java();case MV.Js:return t.js();case MV.Node:return t.node();case MV.Ts:return t.ts();case MV.Nodets:return t.nodets();case MV.Golang:return t.golang();case MV.Dotnet:return t.dotnet();case MV.Jvm:return t.jvm();default:return t._other()}}};var X5t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return X5t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return X5t._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 Bze={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return Bze._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return Bze._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 MG={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case MG.Get:return t.get();case MG.Post:return t.post();case MG.Put:return t.put();case MG.Patch:return t.patch();case MG.Delete:return t.delete();case MG.Head:return t.head();case MG.Options:return t.options();case MG.Trace:return t.trace();default:return t._other()}}};var Kdi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Kdi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Kdi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Kdi._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 xze={file:e=>({...e,type:"file",_visit:function(t){return xze._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return xze._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 AG={file:e=>({...e,type:"file",_visit:function(t){return AG._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return AG._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return AG._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return AG._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return AG._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return AG._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return AG._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 Oy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Oy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Oy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Oy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Oy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Oy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Oy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Oy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Oy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Oy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Oy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Oy._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 mj={int:e=>({...e,type:"int",_visit:function(t){return mj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return mj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return mj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return mj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return mj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return mj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return mj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return mj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return mj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return mj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return mj._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 jx={boolean:e=>({value:e,type:"boolean",_visit:function(t){return jx._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return jx._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 EKr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return EKr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return EKr._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 uDe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return uDe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return uDe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return uDe._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 PT={file:e=>({...e,type:"file",_visit:function(t){return PT._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return PT._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return PT._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return PT._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return PT._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return PT._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return PT._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 El={primitive:e=>({...e,type:"primitive",_visit:function(t){return El._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return El._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return El._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return El._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return El._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return El._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return El._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return El._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return El._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return El._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return El._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 pX={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return pX._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return pX._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 Xd={int:e=>({...e,type:"int",_visit:function(t){return Xd._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xd._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Xd._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Xd._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Xd._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Xd._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xd._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Xd._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Xd._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Xd._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xd._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={};Eo(cv,{AllOfPropertyConflict:()=>ASn,ArraySchema:()=>kTo,ArraySchemaWithExample:()=>ECo,Availability:()=>Qqo,Base64WithExample:()=>PCo,BasicSecurityScheme:()=>Yqo,BearerSecurityScheme:()=>Xqo,BooleanSchema:()=>QTo,BooleanWithExample:()=>jCo,BytesResponse:()=>OSn,CasingOverrides:()=>eTo,CommonProperty:()=>uCo,CommonPropertyWithExample:()=>zCo,CursorPagination:()=>qTo,CustomCodeSample:()=>MTo,CustomCodeSampleLanguage:()=>STo,CustomCodeSampleSdk:()=>ETo,CustomPagination:()=>CTo,DateWithExample:()=>mCo,DatetimeWithExample:()=>OCo,DiscriminatedOneOfSchema:()=>aCo,DiscriminatedOneOfSchemaWithExample:()=>xCo,DoubleSchema:()=>$To,DoubleWithExample:()=>bCo,Encoding:()=>Gqo,Endpoint:()=>BTo,EndpointExample:()=>wSn,EndpointResponseExample:()=>wTo,EndpointSdkName:()=>CXt,EndpointWithExample:()=>j6p,EnumSchema:()=>lSn,EnumSchemaWithExample:()=>SCo,EnumValue:()=>Zdi,ErrorExample:()=>gTo,FernExample:()=>mTo,FileResponse:()=>bSn,FileSchema:()=>dTo,FloatWithExample:()=>vCo,FullEndpointExample:()=>ATo,FullExample:()=>kA,FullObjectExample:()=>uTo,FullOneOfExample:()=>cTo,GlobalHeader:()=>KTo,Header:()=>epi,HeaderExample:()=>jSn,HeaderSecurityScheme:()=>Zqo,HeaderWithExample:()=>ipi,HttpEndpointServer:()=>mSn,HttpError:()=>OTo,HttpErrorWithExample:()=>dCo,HttpMethod:()=>pSn,IdempotencyHeader:()=>YTo,Int64WithExample:()=>_Co,IntSchema:()=>WTo,IntWithExample:()=>pCo,JsonRequest:()=>yTo,JsonRequestWithExample:()=>cCo,JsonResponse:()=>gSn,JsonResponseWithExample:()=>CSn,KeyValuePair:()=>sTo,LiteralExample:()=>oTo,LiteralSchema:()=>MSn,LiteralSchemaValue:()=>XTo,LongSchema:()=>HTo,MapSchema:()=>eCo,MapSchemaWithExample:()=>MCo,MultipartRequest:()=>vSn,MultipartRequestProperty:()=>hTo,MultipartRequestPropertyEncoding:()=>_To,MultipartSchema:()=>pTo,NamedFullExample:()=>xXt,Namespace:()=>tTo,NamespaceId:()=>aTo,NullableSchema:()=>rCo,NullableSchemaWithExample:()=>qCo,OauthSecurityScheme:()=>iTo,ObjectProperty:()=>nCo,ObjectPropertyConflictInfo:()=>qSn,ObjectPropertyWithExample:()=>BCo,ObjectSchema:()=>ZTo,ObjectSchemaWithExample:()=>TCo,OctetStreamRequest:()=>ySn,OffsetPagination:()=>TTo,OneOfSchema:()=>iCo,OneOfSchemaWithExample:()=>CCo,OpenApiIntermediateRepresentation:()=>m6p,OpenApiSource:()=>Vqo,OptionalSchema:()=>tCo,OptionalSchemaWithExample:()=>ACo,Pagination:()=>SSn,PathParameter:()=>_Sn,PathParameterExample:()=>PTo,PathParameterWithExample:()=>sCo,PrimitiveExample:()=>dSn,PrimitiveSchema:()=>rpi,PrimitiveSchemaValue:()=>JTo,PrimitiveSchemaValueWithExample:()=>wCo,PrimitiveSchemaWithExample:()=>BSn,PropertyKey:()=>fSn,ProtobufEncoding:()=>$qo,ProtobufSource:()=>Wqo,QueryParameter:()=>hSn,QueryParameterExample:()=>PSn,QueryParameterWithExample:()=>TSn,QuerySecurityScheme:()=>kqo,ReferencedSchema:()=>BXt,Request:()=>vTo,RequestWithExample:()=>lCo,Response:()=>bTo,ResponseWithExample:()=>fCo,Schema:()=>KO,SchemaId:()=>_X,SchemaWithExample:()=>qM,Schemas:()=>VTo,SdkGroup:()=>rTo,SdkGroupInfo:()=>lTo,SdkGroupName:()=>kdi,SecurityScheme:()=>nTo,SecuritySchemeId:()=>Kqo,Server:()=>vha,Source:()=>Hqo,StatusCode:()=>qXt,StreamingResponseExample:()=>jTo,StringSchema:()=>GTo,StringSchemaWithExample:()=>gCo,SupportedSdkLanguage:()=>DTo,Tag:()=>Jqo,TagId:()=>hX,Tags:()=>fTo,TextResponse:()=>tpi,Uint64WithExample:()=>yCo,UintWithExample:()=>hCo,UnDiscriminatedOneOfSchema:()=>oCo,UnDiscriminatedOneOfSchemaWithExample:()=>ICo,UnknownSchemaWithExample:()=>DCo,Webhook:()=>xTo,WebhookExampleCall:()=>ESn,WebhookHttpMethod:()=>DSn,WebhookWithExample:()=>w6p,WebsocketChannel:()=>UTo,WebsocketHandshake:()=>ITo,WebsocketHandshakeWithExample:()=>P6p,WebsocketMessageExample:()=>FTo,WebsocketMessageOrigin:()=>zTo,WebsocketMessageSchema:()=>RTo,WebsocketServer:()=>NTo,WebsocketSessionExample:()=>LTo,WithAvailability:()=>dh,WithDescription:()=>pf,WithEncoding:()=>$ie,WithInline:()=>dE,WithName:()=>o0,WithNamespace:()=>TXt,WithSdkGroupName:()=>IO,WithSource:()=>Ah,WithStatusCode:()=>Ize,WithTitle:()=>xO,commons:()=>CUs,example:()=>BUs,finalIr:()=>xUs,parseIr:()=>IUs});var CUs={};Eo(CUs,{BasicSecurityScheme:()=>Yqo,BearerSecurityScheme:()=>Xqo,Encoding:()=>Gqo,HeaderSecurityScheme:()=>Zqo,Namespace:()=>tTo,NamespaceId:()=>aTo,OauthSecurityScheme:()=>iTo,OpenApiSource:()=>Vqo,ProtobufEncoding:()=>$qo,ProtobufSource:()=>Wqo,QuerySecurityScheme:()=>kqo,SchemaId:()=>_X,SdkGroup:()=>rTo,SdkGroupName:()=>kdi,SecurityScheme:()=>nTo,SecuritySchemeId:()=>Kqo,Server:()=>vha,Source:()=>Hqo,StatusCode:()=>qXt,Tag:()=>Jqo,TagId:()=>hX,WithAvailability:()=>dh,WithDescription:()=>pf,WithEncoding:()=>$ie,WithInline:()=>dE,WithName:()=>o0,WithNamespace:()=>TXt,WithSdkGroupName:()=>IO,WithSource:()=>Ah,WithStatusCode:()=>Ize,WithTitle:()=>xO});var qt={};Eo(qt,{JsonError:()=>uSn,ParseError:()=>sSn,any:()=>s6p,bigint:()=>K7p,boolean:()=>c6p,booleanLiteral:()=>u6p,date:()=>Y7p,discriminant:()=>b6p,enum_:()=>Fqo,getObjectLikeUtils:()=>Z5t,getObjectUtils:()=>pNi,getSchemaUtils:()=>ZA,isProperty:()=>Xdi,lazy:()=>X7p,lazyObject:()=>n6p,list:()=>Uqo,number:()=>l6p,object:()=>Lqo,objectWithoutOptionalProperties:()=>i6p,optional:()=>MUs,property:()=>k7p,record:()=>_6p,set:()=>h6p,string:()=>f6p,stringLiteral:()=>o6p,transform:()=>AUs,undiscriminatedUnion:()=>v6p,union:()=>O6p,unknown:()=>d6p,withParsedProperties:()=>TUs});var ZP={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 AM(e,t){return`Expected ${t}. Received ${JAD(e)}.`}function JAD(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 B5(e){return{...e,json:J7p(e.json),parse:J7p(e.parse)}}function J7p(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(`
@@ -1953,7 +1953,7 @@ plugins:
1953
1953
  - enum_type=string
1954
1954
  - default_response=false
1955
1955
  - source_root=${e}
1956
- `}async function Jze({context:e,specs:t,relativePathToDependency:r}){let i=new TRo({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=>OeE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function OeE({generator:e,protobufSpec:t,relativePathToDependency:r}){return{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 Kkp=require("fs"),IEn=require("fs/promises");var Ykp=require("os"),Xkp=di(require("path"),1),Zkp=require("stream/promises"),kkp=di(FNo(),1),ee_=di(ore(),1);var hXs=di(Hxi(),1);var uP;(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"})(uP||(uP={}));var YrE=oJr();async function te_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:uP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:uP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${iiE(s)}`},async o=>{switch(s.type){case"version":l=await tiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await eiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var re_="dependencies";var XrE="metadata.json",ZrE=".fern";function krE(e){return es(Wl.of((0,Ykp.homedir)()),uo.of(ZrE),uo.of(re_),uo.of(e.organization),uo.of(e.apiName),uo.of(e.version))}async function eiE({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:uo.of(e.path)},i);return t.logger.info("Loaded..."),u}async function tiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=krE(e),u=es(a,uo.of(re_)),l=es(a,uo.of(XrE)),d;if(!await Cf(u)||!await Cf(l)){t.logger.info("Downloading manifest...");let c=await YrE.definitionRegistry.get(hXs.FernFiddle.OrganizationId(e.organization),hXs.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=iNi(r),O=iNi(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,IEn.mkdir)(u,{recursive:!0});try{await riE({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,IEn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,IEn.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 riE({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await QR.get(e,{responseType:"stream"}),i=await ee_.default.dir(),n=Xkp.default.join(i.path,"api.tgz");await(0,Zkp.pipeline)(r.data,(0,Kkp.createWriteStream)(n)),await(0,kkp.extract)({file:n,cwd:t})}function iiE(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var he_=di(se_(),1);function LNo(e,t){for(let[r,i]of $N(e))aiE({relativeFilepath:r,failure:i,logger:t})}function aiE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case uP.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 uP.FILE_READ:r.error("Failed to open file: "+e);break;case uP.FILE_MISSING:r.error("Missing file: "+e);break;case uP.FILE_PARSE:t.error instanceof Vaa?r.error(Wie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case uP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of oiE(i))r.error(Wie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case uP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case uP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${zZa}: `+t.dependencyName);break;case uP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case uP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case uP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Wie({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(Wie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function oiE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var ce_=require("fs/promises");async function le_(e,t){let r=[];for(let i of await XBe(e,t))r.push(await uiE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function uiE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,ce_.readFile)(t)).toString()}}async function fe_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Kd.load(n.fileContents,{schema:Kd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:uP.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 de_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all($N(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(jY(b)>0)d[s]={type:uP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=_p(s);if(W4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:uP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await te_({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[_p(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),jY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var pe_=di(require("path"),1);var bXs={};Eo(bXs,{additionalProperties:()=>fiE,default:()=>piE,definitions:()=>diE,properties:()=>ciE,required:()=>liE,type:()=>siE});var siE="object",ciE={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"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},liE=["name"],fiE=!1,diE={"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}},piE={type:siE,properties:ciE,required:liE,additionalProperties:fiE,definitions:diE};var gXs={};Eo(gXs,{additionalProperties:()=>yiE,default:()=>biE,definitions:()=>viE,properties:()=>hiE,type:()=>_iE});var _iE="object",hiE={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"}]}},yiE=!1,viE={"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"]},"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}},biE={type:_iE,properties:hiE,additionalProperties:yiE,definitions:viE};var OXs={};Eo(OXs,{additionalProperties:()=>miE,default:()=>jiE,definitions:()=>PiE,properties:()=>OiE,type:()=>giE});var giE="object",OiE={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"}]}},miE=!1,PiE={"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"]},"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"}]}},jiE={type:giE,properties:OiE,additionalProperties:miE,definitions:PiE};function _e_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of $N(e)){let d=l.contents,s=o=>{a[u]={type:uP.JSONSCHEMA_VALIDATION,error:o}};if(u===QN){let o=nQr(d,bXs);if(o.success){let c=S2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(pe_.default.basename(u)===iS){let o=nQr(d,OXs);if(o.success){let c=S2.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=nQr(d,gXs);if(o.success){let c=S2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:es(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[uo.of(QN)]:{type:uP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var p_i=class extends Y5t{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,he_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=es(this.absoluteFilePath,uo.of(X8)),l=await Ybs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await le_(u,"{yml,yaml}"),s=await fe_(d);if(!s.didSucceed)return LNo(s.failures,a.logger),a.failAndThrow();let o=_e_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return LNo(o.failures,a.logger),a.failAndThrow();let c=await de_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return LNo(c.failures,a.logger),a.failAndThrow();n=new oDe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function LV(e){let t=SiE(e),{value:r,done:i}=mXs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...wiE(t)]}}function*wiE(e){let t;do{let{value:r}=mXs(e,"}"),i=mXs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*SiE(e){for(let t of e)yield t}function mXs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function eba(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function ye_({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return cZt({containerType:t});switch(t.type){case"list":{let u=uC({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:QO.literal({literal:t.literal._visit({boolean:u=>Cd.boolean(u),string:u=>Cd.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return cZt({containerType:t});let u=uC({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return cZt({containerType:t});let u=uC({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=uC({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=uC({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=uC({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function cZt({containerType:e}){switch(e.type){case"list":return{type:"success",example:QO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:QO.literal({literal:e.literal._visit({boolean:t=>Cd.boolean(t),string:t=>Cd.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:QO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:QO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:QO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:QO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function be_({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return AiE({fieldName:e,validation:DiE(t.v2)});case"BASE_64":return{type:"success",example:Cd.base64(Ey.BASE64),jsonExample:Ey.BASE64};case"BOOLEAN":return{type:"success",example:Cd.boolean(Ey.BOOLEAN),jsonExample:Ey.BOOLEAN};case"DATE":return{type:"success",example:Cd.date(Ey.DATE),jsonExample:Ey.DATE};case"DATE_TIME":return{type:"success",example:Cd.datetime({datetime:new Date(Ey.DATE_TIME),raw:Ey.DATE_TIME}),jsonExample:Ey.DATE_TIME};case"DOUBLE":return qiE({fieldName:e,validation:EiE(t.v2)});case"FLOAT":return{type:"success",example:Cd.float(Ey.FLOAT),jsonExample:Ey.FLOAT};case"INTEGER":return TiE({fieldName:e,validation:MiE(t.v2)});case"UINT_64":return{type:"success",example:Cd.uint64(Ey.INT64),jsonExample:Ey.INT64};case"UINT":return{type:"success",example:Cd.uint(Ey.UINT),jsonExample:Ey.UINT};case"BIG_INTEGER":return{type:"success",example:Cd.bigInteger(Ey.INT64.toString()),jsonExample:`${Ey.INT64}`};case"LONG":return{type:"success",example:Cd.long(Ey.INT64),jsonExample:Ey.INT64};case"UUID":return{type:"success",example:Cd.uuid(Ey.UUID),jsonExample:Ey.UUID};default:Fo(t.v1)}}function DiE(e){if(e?.type==="string")return e.validation}function EiE(e){if(e?.type==="double")return e.validation}function MiE(e){if(e?.type==="integer")return e.validation}function ve_(e){if(e<=Ey.SAMPLE_STRINGS.length){let t=Ey.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return Ey.SAMPLE_STRINGS[Ey.SAMPLE_STRINGS.length-1]+".".repeat(e-Ey.SAMPLE_STRINGS.length)}function AiE({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=ve_(i);return{type:"success",example:Cd.string({original:a}),jsonExample:a}}else if(n){let a=ve_(n);return{type:"success",example:Cd.string({original:a}),jsonExample:a}}}let r=e??Ey.STRING;return{type:"success",example:Cd.string({original:r}),jsonExample:r}}function qiE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Cd.double(r),jsonExample:r};if(i)return{type:"success",example:Cd.double(i),jsonExample:i}}return{type:"success",example:Cd.double(Ey.DOUBLE),jsonExample:Ey.DOUBLE}}function TiE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Cd.integer(r),jsonExample:r};if(i)return{type:"success",example:Cd.integer(i),jsonExample:i}}return{type:"success",example:Cd.integer(Ey.INT),jsonExample:Ey.INT}}function uC({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=NEn({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:mh.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=ye_({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=cZt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:mh.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:mh.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=be_({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:mh.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:mh.unknown(u)},jsonExample:u}}}}function FEn({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function NEn({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=uC({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:ow.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:ow.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=NEn({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=CiE({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:ow.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=uC({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:ow.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=uC({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=NEn({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=uC({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function CiE({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=uC({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!FEn({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:ow.object({properties:d}),jsonExample:l}}var PXs=a_.primitive({v1:b0.String,v2:Dv.string({default:void 0,validation:void 0})});function tba({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Wq.ok(nC.body(void 0)),docs:void 0},l=[{params:t.pathParameters,add:s=>u.endpointPathParameters.push(s)},{params:r.pathParameters,add:s=>u.servicePathParameters.push(s)},{params:e.pathParameters,add:s=>u.rootPathParameters.push(s)}];for(let s of l)for(let o of s.params){let c=uC({fieldName:o.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}for(let s of t.queryParameters){if(n&&FEn({typeDeclarations:i,typeReference:s.valueType}))continue;let o=uC({fieldName:s.name.name.originalName,currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:s.valueType,skipOptionalProperties:n});if(o.type==="failure")return o;let{example:c}=o;u.queryParameters.push({name:s.name,shape:s.allowMultiple?D2.exploded():D2.single(),value:c})}let d=[{params:t.headers,add:s=>u.endpointHeaders.push(s)},{params:r.headers,add:s=>u.serviceHeaders.push(s)}];for(let s of d)for(let o of s.params){if(n&&FEn({typeDeclarations:i,typeReference:o.valueType}))continue;let c=uC({fieldName:o.name.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}if(t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let s={},o=[];if(t.requestBody.extends!=null)for(let c of t.requestBody.extends){let b=i[c.typeId];if(b==null)throw new Error(`Failed to find extended type declaration with id ${c.typeId}`);let g=NEn({typeDeclaration:b,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});g!=null&&g.type==="success"&&Object.assign(s,g.jsonExample)}for(let c of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let b=uC({fieldName:c.name.wireValue,typeReference:c.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(b.type==="failure"&&!FEn({typeDeclarations:i,typeReference:c.valueType}))return{type:"failure",message:`Failed to generate required property ${c.name.wireValue} b/c ${b.message}`};if(b.type==="failure")continue;let{example:g,jsonExample:O}=b;o.push({name:c.name,originalTypeDeclaration:void 0,value:g}),s[c.name.wireValue]=O}u.request=tG.inlinedRequestBody({jsonExample:s,properties:o});break}case"reference":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.request=tG.reference(o);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"streamParameter":{let s;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"streaming":{let s;switch(t.response.body.value.type){case"sse":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.sse([{data:{...o,jsonExample:c},event:""}]));break}case"json":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.stream([{...o,jsonExample:c}]));break}case"text":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.stream([{...o,jsonExample:c}]));break}default:Fo(t.response.body.value)}break}case"text":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Wq.error({body:void 0,error:a.declaration.name});else{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.response=Wq.error({body:o,error:a.declaration.name})}try{return{type:"success",example:{id:eba(u),url:BiE(t,u),...u},jsonExample:void 0}}catch(s){return{type:"failure",message:`Parse failure with exceptions ${s}`}}}function BiE(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function vFi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=tba({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}return e}function jXs(e,t,r){let{environments:i,changedBaseUrlIds1:n,changedBaseUrlIds2:a}=xiE(e.environments,t.environments,r),{services:u,websocketChannels:l}=IiE(e,t,n,a);return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:i,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:u,webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:l,rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}function xiE(e,t,r){if(e==null&&t==null)return{environments:void 0,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(t==null)return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(e==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(JSON.stringify(e)===JSON.stringify(t))return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let i=ge_(e),n=ge_(t);if(i&&n&&e.environments.type==="singleBaseUrl"&&t.environments.type==="singleBaseUrl")return{environments:{defaultEnvironment:e.defaultEnvironment??t.defaultEnvironment,environments:NC.singleBaseUrl({environments:[...e.environments.environments,...t.environments.environments]})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let a=i?t.defaultEnvironment:e.defaultEnvironment,u=e.environments,l=t.environments;if(u.type==="singleBaseUrl"&&l.type==="singleBaseUrl"){let d=i?l:u,s=i?u:l,o={},{deconflictedEnvironments2:c,changedBaseUrlIds2:b}=ziE(d,s,r);if(d.environments[0]==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let g="Base",O=r.generateName("Base");return d.environments.forEach(m=>{o[m.id]=g}),{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[{id:g,name:O},...c.environments.map(m=>({id:m.id,name:m.name}))],environments:d.environments.map(m=>({id:m.id,name:m.name,urls:{[g]:m.url,...Object.fromEntries(c.environments.map(P=>[P.id,P.url]))},docs:void 0}))})},changedBaseUrlIds1:o,changedBaseUrlIds2:b}}if(u.type==="multipleBaseUrls"&&l.type==="singleBaseUrl"||u.type==="singleBaseUrl"&&l.type==="multipleBaseUrls"){let d=u.type==="singleBaseUrl"?u:l,s=u.type==="multipleBaseUrls"?u:l,{deconflictedEnvironments1:o,changedBaseUrlIds1:c}=RiE(d,s,r);return{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[...s.baseUrls,...o.environments.map(b=>({id:b.id,name:b.name}))],environments:s.environments.map(b=>({...b,urls:{...b.urls,...Object.fromEntries(o.environments.map(g=>[g.id,g.url]))}}))})},changedBaseUrlIds1:u.type==="singleBaseUrl"?c:void 0,changedBaseUrlIds2:u.type==="singleBaseUrl"?void 0:c}}if(u.type==="multipleBaseUrls"&&l.type==="multipleBaseUrls"){let{deconflictedEnvironments:d,changedBaseUrlIds:s}=NiE(u,l,r);return{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[...u.baseUrls,...d.baseUrls],environments:u.environments.flatMap(o=>d.environments.map(c=>({...o,urls:{...o.urls,...c.urls}})))})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:s}}return{environments:e??t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0}}function IiE(e,t,r,i){if(r!=null)for(let[u,l]of Object.entries(r)){for(let d of Object.values(e.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(e.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}if(i!=null)for(let[u,l]of Object.entries(i)){for(let d of Object.values(t.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(t.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}let n={...e.services??{},...t.services??{}},a={...e.websocketChannels??{},...t.websocketChannels??{}};return{services:n,websocketChannels:a}}function ziE(e,t,r){let i={},n=new Set(e.environments.map(s=>s.id)),a=new Set(e.environments.map(s=>s.name)),u=new Map(e.environments.map(s=>[s.url,s.id])),l=t.environments.filter(s=>{let o=u.get(s.url);return o!=null?(i[s.id]=o,!1):!0}).map(s=>{if(n.has(s.id)||a.has(s.name)){let o=wXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s});return{deconflictedEnvironments2:NC.singleBaseUrl({environments:l}),changedBaseUrlIds2:i}}function RiE(e,t,r){let i={},n=new Set(t.baseUrls.map(d=>d.id)),a=new Set(t.baseUrls.map(d=>d.name)),u=e.environments.map(d=>{if(n.has(d.id)||a.has(d.name)){let s=wXs(d.id,n);return i[d.id]=s,{...d,id:s,name:r.generateName(s)}}return d});return{deconflictedEnvironments1:NC.singleBaseUrl({environments:u}),changedBaseUrlIds1:i}}function NiE(e,t,r){let i={},n=new Set(e.baseUrls.map(s=>s.id)),a=new Set(e.baseUrls.map(s=>s.name)),u=t.baseUrls.map(s=>{if(n.has(s.id)||a.has(s.name)){let o=wXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s}),l=t.environments.map(s=>({...s,urls:Object.fromEntries(Object.entries(s.urls).map(([o,c])=>[i[o]??o,c]))}));return{deconflictedEnvironments:NC.multipleBaseUrls({baseUrls:u,environments:l}),changedBaseUrlIds:i}}function ge_(e){return e.environments.type==="singleBaseUrl"?e.environments.environments.some(t=>t.url&&(t.url.startsWith("ws://")||t.url.startsWith("wss://"))):e.environments.type==="multipleBaseUrls"?e.environments.environments.some(t=>Object.values(t.urls).some(r=>r&&(r.startsWith("ws://")||r.startsWith("wss://")))):!1}function wXs(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}-${i}`,i++;return r}var og=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var Oe_={[My.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,lx(e)])),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.GenerationLanguage.SWIFT]:new Set([])};var FiE=["go","ruby"];function vDe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:LiE({name:c,keywords:UiE({generationLanguage:e,keywords:t})})}),l=L0(n),d=lx(l),s=qCi(n),o=DCi(l);return r&&(!HiE(o)&&(e==null||FiE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=UNo(c);if(g!=null)return g;if(VNo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=UNo(c);return g??(VNo(c)?c.toUpperCase():b===0?lx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(qCi).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 LiE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":WiE(e)?"_"+e:e}function UiE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Oe_[e]}var ViE=/^[0-9]/;function WiE(e){return ViE.test(e)}function HiE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=UNo(i)!=null||VNo(i),a=UNo(t)!=null||VNo(t);return n&&a})}function UNo(e){return GiE.get(e.toUpperCase())}function VNo(e){return $iE.has(e.toUpperCase())}var $iE=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"]),GiE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var bFi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.casingsGenerator=vDe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=L0(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:{allParts:[],packagePath:[],file:t.name!=null?this.casingsGenerator.generateName(t.name):void 0},service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Kd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return cJt.ReadOnly;if(r.writeOnly)return cJt.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new HG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:d5.Deprecated,message:void 0}}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t){return a_.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var mz=class extends og{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var H2={};Eo(H2,{SchemaConverters:()=>SXs});var SXs={};Eo(SXs,{ArraySchemaConverter:()=>HEn,EnumSchemaConverter:()=>LEn,ObjectSchemaConverter:()=>UEn,OneOfSchemaConverter:()=>VEn,PrimitiveSchemaConverter:()=>WEn,SchemaConverter:()=>__i,SchemaOrReferenceConverter:()=>_9t});var LEn=class extends og{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:aw.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var UEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:aw.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new _9t({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new _9t({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:aw.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(y0),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var VEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new _9t({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:rG.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:aw.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",rba(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new __i({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:aw.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var WEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?a_.container(eg.literal(LY.string(i))):a_.primitive({v1:"STRING",v2:Dv.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return a_.primitive({v1:"DOUBLE",v2:Dv.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return a_.primitive({v1:"FLOAT",v2:Dv.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return a_.primitive({v1:"INTEGER",v2:Dv.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return a_.primitive({v1:"LONG",v2:Dv.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return a_.primitive({v1:"UINT",v2:Dv.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return a_.primitive({v1:"UINT_64",v2:Dv.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return a_.primitive({v1:"INTEGER",v2:Dv.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?a_.container(eg.literal(LY.boolean(i))):a_.primitive({v1:"BOOLEAN",v2:Dv.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var __i=class extends og{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new HG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new LEn({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new WEn({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:aw.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new HEn({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:aw.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new VEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new UEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.casingsGenerator.generateName(this.id)}}};var _9t=class extends og{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new __i({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return a_.container(eg.optional(t))}wrapInNullable(t){return a_.container(eg.nullable(t))}};var HEn=class e extends og{static LIST_UNKNOWN=a_.container(eg.list(a_.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new _9t({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:a_.container(eg.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var iba=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(V0.Info,Wie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?k_.dim(t.path.join(" -> ")):void 0}))}};var HG={};Eo(HG,{FernAvailabilityExtension:()=>WNo,FernEnumExtension:()=>HNo,FernIgnoreExtension:()=>$No,SdkGroupNameExtension:()=>GNo,SdkMethodNameExtension:()=>QNo});var WNo=class extends mz{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return d5.InDevelopment;case"PRE_RELEASE":return d5.PreRelease;case"GENERAL_AVAILABILITY":return d5.GeneralAvailability;case"DEPRECATED":return d5.Deprecated;default:return}}};var QiE=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),JiE=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:QiE.optional()}),me_=Yu.record(JiE);var HNo=class extends mz{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=me_.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var $No=class extends mz{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};var GNo=class extends mz{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var QNo=class extends mz{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};function rba(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${rba(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${rba(a)}`}var h_i=class e extends og{static STRING=a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=a_.container(eg.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var JNo=class extends og{channel;channelPath;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,group:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.group=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let l;this.channel.subscribe!=null&&(l=await this.convertMessage({context:t,errorCollector:r,origin:"server",operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let d;this.channel.publish!=null&&(d=await this.convertMessage({context:t,errorCollector:r,origin:"client",operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let s=[];l!=null&&s.push(l),d!=null&&s.push(d);let o=this.channel.servers?.[0]??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:o,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:s,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,origin:i,operation:n,defaultId:a,breadcrumbName:u}){let l;if("$ref"in n.message){let d=await t.resolveReference(n.message);d.resolved&&(n.message=d.value)}if("oneOf"in n.message){let s=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:n.message,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});s!=null&&s.schema!=null&&(l=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(n.message)){let d;if(t.isReferenceObject(n.message.payload)){let s=await t.resolveReference(n.message.payload);s.resolved&&(d=s.value)}else d=n.message.payload;if(d!=null){let o=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:d,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});o!=null&&o.schema!=null&&(l=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}}if(l!=null){let d=l,s=sc.TypeReference.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:d.name.name,typeId:d.name.typeId,default:void 0,inline:!1}),o=sc.WebSocketMessageBody.reference({bodyType:s,docs:n.description});return{type:d.name.typeId,displayName:d.name.name.originalName,origin:i,body:o,availability:await t.getAvailability({node:n,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:n.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new h_i({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new h_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new h_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var KNo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.url),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:NC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var DXs="$message.",Pe_="#/channels/",je_="#/servers/",YNo=class extends og{channel;channelPath;operations;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n,group:a}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n,this.group=a}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let l=Object.entries(this.operations).reduce((o,[c,b])=>{try{this.getChannelPathFromOperation(b)===this.channelPath&&(o[c]=b)}catch{}return o},{}),d=[];for(let[o,c]of Object.entries(l))for(let b of c.messages){let g=await t.convertReferenceToTypeReference(b);if(g.ok){let O=sc.WebSocketMessageBody.reference({bodyType:g.reference,docs:c.description});d.push({type:o,displayName:o,origin:c.action==="send"?"client":"server",body:O,availability:await t.getAvailability({node:c,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:c.description})}}let s=this.resolveChannelServersFromReference(this.channel.servers??[],r)??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:s,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new h_i({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s,required:!0}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(DXs)){r.collect({message:`Invalid location format: ${t}; expected ${DXs} prefix`,path:this.breadcrumbs});return}let a=i.substring(DXs.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.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,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(je_)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(je_.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Pe_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Pe_.length)}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var XNo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.host),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:NC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var nba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)?await this.convertChannelMessages({context:t,errorCollector:r}):await this.convertComponentMessages({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...vFi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(!t.isMessageWithPayload(l)&&!t.isReferenceObject(l))continue;let d;if(t.isMessageWithPayload(l))if(t.isReferenceObject(l.payload)){let b=await t.resolveReference(l.payload);b.resolved&&(d=b.value)}else d=l.payload;else if(t.isReferenceObject(l)){let b=await t.resolveReference(l);if(b.resolved){let g=b.value.payload;if(t.isReferenceObject(g)){let O=await t.resolveReference(g);O.resolved&&(d=O.value)}else d=g}}if(d==null)continue;let s=`${n}_${u}`,c=await new H2.SchemaConverters.SchemaConverter({id:s,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});c!=null&&(this.ir.rootPackage.types.push(s),this.ir.types={...this.ir.types,...c.inlinedTypes,[s]:c.typeDeclaration})}}async convertComponentMessages({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.messages??{})){if(n.payload==null)continue;let a;if(t.isReferenceObject(n.payload)){let d=await t.resolveReference(n.payload);d.resolved&&(a=d.value)}else a=n.payload;if(a==null)continue;let l=await new H2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","messages",i],schema:a}).convert({context:t,errorCollector:r});l!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...l.inlinedTypes,[i]:l.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new H2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new XNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new KNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{})){let u=new HG.SdkGroupNameExtension({breadcrumbs:["channels",i],operation:n}).convert({context:t,errorCollector:r})?.groups;if(this.isAsyncAPIV3(t)){let d=t.spec.operations??{},o=await new YNo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:d,group:u}).convert({context:t,errorCollector:r});o!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:o.channel},this.ir.types={...this.ir.types,...o.inlinedTypes})}else{let d=await new JNo({breadcrumbs:["channels",i],channel:n,channelPath:i,group:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var aba=class extends bFi{isReferenceObject(t){return t!=null&&"$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]}async convertReferenceToTypeReference(t){let r,i=t.$ref.match(/^.*\/schemas\/(.+)$/),n=t.$ref.match(/^.*\/messages\/(.+)$/);return i&&i[1]?r=i[1]:n&&n[1]&&(r=n[1]),r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:a_.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var De_=di(EXs(),1);var TXs=di(EXs(),1);var we_=["get","post","put","delete","patch"];var ZNo=class extends mz{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var XiE=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),ZiE=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),MXs=Yu.union([Yu.boolean(),XiE,ZiE]);var AXs="$request.",kNo="$response.",eFo=class extends mz{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=MXs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.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 u=MXs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,AXs),nextCursor:r.maybeTrimPrefix(i.next_cursor,kNo),results:r.maybeTrimPrefix(i.results,kNo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,AXs),results:r.maybeTrimPrefix(n.results,kNo),step:n.step!=null?r.maybeTrimPrefix(n.step,AXs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],kNo):void 0}}};var kiE="$request.",enE=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),tnE=Yu.union([Yu.boolean(),enE]),$En=class extends mz{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=tnE.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],kiE),responseStream:n.data["response-stream"],response:n.data.response}}};var tFo=class extends mz{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var rFo=class extends mz{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var qXs="Base",GEn=class e extends og{servers;endpointLevelServers;constructor({breadcrumbs:t,servers:r,endpointLevelServers:i}){super({breadcrumbs:t}),this.servers=r,this.endpointLevelServers=i}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n={id:qXs,name:t.casingsGenerator.generateName(qXs)},a=this.endpointLevelServers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t});return{id:s,name:t.casingsGenerator.generateName(s)}}).filter((d,s,o)=>o.findIndex(c=>c.id===d.id)===s),u=[n,...a],l=this.servers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t}),o=this.endpointLevelServers?.map(c=>[e.getServerName({server:c,errorCollector:r,context:t}),this.getServerUrl(c)]);return{id:s,name:t.casingsGenerator.generateName(s),urls:{[qXs]:this.getServerUrl(d),...Object.fromEntries(o??[])},docs:d.description}});return{value:{defaultEnvironment:l[0]?.id,environments:NC.multipleBaseUrls({baseUrls:u,environments:l})},defaultUrl:e.getServerName({server:this.servers[0],errorCollector:r,context:t})}}let i=this.servers.map(n=>{let a=e.getServerName({server:n,context:t,errorCollector:r});return{id:a,name:t.casingsGenerator.generateName(a),url:this.getServerUrl(n),docs:n.description}}).filter(y0);return{value:{defaultEnvironment:i[0]?.id,environments:NC.singleBaseUrl({environments:i})}}}static getServerName({server:t,context:r,errorCollector:i}){return new rFo({breadcrumbs:[],server:t}).convert({context:r,errorCollector:i})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var oba=class e extends og{static STRING=a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=a_.container(eg.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var iFo=class extends og{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:pI.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:pI.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:pI.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?aF.file(QU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?aF.file(QU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?aF.file(QU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?aF.file(QU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?aF.file(QU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):aF.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var nFo=class extends og{responseBody;group;method;statusCode;streamingExtension;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a,streamingExtension:u}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a,this.streamingExtension=u}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(a=>a.includes("json"));for(let a of[...i]){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&a.includes("json"))return{responseBody:JA.json(MSe.response({responseBodyType:u.convertedSchema.type,docs:this.responseBody.description})),inlinedTypes:u.convertedSchema.inlinedTypes,examples:u.examples}}let n=Object.keys(this.responseBody.content).filter(a=>!a.includes("json"));for(let a of n){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&this.isBinarySchema(u.convertedSchema))return t.settings?.useBytesForBinaryResponse&&this.streamingExtension==null?{responseBody:JA.bytes({docs:this.responseBody.description}),inlinedTypes:{}}:{responseBody:JA.fileDownload({docs:this.responseBody.description}),inlinedTypes:{}}}}async parseMediaTypeObject({context:t,errorCollector:r,contentType:i}){let n=this.responseBody.content?.[i];if(n==null||n.schema==null)return;let a=[...this.group,this.method,"Response",this.statusCode].join("_"),l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:n.schema,schemaIdOverride:a}).convert({context:t,errorCollector:r});if(l==null)return;let d=n.examples!=null?Object.fromEntries(await Promise.all(Object.entries(n.examples).map(async([s,o])=>[s,t.isReferenceObject(o)?await t.resolveReference(o):o]))):void 0;return{convertedSchema:l,examples:d}}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}}};var rnE=/{([^}]+)}/g,QEn=class extends og{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return b7.Get;case"post":return b7.Post;case"put":return b7.Put;case"delete":return b7.Delete;case"patch":return b7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new oba({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll(rnE)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:oba.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new iFo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a,streamingExtension:u}){if(this.operation.responses!=null)for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(isNaN(s)||s<200||s>=300)continue;let o;if(t.isReferenceObject(d)){let g=await t.resolveReference(d);g.resolved&&(o=g.value)}else o=d;if(o==null)continue;let b=await new nFo({breadcrumbs:[...i,l],responseBody:o,group:n??[],method:a,statusCode:l,streamingExtension:u}).convert({context:t,errorCollector:r});if(b!=null)return this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},{value:{statusCode:s,body:b.responseBody},examples:b.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new HG.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new HG.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?L0(this.operation.summary):L0(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=Se_(i),u=Se_(n);return oSe(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:L0(u.join("_"))}}};function Se_(e){let t=inE(e)?nnE(e):anE(e);return t=t.map(r=>r.toLowerCase()),t=NBe(t),t}function inE(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function nnE(e){return e.split(/(?=[A-Z])/)}function anE(e){return e.split(/[^a-zA-Z0-9]+/)}var aFo=class extends QEn{idempotent;servers;streamingExtensionConverter;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a,servers:u}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a,this.servers=u,this.streamingExtensionConverter=new $En({breadcrumbs:this.breadcrumbs,operation:this.operation})}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=this.streamingExtensionConverter.convert({context:t,errorCollector:r}),{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),c=o?.value,b=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a,streamingExtension:u}),g=this.operation.servers?.[0]??this.servers?.[0]??t.spec.servers?.[0];return{group:n,endpoint:{id:`${n?.join(".")??""}.${a}`,displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:g!=null?GEn.getServerName({server:g,context:t,errorCollector:r}):void 0,path:LV(this.path),pathParameters:d,queryParameters:s,headers:l,requestBody:c,sdkRequest:void 0,response:b?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:LV(this.path),allPathParameters:d,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes,servers:this.operation.servers}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var JEn=class extends QEn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=YU.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=YU.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var oFo=class extends og{pathItem;path;servers;constructor({breadcrumbs:t,pathItem:r,path:i,servers:n}){super({breadcrumbs:t}),this.pathItem=r,this.path=i,this.servers=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of we_){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new $En({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new tFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new JEn({breadcrumbs:i,operation:t,method:TXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new eFo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new ZNo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new aFo({breadcrumbs:i,operation:t,method:TXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var uFo=class extends og{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return FR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return FR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:a_.container(eg.optional(a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var uba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertWebhooks({context:t,errorCollector:r});let{endpointLevelServers:i}=await this.convertPaths({context:t,errorCollector:r});this.convertServers({context:t,errorCollector:r,endpointLevelServers:i});let n={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return n={...n,...vFi({ir:n,exampleGeneration:{disabled:!1}})},n}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new uFo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r,endpointLevelServers:i}){let a=new GEn({breadcrumbs:["servers"],servers:t.spec.servers,endpointLevelServers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a.value)}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new H2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertWebhooks({context:t,errorCollector:r}){let i={};for(let[,n]of Object.entries(t.spec.webhooks??{})){if(n==null||!("post"in n)||!n.post?.operationId)continue;let a=n.post.operationId,l=await new JEn({breadcrumbs:["webhooks",a],operation:n.post,method:De_.OpenAPIV3.HttpMethods.POST,path:a}).convert({context:t,errorCollector:r});if(l!=null){let d=l.group?.join(".")??a;i[d]==null&&(i[d]=[]),i[d].push(a),this.ir.webhookGroups[d]==null&&(this.ir.webhookGroups[d]=[]),this.ir.webhookGroups[d].push(l.webhook),this.ir.types={...this.ir.types,...l.inlinedTypes}}}}async convertPaths({context:t,errorCollector:r}){let i={},n=[];for(let[a,u]of Object.entries(t.spec.paths??{})){if(u==null)continue;let d=await new oFo({breadcrumbs:["paths",a],pathItem:u,path:a,servers:t.spec.servers}).convert({context:t,errorCollector:r});if(d!=null){for(let s of d.endpoints){let o=s.group?.join(".")??"";i[o]==null&&(i[o]=[]),i[o].push(s.endpoint),s.servers&&s.servers[0]!=null&&n.push(s.servers[0])}for(let s of d.webhooks){let o=s.group?.join(".")??"";this.ir.webhookGroups[o]==null&&(this.ir.webhookGroups[o]=[]),this.ir.webhookGroups[o].push(s.webhook)}this.ir.types={...this.ir.types,...d.inlinedTypes}}}return this.addServicesToIr({groupToEndpoints:i,context:t}),this.addWebhookGroupsToIr({webhookGroups:this.ir.webhookGroups,context:t}),{endpointLevelServers:n}}addServicesToIr({groupToEndpoints:t,context:r}){for(let[i,n]of Object.entries(t)){let a=i.split(".").map(l=>r.casingsGenerator.generateName(l)),u=a[a.length-1]??r.casingsGenerator.generateName("");this.ir.services[i]={name:{fernFilepath:{allParts:a,packagePath:a.slice(0,-1),file:u}},displayName:void 0,basePath:LV(""),headers:[],pathParameters:[],availability:void 0,endpoints:n,transport:void 0,encoding:void 0},i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].service=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.service=i}}addWebhookGroupsToIr({webhookGroups:t,context:r}){for(let[i,n]of Object.entries(t))this.ir.webhookGroups[i]=n,i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].webhooks=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.webhooks=i}};var sba=class extends bFi{isReferenceObject(t){return t!=null&&"$ref"in t}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:a_.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var Ee_={[My.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,lx(e)])),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.GenerationLanguage.SWIFT]:new Set([])};var onE=["go","ruby"];function Me_({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:unE({name:c,keywords:snE({generationLanguage:e,keywords:t})})}),l=L0(n),d=lx(l),s=qCi(n),o=DCi(l);return r&&(!fnE(o)&&(e==null||onE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=sFo(c);if(g!=null)return g;if(cFo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=sFo(c);return g??(cFo(c)?c.toUpperCase():b===0?lx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(qCi).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 unE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":lnE(e)?"_"+e:e}function snE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Ee_[e]}var cnE=/^[0-9]/;function lnE(e){return cnE.test(e)}function fnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=sFo(i)!=null||cFo(i),a=sFo(t)!=null||cFo(t);return n&&a})}function sFo(e){return pnE.get(e.toUpperCase())}function cFo(e){return dnE.has(e.toUpperCase())}var dnE=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"]),pnE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var $7=class extends jha{specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new f9t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await Jze({context:t,specs:this.specs,relativePathToDependency:r});return GNi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:i?.useBytesForBinaryResponse??this.useBytesForBinaryResponse}})}async getIntermediateRepresentation({context:t}){let r=await Jze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new iba({logger:t.logger}),l;if(a.type==="openapi"){let s=new sba({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new uba({context:s}).convert({context:s,errorCollector:u})}else if(a.type==="asyncapi"){let s=new aba({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new nba({context:s}).convert({context:s,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors());let d=Me_({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});l!=null&&(n=n===void 0?l:jXs(n,l,d))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new oDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(y0)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:Tie(),absoluteFilePath:u})),n},i)}};var Ae_={None:"none",Header:"header"};var CFo={};Eo(CFo,{ConjureAliasDeclaration:()=>yFo,ConjureArgument:()=>AFo,ConjureArgumentWithParamType:()=>MFo,ConjureAuthDefinition:()=>ZEn,ConjureAuthDefinitionType:()=>DFo,ConjureDefinitions:()=>wFo,ConjureEndpointDefinition:()=>qFo,ConjureEnumDeclaration:()=>PFo,ConjureEnumVariant:()=>mFo,ConjureEnumWithDocs:()=>OFo,ConjureObjectDeclaration:()=>gFo,ConjureParamType:()=>EFo,ConjurePrimitive:()=>hFo,ConjureService:()=>TFo,ConjureServiceName:()=>_Fo,ConjureType:()=>g_i,ConjureTypeDeclaration:()=>jFo,ConjureTypeReference:()=>O_i,ConjureTypeWithDocs:()=>vFo,ConjureTypes:()=>SFo,ConjureUnionDeclaration:()=>bFo,DefinitionFile:()=>it_,WithDocs:()=>lZt,commons:()=>zXs,conjure:()=>RXs,services:()=>NXs,types:()=>FXs});var zXs={};Eo(zXs,{WithDocs:()=>lZt});var kd={};Eo(kd,{JsonError:()=>KEn,ParseError:()=>YEn,any:()=>He_,bigint:()=>Te_,boolean:()=>$e_,booleanLiteral:()=>We_,date:()=>Ce_,discriminant:()=>et_,enum_:()=>fFo,getObjectLikeUtils:()=>h9t,getObjectUtils:()=>gFi,getSchemaUtils:()=>tq,isProperty:()=>b_i,lazy:()=>Be_,lazyObject:()=>Le_,list:()=>pFo,number:()=>Ge_,object:()=>dFo,objectWithoutOptionalProperties:()=>Fe_,optional:()=>CXs,property:()=>Ie_,record:()=>Ye_,set:()=>Xe_,string:()=>Qe_,stringLiteral:()=>Ve_,transform:()=>BXs,undiscriminatedUnion:()=>ke_,union:()=>rt_,unknown:()=>Je_,withParsedProperties:()=>IXs});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 BM(e,t){return`Expected ${t}. Received ${_nE(e)}.`}function _nE(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 V5(e){return{...e,json:qe_(e.json),parse:qe_(e.parse)}}function qe_(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(`
1956
+ `}async function Jze({context:e,specs:t,relativePathToDependency:r}){let i=new TRo({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=>OeE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function OeE({generator:e,protobufSpec:t,relativePathToDependency:r}){return{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 Kkp=require("fs"),IEn=require("fs/promises");var Ykp=require("os"),Xkp=di(require("path"),1),Zkp=require("stream/promises"),kkp=di(FNo(),1),ee_=di(ore(),1);var hXs=di(Hxi(),1);var uP;(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"})(uP||(uP={}));var YrE=oJr();async function te_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:uP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:uP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${iiE(s)}`},async o=>{switch(s.type){case"version":l=await tiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await eiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var re_="dependencies";var XrE="metadata.json",ZrE=".fern";function krE(e){return es(Wl.of((0,Ykp.homedir)()),uo.of(ZrE),uo.of(re_),uo.of(e.organization),uo.of(e.apiName),uo.of(e.version))}async function eiE({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:uo.of(e.path)},i);return t.logger.info("Loaded..."),u}async function tiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=krE(e),u=es(a,uo.of(re_)),l=es(a,uo.of(XrE)),d;if(!await Cf(u)||!await Cf(l)){t.logger.info("Downloading manifest...");let c=await YrE.definitionRegistry.get(hXs.FernFiddle.OrganizationId(e.organization),hXs.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=iNi(r),O=iNi(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,IEn.mkdir)(u,{recursive:!0});try{await riE({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,IEn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,IEn.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 riE({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await QR.get(e,{responseType:"stream"}),i=await ee_.default.dir(),n=Xkp.default.join(i.path,"api.tgz");await(0,Zkp.pipeline)(r.data,(0,Kkp.createWriteStream)(n)),await(0,kkp.extract)({file:n,cwd:t})}function iiE(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var he_=di(se_(),1);function LNo(e,t){for(let[r,i]of $N(e))aiE({relativeFilepath:r,failure:i,logger:t})}function aiE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case uP.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 uP.FILE_READ:r.error("Failed to open file: "+e);break;case uP.FILE_MISSING:r.error("Missing file: "+e);break;case uP.FILE_PARSE:t.error instanceof Vaa?r.error(Wie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case uP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of oiE(i))r.error(Wie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case uP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case uP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${zZa}: `+t.dependencyName);break;case uP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case uP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case uP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Wie({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(Wie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function oiE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var ce_=require("fs/promises");async function le_(e,t){let r=[];for(let i of await XBe(e,t))r.push(await uiE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function uiE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,ce_.readFile)(t)).toString()}}async function fe_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Kd.load(n.fileContents,{schema:Kd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:uP.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 de_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all($N(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(jY(b)>0)d[s]={type:uP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=_p(s);if(W4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:uP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await te_({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[_p(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),jY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var pe_=di(require("path"),1);var bXs={};Eo(bXs,{additionalProperties:()=>fiE,default:()=>piE,definitions:()=>diE,properties:()=>ciE,required:()=>liE,type:()=>siE});var siE="object",ciE={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"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},liE=["name"],fiE=!1,diE={"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}},piE={type:siE,properties:ciE,required:liE,additionalProperties:fiE,definitions:diE};var gXs={};Eo(gXs,{additionalProperties:()=>yiE,default:()=>biE,definitions:()=>viE,properties:()=>hiE,type:()=>_iE});var _iE="object",hiE={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"}]}},yiE=!1,viE={"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"]},"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}},biE={type:_iE,properties:hiE,additionalProperties:yiE,definitions:viE};var OXs={};Eo(OXs,{additionalProperties:()=>miE,default:()=>jiE,definitions:()=>PiE,properties:()=>OiE,type:()=>giE});var giE="object",OiE={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"}]}},miE=!1,PiE={"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"]},"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"}]}},jiE={type:giE,properties:OiE,additionalProperties:miE,definitions:PiE};function _e_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of $N(e)){let d=l.contents,s=o=>{a[u]={type:uP.JSONSCHEMA_VALIDATION,error:o}};if(u===QN){let o=nQr(d,bXs);if(o.success){let c=S2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(pe_.default.basename(u)===iS){let o=nQr(d,OXs);if(o.success){let c=S2.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=nQr(d,gXs);if(o.success){let c=S2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:es(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[uo.of(QN)]:{type:uP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var p_i=class extends Y5t{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,he_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=es(this.absoluteFilePath,uo.of(X8)),l=await Ybs({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await le_(u,"{yml,yaml}"),s=await fe_(d);if(!s.didSucceed)return LNo(s.failures,a.logger),a.failAndThrow();let o=_e_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return LNo(o.failures,a.logger),a.failAndThrow();let c=await de_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return LNo(c.failures,a.logger),a.failAndThrow();n=new oDe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function LV(e){let t=SiE(e),{value:r,done:i}=mXs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...wiE(t)]}}function*wiE(e){let t;do{let{value:r}=mXs(e,"}"),i=mXs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*SiE(e){for(let t of e)yield t}function mXs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function eba(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function ye_({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return cZt({containerType:t});switch(t.type){case"list":{let u=uC({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:QO.literal({literal:t.literal._visit({boolean:u=>Cd.boolean(u),string:u=>Cd.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return cZt({containerType:t});let u=uC({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return cZt({containerType:t});let u=uC({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=uC({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=uC({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=uC({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?cZt({containerType:t}):{type:"success",example:QO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function cZt({containerType:e}){switch(e.type){case"list":return{type:"success",example:QO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:QO.literal({literal:e.literal._visit({boolean:t=>Cd.boolean(t),string:t=>Cd.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:QO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:QO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:QO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:QO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function be_({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return AiE({fieldName:e,validation:DiE(t.v2)});case"BASE_64":return{type:"success",example:Cd.base64(Ey.BASE64),jsonExample:Ey.BASE64};case"BOOLEAN":return{type:"success",example:Cd.boolean(Ey.BOOLEAN),jsonExample:Ey.BOOLEAN};case"DATE":return{type:"success",example:Cd.date(Ey.DATE),jsonExample:Ey.DATE};case"DATE_TIME":return{type:"success",example:Cd.datetime({datetime:new Date(Ey.DATE_TIME),raw:Ey.DATE_TIME}),jsonExample:Ey.DATE_TIME};case"DOUBLE":return qiE({fieldName:e,validation:EiE(t.v2)});case"FLOAT":return{type:"success",example:Cd.float(Ey.FLOAT),jsonExample:Ey.FLOAT};case"INTEGER":return TiE({fieldName:e,validation:MiE(t.v2)});case"UINT_64":return{type:"success",example:Cd.uint64(Ey.INT64),jsonExample:Ey.INT64};case"UINT":return{type:"success",example:Cd.uint(Ey.UINT),jsonExample:Ey.UINT};case"BIG_INTEGER":return{type:"success",example:Cd.bigInteger(Ey.INT64.toString()),jsonExample:`${Ey.INT64}`};case"LONG":return{type:"success",example:Cd.long(Ey.INT64),jsonExample:Ey.INT64};case"UUID":return{type:"success",example:Cd.uuid(Ey.UUID),jsonExample:Ey.UUID};default:Fo(t.v1)}}function DiE(e){if(e?.type==="string")return e.validation}function EiE(e){if(e?.type==="double")return e.validation}function MiE(e){if(e?.type==="integer")return e.validation}function ve_(e){if(e<=Ey.SAMPLE_STRINGS.length){let t=Ey.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return Ey.SAMPLE_STRINGS[Ey.SAMPLE_STRINGS.length-1]+".".repeat(e-Ey.SAMPLE_STRINGS.length)}function AiE({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=ve_(i);return{type:"success",example:Cd.string({original:a}),jsonExample:a}}else if(n){let a=ve_(n);return{type:"success",example:Cd.string({original:a}),jsonExample:a}}}let r=e??Ey.STRING;return{type:"success",example:Cd.string({original:r}),jsonExample:r}}function qiE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Cd.double(r),jsonExample:r};if(i)return{type:"success",example:Cd.double(i),jsonExample:i}}return{type:"success",example:Cd.double(Ey.DOUBLE),jsonExample:Ey.DOUBLE}}function TiE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Cd.integer(r),jsonExample:r};if(i)return{type:"success",example:Cd.integer(i),jsonExample:i}}return{type:"success",example:Cd.integer(Ey.INT),jsonExample:Ey.INT}}function uC({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=NEn({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:mh.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=ye_({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=cZt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:mh.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:mh.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=be_({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:mh.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:mh.unknown(u)},jsonExample:u}}}}function FEn({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function NEn({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=uC({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:ow.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:ow.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=NEn({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=CiE({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:ow.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=uC({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:ow.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=uC({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=NEn({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=uC({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:oF.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function CiE({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=uC({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!FEn({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:ow.object({properties:d}),jsonExample:l}}var PXs=a_.primitive({v1:b0.String,v2:Dv.string({default:void 0,validation:void 0})});function tba({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Wq.ok(nC.body(void 0)),docs:void 0},l=[{params:t.pathParameters,add:s=>u.endpointPathParameters.push(s)},{params:r.pathParameters,add:s=>u.servicePathParameters.push(s)},{params:e.pathParameters,add:s=>u.rootPathParameters.push(s)}];for(let s of l)for(let o of s.params){let c=uC({fieldName:o.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}for(let s of t.queryParameters){if(n&&FEn({typeDeclarations:i,typeReference:s.valueType}))continue;let o=uC({fieldName:s.name.name.originalName,currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:s.valueType,skipOptionalProperties:n});if(o.type==="failure")return o;let{example:c}=o;u.queryParameters.push({name:s.name,shape:s.allowMultiple?D2.exploded():D2.single(),value:c})}let d=[{params:t.headers,add:s=>u.endpointHeaders.push(s)},{params:r.headers,add:s=>u.serviceHeaders.push(s)}];for(let s of d)for(let o of s.params){if(n&&FEn({typeDeclarations:i,typeReference:o.valueType}))continue;let c=uC({fieldName:o.name.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}if(t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let s={},o=[];if(t.requestBody.extends!=null)for(let c of t.requestBody.extends){let b=i[c.typeId];if(b==null)throw new Error(`Failed to find extended type declaration with id ${c.typeId}`);let g=NEn({typeDeclaration:b,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});g!=null&&g.type==="success"&&Object.assign(s,g.jsonExample)}for(let c of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let b=uC({fieldName:c.name.wireValue,typeReference:c.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(b.type==="failure"&&!FEn({typeDeclarations:i,typeReference:c.valueType}))return{type:"failure",message:`Failed to generate required property ${c.name.wireValue} b/c ${b.message}`};if(b.type==="failure")continue;let{example:g,jsonExample:O}=b;o.push({name:c.name,originalTypeDeclaration:void 0,value:g}),s[c.name.wireValue]=O}u.request=tG.inlinedRequestBody({jsonExample:s,properties:o});break}case"reference":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.request=tG.reference(o);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"streamParameter":{let s;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"streaming":{let s;switch(t.response.body.value.type){case"sse":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.sse([{data:{...o,jsonExample:c},event:""}]));break}case"json":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.stream([{...o,jsonExample:c}]));break}case"text":{if(s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.stream([{...o,jsonExample:c}]));break}default:Fo(t.response.body.value)}break}case"text":{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:PXs,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Wq.ok(nC.body({...o,jsonExample:c}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Wq.error({body:void 0,error:a.declaration.name});else{let s=uC({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.response=Wq.error({body:o,error:a.declaration.name})}try{return{type:"success",example:{id:eba(u),url:BiE(t,u),...u},jsonExample:void 0}}catch(s){return{type:"failure",message:`Parse failure with exceptions ${s}`}}}function BiE(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function vFi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=tba({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}return e}function jXs(e,t,r){let{environments:i,changedBaseUrlIds1:n,changedBaseUrlIds2:a}=xiE(e.environments,t.environments,r),{services:u,websocketChannels:l}=IiE(e,t,n,a);return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:i,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:u,webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:l,rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}function xiE(e,t,r){if(e==null&&t==null)return{environments:void 0,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(t==null)return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(e==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(JSON.stringify(e)===JSON.stringify(t))return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let i=ge_(e),n=ge_(t);if(i&&n&&e.environments.type==="singleBaseUrl"&&t.environments.type==="singleBaseUrl")return{environments:{defaultEnvironment:e.defaultEnvironment??t.defaultEnvironment,environments:NC.singleBaseUrl({environments:[...e.environments.environments,...t.environments.environments]})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let a=i?t.defaultEnvironment:e.defaultEnvironment,u=e.environments,l=t.environments;if(u.type==="singleBaseUrl"&&l.type==="singleBaseUrl"){let d=i?l:u,s=i?u:l,o={},{deconflictedEnvironments2:c,changedBaseUrlIds2:b}=ziE(d,s,r);if(d.environments[0]==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let g="Base",O=r.generateName("Base");return d.environments.forEach(m=>{o[m.id]=g}),{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[{id:g,name:O},...c.environments.map(m=>({id:m.id,name:m.name}))],environments:d.environments.map(m=>({id:m.id,name:m.name,urls:{[g]:m.url,...Object.fromEntries(c.environments.map(P=>[P.id,P.url]))},docs:void 0}))})},changedBaseUrlIds1:o,changedBaseUrlIds2:b}}if(u.type==="multipleBaseUrls"&&l.type==="singleBaseUrl"||u.type==="singleBaseUrl"&&l.type==="multipleBaseUrls"){let d=u.type==="singleBaseUrl"?u:l,s=u.type==="multipleBaseUrls"?u:l,{deconflictedEnvironments1:o,changedBaseUrlIds1:c}=RiE(d,s,r);return{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[...s.baseUrls,...o.environments.map(b=>({id:b.id,name:b.name}))],environments:s.environments.map(b=>({...b,urls:{...b.urls,...Object.fromEntries(o.environments.map(g=>[g.id,g.url]))}}))})},changedBaseUrlIds1:u.type==="singleBaseUrl"?c:void 0,changedBaseUrlIds2:u.type==="singleBaseUrl"?void 0:c}}if(u.type==="multipleBaseUrls"&&l.type==="multipleBaseUrls"){let{deconflictedEnvironments:d,changedBaseUrlIds:s}=NiE(u,l,r);return{environments:{defaultEnvironment:a,environments:NC.multipleBaseUrls({baseUrls:[...u.baseUrls,...d.baseUrls],environments:u.environments.flatMap(o=>d.environments.map(c=>({...o,urls:{...o.urls,...c.urls}})))})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:s}}return{environments:e??t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0}}function IiE(e,t,r,i){if(r!=null)for(let[u,l]of Object.entries(r)){for(let d of Object.values(e.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(e.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}if(i!=null)for(let[u,l]of Object.entries(i)){for(let d of Object.values(t.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(t.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}let n={...e.services??{},...t.services??{}},a={...e.websocketChannels??{},...t.websocketChannels??{}};return{services:n,websocketChannels:a}}function ziE(e,t,r){let i={},n=new Set(e.environments.map(s=>s.id)),a=new Set(e.environments.map(s=>s.name)),u=new Map(e.environments.map(s=>[s.url,s.id])),l=t.environments.filter(s=>{let o=u.get(s.url);return o!=null?(i[s.id]=o,!1):!0}).map(s=>{if(n.has(s.id)||a.has(s.name)){let o=wXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s});return{deconflictedEnvironments2:NC.singleBaseUrl({environments:l}),changedBaseUrlIds2:i}}function RiE(e,t,r){let i={},n=new Set(t.baseUrls.map(d=>d.id)),a=new Set(t.baseUrls.map(d=>d.name)),u=e.environments.map(d=>{if(n.has(d.id)||a.has(d.name)){let s=wXs(d.id,n);return i[d.id]=s,{...d,id:s,name:r.generateName(s)}}return d});return{deconflictedEnvironments1:NC.singleBaseUrl({environments:u}),changedBaseUrlIds1:i}}function NiE(e,t,r){let i={},n=new Set(e.baseUrls.map(s=>s.id)),a=new Set(e.baseUrls.map(s=>s.name)),u=t.baseUrls.map(s=>{if(n.has(s.id)||a.has(s.name)){let o=wXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s}),l=t.environments.map(s=>({...s,urls:Object.fromEntries(Object.entries(s.urls).map(([o,c])=>[i[o]??o,c]))}));return{deconflictedEnvironments:NC.multipleBaseUrls({baseUrls:u,environments:l}),changedBaseUrlIds:i}}function ge_(e){return e.environments.type==="singleBaseUrl"?e.environments.environments.some(t=>t.url&&(t.url.startsWith("ws://")||t.url.startsWith("wss://"))):e.environments.type==="multipleBaseUrls"?e.environments.environments.some(t=>Object.values(t.urls).some(r=>r&&(r.startsWith("ws://")||r.startsWith("wss://")))):!1}function wXs(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}-${i}`,i++;return r}var og=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var Oe_={[My.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,lx(e)])),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.GenerationLanguage.SWIFT]:new Set([])};var FiE=["go","ruby"];function vDe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:LiE({name:c,keywords:UiE({generationLanguage:e,keywords:t})})}),l=L0(n),d=lx(l),s=qCi(n),o=DCi(l);return r&&(!HiE(o)&&(e==null||FiE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=UNo(c);if(g!=null)return g;if(VNo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=UNo(c);return g??(VNo(c)?c.toUpperCase():b===0?lx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(qCi).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 LiE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":WiE(e)?"_"+e:e}function UiE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Oe_[e]}var ViE=/^[0-9]/;function WiE(e){return ViE.test(e)}function HiE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=UNo(i)!=null||VNo(i),a=UNo(t)!=null||VNo(t);return n&&a})}function UNo(e){return GiE.get(e.toUpperCase())}function VNo(e){return $iE.has(e.toUpperCase())}var $iE=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"]),GiE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var bFi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;namespace;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.namespace=t.namespace,this.casingsGenerator=vDe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=L0(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:this.createFernFilepath(t),service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}createFernFilepath(t={}){let r=this.namespace!=null?[this.casingsGenerator.generateName(this.namespace)]:[],i=t.name!=null?this.casingsGenerator.generateName(t.name):void 0;return{allParts:i?[...r,i]:r,packagePath:r,file:i}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Kd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return cJt.ReadOnly;if(r.writeOnly)return cJt.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new HG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:d5.Deprecated,message:void 0}}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t){return a_.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var mz=class extends og{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var H2={};Eo(H2,{SchemaConverters:()=>SXs});var SXs={};Eo(SXs,{ArraySchemaConverter:()=>HEn,EnumSchemaConverter:()=>LEn,ObjectSchemaConverter:()=>UEn,OneOfSchemaConverter:()=>VEn,PrimitiveSchemaConverter:()=>WEn,SchemaConverter:()=>__i,SchemaOrReferenceConverter:()=>_9t});var LEn=class extends og{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:aw.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var UEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:aw.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new _9t({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new _9t({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:aw.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(y0),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var VEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new _9t({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:rG.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:aw.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",rba(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new __i({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:aw.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var WEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?a_.container(eg.literal(LY.string(i))):a_.primitive({v1:"STRING",v2:Dv.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return a_.primitive({v1:"DOUBLE",v2:Dv.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return a_.primitive({v1:"FLOAT",v2:Dv.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return a_.primitive({v1:"INTEGER",v2:Dv.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return a_.primitive({v1:"LONG",v2:Dv.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return a_.primitive({v1:"UINT",v2:Dv.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return a_.primitive({v1:"UINT_64",v2:Dv.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return a_.primitive({v1:"INTEGER",v2:Dv.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?a_.container(eg.literal(LY.boolean(i))):a_.primitive({v1:"BOOLEAN",v2:Dv.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var __i=class extends og{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new HG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new LEn({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new WEn({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:aw.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new HEn({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:aw.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new VEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new UEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:t.createFernFilepath(),name:t.casingsGenerator.generateName(this.id)}}};var _9t=class extends og{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new __i({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return a_.container(eg.optional(t))}wrapInNullable(t){return a_.container(eg.nullable(t))}};var HEn=class e extends og{static LIST_UNKNOWN=a_.container(eg.list(a_.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new _9t({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:a_.container(eg.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var iba=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(V0.Info,Wie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?k_.dim(t.path.join(" -> ")):void 0}))}};var HG={};Eo(HG,{FernAvailabilityExtension:()=>WNo,FernEnumExtension:()=>HNo,FernIgnoreExtension:()=>$No,SdkGroupNameExtension:()=>GNo,SdkMethodNameExtension:()=>QNo});var WNo=class extends mz{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return d5.InDevelopment;case"PRE_RELEASE":return d5.PreRelease;case"GENERAL_AVAILABILITY":return d5.GeneralAvailability;case"DEPRECATED":return d5.Deprecated;default:return}}};var QiE=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),JiE=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:QiE.optional()}),me_=Yu.record(JiE);var HNo=class extends mz{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=me_.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var $No=class extends mz{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};var GNo=class extends mz{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var QNo=class extends mz{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};function rba(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${rba(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${rba(a)}`}var h_i=class e extends og{static STRING=a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=a_.container(eg.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var JNo=class extends og{channel;channelPath;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,group:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.group=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let l;this.channel.subscribe!=null&&(l=await this.convertMessage({context:t,errorCollector:r,origin:"server",operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let d;this.channel.publish!=null&&(d=await this.convertMessage({context:t,errorCollector:r,origin:"client",operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let s=[];l!=null&&s.push(l),d!=null&&s.push(d);let o=this.channel.servers?.[0]??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:o,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:s,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,origin:i,operation:n,defaultId:a,breadcrumbName:u}){let l;if(t.isReferenceObject(n.message)){let d=await t.resolveReference(n.message);d.resolved&&(n.message=d.value)}if("oneOf"in n.message){let s=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:n.message,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});s!=null&&s.schema!=null&&(l=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(n.message)){let d;if(t.isReferenceObject(n.message.payload)){let s=await t.resolveReference(n.message.payload);s.resolved&&(d=s.value)}else d=n.message.payload;if(d!=null){let o=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:d,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});o!=null&&o.schema!=null&&(l=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}}if(l!=null){let d=l,s=sc.TypeReference.named({fernFilepath:t.createFernFilepath(),name:d.name.name,typeId:d.name.typeId,default:void 0,inline:!1}),o=sc.WebSocketMessageBody.reference({bodyType:s,docs:n.description});return{type:d.name.typeId,displayName:d.name.name.originalName,origin:i,body:o,availability:await t.getAvailability({node:n,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:n.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new h_i({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new h_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new h_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var KNo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.url),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:NC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var DXs="$message.",Pe_="#/channels/",je_="#/servers/",YNo=class extends og{channel;channelPath;operations;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n,group:a}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n,this.group=a}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let l=Object.entries(this.operations).reduce((o,[c,b])=>{try{this.getChannelPathFromOperation(b)===this.channelPath&&(o[c]=b)}catch{}return o},{}),d=[];for(let[o,c]of Object.entries(l))for(let b of c.messages){let g=await t.convertReferenceToTypeReference(b);if(g.ok){let O=sc.WebSocketMessageBody.reference({bodyType:g.reference,docs:c.description});d.push({type:o,displayName:o,origin:c.action==="send"?"client":"server",body:O,availability:await t.getAvailability({node:c,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:c.description})}}let s=this.resolveChannelServersFromReference(this.channel.servers??[],r)??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:s,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new h_i({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s,required:!0}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(DXs)){r.collect({message:`Invalid location format: ${t}; expected ${DXs} prefix`,path:this.breadcrumbs});return}let a=i.substring(DXs.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.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,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(je_)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(je_.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Pe_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Pe_.length)}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var XNo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.host),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:NC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var nba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)?await this.convertChannelMessages({context:t,errorCollector:r}):await this.convertComponentMessages({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...vFi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(!t.isMessageWithPayload(l)&&!t.isReferenceObject(l))continue;let d;if(t.isMessageWithPayload(l))if(t.isReferenceObject(l.payload)){let b=await t.resolveReference(l.payload);b.resolved&&(d=b.value)}else d=l.payload;else if(t.isReferenceObject(l)){let b=await t.resolveReference(l);if(b.resolved){let g=b.value.payload;if(t.isReferenceObject(g)){let O=await t.resolveReference(g);O.resolved&&(d=O.value)}else d=g}}if(d==null)continue;let s=`${n}_${u}`,c=await new H2.SchemaConverters.SchemaConverter({id:s,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});c!=null&&(this.ir.rootPackage.types.push(s),this.ir.types={...this.ir.types,...c.inlinedTypes,[s]:c.typeDeclaration})}}async convertComponentMessages({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.messages??{})){if(n.payload==null)continue;let a;if(t.isReferenceObject(n.payload)){let d=await t.resolveReference(n.payload);d.resolved&&(a=d.value)}else a=n.payload;if(a==null)continue;let l=await new H2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","messages",i],schema:a}).convert({context:t,errorCollector:r});l!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...l.inlinedTypes,[i]:l.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new H2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new XNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new KNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{})){let u=new HG.SdkGroupNameExtension({breadcrumbs:["channels",i],operation:n}).convert({context:t,errorCollector:r})?.groups;if(this.isAsyncAPIV3(t)){let d=t.spec.operations??{},o=await new YNo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:d,group:u}).convert({context:t,errorCollector:r});o!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:o.channel},this.ir.types={...this.ir.types,...o.inlinedTypes})}else{let d=await new JNo({breadcrumbs:["channels",i],channel:n,channelPath:i,group:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var aba=class extends bFi{isReferenceObject(t){return t!=null&&"$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]}async convertReferenceToTypeReference(t){let r,i=t.$ref.match(/^.*\/schemas\/(.+)$/),n=t.$ref.match(/^.*\/messages\/(.+)$/);return i&&i[1]?r=i[1]:n&&n[1]&&(r=n[1]),r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:a_.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var De_=di(EXs(),1);var TXs=di(EXs(),1);var we_=["get","post","put","delete","patch"];var ZNo=class extends mz{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var XiE=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),ZiE=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),MXs=Yu.union([Yu.boolean(),XiE,ZiE]);var AXs="$request.",kNo="$response.",eFo=class extends mz{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=MXs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.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 u=MXs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,AXs),nextCursor:r.maybeTrimPrefix(i.next_cursor,kNo),results:r.maybeTrimPrefix(i.results,kNo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,AXs),results:r.maybeTrimPrefix(n.results,kNo),step:n.step!=null?r.maybeTrimPrefix(n.step,AXs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],kNo):void 0}}};var kiE="$request.",enE=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),tnE=Yu.union([Yu.boolean(),enE]),$En=class extends mz{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=tnE.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],kiE),responseStream:n.data["response-stream"],response:n.data.response}}};var tFo=class extends mz{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var rFo=class extends mz{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var qXs="Base",GEn=class e extends og{servers;endpointLevelServers;constructor({breadcrumbs:t,servers:r,endpointLevelServers:i}){super({breadcrumbs:t}),this.servers=r,this.endpointLevelServers=i}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n={id:qXs,name:t.casingsGenerator.generateName(qXs)},a=this.endpointLevelServers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t});return{id:s,name:t.casingsGenerator.generateName(s)}}).filter((d,s,o)=>o.findIndex(c=>c.id===d.id)===s),u=[n,...a],l=this.servers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t}),o=this.endpointLevelServers?.map(c=>[e.getServerName({server:c,errorCollector:r,context:t}),this.getServerUrl(c)]);return{id:s,name:t.casingsGenerator.generateName(s),urls:{[qXs]:this.getServerUrl(d),...Object.fromEntries(o??[])},docs:d.description}});return{value:{defaultEnvironment:l[0]?.id,environments:NC.multipleBaseUrls({baseUrls:u,environments:l})},defaultUrl:e.getServerName({server:this.servers[0],errorCollector:r,context:t})}}let i=this.servers.map(n=>{let a=e.getServerName({server:n,context:t,errorCollector:r});return{id:a,name:t.casingsGenerator.generateName(a),url:this.getServerUrl(n),docs:n.description}}).filter(y0);return{value:{defaultEnvironment:i[0]?.id,environments:NC.singleBaseUrl({environments:i})}}}static getServerName({server:t,context:r,errorCollector:i}){return new rFo({breadcrumbs:[],server:t}).convert({context:r,errorCollector:i})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var oba=class e extends og{static STRING=a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=a_.container(eg.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var iFo=class extends og{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:pI.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:pI.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:pI.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?aF.file(QU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?aF.file(QU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?aF.file(QU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?aF.file(QU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?aF.file(QU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):aF.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var nFo=class extends og{responseBody;group;method;statusCode;streamingExtension;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a,streamingExtension:u}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a,this.streamingExtension=u}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(a=>a.includes("json"));for(let a of[...i]){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&a.includes("json"))return{responseBody:JA.json(MSe.response({responseBodyType:u.convertedSchema.type,docs:this.responseBody.description})),inlinedTypes:u.convertedSchema.inlinedTypes,examples:u.examples}}let n=Object.keys(this.responseBody.content).filter(a=>!a.includes("json"));for(let a of n){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&this.isBinarySchema(u.convertedSchema))return t.settings?.useBytesForBinaryResponse&&this.streamingExtension==null?{responseBody:JA.bytes({docs:this.responseBody.description}),inlinedTypes:{}}:{responseBody:JA.fileDownload({docs:this.responseBody.description}),inlinedTypes:{}}}}async parseMediaTypeObject({context:t,errorCollector:r,contentType:i}){let n=this.responseBody.content?.[i];if(n==null||n.schema==null)return;let a=[...this.group,this.method,"Response",this.statusCode].join("_"),l=await new H2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:n.schema,schemaIdOverride:a}).convert({context:t,errorCollector:r});if(l==null)return;let d=n.examples!=null?Object.fromEntries(await Promise.all(Object.entries(n.examples).map(async([s,o])=>[s,t.isReferenceObject(o)?await t.resolveReference(o):o]))):void 0;return{convertedSchema:l,examples:d}}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}}};var rnE=/{([^}]+)}/g,QEn=class extends og{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return b7.Get;case"post":return b7.Post;case"put":return b7.Put;case"delete":return b7.Delete;case"patch":return b7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new oba({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll(rnE)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:oba.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new iFo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a,streamingExtension:u}){if(this.operation.responses!=null)for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(isNaN(s)||s<200||s>=300)continue;let o;if(t.isReferenceObject(d)){let g=await t.resolveReference(d);g.resolved&&(o=g.value)}else o=d;if(o==null)continue;let b=await new nFo({breadcrumbs:[...i,l],responseBody:o,group:n??[],method:a,statusCode:l,streamingExtension:u}).convert({context:t,errorCollector:r});if(b!=null)return this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},{value:{statusCode:s,body:b.responseBody},examples:b.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new HG.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new HG.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?L0(this.operation.summary):L0(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=Se_(i),u=Se_(n);return oSe(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:L0(u.join("_"))}}};function Se_(e){let t=inE(e)?nnE(e):anE(e);return t=t.map(r=>r.toLowerCase()),t=NBe(t),t}function inE(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function nnE(e){return e.split(/(?=[A-Z])/)}function anE(e){return e.split(/[^a-zA-Z0-9]+/)}var aFo=class extends QEn{idempotent;servers;streamingExtensionConverter;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a,servers:u}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a,this.servers=u,this.streamingExtensionConverter=new $En({breadcrumbs:this.breadcrumbs,operation:this.operation})}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=this.streamingExtensionConverter.convert({context:t,errorCollector:r}),{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),c=o?.value,b=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a,streamingExtension:u}),g=this.operation.servers?.[0]??this.servers?.[0]??t.spec.servers?.[0];return{group:n,endpoint:{id:`${n?.join(".")??""}.${a}`,displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:g!=null?GEn.getServerName({server:g,context:t,errorCollector:r}):void 0,path:LV(this.path),pathParameters:d,queryParameters:s,headers:l,requestBody:c,sdkRequest:void 0,response:b?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:LV(this.path),allPathParameters:d,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes,servers:this.operation.servers}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var JEn=class extends QEn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=YU.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=YU.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var oFo=class extends og{pathItem;path;servers;constructor({breadcrumbs:t,pathItem:r,path:i,servers:n}){super({breadcrumbs:t}),this.pathItem=r,this.path=i,this.servers=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of we_){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new $En({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new tFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new JEn({breadcrumbs:i,operation:t,method:TXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new eFo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new ZNo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new aFo({breadcrumbs:i,operation:t,method:TXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var uFo=class extends og{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return FR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return FR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:a_.container(eg.optional(a_.primitive({v1:"STRING",v2:Dv.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var uba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertWebhooks({context:t,errorCollector:r});let{endpointLevelServers:i}=await this.convertPaths({context:t,errorCollector:r});this.convertServers({context:t,errorCollector:r,endpointLevelServers:i});let n={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return n={...n,...vFi({ir:n,exampleGeneration:{disabled:!1}})},n}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new HG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new uFo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r,endpointLevelServers:i}){let a=new GEn({breadcrumbs:["servers"],servers:t.spec.servers,endpointLevelServers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a.value)}async convertSchemas({context:t,errorCollector:r}){let i=this.getGroup({groupParts:[],namespace:t.namespace}),n=this.getOrCreatePackage({context:t,group:i});for(let[a,u]of Object.entries(t.spec.components?.schemas??{})){let d=await new H2.SchemaConverters.SchemaConverter({id:a,breadcrumbs:["components","schemas",a],schema:u}).convert({context:t,errorCollector:r});d!=null&&(n.types.push(a),this.ir.types={...this.ir.types,...d.inlinedTypes,[a]:d.typeDeclaration})}}async convertWebhooks({context:t,errorCollector:r}){let i={};for(let[,n]of Object.entries(t.spec.webhooks??{})){if(n==null||!("post"in n)||!n.post?.operationId)continue;let a=n.post.operationId,l=await new JEn({breadcrumbs:["webhooks",a],operation:n.post,method:De_.OpenAPIV3.HttpMethods.POST,path:a}).convert({context:t,errorCollector:r});if(l!=null){let d=l.group?.join(".")??a;i[d]==null&&(i[d]=[]),i[d].push(a),this.ir.webhookGroups[d]==null&&(this.ir.webhookGroups[d]=[]),this.ir.webhookGroups[d].push(l.webhook),this.ir.types={...this.ir.types,...l.inlinedTypes}}}}async convertPaths({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.paths??{})){if(a==null)continue;let l=await new oFo({breadcrumbs:["paths",n],pathItem:a,path:n,servers:t.spec.servers}).convert({context:t,errorCollector:r});if(l!=null){for(let d of l.endpoints){let s=this.getGroup({groupParts:d.group,namespace:t.namespace}),o=s.join("."),c=this.getOrCreatePackage({context:t,group:d.group}),b=[...s].map(O=>t.casingsGenerator.generateName(O)),g=b[b.length-1];c.service==null&&(c.service=`service_${o}`),this.ir.services[c.service]==null&&(this.ir.services[c.service]={name:{fernFilepath:{allParts:b,packagePath:b.slice(0,-1),file:g}},displayName:void 0,basePath:LV(""),headers:[],pathParameters:[],availability:void 0,endpoints:[],transport:void 0,encoding:void 0}),this.ir.services[c.service]?.endpoints.push(d.endpoint),d.servers&&d.servers[0]!=null&&i.push(d.servers[0])}for(let d of l.webhooks){let o=this.getGroup({groupParts:d.group,namespace:t.namespace}).join("."),c=this.getOrCreatePackage({context:t,group:d.group});this.ir.webhookGroups[o]??=[],this.ir.webhookGroups[o].push(d.webhook),c.webhooks=o}this.ir.types={...this.ir.types,...l.inlinedTypes}}}return{endpointLevelServers:i}}getOrCreatePackage({context:t,group:r}){let i=[];if(t.namespace!=null&&i.push(t.namespace),i.push(...r??[]),i.length==0)return this.ir.rootPackage;let n=this.ir.rootPackage;for(let a=0;a<i.length;a++){let u=i[a],l=i.slice(0,a+1).join(".");this.ir.subpackages[l]==null&&(this.ir.subpackages[l]={name:t.casingsGenerator.generateName(u),...t.createPackage({name:u})});let d=this.ir.subpackages[l];n.subpackages.includes(l)||n.subpackages.push(l),n=d}return n}getGroup({groupParts:t,namespace:r}){let i=[];return r!=null&&i.push(r),i.push(...t??[]),i}};var sba=class extends bFi{isReferenceObject(t){return t!=null&&"$ref"in t}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:a_.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var Ee_={[My.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,lx(e)])),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.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"]),[My.GenerationLanguage.SWIFT]:new Set([])};var onE=["go","ruby"];function Me_({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:unE({name:c,keywords:snE({generationLanguage:e,keywords:t})})}),l=L0(n),d=lx(l),s=qCi(n),o=DCi(l);return r&&(!fnE(o)&&(e==null||onE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=sFo(c);if(g!=null)return g;if(cFo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=sFo(c);return g??(cFo(c)?c.toUpperCase():b===0?lx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(qCi).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 unE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":lnE(e)?"_"+e:e}function snE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Ee_[e]}var cnE=/^[0-9]/;function lnE(e){return cnE.test(e)}function fnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=sFo(i)!=null||cFo(i),a=sFo(t)!=null||cFo(t);return n&&a})}function sFo(e){return pnE.get(e.toUpperCase())}function cFo(e){return dnE.has(e.toUpperCase())}var dnE=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"]),pnE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var $7=class extends jha{specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new f9t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await Jze({context:t,specs:this.specs,relativePathToDependency:r});return GNi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:i?.useBytesForBinaryResponse??this.useBytesForBinaryResponse}})}async getIntermediateRepresentation({context:t}){let r=await Jze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new iba({logger:t.logger}),l;if(a.type==="openapi"){let s=new sba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new uba({context:s}).convert({context:s,errorCollector:u})}else if(a.type==="asyncapi"){let s=new aba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new nba({context:s}).convert({context:s,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors());let d=Me_({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});l!=null&&(n=n===void 0?l:jXs(n,l,d))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new oDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(y0)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:Tie(),absoluteFilePath:u})),n},i)}};var Ae_={None:"none",Header:"header"};var CFo={};Eo(CFo,{ConjureAliasDeclaration:()=>yFo,ConjureArgument:()=>AFo,ConjureArgumentWithParamType:()=>MFo,ConjureAuthDefinition:()=>ZEn,ConjureAuthDefinitionType:()=>DFo,ConjureDefinitions:()=>wFo,ConjureEndpointDefinition:()=>qFo,ConjureEnumDeclaration:()=>PFo,ConjureEnumVariant:()=>mFo,ConjureEnumWithDocs:()=>OFo,ConjureObjectDeclaration:()=>gFo,ConjureParamType:()=>EFo,ConjurePrimitive:()=>hFo,ConjureService:()=>TFo,ConjureServiceName:()=>_Fo,ConjureType:()=>g_i,ConjureTypeDeclaration:()=>jFo,ConjureTypeReference:()=>O_i,ConjureTypeWithDocs:()=>vFo,ConjureTypes:()=>SFo,ConjureUnionDeclaration:()=>bFo,DefinitionFile:()=>it_,WithDocs:()=>lZt,commons:()=>zXs,conjure:()=>RXs,services:()=>NXs,types:()=>FXs});var zXs={};Eo(zXs,{WithDocs:()=>lZt});var kd={};Eo(kd,{JsonError:()=>KEn,ParseError:()=>YEn,any:()=>He_,bigint:()=>Te_,boolean:()=>$e_,booleanLiteral:()=>We_,date:()=>Ce_,discriminant:()=>et_,enum_:()=>fFo,getObjectLikeUtils:()=>h9t,getObjectUtils:()=>gFi,getSchemaUtils:()=>tq,isProperty:()=>b_i,lazy:()=>Be_,lazyObject:()=>Le_,list:()=>pFo,number:()=>Ge_,object:()=>dFo,objectWithoutOptionalProperties:()=>Fe_,optional:()=>CXs,property:()=>Ie_,record:()=>Ye_,set:()=>Xe_,string:()=>Qe_,stringLiteral:()=>Ve_,transform:()=>BXs,undiscriminatedUnion:()=>ke_,union:()=>rt_,unknown:()=>Je_,withParsedProperties:()=>IXs});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 BM(e,t){return`Expected ${t}. Received ${_nE(e)}.`}function _nE(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 V5(e){return{...e,json:qe_(e.json),parse:qe_(e.parse)}}function qe_(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(`
1957
1957
  `)),{ok:!0,value:t}):i}}function lFo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var KEn=class e extends Error{errors;constructor(t){super(t.map(lFo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var YEn=class e extends Error{errors;constructor(t){super(t.map(lFo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function tq(e){return{optional:()=>CXs(e),transform:t=>BXs(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new YEn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new KEn(i.errors)}}}function CXs(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:()=>ej.OPTIONAL};return{...t,...tq(t)}}function BXs(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,...tq(r)}}function Te_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:BM(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:BM(t,"bigint")}]},getType:()=>ej.BIGINT};return{...V5(e),...tq(e)}}var hnE=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Ce_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:BM(t,"string")}]}:hnE.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:BM(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:BM(t,"Date object")}]},getType:()=>ej.DATE};return{...V5(e),...tq(e)}}function $G(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...V5(r),...tq(r)}}}function fFo(e){let t=new Set(e);return $G(ej.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:BM(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:BM(i,"enum")}]}:{ok:!0,value:i})()}function Be_(e){let t=xXs(e);return{...t,...tq(t)}}function xXs(e){return{parse:(t,r)=>XEn(e).parse(t,r),json:(t,r)=>XEn(e).json(t,r),getType:()=>XEn(e).getType()}}function XEn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function cba(e){return Object.entries(e)}function lba(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function v_i(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 fba(e){return Object.keys(e)}function xe_(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function h9t(e){return{withParsedProperties:t=>IXs(e,t)}}function IXs(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(!v_i(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:BM(i,"object")}]};let a=new Set(Object.keys(t)),u=lba(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...tq(r),...h9t(r)}}function Ie_(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function b_i(e){return e.isProperty}function dFo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>b_i(i)?i.rawKey:r),_getParsedProperties:()=>fba(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of cba(e)){let d=b_i(l)?l.rawKey:u,s=b_i(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,Ne_(s)&&a.push(d)}return ze_({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 cba(e)){let l=b_i(u)?u.valueSchema:u;Ne_(l)&&n.push(a)}return ze_({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return b_i(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:()=>ej.OBJECT};return{...V5(t),...tq(t),...h9t(t),...gFi(t)}}function ze_({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!v_i(e))return{ok:!1,errors:[{path:a,message:BM(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 gFi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>Re_({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>Re_({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>ej.OBJECT};return{...r,...tq(r),...h9t(r),...gFi(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:()=>ej.OBJECT};return{...t,...tq(t),...h9t(t),...gFi(t)}}}}function Re_({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=xe_(fba(t),s=>n.has(s)),l=r(lba(t,u)),d=i(lba(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 Ne_(e){return!ynE(e)}function ynE(e){switch(e.getType()){case ej.ANY:case ej.UNKNOWN:case ej.OPTIONAL:return!0;default:return!1}}function Fe_(e){return dFo(e)}function Le_(e){let t={...xXs(e),_getRawProperties:()=>XEn(e)._getRawProperties(),_getParsedProperties:()=>XEn(e)._getParsedProperties()};return{...t,...tq(t),...h9t(t),...gFi(t)}}function pFo(e){let t={parse:(r,i)=>Ue_(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>Ue_(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>ej.LIST};return{...V5(t),...tq(t)}}function Ue_(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:BM(e,"list"),path:[]}]}}function Ve_(e){return $G(ej.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:BM(r,`"${e}"`)}]})()}function We_(e){return $G(ej.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:BM(r,`${e.toString()}`)}]})()}var He_=$G(ej.ANY,e=>({ok:!0,value:e}));var $e_=$G(ej.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"boolean")}]});var Ge_=$G(ej.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"number")}]});var Qe_=$G(ej.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"string")}]});var Je_=$G(ej.UNKNOWN,e=>({ok:!0,value:e}));function Ye_(e,t){let r={parse:(i,n)=>Ke_({value:i,isKeyNumeric:e.getType()===ej.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)=>Ke_({value:i,isKeyNumeric:e.getType()===ej.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:()=>ej.RECORD};return{...V5(r),...tq(r)}}function Ke_({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return v_i(e)?cba(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:BM(e,"object")}]}}function Xe_(e){let t=pFo(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:BM(i,"Set")}]},getType:()=>ej.SET};return{...V5(r),...tq(r)}}function ke_(e){let t={parse:(r,i)=>Ze_((n,a)=>n.parse(r,a),e,i),json:(r,i)=>Ze_((n,a)=>n.json(r,a),e,i),getType:()=>ej.UNDISCRIMINATED_UNION};return{...V5(t),...tq(t)}}function Ze_(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 et_(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function rt_(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=fFo(fba(t)),a={parse:(u,l)=>tt_({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)=>tt_({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:()=>ej.UNION};return{...V5(a),...tq(a),...h9t(a)}}function tt_({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!v_i(e))return{ok:!1,errors:[{path:l,message:BM(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 lZt=kd.objectWithoutOptionalProperties({docs:kd.string().optional()});var RXs={};Eo(RXs,{ConjureServiceName:()=>_Fo,DefinitionFile:()=>it_});var _Fo=kd.string();var hFo=kd.enum_(["rid","string","safelong","integer","double","boolean"]);var g_i=kd.undiscriminatedUnion([hFo,kd.string()]);var yFo=kd.objectWithoutOptionalProperties({alias:g_i,docs:kd.string().optional()});var vFo=kd.objectWithoutOptionalProperties({type:g_i,docs:kd.string().optional()});var O_i=kd.undiscriminatedUnion([g_i,vFo]);var bFo=kd.objectWithoutOptionalProperties({union:kd.record(kd.string(),O_i)});var gFo=kd.objectWithoutOptionalProperties({fields:kd.record(kd.string(),O_i)});var OFo=kd.objectWithoutOptionalProperties({value:kd.string()}).extend(lZt);var mFo=kd.undiscriminatedUnion([kd.string(),OFo]);var PFo=kd.objectWithoutOptionalProperties({values:kd.list(mFo)});var jFo=kd.undiscriminatedUnion([yFo,bFo,gFo,PFo]);var wFo=kd.objectWithoutOptionalProperties({objects:kd.record(kd.string(),jFo).optional()});var SFo=kd.objectWithoutOptionalProperties({conjureImports:kd.property("conjure-imports",kd.record(kd.string(),kd.string()).optional()),definitions:wFo.optional()});var DFo=kd.enum_(["none","header"]);var ZEn=kd.undiscriminatedUnion([DFo,kd.string()]);var EFo=kd.enum_(["path","query","body"]);var MFo=kd.objectWithoutOptionalProperties({paramType:kd.property("param-type",EFo),type:kd.string()}).extend(lZt);var AFo=kd.undiscriminatedUnion([kd.string(),MFo]);var qFo=kd.objectWithoutOptionalProperties({http:kd.string(),auth:ZEn.optional(),args:kd.record(kd.string(),AFo).optional(),returns:O_i.optional()}).extend(lZt);var TFo=kd.objectWithoutOptionalProperties({name:kd.string().optional(),package:kd.string().optional(),basePath:kd.property("base-path",kd.string().optional()),defaultAuth:kd.property("default-auth",ZEn.optional()),endpoints:kd.record(kd.string(),qFo).optional()}).extend(lZt);var it_=kd.objectWithoutOptionalProperties({types:SFo.optional(),services:kd.record(_Fo,TFo).optional()});var NXs={};Eo(NXs,{ConjureArgument:()=>AFo,ConjureArgumentWithParamType:()=>MFo,ConjureAuthDefinition:()=>ZEn,ConjureAuthDefinitionType:()=>DFo,ConjureEndpointDefinition:()=>qFo,ConjureParamType:()=>EFo,ConjureService:()=>TFo});var FXs={};Eo(FXs,{ConjureAliasDeclaration:()=>yFo,ConjureDefinitions:()=>wFo,ConjureEnumDeclaration:()=>PFo,ConjureEnumVariant:()=>mFo,ConjureEnumWithDocs:()=>OFo,ConjureObjectDeclaration:()=>gFo,ConjurePrimitive:()=>hFo,ConjureType:()=>g_i,ConjureTypeDeclaration:()=>jFo,ConjureTypeReference:()=>O_i,ConjureTypeWithDocs:()=>vFo,ConjureTypes:()=>SFo,ConjureUnionDeclaration:()=>bFo});var nt_=require("fs/promises");async function at_(e,t){let r=[];for(let i of await XBe(e,t))r.push(await vnE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function vnE({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,nt_.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
1958
1958
  `).replaceAll("<rid>","<string>").replaceAll("rid>","string>").replaceAll(": safelong",": long").replaceAll("<safelong>","<long>").replaceAll("safelong>","long>").replaceAll(": any",": unknown").replaceAll("<any>","<unknown>").replaceAll("any>","unknown>");return{relativeFilepath:e,absoluteFilepath:t,fileContents:CFo.DefinitionFile.parseOrThrow(Kd.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function ot_(e,t){if(bnE(e))return t.alias(e);if(gnE(e))return t.enum(e);if(OnE(e))return t.object(e);if(mnE(e))return t.union(e);Fo(e)}function bnE(e){return e?.alias!=null}function gnE(e){return e?.values!=null}function OnE(e){return e?.fields!=null}function mnE(e){return e?.union!=null}var dba=class extends pha{fernDefinitionBuilder=new dNi(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:i,globalHeaderOverrides:n}){if(r!=null){for(let[a,u]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:u});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(i!=null){for(let[a,u]of Object.entries(i.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:u});i["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(i["default-environment"]),i["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(i["default-url"])}return await ut_(t,(a,u,l)=>{for(let[o,c]of Object.entries(l.services??{})){let b=YXa({value:o,suffix:"Service"});this.conjureFilepathToFernFilepath[u]=uo.of(`${b}/__package__.yml`);return}let s=Tbs(u)?.split(".")[0];s!=null&&(this.conjureFilepathToFernFilepath[u]=uo.of(`${s}/__package__.yml`))}),await ut_(t,(a,u,l)=>{if(l.services==null||Object.keys(l.services??{}).length===0){let d=this.conjureFilepathToFernFilepath[u];if(d==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${u}`);for(let[s,o]of Object.entries(l.types?.conjureImports??{})){let c=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:uo.of(o)});this.fernDefinitionBuilder.addImport({file:d,fileToImport:uo.of(c),alias:s})}this.importAllTypes({conjureFile:l,fernFilePath:d});return}for(let[d,s]of Object.entries(l.services)){let o=YXa({value:d,suffix:"Service"}),c=uo.of(`${o}/__package__.yml`),b={};s.basePath!=null&&(b["base-path"]=s.basePath),s.docs!=null&&(b.docs=s.docs),this.fernDefinitionBuilder.setServiceInfo(c,b),this.importAllTypes({conjureFile:l,fernFilePath:c});for(let[g,O]of Object.entries(l.types?.conjureImports??{})){let m=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:uo.of(O)});this.fernDefinitionBuilder.addImport({file:c,fileToImport:uo.of(m),alias:g})}for(let[g,O]of Object.entries(s.endpoints??{})){let m=L_s(O.http);if(m.type==="failure"){this.context?.logger.error(`Failed to parse ${O.http}. Skipping.`);continue}let E={auth:(O.auth??s.defaultAuth)!==Ae_.None,path:m.path,method:m.method,response:O.returns==="binary"?"file":O.returns};O.docs!=null&&(E.docs=O.docs);let A={};if(O.args!=null)for(let q of m.pathParameters){let D=O.args[q];if(D==null)throw new Error(`Failed to find path parameter ${q} in ${O.http}`);A[q]=typeof D=="string"?D:{type:D.type}}Object.entries(A).length>0&&(E["path-parameters"]=A);for(let[q,D]of Object.entries(O.args??{}))if(A[q]==null)if(typeof D=="string")E.request?typeof E.request=="string"&&(E.request={body:E.request}):E.request={},E.request.body=D==="binary"?"bytes":D;else switch(D.paramType){case"body":E.request={body:D.type==="binary"?"bytes":D.type};break;case"query":E.request==null?E.request={"query-parameters":{[q]:D.type}}:typeof E.request!="string"&&E.request?.["query-parameters"]==null?E.request["query-parameters"]={[q]:D.type}:typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request["query-parameters"][q]=D.type)}E.request!=null&&typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request.name=`${g}Request`),this.fernDefinitionBuilder.addEndpoint(c,{name:g,schema:E,source:void 0})}}}),this.fernDefinitionBuilder.build()}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[i,n]of Object.entries(t.types?.definitions?.objects??{}))ot_(n,{alias:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{type:a.alias,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{properties:a.fields}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{union:Object.fromEntries(Object.entries(a.union).map(([u,l])=>[u,{type:typeof l=="string"?l:l.type,docs:typeof l=="string"?void 0:l.docs,key:u}]))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:i}){let n=es(_p(t),uo.of(r)),a=usi(i,n),u=this.conjureFilepathToFernFilepath[a];if(u==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return u}};async function ut_(e,t){for(let r of await at_(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function st_(e,t){return rd(e,t)}var BFo=class extends Y5t{absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=es(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new oDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let n=await new dba(t).import({absolutePathToConjureFolder:this.absolutePathToConjureFolder,authOverrides:this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0,environmentOverrides:this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:Wl.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:n.rootApiFile["default-url"],contents:n.rootApiFile,rawContents:Kd.dump(n.rootApiFile)},namedDefinitionFiles:{...st_(n.definitionFiles,a=>({absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Kd.dump(a),contents:a})),[uo.of(iS)]:{absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Kd.dump(n.packageMarkerFile),contents:n.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};function LXs(e,t){for(let[r,i]of $N(e.failures))PnE({relativeFilepath:r,failure:i,logger:t})}function PnE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case uP.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 uP.FILE_READ:r.error("Failed to open file: "+e);break;case uP.FILE_MISSING:r.error("Missing file: "+e);break;case uP.FILE_PARSE:t.error instanceof Vaa?r.error(Wie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case uP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of jnE(i))r.error(Wie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case uP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case uP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${zZa}: `+t.dependencyName);break;case uP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case uP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case uP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Wie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));break;default:Fo(t)}}function jnE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var ct_=require("fs/promises");async function lt_(e,t){let r=[];for(let i of await XBe(e,t))r.push(await wnE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function wnE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,ct_.readFile)(t)).toString()}}async function ft_({absolutePathToWorkspace:e}){let t=es(e,uo.of(BHf));if(!await Cf(t))return;let i=await lt_(t,"{md,mdx}");return{files:await Promise.all(i.map(n=>({absoluteFilepath:n.absoluteFilepath,contents:n.fileContents})))}}async function UXs({absolutePathToWorkspace:e,namespace:t,definitions:r}){let i=[];for(let n of r){let a=n.overrides!=null?es(e,uo.of(n.overrides)):void 0;if(n.schema.type==="protobuf"){let l=uo.of(n.schema.root),d=es(e,l);if(!await Cf(d))return{didSucceed:!1,failures:{[uo.of(n.schema.root)]:{type:uP.FILE_MISSING}}};let s=es(e,uo.of(n.schema.target));if(!await Cf(s))return{didSucceed:!1,failures:{[uo.of(n.schema.target)]:{type:uP.FILE_MISSING}}};i.push({type:"protobuf",absoluteFilepathToProtobufRoot:d,absoluteFilepathToProtobufTarget:s,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:l,generateLocally:n.schema.localGeneration,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:void 0,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:n.settings?.useBytesForBinaryResponse??!1}});continue}let u=es(e,uo.of(n.schema.path));if(!await Cf(u))return{didSucceed:!1,failures:{[uo.of(n.schema.path)]:{type:uP.FILE_MISSING}}};if(n.overrides!=null&&a!=null&&!await Cf(a))return{didSucceed:!1,failures:{[uo.of(n.overrides)]:{type:uP.FILE_MISSING}}};i.push({type:"openapi",absoluteFilepath:u,absoluteFilepathToOverrides:a,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:n.settings?.exampleGeneration,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:n.settings?.useBytesForBinaryResponse??!1},source:{type:"openapi",file:u},namespace:t})}return i}async function pba({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:i}){let n=await L8t({absolutePathToWorkspace:e,context:t}),a;try{a=await ft_({absolutePathToWorkspace:e})}catch{}if(n?.api!=null&&n?.api.type==="conjure")return{didSucceed:!0,workspace:new BFo({workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:uo.of(n.api.pathToConjureDefinition)})};if(n?.api!=null&&(n.api.type==="singleNamespace"&&n.api.definitions.length>0||n.api.type==="multiNamespace")){let u=[];if(n.api.type==="singleNamespace"){let l=await UXs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.definitions});if(!Array.isArray(l))return l;u.push(...l)}else{for(let[l,d]of Object.entries(n.api.definitions)){let s=await UXs({absolutePathToWorkspace:e,namespace:l,definitions:d});if(!Array.isArray(s))return s;u.push(...s)}if(n.api.rootDefinitions!=null){let l=await UXs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.rootDefinitions});if(!Array.isArray(l))return l;u.push(...l)}}return{didSucceed:!0,workspace:new $7({specs:u,workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r})}}return await Cf(es(e,uo.of(X8)))?{didSucceed:!0,workspace:new p_i({absoluteFilePath:e,generatorsConfiguration:n,workspaceName:i,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:pba})}:{didSucceed:!1,failures:{[uo.of(IZa)]:{type:uP.MISCONFIGURED_DIRECTORY}}}}var dt_=require("fs/promises");var VXs={};Eo(VXs,{additionalProperties:()=>MnE,default:()=>qnE,definitions:()=>AnE,properties:()=>DnE,required:()=>EnE,type:()=>SnE});var SnE="object",DnE={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},EnE=["instances"],MnE=!1,AnE={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItem":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfig":{type:"string"},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","primary","secondary"]}},required:["type"],oneOf:[{properties:{type:{const:"filled"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"primary"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.AIChatModel":{type:"string",enum:["claude-3.5","claude-3.7","command-r-plus"]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},qnE={type:SnE,properties:DnE,required:EnE,additionalProperties:MnE,definitions:AnE};async function WXs({fernDirectory:e,context:t}){let r=es(e,uo.of(Y4t));if(!await Cf(r))return;let i=await TnE({absolutePathToDocsDefinition:e,context:t});if(i!=null)return{type:"docs",absoluteFilePath:e,config:i,workspaceName:void 0,absoluteFilepathToDocsConfig:es(e,uo.of(Y4t))}}async function TnE({absolutePathToDocsDefinition:e,context:t}){if(!await Cf(e))return;let r=es(e,uo.of(Y4t));return await CnE({absolutePathOfConfiguration:r,context:t})}async function CnE({absolutePathOfConfiguration:e,context:t}){let r=await(0,dt_.readFile)(e),i=Kd.load(r.toString()),n=nQr(i,VXs);if(n.success)return k4t.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(i);throw new Error(`Failed to parse docs.yml because of ${n.error?.message??"Unknown error"}`)}async function HXs({context:e,nameOverride:t,...r}){let i=await u8t(t);return i==null?e.failAndThrow(`Directory "${t??qU}" not found.`):await _t_({absolutePathToFernDirectory:i,context:e,nameOverride:t,...r})}async function _t_({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n,context:a}){let u=[];return(await Cf(es(e,uo.of(Fui)))||await Cf(es(e,uo.of(X8)))||await Cf(es(e,uo.of(JN)))||await Cf(es(e,uo.of(IZa)))||await Cf(es(e,uo.of(xHf))))&&(u=await ht_({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n})),{config:await qQr({directory:e,context:a}),apiWorkspaces:u,docsWorkspaces:await WXs({fernDirectory:e,context:a}),loadAPIWorkspace:l=>l==null?u[0]:u.find(d=>d.workspaceName===l)}}async function ht_({cliName:e,fernDirectory:t,context:r,cliVersion:i,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:a}){let u=es(t,uo.of(Fui));if(await Cf(u)){let o=(await(0,pt_.readdir)(u,{withFileTypes:!0})).reduce((g,O)=>(O.isDirectory()&&g.push(O.name),g),[]);if(n!=null){if(!o.includes(n))return r.failAndThrow("API does not exist: "+n)}else{if(o.length===0)return r.failAndThrow("No APIs found.");if(o.length>1&&!a){let g=`There are multiple workspaces. You must specify one with --api:
1959
1959
  `,O=Math.max(...o.map(m=>m.length));return g+=o.map(m=>{let P=`${e} ${process.argv.slice(2).join(" ")} --api ${m}`;return` \u203A ${Js.bold(m.padEnd(O))} ${Js.dim(P)}`}).join(`