fern-api 3.30.3 → 3.30.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 +5 -5
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -793,7 +793,7 @@ ${t.format(r)}
793
793
  ${a}`;break;case"retry":XCE(a)&&(r[n]=a);break;case"id":ZCE(a)&&(r[n]=a);break;case"event":a.length>0&&(r[n]=a);break}}processEvent(t){t.retry&&XCE(t.retry)&&(this.state.reconnectionTime=parseInt(t.retry,10)),t.id&&ZCE(t.id)&&(this.state.lastEventId=t.id),t.data!==void 0&&this.push({type:t.event||"message",options:{data:t.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};kCE.exports={EventSourceStream:h_p}});var sqE=f((Jl2,uqE)=>{"use strict";var{pipeline:e65}=require("stream"),{fetching:t65}=EIo(),{makeRequest:r65}=lFa(),{webidl:m9i}=K3(),{EventSourceStream:i65}=eqE(),{parseMIMEType:n65}=gbe(),{createFastMessageEvent:a65}=yFa(),{isNetworkError:tqE}=jIo(),{delay:o65}=p_p(),{kEnumerableProperty:tKn}=zv(),{environmentSettingsObject:rqE}=pje(),iqE=!1,nqE=3e3,FIo=0,aqE=1,QIo=2,u65="anonymous",s65="use-credentials",AFa=class e extends EventTarget{#e={open:null,error:null,message:null};#t=null;#r=!1;#i=FIo;#n=null;#a=null;#o;#s;constructor(t,r={}){super(),m9i.util.markAsUncloneable(this);let i="EventSource constructor";m9i.argumentLengthCheck(arguments,1,i),iqE||(iqE=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),t=m9i.converters.USVString(t,i,"url"),r=m9i.converters.EventSourceInitDict(r,i,"eventSourceInitDict"),this.#o=r.dispatcher,this.#s={lastEventId:"",reconnectionTime:nqE};let n=rqE,a;try{a=new URL(t,n.settingsObject.baseUrl),this.#s.origin=a.origin}catch(d){throw new DOMException(d,"SyntaxError")}this.#t=a.href;let o=u65;r.withCredentials&&(o=s65,this.#r=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:o==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=rqE.settingsObject,c.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],c.cache="no-store",c.initiator="other",c.urlList=[new URL(this.#t)],this.#n=r65(c),this.#u()}get readyState(){return this.#i}get url(){return this.#t}get withCredentials(){return this.#r}#u(){if(this.#i===QIo)return;this.#i=FIo;let t={request:this.#n,dispatcher:this.#o},r=i=>{tqE(i)&&(this.dispatchEvent(new Event("error")),this.close()),this.#c()};t.processResponseEndOfBody=r,t.processResponse=i=>{if(tqE(i))if(i.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#c();return}let n=i.headersList.get("content-type",!0),a=n!==null?n65(n):"failure",o=a!=="failure"&&a.essence==="text/event-stream";if(i.status!==200||o===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=aqE,this.dispatchEvent(new Event("open")),this.#s.origin=i.urlList[i.urlList.length-1].origin;let c=new i65({eventSourceSettings:this.#s,push:d=>{this.dispatchEvent(a65(d.type,d.options))}});e65(i.body.stream,c,d=>{d?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#a=t65(t)}async#c(){this.#i!==QIo&&(this.#i=FIo,this.dispatchEvent(new Event("error")),await o65(this.#s.reconnectionTime),this.#i===FIo&&(this.#s.lastEventId.length&&this.#n.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#u()))}close(){m9i.brandCheck(this,e),this.#i!==QIo&&(this.#i=QIo,this.#a.abort(),this.#n=null)}get onopen(){return this.#e.open}set onopen(t){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(t){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(t){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}},oqE={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:FIo,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:aqE,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:QIo,writable:!1}};Object.defineProperties(AFa,oqE);Object.defineProperties(AFa.prototype,oqE);Object.defineProperties(AFa.prototype,{close:tKn,onerror:tKn,onmessage:tKn,onopen:tKn,readyState:tKn,url:tKn,withCredentials:tKn});m9i.converters.EventSourceInitDict=m9i.dictionaryConverter([{key:"withCredentials",converter:m9i.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:m9i.converters.any}]);uqE.exports={EventSource:AFa,defaultReconnectionTime:nqE}});var y_p=f(($l2,Lf)=>{"use strict";var c65=cIo(),cqE=LBo(),l65=XNa(),f65=yME(),d65=ZNa(),p65=Udp(),_65=qME(),h65=QME(),lqE=BP(),BZs=zv(),{InvalidArgumentError:DZs}=lqE,mFa=wDE(),y65=WBo(),b65=App(),v65=oBE(),g65=jpp(),O65=spp(),A65=IXs(),{getGlobalDispatcher:fqE,setGlobalDispatcher:m65}=LXs(),P65=VXs(),j65=gXs(),w65=OXs();Object.assign(cqE.prototype,mFa);Lf.exports.Dispatcher=cqE;Lf.exports.Client=c65;Lf.exports.Pool=l65;Lf.exports.BalancedPool=f65;Lf.exports.Agent=d65;Lf.exports.ProxyAgent=p65;Lf.exports.EnvHttpProxyAgent=_65;Lf.exports.RetryAgent=h65;Lf.exports.RetryHandler=A65;Lf.exports.DecoratorHandler=P65;Lf.exports.RedirectHandler=j65;Lf.exports.createRedirectInterceptor=w65;Lf.exports.interceptors={redirect:pBE(),retry:hBE(),dump:bBE(),dns:OBE()};Lf.exports.buildConnector=y65;Lf.exports.errors=lqE;Lf.exports.util={parseHeaders:BZs.parseHeaders,headerNameToString:BZs.headerNameToString};function UIo(e){return(t,r,i)=>{if(typeof r=="function"&&(i=r,r=null),!t||typeof t!="string"&&typeof t!="object"&&!(t instanceof URL))throw new DZs("invalid url");if(r!=null&&typeof r!="object")throw new DZs("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new DZs("invalid opts.path");let o=r.path;r.path.startsWith("/")||(o=`/${o}`),t=new URL(BZs.parseOrigin(t).origin+o)}else r||(r=typeof t=="object"?t:{}),t=BZs.parseURL(t);let{agent:n,dispatcher:a=fqE()}=r;if(n)throw new DZs("unsupported opts.agent. Did you mean opts.client?");return e.call(a,{...r,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:r.method||(r.body?"PUT":"GET")},i)}}Lf.exports.setGlobalDispatcher=m65;Lf.exports.getGlobalDispatcher=fqE;var E65=EIo().fetch;Lf.exports.fetch=async function(t,r=void 0){try{return await E65(t,r)}catch(i){throw i&&typeof i=="object"&&Error.captureStackTrace(i),i}};Lf.exports.Headers=Jxn().Headers;Lf.exports.Response=jIo().Response;Lf.exports.Request=lFa().Request;Lf.exports.FormData=YBo().FormData;Lf.exports.File=globalThis.File??require("buffer").File;Lf.exports.FileReader=TIE().FileReader;var{setGlobalOrigin:S65,getGlobalOrigin:M65}=Lfp();Lf.exports.setGlobalOrigin=S65;Lf.exports.getGlobalOrigin=M65;var{CacheStorage:D65}=WIE(),{kConstruct:B65}=cZs();Lf.exports.caches=new D65(B65);var{deleteCookie:I65,getCookies:C65,getSetCookies:q65,setCookie:T65}=tCE();Lf.exports.deleteCookie=I65;Lf.exports.getCookies=C65;Lf.exports.getSetCookies=q65;Lf.exports.setCookie=T65;var{parseMIMEType:R65,serializeAMimeType:z65}=gbe();Lf.exports.parseMIMEType=R65;Lf.exports.serializeAMimeType=z65;var{CloseEvent:N65,ErrorEvent:F65,MessageEvent:Q65}=yFa();Lf.exports.WebSocket=$CE().WebSocket;Lf.exports.CloseEvent=N65;Lf.exports.ErrorEvent=F65;Lf.exports.MessageEvent=Q65;Lf.exports.request=UIo(mFa.request);Lf.exports.stream=UIo(mFa.stream);Lf.exports.pipeline=UIo(mFa.pipeline);Lf.exports.connect=UIo(mFa.connect);Lf.exports.upgrade=UIo(mFa.upgrade);Lf.exports.MockClient=b65;Lf.exports.MockPool=g65;Lf.exports.MockAgent=v65;Lf.exports.mockErrors=O65;var{EventSource:U65}=sqE();Lf.exports.EventSource=U65});function jFa(e,t){return e!==null&&typeof e=="object"&&"$typeName"in e&&typeof e.$typeName=="string"?t===void 0?!0:t.typeName===e.$typeName:!1}var $r;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})($r||($r={}));function I_p(){let e=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(e|=(n&127)<<i,(n&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(n&127)<<i,(n&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function KIo(e,t,r){for(let a=0;a<28;a=a+7){let o=e>>>a,c=!(!(o>>>7)&&t==0),d=(c?o|128:o)&255;if(r.push(d),!c)return}let i=e>>>28&15|(t&7)<<4,n=t>>3!=0;if(r.push((n?i|128:i)&255),!!n){for(let a=3;a<31;a=a+7){let o=t>>>a,c=!!(o>>>7),d=(c?o|128:o)&255;if(r.push(d),!c)return}r.push(t>>>31&1)}}var xIo=4294967296;function CZs(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,i=0,n=0;function a(o,c){let d=Number(e.slice(o,c));n*=r,i=i*r+d,i>=xIo&&(n=n+(i/xIo|0),i=i%xIo)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?q_p(i,n):TZs(i,n)}function C_p(e,t){let r=TZs(e,t),i=r.hi&2147483648;i&&(r=q_p(r.lo,r.hi));let n=qZs(r.lo,r.hi);return i?"-"+n:n}function qZs(e,t){if({lo:e,hi:t}=qqE(e,t),t<=2097151)return String(xIo*t+e);let r=e&16777215,i=(e>>>24|t<<8)&16777215,n=t>>16&65535,a=r+i*6777216+n*6710656,o=i+n*8147497,c=n*2,d=1e7;return a>=d&&(o+=Math.floor(a/d),a%=d),o>=d&&(c+=Math.floor(o/d),o%=d),c.toString()+B_p(o)+B_p(a)}function qqE(e,t){return{lo:e>>>0,hi:t>>>0}}function TZs(e,t){return{lo:e|0,hi:t|0}}function q_p(e,t){return t=~t,e?e=~e+1:t+=1,TZs(e,t)}var B_p=e=>{let t=String(e);return"0000000".slice(t.length)+t};function RZs(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function T_p(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var Dj=TqE();function TqE(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),n=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(o){let c=typeof o=="bigint"?o:BigInt(o);if(c>i||c<r)throw new Error(`invalid int64: ${o}`);return c},uParse(o){let c=typeof o=="bigint"?o:BigInt(o);if(c>a||c<n)throw new Error(`invalid uint64: ${o}`);return c},enc(o){return e.setBigInt64(0,this.parse(o),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(o){return e.setBigInt64(0,this.uParse(o),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(o,c){return e.setInt32(0,o,!0),e.setInt32(4,c,!0),e.getBigInt64(0,!0)},uDec(o,c){return e.setInt32(0,o,!0),e.setInt32(4,c,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),R_p(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),z_p(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),R_p(r),CZs(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),z_p(r),CZs(r)},dec(r,i){return C_p(r,i)},uDec(r,i){return qZs(r,i)}}}function R_p(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function z_p(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}function kRi(e,t){switch(e){case $r.STRING:return"";case $r.BOOL:return!1;default:return 0;case $r.DOUBLE:case $r.FLOAT:return 0;case $r.INT64:case $r.UINT64:case $r.SFIXED64:case $r.FIXED64:case $r.SINT64:return t?"0":Dj.zero;case $r.BYTES:return new Uint8Array(0)}}function N_p(e,t){switch(e){case $r.BOOL:return t===!1;case $r.STRING:return t==="";case $r.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var uHt=class extends Error{constructor(t,r,i="FieldValueInvalidError"){super(r),this.name=i,this.field=()=>t}};var F_p=2,OLt=Symbol.for("reflect unsafe local");function JIo(e,t){let r=e[t.localName].case;return r===void 0?r:t.fields.find(i=>i.localName===r)}function Q_p(e,t){let r=t.localName;if(t.oneof)return e[t.oneof.localName].case===r;if(t.presence!=F_p)return e[r]!==void 0&&Object.prototype.hasOwnProperty.call(e,r);switch(t.fieldKind){case"list":return e[r].length>0;case"map":return Object.keys(e[r]).length>0;case"scalar":return!N_p(t.scalar,e[r]);case"enum":return e[r]!==t.enum.values[0].number}throw new Error("message field with implicit presence")}function hln(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function $Io(e,t){if(t.oneof){let r=e[t.oneof.localName];return r.case===t.localName?r.value:void 0}return e[t.localName]}function YIo(e,t,r){t.oneof?e[t.oneof.localName]={case:t.localName,value:r}:e[t.localName]=r}function U_p(e,t){let r=t.localName;if(t.oneof){let i=t.oneof.localName;e[i].case===r&&(e[i]={case:void 0})}else if(t.presence!=F_p)delete e[r];else switch(t.fieldKind){case"map":e[r]={};break;case"list":e[r]=[];break;case"enum":e[r]=t.enum.values[0].number;break;case"scalar":e[r]=kRi(t.scalar,t.longAsString);break}}function sHt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function wFa(e,t){var r,i,n,a;if(sHt(e)&&OLt in e&&"add"in e&&"field"in e&&typeof e.field=="function"){if(t!==void 0){let o=t,c=e.field();return o.listKind==c.listKind&&o.scalar===c.scalar&&((r=o.message)===null||r===void 0?void 0:r.typeName)===((i=c.message)===null||i===void 0?void 0:i.typeName)&&((n=o.enum)===null||n===void 0?void 0:n.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}function EFa(e,t){var r,i,n,a;if(sHt(e)&&OLt in e&&"has"in e&&"field"in e&&typeof e.field=="function"){if(t!==void 0){let o=t,c=e.field();return o.mapKey===c.mapKey&&o.mapKind==c.mapKind&&o.scalar===c.scalar&&((r=o.message)===null||r===void 0?void 0:r.typeName)===((i=c.message)===null||i===void 0?void 0:i.typeName)&&((n=o.enum)===null||n===void 0?void 0:n.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}function SFa(e,t){return sHt(e)&&OLt in e&&"desc"in e&&sHt(e.desc)&&e.desc.kind==="message"&&(t===void 0||e.desc.typeName==t.typeName)}function L_p(e){return V_p(e.$typeName)}function XIo(e){let t=e.fields[0];return V_p(e.typeName)&&t!==void 0&&t.fieldKind=="scalar"&&t.name=="value"&&t.number==1}function V_p(e){return e.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(e.substring(16))}var RqE=999,zqE=998,ZIo=2;function MFa(e,t){if(jFa(t,e))return t;let r=LqE(e);return t!==void 0&&NqE(e,r,t),r}function NqE(e,t,r){for(let i of e.members){let n=r[i.localName];if(n==null)continue;let a;if(i.kind=="oneof"){let o=JIo(r,i);if(!o)continue;a=o,n=$Io(r,o)}else a=i;switch(a.fieldKind){case"message":n=NZs(a,n);break;case"scalar":n=H_p(a,n);break;case"list":n=QqE(a,n);break;case"map":n=FqE(a,n);break}YIo(t,a,n)}return t}function H_p(e,t){return e.scalar==$r.BYTES?FZs(t):t}function FqE(e,t){if(sHt(t)){if(e.scalar==$r.BYTES)return W_p(t,FZs);if(e.mapKind=="message")return W_p(t,r=>NZs(e,r))}return t}function QqE(e,t){if(Array.isArray(t)){if(e.scalar==$r.BYTES)return t.map(FZs);if(e.listKind=="message")return t.map(r=>NZs(e,r))}return t}function NZs(e,t){if(e.fieldKind=="message"&&!e.oneof&&XIo(e.message))return H_p(e.message.fields[0],t);if(sHt(t)){if(e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!=="google.protobuf.Value")return t;if(!jFa(t,e.message))return MFa(e.message,t)}return t}function FZs(e){return Array.isArray(e)?new Uint8Array(e):e}function W_p(e,t){let r={};for(let i of Object.entries(e))r[i[0]]=t(i[1]);return r}var UqE=Symbol(),G_p=new WeakMap;function LqE(e){let t;if(VqE(e)){let r=G_p.get(e),i,n;if(r)({prototype:i,members:n}=r);else{i={},n=new Set;for(let a of e.members)a.kind!="oneof"&&(a.fieldKind!="scalar"&&a.fieldKind!="enum"||a.presence!=ZIo&&(n.add(a),i[a.localName]=zZs(a)));G_p.set(e,{prototype:i,members:n})}t=Object.create(i),t.$typeName=e.typeName;for(let a of e.members)n.has(a)||a.kind=="field"&&(a.fieldKind=="message"||(a.fieldKind=="scalar"||a.fieldKind=="enum")&&a.presence!=ZIo)||(t[a.localName]=zZs(a))}else{t={$typeName:e.typeName};for(let r of e.members)(r.kind=="oneof"||r.presence==ZIo)&&(t[r.localName]=zZs(r))}return t}function VqE(e){switch(e.file.edition){case RqE:return!1;case zqE:return!0;default:return e.fields.some(t=>t.presence!=ZIo&&t.fieldKind!="message"&&!t.oneof)}}function zZs(e){if(e.kind=="oneof")return{case:void 0};if(e.fieldKind=="list")return[];if(e.fieldKind=="map")return{};if(e.fieldKind=="message")return UqE;let t=e.getDefaultValue();return t!==void 0?e.fieldKind=="scalar"&&e.longAsString?t.toString():t:e.fieldKind=="scalar"?kRi(e.scalar,e.longAsString):e.enum.values[0].number}var QZs=Symbol.for("@bufbuild/protobuf/text-encoding");function DFa(){if(globalThis[QZs]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[QZs]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[QZs]}var $M;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})($M||($M={}));var LZs=34028234663852886e22,VZs=-34028234663852886e22,WZs=4294967295,GZs=2147483647,HZs=-2147483648,kIo=class{constructor(t=DFa().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let n=0;n<this.chunks.length;n++)t+=this.chunks[n].length;let r=new Uint8Array(t),i=0;for(let n=0;n<this.chunks.length;n++)r.set(this.chunks[n],i),i+=this.chunks[n].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(x_p(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return UZs(t),RZs(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){WqE(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){x_p(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){UZs(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return UZs(t),t=(t<<1^t>>31)>>>0,RZs(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),i=new DataView(r.buffer),n=Dj.enc(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),i=new DataView(r.buffer),n=Dj.uEnc(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(r)}int64(t){let r=Dj.enc(t);return KIo(r.lo,r.hi,this.buf),this}sint64(t){let r=Dj.enc(t),i=r.hi>>31,n=r.lo<<1^i,a=(r.hi<<1|r.lo>>>31)^i;return KIo(n,a,this.buf),this}uint64(t){let r=Dj.uEnc(t);return KIo(r.lo,r.hi,this.buf),this}},eCo=class{constructor(t,r=DFa().decodeUtf8){this.decodeUtf8=r,this.varint64=I_p,this.uint32=T_p,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,i=t&7;if(r<=0||i<0||i>5)throw new Error("illegal tag: field no "+r+" wire type "+i);return[r,i]}skip(t,r){let i=this.pos;switch(t){case $M.Varint:for(;this.buf[this.pos++]&128;);break;case $M.Bit64:this.pos+=4;case $M.Bit32:this.pos+=4;break;case $M.LengthDelimited:let n=this.uint32();this.pos+=n;break;case $M.StartGroup:for(;;){let[a,o]=this.tag();if(o===$M.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(o,a)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Dj.dec(...this.varint64())}uint64(){return Dj.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),i=-(t&1);return t=(t>>>1|(r&1)<<31)^i,r=r>>>1^i,Dj.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Dj.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dj.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function UZs(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>GZs||e<HZs)throw new Error("invalid int32: "+e)}function x_p(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>WZs||e<0)throw new Error("invalid uint32: "+e)}function WqE(e){if(typeof e=="string"){let t=e;if(e=Number(e),isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>LZs||e<VZs))throw new Error("invalid float32: "+e)}function K_p(e,t){let r=e.fieldKind=="list"?wFa(t,e):e.fieldKind=="map"?EFa(t,e):KZs(e,t);if(r===!0)return;let i;switch(e.fieldKind){case"list":i=`expected ${X_p(e)}, got ${rCo(t)}`;break;case"map":i=`expected ${Z_p(e)}, got ${rCo(t)}`;break;default:i=tCo(e,t,r)}return new uHt(e,i)}function xZs(e,t,r){let i=KZs(e,r);if(i!==!0)return new uHt(e,`list item #${t+1}: ${tCo(e,r,i)}`)}function J_p(e,t,r){let i=$_p(t,e.mapKey);if(i!==!0)return new uHt(e,`invalid map key: ${tCo({scalar:e.mapKey},t,i)}`);let n=KZs(e,r);if(n!==!0)return new uHt(e,`map entry ${rCo(t)}: ${tCo(e,r,n)}`)}function KZs(e,t){return e.scalar!==void 0?$_p(t,e.scalar):e.enum!==void 0?e.enum.open?Number.isInteger(t):e.enum.values.some(r=>r.number===t):SFa(t,e.message)}function $_p(e,t){switch(t){case $r.DOUBLE:return typeof e=="number";case $r.FLOAT:return typeof e!="number"?!1:Number.isNaN(e)||!Number.isFinite(e)?!0:e>LZs||e<VZs?`${e.toFixed()} out of range`:!0;case $r.INT32:case $r.SFIXED32:case $r.SINT32:return typeof e!="number"||!Number.isInteger(e)?!1:e>GZs||e<HZs?`${e.toFixed()} out of range`:!0;case $r.FIXED32:case $r.UINT32:return typeof e!="number"||!Number.isInteger(e)?!1:e>WZs||e<0?`${e.toFixed()} out of range`:!0;case $r.BOOL:return typeof e=="boolean";case $r.STRING:return typeof e!="string"?!1:DFa().checkUtf8(e)||"invalid UTF8";case $r.BYTES:return e instanceof Uint8Array;case $r.INT64:case $r.SFIXED64:case $r.SINT64:if(typeof e=="bigint"||typeof e=="number"||typeof e=="string"&&e.length>0)try{return Dj.parse(e),!0}catch{return`${e} out of range`}return!1;case $r.FIXED64:case $r.UINT64:if(typeof e=="bigint"||typeof e=="number"||typeof e=="string"&&e.length>0)try{return Dj.uParse(e),!0}catch{return`${e} out of range`}return!1}}function tCo(e,t,r){return r=typeof r=="string"?`: ${r}`:`, got ${rCo(t)}`,e.scalar!==void 0?`expected ${GqE(e.scalar)}`+r:e.enum!==void 0?`expected ${e.enum.toString()}`+r:`expected ${Y_p(e.message)}`+r}function rCo(e){switch(typeof e){case"object":return e===null?"null":e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:wFa(e)?X_p(e.field()):EFa(e)?Z_p(e.field()):SFa(e)?Y_p(e.desc):jFa(e)?`message ${e.$typeName}`:"object";case"string":return e.length>30?"string":`"${e.split('"').join('\\"')}"`;case"boolean":return String(e);case"number":return String(e);case"bigint":return String(e)+"n";default:return typeof e}}function Y_p(e){return`ReflectMessage (${e.typeName})`}function X_p(e){switch(e.listKind){case"message":return`ReflectList (${e.message.toString()})`;case"enum":return`ReflectList (${e.enum.toString()})`;case"scalar":return`ReflectList (${$r[e.scalar]})`}}function Z_p(e){switch(e.mapKind){case"message":return`ReflectMap (${$r[e.mapKey]}, ${e.message.toString()})`;case"enum":return`ReflectMap (${$r[e.mapKey]}, ${e.enum.toString()})`;case"scalar":return`ReflectMap (${$r[e.mapKey]}, ${$r[e.scalar]})`}}function GqE(e){switch(e){case $r.STRING:return"string";case $r.BOOL:return"boolean";case $r.INT64:case $r.SINT64:case $r.SFIXED64:return"bigint (int64)";case $r.UINT64:case $r.FIXED64:return"bigint (uint64)";case $r.BYTES:return"Uint8Array";case $r.DOUBLE:return"number (float64)";case $r.FLOAT:return"number (float32)";case $r.FIXED32:case $r.UINT32:return"number (uint32)";case $r.INT32:case $r.SFIXED32:case $r.SINT32:return"number (int32)"}}function aKn(e,t,r=!0){return new nCo(e,t,r)}var nCo=class{get sortedFields(){var t;return(t=this._sortedFields)!==null&&t!==void 0?t:this._sortedFields=this.desc.fields.concat().sort((r,i)=>r.number-i.number)}constructor(t,r,i=!0){this.lists=new Map,this.maps=new Map,this.check=i,this.desc=t,this.message=this[OLt]=r??MFa(t),this.fields=t.fields,this.oneofs=t.oneofs,this.members=t.members}findNumber(t){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(r=>[r.number,r]))),this._fieldsByNumber.get(t)}oneofCase(t){return BFa(this.message,t),JIo(this.message,t)}isSet(t){return BFa(this.message,t),Q_p(this.message,t)}clear(t){BFa(this.message,t),U_p(this.message,t)}get(t){BFa(this.message,t);let r=$Io(this.message,t);switch(t.fieldKind){case"list":let i=this.lists.get(t);return(!i||i[OLt]!==r)&&this.lists.set(t,i=new YZs(t,r,this.check)),i;case"map":let n=this.maps.get(t);return(!n||n[OLt]!==r)&&this.maps.set(t,n=new XZs(t,r,this.check)),n;case"message":return kZs(t,r,this.check);case"scalar":return r===void 0?kRi(t.scalar,!1):e2s(t,r);case"enum":return r??t.enum.values[0].number}}set(t,r){if(BFa(this.message,t),this.check){let n=K_p(t,r);if(n)throw n}let i;t.fieldKind=="message"?i=ZZs(t,r):EFa(r)||wFa(r)?i=r[OLt]:i=t2s(t,r),YIo(this.message,t,i)}getUnknown(){return this.message.$unknown}setUnknown(t){this.message.$unknown=t}};function BFa(e,t){if(t.parent.typeName!==e.$typeName)throw new uHt(t,`cannot use ${t.toString()} with message ${e.$typeName}`,"ForeignFieldError")}var YZs=class{field(){return this._field}get size(){return this._arr.length}constructor(t,r,i){this._field=t,this._arr=this[OLt]=r,this.check=i}get(t){let r=this._arr[t];return r===void 0?void 0:JZs(this._field,r,this.check)}set(t,r){if(t<0||t>=this._arr.length)throw new uHt(this._field,`list item #${t+1}: out of range`);if(this.check){let i=xZs(this._field,t,r);if(i)throw i}this._arr[t]=k_p(this._field,r)}add(t){if(this.check){let r=xZs(this._field,this._arr.length,t);if(r)throw r}this._arr.push(k_p(this._field,t))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let t of this._arr)yield JZs(this._field,t,this.check)}*entries(){for(let t=0;t<this._arr.length;t++)yield[t,JZs(this._field,this._arr[t],this.check)]}};var XZs=class{constructor(t,r,i=!0){this.obj=this[OLt]=r??{},this.check=i,this._field=t}field(){return this._field}set(t,r){if(this.check){let i=J_p(this._field,t,r);if(i)throw i}return this.obj[iCo(t)]=HqE(this._field,r),this}delete(t){let r=iCo(t),i=Object.prototype.hasOwnProperty.call(this.obj,r);return i&&delete this.obj[r],i}clear(){for(let t of Object.keys(this.obj))delete this.obj[t]}get(t){let r=this.obj[iCo(t)];return r!==void 0&&(r=$Zs(this._field,r,this.check)),r}has(t){return Object.prototype.hasOwnProperty.call(this.obj,iCo(t))}*keys(){for(let t of Object.keys(this.obj))yield ehp(t,this._field.mapKey)}*entries(){for(let t of Object.entries(this.obj))yield[ehp(t[0],this._field.mapKey),$Zs(this._field,t[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let t of Object.values(this.obj))yield $Zs(this._field,t,this.check)}forEach(t,r){for(let i of this.entries())t.call(r,i[1],i[0],this)}};function ZZs(e,t){return SFa(t)?L_p(t.message)&&!e.oneof&&e.fieldKind=="message"?t.message.value:t.desc.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"?rhp(t.message):t.message:t}function kZs(e,t,r){return t!==void 0&&(XIo(e.message)&&!e.oneof&&e.fieldKind=="message"?t={$typeName:e.message.typeName,value:e2s(e.message.fields[0],t)}:e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"&&sHt(t)&&(t=thp(t))),new nCo(e.message,t,r)}function k_p(e,t){return e.listKind=="message"?ZZs(e,t):t2s(e,t)}function JZs(e,t,r){return e.listKind=="message"?kZs(e,t,r):e2s(e,t)}function HqE(e,t){return e.mapKind=="message"?ZZs(e,t):t2s(e,t)}function $Zs(e,t,r){return e.mapKind=="message"?kZs(e,t,r):t}function iCo(e){return typeof e=="string"||typeof e=="number"?e:String(e)}function ehp(e,t){switch(t){case $r.STRING:return e;case $r.INT32:case $r.FIXED32:case $r.UINT32:case $r.SFIXED32:case $r.SINT32:{let r=Number.parseInt(e);if(Number.isFinite(r))return r;break}case $r.BOOL:switch(e){case"true":return!0;case"false":return!1}break;case $r.UINT64:case $r.FIXED64:try{return Dj.uParse(e)}catch{}break;default:try{return Dj.parse(e)}catch{}break}return e}function e2s(e,t){switch(e.scalar){case $r.INT64:case $r.SFIXED64:case $r.SINT64:"longAsString"in e&&e.longAsString&&typeof t=="string"&&(t=Dj.parse(t));break;case $r.FIXED64:case $r.UINT64:"longAsString"in e&&e.longAsString&&typeof t=="string"&&(t=Dj.uParse(t));break}return t}function t2s(e,t){switch(e.scalar){case $r.INT64:case $r.SFIXED64:case $r.SINT64:"longAsString"in e&&e.longAsString?t=String(t):(typeof t=="string"||typeof t=="number")&&(t=Dj.parse(t));break;case $r.FIXED64:case $r.UINT64:"longAsString"in e&&e.longAsString?t=String(t):(typeof t=="string"||typeof t=="number")&&(t=Dj.uParse(t));break}return t}function thp(e){let t={$typeName:"google.protobuf.Struct",fields:{}};if(sHt(e))for(let[r,i]of Object.entries(e))t.fields[r]=nhp(i);return t}function rhp(e){let t={};for(let[r,i]of Object.entries(e.fields))t[r]=ihp(i);return t}function ihp(e){switch(e.kind.case){case"structValue":return rhp(e.kind.value);case"listValue":return e.kind.value.values.map(ihp);case"nullValue":case void 0:return null;default:return e.kind.value}}function nhp(e){let t={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof e){case"number":t.kind={case:"numberValue",value:e};break;case"string":t.kind={case:"stringValue",value:e};break;case"boolean":t.kind={case:"boolValue",value:e};break;case"object":if(e===null)t.kind={case:"nullValue",value:0};else if(Array.isArray(e)){let r={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(e))for(let i of e)r.values.push(nhp(i));t.kind={case:"listValue",value:r}}else t.kind={case:"structValue",value:thp(e)};break}return t}function ohp(e){let t=KqE(),r=e.length*3/4;e[e.length-2]=="="?r-=2:e[e.length-1]=="="&&(r-=1);let i=new Uint8Array(r),n=0,a=0,o,c=0;for(let d=0;d<e.length;d++){if(o=t[e.charCodeAt(d)],o===void 0)switch(e[d]){case"=":a=0;case`
794
794
  `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(a){case 0:c=o,a=1;break;case 1:i[n++]=c<<2|(o&48)>>4,c=o,a=2;break;case 2:i[n++]=(c&15)<<4|(o&60)>>2,c=o,a=3;break;case 3:i[n++]=(c&3)<<6|o,a=0;break}}if(a==1)throw Error("invalid base64 string");return i.subarray(0,n)}var aCo,ahp,oKn;function xqE(e){return aCo||(aCo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ahp=aCo.slice(0,-2).concat("-","_")),e=="url"?ahp:aCo}function KqE(){if(!oKn){oKn=[];let e=xqE("std");for(let t=0;t<e.length;t++)oKn[e[t].charCodeAt(0)]=t;oKn[45]=e.indexOf("+"),oKn[95]=e.indexOf("/")}return oKn}function uKn(e){let t=!1,r=[];for(let i=0;i<e.length;i++){let n=e.charAt(i);switch(n){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r.push(n),t=!1;break;default:t&&(t=!1,n=n.toUpperCase()),r.push(n);break}}return r.join("")}var JqE=new Set(["constructor","toString","toJSON","valueOf"]);function sKn(e){return JqE.has(e)?e+"$":e}function IFa(e){for(let t of e.field)hln(t,"jsonName")||(t.jsonName=uKn(t.name));e.nestedType.forEach(IFa)}function uhp(e,t){let r=e.values.find(i=>i.name===t);if(!r)throw new Error(`cannot parse ${e} default value: ${t}`);return r.number}function shp(e,t){switch(e){case $r.STRING:return t;case $r.BYTES:{let r=$qE(t);if(r===!1)throw new Error(`cannot parse ${$r[e]} default value: ${t}`);return r}case $r.INT64:case $r.SFIXED64:case $r.SINT64:return Dj.parse(t);case $r.UINT64:case $r.FIXED64:return Dj.uParse(t);case $r.DOUBLE:case $r.FLOAT:switch(t){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(t)}case $r.BOOL:return t==="true";case $r.INT32:case $r.UINT32:case $r.SINT32:case $r.FIXED32:case $r.SFIXED32:return parseInt(t,10)}}function $qE(e){let t=[],r={tail:e,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(i){if(this.tail.length>=i){let n=this.tail.substring(0,i);return this.tail=this.tail.substring(i),n}return!1}};for(;r.next();)switch(r.c){case"\\":if(r.next())switch(r.c){case"\\":t.push(r.c.charCodeAt(0));break;case"b":t.push(8);break;case"f":t.push(12);break;case"n":t.push(10);break;case"r":t.push(13);break;case"t":t.push(9);break;case"v":t.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i=r.c,n=r.take(2);if(n===!1)return!1;let a=parseInt(i+n,8);if(isNaN(a))return!1;t.push(a);break}case"x":{let i=r.c,n=r.take(2);if(n===!1)return!1;let a=parseInt(i+n,16);if(isNaN(a))return!1;t.push(a);break}case"u":{let i=r.c,n=r.take(4);if(n===!1)return!1;let a=parseInt(i+n,16);if(isNaN(a))return!1;let o=new Uint8Array(4);new DataView(o.buffer).setInt32(0,a,!0),t.push(o[0],o[1],o[2],o[3]);break}case"U":{let i=r.c,n=r.take(8);if(n===!1)return!1;let a=Dj.uEnc(i+n),o=new Uint8Array(8),c=new DataView(o.buffer);c.setInt32(0,a.lo,!0),c.setInt32(4,a.hi,!0),t.push(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7]);break}}break;default:t.push(r.c.charCodeAt(0))}return new Uint8Array(t)}function*oCo(e){switch(e.kind){case"file":for(let t of e.messages)yield t,yield*oCo(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case"message":for(let t of e.nestedMessages)yield t,yield*oCo(t);yield*e.nestedEnums,yield*e.nestedExtensions;break}}function sCo(...e){let t=YqE();if(!e.length)return t;if("$typeName"in e[0]&&e[0].$typeName=="google.protobuf.FileDescriptorSet"){for(let i of e[0].file)fhp(i,t);return t}if("$typeName"in e[0]){let o=function(c){let d=[];for(let s of c.dependency){if(t.getFile(s)!=null||a.has(s))continue;let u=n(s);if(!u)throw new Error(`Unable to resolve ${s}, imported by ${c.name}`);"kind"in u?t.addFile(u,!1,!0):(a.add(u.name),d.push(u))}return d.concat(...d.map(o))};var r=o;let i=e[0],n=e[1],a=new Set;for(let c of[i,...o(i)].reverse())fhp(c,t)}else for(let i of e)for(let n of i.files)t.addFile(n);return t}function YqE(){let e=new Map,t=new Map,r=new Map;return{kind:"registry",types:e,extendees:t,[Symbol.iterator](){return e.values()},get files(){return r.values()},addFile(i,n,a){if(r.set(i.proto.name,i),!n)for(let o of oCo(i))this.add(o);if(a)for(let o of i.dependencies)this.addFile(o,n,a)},add(i){if(i.kind=="extension"){let n=t.get(i.extendee.typeName);n||t.set(i.extendee.typeName,n=new Map),n.set(i.number,i)}e.set(i.typeName,i)},get(i){return e.get(i)},getFile(i){return r.get(i)},getMessage(i){let n=e.get(i);return n?.kind=="message"?n:void 0},getEnum(i){let n=e.get(i);return n?.kind=="enum"?n:void 0},getExtension(i){let n=e.get(i);return n?.kind=="extension"?n:void 0},getExtensionFor(i,n){var a;return(a=t.get(i.typeName))===null||a===void 0?void 0:a.get(n)},getService(i){let n=e.get(i);return n?.kind=="service"?n:void 0}}}var XqE=998,ZqE=999,kqE=9,uCo=10,CFa=11,e1E=12,chp=14,o2s=3,t1E=2,lhp=1,r1E=0,r2s=1,i1E=2,n1E=3,a1E=1,o1E=2,u1E=1,php=998,_hp=1e3,hhp={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2}};function fhp(e,t){var r,i;let n={kind:"file",proto:e,deprecated:(i=(r=e.options)===null||r===void 0?void 0:r.deprecated)!==null&&i!==void 0?i:!1,edition:f1E(e),name:e.name.replace(/\.proto$/,""),dependencies:d1E(e,t),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},a=new Map,o={get(c){return a.get(c)},add(c){var d;ALt(((d=c.proto.options)===null||d===void 0?void 0:d.mapEntry)===!0),a.set(c.typeName,c)}};for(let c of e.enumType)yhp(c,n,void 0,t);for(let c of e.messageType)bhp(c,n,void 0,t,o);for(let c of e.service)s1E(c,n,t);i2s(n,t);for(let c of a.values())n2s(c,t,o);for(let c of n.messages)n2s(c,t,o),i2s(c,t);t.addFile(n,!0)}function i2s(e,t){switch(e.kind){case"file":for(let r of e.proto.extension){let i=a2s(r,e,t);e.extensions.push(i),t.add(i)}break;case"message":for(let r of e.proto.extension){let i=a2s(r,e,t);e.nestedExtensions.push(i),t.add(i)}for(let r of e.nestedMessages)i2s(r,t);break}}function n2s(e,t,r){let i=e.proto.oneofDecl.map(a=>l1E(a,e)),n=new Set;for(let a of e.proto.field){let o=h1E(a,i),c=a2s(a,e,t,o,r);e.fields.push(c),e.field[c.localName]=c,o===void 0?e.members.push(c):(o.fields.push(c),n.has(o)||(n.add(o),e.members.push(o)))}for(let a of i.filter(o=>n.has(o)))e.oneofs.push(a);for(let a of e.nestedMessages)n2s(a,t,r)}function yhp(e,t,r,i){var n,a,o;let c=p1E(e.name,e.value),d={kind:"enum",proto:e,deprecated:(a=(n=e.options)===null||n===void 0?void 0:n.deprecated)!==null&&a!==void 0?a:!1,file:t,parent:r,open:!0,name:e.name,typeName:cCo(e,r,t),value:{},values:[],sharedPrefix:c,toString(){return`enum ${this.typeName}`}};d.open=g1E(d),i.add(d),e.value.forEach(s=>{var u,l;let p=s.name;d.values.push(d.value[s.number]={kind:"enum_value",proto:s,deprecated:(l=(u=s.options)===null||u===void 0?void 0:u.deprecated)!==null&&l!==void 0?l:!1,parent:d,name:p,localName:sKn(c==null?p:p.substring(c.length)),number:s.number,toString(){return`enum value ${d.typeName}.${p}`}})}),((o=r?.nestedEnums)!==null&&o!==void 0?o:t.enums).push(d)}function bhp(e,t,r,i,n){var a,o,c,d;let s={kind:"message",proto:e,deprecated:(o=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&o!==void 0?o:!1,file:t,parent:r,name:e.name,typeName:cCo(e,r,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};((c=e.options)===null||c===void 0?void 0:c.mapEntry)===!0?n.add(s):(((d=r?.nestedMessages)!==null&&d!==void 0?d:t.messages).push(s),i.add(s));for(let u of e.enumType)yhp(u,t,s,i);for(let u of e.nestedType)bhp(u,t,s,i,n)}function s1E(e,t,r){var i,n;let a={kind:"service",proto:e,deprecated:(n=(i=e.options)===null||i===void 0?void 0:i.deprecated)!==null&&n!==void 0?n:!1,file:t,name:e.name,typeName:cCo(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(a),r.add(a);for(let o of e.method){let c=c1E(o,a,r);a.methods.push(c),a.method[c.localName]=c}}function c1E(e,t,r){var i,n,a,o;let c;e.clientStreaming&&e.serverStreaming?c="bidi_streaming":e.clientStreaming?c="client_streaming":e.serverStreaming?c="server_streaming":c="unary";let d=r.getMessage(ezi(e.inputType)),s=r.getMessage(ezi(e.outputType));ALt(d,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),ALt(s,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let u=e.name;return{kind:"rpc",proto:e,deprecated:(n=(i=e.options)===null||i===void 0?void 0:i.deprecated)!==null&&n!==void 0?n:!1,parent:t,name:u,localName:sKn(u.length?sKn(u[0].toLowerCase()+u.substring(1)):u),methodKind:c,input:d,output:s,idempotency:(o=(a=e.options)===null||a===void 0?void 0:a.idempotencyLevel)!==null&&o!==void 0?o:r1E,toString(){return`rpc ${t.typeName}.${u}`}}}function l1E(e,t){return{kind:"oneof",proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:sKn(uKn(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}function a2s(e,t,r,i,n){var a,o,c;let d=n===void 0,s={kind:"field",proto:e,deprecated:(o=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&o!==void 0?o:!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:y1E(e,i,d,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(d){let _=t.kind=="file"?t:t.file,h=t.kind=="file"?void 0:t,y=cCo(e,h,_);s.kind="extension",s.file=_,s.parent=h,s.oneof=void 0,s.typeName=y,s.jsonName=`[${y}]`,s.toString=()=>`extension ${y}`;let b=r.getMessage(ezi(e.extendee));ALt(b,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),s.extendee=b}else{let _=t;ALt(_.kind=="message"),s.parent=_,s.oneof=i,s.localName=i?uKn(e.name):sKn(uKn(e.name)),s.jsonName=e.jsonName,s.toString=()=>`field ${_.typeName}.${e.name}`}let u=e.label,l=e.type,p=(c=e.options)===null||c===void 0?void 0:c.jstype;if(u===o2s){let _=l==CFa?n?.get(ezi(e.typeName)):void 0;if(_){s.fieldKind="map";let{key:h,value:y}=v1E(_);return s.mapKey=h.scalar,s.mapKind=y.fieldKind,s.message=y.message,s.delimitedEncoding=!1,s.enum=y.enum,s.scalar=y.scalar,s}switch(s.fieldKind="list",l){case CFa:case uCo:s.listKind="message",s.message=r.getMessage(ezi(e.typeName)),ALt(s.message),s.delimitedEncoding=dhp(e,t);break;case chp:s.listKind="enum",s.enum=r.getEnum(ezi(e.typeName)),ALt(s.enum);break;default:s.listKind="scalar",s.scalar=l,s.longAsString=p==lhp;break}return s.packed=b1E(e,t),s}switch(l){case CFa:case uCo:s.fieldKind="message",s.message=r.getMessage(ezi(e.typeName)),ALt(s.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),s.delimitedEncoding=dhp(e,t),s.getDefaultValue=()=>{};break;case chp:{let _=r.getEnum(ezi(e.typeName));ALt(_!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),s.fieldKind="enum",s.enum=r.getEnum(ezi(e.typeName)),s.getDefaultValue=()=>hln(e,"defaultValue")?uhp(_,e.defaultValue):void 0;break}default:{s.fieldKind="scalar",s.scalar=l,s.longAsString=p==lhp,s.getDefaultValue=()=>hln(e,"defaultValue")?shp(l,e.defaultValue):void 0;break}}return s}function f1E(e){switch(e.syntax){case"":case"proto2":return XqE;case"proto3":return ZqE;case"editions":if(e.edition in hhp)return e.edition;throw new Error(`${e.name}: unsupported edition`);default:throw new Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function d1E(e,t){return e.dependency.map(r=>{let i=t.getFile(r);if(!i)throw new Error(`Cannot find ${r}, imported by ${e.name}`);return i})}function p1E(e,t){let r=_1E(e)+"_";for(let i of t){if(!i.name.toLowerCase().startsWith(r))return;let n=i.name.substring(r.length);if(n.length==0||/^\d/.test(n))return}return r}function _1E(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,t=>"_"+t)).toLowerCase()}function cCo(e,t,r){let i;return t?i=`${t.typeName}.${e.name}`:r.proto.package.length>0?i=`${r.proto.package}.${e.name}`:i=`${e.name}`,i}function ezi(e){return e.startsWith(".")?e.substring(1):e}function h1E(e,t){if(!hln(e,"oneofIndex")||e.proto3Optional)return;let r=t[e.oneofIndex];return ALt(r,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),r}function y1E(e,t,r,i){return e.label==t1E?n1E:e.label==o2s?i1E:t||e.proto3Optional||e.type==CFa||r?r2s:cKn("fieldPresence",{proto:e,parent:i})}function b1E(e,t){if(e.label!=o2s)return!1;switch(e.type){case kqE:case e1E:case uCo:case CFa:return!1}let r=e.options;return r&&hln(r,"packed")?r.packed:a1E==cKn("repeatedFieldEncoding",{proto:e,parent:t})}function v1E(e){let t=e.fields.find(i=>i.number===1),r=e.fields.find(i=>i.number===2);return ALt(t&&t.fieldKind=="scalar"&&t.scalar!=$r.BYTES&&t.scalar!=$r.FLOAT&&t.scalar!=$r.DOUBLE&&r&&r.fieldKind!="list"&&r.fieldKind!="map"),{key:t,value:r}}function g1E(e){var t;return u1E==cKn("enumType",{proto:e.proto,parent:(t=e.parent)!==null&&t!==void 0?t:e.file})}function dhp(e,t){return e.type==uCo?!0:o1E==cKn("messageEncoding",{proto:e,parent:t})}function cKn(e,t){var r,i;let n=(r=t.proto.options)===null||r===void 0?void 0:r.features;if(n){let a=n[e];if(a!=0)return a}if("kind"in t){if(t.kind=="message")return cKn(e,(i=t.parent)!==null&&i!==void 0?i:t.file);let a=hhp[t.edition];if(!a)throw new Error(`feature default for edition ${t.edition} not found`);return a[e]}return cKn(e,t.parent)}function ALt(e,t){if(!e)throw new Error(t)}function vhp(e){let t=O1E(e);return t.messageType.forEach(IFa),sCo(t,()=>{}).getFile(t.name)}function O1E(e){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(ghp),enumType:e.enumType.map(Ohp)}))}function ghp(e){var t,r,i,n,a,o,c,d;return{$typeName:"google.protobuf.DescriptorProto",name:e.name,field:(r=(t=e.field)===null||t===void 0?void 0:t.map(A1E))!==null&&r!==void 0?r:[],extension:[],nestedType:(n=(i=e.nestedType)===null||i===void 0?void 0:i.map(ghp))!==null&&n!==void 0?n:[],enumType:(o=(a=e.enumType)===null||a===void 0?void 0:a.map(Ohp))!==null&&o!==void 0?o:[],extensionRange:(d=(c=e.extensionRange)===null||c===void 0?void 0:c.map(s=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},s)))!==null&&d!==void 0?d:[],oneofDecl:[],reservedRange:[],reservedName:[]}}function A1E(e){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},e),{options:e.options?m1E(e.options):void 0}))}function m1E(e){var t,r,i;return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},e),{targets:(t=e.targets)!==null&&t!==void 0?t:[],editionDefaults:(i=(r=e.editionDefaults)===null||r===void 0?void 0:r.map(a=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},a)))!==null&&i!==void 0?i:[],uninterpretedOption:[]}))}function Ohp(e){return{$typeName:"google.protobuf.EnumDescriptorProto",name:e.name,reservedName:[],reservedRange:[],value:e.value.map(t=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},t))}}function qFa(e,t,...r){return r.reduce((i,n)=>i.nestedMessages[n],e.messages[t])}var u2s=vhp({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:536000001}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false"},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"MessageOptions",field:[{name:"message_set_wire_format",number:1,type:8,label:1,defaultValue:"false"},{name:"no_standard_descriptor_accessor",number:2,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"map_entry",number:7,type:8,label:1},{name:"deprecated_legacy_json_field_conflicts",number:11,type:8,label:1,options:{deprecated:!0}},{name:"features",number:12,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldOptions",field:[{name:"ctype",number:1,type:14,label:1,typeName:".google.protobuf.FieldOptions.CType",defaultValue:"STRING"},{name:"packed",number:2,type:8,label:1},{name:"jstype",number:6,type:14,label:1,typeName:".google.protobuf.FieldOptions.JSType",defaultValue:"JS_NORMAL"},{name:"lazy",number:5,type:8,label:1,defaultValue:"false"},{name:"unverified_lazy",number:15,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"weak",number:10,type:8,label:1,defaultValue:"false"},{name:"debug_redact",number:16,type:8,label:1,defaultValue:"false"},{name:"retention",number:17,type:14,label:1,typeName:".google.protobuf.FieldOptions.OptionRetention"},{name:"targets",number:19,type:14,label:3,typeName:".google.protobuf.FieldOptions.OptionTargetType"},{name:"edition_defaults",number:20,type:11,label:3,typeName:".google.protobuf.FieldOptions.EditionDefault"},{name:"features",number:21,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"feature_support",number:22,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],nestedType:[{name:"EditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"value",number:2,type:9,label:1}]},{name:"FeatureSupport",field:[{name:"edition_introduced",number:1,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"edition_deprecated",number:2,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"deprecation_warning",number:3,type:9,label:1},{name:"edition_removed",number:4,type:14,label:1,typeName:".google.protobuf.Edition"}]}],enumType:[{name:"CType",value:[{name:"STRING",number:0},{name:"CORD",number:1},{name:"STRING_PIECE",number:2}]},{name:"JSType",value:[{name:"JS_NORMAL",number:0},{name:"JS_STRING",number:1},{name:"JS_NUMBER",number:2}]},{name:"OptionRetention",value:[{name:"RETENTION_UNKNOWN",number:0},{name:"RETENTION_RUNTIME",number:1},{name:"RETENTION_SOURCE",number:2}]},{name:"OptionTargetType",value:[{name:"TARGET_TYPE_UNKNOWN",number:0},{name:"TARGET_TYPE_FILE",number:1},{name:"TARGET_TYPE_EXTENSION_RANGE",number:2},{name:"TARGET_TYPE_MESSAGE",number:3},{name:"TARGET_TYPE_FIELD",number:4},{name:"TARGET_TYPE_ONEOF",number:5},{name:"TARGET_TYPE_ENUM",number:6},{name:"TARGET_TYPE_ENUM_ENTRY",number:7},{name:"TARGET_TYPE_SERVICE",number:8},{name:"TARGET_TYPE_METHOD",number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"OneofOptions",field:[{name:"features",number:1,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumOptions",field:[{name:"allow_alias",number:2,type:8,label:1},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"deprecated_legacy_json_field_conflicts",number:6,type:8,label:1,options:{deprecated:!0}},{name:"features",number:7,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumValueOptions",field:[{name:"deprecated",number:1,type:8,label:1,defaultValue:"false"},{name:"features",number:2,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"debug_redact",number:3,type:8,label:1,defaultValue:"false"},{name:"feature_support",number:4,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"ServiceOptions",field:[{name:"features",number:34,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"MethodOptions",field:[{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"idempotency_level",number:34,type:14,label:1,typeName:".google.protobuf.MethodOptions.IdempotencyLevel",defaultValue:"IDEMPOTENCY_UNKNOWN"},{name:"features",number:35,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"IdempotencyLevel",value:[{name:"IDEMPOTENCY_UNKNOWN",number:0},{name:"NO_SIDE_EFFECTS",number:1},{name:"IDEMPOTENT",number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"UninterpretedOption",field:[{name:"name",number:2,type:11,label:3,typeName:".google.protobuf.UninterpretedOption.NamePart"},{name:"identifier_value",number:3,type:9,label:1},{name:"positive_int_value",number:4,type:4,label:1},{name:"negative_int_value",number:5,type:3,label:1},{name:"double_value",number:6,type:1,label:1},{name:"string_value",number:7,type:12,label:1},{name:"aggregate_value",number:8,type:9,label:1}],nestedType:[{name:"NamePart",field:[{name:"name_part",number:1,type:9,label:2},{name:"is_extension",number:2,type:8,label:2}]}]},{name:"FeatureSet",field:[{name:"field_presence",number:1,type:14,label:1,typeName:".google.protobuf.FeatureSet.FieldPresence",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPLICIT",edition:900},{value:"IMPLICIT",edition:999},{value:"EXPLICIT",edition:1e3}]}},{name:"enum_type",number:2,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnumType",options:{retention:1,targets:[6,1],editionDefaults:[{value:"CLOSED",edition:900},{value:"OPEN",edition:999}]}},{name:"repeated_field_encoding",number:3,type:14,label:1,typeName:".google.protobuf.FeatureSet.RepeatedFieldEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPANDED",edition:900},{value:"PACKED",edition:999}]}},{name:"utf8_validation",number:4,type:14,label:1,typeName:".google.protobuf.FeatureSet.Utf8Validation",options:{retention:1,targets:[4,1],editionDefaults:[{value:"NONE",edition:900},{value:"VERIFY",edition:999}]}},{name:"message_encoding",number:5,type:14,label:1,typeName:".google.protobuf.FeatureSet.MessageEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"LENGTH_PREFIXED",edition:900}]}},{name:"json_format",number:6,type:14,label:1,typeName:".google.protobuf.FeatureSet.JsonFormat",options:{retention:1,targets:[3,6,1],editionDefaults:[{value:"LEGACY_BEST_EFFORT",edition:900},{value:"ALLOW",edition:999}]}},{name:"enforce_naming_style",number:7,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnforceNamingStyle",options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:"STYLE_LEGACY",edition:900},{value:"STYLE2024",edition:1001}]}}],enumType:[{name:"FieldPresence",value:[{name:"FIELD_PRESENCE_UNKNOWN",number:0},{name:"EXPLICIT",number:1},{name:"IMPLICIT",number:2},{name:"LEGACY_REQUIRED",number:3}]},{name:"EnumType",value:[{name:"ENUM_TYPE_UNKNOWN",number:0},{name:"OPEN",number:1},{name:"CLOSED",number:2}]},{name:"RepeatedFieldEncoding",value:[{name:"REPEATED_FIELD_ENCODING_UNKNOWN",number:0},{name:"PACKED",number:1},{name:"EXPANDED",number:2}]},{name:"Utf8Validation",value:[{name:"UTF8_VALIDATION_UNKNOWN",number:0},{name:"VERIFY",number:2},{name:"NONE",number:3}]},{name:"MessageEncoding",value:[{name:"MESSAGE_ENCODING_UNKNOWN",number:0},{name:"LENGTH_PREFIXED",number:1},{name:"DELIMITED",number:2}]},{name:"JsonFormat",value:[{name:"JSON_FORMAT_UNKNOWN",number:0},{name:"ALLOW",number:1},{name:"LEGACY_BEST_EFFORT",number:2}]},{name:"EnforceNamingStyle",value:[{name:"ENFORCE_NAMING_STYLE_UNKNOWN",number:0},{name:"STYLE2024",number:1},{name:"STYLE_LEGACY",number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:"FeatureSetDefaults",field:[{name:"defaults",number:1,type:11,label:3,typeName:".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"},{name:"minimum_edition",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"maximum_edition",number:5,type:14,label:1,typeName:".google.protobuf.Edition"}],nestedType:[{name:"FeatureSetEditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"overridable_features",number:4,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"fixed_features",number:5,type:11,label:1,typeName:".google.protobuf.FeatureSet"}]}]},{name:"SourceCodeInfo",field:[{name:"location",number:1,type:11,label:3,typeName:".google.protobuf.SourceCodeInfo.Location"}],nestedType:[{name:"Location",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"span",number:2,type:5,label:3,options:{packed:!0}},{name:"leading_comments",number:3,type:9,label:1},{name:"trailing_comments",number:4,type:9,label:1},{name:"leading_detached_comments",number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:"GeneratedCodeInfo",field:[{name:"annotation",number:1,type:11,label:3,typeName:".google.protobuf.GeneratedCodeInfo.Annotation"}],nestedType:[{name:"Annotation",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"source_file",number:2,type:9,label:1},{name:"begin",number:3,type:5,label:1},{name:"end",number:4,type:5,label:1},{name:"semantic",number:5,type:14,label:1,typeName:".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"}],enumType:[{name:"Semantic",value:[{name:"NONE",number:0},{name:"SET",number:1},{name:"ALIAS",number:2}]}]}]}],enumType:[{name:"Edition",value:[{name:"EDITION_UNKNOWN",number:0},{name:"EDITION_LEGACY",number:900},{name:"EDITION_PROTO2",number:998},{name:"EDITION_PROTO3",number:999},{name:"EDITION_2023",number:1e3},{name:"EDITION_2024",number:1001},{name:"EDITION_1_TEST_ONLY",number:1},{name:"EDITION_2_TEST_ONLY",number:2},{name:"EDITION_99997_TEST_ONLY",number:99997},{name:"EDITION_99998_TEST_ONLY",number:99998},{name:"EDITION_99999_TEST_ONLY",number:99999},{name:"EDITION_MAX",number:2147483647}]}]});var Nhp=qFa(u2s,1);var Ahp;(function(e){e[e.DECLARATION=0]="DECLARATION",e[e.UNVERIFIED=1]="UNVERIFIED"})(Ahp||(Ahp={}));var Vf;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.GROUP=10]="GROUP",e[e.MESSAGE=11]="MESSAGE",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.ENUM=14]="ENUM",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(Vf||(Vf={}));var lKn;(function(e){e[e.OPTIONAL=1]="OPTIONAL",e[e.REPEATED=3]="REPEATED",e[e.REQUIRED=2]="REQUIRED"})(lKn||(lKn={}));var mhp;(function(e){e[e.SPEED=1]="SPEED",e[e.CODE_SIZE=2]="CODE_SIZE",e[e.LITE_RUNTIME=3]="LITE_RUNTIME"})(mhp||(mhp={}));var Php;(function(e){e[e.STRING=0]="STRING",e[e.CORD=1]="CORD",e[e.STRING_PIECE=2]="STRING_PIECE"})(Php||(Php={}));var jhp;(function(e){e[e.JS_NORMAL=0]="JS_NORMAL",e[e.JS_STRING=1]="JS_STRING",e[e.JS_NUMBER=2]="JS_NUMBER"})(jhp||(jhp={}));var whp;(function(e){e[e.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",e[e.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",e[e.RETENTION_SOURCE=2]="RETENTION_SOURCE"})(whp||(whp={}));var Ehp;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",e[e.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",e[e.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",e[e.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",e[e.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",e[e.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",e[e.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",e[e.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",e[e.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",e[e.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD"})(Ehp||(Ehp={}));var Shp;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",e[e.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",e[e.IDEMPOTENT=2]="IDEMPOTENT"})(Shp||(Shp={}));var Mhp;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",e[e.EXPLICIT=1]="EXPLICIT",e[e.IMPLICIT=2]="IMPLICIT",e[e.LEGACY_REQUIRED=3]="LEGACY_REQUIRED"})(Mhp||(Mhp={}));var Dhp;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",e[e.OPEN=1]="OPEN",e[e.CLOSED=2]="CLOSED"})(Dhp||(Dhp={}));var Bhp;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",e[e.PACKED=1]="PACKED",e[e.EXPANDED=2]="EXPANDED"})(Bhp||(Bhp={}));var Ihp;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",e[e.VERIFY=2]="VERIFY",e[e.NONE=3]="NONE"})(Ihp||(Ihp={}));var Chp;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",e[e.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",e[e.DELIMITED=2]="DELIMITED"})(Chp||(Chp={}));var qhp;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",e[e.ALLOW=1]="ALLOW",e[e.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT"})(qhp||(qhp={}));var Thp;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]="ENFORCE_NAMING_STYLE_UNKNOWN",e[e.STYLE2024=1]="STYLE2024",e[e.STYLE_LEGACY=2]="STYLE_LEGACY"})(Thp||(Thp={}));var Rhp;(function(e){e[e.NONE=0]="NONE",e[e.SET=1]="SET",e[e.ALIAS=2]="ALIAS"})(Rhp||(Rhp={}));var zhp;(function(e){e[e.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",e[e.EDITION_LEGACY=900]="EDITION_LEGACY",e[e.EDITION_PROTO2=998]="EDITION_PROTO2",e[e.EDITION_PROTO3=999]="EDITION_PROTO3",e[e.EDITION_2023=1e3]="EDITION_2023",e[e.EDITION_2024=1001]="EDITION_2024",e[e.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",e[e.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",e[e.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",e[e.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",e[e.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY",e[e.EDITION_MAX=2147483647]="EDITION_MAX"})(zhp||(zhp={}));var Fhp={readUnknownFields:!0};function P1E(e){return e?Object.assign(Object.assign({},Fhp),e):Fhp}function TFa(e,t,r){let i=aKn(e,void 0,!1);return Qhp(i,new eCo(t),P1E(r),!1,t.byteLength),i.message}function Qhp(e,t,r,i,n){var a;let o=i?t.len:t.pos+n,c,d,s=(a=e.getUnknown())!==null&&a!==void 0?a:[];for(;t.pos<o&&([c,d]=t.tag(),!(i&&d==$M.EndGroup));){let u=e.findNumber(c);if(!u){let l=t.skip(d,c);r.readUnknownFields&&s.push({no:c,wireType:d,data:l});continue}j1E(e,t,u,d,r)}if(i&&(d!=$M.EndGroup||c!==n))throw new Error("invalid end group tag");s.length>0&&e.setUnknown(s)}function j1E(e,t,r,i,n){switch(r.fieldKind){case"scalar":e.set(r,fKn(t,r.scalar));break;case"enum":e.set(r,fKn(t,$r.INT32));break;case"message":e.set(r,s2s(t,n,r,e.get(r)));break;case"list":E1E(t,i,e.get(r),n);break;case"map":w1E(t,e.get(r),n);break}}function w1E(e,t,r){let i=t.field(),n,a,o=e.pos+e.uint32();for(;e.pos<o;){let[c]=e.tag();switch(c){case 1:n=fKn(e,i.mapKey);break;case 2:switch(i.mapKind){case"scalar":a=fKn(e,i.scalar);break;case"enum":a=e.int32();break;case"message":a=s2s(e,r,i);break}break}}if(n===void 0&&(n=kRi(i.mapKey,!1)),a===void 0)switch(i.mapKind){case"scalar":a=kRi(i.scalar,!1);break;case"enum":a=i.enum.values[0].number;break;case"message":a=aKn(i.message,void 0,!1);break}t.set(n,a)}function E1E(e,t,r,i){var n;let a=r.field();if(a.listKind==="message"){r.add(s2s(e,i,a));return}let o=(n=a.scalar)!==null&&n!==void 0?n:$r.INT32;if(!(t==$M.LengthDelimited&&o!=$r.STRING&&o!=$r.BYTES)){r.add(fKn(e,o));return}let d=e.uint32()+e.pos;for(;e.pos<d;)r.add(fKn(e,o))}function s2s(e,t,r,i){let n=r.delimitedEncoding,a=i??aKn(r.message,void 0,!1);return Qhp(a,e,t,n,n?r.number:e.uint32()),a}function fKn(e,t){switch(t){case $r.STRING:return e.string();case $r.BOOL:return e.bool();case $r.DOUBLE:return e.double();case $r.FLOAT:return e.float();case $r.INT32:return e.int32();case $r.INT64:return e.int64();case $r.UINT64:return e.uint64();case $r.FIXED64:return e.fixed64();case $r.BYTES:return e.bytes();case $r.FIXED32:return e.fixed32();case $r.SFIXED32:return e.sfixed32();case $r.SFIXED64:return e.sfixed64();case $r.SINT64:return e.sint64();case $r.UINT32:return e.uint32();case $r.SINT32:return e.sint32()}}function Uhp(e,t){var r;let i=TFa(Nhp,ohp(e));return i.messageType.forEach(IFa),i.dependency=(r=t?.map(a=>a.proto.name))!==null&&r!==void 0?r:[],sCo(i,a=>t?.find(o=>o.proto.name===a)).getFile(i.name)}var S1E=3,Lhp={writeUnknownFields:!0};function M1E(e){return e?Object.assign(Object.assign({},Lhp),e):Lhp}function c2s(e,t,r){return lCo(new kIo,M1E(r),aKn(e,t)).finish()}function lCo(e,t,r){var i;for(let n of r.sortedFields){if(!r.isSet(n)){if(n.presence==S1E)throw new Error(`cannot encode field ${r.desc.typeName}.${n.name} to binary: required field not set`);continue}D1E(e,t,r,n)}if(t.writeUnknownFields)for(let{no:n,wireType:a,data:o}of(i=r.getUnknown())!==null&&i!==void 0?i:[])e.tag(n,a).raw(o);return e}function D1E(e,t,r,i){var n;switch(i.fieldKind){case"scalar":case"enum":fCo(e,r.desc.typeName,i.name,(n=i.scalar)!==null&&n!==void 0?n:$r.INT32,i.number,r.get(i));break;case"list":B1E(e,t,i,r.get(i));break;case"message":Vhp(e,t,i,r.get(i));break;case"map":for(let[a,o]of r.get(i))I1E(e,t,i,a,o);break}}function fCo(e,t,r,i,n,a){Whp(e.tag(n,C1E(i)),t,r,i,a)}function Vhp(e,t,r,i){r.delimitedEncoding?lCo(e.tag(r.number,$M.StartGroup),t,i).tag(r.number,$M.EndGroup):lCo(e.tag(r.number,$M.LengthDelimited).fork(),t,i).join()}function B1E(e,t,r,i){var n;if(r.listKind=="message"){for(let o of i)Vhp(e,t,r,o);return}let a=(n=r.scalar)!==null&&n!==void 0?n:$r.INT32;if(r.packed){if(!i.size)return;e.tag(r.number,$M.LengthDelimited).fork();for(let o of i)Whp(e,r.parent.typeName,r.name,a,o);e.join();return}for(let o of i)fCo(e,r.parent.typeName,r.name,a,r.number,o)}function I1E(e,t,r,i,n){var a;switch(e.tag(r.number,$M.LengthDelimited).fork(),fCo(e,r.parent.typeName,r.name,r.mapKey,1,i),r.mapKind){case"scalar":case"enum":fCo(e,r.parent.typeName,r.name,(a=r.scalar)!==null&&a!==void 0?a:$r.INT32,2,n);break;case"message":lCo(e.tag(2,$M.LengthDelimited).fork(),t,n).join();break}e.join()}function Whp(e,t,r,i,n){try{switch(i){case $r.STRING:e.string(n);break;case $r.BOOL:e.bool(n);break;case $r.DOUBLE:e.double(n);break;case $r.FLOAT:e.float(n);break;case $r.INT32:e.int32(n);break;case $r.INT64:e.int64(n);break;case $r.UINT64:e.uint64(n);break;case $r.FIXED64:e.fixed64(n);break;case $r.BYTES:e.bytes(n);break;case $r.FIXED32:e.fixed32(n);break;case $r.SFIXED32:e.sfixed32(n);break;case $r.SFIXED64:e.sfixed64(n);break;case $r.SINT64:e.sint64(n);break;case $r.UINT32:e.uint32(n);break;case $r.SINT32:e.sint32(n);break}}catch(a){throw a instanceof Error?new Error(`cannot encode field ${t}.${r} to binary: ${a.message}`):a}}function C1E(e){switch(e){case $r.BYTES:case $r.STRING:return $M.LengthDelimited;case $r.DOUBLE:case $r.FIXED64:case $r.SFIXED64:return $M.Bit64;case $r.FIXED32:case $r.SFIXED32:case $r.FLOAT:return $M.Bit32;default:return $M.Varint}}var Ghp=Uhp("CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29nbGUucHJvdG9idWYuY29tcGlsZXIiRgoHVmVyc2lvbhINCgVtYWpvchgBIAEoBRINCgVtaW5vchgCIAEoBRINCgVwYXRjaBgDIAEoBRIOCgZzdWZmaXgYBCABKAkigQIKFENvZGVHZW5lcmF0b3JSZXF1ZXN0EhgKEGZpbGVfdG9fZ2VuZXJhdGUYASADKAkSEQoJcGFyYW1ldGVyGAIgASgJEjgKCnByb3RvX2ZpbGUYDyADKAsyJC5nb29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90bxJFChdzb3VyY2VfZmlsZV9kZXNjcmlwdG9ycxgRIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5GaWxlRGVzY3JpcHRvclByb3RvEjsKEGNvbXBpbGVyX3ZlcnNpb24YAyABKAsyIS5nb29nbGUucHJvdG9idWYuY29tcGlsZXIuVmVyc2lvbiKSAwoVQ29kZUdlbmVyYXRvclJlc3BvbnNlEg0KBWVycm9yGAEgASgJEhoKEnN1cHBvcnRlZF9mZWF0dXJlcxgCIAEoBBIXCg9taW5pbXVtX2VkaXRpb24YAyABKAUSFwoPbWF4aW11bV9lZGl0aW9uGAQgASgFEkIKBGZpbGUYDyADKAsyNC5nb29nbGUucHJvdG9idWYuY29tcGlsZXIuQ29kZUdlbmVyYXRvclJlc3BvbnNlLkZpbGUafwoERmlsZRIMCgRuYW1lGAEgASgJEhcKD2luc2VydGlvbl9wb2ludBgCIAEoCRIPCgdjb250ZW50GA8gASgJEj8KE2dlbmVyYXRlZF9jb2RlX2luZm8YECABKAsyIi5nb29nbGUucHJvdG9idWYuR2VuZXJhdGVkQ29kZUluZm8iVwoHRmVhdHVyZRIQCgxGRUFUVVJFX05PTkUQABIbChdGRUFUVVJFX1BST1RPM19PUFRJT05BTBABEh0KGUZFQVRVUkVfU1VQUE9SVFNfRURJVElPTlMQAkJyChxjb20uZ29vZ2xlLnByb3RvYnVmLmNvbXBpbGVyQgxQbHVnaW5Qcm90b3NaKWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL3BsdWdpbnBiqgIYR29vZ2xlLlByb3RvYnVmLkNvbXBpbGVy",[u2s]);var Hhp=qFa(Ghp,1),dCo=qFa(Ghp,2);var RFa;(function(e){e[e.NONE=0]="NONE",e[e.PROTO3_OPTIONAL=1]="PROTO3_OPTIONAL",e[e.SUPPORTS_EDITIONS=2]="SUPPORTS_EDITIONS"})(RFa||(RFa={}));function l2s({onlyFirst:e=!1}={}){let n="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(n,e?void 0:"g")}var q1E=l2s();function mLt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(q1E,"")}function PLt({prefix:e,content:t,includePrefixOnAllLines:r=!1}){let i=mLt(e).length;return`${e}${t.replaceAll(`
795
795
  `,`
796
- ${r?e:" ".repeat(i)}`)}`}function gt(e){throw new Error("Unexpected value: "+JSON.stringify(e))}function f2s(e){return new Promise(t=>setTimeout(()=>t(),e))}var Un={};Zt(Un,{BASE64:()=>R1E,BIG_INTEGER:()=>x1E,BOOLEAN:()=>z1E,DATE:()=>N1E,DATE_TIME:()=>F1E,DOUBLE:()=>Q1E,FLOAT:()=>U1E,INT:()=>L1E,INT64:()=>V1E,SAMPLE_STRINGS:()=>K1E,STRING:()=>T1E,UINT:()=>W1E,UINT64:()=>G1E,UUID:()=>H1E});var T1E="string",R1E="SGVsbG8gd29ybGQh",z1E=!0,N1E="2023-01-15",F1E="2024-01-15T09:30:00Z",Q1E=1.1,U1E=1.1,L1E=1,V1E=1e6,W1E=1,G1E=1e6,H1E="d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",x1E="123456789123456789",K1E=["x","xy","foo","buzz","alpha","banana","apricot","mandarin","nectarine","strawberry","pomegranate","blackcurrant"];function d2s(e){let t=new Set,r=new Set,i=[];for(let n of e)t.has(n)&&!r.has(n)&&(r.add(n),i.push(n)),t.add(n);return i}function As(e){return e!=null}var ryp=ce(h2s(),1),xO=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,o){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static TEXT_PLAIN="text/plain";static TEXT_HTML="text/html";static TEXT_XML="text/xml";static APPLICATION_XML="application/xml";static APPLICATION_FORM_URLENCODED="application/x-www-form-urlencoded";static parse(t){if(t==null||t.trim()==="")return null;let r=t.trim(),i=ryp.default.parse(r);return i==null?null:new e(i.type,i.subtype,i.essence,i.parameters,i,r)}toString(){return this.input}getCharset(){return this.parameters.get("charset")??null}getBoundary(){return this.parameters.get("boundary")??null}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return(this.isText()||this.isApplication())&&this.subtype==="csv"}isMarkdown(){return this.isText()&&(this.subtype==="markdown"||this.subtype==="x-markdown")}isPlainText(){return this.isText()&&this.subtype==="plain"}isRichText(){return this.isText()&&this.subtype==="richtext"}isDNS(){return this.isText()&&this.subtype==="dns"}isApplicationText(){return this.isApplication()&&this.subtype==="text"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isMultiPartMixed(){return this.isMultipart()&&this.subtype==="mixed"}isMultiPartAlternative(){return this.isMultipart()&&this.subtype==="alternative"}isMultiPartRelated(){return this.isMultipart()&&this.subtype==="related"}isJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&(this.subtype==="zip"||this.subtype==="x-zip-compressed")}isGzip(){return this.isApplication()&&(this.subtype==="gzip"||this.subtype==="x-gzip")}isTar(){return this.isApplication()&&(this.subtype==="tar"||this.subtype==="x-tar")}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&(this.subtype==="protobuf"||this.subtype==="x-protobuf")}isExcel(){return this.isApplication()&&(this.subtype==="vnd.ms-excel"||this.subtype==="vnd.openxmlformats-officedocument.spreadsheetml.sheet")}isWord(){return this.isApplication()&&(this.subtype==="msword"||this.subtype==="vnd.openxmlformats-officedocument.wordprocessingml.document")}isPowerPoint(){return this.isApplication()&&(this.subtype==="vnd.ms-powerpoint"||this.subtype==="vnd.openxmlformats-officedocument.presentationml.presentation")}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&(this.subtype==="jpeg"||this.subtype==="jpg")}isGIF(){return this.isImage()&&this.subtype==="gif"}isBMP(){return this.isImage()&&this.subtype==="bmp"}isTIFF(){return this.isImage()&&(this.subtype==="tiff"||this.subtype==="tif")}isICO(){return this.isImage()&&(this.subtype==="x-icon"||this.subtype==="vnd.microsoft.icon")}isMPEG(){return this.isAudio()&&(this.subtype==="mpeg"||this.subtype==="mp3")}isWAV(){return this.isAudio()&&(this.subtype==="wav"||this.subtype==="wave")}isOGG(){return this.isAudio()&&this.subtype==="ogg"}isAAC(){return this.isAudio()&&this.subtype==="aac"}isFLAC(){return this.isAudio()&&this.subtype==="flac"}isMP4(){return this.isVideo()&&this.subtype==="mp4"}isWebM(){return this.isVideo()&&this.subtype==="webm"}isAVI(){return this.isVideo()&&this.subtype==="x-msvideo"}isMOV(){return this.isVideo()&&this.subtype==="quicktime"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()||this.isApplication()&&this.subtype.endsWith("+xml")}isJavaScript(){return this.mimeType.isJavaScript()}isBinary(){return this.isImage()||this.isAudio()||this.isVideo()||this.isFont()||this.isOctetStream()||this.isPDF()||this.isZip()||this.isGzip()||this.isTar()||this.isBrotli()}isTextBased(){return this.isText()||this.isJSON()||this.isXML()||this.isHTML()||this.isJavaScript()||this.isCSS()||this.isCSV()||this.isMarkdown()||this.isSVG()||this.isDNS()||this.isApplicationText()}isStructuredData(){return this.isJSON()||this.isXML()||this.isCSV()||this.isHTML()}isFormData(){return this.isURLEncoded()||this.isMultiPartFormData()}isCompressed(){return this.isGzip()||this.isBrotli()||this.isDeflate()||this.isZip()||this.isTar()}};var nTE=typeof global=="object"&&global&&global.Object===Object&&global,_Co=nTE;var aTE=typeof self=="object"&&self&&self.Object===Object&&self,oTE=_Co||aTE||Function("return this")(),Cq=oTE;var uTE=Cq.Symbol,tG=uTE;var iyp=Object.prototype,sTE=iyp.hasOwnProperty,cTE=iyp.toString,NFa=tG?tG.toStringTag:void 0;function lTE(e){var t=sTE.call(e,NFa),r=e[NFa];try{e[NFa]=void 0;var i=!0}catch{}var n=cTE.call(e);return i&&(t?e[NFa]=r:delete e[NFa]),n}var nyp=lTE;var fTE=Object.prototype,dTE=fTE.toString;function pTE(e){return dTE.call(e)}var ayp=pTE;var _TE="[object Null]",hTE="[object Undefined]",oyp=tG?tG.toStringTag:void 0;function yTE(e){return e==null?e===void 0?hTE:_TE:oyp&&oyp in Object(e)?nyp(e):ayp(e)}var rG=yTE;function bTE(e){return e!=null&&typeof e=="object"}var ZU=bTE;var vTE="[object Symbol]";function gTE(e){return typeof e=="symbol"||ZU(e)&&rG(e)==vTE}var cHt=gTE;function OTE(e,t){for(var r=-1,i=e==null?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}var dKn=OTE;var ATE=Array.isArray,u0=ATE;var mTE=1/0,uyp=tG?tG.prototype:void 0,syp=uyp?uyp.toString:void 0;function cyp(e){if(typeof e=="string")return e;if(u0(e))return dKn(e,cyp)+"";if(cHt(e))return syp?syp.call(e):"";var t=e+"";return t=="0"&&1/e==-mTE?"-0":t}var lyp=cyp;var PTE=/\s/;function jTE(e){for(var t=e.length;t--&&PTE.test(e.charAt(t)););return t}var fyp=jTE;var wTE=/^\s+/;function ETE(e){return e&&e.slice(0,fyp(e)+1).replace(wTE,"")}var dyp=ETE;function STE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var OB=STE;var pyp=NaN,MTE=/^[-+]0x[0-9a-f]+$/i,DTE=/^0b[01]+$/i,BTE=/^0o[0-7]+$/i,ITE=parseInt;function CTE(e){if(typeof e=="number")return e;if(cHt(e))return pyp;if(OB(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=OB(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dyp(e);var r=DTE.test(e);return r||BTE.test(e)?ITE(e.slice(2),r?2:8):MTE.test(e)?pyp:+e}var _yp=CTE;var hyp=1/0,qTE=17976931348623157e292;function TTE(e){if(!e)return e===0?e:0;if(e=_yp(e),e===hyp||e===-hyp){var t=e<0?-1:1;return t*qTE}return e===e?e:0}var yyp=TTE;function RTE(e){var t=yyp(e),r=t%1;return t===t?r?t-r:t:0}var byp=RTE;function zTE(e){return e}var pKn=zTE;var NTE="[object AsyncFunction]",FTE="[object Function]",QTE="[object GeneratorFunction]",UTE="[object Proxy]";function LTE(e){if(!OB(e))return!1;var t=rG(e);return t==FTE||t==QTE||t==NTE||t==UTE}var _Kn=LTE;var VTE=Cq["__core-js_shared__"],hCo=VTE;var vyp=(function(){var e=/[^.]+$/.exec(hCo&&hCo.keys&&hCo.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function WTE(e){return!!vyp&&vyp in e}var gyp=WTE;var GTE=Function.prototype,HTE=GTE.toString;function xTE(e){if(e!=null){try{return HTE.call(e)}catch{}try{return e+""}catch{}}return""}var tzi=xTE;var KTE=/[\\^$.*+?()[\]{}|]/g,JTE=/^\[object .+?Constructor\]$/,$TE=Function.prototype,YTE=Object.prototype,XTE=$TE.toString,ZTE=YTE.hasOwnProperty,kTE=RegExp("^"+XTE.call(ZTE).replace(KTE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function eRE(e){if(!OB(e)||gyp(e))return!1;var t=_Kn(e)?kTE:JTE;return t.test(tzi(e))}var Oyp=eRE;function tRE(e,t){return e?.[t]}var Ayp=tRE;function rRE(e,t){var r=Ayp(e,t);return Oyp(r)?r:void 0}var tJ=rRE;var iRE=tJ(Cq,"WeakMap"),yCo=iRE;var myp=Object.create,nRE=(function(){function e(){}return function(t){if(!OB(t))return{};if(myp)return myp(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),Pyp=nRE;function aRE(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var jyp=aRE;function oRE(){}var Pje=oRE;function uRE(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t}var wyp=uRE;var sRE=800,cRE=16,lRE=Date.now;function fRE(e){var t=0,r=0;return function(){var i=lRE(),n=cRE-(i-r);if(r=i,n>0){if(++t>=sRE)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Eyp=fRE;function dRE(e){return function(){return e}}var Syp=dRE;var pRE=(function(){try{var e=tJ(Object,"defineProperty");return e({},"",{}),e}catch{}})(),hKn=pRE;var _RE=hKn?function(e,t){return hKn(e,"toString",{configurable:!0,enumerable:!1,value:Syp(t),writable:!0})}:pKn,Myp=_RE;var hRE=Eyp(Myp),Dyp=hRE;function yRE(e,t,r,i){for(var n=e.length,a=r+(i?1:-1);i?a--:++a<n;)if(t(e[a],a,e))return a;return-1}var Byp=yRE;function bRE(e){return e!==e}var Iyp=bRE;function vRE(e,t,r){for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return-1}var Cyp=vRE;function gRE(e,t,r){return t===t?Cyp(e,t,r):Byp(e,Iyp,r)}var qyp=gRE;function ORE(e,t){var r=e==null?0:e.length;return!!r&&qyp(e,t,0)>-1}var Typ=ORE;var ARE=9007199254740991,mRE=/^(?:0|[1-9]\d*)$/;function PRE(e,t){var r=typeof e;return t=t??ARE,!!t&&(r=="number"||r!="symbol"&&mRE.test(e))&&e>-1&&e%1==0&&e<t}var j9i=PRE;function jRE(e,t,r){t=="__proto__"&&hKn?hKn(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var rJ=jRE;function wRE(e,t){return e===t||e!==e&&t!==t}var Ebe=wRE;var ERE=Object.prototype,SRE=ERE.hasOwnProperty;function MRE(e,t,r){var i=e[t];(!(SRE.call(e,t)&&Ebe(i,r))||r===void 0&&!(t in e))&&rJ(e,t,r)}var bCo=MRE;function DRE(e,t,r,i){var n=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var c=t[a],d=i?i(r[c],e[c],c,r,e):void 0;d===void 0&&(d=e[c]),n?rJ(r,c,d):bCo(r,c,d)}return r}var Ryp=DRE;var zyp=Math.max;function BRE(e,t,r){return t=zyp(t===void 0?e.length-1:t,0),function(){for(var i=arguments,n=-1,a=zyp(i.length-t,0),o=Array(a);++n<a;)o[n]=i[t+n];n=-1;for(var c=Array(t+1);++n<t;)c[n]=i[n];return c[t]=r(o),jyp(e,this,c)}}var Nyp=BRE;function IRE(e,t){return Dyp(Nyp(e,t,pKn),e+"")}var vCo=IRE;var CRE=9007199254740991;function qRE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=CRE}var yKn=qRE;function TRE(e){return e!=null&&yKn(e.length)&&!_Kn(e)}var iJ=TRE;function RRE(e,t,r){if(!OB(r))return!1;var i=typeof t;return(i=="number"?iJ(r)&&j9i(t,r.length):i=="string"&&t in r)?Ebe(r[t],e):!1}var gCo=RRE;function zRE(e){return vCo(function(t,r){var i=-1,n=r.length,a=n>1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,o&&gCo(r[0],r[1],o)&&(a=n<3?void 0:a,n=1),t=Object(t);++i<n;){var c=r[i];c&&e(t,c,i,a)}return t})}var OCo=zRE;var NRE=Object.prototype;function FRE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||NRE;return e===r}var w9i=FRE;function QRE(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}var Fyp=QRE;var URE="[object Arguments]";function LRE(e){return ZU(e)&&rG(e)==URE}var y2s=LRE;var Qyp=Object.prototype,VRE=Qyp.hasOwnProperty,WRE=Qyp.propertyIsEnumerable,GRE=y2s((function(){return arguments})())?y2s:function(e){return ZU(e)&&VRE.call(e,"callee")&&!WRE.call(e,"callee")},jLt=GRE;function HRE(){return!1}var Uyp=HRE;var Wyp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lyp=Wyp&&typeof module=="object"&&module&&!module.nodeType&&module,xRE=Lyp&&Lyp.exports===Wyp,Vyp=xRE?Cq.Buffer:void 0,KRE=Vyp?Vyp.isBuffer:void 0,JRE=KRE||Uyp,rzi=JRE;var $RE="[object Arguments]",YRE="[object Array]",XRE="[object Boolean]",ZRE="[object Date]",kRE="[object Error]",ezE="[object Function]",tzE="[object Map]",rzE="[object Number]",izE="[object Object]",nzE="[object RegExp]",azE="[object Set]",ozE="[object String]",uzE="[object WeakMap]",szE="[object ArrayBuffer]",czE="[object DataView]",lzE="[object Float32Array]",fzE="[object Float64Array]",dzE="[object Int8Array]",pzE="[object Int16Array]",_zE="[object Int32Array]",hzE="[object Uint8Array]",yzE="[object Uint8ClampedArray]",bzE="[object Uint16Array]",vzE="[object Uint32Array]",xE={};xE[lzE]=xE[fzE]=xE[dzE]=xE[pzE]=xE[_zE]=xE[hzE]=xE[yzE]=xE[bzE]=xE[vzE]=!0;xE[$RE]=xE[YRE]=xE[szE]=xE[XRE]=xE[czE]=xE[ZRE]=xE[kRE]=xE[ezE]=xE[tzE]=xE[rzE]=xE[izE]=xE[nzE]=xE[azE]=xE[ozE]=xE[uzE]=!1;function gzE(e){return ZU(e)&&yKn(e.length)&&!!xE[rG(e)]}var Gyp=gzE;function OzE(e){return function(t){return e(t)}}var ACo=OzE;var Hyp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FFa=Hyp&&typeof module=="object"&&module&&!module.nodeType&&module,AzE=FFa&&FFa.exports===Hyp,b2s=AzE&&_Co.process,mzE=(function(){try{var e=FFa&&FFa.require&&FFa.require("util").types;return e||b2s&&b2s.binding&&b2s.binding("util")}catch{}})(),v2s=mzE;var xyp=v2s&&v2s.isTypedArray,PzE=xyp?ACo(xyp):Gyp,E9i=PzE;var jzE=Object.prototype,wzE=jzE.hasOwnProperty;function EzE(e,t){var r=u0(e),i=!r&&jLt(e),n=!r&&!i&&rzi(e),a=!r&&!i&&!n&&E9i(e),o=r||i||n||a,c=o?Fyp(e.length,String):[],d=c.length;for(var s in e)(t||wzE.call(e,s))&&!(o&&(s=="length"||n&&(s=="offset"||s=="parent")||a&&(s=="buffer"||s=="byteLength"||s=="byteOffset")||j9i(s,d)))&&c.push(s);return c}var mCo=EzE;function SzE(e,t){return function(r){return e(t(r))}}var PCo=SzE;var MzE=PCo(Object.keys,Object),Kyp=MzE;var DzE=Object.prototype,BzE=DzE.hasOwnProperty;function IzE(e){if(!w9i(e))return Kyp(e);var t=[];for(var r in Object(e))BzE.call(e,r)&&r!="constructor"&&t.push(r);return t}var bKn=IzE;function CzE(e){return iJ(e)?mCo(e):bKn(e)}var vKn=CzE;function qzE(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Jyp=qzE;var TzE=Object.prototype,RzE=TzE.hasOwnProperty;function zzE(e){if(!OB(e))return Jyp(e);var t=w9i(e),r=[];for(var i in e)i=="constructor"&&(t||!RzE.call(e,i))||r.push(i);return r}var $yp=zzE;function NzE(e){return iJ(e)?mCo(e,!0):$yp(e)}var gKn=NzE;var FzE=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QzE=/^\w*$/;function UzE(e,t){if(u0(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||cHt(e)?!0:QzE.test(e)||!FzE.test(e)||t!=null&&e in Object(t)}var OKn=UzE;var LzE=tJ(Object,"create"),izi=LzE;function VzE(){this.__data__=izi?izi(null):{},this.size=0}var Yyp=VzE;function WzE(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Xyp=WzE;var GzE="__lodash_hash_undefined__",HzE=Object.prototype,xzE=HzE.hasOwnProperty;function KzE(e){var t=this.__data__;if(izi){var r=t[e];return r===GzE?void 0:r}return xzE.call(t,e)?t[e]:void 0}var Zyp=KzE;var JzE=Object.prototype,$zE=JzE.hasOwnProperty;function YzE(e){var t=this.__data__;return izi?t[e]!==void 0:$zE.call(t,e)}var kyp=YzE;var XzE="__lodash_hash_undefined__";function ZzE(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=izi&&t===void 0?XzE:t,this}var ebp=ZzE;function AKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}AKn.prototype.clear=Yyp;AKn.prototype.delete=Xyp;AKn.prototype.get=Zyp;AKn.prototype.has=kyp;AKn.prototype.set=ebp;var g2s=AKn;function kzE(){this.__data__=[],this.size=0}var tbp=kzE;function eNE(e,t){for(var r=e.length;r--;)if(Ebe(e[r][0],t))return r;return-1}var S9i=eNE;var tNE=Array.prototype,rNE=tNE.splice;function iNE(e){var t=this.__data__,r=S9i(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():rNE.call(t,r,1),--this.size,!0}var rbp=iNE;function nNE(e){var t=this.__data__,r=S9i(t,e);return r<0?void 0:t[r][1]}var ibp=nNE;function aNE(e){return S9i(this.__data__,e)>-1}var nbp=aNE;function oNE(e,t){var r=this.__data__,i=S9i(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var abp=oNE;function mKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}mKn.prototype.clear=tbp;mKn.prototype.delete=rbp;mKn.prototype.get=ibp;mKn.prototype.has=nbp;mKn.prototype.set=abp;var M9i=mKn;var uNE=tJ(Cq,"Map"),D9i=uNE;function sNE(){this.size=0,this.__data__={hash:new g2s,map:new(D9i||M9i),string:new g2s}}var obp=sNE;function cNE(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ubp=cNE;function lNE(e,t){var r=e.__data__;return ubp(t)?r[typeof t=="string"?"string":"hash"]:r.map}var B9i=lNE;function fNE(e){var t=B9i(this,e).delete(e);return this.size-=t?1:0,t}var sbp=fNE;function dNE(e){return B9i(this,e).get(e)}var cbp=dNE;function pNE(e){return B9i(this,e).has(e)}var lbp=pNE;function _NE(e,t){var r=B9i(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var fbp=_NE;function PKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}PKn.prototype.clear=obp;PKn.prototype.delete=sbp;PKn.prototype.get=cbp;PKn.prototype.has=lbp;PKn.prototype.set=fbp;var yln=PKn;var hNE="Expected a function";function O2s(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hNE);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],a=r.cache;if(a.has(n))return a.get(n);var o=e.apply(this,i);return r.cache=a.set(n,o)||a,o};return r.cache=new(O2s.Cache||yln),r}O2s.Cache=yln;var dbp=O2s;var yNE=500;function bNE(e){var t=dbp(e,function(i){return r.size===yNE&&r.clear(),i}),r=t.cache;return t}var pbp=bNE;var vNE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gNE=/\\(\\)?/g,ONE=pbp(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vNE,function(r,i,n,a){t.push(n?a.replace(gNE,"$1"):i||r)}),t}),_bp=ONE;function ANE(e){return e==null?"":lyp(e)}var lHt=ANE;function mNE(e,t){return u0(e)?e:OKn(e,t)?[e]:_bp(lHt(e))}var I9i=mNE;var PNE=1/0;function jNE(e){if(typeof e=="string"||cHt(e))return e;var t=e+"";return t=="0"&&1/e==-PNE?"-0":t}var fHt=jNE;function wNE(e,t){t=I9i(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[fHt(t[r++])];return r&&r==i?e:void 0}var jKn=wNE;function ENE(e,t,r){var i=e==null?void 0:jKn(e,t);return i===void 0?r:i}var hbp=ENE;function SNE(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}var wKn=SNE;var ybp=tG?tG.isConcatSpreadable:void 0;function MNE(e){return u0(e)||jLt(e)||!!(ybp&&e&&e[ybp])}var bbp=MNE;function vbp(e,t,r,i,n){var a=-1,o=e.length;for(r||(r=bbp),n||(n=[]);++a<o;){var c=e[a];t>0&&r(c)?t>1?vbp(c,t-1,r,i,n):wKn(n,c):i||(n[n.length]=c)}return n}var gbp=vbp;var DNE=PCo(Object.getPrototypeOf,Object),EKn=DNE;var BNE="[object Object]",INE=Function.prototype,CNE=Object.prototype,Obp=INE.toString,qNE=CNE.hasOwnProperty,TNE=Obp.call(Object);function RNE(e){if(!ZU(e)||rG(e)!=BNE)return!1;var t=EKn(e);if(t===null)return!0;var r=qNE.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Obp.call(r)==TNE}var QFa=RNE;function zNE(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(n);++i<n;)a[i]=e[i+t];return a}var jCo=zNE;function NNE(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:jCo(e,t,r)}var Abp=NNE;var FNE="\\ud800-\\udfff",QNE="\\u0300-\\u036f",UNE="\\ufe20-\\ufe2f",LNE="\\u20d0-\\u20ff",VNE=QNE+UNE+LNE,WNE="\\ufe0e\\ufe0f",GNE="\\u200d",HNE=RegExp("["+GNE+FNE+VNE+WNE+"]");function xNE(e){return HNE.test(e)}var SKn=xNE;function KNE(e){return e.split("")}var mbp=KNE;var Pbp="\\ud800-\\udfff",JNE="\\u0300-\\u036f",$NE="\\ufe20-\\ufe2f",YNE="\\u20d0-\\u20ff",XNE=JNE+$NE+YNE,ZNE="\\ufe0e\\ufe0f",kNE="["+Pbp+"]",A2s="["+XNE+"]",m2s="\\ud83c[\\udffb-\\udfff]",eFE="(?:"+A2s+"|"+m2s+")",jbp="[^"+Pbp+"]",wbp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ebp="[\\ud800-\\udbff][\\udc00-\\udfff]",tFE="\\u200d",Sbp=eFE+"?",Mbp="["+ZNE+"]?",rFE="(?:"+tFE+"(?:"+[jbp,wbp,Ebp].join("|")+")"+Mbp+Sbp+")*",iFE=Mbp+Sbp+rFE,nFE="(?:"+[jbp+A2s+"?",A2s,wbp,Ebp,kNE].join("|")+")",aFE=RegExp(m2s+"(?="+m2s+")|"+nFE+iFE,"g");function oFE(e){return e.match(aFE)||[]}var Dbp=oFE;function uFE(e){return SKn(e)?Dbp(e):mbp(e)}var Bbp=uFE;function sFE(e){return function(t){t=lHt(t);var r=SKn(t)?Bbp(t):void 0,i=r?r[0]:t.charAt(0),n=r?Abp(r,1).join(""):t.slice(1);return i[e]()+n}}var Ibp=sFE;var cFE=Ibp("toUpperCase"),F0=cFE;function lFE(e){return F0(lHt(e).toLowerCase())}var UFa=lFE;function fFE(e,t,r,i){var n=-1,a=e==null?0:e.length;for(i&&a&&(r=e[++n]);++n<a;)r=t(r,e[n],n,e);return r}var Cbp=fFE;function dFE(e){return function(t){return e?.[t]}}var qbp=dFE;var pFE={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},_FE=qbp(pFE),Tbp=_FE;var hFE=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yFE="\\u0300-\\u036f",bFE="\\ufe20-\\ufe2f",vFE="\\u20d0-\\u20ff",gFE=yFE+bFE+vFE,OFE="["+gFE+"]",AFE=RegExp(OFE,"g");function mFE(e){return e=lHt(e),e&&e.replace(hFE,Tbp).replace(AFE,"")}var Rbp=mFE;var PFE=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function jFE(e){return e.match(PFE)||[]}var zbp=jFE;var wFE=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function EFE(e){return wFE.test(e)}var Nbp=EFE;var Vbp="\\ud800-\\udfff",SFE="\\u0300-\\u036f",MFE="\\ufe20-\\ufe2f",DFE="\\u20d0-\\u20ff",BFE=SFE+MFE+DFE,Wbp="\\u2700-\\u27bf",Gbp="a-z\\xdf-\\xf6\\xf8-\\xff",IFE="\\xac\\xb1\\xd7\\xf7",CFE="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qFE="\\u2000-\\u206f",TFE=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Hbp="A-Z\\xc0-\\xd6\\xd8-\\xde",RFE="\\ufe0e\\ufe0f",xbp=IFE+CFE+qFE+TFE,Kbp="['\u2019]",Fbp="["+xbp+"]",zFE="["+BFE+"]",Jbp="\\d+",NFE="["+Wbp+"]",$bp="["+Gbp+"]",Ybp="[^"+Vbp+xbp+Jbp+Wbp+Gbp+Hbp+"]",FFE="\\ud83c[\\udffb-\\udfff]",QFE="(?:"+zFE+"|"+FFE+")",UFE="[^"+Vbp+"]",Xbp="(?:\\ud83c[\\udde6-\\uddff]){2}",Zbp="[\\ud800-\\udbff][\\udc00-\\udfff]",MKn="["+Hbp+"]",LFE="\\u200d",Qbp="(?:"+$bp+"|"+Ybp+")",VFE="(?:"+MKn+"|"+Ybp+")",Ubp="(?:"+Kbp+"(?:d|ll|m|re|s|t|ve))?",Lbp="(?:"+Kbp+"(?:D|LL|M|RE|S|T|VE))?",kbp=QFE+"?",evp="["+RFE+"]?",WFE="(?:"+LFE+"(?:"+[UFE,Xbp,Zbp].join("|")+")"+evp+kbp+")*",GFE="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",HFE="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",xFE=evp+kbp+WFE,KFE="(?:"+[NFE,Xbp,Zbp].join("|")+")"+xFE,JFE=RegExp([MKn+"?"+$bp+"+"+Ubp+"(?="+[Fbp,MKn,"$"].join("|")+")",VFE+"+"+Lbp+"(?="+[Fbp,MKn+Qbp,"$"].join("|")+")",MKn+"?"+Qbp+"+"+Ubp,MKn+"+"+Lbp,HFE,GFE,Jbp,KFE].join("|"),"g");function $FE(e){return e.match(JFE)||[]}var tvp=$FE;function YFE(e,t,r){return e=lHt(e),t=r?void 0:t,t===void 0?Nbp(e)?tvp(e):zbp(e):e.match(t)||[]}var bln=YFE;var XFE="['\u2019]",ZFE=RegExp(XFE,"g");function kFE(e){return function(t){return Cbp(bln(Rbp(t).replace(ZFE,"")),e,"")}}var C9i=kFE;var eQE=C9i(function(e,t,r){return t=t.toLowerCase(),e+(r?UFa(t):t)}),nu=eQE;var tQE=Math.ceil,rQE=Math.max;function iQE(e,t,r){(r?gCo(e,t,r):t===void 0)?t=1:t=rQE(byp(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var n=0,a=0,o=Array(tQE(i/t));n<i;)o[a++]=jCo(e,n,n+=t);return o}var LFa=iQE;function nQE(){this.__data__=new M9i,this.size=0}var rvp=nQE;function aQE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var ivp=aQE;function oQE(e){return this.__data__.get(e)}var nvp=oQE;function uQE(e){return this.__data__.has(e)}var avp=uQE;var sQE=200;function cQE(e,t){var r=this.__data__;if(r instanceof M9i){var i=r.__data__;if(!D9i||i.length<sQE-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new yln(i)}return r.set(e,t),this.size=r.size,this}var ovp=cQE;function DKn(e){var t=this.__data__=new M9i(e);this.size=t.size}DKn.prototype.clear=rvp;DKn.prototype.delete=ivp;DKn.prototype.get=nvp;DKn.prototype.has=avp;DKn.prototype.set=ovp;var q9i=DKn;var lvp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uvp=lvp&&typeof module=="object"&&module&&!module.nodeType&&module,lQE=uvp&&uvp.exports===lvp,svp=lQE?Cq.Buffer:void 0,cvp=svp?svp.allocUnsafe:void 0;function fQE(e,t){if(t)return e.slice();var r=e.length,i=cvp?cvp(r):new e.constructor(r);return e.copy(i),i}var fvp=fQE;function dQE(e,t){for(var r=-1,i=e==null?0:e.length,n=0,a=[];++r<i;){var o=e[r];t(o,r,e)&&(a[n++]=o)}return a}var dvp=dQE;function pQE(){return[]}var wCo=pQE;var _QE=Object.prototype,hQE=_QE.propertyIsEnumerable,pvp=Object.getOwnPropertySymbols,yQE=pvp?function(e){return e==null?[]:(e=Object(e),dvp(pvp(e),function(t){return hQE.call(e,t)}))}:wCo,ECo=yQE;var bQE=Object.getOwnPropertySymbols,vQE=bQE?function(e){for(var t=[];e;)wKn(t,ECo(e)),e=EKn(e);return t}:wCo,_vp=vQE;function gQE(e,t,r){var i=t(e);return u0(e)?i:wKn(i,r(e))}var SCo=gQE;function OQE(e){return SCo(e,vKn,ECo)}var P2s=OQE;function AQE(e){return SCo(e,gKn,_vp)}var hvp=AQE;var mQE=tJ(Cq,"DataView"),MCo=mQE;var PQE=tJ(Cq,"Promise"),DCo=PQE;var jQE=tJ(Cq,"Set"),BCo=jQE;var yvp="[object Map]",wQE="[object Object]",bvp="[object Promise]",vvp="[object Set]",gvp="[object WeakMap]",Ovp="[object DataView]",EQE=tzi(MCo),SQE=tzi(D9i),MQE=tzi(DCo),DQE=tzi(BCo),BQE=tzi(yCo),vln=rG;(MCo&&vln(new MCo(new ArrayBuffer(1)))!=Ovp||D9i&&vln(new D9i)!=yvp||DCo&&vln(DCo.resolve())!=bvp||BCo&&vln(new BCo)!=vvp||yCo&&vln(new yCo)!=gvp)&&(vln=function(e){var t=rG(e),r=t==wQE?e.constructor:void 0,i=r?tzi(r):"";if(i)switch(i){case EQE:return Ovp;case SQE:return yvp;case MQE:return bvp;case DQE:return vvp;case BQE:return gvp}return t});var gln=vln;var IQE=Cq.Uint8Array,BKn=IQE;function CQE(e){var t=new e.constructor(e.byteLength);return new BKn(t).set(new BKn(e)),t}var Avp=CQE;function qQE(e,t){var r=t?Avp(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var mvp=qQE;function TQE(e){return typeof e.constructor=="function"&&!w9i(e)?Pyp(EKn(e)):{}}var Pvp=TQE;function RQE(e){for(var t=-1,r=e==null?0:e.length,i=0,n=[];++t<r;){var a=e[t];a&&(n[i++]=a)}return n}var jje=RQE;var zQE="__lodash_hash_undefined__";function NQE(e){return this.__data__.set(e,zQE),this}var jvp=NQE;function FQE(e){return this.__data__.has(e)}var wvp=FQE;function ICo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new yln;++t<r;)this.add(e[t])}ICo.prototype.add=ICo.prototype.push=jvp;ICo.prototype.has=wvp;var CCo=ICo;function QQE(e,t){for(var r=-1,i=e==null?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}var Evp=QQE;function UQE(e,t){return e.has(t)}var qCo=UQE;var LQE=1,VQE=2;function WQE(e,t,r,i,n,a){var o=r&LQE,c=e.length,d=t.length;if(c!=d&&!(o&&d>c))return!1;var s=a.get(e),u=a.get(t);if(s&&u)return s==t&&u==e;var l=-1,p=!0,_=r&VQE?new CCo:void 0;for(a.set(e,t),a.set(t,e);++l<c;){var h=e[l],y=t[l];if(i)var b=o?i(y,h,l,t,e,a):i(h,y,l,e,t,a);if(b!==void 0){if(b)continue;p=!1;break}if(_){if(!Evp(t,function(v,O){if(!qCo(_,O)&&(h===v||n(h,v,r,i,a)))return _.push(O)})){p=!1;break}}else if(!(h===y||n(h,y,r,i,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var TCo=WQE;function GQE(e){var t=-1,r=Array(e.size);return e.forEach(function(i,n){r[++t]=[n,i]}),r}var Svp=GQE;function HQE(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}var Mvp=HQE;var xQE=1,KQE=2,JQE="[object Boolean]",$QE="[object Date]",YQE="[object Error]",XQE="[object Map]",ZQE="[object Number]",kQE="[object RegExp]",eUE="[object Set]",tUE="[object String]",rUE="[object Symbol]",iUE="[object ArrayBuffer]",nUE="[object DataView]",Dvp=tG?tG.prototype:void 0,j2s=Dvp?Dvp.valueOf:void 0;function aUE(e,t,r,i,n,a,o){switch(r){case nUE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case iUE:return!(e.byteLength!=t.byteLength||!a(new BKn(e),new BKn(t)));case JQE:case $QE:case ZQE:return Ebe(+e,+t);case YQE:return e.name==t.name&&e.message==t.message;case kQE:case tUE:return e==t+"";case XQE:var c=Svp;case eUE:var d=i&xQE;if(c||(c=Mvp),e.size!=t.size&&!d)return!1;var s=o.get(e);if(s)return s==t;i|=KQE,o.set(e,t);var u=TCo(c(e),c(t),i,n,a,o);return o.delete(e),u;case rUE:if(j2s)return j2s.call(e)==j2s.call(t)}return!1}var Bvp=aUE;var oUE=1,uUE=Object.prototype,sUE=uUE.hasOwnProperty;function cUE(e,t,r,i,n,a){var o=r&oUE,c=P2s(e),d=c.length,s=P2s(t),u=s.length;if(d!=u&&!o)return!1;for(var l=d;l--;){var p=c[l];if(!(o?p in t:sUE.call(t,p)))return!1}var _=a.get(e),h=a.get(t);if(_&&h)return _==t&&h==e;var y=!0;a.set(e,t),a.set(t,e);for(var b=o;++l<d;){p=c[l];var v=e[p],O=t[p];if(i)var A=o?i(O,v,p,t,e,a):i(v,O,p,e,t,a);if(!(A===void 0?v===O||n(v,O,r,i,a):A)){y=!1;break}b||(b=p=="constructor")}if(y&&!b){var g=e.constructor,m=t.constructor;g!=m&&"constructor"in e&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof m=="function"&&m instanceof m)&&(y=!1)}return a.delete(e),a.delete(t),y}var Ivp=cUE;var lUE=1,Cvp="[object Arguments]",qvp="[object Array]",RCo="[object Object]",fUE=Object.prototype,Tvp=fUE.hasOwnProperty;function dUE(e,t,r,i,n,a){var o=u0(e),c=u0(t),d=o?qvp:gln(e),s=c?qvp:gln(t);d=d==Cvp?RCo:d,s=s==Cvp?RCo:s;var u=d==RCo,l=s==RCo,p=d==s;if(p&&rzi(e)){if(!rzi(t))return!1;o=!0,u=!1}if(p&&!u)return a||(a=new q9i),o||E9i(e)?TCo(e,t,r,i,n,a):Bvp(e,t,d,r,i,n,a);if(!(r&lUE)){var _=u&&Tvp.call(e,"__wrapped__"),h=l&&Tvp.call(t,"__wrapped__");if(_||h){var y=_?e.value():e,b=h?t.value():t;return a||(a=new q9i),n(y,b,r,i,a)}}return p?(a||(a=new q9i),Ivp(e,t,r,i,n,a)):!1}var Rvp=dUE;function zvp(e,t,r,i,n){return e===t?!0:e==null||t==null||!ZU(e)&&!ZU(t)?e!==e&&t!==t:Rvp(e,t,r,i,zvp,n)}var T9i=zvp;var pUE=1,_UE=2;function hUE(e,t,r,i){var n=r.length,a=n,o=!i;if(e==null)return!a;for(e=Object(e);n--;){var c=r[n];if(o&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++n<a;){c=r[n];var d=c[0],s=e[d],u=c[1];if(o&&c[2]){if(s===void 0&&!(d in e))return!1}else{var l=new q9i;if(i)var p=i(s,u,d,e,t,l);if(!(p===void 0?T9i(u,s,pUE|_UE,i,l):p))return!1}}return!0}var Nvp=hUE;function yUE(e){return e===e&&!OB(e)}var zCo=yUE;function bUE(e){for(var t=vKn(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,zCo(n)]}return t}var Fvp=bUE;function vUE(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var NCo=vUE;function gUE(e){var t=Fvp(e);return t.length==1&&t[0][2]?NCo(t[0][0],t[0][1]):function(r){return r===e||Nvp(r,e,t)}}var Qvp=gUE;function OUE(e,t){return e!=null&&t in Object(e)}var Uvp=OUE;function AUE(e,t,r){t=I9i(t,e);for(var i=-1,n=t.length,a=!1;++i<n;){var o=fHt(t[i]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++i!=n?a:(n=e==null?0:e.length,!!n&&yKn(n)&&j9i(o,n)&&(u0(e)||jLt(e)))}var Lvp=AUE;function mUE(e,t){return e!=null&&Lvp(e,t,Uvp)}var Vvp=mUE;var PUE=1,jUE=2;function wUE(e,t){return OKn(e)&&zCo(t)?NCo(fHt(e),t):function(r){var i=hbp(r,e);return i===void 0&&i===t?Vvp(r,e):T9i(t,i,PUE|jUE)}}var Wvp=wUE;function EUE(e){return function(t){return t?.[e]}}var FCo=EUE;function SUE(e){return function(t){return jKn(t,e)}}var Gvp=SUE;function MUE(e){return OKn(e)?FCo(fHt(e)):Gvp(e)}var Hvp=MUE;function DUE(e){return typeof e=="function"?e:e==null?pKn:typeof e=="object"?u0(e)?Wvp(e[0],e[1]):Qvp(e):Hvp(e)}var wje=DUE;function BUE(e,t,r,i){for(var n=-1,a=e==null?0:e.length;++n<a;){var o=e[n];t(i,o,r(o),e)}return i}var xvp=BUE;function IUE(e){return function(t,r,i){for(var n=-1,a=Object(t),o=i(t),c=o.length;c--;){var d=o[e?c:++n];if(r(a[d],d,a)===!1)break}return t}}var Kvp=IUE;var CUE=Kvp(),QCo=CUE;function qUE(e,t){return e&&QCo(e,t,vKn)}var IKn=qUE;function TUE(e,t){return function(r,i){if(r==null)return r;if(!iJ(r))return e(r,i);for(var n=r.length,a=t?n:-1,o=Object(r);(t?a--:++a<n)&&i(o[a],a,o)!==!1;);return r}}var Jvp=TUE;var RUE=Jvp(IKn),$vp=RUE;function zUE(e,t,r,i){return $vp(e,function(n,a,o){t(i,n,r(n),o)}),i}var Yvp=zUE;function NUE(e,t){return function(r,i){var n=u0(r)?xvp:Yvp,a=t?t():{};return n(r,e,wje(i,2),a)}}var UCo=NUE;function FUE(e,t,r){(r!==void 0&&!Ebe(e[t],r)||r===void 0&&!(t in e))&&rJ(e,t,r)}var VFa=FUE;function QUE(e){return ZU(e)&&iJ(e)}var WFa=QUE;function UUE(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var GFa=UUE;function LUE(e){return Ryp(e,gKn(e))}var Xvp=LUE;function VUE(e,t,r,i,n,a,o){var c=GFa(e,r),d=GFa(t,r),s=o.get(d);if(s){VFa(e,r,s);return}var u=a?a(c,d,r+"",e,t,o):void 0,l=u===void 0;if(l){var p=u0(d),_=!p&&rzi(d),h=!p&&!_&&E9i(d);u=d,p||_||h?u0(c)?u=c:WFa(c)?u=wyp(c):_?(l=!1,u=fvp(d,!0)):h?(l=!1,u=mvp(d,!0)):u=[]:QFa(d)||jLt(d)?(u=c,jLt(c)?u=Xvp(c):(!OB(c)||_Kn(c))&&(u=Pvp(d))):l=!1}l&&(o.set(d,u),n(u,d,i,a,o),o.delete(d)),VFa(e,r,u)}var Zvp=VUE;function kvp(e,t,r,i,n){e!==t&&QCo(t,function(a,o){if(n||(n=new q9i),OB(a))Zvp(e,t,o,r,kvp,i,n);else{var c=i?i(GFa(e,o),a,o+"",e,t,n):void 0;c===void 0&&(c=a),VFa(e,o,c)}},gKn)}var LCo=kvp;var WUE=OCo(function(e,t,r,i){LCo(e,t,r,i)}),CKn=WUE;function GUE(e,t,r){for(var i=-1,n=e==null?0:e.length;++i<n;)if(r(t,e[i]))return!0;return!1}var egp=GUE;var HUE=200;function xUE(e,t,r,i){var n=-1,a=Typ,o=!0,c=e.length,d=[],s=t.length;if(!c)return d;r&&(t=dKn(t,ACo(r))),i?(a=egp,o=!1):t.length>=HUE&&(a=qCo,o=!1,t=new CCo(t));e:for(;++n<c;){var u=e[n],l=r==null?u:r(u);if(u=i||u!==0?u:0,o&&l===l){for(var p=s;p--;)if(t[p]===l)continue e;d.push(u)}else a(t,l,i)||d.push(u)}return d}var tgp=xUE;var KUE=vCo(function(e,t){return WFa(e)?tgp(e,gbp(t,1,WFa,!0)):[]}),VCo=KUE;function JUE(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var w2s=JUE;var $UE=Object.prototype,YUE=$UE.hasOwnProperty,XUE=UCo(function(e,t,r){YUE.call(e,r)?e[r].push(t):rJ(e,r,[t])}),E2s=XUE;function ZUE(e,t){return e>t}var rgp=ZUE;var kUE="[object String]";function e4E(e){return typeof e=="string"||!u0(e)&&ZU(e)&&rG(e)==kUE}var igp=e4E;var t4E="[object Map]",r4E="[object Set]",i4E=Object.prototype,n4E=i4E.hasOwnProperty;function a4E(e){if(e==null)return!0;if(iJ(e)&&(u0(e)||typeof e=="string"||typeof e.splice=="function"||rzi(e)||E9i(e)||jLt(e)))return!e.length;var t=gln(e);if(t==t4E||t==r4E)return!e.size;if(w9i(e))return!bKn(e).length;for(var r in e)if(n4E.call(e,r))return!1;return!0}var S2s=a4E;function o4E(e,t){return T9i(e,t)}var NT=o4E;function u4E(e,t,r){r=typeof r=="function"?r:void 0;var i=r?r(e,t):void 0;return i===void 0?T9i(e,t,void 0,r):!!i}var dHt=u4E;function s4E(e){return e===null}var M2s=s4E;var c4E=C9i(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),KE=c4E;var l4E=UCo(function(e,t,r){rJ(e,r,t)}),D2s=l4E;function f4E(e,t){var r={};return t=wje(t,3),IKn(e,function(i,n,a){rJ(r,t(i,n,a),i)}),r}var HFa=f4E;function d4E(e,t){var r={};return t=wje(t,3),IKn(e,function(i,n,a){rJ(r,n,t(i,n,a))}),r}var gn=d4E;function p4E(e,t,r){for(var i=-1,n=e.length;++i<n;){var a=e[i],o=t(a);if(o!=null&&(c===void 0?o===o&&!cHt(o):r(o,c)))var c=o,d=a}return d}var ngp=p4E;function _4E(e,t){return e&&e.length?ngp(e,wje(t,2),rgp):void 0}var B2s=_4E;var h4E=OCo(function(e,t,r){LCo(e,t,r)}),I2s=h4E;var y4E="Expected a function";function b4E(e){if(typeof e!="function")throw new TypeError(y4E);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var agp=b4E;function v4E(e,t,r,i){if(!OB(e))return e;t=I9i(t,e);for(var n=-1,a=t.length,o=a-1,c=e;c!=null&&++n<a;){var d=fHt(t[n]),s=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(n!=o){var u=c[d];s=i?i(u,d,c):void 0,s===void 0&&(s=OB(u)?u:j9i(t[n+1])?[]:{})}bCo(c,d,s),c=c[d]}return e}var ogp=v4E;function g4E(e,t,r){for(var i=-1,n=t.length,a={};++i<n;){var o=t[i],c=jKn(e,o);r(c,o)&&ogp(a,I9i(o,e),c)}return a}var ugp=g4E;function O4E(e,t){if(e==null)return{};var r=dKn(hvp(e),function(i){return[i]});return t=wje(t),ugp(e,r,function(i,n){return t(i,n[0])})}var Oln=O4E;function A4E(e,t){return Oln(e,agp(wje(t)))}var C2s=A4E;var m4E=FCo("length"),sgp=m4E;var lgp="\\ud800-\\udfff",P4E="\\u0300-\\u036f",j4E="\\ufe20-\\ufe2f",w4E="\\u20d0-\\u20ff",E4E=P4E+j4E+w4E,S4E="\\ufe0e\\ufe0f",M4E="["+lgp+"]",q2s="["+E4E+"]",T2s="\\ud83c[\\udffb-\\udfff]",D4E="(?:"+q2s+"|"+T2s+")",fgp="[^"+lgp+"]",dgp="(?:\\ud83c[\\udde6-\\uddff]){2}",pgp="[\\ud800-\\udbff][\\udc00-\\udfff]",B4E="\\u200d",_gp=D4E+"?",hgp="["+S4E+"]?",I4E="(?:"+B4E+"(?:"+[fgp,dgp,pgp].join("|")+")"+hgp+_gp+")*",C4E=hgp+_gp+I4E,q4E="(?:"+[fgp+q2s+"?",q2s,dgp,pgp,M4E].join("|")+")",cgp=RegExp(T2s+"(?="+T2s+")|"+q4E+C4E,"g");function T4E(e){for(var t=cgp.lastIndex=0;cgp.test(e);)++t;return t}var ygp=T4E;function R4E(e){return SKn(e)?ygp(e):sgp(e)}var bgp=R4E;var z4E="[object Map]",N4E="[object Set]";function F4E(e){if(e==null)return 0;if(iJ(e))return igp(e)?bgp(e):e.length;var t=gln(e);return t==z4E||t==N4E?e.size:bKn(e).length}var Dm=F4E;var Q4E=C9i(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Aln=Q4E;var U4E=C9i(function(e,t,r){return e+(r?" ":"")+F0(t)}),mln=U4E;function z2s({data:e,overrides:t,allowNullKeys:r}){let i=CKn(e,CKn,t,(a,o)=>Array.isArray(a)&&Array.isArray(o)?o.every(c=>typeof c=="object")&&a.every(c=>typeof c=="object")?void 0:[...o]:void 0);return R2s(i,M2s,{ancestorKeys:r??[],allowOmissionCursor:!1})}var R2s=(e,t,r)=>{function i(n){if(Array.isArray(n))return n.map(a=>R2s(a,t,r));if(QFa(n)){let a={};for(let[o,c]of Object.entries(n))a[o]=R2s(c,t,r!=null&&(r.allowOmissionCursor||r.ancestorKeys.includes(o))?{...r,allowOmissionCursor:!0}:r);return r==null||!r?.allowOmissionCursor?C2s(a,t):a}return n}return i(e)};function Bt(){}function N2s(e){return As(e)?e:void 0}function F2s(e){return L4E(e,t=>!As(t),void 0)}function Q2s(...e){let t=e.filter(r=>!As(r)).length;return t===0||t===e.length}function L4E(e,t,r){return Object.entries(e).some(([,a])=>t(a))?r:e}function wLt(e){return Object.keys(e)}function Vy(e,t){for(let r of wLt(t))t[r](e[r])}async function pHt(e,t){for(let r of wLt(t))await t[r](e[r])}function AI(e){return Object.entries(e)}function gl(e){if(!V4E(e)||toString.call(e)!=="[object Object]")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 V4E(e){return typeof e=="object"&&e!=null}function vgp(e,t){e=Object(e);let r={};return Object.keys(e).forEach(i=>{r[i]=t(e[i],i,e)}),r}function U2s(e){let[t,r]=e.split(" ");if(!t||!["POST","GET","PUT","PATCH","DELETE"].includes(t))return{type:"failure",message:`${e} contains invalid method ${t}`};if(!r)return{type:"failure",message:`${e} contains no path ${r}`};let i=new Set,n=/{([^}]+)}/g,a;for(;(a=n.exec(r))!=null;){let o=a[1];o!=null&&i.add(o)}return{type:"success",method:t,path:r,pathParameters:i}}function WCo({value:e,suffix:t}){return e.endsWith(t)?e.substring(0,e.length-t.length):e}var W4E=/\$\{(\w+)\}/g,G4E=/\\\$\\\{(\w+)\\}/g,ggp="\0ESCAPED_ENV_VAR\0";function FT(e,t,r={}){if(typeof e=="string"){let n=e.replace(G4E,(a,o)=>`${ggp}${o}\0`);return n=n.replace(W4E,(a,o)=>{if(r.substituteAsEmpty)return"";let c=process.env[o];return c==null&&t.onError(`Environment variable ${o} is not defined.`),c??""}),n=n.replace(new RegExp(`${ggp.replace(/\0/g,"\\0")}(\\w+)\\0`,"g"),(a,o)=>`\${${o}}`),n}return Array.isArray(e)?e.map(n=>FT(n,t,r)):gl(e)?vgp(e,n=>FT(n,t,r)):e}var xFa=Symbol.for("fern:skip");function Eje(e,t=[],r=[]){if(e==null)return r.push([...t]),xFa;if(Array.isArray(e)){let i=[];for(let n=0;n<e.length;n++){let a=Eje(e[n],[...t,String(n)],r);a!==xFa&&i.push(a)}return i}if(typeof e=="object"&&e!==null&&e.constructor===Object){let i={};try{for(let[n,a]of Object.entries(e)){let o=Eje(a,[...t,n],r);o!==xFa&&(i[n]=o)}}catch{return r.push([...t]),xFa}return i}return e}var uks=ce(Sbe(),1);function oks(e){let t=uks.default.parse(e);if(t===null)throw new Error(`Invalid semver: ${e}`);return t}function sks(e,t){let r=typeof e=="string"?oks(e):e,i=typeof t=="string"?oks(t):t;if(r>i)throw new Error("From semver must be less than or equal to to semver");return uks.default.diff(r,i)}function Z3(e){return e?.replace(/^\/+/,"")}var pAp=ce(eQa(),1);function iqo(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,pAp.default)(e,{special:$3E}).replace(/V\s(\d)/g,"V$1")}var $3E=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];var VPp=ce(QPp(),1);function Kec(e){return typeof e=="object"&&e!==null&&("oneOf"in e||"anyOf"in e)}function UPp(e){return typeof e=="object"&&e!==null&&"$ref"in e}function AGE(e){return typeof e=="object"&&e!==null}function mGE(e){return typeof e=="object"&&e!==null&&"additionalProperty"in e}function PGE(e){return typeof e=="object"&&e!==null&&"missingProperty"in e}function Mbe(e,t){if(!e&&!t)return"$";let r=e.split("/").filter(i=>i!=="");return t&&r.push(t),r.length===0?"$":"$"+r.map(i=>{let n=i.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(n)?`[${n}]`:/[.[\]']/.test(n)?`['${n.replace(/'/g,"\\'")}']`:`.${n}`}).join("")}function jGE(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Qqo(e,t){try{let r=t.split("/").filter(n=>n!==""),i=e;for(let n of r){let a=n.replace(/~1/g,"/").replace(/~0/g,"~");if(Array.isArray(i)){let o=parseInt(a,10);if(!isNaN(o))i=i[o];else return}else if(typeof i=="object"&&i!=null)i=i[a];else return}return i}catch{return}}function Jec(e){if(typeof e!="object"||e===null)return"";let r=Object.keys(e);return r.length===0?" (empty object)":` (has properties: ${r.join(", ")})`}function Yec(e,t){if(typeof e!="object"||e===null||typeof t!="object"||t===null)return{missing:0,extra:0,total:0};let r=e,i=new Set(Object.keys(r)),n=new Set,a=new Set;t.properties&&typeof t.properties=="object"&&Object.keys(t.properties).forEach(d=>n.add(d)),Array.isArray(t.required)&&t.required.forEach(d=>a.add(d));let o=0;for(let d of a)i.has(d)||o++;let c=0;for(let d of i)n.has(d)||c++;return{missing:o,extra:c,total:o+c}}function $ec(e,t){if(typeof e!="object"||e===null||!Array.isArray(t)||t.length===0)return null;let r=null;for(let i of t)if(i.type==="object"&&i.properties){let n=Yec(e,i);(r===null||wGE(n,r.differences))&&(r={schema:i,differences:n})}return r}function wGE(e,t){return e.missing===0&&t.missing>0?!0:e.missing>0&&t.missing===0?!1:e.missing!==t.missing?e.missing<t.missing:e.total<t.total}function EGE(e,t){let r=e.instancePath.split("/").length,i=t.instancePath.split("/").length,n=e.keyword==="oneOf"||e.keyword==="anyOf",a=t.keyword==="oneOf"||t.keyword==="anyOf",o=LPp(e),c=LPp(t);return!n&&a?!0:n&&!a?!1:o>=9&&c<9?!0:c>=9&&o<9?!1:r>i?!0:r<i?!1:o>c}function LPp(e){switch(e.keyword){case"additionalProperties":return 10;case"required":return 9;case"type":return 8;case"enum":return 7;case"format":return 6;case"pattern":return 6;case"const":return 4;case"minimum":case"maximum":case"minLength":case"maxLength":return 5;case"oneOf":case"anyOf":return 3;default:return 1}}function Dbe(e,t){if(!t)return e;let r=e.match(/at path (\$[^\s]+)/),i=r?r[1]:"";if(i){let n=i.replace(/^\$/,"").replace(/\[(\d+)\]/g,"/$1").replace(/\.([^[\]]+)/g,"/$1");return`${e} at ${n} (in ${t})`}return`${e} (in ${t})`}function DQa(e,t){if(typeof e!="object"||e===null||!t.schema.properties)return"";let r=e,i=new Set(Object.keys(r)),n=new Set,a=new Set;t.schema.properties&&Object.keys(t.schema.properties).forEach(s=>n.add(s)),Array.isArray(t.schema.required)&&t.schema.required.forEach(s=>a.add(s));let o=[],c=[];for(let s of a)i.has(s)||o.push(s);for(let s of i)n.has(s)||c.push(s);let d=[];return o.length>0&&d.push(`add ${o.map(s=>`'${s}'`).join(", ")}`),c.length>0&&d.push(`remove ${c.map(s=>`'${s}'`).join(", ")}`),d.length>0?`
796
+ ${r?e:" ".repeat(i)}`)}`}function gt(e){throw new Error("Unexpected value: "+JSON.stringify(e))}function f2s(e){return new Promise(t=>setTimeout(()=>t(),e))}var Un={};Zt(Un,{BASE64:()=>R1E,BIG_INTEGER:()=>x1E,BOOLEAN:()=>z1E,DATE:()=>N1E,DATE_TIME:()=>F1E,DOUBLE:()=>Q1E,FLOAT:()=>U1E,INT:()=>L1E,INT64:()=>V1E,SAMPLE_STRINGS:()=>K1E,STRING:()=>T1E,UINT:()=>W1E,UINT64:()=>G1E,UUID:()=>H1E});var T1E="string",R1E="SGVsbG8gd29ybGQh",z1E=!0,N1E="2023-01-15",F1E="2024-01-15T09:30:00Z",Q1E=1.1,U1E=1.1,L1E=1,V1E=1e6,W1E=1,G1E=1e6,H1E="d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",x1E="123456789123456789",K1E=["x","xy","foo","buzz","alpha","banana","apricot","mandarin","nectarine","strawberry","pomegranate","blackcurrant"];function d2s(e){let t=new Set,r=new Set,i=[];for(let n of e)t.has(n)&&!r.has(n)&&(r.add(n),i.push(n)),t.add(n);return i}function As(e){return e!=null}var ryp=ce(h2s(),1),xO=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,o){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static TEXT_PLAIN="text/plain";static TEXT_HTML="text/html";static TEXT_XML="text/xml";static APPLICATION_XML="application/xml";static APPLICATION_FORM_URLENCODED="application/x-www-form-urlencoded";static parse(t){if(t==null||t.trim()==="")return null;let r=t.trim(),i=ryp.default.parse(r);return i==null?null:new e(i.type,i.subtype,i.essence,i.parameters,i,r)}toString(){return this.input}getCharset(){return this.parameters.get("charset")??null}getBoundary(){return this.parameters.get("boundary")??null}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return(this.isText()||this.isApplication())&&this.subtype==="csv"}isMarkdown(){return this.isText()&&(this.subtype==="markdown"||this.subtype==="x-markdown")}isPlainText(){return this.isText()&&this.subtype==="plain"}isRichText(){return this.isText()&&this.subtype==="richtext"}isDNS(){return this.isText()&&this.subtype==="dns"}isApplicationText(){return this.isApplication()&&this.subtype==="text"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isMultiPartMixed(){return this.isMultipart()&&this.subtype==="mixed"}isMultiPartAlternative(){return this.isMultipart()&&this.subtype==="alternative"}isMultiPartRelated(){return this.isMultipart()&&this.subtype==="related"}isJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&(this.subtype==="zip"||this.subtype==="x-zip-compressed")}isGzip(){return this.isApplication()&&(this.subtype==="gzip"||this.subtype==="x-gzip")}isTar(){return this.isApplication()&&(this.subtype==="tar"||this.subtype==="x-tar")}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&(this.subtype==="protobuf"||this.subtype==="x-protobuf")}isExcel(){return this.isApplication()&&(this.subtype==="vnd.ms-excel"||this.subtype==="vnd.openxmlformats-officedocument.spreadsheetml.sheet")}isWord(){return this.isApplication()&&(this.subtype==="msword"||this.subtype==="vnd.openxmlformats-officedocument.wordprocessingml.document")}isPowerPoint(){return this.isApplication()&&(this.subtype==="vnd.ms-powerpoint"||this.subtype==="vnd.openxmlformats-officedocument.presentationml.presentation")}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&(this.subtype==="jpeg"||this.subtype==="jpg")}isGIF(){return this.isImage()&&this.subtype==="gif"}isBMP(){return this.isImage()&&this.subtype==="bmp"}isTIFF(){return this.isImage()&&(this.subtype==="tiff"||this.subtype==="tif")}isICO(){return this.isImage()&&(this.subtype==="x-icon"||this.subtype==="vnd.microsoft.icon")}isMPEG(){return this.isAudio()&&(this.subtype==="mpeg"||this.subtype==="mp3")}isWAV(){return this.isAudio()&&(this.subtype==="wav"||this.subtype==="wave")}isOGG(){return this.isAudio()&&this.subtype==="ogg"}isAAC(){return this.isAudio()&&this.subtype==="aac"}isFLAC(){return this.isAudio()&&this.subtype==="flac"}isMP4(){return this.isVideo()&&this.subtype==="mp4"}isWebM(){return this.isVideo()&&this.subtype==="webm"}isAVI(){return this.isVideo()&&this.subtype==="x-msvideo"}isMOV(){return this.isVideo()&&this.subtype==="quicktime"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()||this.isApplication()&&this.subtype.endsWith("+xml")}isJavaScript(){return this.mimeType.isJavaScript()}isBinary(){return this.isImage()||this.isAudio()||this.isVideo()||this.isFont()||this.isOctetStream()||this.isPDF()||this.isZip()||this.isGzip()||this.isTar()||this.isBrotli()}isTextBased(){return this.isText()||this.isJSON()||this.isXML()||this.isHTML()||this.isJavaScript()||this.isCSS()||this.isCSV()||this.isMarkdown()||this.isSVG()||this.isDNS()||this.isApplicationText()}isStructuredData(){return this.isJSON()||this.isXML()||this.isCSV()||this.isHTML()}isFormData(){return this.isURLEncoded()||this.isMultiPartFormData()}isCompressed(){return this.isGzip()||this.isBrotli()||this.isDeflate()||this.isZip()||this.isTar()}};var nTE=typeof global=="object"&&global&&global.Object===Object&&global,_Co=nTE;var aTE=typeof self=="object"&&self&&self.Object===Object&&self,oTE=_Co||aTE||Function("return this")(),Cq=oTE;var uTE=Cq.Symbol,tG=uTE;var iyp=Object.prototype,sTE=iyp.hasOwnProperty,cTE=iyp.toString,NFa=tG?tG.toStringTag:void 0;function lTE(e){var t=sTE.call(e,NFa),r=e[NFa];try{e[NFa]=void 0;var i=!0}catch{}var n=cTE.call(e);return i&&(t?e[NFa]=r:delete e[NFa]),n}var nyp=lTE;var fTE=Object.prototype,dTE=fTE.toString;function pTE(e){return dTE.call(e)}var ayp=pTE;var _TE="[object Null]",hTE="[object Undefined]",oyp=tG?tG.toStringTag:void 0;function yTE(e){return e==null?e===void 0?hTE:_TE:oyp&&oyp in Object(e)?nyp(e):ayp(e)}var rG=yTE;function bTE(e){return e!=null&&typeof e=="object"}var ZU=bTE;var vTE="[object Symbol]";function gTE(e){return typeof e=="symbol"||ZU(e)&&rG(e)==vTE}var cHt=gTE;function OTE(e,t){for(var r=-1,i=e==null?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}var dKn=OTE;var ATE=Array.isArray,u0=ATE;var mTE=1/0,uyp=tG?tG.prototype:void 0,syp=uyp?uyp.toString:void 0;function cyp(e){if(typeof e=="string")return e;if(u0(e))return dKn(e,cyp)+"";if(cHt(e))return syp?syp.call(e):"";var t=e+"";return t=="0"&&1/e==-mTE?"-0":t}var lyp=cyp;var PTE=/\s/;function jTE(e){for(var t=e.length;t--&&PTE.test(e.charAt(t)););return t}var fyp=jTE;var wTE=/^\s+/;function ETE(e){return e&&e.slice(0,fyp(e)+1).replace(wTE,"")}var dyp=ETE;function STE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var OB=STE;var pyp=NaN,MTE=/^[-+]0x[0-9a-f]+$/i,DTE=/^0b[01]+$/i,BTE=/^0o[0-7]+$/i,ITE=parseInt;function CTE(e){if(typeof e=="number")return e;if(cHt(e))return pyp;if(OB(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=OB(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dyp(e);var r=DTE.test(e);return r||BTE.test(e)?ITE(e.slice(2),r?2:8):MTE.test(e)?pyp:+e}var _yp=CTE;var hyp=1/0,qTE=17976931348623157e292;function TTE(e){if(!e)return e===0?e:0;if(e=_yp(e),e===hyp||e===-hyp){var t=e<0?-1:1;return t*qTE}return e===e?e:0}var yyp=TTE;function RTE(e){var t=yyp(e),r=t%1;return t===t?r?t-r:t:0}var byp=RTE;function zTE(e){return e}var pKn=zTE;var NTE="[object AsyncFunction]",FTE="[object Function]",QTE="[object GeneratorFunction]",UTE="[object Proxy]";function LTE(e){if(!OB(e))return!1;var t=rG(e);return t==FTE||t==QTE||t==NTE||t==UTE}var _Kn=LTE;var VTE=Cq["__core-js_shared__"],hCo=VTE;var vyp=(function(){var e=/[^.]+$/.exec(hCo&&hCo.keys&&hCo.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function WTE(e){return!!vyp&&vyp in e}var gyp=WTE;var GTE=Function.prototype,HTE=GTE.toString;function xTE(e){if(e!=null){try{return HTE.call(e)}catch{}try{return e+""}catch{}}return""}var tzi=xTE;var KTE=/[\\^$.*+?()[\]{}|]/g,JTE=/^\[object .+?Constructor\]$/,$TE=Function.prototype,YTE=Object.prototype,XTE=$TE.toString,ZTE=YTE.hasOwnProperty,kTE=RegExp("^"+XTE.call(ZTE).replace(KTE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function eRE(e){if(!OB(e)||gyp(e))return!1;var t=_Kn(e)?kTE:JTE;return t.test(tzi(e))}var Oyp=eRE;function tRE(e,t){return e?.[t]}var Ayp=tRE;function rRE(e,t){var r=Ayp(e,t);return Oyp(r)?r:void 0}var tJ=rRE;var iRE=tJ(Cq,"WeakMap"),yCo=iRE;var myp=Object.create,nRE=(function(){function e(){}return function(t){if(!OB(t))return{};if(myp)return myp(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),Pyp=nRE;function aRE(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var jyp=aRE;function oRE(){}var Pje=oRE;function uRE(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t}var wyp=uRE;var sRE=800,cRE=16,lRE=Date.now;function fRE(e){var t=0,r=0;return function(){var i=lRE(),n=cRE-(i-r);if(r=i,n>0){if(++t>=sRE)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Eyp=fRE;function dRE(e){return function(){return e}}var Syp=dRE;var pRE=(function(){try{var e=tJ(Object,"defineProperty");return e({},"",{}),e}catch{}})(),hKn=pRE;var _RE=hKn?function(e,t){return hKn(e,"toString",{configurable:!0,enumerable:!1,value:Syp(t),writable:!0})}:pKn,Myp=_RE;var hRE=Eyp(Myp),Dyp=hRE;function yRE(e,t,r,i){for(var n=e.length,a=r+(i?1:-1);i?a--:++a<n;)if(t(e[a],a,e))return a;return-1}var Byp=yRE;function bRE(e){return e!==e}var Iyp=bRE;function vRE(e,t,r){for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return-1}var Cyp=vRE;function gRE(e,t,r){return t===t?Cyp(e,t,r):Byp(e,Iyp,r)}var qyp=gRE;function ORE(e,t){var r=e==null?0:e.length;return!!r&&qyp(e,t,0)>-1}var Typ=ORE;var ARE=9007199254740991,mRE=/^(?:0|[1-9]\d*)$/;function PRE(e,t){var r=typeof e;return t=t??ARE,!!t&&(r=="number"||r!="symbol"&&mRE.test(e))&&e>-1&&e%1==0&&e<t}var j9i=PRE;function jRE(e,t,r){t=="__proto__"&&hKn?hKn(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var rJ=jRE;function wRE(e,t){return e===t||e!==e&&t!==t}var Ebe=wRE;var ERE=Object.prototype,SRE=ERE.hasOwnProperty;function MRE(e,t,r){var i=e[t];(!(SRE.call(e,t)&&Ebe(i,r))||r===void 0&&!(t in e))&&rJ(e,t,r)}var bCo=MRE;function DRE(e,t,r,i){var n=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var c=t[a],d=i?i(r[c],e[c],c,r,e):void 0;d===void 0&&(d=e[c]),n?rJ(r,c,d):bCo(r,c,d)}return r}var Ryp=DRE;var zyp=Math.max;function BRE(e,t,r){return t=zyp(t===void 0?e.length-1:t,0),function(){for(var i=arguments,n=-1,a=zyp(i.length-t,0),o=Array(a);++n<a;)o[n]=i[t+n];n=-1;for(var c=Array(t+1);++n<t;)c[n]=i[n];return c[t]=r(o),jyp(e,this,c)}}var Nyp=BRE;function IRE(e,t){return Dyp(Nyp(e,t,pKn),e+"")}var vCo=IRE;var CRE=9007199254740991;function qRE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=CRE}var yKn=qRE;function TRE(e){return e!=null&&yKn(e.length)&&!_Kn(e)}var iJ=TRE;function RRE(e,t,r){if(!OB(r))return!1;var i=typeof t;return(i=="number"?iJ(r)&&j9i(t,r.length):i=="string"&&t in r)?Ebe(r[t],e):!1}var gCo=RRE;function zRE(e){return vCo(function(t,r){var i=-1,n=r.length,a=n>1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,o&&gCo(r[0],r[1],o)&&(a=n<3?void 0:a,n=1),t=Object(t);++i<n;){var c=r[i];c&&e(t,c,i,a)}return t})}var OCo=zRE;var NRE=Object.prototype;function FRE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||NRE;return e===r}var w9i=FRE;function QRE(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}var Fyp=QRE;var URE="[object Arguments]";function LRE(e){return ZU(e)&&rG(e)==URE}var y2s=LRE;var Qyp=Object.prototype,VRE=Qyp.hasOwnProperty,WRE=Qyp.propertyIsEnumerable,GRE=y2s((function(){return arguments})())?y2s:function(e){return ZU(e)&&VRE.call(e,"callee")&&!WRE.call(e,"callee")},jLt=GRE;function HRE(){return!1}var Uyp=HRE;var Wyp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lyp=Wyp&&typeof module=="object"&&module&&!module.nodeType&&module,xRE=Lyp&&Lyp.exports===Wyp,Vyp=xRE?Cq.Buffer:void 0,KRE=Vyp?Vyp.isBuffer:void 0,JRE=KRE||Uyp,rzi=JRE;var $RE="[object Arguments]",YRE="[object Array]",XRE="[object Boolean]",ZRE="[object Date]",kRE="[object Error]",ezE="[object Function]",tzE="[object Map]",rzE="[object Number]",izE="[object Object]",nzE="[object RegExp]",azE="[object Set]",ozE="[object String]",uzE="[object WeakMap]",szE="[object ArrayBuffer]",czE="[object DataView]",lzE="[object Float32Array]",fzE="[object Float64Array]",dzE="[object Int8Array]",pzE="[object Int16Array]",_zE="[object Int32Array]",hzE="[object Uint8Array]",yzE="[object Uint8ClampedArray]",bzE="[object Uint16Array]",vzE="[object Uint32Array]",xE={};xE[lzE]=xE[fzE]=xE[dzE]=xE[pzE]=xE[_zE]=xE[hzE]=xE[yzE]=xE[bzE]=xE[vzE]=!0;xE[$RE]=xE[YRE]=xE[szE]=xE[XRE]=xE[czE]=xE[ZRE]=xE[kRE]=xE[ezE]=xE[tzE]=xE[rzE]=xE[izE]=xE[nzE]=xE[azE]=xE[ozE]=xE[uzE]=!1;function gzE(e){return ZU(e)&&yKn(e.length)&&!!xE[rG(e)]}var Gyp=gzE;function OzE(e){return function(t){return e(t)}}var ACo=OzE;var Hyp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FFa=Hyp&&typeof module=="object"&&module&&!module.nodeType&&module,AzE=FFa&&FFa.exports===Hyp,b2s=AzE&&_Co.process,mzE=(function(){try{var e=FFa&&FFa.require&&FFa.require("util").types;return e||b2s&&b2s.binding&&b2s.binding("util")}catch{}})(),v2s=mzE;var xyp=v2s&&v2s.isTypedArray,PzE=xyp?ACo(xyp):Gyp,E9i=PzE;var jzE=Object.prototype,wzE=jzE.hasOwnProperty;function EzE(e,t){var r=u0(e),i=!r&&jLt(e),n=!r&&!i&&rzi(e),a=!r&&!i&&!n&&E9i(e),o=r||i||n||a,c=o?Fyp(e.length,String):[],d=c.length;for(var s in e)(t||wzE.call(e,s))&&!(o&&(s=="length"||n&&(s=="offset"||s=="parent")||a&&(s=="buffer"||s=="byteLength"||s=="byteOffset")||j9i(s,d)))&&c.push(s);return c}var mCo=EzE;function SzE(e,t){return function(r){return e(t(r))}}var PCo=SzE;var MzE=PCo(Object.keys,Object),Kyp=MzE;var DzE=Object.prototype,BzE=DzE.hasOwnProperty;function IzE(e){if(!w9i(e))return Kyp(e);var t=[];for(var r in Object(e))BzE.call(e,r)&&r!="constructor"&&t.push(r);return t}var bKn=IzE;function CzE(e){return iJ(e)?mCo(e):bKn(e)}var vKn=CzE;function qzE(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Jyp=qzE;var TzE=Object.prototype,RzE=TzE.hasOwnProperty;function zzE(e){if(!OB(e))return Jyp(e);var t=w9i(e),r=[];for(var i in e)i=="constructor"&&(t||!RzE.call(e,i))||r.push(i);return r}var $yp=zzE;function NzE(e){return iJ(e)?mCo(e,!0):$yp(e)}var gKn=NzE;var FzE=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QzE=/^\w*$/;function UzE(e,t){if(u0(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||cHt(e)?!0:QzE.test(e)||!FzE.test(e)||t!=null&&e in Object(t)}var OKn=UzE;var LzE=tJ(Object,"create"),izi=LzE;function VzE(){this.__data__=izi?izi(null):{},this.size=0}var Yyp=VzE;function WzE(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Xyp=WzE;var GzE="__lodash_hash_undefined__",HzE=Object.prototype,xzE=HzE.hasOwnProperty;function KzE(e){var t=this.__data__;if(izi){var r=t[e];return r===GzE?void 0:r}return xzE.call(t,e)?t[e]:void 0}var Zyp=KzE;var JzE=Object.prototype,$zE=JzE.hasOwnProperty;function YzE(e){var t=this.__data__;return izi?t[e]!==void 0:$zE.call(t,e)}var kyp=YzE;var XzE="__lodash_hash_undefined__";function ZzE(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=izi&&t===void 0?XzE:t,this}var ebp=ZzE;function AKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}AKn.prototype.clear=Yyp;AKn.prototype.delete=Xyp;AKn.prototype.get=Zyp;AKn.prototype.has=kyp;AKn.prototype.set=ebp;var g2s=AKn;function kzE(){this.__data__=[],this.size=0}var tbp=kzE;function eNE(e,t){for(var r=e.length;r--;)if(Ebe(e[r][0],t))return r;return-1}var S9i=eNE;var tNE=Array.prototype,rNE=tNE.splice;function iNE(e){var t=this.__data__,r=S9i(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():rNE.call(t,r,1),--this.size,!0}var rbp=iNE;function nNE(e){var t=this.__data__,r=S9i(t,e);return r<0?void 0:t[r][1]}var ibp=nNE;function aNE(e){return S9i(this.__data__,e)>-1}var nbp=aNE;function oNE(e,t){var r=this.__data__,i=S9i(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var abp=oNE;function mKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}mKn.prototype.clear=tbp;mKn.prototype.delete=rbp;mKn.prototype.get=ibp;mKn.prototype.has=nbp;mKn.prototype.set=abp;var M9i=mKn;var uNE=tJ(Cq,"Map"),D9i=uNE;function sNE(){this.size=0,this.__data__={hash:new g2s,map:new(D9i||M9i),string:new g2s}}var obp=sNE;function cNE(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ubp=cNE;function lNE(e,t){var r=e.__data__;return ubp(t)?r[typeof t=="string"?"string":"hash"]:r.map}var B9i=lNE;function fNE(e){var t=B9i(this,e).delete(e);return this.size-=t?1:0,t}var sbp=fNE;function dNE(e){return B9i(this,e).get(e)}var cbp=dNE;function pNE(e){return B9i(this,e).has(e)}var lbp=pNE;function _NE(e,t){var r=B9i(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var fbp=_NE;function PKn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}PKn.prototype.clear=obp;PKn.prototype.delete=sbp;PKn.prototype.get=cbp;PKn.prototype.has=lbp;PKn.prototype.set=fbp;var yln=PKn;var hNE="Expected a function";function O2s(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hNE);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],a=r.cache;if(a.has(n))return a.get(n);var o=e.apply(this,i);return r.cache=a.set(n,o)||a,o};return r.cache=new(O2s.Cache||yln),r}O2s.Cache=yln;var dbp=O2s;var yNE=500;function bNE(e){var t=dbp(e,function(i){return r.size===yNE&&r.clear(),i}),r=t.cache;return t}var pbp=bNE;var vNE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gNE=/\\(\\)?/g,ONE=pbp(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vNE,function(r,i,n,a){t.push(n?a.replace(gNE,"$1"):i||r)}),t}),_bp=ONE;function ANE(e){return e==null?"":lyp(e)}var lHt=ANE;function mNE(e,t){return u0(e)?e:OKn(e,t)?[e]:_bp(lHt(e))}var I9i=mNE;var PNE=1/0;function jNE(e){if(typeof e=="string"||cHt(e))return e;var t=e+"";return t=="0"&&1/e==-PNE?"-0":t}var fHt=jNE;function wNE(e,t){t=I9i(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[fHt(t[r++])];return r&&r==i?e:void 0}var jKn=wNE;function ENE(e,t,r){var i=e==null?void 0:jKn(e,t);return i===void 0?r:i}var hbp=ENE;function SNE(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}var wKn=SNE;var ybp=tG?tG.isConcatSpreadable:void 0;function MNE(e){return u0(e)||jLt(e)||!!(ybp&&e&&e[ybp])}var bbp=MNE;function vbp(e,t,r,i,n){var a=-1,o=e.length;for(r||(r=bbp),n||(n=[]);++a<o;){var c=e[a];t>0&&r(c)?t>1?vbp(c,t-1,r,i,n):wKn(n,c):i||(n[n.length]=c)}return n}var gbp=vbp;var DNE=PCo(Object.getPrototypeOf,Object),EKn=DNE;var BNE="[object Object]",INE=Function.prototype,CNE=Object.prototype,Obp=INE.toString,qNE=CNE.hasOwnProperty,TNE=Obp.call(Object);function RNE(e){if(!ZU(e)||rG(e)!=BNE)return!1;var t=EKn(e);if(t===null)return!0;var r=qNE.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Obp.call(r)==TNE}var QFa=RNE;function zNE(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(n);++i<n;)a[i]=e[i+t];return a}var jCo=zNE;function NNE(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:jCo(e,t,r)}var Abp=NNE;var FNE="\\ud800-\\udfff",QNE="\\u0300-\\u036f",UNE="\\ufe20-\\ufe2f",LNE="\\u20d0-\\u20ff",VNE=QNE+UNE+LNE,WNE="\\ufe0e\\ufe0f",GNE="\\u200d",HNE=RegExp("["+GNE+FNE+VNE+WNE+"]");function xNE(e){return HNE.test(e)}var SKn=xNE;function KNE(e){return e.split("")}var mbp=KNE;var Pbp="\\ud800-\\udfff",JNE="\\u0300-\\u036f",$NE="\\ufe20-\\ufe2f",YNE="\\u20d0-\\u20ff",XNE=JNE+$NE+YNE,ZNE="\\ufe0e\\ufe0f",kNE="["+Pbp+"]",A2s="["+XNE+"]",m2s="\\ud83c[\\udffb-\\udfff]",eFE="(?:"+A2s+"|"+m2s+")",jbp="[^"+Pbp+"]",wbp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ebp="[\\ud800-\\udbff][\\udc00-\\udfff]",tFE="\\u200d",Sbp=eFE+"?",Mbp="["+ZNE+"]?",rFE="(?:"+tFE+"(?:"+[jbp,wbp,Ebp].join("|")+")"+Mbp+Sbp+")*",iFE=Mbp+Sbp+rFE,nFE="(?:"+[jbp+A2s+"?",A2s,wbp,Ebp,kNE].join("|")+")",aFE=RegExp(m2s+"(?="+m2s+")|"+nFE+iFE,"g");function oFE(e){return e.match(aFE)||[]}var Dbp=oFE;function uFE(e){return SKn(e)?Dbp(e):mbp(e)}var Bbp=uFE;function sFE(e){return function(t){t=lHt(t);var r=SKn(t)?Bbp(t):void 0,i=r?r[0]:t.charAt(0),n=r?Abp(r,1).join(""):t.slice(1);return i[e]()+n}}var Ibp=sFE;var cFE=Ibp("toUpperCase"),F0=cFE;function lFE(e){return F0(lHt(e).toLowerCase())}var UFa=lFE;function fFE(e,t,r,i){var n=-1,a=e==null?0:e.length;for(i&&a&&(r=e[++n]);++n<a;)r=t(r,e[n],n,e);return r}var Cbp=fFE;function dFE(e){return function(t){return e?.[t]}}var qbp=dFE;var pFE={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},_FE=qbp(pFE),Tbp=_FE;var hFE=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yFE="\\u0300-\\u036f",bFE="\\ufe20-\\ufe2f",vFE="\\u20d0-\\u20ff",gFE=yFE+bFE+vFE,OFE="["+gFE+"]",AFE=RegExp(OFE,"g");function mFE(e){return e=lHt(e),e&&e.replace(hFE,Tbp).replace(AFE,"")}var Rbp=mFE;var PFE=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function jFE(e){return e.match(PFE)||[]}var zbp=jFE;var wFE=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function EFE(e){return wFE.test(e)}var Nbp=EFE;var Vbp="\\ud800-\\udfff",SFE="\\u0300-\\u036f",MFE="\\ufe20-\\ufe2f",DFE="\\u20d0-\\u20ff",BFE=SFE+MFE+DFE,Wbp="\\u2700-\\u27bf",Gbp="a-z\\xdf-\\xf6\\xf8-\\xff",IFE="\\xac\\xb1\\xd7\\xf7",CFE="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qFE="\\u2000-\\u206f",TFE=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Hbp="A-Z\\xc0-\\xd6\\xd8-\\xde",RFE="\\ufe0e\\ufe0f",xbp=IFE+CFE+qFE+TFE,Kbp="['\u2019]",Fbp="["+xbp+"]",zFE="["+BFE+"]",Jbp="\\d+",NFE="["+Wbp+"]",$bp="["+Gbp+"]",Ybp="[^"+Vbp+xbp+Jbp+Wbp+Gbp+Hbp+"]",FFE="\\ud83c[\\udffb-\\udfff]",QFE="(?:"+zFE+"|"+FFE+")",UFE="[^"+Vbp+"]",Xbp="(?:\\ud83c[\\udde6-\\uddff]){2}",Zbp="[\\ud800-\\udbff][\\udc00-\\udfff]",MKn="["+Hbp+"]",LFE="\\u200d",Qbp="(?:"+$bp+"|"+Ybp+")",VFE="(?:"+MKn+"|"+Ybp+")",Ubp="(?:"+Kbp+"(?:d|ll|m|re|s|t|ve))?",Lbp="(?:"+Kbp+"(?:D|LL|M|RE|S|T|VE))?",kbp=QFE+"?",evp="["+RFE+"]?",WFE="(?:"+LFE+"(?:"+[UFE,Xbp,Zbp].join("|")+")"+evp+kbp+")*",GFE="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",HFE="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",xFE=evp+kbp+WFE,KFE="(?:"+[NFE,Xbp,Zbp].join("|")+")"+xFE,JFE=RegExp([MKn+"?"+$bp+"+"+Ubp+"(?="+[Fbp,MKn,"$"].join("|")+")",VFE+"+"+Lbp+"(?="+[Fbp,MKn+Qbp,"$"].join("|")+")",MKn+"?"+Qbp+"+"+Ubp,MKn+"+"+Lbp,HFE,GFE,Jbp,KFE].join("|"),"g");function $FE(e){return e.match(JFE)||[]}var tvp=$FE;function YFE(e,t,r){return e=lHt(e),t=r?void 0:t,t===void 0?Nbp(e)?tvp(e):zbp(e):e.match(t)||[]}var bln=YFE;var XFE="['\u2019]",ZFE=RegExp(XFE,"g");function kFE(e){return function(t){return Cbp(bln(Rbp(t).replace(ZFE,"")),e,"")}}var C9i=kFE;var eQE=C9i(function(e,t,r){return t=t.toLowerCase(),e+(r?UFa(t):t)}),nu=eQE;var tQE=Math.ceil,rQE=Math.max;function iQE(e,t,r){(r?gCo(e,t,r):t===void 0)?t=1:t=rQE(byp(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var n=0,a=0,o=Array(tQE(i/t));n<i;)o[a++]=jCo(e,n,n+=t);return o}var LFa=iQE;function nQE(){this.__data__=new M9i,this.size=0}var rvp=nQE;function aQE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var ivp=aQE;function oQE(e){return this.__data__.get(e)}var nvp=oQE;function uQE(e){return this.__data__.has(e)}var avp=uQE;var sQE=200;function cQE(e,t){var r=this.__data__;if(r instanceof M9i){var i=r.__data__;if(!D9i||i.length<sQE-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new yln(i)}return r.set(e,t),this.size=r.size,this}var ovp=cQE;function DKn(e){var t=this.__data__=new M9i(e);this.size=t.size}DKn.prototype.clear=rvp;DKn.prototype.delete=ivp;DKn.prototype.get=nvp;DKn.prototype.has=avp;DKn.prototype.set=ovp;var q9i=DKn;var lvp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uvp=lvp&&typeof module=="object"&&module&&!module.nodeType&&module,lQE=uvp&&uvp.exports===lvp,svp=lQE?Cq.Buffer:void 0,cvp=svp?svp.allocUnsafe:void 0;function fQE(e,t){if(t)return e.slice();var r=e.length,i=cvp?cvp(r):new e.constructor(r);return e.copy(i),i}var fvp=fQE;function dQE(e,t){for(var r=-1,i=e==null?0:e.length,n=0,a=[];++r<i;){var o=e[r];t(o,r,e)&&(a[n++]=o)}return a}var dvp=dQE;function pQE(){return[]}var wCo=pQE;var _QE=Object.prototype,hQE=_QE.propertyIsEnumerable,pvp=Object.getOwnPropertySymbols,yQE=pvp?function(e){return e==null?[]:(e=Object(e),dvp(pvp(e),function(t){return hQE.call(e,t)}))}:wCo,ECo=yQE;var bQE=Object.getOwnPropertySymbols,vQE=bQE?function(e){for(var t=[];e;)wKn(t,ECo(e)),e=EKn(e);return t}:wCo,_vp=vQE;function gQE(e,t,r){var i=t(e);return u0(e)?i:wKn(i,r(e))}var SCo=gQE;function OQE(e){return SCo(e,vKn,ECo)}var P2s=OQE;function AQE(e){return SCo(e,gKn,_vp)}var hvp=AQE;var mQE=tJ(Cq,"DataView"),MCo=mQE;var PQE=tJ(Cq,"Promise"),DCo=PQE;var jQE=tJ(Cq,"Set"),BCo=jQE;var yvp="[object Map]",wQE="[object Object]",bvp="[object Promise]",vvp="[object Set]",gvp="[object WeakMap]",Ovp="[object DataView]",EQE=tzi(MCo),SQE=tzi(D9i),MQE=tzi(DCo),DQE=tzi(BCo),BQE=tzi(yCo),vln=rG;(MCo&&vln(new MCo(new ArrayBuffer(1)))!=Ovp||D9i&&vln(new D9i)!=yvp||DCo&&vln(DCo.resolve())!=bvp||BCo&&vln(new BCo)!=vvp||yCo&&vln(new yCo)!=gvp)&&(vln=function(e){var t=rG(e),r=t==wQE?e.constructor:void 0,i=r?tzi(r):"";if(i)switch(i){case EQE:return Ovp;case SQE:return yvp;case MQE:return bvp;case DQE:return vvp;case BQE:return gvp}return t});var gln=vln;var IQE=Cq.Uint8Array,BKn=IQE;function CQE(e){var t=new e.constructor(e.byteLength);return new BKn(t).set(new BKn(e)),t}var Avp=CQE;function qQE(e,t){var r=t?Avp(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var mvp=qQE;function TQE(e){return typeof e.constructor=="function"&&!w9i(e)?Pyp(EKn(e)):{}}var Pvp=TQE;function RQE(e){for(var t=-1,r=e==null?0:e.length,i=0,n=[];++t<r;){var a=e[t];a&&(n[i++]=a)}return n}var jje=RQE;var zQE="__lodash_hash_undefined__";function NQE(e){return this.__data__.set(e,zQE),this}var jvp=NQE;function FQE(e){return this.__data__.has(e)}var wvp=FQE;function ICo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new yln;++t<r;)this.add(e[t])}ICo.prototype.add=ICo.prototype.push=jvp;ICo.prototype.has=wvp;var CCo=ICo;function QQE(e,t){for(var r=-1,i=e==null?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}var Evp=QQE;function UQE(e,t){return e.has(t)}var qCo=UQE;var LQE=1,VQE=2;function WQE(e,t,r,i,n,a){var o=r&LQE,c=e.length,d=t.length;if(c!=d&&!(o&&d>c))return!1;var s=a.get(e),u=a.get(t);if(s&&u)return s==t&&u==e;var l=-1,p=!0,_=r&VQE?new CCo:void 0;for(a.set(e,t),a.set(t,e);++l<c;){var h=e[l],y=t[l];if(i)var b=o?i(y,h,l,t,e,a):i(h,y,l,e,t,a);if(b!==void 0){if(b)continue;p=!1;break}if(_){if(!Evp(t,function(v,O){if(!qCo(_,O)&&(h===v||n(h,v,r,i,a)))return _.push(O)})){p=!1;break}}else if(!(h===y||n(h,y,r,i,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var TCo=WQE;function GQE(e){var t=-1,r=Array(e.size);return e.forEach(function(i,n){r[++t]=[n,i]}),r}var Svp=GQE;function HQE(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}var Mvp=HQE;var xQE=1,KQE=2,JQE="[object Boolean]",$QE="[object Date]",YQE="[object Error]",XQE="[object Map]",ZQE="[object Number]",kQE="[object RegExp]",eUE="[object Set]",tUE="[object String]",rUE="[object Symbol]",iUE="[object ArrayBuffer]",nUE="[object DataView]",Dvp=tG?tG.prototype:void 0,j2s=Dvp?Dvp.valueOf:void 0;function aUE(e,t,r,i,n,a,o){switch(r){case nUE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case iUE:return!(e.byteLength!=t.byteLength||!a(new BKn(e),new BKn(t)));case JQE:case $QE:case ZQE:return Ebe(+e,+t);case YQE:return e.name==t.name&&e.message==t.message;case kQE:case tUE:return e==t+"";case XQE:var c=Svp;case eUE:var d=i&xQE;if(c||(c=Mvp),e.size!=t.size&&!d)return!1;var s=o.get(e);if(s)return s==t;i|=KQE,o.set(e,t);var u=TCo(c(e),c(t),i,n,a,o);return o.delete(e),u;case rUE:if(j2s)return j2s.call(e)==j2s.call(t)}return!1}var Bvp=aUE;var oUE=1,uUE=Object.prototype,sUE=uUE.hasOwnProperty;function cUE(e,t,r,i,n,a){var o=r&oUE,c=P2s(e),d=c.length,s=P2s(t),u=s.length;if(d!=u&&!o)return!1;for(var l=d;l--;){var p=c[l];if(!(o?p in t:sUE.call(t,p)))return!1}var _=a.get(e),h=a.get(t);if(_&&h)return _==t&&h==e;var y=!0;a.set(e,t),a.set(t,e);for(var b=o;++l<d;){p=c[l];var v=e[p],O=t[p];if(i)var A=o?i(O,v,p,t,e,a):i(v,O,p,e,t,a);if(!(A===void 0?v===O||n(v,O,r,i,a):A)){y=!1;break}b||(b=p=="constructor")}if(y&&!b){var g=e.constructor,m=t.constructor;g!=m&&"constructor"in e&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof m=="function"&&m instanceof m)&&(y=!1)}return a.delete(e),a.delete(t),y}var Ivp=cUE;var lUE=1,Cvp="[object Arguments]",qvp="[object Array]",RCo="[object Object]",fUE=Object.prototype,Tvp=fUE.hasOwnProperty;function dUE(e,t,r,i,n,a){var o=u0(e),c=u0(t),d=o?qvp:gln(e),s=c?qvp:gln(t);d=d==Cvp?RCo:d,s=s==Cvp?RCo:s;var u=d==RCo,l=s==RCo,p=d==s;if(p&&rzi(e)){if(!rzi(t))return!1;o=!0,u=!1}if(p&&!u)return a||(a=new q9i),o||E9i(e)?TCo(e,t,r,i,n,a):Bvp(e,t,d,r,i,n,a);if(!(r&lUE)){var _=u&&Tvp.call(e,"__wrapped__"),h=l&&Tvp.call(t,"__wrapped__");if(_||h){var y=_?e.value():e,b=h?t.value():t;return a||(a=new q9i),n(y,b,r,i,a)}}return p?(a||(a=new q9i),Ivp(e,t,r,i,n,a)):!1}var Rvp=dUE;function zvp(e,t,r,i,n){return e===t?!0:e==null||t==null||!ZU(e)&&!ZU(t)?e!==e&&t!==t:Rvp(e,t,r,i,zvp,n)}var T9i=zvp;var pUE=1,_UE=2;function hUE(e,t,r,i){var n=r.length,a=n,o=!i;if(e==null)return!a;for(e=Object(e);n--;){var c=r[n];if(o&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++n<a;){c=r[n];var d=c[0],s=e[d],u=c[1];if(o&&c[2]){if(s===void 0&&!(d in e))return!1}else{var l=new q9i;if(i)var p=i(s,u,d,e,t,l);if(!(p===void 0?T9i(u,s,pUE|_UE,i,l):p))return!1}}return!0}var Nvp=hUE;function yUE(e){return e===e&&!OB(e)}var zCo=yUE;function bUE(e){for(var t=vKn(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,zCo(n)]}return t}var Fvp=bUE;function vUE(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var NCo=vUE;function gUE(e){var t=Fvp(e);return t.length==1&&t[0][2]?NCo(t[0][0],t[0][1]):function(r){return r===e||Nvp(r,e,t)}}var Qvp=gUE;function OUE(e,t){return e!=null&&t in Object(e)}var Uvp=OUE;function AUE(e,t,r){t=I9i(t,e);for(var i=-1,n=t.length,a=!1;++i<n;){var o=fHt(t[i]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++i!=n?a:(n=e==null?0:e.length,!!n&&yKn(n)&&j9i(o,n)&&(u0(e)||jLt(e)))}var Lvp=AUE;function mUE(e,t){return e!=null&&Lvp(e,t,Uvp)}var Vvp=mUE;var PUE=1,jUE=2;function wUE(e,t){return OKn(e)&&zCo(t)?NCo(fHt(e),t):function(r){var i=hbp(r,e);return i===void 0&&i===t?Vvp(r,e):T9i(t,i,PUE|jUE)}}var Wvp=wUE;function EUE(e){return function(t){return t?.[e]}}var FCo=EUE;function SUE(e){return function(t){return jKn(t,e)}}var Gvp=SUE;function MUE(e){return OKn(e)?FCo(fHt(e)):Gvp(e)}var Hvp=MUE;function DUE(e){return typeof e=="function"?e:e==null?pKn:typeof e=="object"?u0(e)?Wvp(e[0],e[1]):Qvp(e):Hvp(e)}var wje=DUE;function BUE(e,t,r,i){for(var n=-1,a=e==null?0:e.length;++n<a;){var o=e[n];t(i,o,r(o),e)}return i}var xvp=BUE;function IUE(e){return function(t,r,i){for(var n=-1,a=Object(t),o=i(t),c=o.length;c--;){var d=o[e?c:++n];if(r(a[d],d,a)===!1)break}return t}}var Kvp=IUE;var CUE=Kvp(),QCo=CUE;function qUE(e,t){return e&&QCo(e,t,vKn)}var IKn=qUE;function TUE(e,t){return function(r,i){if(r==null)return r;if(!iJ(r))return e(r,i);for(var n=r.length,a=t?n:-1,o=Object(r);(t?a--:++a<n)&&i(o[a],a,o)!==!1;);return r}}var Jvp=TUE;var RUE=Jvp(IKn),$vp=RUE;function zUE(e,t,r,i){return $vp(e,function(n,a,o){t(i,n,r(n),o)}),i}var Yvp=zUE;function NUE(e,t){return function(r,i){var n=u0(r)?xvp:Yvp,a=t?t():{};return n(r,e,wje(i,2),a)}}var UCo=NUE;function FUE(e,t,r){(r!==void 0&&!Ebe(e[t],r)||r===void 0&&!(t in e))&&rJ(e,t,r)}var VFa=FUE;function QUE(e){return ZU(e)&&iJ(e)}var WFa=QUE;function UUE(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var GFa=UUE;function LUE(e){return Ryp(e,gKn(e))}var Xvp=LUE;function VUE(e,t,r,i,n,a,o){var c=GFa(e,r),d=GFa(t,r),s=o.get(d);if(s){VFa(e,r,s);return}var u=a?a(c,d,r+"",e,t,o):void 0,l=u===void 0;if(l){var p=u0(d),_=!p&&rzi(d),h=!p&&!_&&E9i(d);u=d,p||_||h?u0(c)?u=c:WFa(c)?u=wyp(c):_?(l=!1,u=fvp(d,!0)):h?(l=!1,u=mvp(d,!0)):u=[]:QFa(d)||jLt(d)?(u=c,jLt(c)?u=Xvp(c):(!OB(c)||_Kn(c))&&(u=Pvp(d))):l=!1}l&&(o.set(d,u),n(u,d,i,a,o),o.delete(d)),VFa(e,r,u)}var Zvp=VUE;function kvp(e,t,r,i,n){e!==t&&QCo(t,function(a,o){if(n||(n=new q9i),OB(a))Zvp(e,t,o,r,kvp,i,n);else{var c=i?i(GFa(e,o),a,o+"",e,t,n):void 0;c===void 0&&(c=a),VFa(e,o,c)}},gKn)}var LCo=kvp;var WUE=OCo(function(e,t,r,i){LCo(e,t,r,i)}),CKn=WUE;function GUE(e,t,r){for(var i=-1,n=e==null?0:e.length;++i<n;)if(r(t,e[i]))return!0;return!1}var egp=GUE;var HUE=200;function xUE(e,t,r,i){var n=-1,a=Typ,o=!0,c=e.length,d=[],s=t.length;if(!c)return d;r&&(t=dKn(t,ACo(r))),i?(a=egp,o=!1):t.length>=HUE&&(a=qCo,o=!1,t=new CCo(t));e:for(;++n<c;){var u=e[n],l=r==null?u:r(u);if(u=i||u!==0?u:0,o&&l===l){for(var p=s;p--;)if(t[p]===l)continue e;d.push(u)}else a(t,l,i)||d.push(u)}return d}var tgp=xUE;var KUE=vCo(function(e,t){return WFa(e)?tgp(e,gbp(t,1,WFa,!0)):[]}),VCo=KUE;function JUE(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var w2s=JUE;var $UE=Object.prototype,YUE=$UE.hasOwnProperty,XUE=UCo(function(e,t,r){YUE.call(e,r)?e[r].push(t):rJ(e,r,[t])}),E2s=XUE;function ZUE(e,t){return e>t}var rgp=ZUE;var kUE="[object String]";function e4E(e){return typeof e=="string"||!u0(e)&&ZU(e)&&rG(e)==kUE}var igp=e4E;var t4E="[object Map]",r4E="[object Set]",i4E=Object.prototype,n4E=i4E.hasOwnProperty;function a4E(e){if(e==null)return!0;if(iJ(e)&&(u0(e)||typeof e=="string"||typeof e.splice=="function"||rzi(e)||E9i(e)||jLt(e)))return!e.length;var t=gln(e);if(t==t4E||t==r4E)return!e.size;if(w9i(e))return!bKn(e).length;for(var r in e)if(n4E.call(e,r))return!1;return!0}var S2s=a4E;function o4E(e,t){return T9i(e,t)}var NT=o4E;function u4E(e,t,r){r=typeof r=="function"?r:void 0;var i=r?r(e,t):void 0;return i===void 0?T9i(e,t,void 0,r):!!i}var dHt=u4E;function s4E(e){return e===null}var M2s=s4E;var c4E=C9i(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),KE=c4E;var l4E=UCo(function(e,t,r){rJ(e,r,t)}),D2s=l4E;function f4E(e,t){var r={};return t=wje(t,3),IKn(e,function(i,n,a){rJ(r,t(i,n,a),i)}),r}var HFa=f4E;function d4E(e,t){var r={};return t=wje(t,3),IKn(e,function(i,n,a){rJ(r,n,t(i,n,a))}),r}var gn=d4E;function p4E(e,t,r){for(var i=-1,n=e.length;++i<n;){var a=e[i],o=t(a);if(o!=null&&(c===void 0?o===o&&!cHt(o):r(o,c)))var c=o,d=a}return d}var ngp=p4E;function _4E(e,t){return e&&e.length?ngp(e,wje(t,2),rgp):void 0}var B2s=_4E;var h4E=OCo(function(e,t,r){LCo(e,t,r)}),I2s=h4E;var y4E="Expected a function";function b4E(e){if(typeof e!="function")throw new TypeError(y4E);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var agp=b4E;function v4E(e,t,r,i){if(!OB(e))return e;t=I9i(t,e);for(var n=-1,a=t.length,o=a-1,c=e;c!=null&&++n<a;){var d=fHt(t[n]),s=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(n!=o){var u=c[d];s=i?i(u,d,c):void 0,s===void 0&&(s=OB(u)?u:j9i(t[n+1])?[]:{})}bCo(c,d,s),c=c[d]}return e}var ogp=v4E;function g4E(e,t,r){for(var i=-1,n=t.length,a={};++i<n;){var o=t[i],c=jKn(e,o);r(c,o)&&ogp(a,I9i(o,e),c)}return a}var ugp=g4E;function O4E(e,t){if(e==null)return{};var r=dKn(hvp(e),function(i){return[i]});return t=wje(t),ugp(e,r,function(i,n){return t(i,n[0])})}var Oln=O4E;function A4E(e,t){return Oln(e,agp(wje(t)))}var C2s=A4E;var m4E=FCo("length"),sgp=m4E;var lgp="\\ud800-\\udfff",P4E="\\u0300-\\u036f",j4E="\\ufe20-\\ufe2f",w4E="\\u20d0-\\u20ff",E4E=P4E+j4E+w4E,S4E="\\ufe0e\\ufe0f",M4E="["+lgp+"]",q2s="["+E4E+"]",T2s="\\ud83c[\\udffb-\\udfff]",D4E="(?:"+q2s+"|"+T2s+")",fgp="[^"+lgp+"]",dgp="(?:\\ud83c[\\udde6-\\uddff]){2}",pgp="[\\ud800-\\udbff][\\udc00-\\udfff]",B4E="\\u200d",_gp=D4E+"?",hgp="["+S4E+"]?",I4E="(?:"+B4E+"(?:"+[fgp,dgp,pgp].join("|")+")"+hgp+_gp+")*",C4E=hgp+_gp+I4E,q4E="(?:"+[fgp+q2s+"?",q2s,dgp,pgp,M4E].join("|")+")",cgp=RegExp(T2s+"(?="+T2s+")|"+q4E+C4E,"g");function T4E(e){for(var t=cgp.lastIndex=0;cgp.test(e);)++t;return t}var ygp=T4E;function R4E(e){return SKn(e)?ygp(e):sgp(e)}var bgp=R4E;var z4E="[object Map]",N4E="[object Set]";function F4E(e){if(e==null)return 0;if(iJ(e))return igp(e)?bgp(e):e.length;var t=gln(e);return t==z4E||t==N4E?e.size:bKn(e).length}var Dm=F4E;var Q4E=C9i(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Aln=Q4E;var U4E=C9i(function(e,t,r){return e+(r?" ":"")+F0(t)}),mln=U4E;function z2s({data:e,overrides:t,allowNullKeys:r}){let i=CKn(e,CKn,t,(a,o)=>Array.isArray(a)&&Array.isArray(o)?o.every(c=>typeof c=="object")&&a.every(c=>typeof c=="object")?void 0:[...o]:void 0);return R2s(i,M2s,{ancestorKeys:r??[],allowOmissionCursor:!1})}var R2s=(e,t,r)=>{function i(n){if(Array.isArray(n))return n.map(a=>R2s(a,t,r));if(QFa(n)){let a={};for(let[o,c]of Object.entries(n))a[o]=R2s(c,t,r!=null&&(r.allowOmissionCursor||r.ancestorKeys.includes(o))?{...r,allowOmissionCursor:!0}:r);return r==null||!r?.allowOmissionCursor?C2s(a,t):a}return n}return i(e)};function Bt(){}function N2s(e){return As(e)?e:void 0}function F2s(e){return L4E(e,t=>!As(t),void 0)}function Q2s(...e){let t=e.filter(r=>!As(r)).length;return t===0||t===e.length}function L4E(e,t,r){return Object.entries(e).some(([,a])=>t(a))?r:e}function wLt(e){return Object.keys(e)}function Vy(e,t){for(let r of wLt(t))t[r](e[r])}async function pHt(e,t){for(let r of wLt(t))await t[r](e[r])}function AI(e){return Object.entries(e)}function gl(e){if(!V4E(e)||toString.call(e)!=="[object Object]")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 V4E(e){return typeof e=="object"&&e!=null}function vgp(e,t){e=Object(e);let r={};return Object.keys(e).forEach(i=>{r[i]=t(e[i],i,e)}),r}function U2s(e){let[t,r]=e.split(" ");if(!t||!["POST","GET","PUT","PATCH","DELETE"].includes(t))return{type:"failure",message:`${e} contains invalid method ${t}`};if(!r)return{type:"failure",message:`${e} contains no path ${r}`};let i=new Set,n=/{([^}]+)}/g,a;for(;(a=n.exec(r))!=null;){let o=a[1];o!=null&&i.add(o)}return{type:"success",method:t,path:r,pathParameters:i}}function WCo({value:e,suffix:t}){return e.endsWith(t)?e.substring(0,e.length-t.length):e}var W4E=/\$\{(\w+)\}/g,G4E=/\\\$\\\{(\w+)\\}/g,ggp="\0ESCAPED_ENV_VAR\0";function FT(e,t,r={}){if(typeof e=="string"){let n=e.replace(G4E,(a,o)=>`${ggp}${o}\0`);return n=n.replace(W4E,(a,o)=>{if(r.substituteAsEmpty)return"";let c=process.env[o];return c==null&&t.onError(`Environment variable ${o} is not defined.`),c??""}),n=n.replace(new RegExp(`${ggp.replace(/\0/g,"\\0")}(\\w+)\\0`,"g"),(a,o)=>`\${${o}}`),n}return Array.isArray(e)?e.map(n=>FT(n,t,r)):gl(e)?vgp(e,n=>FT(n,t,r)):e}var xFa=Symbol.for("fern:skip");function Eje(e,t=[],r=[]){if(e==null)return r.push([...t]),xFa;if(Array.isArray(e)){let i=[];for(let n=0;n<e.length;n++){let a=Eje(e[n],[...t,String(n)],r);a!==xFa&&i.push(a)}return i}if(typeof e=="object"&&e!==null&&e.constructor===Object){let i={};try{for(let[n,a]of Object.entries(e)){let o=Eje(a,[...t,n],r);o!==xFa&&(i[n]=o)}}catch{return r.push([...t]),xFa}return i}return e}var uks=ce(Sbe(),1);function oks(e){let t=uks.default.parse(e);if(t===null)throw new Error(`Invalid semver: ${e}`);return t}function sks(e,t){let r=typeof e=="string"?oks(e):e,i=typeof t=="string"?oks(t):t;if(r>i)throw new Error("From semver must be less than or equal to to semver");return uks.default.diff(r,i)}function Z3(e){return e?.replace(/^\/+/,"")}var pAp=ce(eQa(),1);function iqo(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,pAp.default)(e,{special:$3E}).replace(/V\s(\d)/g,"V$1")}var $3E=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","ACH","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];var VPp=ce(QPp(),1);function Kec(e){return typeof e=="object"&&e!==null&&("oneOf"in e||"anyOf"in e)}function UPp(e){return typeof e=="object"&&e!==null&&"$ref"in e}function AGE(e){return typeof e=="object"&&e!==null}function mGE(e){return typeof e=="object"&&e!==null&&"additionalProperty"in e}function PGE(e){return typeof e=="object"&&e!==null&&"missingProperty"in e}function Mbe(e,t){if(!e&&!t)return"$";let r=e.split("/").filter(i=>i!=="");return t&&r.push(t),r.length===0?"$":"$"+r.map(i=>{let n=i.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(n)?`[${n}]`:/[.[\]']/.test(n)?`['${n.replace(/'/g,"\\'")}']`:`.${n}`}).join("")}function jGE(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Qqo(e,t){try{let r=t.split("/").filter(n=>n!==""),i=e;for(let n of r){let a=n.replace(/~1/g,"/").replace(/~0/g,"~");if(Array.isArray(i)){let o=parseInt(a,10);if(!isNaN(o))i=i[o];else return}else if(typeof i=="object"&&i!=null)i=i[a];else return}return i}catch{return}}function Jec(e){if(typeof e!="object"||e===null)return"";let r=Object.keys(e);return r.length===0?" (empty object)":` (has properties: ${r.join(", ")})`}function Yec(e,t){if(typeof e!="object"||e===null||typeof t!="object"||t===null)return{missing:0,extra:0,total:0};let r=e,i=new Set(Object.keys(r)),n=new Set,a=new Set;t.properties&&typeof t.properties=="object"&&Object.keys(t.properties).forEach(d=>n.add(d)),Array.isArray(t.required)&&t.required.forEach(d=>a.add(d));let o=0;for(let d of a)i.has(d)||o++;let c=0;for(let d of i)n.has(d)||c++;return{missing:o,extra:c,total:o+c}}function $ec(e,t){if(typeof e!="object"||e===null||!Array.isArray(t)||t.length===0)return null;let r=null;for(let i of t)if(i.type==="object"&&i.properties){let n=Yec(e,i);(r===null||wGE(n,r.differences))&&(r={schema:i,differences:n})}return r}function wGE(e,t){return e.missing===0&&t.missing>0?!0:e.missing>0&&t.missing===0?!1:e.missing!==t.missing?e.missing<t.missing:e.total<t.total}function EGE(e,t){let r=e.instancePath.split("/").length,i=t.instancePath.split("/").length,n=e.keyword==="oneOf"||e.keyword==="anyOf",a=t.keyword==="oneOf"||t.keyword==="anyOf",o=LPp(e),c=LPp(t);return!n&&a?!0:n&&!a?!1:o>=9&&c<9?!0:c>=9&&o<9?!1:r>i?!0:r<i?!1:o>c}function LPp(e){switch(e.keyword){case"additionalProperties":return 10;case"required":return 9;case"type":return 8;case"enum":return 7;case"format":return 6;case"pattern":return 6;case"const":return 4;case"minimum":case"maximum":case"minLength":case"maxLength":return 5;case"oneOf":case"anyOf":return 3;default:return 1}}function Dbe(e,t){if(!t)return e;let r=e.match(/at path (\$[^\s]+)/),i=r?r[1]:"";if(i){let n=i.replace(/^\$/,"").replace(/\[(\d+)\]/g,"/$1").replace(/\.([^[\]]+)/g,"/$1");return`${e} at ${n} (in ${t})`}return`${e} (in ${t})`}function DQa(e,t){if(typeof e!="object"||e===null||!t.schema.properties)return"";let r=e,i=new Set(Object.keys(r)),n=new Set,a=new Set;t.schema.properties&&Object.keys(t.schema.properties).forEach(s=>n.add(s)),Array.isArray(t.schema.required)&&t.schema.required.forEach(s=>a.add(s));let o=[],c=[];for(let s of a)i.has(s)||o.push(s);for(let s of i)n.has(s)||c.push(s);let d=[];return o.length>0&&d.push(`add ${o.map(s=>`'${s}'`).join(", ")}`),c.length>0&&d.push(`remove ${c.map(s=>`'${s}'`).join(", ")}`),d.length>0?`
797
797
  Did you mean to ${d.join(" and ")}?`:""}function BLt(e,t,r){let n=new VPp.default({allErrors:!0,allowUnionTypes:!0}).compile(t);if(n(e))return{success:!0,data:e};if(n.errors?.[0]!=null)try{let o=n.errors[0],c=new Map;for(let l of n.errors??[]){let p=l.instancePath;c.has(p)||c.set(p,[]),c.get(p)?.push(l)}for(let l of n.errors??[])EGE(l,o)&&(o=l);if(o.keyword==="additionalProperties"){if(!mGE(o.params))throw new Error("additionalProperties error missing expected params");let l=o.params.additionalProperty,p=Mbe(o.instancePath,l),_=Qqo(e,o.instancePath),h=Jec(_);if((c.get(o.instancePath)||[]).some(A=>A.keyword==="oneOf"||A.keyword==="anyOf")&&typeof _=="object"&&_!==null){let A="",g=(n.errors??[]).filter(S=>S.keyword==="oneOf"||S.keyword==="anyOf"),m=g.find(S=>S.instancePath===o.instancePath);if(g.length>0){let S=m||g[0],w=null;if(S?.schema&&Kec(S.schema)&&(w=S.schema.oneOf||S.schema.anyOf||null),!w&&S?.schemaPath){let D=S.schemaPath.replace("#/","").split("/"),B=t;for(let R of D)if(B&&typeof B=="object"&&R in B){let N=B[R];if(typeof N=="object"&&N!==null)B=N;else{B=null;break}}else{B=null;break}Array.isArray(B)&&(w=B.map(R=>{if(UPp(R)&&R.$ref){let N=R.$ref.replace("#/","").split("/"),z=t;for(let F of N)if(z&&typeof z=="object"&&F in z){let U=z[F];if(typeof U=="object"&&U!==null)z=U;else{z=null;break}}else{z=null;break}return z}return typeof R=="object"&&R!==null?R:null}).filter(R=>R!==null))}if(!w&&o.instancePath.includes("/navigation/")&&AGE(t)&&t.definitions){let D=t.definitions["docs.NavigationItem"];Kec(D)&&D.anyOf&&(w=D.anyOf.map(R=>{if(UPp(R)&&R.$ref){let N=R.$ref.replace("#/","").split("/"),z=t;for(let F of N)if(z&&typeof z=="object"&&F in z){let U=z[F];if(typeof U=="object"&&U!==null)z=U;else{z=null;break}}else{z=null;break}return z}return typeof R=="object"&&R!==null?R:null}).filter(R=>R!==null))}if(Array.isArray(w)){let D=$ec(_,w);D&&D.differences.total<=2&&(A=DQa(_,D))}}else if(t.oneOf||t.anyOf){let S=t.oneOf||t.anyOf;if(Array.isArray(S)){let w=$ec(_,S);w&&w.differences.total<=2&&(A=DQa(_,w))}}let j=`Invalid object at path ${Mbe(o.instancePath)}: does not match any allowed schema${h}${A}`;return{success:!1,error:{...o,message:Dbe(j,r?.filePath)},allErrors:n.errors??[]}}let v="";if(typeof _=="object"&&_!==null&&t.type==="object"&&t.properties){let A=Yec(_,t);A.total<=2&&(v=DQa(_,{schema:t,differences:A}))}let O=`Unexpected property '${l}' at path ${p}${h}${v}`;return{success:!1,error:{...o,message:Dbe(O,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="required"){if(!PGE(o.params))throw new Error("required error missing expected params");let l=o.params.missingProperty,p=Mbe(o.instancePath,l),_=Qqo(e,o.instancePath),h=Jec(_),y="";if(typeof _=="object"&&_!==null&&t.type==="object"&&t.properties){let v=Yec(_,t);v.total<=2&&(y=DQa(_,{schema:t,differences:v}))}let b=`Missing required property '${l}' at path ${p}${h}${y}`;return{success:!1,error:{...o,message:Dbe(b,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="type"){let l=Array.isArray(o.params.type)?o.params.type.join(" or "):o.params.type,p=Mbe(o.instancePath),_=Qqo(e,o.instancePath),h=jGE(_),y=`Incorrect type at path ${p}: expected ${l} but received ${h}`;return{success:!1,error:{...o,message:Dbe(y,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="enum"){let p=`Invalid value at path ${Mbe(o.instancePath)}: must be one of [${o.params.allowedValues.join(", ")}]`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="format"){let p=`Invalid format at path ${Mbe(o.instancePath)}: must be a valid ${o.params.format}`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="pattern"){let p=`Invalid format at path ${Mbe(o.instancePath)}: must match pattern ${o.params.pattern}`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="oneOf"||o.keyword==="anyOf"){let l=Mbe(o.instancePath),p=Qqo(e,o.instancePath),_=Jec(p),h="";if(typeof p=="object"&&p!==null){let b=null;if(o.schema&&Kec(o.schema)&&(b=o.schema.oneOf||o.schema.anyOf||null),!b&&(t.oneOf||t.anyOf)&&(b=t.oneOf||t.anyOf||null),!b&&o.instancePath){let v=o.instancePath.split("/").filter(A=>A),O=t;for(let A of v){let g=A.replace(/~1/g,"/").replace(/~0/g,"~");if(O.properties&&O.properties[g]?O=O.properties[g]:(O.items&&/^\d+$/.test(g)||O.items&&typeof O.items=="object")&&(O=O.items),O.anyOf||O.oneOf){b=O.anyOf||O.oneOf;break}}}if(Array.isArray(b)){let v=$ec(p,b);v&&v.differences.total<=2&&(h=DQa(p,v))}}let y=`Invalid object at path ${l}: does not match any allowed schema${_}${h}`;return{success:!1,error:{...o,message:Dbe(y,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="maximum"){let p=`Value at path ${Mbe(o.instancePath)} must be less than or equal to ${o.params.limit}`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="minimum"){let p=`Value at path ${Mbe(o.instancePath)} must be greater than or equal to ${o.params.limit}`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="maxLength"){let p=`Value at path ${Mbe(o.instancePath)} must be no longer than ${o.params.limit} characters`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}else if(o.keyword==="minLength"){let p=`Value at path ${Mbe(o.instancePath)} must be at least ${o.params.limit} characters`;return{success:!1,error:{...o,message:Dbe(p,r?.filePath)},allErrors:n.errors??[]}}let d=Mbe(o.instancePath),u=`Validation failed${d!=="$"?` at path ${d}`:""}`;return{success:!1,error:{...o,message:Dbe(u,r?.filePath)},allErrors:n.errors??[]}}catch{return{success:!1,error:{message:"Failed to parse because JSON schema validation failed",...n.errors[0]},allErrors:n.errors??[]}}else return{success:!1,error:void 0,allErrors:[]}}function Tln(e,t="type"){return{_visit:r=>{let i=r[e[t]];return i!=null?i(e):(r._other==null&&gt(e),r._other(e))}}}var QT="fern",qq="definition",BQa="openapi",WPp="changelog",Xec="asyncapi",AB="api.yml",Rln="__package__",Qb=`${Rln}.yml`,Uqo="dependencies.yml",YM="generators.yml",Lqo="generators.yaml",GPp="dependencies.yml",c0="docs.yml",t4="fern.config.json",Zec="api",gHt=".fernignore";var HPp="snippet-templates.json";var $Kn="default-group",xPp="spec-origin",KPp="async-api",JPp="openapi",$Pp="openapi-overrides",YPp="api-settings";var czi="apis",IQa="local";var zt={};Zt(zt,{BRAND:()=>kGE,DIRTY:()=>zln,EMPTY_PATH:()=>IGE,INVALID:()=>cf,NEVER:()=>NHE,OK:()=>r8,ParseStatus:()=>r4,Schema:()=>kh,ZodAny:()=>G9i,ZodArray:()=>pzi,ZodBigInt:()=>Fln,ZodBoolean:()=>Qln,ZodBranded:()=>qQa,ZodCatch:()=>Yln,ZodDate:()=>Uln,ZodDefault:()=>$ln,ZodDiscriminatedUnion:()=>Gqo,ZodEffects:()=>Rje,ZodEnum:()=>Kln,ZodError:()=>sJ,ZodFirstPartyTypeKind:()=>Pf,ZodFunction:()=>xqo,ZodIntersection:()=>Gln,ZodIssueCode:()=>Pi,ZodLazy:()=>Hln,ZodLiteral:()=>xln,ZodMap:()=>tJn,ZodNaN:()=>iJn,ZodNativeEnum:()=>Jln,ZodNever:()=>ILt,ZodNull:()=>Vln,ZodNullable:()=>mHt,ZodNumber:()=>Nln,ZodObject:()=>cJ,ZodOptional:()=>qje,ZodParsedType:()=>No,ZodPipeline:()=>TQa,ZodPromise:()=>H9i,ZodReadonly:()=>Xln,ZodRecord:()=>Hqo,ZodSchema:()=>kh,ZodSet:()=>rJn,ZodString:()=>W9i,ZodSymbol:()=>kKn,ZodTransformer:()=>Rje,ZodTuple:()=>AHt,ZodType:()=>kh,ZodUndefined:()=>Lln,ZodUnion:()=>Wln,ZodUnknown:()=>dzi,ZodVoid:()=>eJn,addIssueToContext:()=>qa,any:()=>sHE,array:()=>dHE,bigint:()=>iHE,boolean:()=>ujp,coerce:()=>zHE,custom:()=>njp,date:()=>nHE,datetimeRegex:()=>rjp,defaultErrorMap:()=>lzi,discriminatedUnion:()=>yHE,effect:()=>MHE,enum:()=>wHE,function:()=>mHE,getErrorMap:()=>YKn,getParsedType:()=>OHt,instanceof:()=>tHE,intersection:()=>bHE,isAborted:()=>Vqo,isAsync:()=>XKn,isDirty:()=>Wqo,isValid:()=>V9i,late:()=>eHE,lazy:()=>PHE,literal:()=>jHE,makeIssue:()=>CQa,map:()=>OHE,nan:()=>rHE,nativeEnum:()=>EHE,never:()=>lHE,null:()=>uHE,nullable:()=>BHE,number:()=>ojp,object:()=>pHE,objectUtil:()=>kec,oboolean:()=>RHE,onumber:()=>THE,optional:()=>DHE,ostring:()=>qHE,pipeline:()=>CHE,preprocess:()=>IHE,promise:()=>SHE,quotelessJson:()=>MGE,record:()=>gHE,set:()=>AHE,setErrorMap:()=>BGE,strictObject:()=>_HE,string:()=>ajp,symbol:()=>aHE,transformer:()=>MHE,tuple:()=>vHE,undefined:()=>oHE,union:()=>hHE,unknown:()=>cHE,util:()=>Nv,void:()=>fHE});var Nv;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},e.getValidEnumValues=n=>{let a=e.objectKeys(n).filter(c=>typeof n[n[c]]!="number"),o={};for(let c of a)o[c]=n[c];return e.objectValues(o)},e.objectValues=n=>e.objectKeys(n).map(function(a){return n[a]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},e.find=(n,a)=>{for(let o of n)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=i,e.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(Nv||(Nv={}));var kec;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(kec||(kec={}));var No=Nv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),OHt=e=>{switch(typeof e){case"undefined":return No.undefined;case"string":return No.string;case"number":return Number.isNaN(e)?No.nan:No.number;case"boolean":return No.boolean;case"function":return No.function;case"bigint":return No.bigint;case"symbol":return No.symbol;case"object":return Array.isArray(e)?No.array:e===null?No.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?No.promise:typeof Map<"u"&&e instanceof Map?No.map:typeof Set<"u"&&e instanceof Set?No.set:typeof Date<"u"&&e instanceof Date?No.date:No.object;default:return No.unknown}};var Pi=Nv.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),MGE=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),sJ=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},i={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)i._errors.push(r(o));else{let c=i,d=0;for(;d<o.path.length;){let s=o.path[d];d===o.path.length-1?(c[s]=c[s]||{_errors:[]},c[s]._errors.push(r(o))):c[s]=c[s]||{_errors:[]},c=c[s],d++}}};return n(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},i=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];r[a]=r[a]||[],r[a].push(t(n))}else i.push(t(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};sJ.create=e=>new sJ(e);var DGE=(e,t)=>{let r;switch(e.code){case Pi.invalid_type:e.received===No.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Pi.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Nv.jsonStringifyReplacer)}`;break;case Pi.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nv.joinValues(e.keys,", ")}`;break;case Pi.invalid_union:r="Invalid input";break;case Pi.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nv.joinValues(e.options)}`;break;case Pi.invalid_enum_value:r=`Invalid enum value. Expected ${Nv.joinValues(e.options)}, received '${e.received}'`;break;case Pi.invalid_arguments:r="Invalid function arguments";break;case Pi.invalid_return_type:r="Invalid function return type";break;case Pi.invalid_date:r="Invalid date";break;case Pi.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Nv.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Pi.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Pi.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Pi.custom:r="Invalid input";break;case Pi.invalid_intersection_types:r="Intersection results could not be merged";break;case Pi.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Pi.not_finite:r="Number must be finite";break;default:r=t.defaultError,Nv.assertNever(e)}return{message:r}},lzi=DGE;var XPp=lzi;function BGE(e){XPp=e}function YKn(){return XPp}var CQa=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,a=[...r,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let c="",d=i.filter(s=>!!s).slice().reverse();for(let s of d)c=s(o,{data:t,defaultError:c}).message;return{...n,path:a,message:c}},IGE=[];function qa(e,t){let r=YKn(),i=CQa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===lzi?void 0:lzi].filter(n=>!!n)});e.common.issues.push(i)}var r4=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let i=[];for(let n of r){if(n.status==="aborted")return cf;n.status==="dirty"&&t.dirty(),i.push(n.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,r){let i=[];for(let n of r){let a=await n.key,o=await n.value;i.push({key:a,value:o})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,r){let i={};for(let n of r){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return cf;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(i[a.value]=o.value)}return{status:t.value,value:i}}},cf=Object.freeze({status:"aborted"}),zln=e=>({status:"dirty",value:e}),r8=e=>({status:"valid",value:e}),Vqo=e=>e.status==="aborted",Wqo=e=>e.status==="dirty",V9i=e=>e.status==="valid",XKn=e=>typeof Promise<"u"&&e instanceof Promise;var Ws;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ws||(Ws={}));var Tje=class{constructor(t,r,i,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ZPp=(e,t)=>{if(V9i(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new sJ(e.common.issues);return this._error=r,this._error}}};function z_(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(o,c)=>{let{message:d}=e;return o.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:d??i??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:d??r??c.defaultError}},description:n}}var kh=class{get description(){return this._def.description}_getType(t){return OHt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:OHt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new r4,ctx:{common:t.parent.common,data:t.data,parsedType:OHt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(XKn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let i=this.safeParse(t,r);if(i.success)return i.data;throw i.error}safeParse(t,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:OHt(t)},n=this._parseSync({data:t,path:i.path,parent:i});return ZPp(i,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:OHt(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return V9i(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>V9i(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let i=await this.safeParseAsync(t,r);if(i.success)return i.data;throw i.error}async safeParseAsync(t,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:OHt(t)},n=this._parse({data:t,path:i.path,parent:i}),a=await(XKn(n)?n:Promise.resolve(n));return ZPp(i,a)}refine(t,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{let o=t(n),c=()=>a.addIssue({code:Pi.custom,...i(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,r){return this._refinement((i,n)=>t(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(t){return new Rje({schema:this,typeName:Pf.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return qje.create(this,this._def)}nullable(){return mHt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pzi.create(this)}promise(){return H9i.create(this,this._def)}or(t){return Wln.create([this,t],this._def)}and(t){return Gln.create(this,t,this._def)}transform(t){return new Rje({...z_(this._def),schema:this,typeName:Pf.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new $ln({...z_(this._def),innerType:this,defaultValue:r,typeName:Pf.ZodDefault})}brand(){return new qQa({typeName:Pf.ZodBranded,type:this,...z_(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Yln({...z_(this._def),innerType:this,catchValue:r,typeName:Pf.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return TQa.create(this,t)}readonly(){return Xln.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},CGE=/^c[^\s-]{8,}$/i,qGE=/^[0-9a-z]+$/,TGE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,RGE=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zGE=/^[a-z0-9_-]{21}$/i,NGE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FGE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,QGE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UGE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",etc,LGE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,VGE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,WGE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,GGE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HGE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xGE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ejp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",KGE=new RegExp(`^${ejp}$`);function tjp(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function JGE(e){return new RegExp(`^${tjp(e)}$`)}function rjp(e){let t=`${ejp}T${tjp(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function $GE(e,t){return!!((t==="v4"||!t)&&LGE.test(e)||(t==="v6"||!t)&&WGE.test(e))}function YGE(e,t){if(!NGE.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function XGE(e,t){return!!((t==="v4"||!t)&&VGE.test(e)||(t==="v6"||!t)&&GGE.test(e))}var W9i=class e extends kh{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==No.string){let a=this._getOrReturnCtx(t);return qa(a,{code:Pi.invalid_type,expected:No.string,received:a.parsedType}),cf}let i=new r4,n;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")t.data.length>a.value&&(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){let o=t.data.length>a.value,c=t.data.length<a.value;(o||c)&&(n=this._getOrReturnCtx(t,n),o?qa(n,{code:Pi.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&qa(n,{code:Pi.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")QGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"email",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")etc||(etc=new RegExp(UGE,"u")),etc.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"emoji",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")RGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"uuid",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")zGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"nanoid",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")CGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"cuid",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")qGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"cuid2",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")TGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"ulid",code:Pi.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),qa(n,{validation:"url",code:Pi.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"regex",code:Pi.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?rjp(a).test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?KGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?JGE(a).test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?FGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"duration",code:Pi.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?$GE(t.data,a.version)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"ip",code:Pi.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?YGE(t.data,a.alg)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"jwt",code:Pi.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?XGE(t.data,a.version)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"cidr",code:Pi.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?HGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"base64",code:Pi.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?xGE.test(t.data)||(n=this._getOrReturnCtx(t,n),qa(n,{validation:"base64url",code:Pi.invalid_string,message:a.message}),i.dirty()):Nv.assertNever(a);return{status:i.value,value:t.data}}_regex(t,r,i){return this.refinement(n=>t.test(n),{validation:r,code:Pi.invalid_string,...Ws.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ws.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ws.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ws.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ws.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ws.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ws.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ws.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ws.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ws.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ws.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ws.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ws.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ws.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Ws.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Ws.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Ws.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Ws.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Ws.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Ws.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Ws.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Ws.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Ws.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Ws.errToObj(r)})}nonempty(t){return this.min(1,Ws.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};W9i.create=e=>new W9i({checks:[],typeName:Pf.ZodString,coerce:e?.coerce??!1,...z_(e)});function ZGE(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,a=Number.parseInt(e.toFixed(n).replace(".","")),o=Number.parseInt(t.toFixed(n).replace(".",""));return a%o/10**n}var Nln=class e extends kh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==No.number){let a=this._getOrReturnCtx(t);return qa(a,{code:Pi.invalid_type,expected:No.number,received:a.parsedType}),cf}let i,n=new r4;for(let a of this._def.checks)a.kind==="int"?Nv.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ZGE(t.data,a.value)!==0&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.not_finite,message:a.message}),n.dirty()):Nv.assertNever(a);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Ws.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ws.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ws.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ws.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:Ws.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ws.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ws.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ws.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ws.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ws.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ws.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Ws.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ws.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ws.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Nv.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Nln.create=e=>new Nln({checks:[],typeName:Pf.ZodNumber,coerce:e?.coerce||!1,...z_(e)});var Fln=class e extends kh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==No.bigint)return this._getInvalidInput(t);let i,n=new r4;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),qa(i,{code:Pi.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Nv.assertNever(a);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return qa(r,{code:Pi.invalid_type,expected:No.bigint,received:r.parsedType}),cf}gte(t,r){return this.setLimit("min",t,!0,Ws.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ws.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ws.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ws.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:Ws.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ws.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ws.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ws.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ws.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ws.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Fln.create=e=>new Fln({checks:[],typeName:Pf.ZodBigInt,coerce:e?.coerce??!1,...z_(e)});var Qln=class extends kh{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==No.boolean){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.boolean,received:i.parsedType}),cf}return r8(t.data)}};Qln.create=e=>new Qln({typeName:Pf.ZodBoolean,coerce:e?.coerce||!1,...z_(e)});var Uln=class e extends kh{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==No.date){let a=this._getOrReturnCtx(t);return qa(a,{code:Pi.invalid_type,expected:No.date,received:a.parsedType}),cf}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return qa(a,{code:Pi.invalid_date}),cf}let i=new r4,n;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(n=this._getOrReturnCtx(t,n),qa(n,{code:Pi.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):Nv.assertNever(a);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Ws.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Ws.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Uln.create=e=>new Uln({checks:[],coerce:e?.coerce||!1,typeName:Pf.ZodDate,...z_(e)});var kKn=class extends kh{_parse(t){if(this._getType(t)!==No.symbol){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.symbol,received:i.parsedType}),cf}return r8(t.data)}};kKn.create=e=>new kKn({typeName:Pf.ZodSymbol,...z_(e)});var Lln=class extends kh{_parse(t){if(this._getType(t)!==No.undefined){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.undefined,received:i.parsedType}),cf}return r8(t.data)}};Lln.create=e=>new Lln({typeName:Pf.ZodUndefined,...z_(e)});var Vln=class extends kh{_parse(t){if(this._getType(t)!==No.null){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.null,received:i.parsedType}),cf}return r8(t.data)}};Vln.create=e=>new Vln({typeName:Pf.ZodNull,...z_(e)});var G9i=class extends kh{constructor(){super(...arguments),this._any=!0}_parse(t){return r8(t.data)}};G9i.create=e=>new G9i({typeName:Pf.ZodAny,...z_(e)});var dzi=class extends kh{constructor(){super(...arguments),this._unknown=!0}_parse(t){return r8(t.data)}};dzi.create=e=>new dzi({typeName:Pf.ZodUnknown,...z_(e)});var ILt=class extends kh{_parse(t){let r=this._getOrReturnCtx(t);return qa(r,{code:Pi.invalid_type,expected:No.never,received:r.parsedType}),cf}};ILt.create=e=>new ILt({typeName:Pf.ZodNever,...z_(e)});var eJn=class extends kh{_parse(t){if(this._getType(t)!==No.undefined){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.void,received:i.parsedType}),cf}return r8(t.data)}};eJn.create=e=>new eJn({typeName:Pf.ZodVoid,...z_(e)});var pzi=class e extends kh{_parse(t){let{ctx:r,status:i}=this._processInputParams(t),n=this._def;if(r.parsedType!==No.array)return qa(r,{code:Pi.invalid_type,expected:No.array,received:r.parsedType}),cf;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,c=r.data.length<n.exactLength.value;(o||c)&&(qa(r,{code:o?Pi.too_big:Pi.too_small,minimum:c?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(qa(r,{code:Pi.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(qa(r,{code:Pi.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((o,c)=>n.type._parseAsync(new Tje(r,o,r.path,c)))).then(o=>r4.mergeArray(i,o));let a=[...r.data].map((o,c)=>n.type._parseSync(new Tje(r,o,r.path,c)));return r4.mergeArray(i,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Ws.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Ws.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Ws.toString(r)}})}nonempty(t){return this.min(1,t)}};pzi.create=(e,t)=>new pzi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pf.ZodArray,...z_(t)});function ZKn(e){if(e instanceof cJ){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=qje.create(ZKn(i))}return new cJ({...e._def,shape:()=>t})}else return e instanceof pzi?new pzi({...e._def,type:ZKn(e.element)}):e instanceof qje?qje.create(ZKn(e.unwrap())):e instanceof mHt?mHt.create(ZKn(e.unwrap())):e instanceof AHt?AHt.create(e.items.map(t=>ZKn(t))):e}var cJ=class e extends kh{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Nv.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==No.object){let s=this._getOrReturnCtx(t);return qa(s,{code:Pi.invalid_type,expected:No.object,received:s.parsedType}),cf}let{status:i,ctx:n}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof ILt&&this._def.unknownKeys==="strip"))for(let s in n.data)o.includes(s)||c.push(s);let d=[];for(let s of o){let u=a[s],l=n.data[s];d.push({key:{status:"valid",value:s},value:u._parse(new Tje(n,l,n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof ILt){let s=this._def.unknownKeys;if(s==="passthrough")for(let u of c)d.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(s==="strict")c.length>0&&(qa(n,{code:Pi.unrecognized_keys,keys:c}),i.dirty());else if(s!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let s=this._def.catchall;for(let u of c){let l=n.data[u];d.push({key:{status:"valid",value:u},value:s._parse(new Tje(n,l,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let s=[];for(let u of d){let l=await u.key,p=await u.value;s.push({key:l,value:p,alwaysSet:u.alwaysSet})}return s}).then(s=>r4.mergeObjectSync(i,s)):r4.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(t){return Ws.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:Ws.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Pf.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let i of Nv.objectKeys(t))t[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let i of Nv.objectKeys(this.shape))t[i]||(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}deepPartial(){return ZKn(this)}partial(t){let r={};for(let i of Nv.objectKeys(this.shape)){let n=this.shape[i];t&&!t[i]?r[i]=n:r[i]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let i of Nv.objectKeys(this.shape))if(t&&!t[i])r[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof qje;)a=a._def.innerType;r[i]=a}return new e({...this._def,shape:()=>r})}keyof(){return ijp(Nv.objectKeys(this.shape))}};cJ.create=(e,t)=>new cJ({shape:()=>e,unknownKeys:"strip",catchall:ILt.create(),typeName:Pf.ZodObject,...z_(t)});cJ.strictCreate=(e,t)=>new cJ({shape:()=>e,unknownKeys:"strict",catchall:ILt.create(),typeName:Pf.ZodObject,...z_(t)});cJ.lazycreate=(e,t)=>new cJ({shape:e,unknownKeys:"strip",catchall:ILt.create(),typeName:Pf.ZodObject,...z_(t)});var Wln=class extends kh{_parse(t){let{ctx:r}=this._processInputParams(t),i=this._def.options;function n(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let o=a.map(c=>new sJ(c.ctx.common.issues));return qa(r,{code:Pi.invalid_union,unionErrors:o}),cf}if(r.common.async)return Promise.all(i.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let d of i){let s={...r,common:{...r.common,issues:[]},parent:null},u=d._parseSync({data:r.data,path:r.path,parent:s});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:s}),s.common.issues.length&&o.push(s.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let c=o.map(d=>new sJ(d));return qa(r,{code:Pi.invalid_union,unionErrors:c}),cf}}get options(){return this._def.options}};Wln.create=(e,t)=>new Wln({options:e,typeName:Pf.ZodUnion,...z_(t)});var fzi=e=>e instanceof Hln?fzi(e.schema):e instanceof Rje?fzi(e.innerType()):e instanceof xln?[e.value]:e instanceof Kln?e.options:e instanceof Jln?Nv.objectValues(e.enum):e instanceof $ln?fzi(e._def.innerType):e instanceof Lln?[void 0]:e instanceof Vln?[null]:e instanceof qje?[void 0,...fzi(e.unwrap())]:e instanceof mHt?[null,...fzi(e.unwrap())]:e instanceof qQa||e instanceof Xln?fzi(e.unwrap()):e instanceof Yln?fzi(e._def.innerType):[],Gqo=class e extends kh{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==No.object)return qa(r,{code:Pi.invalid_type,expected:No.object,received:r.parsedType}),cf;let i=this.discriminator,n=r.data[i],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(qa(r,{code:Pi.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),cf)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,i){let n=new Map;for(let a of r){let o=fzi(a.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of o){if(n.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);n.set(c,a)}}return new e({typeName:Pf.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...z_(i)})}};function ttc(e,t){let r=OHt(e),i=OHt(t);if(e===t)return{valid:!0,data:e};if(r===No.object&&i===No.object){let n=Nv.objectKeys(t),a=Nv.objectKeys(e).filter(c=>n.indexOf(c)!==-1),o={...e,...t};for(let c of a){let d=ttc(e[c],t[c]);if(!d.valid)return{valid:!1};o[c]=d.data}return{valid:!0,data:o}}else if(r===No.array&&i===No.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let a=0;a<e.length;a++){let o=e[a],c=t[a],d=ttc(o,c);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===No.date&&i===No.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Gln=class extends kh{_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=(a,o)=>{if(Vqo(a)||Vqo(o))return cf;let c=ttc(a.value,o.value);return c.valid?((Wqo(a)||Wqo(o))&&r.dirty(),{status:r.value,value:c.data}):(qa(i,{code:Pi.invalid_intersection_types}),cf)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Gln.create=(e,t,r)=>new Gln({left:e,right:t,typeName:Pf.ZodIntersection,...z_(r)});var AHt=class e extends kh{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==No.array)return qa(i,{code:Pi.invalid_type,expected:No.array,received:i.parsedType}),cf;if(i.data.length<this._def.items.length)return qa(i,{code:Pi.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),cf;!this._def.rest&&i.data.length>this._def.items.length&&(qa(i,{code:Pi.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...i.data].map((o,c)=>{let d=this._def.items[c]||this._def.rest;return d?d._parse(new Tje(i,o,i.path,c)):null}).filter(o=>!!o);return i.common.async?Promise.all(a).then(o=>r4.mergeArray(r,o)):r4.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};AHt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new AHt({items:e,typeName:Pf.ZodTuple,rest:null,...z_(t)})};var Hqo=class e extends kh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==No.object)return qa(i,{code:Pi.invalid_type,expected:No.object,received:i.parsedType}),cf;let n=[],a=this._def.keyType,o=this._def.valueType;for(let c in i.data)n.push({key:a._parse(new Tje(i,c,i.path,c)),value:o._parse(new Tje(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?r4.mergeObjectAsync(r,n):r4.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,i){return r instanceof kh?new e({keyType:t,valueType:r,typeName:Pf.ZodRecord,...z_(i)}):new e({keyType:W9i.create(),valueType:t,typeName:Pf.ZodRecord,...z_(r)})}},tJn=class extends kh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==No.map)return qa(i,{code:Pi.invalid_type,expected:No.map,received:i.parsedType}),cf;let n=this._def.keyType,a=this._def.valueType,o=[...i.data.entries()].map(([c,d],s)=>({key:n._parse(new Tje(i,c,i.path,[s,"key"])),value:a._parse(new Tje(i,d,i.path,[s,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let d of o){let s=await d.key,u=await d.value;if(s.status==="aborted"||u.status==="aborted")return cf;(s.status==="dirty"||u.status==="dirty")&&r.dirty(),c.set(s.value,u.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let d of o){let s=d.key,u=d.value;if(s.status==="aborted"||u.status==="aborted")return cf;(s.status==="dirty"||u.status==="dirty")&&r.dirty(),c.set(s.value,u.value)}return{status:r.value,value:c}}}};tJn.create=(e,t,r)=>new tJn({valueType:t,keyType:e,typeName:Pf.ZodMap,...z_(r)});var rJn=class e extends kh{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==No.set)return qa(i,{code:Pi.invalid_type,expected:No.set,received:i.parsedType}),cf;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(qa(i,{code:Pi.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(qa(i,{code:Pi.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let a=this._def.valueType;function o(d){let s=new Set;for(let u of d){if(u.status==="aborted")return cf;u.status==="dirty"&&r.dirty(),s.add(u.value)}return{status:r.value,value:s}}let c=[...i.data.values()].map((d,s)=>a._parse(new Tje(i,d,i.path,s)));return i.common.async?Promise.all(c).then(d=>o(d)):o(c)}min(t,r){return new e({...this._def,minSize:{value:t,message:Ws.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Ws.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};rJn.create=(e,t)=>new rJn({valueType:e,minSize:null,maxSize:null,typeName:Pf.ZodSet,...z_(t)});var xqo=class e extends kh{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==No.function)return qa(r,{code:Pi.invalid_type,expected:No.function,received:r.parsedType}),cf;function i(c,d){return CQa({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,YKn(),lzi].filter(s=>!!s),issueData:{code:Pi.invalid_arguments,argumentsError:d}})}function n(c,d){return CQa({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,YKn(),lzi].filter(s=>!!s),issueData:{code:Pi.invalid_return_type,returnTypeError:d}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof H9i){let c=this;return r8(async function(...d){let s=new sJ([]),u=await c._def.args.parseAsync(d,a).catch(_=>{throw s.addIssue(i(d,_)),s}),l=await Reflect.apply(o,this,u);return await c._def.returns._def.type.parseAsync(l,a).catch(_=>{throw s.addIssue(n(l,_)),s})})}else{let c=this;return r8(function(...d){let s=c._def.args.safeParse(d,a);if(!s.success)throw new sJ([i(d,s.error)]);let u=Reflect.apply(o,this,s.data),l=c._def.returns.safeParse(u,a);if(!l.success)throw new sJ([n(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:AHt.create(t).rest(dzi.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,i){return new e({args:t||AHt.create([]).rest(dzi.create()),returns:r||dzi.create(),typeName:Pf.ZodFunction,...z_(i)})}},Hln=class extends kh{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Hln.create=(e,t)=>new Hln({getter:e,typeName:Pf.ZodLazy,...z_(t)});var xln=class extends kh{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return qa(r,{received:r.data,code:Pi.invalid_literal,expected:this._def.value}),cf}return{status:"valid",value:t.data}}get value(){return this._def.value}};xln.create=(e,t)=>new xln({value:e,typeName:Pf.ZodLiteral,...z_(t)});function ijp(e,t){return new Kln({values:e,typeName:Pf.ZodEnum,...z_(t)})}var Kln=class e extends kh{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),i=this._def.values;return qa(r,{expected:Nv.joinValues(i),received:r.parsedType,code:Pi.invalid_type}),cf}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),i=this._def.values;return qa(r,{received:r.data,code:Pi.invalid_enum_value,options:i}),cf}return r8(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...r})}};Kln.create=ijp;var Jln=class extends kh{_parse(t){let r=Nv.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==No.string&&i.parsedType!==No.number){let n=Nv.objectValues(r);return qa(i,{expected:Nv.joinValues(n),received:i.parsedType,code:Pi.invalid_type}),cf}if(this._cache||(this._cache=new Set(Nv.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=Nv.objectValues(r);return qa(i,{received:i.data,code:Pi.invalid_enum_value,options:n}),cf}return r8(t.data)}get enum(){return this._def.values}};Jln.create=(e,t)=>new Jln({values:e,typeName:Pf.ZodNativeEnum,...z_(t)});var H9i=class extends kh{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==No.promise&&r.common.async===!1)return qa(r,{code:Pi.invalid_type,expected:No.promise,received:r.parsedType}),cf;let i=r.parsedType===No.promise?r.data:Promise.resolve(r.data);return r8(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};H9i.create=(e,t)=>new H9i({type:e,typeName:Pf.ZodPromise,...z_(t)});var Rje=class extends kh{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pf.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=this._def.effect||null,a={addIssue:o=>{qa(i,o),o.fatal?r.abort():r.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(i.data,a);if(i.common.async)return Promise.resolve(o).then(async c=>{if(r.value==="aborted")return cf;let d=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return d.status==="aborted"?cf:d.status==="dirty"?zln(d.value):r.value==="dirty"?zln(d.value):d});{if(r.value==="aborted")return cf;let c=this._def.schema._parseSync({data:o,path:i.path,parent:i});return c.status==="aborted"?cf:c.status==="dirty"?zln(c.value):r.value==="dirty"?zln(c.value):c}}if(n.type==="refinement"){let o=c=>{let d=n.refinement(c,a);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?cf:(c.status==="dirty"&&r.dirty(),o(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?cf:(c.status==="dirty"&&r.dirty(),o(c.value).then(()=>({status:r.value,value:c.value}))))}if(n.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!V9i(o))return cf;let c=n.transform(o.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>V9i(o)?Promise.resolve(n.transform(o.value,a)).then(c=>({status:r.value,value:c})):cf);Nv.assertNever(n)}};Rje.create=(e,t,r)=>new Rje({schema:e,typeName:Pf.ZodEffects,effect:t,...z_(r)});Rje.createWithPreprocess=(e,t,r)=>new Rje({schema:t,effect:{type:"preprocess",transform:e},typeName:Pf.ZodEffects,...z_(r)});var qje=class extends kh{_parse(t){return this._getType(t)===No.undefined?r8(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qje.create=(e,t)=>new qje({innerType:e,typeName:Pf.ZodOptional,...z_(t)});var mHt=class extends kh{_parse(t){return this._getType(t)===No.null?r8(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mHt.create=(e,t)=>new mHt({innerType:e,typeName:Pf.ZodNullable,...z_(t)});var $ln=class extends kh{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return r.parsedType===No.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};$ln.create=(e,t)=>new $ln({innerType:e,typeName:Pf.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...z_(t)});var Yln=class extends kh{_parse(t){let{ctx:r}=this._processInputParams(t),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return XKn(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new sJ(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new sJ(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Yln.create=(e,t)=>new Yln({innerType:e,typeName:Pf.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...z_(t)});var iJn=class extends kh{_parse(t){if(this._getType(t)!==No.nan){let i=this._getOrReturnCtx(t);return qa(i,{code:Pi.invalid_type,expected:No.nan,received:i.parsedType}),cf}return{status:"valid",value:t.data}}};iJn.create=e=>new iJn({typeName:Pf.ZodNaN,...z_(e)});var kGE=Symbol("zod_brand"),qQa=class extends kh{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},TQa=class e extends kh{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?cf:a.status==="dirty"?(r.dirty(),zln(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?cf:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(t,r){return new e({in:t,out:r,typeName:Pf.ZodPipeline})}},Xln=class extends kh{_parse(t){let r=this._def.innerType._parse(t),i=n=>(V9i(n)&&(n.value=Object.freeze(n.value)),n);return XKn(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};Xln.create=(e,t)=>new Xln({innerType:e,typeName:Pf.ZodReadonly,...z_(t)});function kPp(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function njp(e,t={},r){return e?G9i.create().superRefine((i,n)=>{let a=e(i);if(a instanceof Promise)return a.then(o=>{if(!o){let c=kPp(t,i),d=c.fatal??r??!0;n.addIssue({code:"custom",...c,fatal:d})}});if(!a){let o=kPp(t,i),c=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:c})}}):G9i.create()}var eHE={object:cJ.lazycreate},Pf;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Pf||(Pf={}));var tHE=(e,t={message:`Input not instance of ${e.name}`})=>njp(r=>r instanceof e,t),ajp=W9i.create,ojp=Nln.create,rHE=iJn.create,iHE=Fln.create,ujp=Qln.create,nHE=Uln.create,aHE=kKn.create,oHE=Lln.create,uHE=Vln.create,sHE=G9i.create,cHE=dzi.create,lHE=ILt.create,fHE=eJn.create,dHE=pzi.create,pHE=cJ.create,_HE=cJ.strictCreate,hHE=Wln.create,yHE=Gqo.create,bHE=Gln.create,vHE=AHt.create,gHE=Hqo.create,OHE=tJn.create,AHE=rJn.create,mHE=xqo.create,PHE=Hln.create,jHE=xln.create,wHE=Kln.create,EHE=Jln.create,SHE=H9i.create,MHE=Rje.create,DHE=qje.create,BHE=mHt.create,IHE=Rje.createWithPreprocess,CHE=TQa.create,qHE=()=>ajp().optional(),THE=()=>ojp().optional(),RHE=()=>ujp().optional(),zHE={string:(e=>W9i.create({...e,coerce:!0})),number:(e=>Nln.create({...e,coerce:!0})),boolean:(e=>Qln.create({...e,coerce:!0})),bigint:(e=>Fln.create({...e,coerce:!0})),date:(e=>Uln.create({...e,coerce:!0}))};var NHE=cf;var fJ={};Zt(fJ,{RawSchemas:()=>urc});var urc={};Zt(urc,{AiChatLocation:()=>atc,AiChatModel:()=>otc,Availability:()=>utc,BodyThemeConfig:()=>ptc,ContentAlignment:()=>gtc,FernDocsConfig:()=>Etc,FernDocsConfigError:()=>RQa,FernDocsConfigTimeoutError:()=>zQa,FontDisplay:()=>mtc,FontStyle:()=>Atc,FooterNavThemeConfig:()=>ftc,HeaderPosition:()=>Otc,HttpSnippetLanguage:()=>ytc,JsScriptStrategy:()=>Ptc,Language:()=>itc,LanguageSwitcherThemeConfig:()=>ltc,PageActionOption:()=>ntc,PageActionsThemeConfig:()=>htc,ProductSwitcherThemeConfig:()=>ctc,ProgrammingLanguage:()=>rtc,SearchbarPlacement:()=>btc,Serializer:()=>lJ,SidebarThemeConfig:()=>_tc,TabsPlacement:()=>vtc,TabsThemeConfig:()=>dtc,Target:()=>wtc,TwitterCardSetting:()=>jtc,VersionAvailability:()=>stc,docs:()=>Kqo,serialization:()=>lJ});var Etc={};Zt(Etc,{AiChatLocation:()=>atc,AiChatModel:()=>otc,Availability:()=>utc,BodyThemeConfig:()=>ptc,ContentAlignment:()=>gtc,FontDisplay:()=>mtc,FontStyle:()=>Atc,FooterNavThemeConfig:()=>ftc,HeaderPosition:()=>Otc,HttpSnippetLanguage:()=>ytc,JsScriptStrategy:()=>Ptc,Language:()=>itc,LanguageSwitcherThemeConfig:()=>ltc,PageActionOption:()=>ntc,PageActionsThemeConfig:()=>htc,ProductSwitcherThemeConfig:()=>ctc,ProgrammingLanguage:()=>rtc,SearchbarPlacement:()=>btc,SidebarThemeConfig:()=>_tc,TabsPlacement:()=>vtc,TabsThemeConfig:()=>dtc,Target:()=>wtc,TwitterCardSetting:()=>jtc,VersionAvailability:()=>stc,docs:()=>Kqo});var Kqo={};Zt(Kqo,{AiChatLocation:()=>atc,AiChatModel:()=>otc,Availability:()=>utc,BodyThemeConfig:()=>ptc,ContentAlignment:()=>gtc,FontDisplay:()=>mtc,FontStyle:()=>Atc,FooterNavThemeConfig:()=>ftc,HeaderPosition:()=>Otc,HttpSnippetLanguage:()=>ytc,JsScriptStrategy:()=>Ptc,Language:()=>itc,LanguageSwitcherThemeConfig:()=>ltc,PageActionOption:()=>ntc,PageActionsThemeConfig:()=>htc,ProductSwitcherThemeConfig:()=>ctc,ProgrammingLanguage:()=>rtc,SearchbarPlacement:()=>btc,SidebarThemeConfig:()=>_tc,TabsPlacement:()=>vtc,TabsThemeConfig:()=>dtc,Target:()=>wtc,TwitterCardSetting:()=>jtc,VersionAvailability:()=>stc});var rtc={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var itc={En:"en",Es:"es",Fr:"fr",De:"de",It:"it",Pt:"pt",Ja:"ja",Zh:"zh",Ko:"ko",El:"el",No:"no",Pl:"pl",Ru:"ru",Sv:"sv",Tr:"tr"};var ntc={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var atc={Docs:"docs",Slack:"slack",Discord:"discord"};var otc={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var utc={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var stc={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var ctc={Default:"default",Toggle:"toggle"};var ltc={Default:"default",Minimal:"minimal"};var ftc={Default:"default",Minimal:"minimal"};var dtc={Default:"default",Bubble:"bubble"};var ptc={Default:"default",Canvas:"canvas"};var _tc={Default:"default",Minimal:"minimal"};var htc={Default:"default",Toolbar:"toolbar"};var ytc={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var btc={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var vtc={Header:"header",Sidebar:"sidebar"};var gtc={Center:"center",Left:"left"};var Otc={Fixed:"fixed",Static:"static"};var Atc={Normal:"normal",Italic:"italic"};var mtc={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var Ptc={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var jtc={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var wtc={Blank:"_blank",Self:"_self",Parent:"_parent",Top:"_top"};var sjp=(e,t,r)=>JSON.stringify(e,t,r);var RQa=class e extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:i,rawResponse:n}){super(FHE({message:t,statusCode:r,body:i})),Object.setPrototypeOf(this,e.prototype),this.statusCode=r,this.body=i,this.rawResponse=n}};function FHE({message:e,statusCode:t,body:r}){let i=[];return e!=null&&i.push(e),t!=null&&i.push(`Status code: ${t.toString()}`),r!=null&&i.push(`Body: ${sjp(r,void 0,2)}`),i.join(`
798
798
  `)}var zQa=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var lJ={};Zt(lJ,{AbsoluteProductPath:()=>WTo,AiChatConfig:()=>eUa,AiChatDatasource:()=>Y1o,AiChatLocation:()=>J1o,AiChatModel:()=>K1o,AiChatWebsiteDatasource:()=>$1o,AnalyticsConfig:()=>A1o,AnnouncementConfig:()=>Y9i,ApiReferenceConfiguration:()=>TTo,ApiReferenceEndpointConfiguration:()=>FTo,ApiReferenceLayoutItem:()=>IHt,ApiReferencePackageConfiguration:()=>UTo,ApiReferencePackageConfigurationWithOptions:()=>LTo,ApiReferenceSectionConfiguration:()=>QTo,Audience:()=>EHt,AudienceId:()=>ZQa,Availability:()=>a8,BackgroundImageConfiguration:()=>rTo,BackgroundImageThemedConfig:()=>tTo,BodyThemeConfig:()=>vTo,ChangelogConfiguration:()=>RTo,ChangelogFolderRelativePath:()=>vJn,ColorConfig:()=>DHt,ColorThemedConfig:()=>iTo,ColorsConfiguration:()=>nTo,ContentAlignment:()=>fTo,CssConfig:()=>ETo,CustomDomain:()=>m1o,CustomPageAction:()=>W1o,DocsConfiguration:()=>Uwp,DocsInstance:()=>w1o,DocsSettingsConfig:()=>yTo,DocsTypographyConfig:()=>sTo,EditThisPageConfig:()=>j1o,ExperimentalConfig:()=>x1o,ExternalProduct:()=>D1o,FeatureFlag:()=>kQa,FeatureFlagConfiguration:()=>E1o,FolderConfiguration:()=>zTo,FontConfig:()=>jJn,FontConfigPath:()=>oTo,FontConfigVariant:()=>aTo,FontDisplay:()=>uTo,FontStyle:()=>PJn,FontWeight:()=>mJn,FooterLinksConfig:()=>L1o,FooterNavThemeConfig:()=>ATo,FullStoryAnalyticsConfig:()=>y1o,GithubEditThisPageConfig:()=>P1o,GoogleAnalytics4Config:()=>O1o,GtmConfig:()=>g1o,HeaderPosition:()=>dTo,HttpSnippetLanguage:()=>_To,HttpSnippetsConfig:()=>hTo,IntegrationsConfig:()=>wTo,IntercomConfig:()=>b1o,InternalProduct:()=>M1o,JsConfig:()=>BTo,JsConfigOptions:()=>tUa,JsFileConfig:()=>DTo,JsFileConfigSettings:()=>MTo,JsRemoteConfig:()=>STo,JsScriptStrategy:()=>wJn,Language:()=>bJn,LanguageSwitcherThemeConfig:()=>mTo,LayoutConfig:()=>pTo,LinkConfiguration:()=>EJn,LogoConfiguration:()=>eTo,MetadataConfig:()=>Z1o,NavbarDropdownConfig:()=>Q1o,NavbarGithubConfig:()=>F1o,NavbarGithubConfigWithOptions:()=>N1o,NavbarLink:()=>U1o,NavbarLinkConfig:()=>MHt,NavigationConfig:()=>Z9i,NavigationItem:()=>SHt,PageActionOption:()=>V1o,PageActionOptions:()=>G1o,PageActionsConfig:()=>H1o,PageActionsThemeConfig:()=>OTo,PageConfiguration:()=>Fje,PlaygroundButtonSettings:()=>qTo,PlaygroundSettings:()=>BHt,PostHogConfig:()=>v1o,ProductConfig:()=>B1o,ProductConfigBase:()=>AJn,ProductFileConfig:()=>Wwp,ProductPath:()=>Vwp,ProductSwitcherThemeConfig:()=>PTo,ProgrammingLanguage:()=>_1o,RedirectConfig:()=>k1o,RelativeProductPath:()=>VTo,Role:()=>gJn,RoleId:()=>rfn,SearchbarPlacement:()=>cTo,SectionConfiguration:()=>NTo,SegmentConfig:()=>h1o,SidebarThemeConfig:()=>bTo,SnippetLanguageConfiguration:()=>Qje,SnippetsConfiguration:()=>CTo,TabConfig:()=>X9i,TabId:()=>zje,TabVariant:()=>q1o,TabbedNavigationConfig:()=>z1o,TabbedNavigationItem:()=>R1o,TabbedNavigationItemWithLayout:()=>C1o,TabbedNavigationItemWithVariants:()=>T1o,TabsPlacement:()=>lTo,TabsThemeConfig:()=>gTo,Target:()=>Nje,ThemeConfig:()=>jTo,TwitterCardSetting:()=>X1o,UntabbedNavigationConfig:()=>I1o,VersionAvailability:()=>S1o,VersionConfig:()=>OJn,VersionFileConfig:()=>Lwp,VersionedSnippetLanguageConfiguration:()=>ITo,WithFeatureFlags:()=>f0,WithPermissions:()=>l0,WithViewers:()=>k9i,docs:()=>orc});var orc={};Zt(orc,{AbsoluteProductPath:()=>WTo,AiChatConfig:()=>eUa,AiChatDatasource:()=>Y1o,AiChatLocation:()=>J1o,AiChatModel:()=>K1o,AiChatWebsiteDatasource:()=>$1o,AnalyticsConfig:()=>A1o,AnnouncementConfig:()=>Y9i,ApiReferenceConfiguration:()=>TTo,ApiReferenceEndpointConfiguration:()=>FTo,ApiReferenceLayoutItem:()=>IHt,ApiReferencePackageConfiguration:()=>UTo,ApiReferencePackageConfigurationWithOptions:()=>LTo,ApiReferenceSectionConfiguration:()=>QTo,Audience:()=>EHt,AudienceId:()=>ZQa,Availability:()=>a8,BackgroundImageConfiguration:()=>rTo,BackgroundImageThemedConfig:()=>tTo,BodyThemeConfig:()=>vTo,ChangelogConfiguration:()=>RTo,ChangelogFolderRelativePath:()=>vJn,ColorConfig:()=>DHt,ColorThemedConfig:()=>iTo,ColorsConfiguration:()=>nTo,ContentAlignment:()=>fTo,CssConfig:()=>ETo,CustomDomain:()=>m1o,CustomPageAction:()=>W1o,DocsConfiguration:()=>Uwp,DocsInstance:()=>w1o,DocsSettingsConfig:()=>yTo,DocsTypographyConfig:()=>sTo,EditThisPageConfig:()=>j1o,ExperimentalConfig:()=>x1o,ExternalProduct:()=>D1o,FeatureFlag:()=>kQa,FeatureFlagConfiguration:()=>E1o,FolderConfiguration:()=>zTo,FontConfig:()=>jJn,FontConfigPath:()=>oTo,FontConfigVariant:()=>aTo,FontDisplay:()=>uTo,FontStyle:()=>PJn,FontWeight:()=>mJn,FooterLinksConfig:()=>L1o,FooterNavThemeConfig:()=>ATo,FullStoryAnalyticsConfig:()=>y1o,GithubEditThisPageConfig:()=>P1o,GoogleAnalytics4Config:()=>O1o,GtmConfig:()=>g1o,HeaderPosition:()=>dTo,HttpSnippetLanguage:()=>_To,HttpSnippetsConfig:()=>hTo,IntegrationsConfig:()=>wTo,IntercomConfig:()=>b1o,InternalProduct:()=>M1o,JsConfig:()=>BTo,JsConfigOptions:()=>tUa,JsFileConfig:()=>DTo,JsFileConfigSettings:()=>MTo,JsRemoteConfig:()=>STo,JsScriptStrategy:()=>wJn,Language:()=>bJn,LanguageSwitcherThemeConfig:()=>mTo,LayoutConfig:()=>pTo,LinkConfiguration:()=>EJn,LogoConfiguration:()=>eTo,MetadataConfig:()=>Z1o,NavbarDropdownConfig:()=>Q1o,NavbarGithubConfig:()=>F1o,NavbarGithubConfigWithOptions:()=>N1o,NavbarLink:()=>U1o,NavbarLinkConfig:()=>MHt,NavigationConfig:()=>Z9i,NavigationItem:()=>SHt,PageActionOption:()=>V1o,PageActionOptions:()=>G1o,PageActionsConfig:()=>H1o,PageActionsThemeConfig:()=>OTo,PageConfiguration:()=>Fje,PlaygroundButtonSettings:()=>qTo,PlaygroundSettings:()=>BHt,PostHogConfig:()=>v1o,ProductConfig:()=>B1o,ProductConfigBase:()=>AJn,ProductFileConfig:()=>Wwp,ProductPath:()=>Vwp,ProductSwitcherThemeConfig:()=>PTo,ProgrammingLanguage:()=>_1o,RedirectConfig:()=>k1o,RelativeProductPath:()=>VTo,Role:()=>gJn,RoleId:()=>rfn,SearchbarPlacement:()=>cTo,SectionConfiguration:()=>NTo,SegmentConfig:()=>h1o,SidebarThemeConfig:()=>bTo,SnippetLanguageConfiguration:()=>Qje,SnippetsConfiguration:()=>CTo,TabConfig:()=>X9i,TabId:()=>zje,TabVariant:()=>q1o,TabbedNavigationConfig:()=>z1o,TabbedNavigationItem:()=>R1o,TabbedNavigationItemWithLayout:()=>C1o,TabbedNavigationItemWithVariants:()=>T1o,TabsPlacement:()=>lTo,TabsThemeConfig:()=>gTo,Target:()=>Nje,ThemeConfig:()=>jTo,TwitterCardSetting:()=>X1o,UntabbedNavigationConfig:()=>I1o,VersionAvailability:()=>S1o,VersionConfig:()=>OJn,VersionFileConfig:()=>Lwp,VersionedSnippetLanguageConfiguration:()=>ITo,WithFeatureFlags:()=>f0,WithPermissions:()=>l0,WithViewers:()=>k9i});var te={};Zt(te,{JsonError:()=>_Jn,ParseError:()=>hJn,any:()=>Swp,bigint:()=>_wp,boolean:()=>Mwp,booleanLiteral:()=>Ewp,date:()=>hwp,discriminant:()=>Nwp,enum_:()=>f1o,getObjectLikeUtils:()=>qLt,getObjectUtils:()=>tfn,getSchemaUtils:()=>JA,isProperty:()=>$9i,lazy:()=>ywp,lazyObject:()=>Pwp,list:()=>p1o,number:()=>Dwp,object:()=>d1o,objectWithoutOptionalProperties:()=>mwp,optional:()=>rrc,property:()=>vwp,record:()=>qwp,set:()=>Twp,string:()=>Bwp,stringLiteral:()=>wwp,transform:()=>irc,undiscriminatedUnion:()=>zwp,union:()=>Qwp,unknown:()=>Iwp,withParsedProperties:()=>arc});var cp={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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function KA(e,t){return`Expected ${t}. Received ${fKE(e)}.`}function fKE(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 rN(e){return{...e,json:pwp(e.json),parse:pwp(e.parse)}}function pwp(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(`
799
799
  `)),{ok:!0,value:t}):i}}function l1o(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var _Jn=class e extends Error{errors;constructor(t){super(t.map(l1o).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var hJn=class e extends Error{errors;constructor(t){super(t.map(l1o).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function JA(e){return{nullable:()=>dKE(e),optional:()=>rrc(e),optionalNullable:()=>pKE(e),transform:t=>irc(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new hJn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new _Jn(i.errors)}}}function dKE(e){let t={parse:(r,i)=>r==null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>cp.NULLABLE};return{...t,...JA(t)}}function rrc(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:()=>cp.OPTIONAL};return{...t,...JA(t)}}function pKE(e){let t={parse:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,i),getType:()=>cp.OPTIONAL_NULLABLE};return{...t,...JA(t)}}function irc(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,...JA(r)}}function _wp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:KA(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:KA(t,"bigint")}]}:{ok:!0,value:t},getType:()=>cp.BIGINT};return{...rN(e),...JA(e)}}var _KE=/^([+-]?\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 hwp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:KA(t,"string")}]}:_KE.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:KA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:KA(t,"Date object")}]},getType:()=>cp.DATE};return{...rN(e),...JA(e)}}function n8(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...rN(r),...JA(r)}}}function f1o(e){let t=new Set(e);return n8(cp.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:KA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:KA(i,"enum")}]}:{ok:!0,value:i})()}function ywp(e){let t=nrc(e);return{...t,...JA(t)}}function nrc(e){return{parse:(t,r)=>yJn(e).parse(t,r),json:(t,r)=>yJn(e).json(t,r),getType:()=>yJn(e).getType()}}function yJn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function $Qa(e){return Object.entries(e)}function YQa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function J9i(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 XQa(e){return Object.keys(e)}function bwp(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function qLt(e){return{withParsedProperties:t=>arc(e,t)}}function arc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[d,s])=>({...c,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(i,n)=>{if(!J9i(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:KA(i,"object")}]};let a=new Set(Object.keys(t)),o=YQa(i,Object.keys(i).filter(c=>!a.has(c)));return e.json(o,n)},getType:()=>e.getType()};return{...r,...JA(r),...qLt(r)}}function vwp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function $9i(e){return e.isProperty}function d1o(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>$9i(i)?i.rawKey:r),_getParsedProperties:()=>XQa(e),parse:(r,i)=>{let n={},a=[];for(let[o,c]of $Qa(e)){let d=$9i(c)?c.rawKey:o,s=$9i(c)?c.valueSchema:c,u={rawKey:d,parsedKey:o,valueSchema:s};n[d]=u,Awp(s)&&a.push(d)}return gwp({value:r,requiredKeys:a,getProperty:o=>{let c=n[o];if(c!=null)return{transformedKey:c.parsedKey,transform:d=>c.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,o]of $Qa(e)){let c=$9i(o)?o.valueSchema:o;Awp(c)&&n.push(a)}return gwp({value:r,requiredKeys:n,getProperty:a=>{let o=e[a];if(o!=null)return $9i(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>cp.OBJECT};return{...rN(t),...JA(t),...qLt(t),...tfn(t)}}function gwp({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!J9i(e))return{ok:!1,errors:[{path:a,message:KA(e,"object")}]};let o=new Set(t),c=[],d={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let p=l.transform(u);p.ok?d[l.transformedKey]=p.value:(d[s]=u,c.push(...p.errors))}else switch(i){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||n?{ok:!0,value:d}:{ok:!1,errors:c}}function tfn(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>Owp({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>Owp({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>cp.OBJECT};return{...r,...JA(r),...qLt(r),...tfn(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:()=>cp.OBJECT};return{...t,...JA(t),...qLt(t),...tfn(t)}}}}function Owp({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,o]=bwp(XQa(t),s=>n.has(s)),c=r(YQa(t,o)),d=i(YQa(t,a));return c.ok&&d.ok?{ok:!0,value:{...c.value,...d.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...d.ok?[]:d.errors]}}function Awp(e){return!hKE(e)}function hKE(e){switch(e.getType()){case cp.ANY:case cp.UNKNOWN:case cp.OPTIONAL:case cp.OPTIONAL_NULLABLE:return!0;default:return!1}}function mwp(e){return d1o(e)}function Pwp(e){let t={...nrc(e),_getRawProperties:()=>yJn(e)._getRawProperties(),_getParsedProperties:()=>yJn(e)._getParsedProperties()};return{...t,...JA(t),...qLt(t),...tfn(t)}}function p1o(e){let t={parse:(r,i)=>jwp(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>jwp(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>cp.LIST};return{...rN(t),...JA(t)}}function jwp(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:KA(e,"list"),path:[]}]}}function wwp(e){return n8(cp.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:KA(r,`"${e}"`)}]})()}function Ewp(e){return n8(cp.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:KA(r,`${e.toString()}`)}]})()}var Swp=n8(cp.ANY,e=>({ok:!0,value:e}));var Mwp=n8(cp.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:KA(e,"boolean")}]});var Dwp=n8(cp.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:KA(e,"number")}]});var Bwp=n8(cp.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:KA(e,"string")}]});var Iwp=n8(cp.UNKNOWN,e=>({ok:!0,value:e}));function qwp(e,t){let r={parse:(i,n)=>Cwp({value:i,isKeyNumeric:e.getType()===cp.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Cwp({value:i,isKeyNumeric:e.getType()===cp.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>cp.RECORD};return{...rN(r),...JA(r)}}function Cwp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return J9i(e)?$Qa(e).reduce((a,[o,c])=>{if(c===void 0)return a;let d=a,s=o;if(t){let _=o.length>0?Number(o):NaN;isNaN(_)||(s=_)}let u=r(s),l=i(c,s);if(d.ok&&u.ok&&l.ok)return{ok:!0,value:{...d.value,[u.value]:l.value}};let p=[];return d.ok||p.push(...d.errors),u.ok||p.push(...u.errors),l.ok||p.push(...l.errors),{ok:!1,errors:p}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:KA(e,"object")}]}}function Twp(e){let t=p1o(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:KA(i,"Set")}]},getType:()=>cp.SET};return{...rN(r),...JA(r)}}function zwp(e){let t={parse:(r,i)=>Rwp((n,a)=>n.parse(r,a),e,i),json:(r,i)=>Rwp((n,a)=>n.json(r,a),e,i),getType:()=>cp.UNDISCRIMINATED_UNION};return{...rN(t),...JA(t)}}function Rwp(e,t,r){let i=[];for(let[n,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)i.push({path:c.path,message:`[Variant ${n}] ${c.message}`})}return{ok:!1,errors:i}}function Nwp(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Qwp(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=f1o(XQa(t)),a={parse:(o,c)=>Fwp({value:o,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>Fwp({value:o,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>cp.UNION};return{...rN(a),...JA(a),...qLt(a)}}function Fwp({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!J9i(e))return{ok:!1,errors:[{path:c,message:KA(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=i(d);if(!u.ok)return{ok:!1,errors:u.errors};let l=n(u.value);if(l==null)return a?{ok:!0,value:{[r]:u.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let p=o(s,l);return p.ok?{ok:!0,value:{[r]:d,...p.value}}:p}var _1o=te.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var bJn=te.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var h1o=te.object({writeKey:te.property("write-key",te.string())});var y1o=te.object({orgId:te.property("org-id",te.string())});var b1o=te.object({appId:te.property("app-id",te.string()),apiBase:te.property("api-base",te.string().optional())});var v1o=te.object({apiKey:te.property("api-key",te.string()),endpoint:te.string().optional()});var g1o=te.object({containerId:te.property("container-id",te.string())});var O1o=te.object({measurementId:te.property("measurement-id",te.string())});var A1o=te.object({segment:h1o.optional(),fullstory:y1o.optional(),intercom:b1o.optional(),posthog:v1o.optional(),gtm:g1o.optional(),ga4:O1o.optional()});var m1o=te.undiscriminatedUnion([te.string(),te.list(te.string())]);var P1o=te.object({host:te.string().optional(),owner:te.string(),repo:te.string(),branch:te.string().optional()});var j1o=te.object({github:P1o.optional()});var ZQa=te.string();var EHt=te.undiscriminatedUnion([ZQa,te.list(ZQa)]);var w1o=te.object({url:te.string(),customDomain:te.property("custom-domain",m1o.optional()),private:te.boolean().optional(),editThisPage:te.property("edit-this-page",j1o.optional()),audiences:EHt.optional()});var Y9i=te.object({message:te.string()});var rfn=te.string();var zje=te.string();var Nje=te.enum_(["_blank","_self","_parent","_top"]);var vJn=te.string();var gJn=te.undiscriminatedUnion([rfn,te.list(rfn)]);var l0=te.object({viewers:gJn.optional(),orphaned:te.boolean().optional()});var kQa=te.object({flag:te.string(),fallbackValue:te.property("fallback-value",te.unknown().optional()),match:te.unknown().optional()});var E1o=te.undiscriminatedUnion([te.string(),kQa,te.list(kQa)]);var f0=te.object({featureFlag:te.property("feature-flag",E1o.optional())});var X9i=te.object({displayName:te.property("display-name",te.string()),icon:te.string().optional(),slug:te.string().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),hidden:te.boolean().optional(),href:te.string().optional(),target:Nje.optional(),changelog:vJn.optional()}).extend(l0).extend(f0);var S1o=te.enum_(["deprecated","ga","stable","beta"]);var OJn=te.object({displayName:te.property("display-name",te.string()),path:te.string(),slug:te.string().optional(),availability:S1o.optional(),audiences:EHt.optional(),hidden:te.boolean().optional(),announcement:Y9i.optional()}).extend(l0).extend(f0);var AJn=te.object({displayName:te.property("display-name",te.string()),subtitle:te.string().optional(),icon:te.string().optional(),image:te.string().optional(),versions:te.list(OJn).optional(),audiences:EHt.optional()}).extend(l0).extend(f0);var M1o=te.object({path:te.string(),slug:te.string().optional(),announcement:Y9i.optional()}).extend(AJn);var D1o=te.object({href:te.string(),target:Nje.optional()}).extend(AJn);var B1o=te.undiscriminatedUnion([M1o,D1o]);var a8=te.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var Fje=te.object({page:te.string(),path:te.string(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),noindex:te.boolean().optional(),availability:a8.optional()}).extend(l0).extend(f0);var I1o=te.list(te.lazy(()=>SHt));var C1o=te.object({tab:zje,layout:te.list(te.lazy(()=>SHt)).optional()});var q1o=te.object({title:te.string(),subtitle:te.string().optional(),icon:te.string().optional(),layout:te.list(te.lazy(()=>SHt)),slug:te.string().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),hidden:te.boolean().optional(),default:te.boolean().optional()}).extend(l0).extend(f0);var T1o=te.object({tab:zje,variants:te.list(q1o)});var R1o=te.undiscriminatedUnion([C1o,T1o]);var z1o=te.list(R1o);var Z9i=te.undiscriminatedUnion([I1o,z1o]);var k9i=te.object({viewers:gJn.optional()});var MHt=te.object({href:te.string().optional(),target:Nje.optional(),url:te.string().optional(),text:te.string().optional(),icon:te.string().optional(),rightIcon:te.string().optional(),rounded:te.boolean().optional()}).extend(k9i);var N1o=te.object({url:te.string(),target:Nje.optional()}).extend(k9i);var F1o=te.undiscriminatedUnion([te.string(),N1o]);var Q1o=te.object({links:te.list(MHt),text:te.string().optional(),icon:te.string().optional(),rightIcon:te.string().optional(),rounded:te.boolean().optional()}).extend(k9i);var U1o=te.union("type",{filled:MHt,outlined:MHt,minimal:MHt,github:te.object({value:F1o}),dropdown:Q1o,primary:MHt,secondary:MHt}).transform({transform:e=>e,untransform:e=>e});var L1o=te.object({github:te.string().optional(),twitter:te.string().optional(),x:te.string().optional(),linkedin:te.string().optional(),youtube:te.string().optional(),instagram:te.string().optional(),facebook:te.string().optional(),discord:te.string().optional(),slack:te.string().optional(),hackernews:te.string().optional(),medium:te.string().optional(),website:te.string().optional()});var V1o=te.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var W1o=te.object({title:te.string(),subtitle:te.string().optional(),url:te.string(),icon:te.string().optional(),default:te.boolean().optional()});var G1o=te.object({copyPage:te.property("copy-page",te.boolean().optional()),viewAsMarkdown:te.property("view-as-markdown",te.boolean().optional()),askAi:te.property("ask-ai",te.boolean().optional()),chatgpt:te.boolean().optional(),claude:te.boolean().optional(),cursor:te.boolean().optional(),vscode:te.boolean().optional(),custom:te.list(W1o).optional()});var H1o=te.object({default:V1o.optional(),options:G1o.optional()});var x1o=te.object({mdxComponents:te.property("mdx-components",te.list(te.string()).optional()),disableStreamToggle:te.property("disable-stream-toggle",te.boolean().optional()),openapiParserV2:te.property("openapi-parser-v2",te.boolean().optional()),openapiParserV3:te.property("openapi-parser-v3",te.boolean().optional()),dynamicSnippets:te.property("dynamic-snippets",te.boolean().optional()),aiExamples:te.property("ai-examples",te.boolean().optional()),aiExampleStyleInstructions:te.property("ai-example-style-instructions",te.string().optional())});var K1o=te.enum_(["claude-3.7","claude-4","command-a"]);var J1o=te.enum_(["docs","slack","discord"]);var $1o=te.object({url:te.string(),title:te.string().optional()});var Y1o=te.undiscriminatedUnion([$1o]);var eUa=te.object({model:K1o.optional(),systemPrompt:te.property("system-prompt",te.string().optional()),location:te.list(J1o).optional(),datasources:te.list(Y1o).optional()});var X1o=te.enum_(["summary","summary_large_image","app","player"]);var Z1o=te.object({ogSiteName:te.property("og:site_name",te.string().optional()),ogTitle:te.property("og:title",te.string().optional()),ogDescription:te.property("og:description",te.string().optional()),ogUrl:te.property("og:url",te.string().optional()),ogImage:te.property("og:image",te.string().optional()),ogImageWidth:te.property("og:image:width",te.number().optional()),ogImageHeight:te.property("og:image:height",te.number().optional()),ogLocale:te.property("og:locale",te.string().optional()),ogLogo:te.property("og:logo",te.string().optional()),twitterTitle:te.property("twitter:title",te.string().optional()),twitterDescription:te.property("twitter:description",te.string().optional()),twitterHandle:te.property("twitter:handle",te.string().optional()),twitterImage:te.property("twitter:image",te.string().optional()),twitterSite:te.property("twitter:site",te.string().optional()),twitterUrl:te.property("twitter:url",te.string().optional()),twitterCard:te.property("twitter:card",X1o.optional()),canonicalHost:te.property("canonical-host",te.string().optional())});var k1o=te.object({source:te.string(),destination:te.string(),permanent:te.boolean().optional()});var eTo=te.object({dark:te.string().optional(),light:te.string().optional(),height:te.number().optional(),href:te.string().optional(),rightText:te.property("right-text",te.string().optional())});var tTo=te.object({dark:te.string().optional(),light:te.string().optional()});var rTo=te.undiscriminatedUnion([te.string(),tTo]);var iTo=te.object({dark:te.string().optional(),light:te.string().optional()});var DHt=te.undiscriminatedUnion([te.string(),iTo]);var nTo=te.object({accentPrimary:te.property("accent-primary",DHt.optional()),accentPrimaryDeprecated:te.property("accentPrimary",DHt.optional()),background:DHt.optional(),border:DHt.optional(),sidebarBackground:te.property("sidebar-background",DHt.optional()),headerBackground:te.property("header-background",DHt.optional()),cardBackground:te.property("card-background",DHt.optional())});var mJn=te.undiscriminatedUnion([te.string(),te.number()]);var PJn=te.enum_(["normal","italic"]);var aTo=te.object({path:te.string(),weight:mJn.optional(),style:PJn.optional()});var oTo=te.undiscriminatedUnion([te.string(),aTo]);var uTo=te.enum_(["auto","block","swap","fallback","optional"]);var jJn=te.object({name:te.string().optional(),path:te.string().optional(),weight:mJn.optional(),style:PJn.optional(),paths:te.list(oTo).optional(),display:uTo.optional(),fallback:te.list(te.string()).optional(),fontVariationSettings:te.property("font-variation-settings",te.string().optional())});var sTo=te.object({headingsFont:jJn.optional(),bodyFont:jJn.optional(),codeFont:jJn.optional()});var cTo=te.enum_(["header","header-tabs","sidebar"]);var lTo=te.enum_(["header","sidebar"]);var fTo=te.enum_(["center","left"]);var dTo=te.enum_(["fixed","static"]);var pTo=te.object({pageWidth:te.property("page-width",te.string().optional()),contentWidth:te.property("content-width",te.string().optional()),sidebarWidth:te.property("sidebar-width",te.string().optional()),headerHeight:te.property("header-height",te.string().optional()),searchbarPlacement:te.property("searchbar-placement",cTo.optional()),tabsPlacement:te.property("tabs-placement",lTo.optional()),contentAlignment:te.property("content-alignment",fTo.optional()),headerPosition:te.property("header-position",dTo.optional()),disableHeader:te.property("disable-header",te.boolean().optional()),hideNavLinks:te.property("hide-nav-links",te.boolean().optional()),hideFeedback:te.property("hide-feedback",te.boolean().optional())});var _To=te.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var hTo=te.undiscriminatedUnion([te.boolean(),te.list(_To)]);var yTo=te.object({searchText:te.property("search-text",te.string().optional()),disableSearch:te.property("disable-search",te.boolean().optional()),darkModeCode:te.property("dark-mode-code",te.boolean().optional()),defaultSearchFilters:te.property("default-search-filters",te.boolean().optional()),httpSnippets:te.property("http-snippets",hTo.optional()),hide404Page:te.property("hide-404-page",te.boolean().optional()),useJavascriptAsTypescript:te.property("use-javascript-as-typescript",te.boolean().optional()),disableExplorerProxy:te.property("disable-explorer-proxy",te.boolean().optional()),disableAnalytics:te.property("disable-analytics",te.boolean().optional()),language:bJn.optional(),substituteEnvVars:te.property("substitute-env-vars",te.boolean().optional())});var bTo=te.enum_(["default","minimal"]);var vTo=te.enum_(["default","canvas"]);var gTo=te.enum_(["default","bubble"]);var OTo=te.enum_(["default","toolbar"]);var ATo=te.enum_(["default","minimal"]);var mTo=te.enum_(["default","minimal"]);var PTo=te.enum_(["default","toggle"]);var jTo=te.object({sidebar:bTo.optional(),body:vTo.optional(),tabs:gTo.optional(),pageActions:te.property("page-actions",OTo.optional()),footerNav:te.property("footer-nav",ATo.optional()),languageSwitcher:te.property("language-switcher",mTo.optional()),productSwitcher:te.property("product-switcher",PTo.optional())});var wTo=te.object({intercom:te.string().optional()});var ETo=te.undiscriminatedUnion([te.string(),te.list(te.string())]);var wJn=te.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var STo=te.object({url:te.string(),strategy:wJn.optional()});var MTo=te.object({path:te.string(),strategy:wJn.optional()});var DTo=te.undiscriminatedUnion([te.string(),MTo]);var tUa=te.undiscriminatedUnion([STo,DTo]);var BTo=te.undiscriminatedUnion([tUa,te.list(tUa)]);var Uwp=te.object({instances:te.list(w1o),title:te.string().optional(),analytics:A1o.optional(),announcement:Y9i.optional(),roles:te.list(rfn).optional(),tabs:te.record(zje,X9i).optional(),versions:te.list(OJn).optional(),products:te.list(B1o).optional(),landingPage:te.property("landing-page",Fje.optional()),navigation:Z9i.optional(),navbarLinks:te.property("navbar-links",te.list(U1o).optional()),footerLinks:te.property("footer-links",L1o.optional()),pageActions:te.property("page-actions",H1o.optional()),experimental:x1o.optional(),defaultLanguage:te.property("default-language",_1o.optional()),languages:te.list(bJn).optional(),aiChat:te.property("ai-chat",eUa.optional()),aiSearch:te.property("ai-search",eUa.optional()),metadata:Z1o.optional(),redirects:te.list(k1o).optional(),logo:eTo.optional(),favicon:te.string().optional(),backgroundImage:te.property("background-image",rTo.optional()),colors:nTo.optional(),typography:sTo.optional(),layout:pTo.optional(),settings:yTo.optional(),theme:jTo.optional(),integrations:wTo.optional(),css:ETo.optional(),js:BTo.optional()});var Lwp=te.object({tabs:te.record(zje,X9i).optional(),landingPage:te.property("landing-page",Fje.optional()),navigation:Z9i});var ITo=te.object({version:te.string(),package:te.string()});var Qje=te.undiscriminatedUnion([te.string(),ITo]);var CTo=te.object({python:Qje.optional(),typescript:Qje.optional(),go:Qje.optional(),java:Qje.optional(),ruby:Qje.optional(),csharp:Qje.optional(),php:Qje.optional(),swift:Qje.optional(),rust:Qje.optional()});var qTo=te.object({href:te.string().optional()});var BHt=te.object({environments:te.list(te.string()).optional(),button:qTo.optional(),oauth:te.boolean().optional(),limitWebsocketMessagesPerConnection:te.property("limit-websocket-messages-per-connection",te.number().optional()),hidden:te.boolean().optional()});var TTo=te.object({api:te.string(),apiName:te.property("api-name",te.string().optional()),openrpc:te.string().optional(),audiences:EHt.optional(),displayErrors:te.property("display-errors",te.boolean().optional()),tagDescriptionPages:te.property("tag-description-pages",te.boolean().optional()),snippets:CTo.optional(),postman:te.string().optional(),summary:te.string().optional(),layout:te.list(te.lazy(()=>IHt)).optional(),collapsed:te.boolean().optional(),icon:te.string().optional(),slug:te.string().optional(),hidden:te.boolean().optional(),availability:a8.optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),alphabetized:te.boolean().optional(),flattened:te.boolean().optional(),paginated:te.boolean().optional(),playground:BHt.optional()}).extend(l0).extend(f0);var EJn=te.object({link:te.string(),href:te.string(),icon:te.string().optional(),target:Nje.optional()});var RTo=te.object({changelog:vJn,title:te.string().optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional()}).extend(l0).extend(f0);var zTo=te.object({folder:te.string(),title:te.string().optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),collapsed:te.boolean().optional(),availability:a8.optional()}).extend(l0).extend(f0);var SHt=te.undiscriminatedUnion([Fje,te.lazyObject(()=>NTo),TTo,EJn,RTo,zTo]);var NTo=te.object({section:te.string(),path:te.string().optional(),contents:te.list(te.lazy(()=>SHt)),collapsed:te.boolean().optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),availability:a8.optional()}).extend(l0).extend(f0);var FTo=te.object({endpoint:te.string(),title:te.string().optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),availability:a8.optional(),playground:BHt.optional()}).extend(l0).extend(f0);var IHt=te.undiscriminatedUnion([te.string(),te.record(te.string(),te.lazy(()=>UTo)),te.lazyObject(()=>QTo),FTo,Fje,EJn]);var QTo=te.object({section:te.string(),referencedPackages:te.property("referenced-packages",te.list(te.string()).optional()),summary:te.string().optional(),contents:te.list(te.lazy(()=>IHt)).optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),availability:a8.optional(),playground:BHt.optional()}).extend(l0).extend(f0);var UTo=te.undiscriminatedUnion([te.list(te.lazy(()=>IHt)),te.lazyObject(()=>LTo)]);var LTo=te.object({title:te.string().optional(),summary:te.string().optional(),contents:te.list(te.lazy(()=>IHt)).optional(),availability:a8.optional(),slug:te.string().optional(),icon:te.string().optional(),hidden:te.boolean().optional(),skipSlug:te.property("skip-slug",te.boolean().optional()),playground:BHt.optional()}).extend(l0).extend(f0);var VTo=te.object({displayName:te.property("display-name",te.string()),path:te.string(),slug:te.string().optional()}).extend(l0).extend(f0);var WTo=te.object({href:te.string()});var Vwp=te.undiscriminatedUnion([VTo,WTo]);var Wwp=te.object({tabs:te.record(zje,X9i).optional(),landingPage:te.property("landing-page",Fje.optional()),navigation:Z9i});var Gwp=require("fs/promises");var yKE=/\r?\n/;async function ifn({absolutePathToFernignore:e}){let t=(await(0,Gwp.readFile)(e)).toString();return Hwp(t)}function Hwp(e){return[gHt,...e.trim().split(yKE).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var _n={};Zt(_n,{API_ORIGIN_LOCATION_KEY:()=>xPp,API_SETTINGS_KEY:()=>YPp,ASYNC_API_LOCATION_KEY:()=>KPp,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>$Kn,DEFAULT_GROUP_NAME:()=>IQa,DefaultIntegerFormat:()=>rEp,ExampleStyle:()=>Ywp,FormParameterEncoding:()=>tEp,GenerationLanguage:()=>xwp,GithubCommitAndReleaseMode:()=>aEp,GithubLicenseType:()=>oEp,GithubSelfhostedMode:()=>nEp,Language:()=>iEp,MessageNamingSettingsSchema:()=>eEp,ModelProvider:()=>$wp,OPENAPI_LOCATION_KEY:()=>JPp,OPENAPI_OVERRIDES_LOCATION_KEY:()=>$Pp,PathParameterOrder:()=>Zwp,RemoveDiscriminantsFromSchemas:()=>Xwp,UnionSettingsSchema:()=>kwp,ai:()=>src,fernDefinition:()=>prc,generators:()=>crc,getPackageName:()=>Kwp,group:()=>lrc,isApiConfigurationV2Schema:()=>HEp,isAsyncApiSpecSchema:()=>xEp,isConjureSchema:()=>KEp,isNamespacedApiConfiguration:()=>JEp,isOpenApiSpecSchema:()=>$Ep,isOpenRpcSpecSchema:()=>YEp,isProtoSpecSchema:()=>XEp,isRawProtobufAPIDefinitionSchema:()=>Jwp,license:()=>frc,reviewers:()=>uEp,serialization:()=>qrc});var xwp={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function Kwp({generatorInvocation:e}){return e.language==="go"?bKE(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function bKE(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function Jwp(e){return typeof e!="string"&&"proto"in e}var src={};Zt(src,{ModelProvider:()=>$wp});var $wp={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var crc={};Zt(crc,{DefaultIntegerFormat:()=>rEp,ExampleStyle:()=>Ywp,FormParameterEncoding:()=>tEp,Language:()=>iEp,MessageNamingSettingsSchema:()=>eEp,PathParameterOrder:()=>Zwp,RemoveDiscriminantsFromSchemas:()=>Xwp,UnionSettingsSchema:()=>kwp});var Ywp={Minimal:"minimal",Comprehensive:"comprehensive"};var Xwp={Always:"always",Never:"never"};var Zwp={UrlOrder:"url-order",SpecOrder:"spec-order"};var kwp={V1:"v1"};var eEp={V1:"v1",V2:"v2"};var tEp={Form:"form",Json:"json"};var rEp={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var iEp={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var lrc={};Zt(lrc,{GithubCommitAndReleaseMode:()=>aEp,GithubSelfhostedMode:()=>nEp});var nEp={PullRequest:"pull-request",Push:"push"};var aEp={Commit:"commit",Release:"release"};var frc={};Zt(frc,{GithubLicenseType:()=>oEp});var oEp={Mit:"MIT",Apache:"Apache-2.0"};var uEp={};var prc={};Zt(prc,{AvailabilityStatusSchema:()=>cEp,auth:()=>sEp,availability:()=>drc,commons:()=>lEp,encoding:()=>fEp,environments:()=>dEp,file:()=>pEp,service:()=>_Ep,types:()=>hEp,validation:()=>yEp});var sEp={};var drc={};Zt(drc,{AvailabilityStatusSchema:()=>cEp});var cEp={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var lEp={};var fEp={};var dEp={};var pEp={};var _Ep={};var hEp={};var yEp={};var qrc={};Zt(qrc,{AiServicesSchema:()=>YTo,ApiConfigurationSchema:()=>ZRo,ApiConfigurationSchemaInternal:()=>FJn,ApiConfigurationV2Schema:()=>XRo,ApiConfigurationV2SettingsSchema:()=>GJn,ApiConfigurationV2SpecsSchema:()=>WJn,ApiDefinitionList:()=>hRo,ApiDefinitionPathSchema:()=>nGi,ApiDefinitionSchema:()=>_Ro,ApiDefinitionSettingsSchema:()=>TJn,ApiDefinitionWithOverridesSchema:()=>RJn,AsyncApiSettingsSchema:()=>VJn,AsyncApiSpecSchema:()=>MRo,BaseApiSettingsSchema:()=>LJn,ConjureSchema:()=>CRo,CratesOutputLocationSchema:()=>yzo,DefaultIntegerFormat:()=>ERo,ExampleStyle:()=>azo,FormParameterEncoding:()=>ARo,GeneratorApiSettingsSchema:()=>Mzo,GeneratorGroupSchema:()=>Bzo,GeneratorInvocationSchema:()=>Dzo,GeneratorOutputSchema:()=>bzo,GeneratorPublishMetadataSchema:()=>sUa,GeneratorSnippetsSchema:()=>Szo,GeneratorsConfigurationSchema:()=>GEp,GeneratorsOpenApiObjectSchema:()=>Izo,GeneratorsOpenApiSchema:()=>Czo,GithubCommitAndReleaseMode:()=>mzo,GithubCommitAndReleaseSchema:()=>Pzo,GithubConfigurationSchema:()=>Ezo,GithubLicenseCustomSchema:()=>Ozo,GithubLicenseSchema:()=>Uje,GithubLicenseType:()=>gzo,GithubPullRequestSchema:()=>jzo,GithubPushSchema:()=>wzo,GithubSelfhostedMode:()=>vzo,GithubSelfhostedSchema:()=>Azo,Language:()=>izo,LocalFileSystemOutputLocationSchema:()=>pzo,MavenOutputLocationSchema:()=>czo,MavenOutputSignatureSchema:()=>szo,MessageNamingSettingsSchema:()=>IJn,ModelName:()=>$To,ModelProvider:()=>JTo,NamespacedApiConfigurationSchema:()=>yRo,NpmOutputLocationSchema:()=>uzo,NugetOutputLocationSchema:()=>_zo,OpenApiExampleGenerationSchema:()=>PRo,OpenApiFilterSchema:()=>mRo,OpenApiSettingsSchema:()=>aGi,OpenApiSpecSchema:()=>SRo,OpenRpcSpecSchema:()=>BRo,OutputMetadataAuthor:()=>tzo,OutputMetadataSchema:()=>uGi,PathParameterOrder:()=>qJn,PostmanOutputLocationSchema:()=>dzo,ProtobufApiDefinitionSchema:()=>NJn,ProtobufDefinitionSchema:()=>zJn,ProtobufSpecSchema:()=>DRo,PypiOutputLocationSchema:()=>fzo,PypiOutputMetadataSchema:()=>lzo,ReadmeCustomSectionSchema:()=>nzo,ReadmeEndpointObjectSchema:()=>rzo,ReadmeEndpointSchema:()=>oUa,ReadmeSchema:()=>ozo,RemoveDiscriminantsFromSchemas:()=>CJn,RequestOrResponseExampleGenerationSchema:()=>aUa,ResolveAliases:()=>wRo,ResolveAliasesSchema:()=>jRo,ReviewerSchema:()=>uUa,ReviewersSchema:()=>sGi,RubyGemsOutputLocationSchema:()=>hzo,SpecSchema:()=>IRo,UnionSettingsSchema:()=>pRo,WhitelabelConfigurationSchema:()=>ezo,WhitelabelGithubConfigurationSchema:()=>kRo,ai:()=>vrc,fernDefinition:()=>Crc,generators:()=>grc,group:()=>Orc,license:()=>Arc,reviewers:()=>mrc});var vrc={};Zt(vrc,{AiServicesSchema:()=>YTo,ModelName:()=>$To,ModelProvider:()=>JTo});var fe={};Zt(fe,{JsonError:()=>SJn,ParseError:()=>MJn,any:()=>IEp,bigint:()=>vEp,boolean:()=>CEp,booleanLiteral:()=>BEp,date:()=>gEp,discriminant:()=>LEp,enum_:()=>HTo,getObjectLikeUtils:()=>TLt,getObjectUtils:()=>nfn,getSchemaUtils:()=>YA,isProperty:()=>tGi,lazy:()=>OEp,lazyObject:()=>SEp,list:()=>KTo,number:()=>qEp,object:()=>xTo,objectWithoutOptionalProperties:()=>EEp,optional:()=>_rc,property:()=>mEp,record:()=>NEp,set:()=>FEp,string:()=>TEp,stringLiteral:()=>DEp,transform:()=>hrc,undiscriminatedUnion:()=>UEp,union:()=>WEp,unknown:()=>REp,withParsedProperties:()=>brc});var lp={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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function $A(e,t){return`Expected ${t}. Received ${vKE(e)}.`}function vKE(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 iN(e){return{...e,json:bEp(e.json),parse:bEp(e.parse)}}function bEp(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(`
@@ -1145,7 +1145,7 @@ ${wC_.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&Tjc(th
1145
1145
  `+m_n.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?m_n.default.cyan(TC_(t,this.opt.mask)):m_n.default.italic(m_n.default.dim("[hidden]")):this.opt.mask?TC_(t,this.opt.mask):m_n.default.italic(m_n.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var f7o=ce(eR(),1);var Tq_=ce(h0c(),1),c7o=require("child_process"),ckn=require("fs"),s7o=ce(require("path"),1),Rq_=ce(require("os"),1),zq_=require("crypto"),k0c=ce(Cq_(),1);var a7o=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var FWa=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var o7o=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var u7o=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function l7o(e="",t,r){let i=new ewc(e,r);i.runAsync((n,a)=>{if(n)setImmediate(t,n,void 0);else try{i.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function qq_(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function QKM(e){let t=[],r="";for(let i=0;i<e.length;i++){let n=e.charAt(i);i>0&&n===" "&&e[i-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${n}`}return r.length>0&&t.push(r),t}var ewc=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=QKM(t).map(n=>n.replace("\\ "," ")),i=r.shift();this.editor={args:r,bin:i}}createTemporaryFile(){try{let t=this.fileOptions.dir??Rq_.default.tmpdir(),r=(0,zq_.randomUUID)(),i=qq_(this.fileOptions.prefix),n=qq_(this.fileOptions.postfix),a=`${i}${r}${n}`,o=s7o.default.resolve(t,a),c=s7o.default.resolve(t)+s7o.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let d={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(d.mode=this.fileOptions.mode),(0,ckn.writeFileSync)(this.tempFile,this.text,d)}catch(t){throw new a7o(t)}}readTemporaryFile(){try{let t=(0,ckn.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,Tq_.detect)(t)??"utf8";k0c.default.encodingExists(r)||(r="utf8"),this.text=k0c.default.decode(t,r)}}catch(t){throw new o7o(t)}}removeTemporaryFile(){try{(0,ckn.unlinkSync)(this.tempFile)}catch(t){throw new u7o(t)}}launchEditor(){try{let t=(0,c7o.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new FWa(t)}}launchEditorAsync(t){try{(0,c7o.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",i=>{this.lastExitStatus=i,setImmediate(t)})}catch(r){throw new FWa(r)}}};var Nq_=ce(ive(),1);var QWa=class extends tR{_run(t){this.done=t,this.editorResult=new Nq_.Subject;let r=F4(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"?f7o.default.dim("Received"):f7o.default.dim("Press <enter> to launch your preferred editor."),t&&(r=f7o.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),l7o(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 Vq_=require("stream");var Uq_=ce(require("readline"),1),Lq_=ce(Qq_(),1),E_n=class{constructor(t){this.rl||=Uq_.default.createInterface(LKM(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 LKM(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 Lq_.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var UWa=class extends E_n{constructor(t={}){super(t),this.log=new Vq_.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return PWa(this.rl,this.bottomBar.split(`
1146
1146
  `).length),this}updateBottomBar(t){return PWa(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+`
1147
1147
  `}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&&qHo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var kO=ce(ive(),1),Hq_=ce(G8a(),1);var d7o=ce(ive(),1),Wq_=ce(G8a(),1),p7o=function(e,t,r){return typeof e[t]!="function"?(0,d7o.of)(e):(0,d7o.from)((0,Wq_.default)(e[t])(r).then(i=>(e[t]=i,e)))};var Gq_={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,o)=>{n==="__proto__"||n==="constructor"||(a===o.length-1?i[n]=r:(!(n in i)||typeof i[n]!="object")&&(i[n]={}),i=i[n])})},get:(e,t="",r)=>{let i=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},lkn=class extends E_n{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let i;return Array.isArray(t)?i=(0,kO.from)(t):(0,kO.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,kO.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,kO.from)([t]),this.process=i.pipe((0,kO.concatMap)(this.processQuestion.bind(this)),(0,kO.publish)()),this.process.connect(),this.process.pipe((0,kO.reduce)((n,a)=>(Gq_.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,kO.defer)(()=>(0,kO.of)(t).pipe((0,kO.concatMap)(this.setDefaultType.bind(this)),(0,kO.concatMap)(this.filterIfRunnable.bind(this)),(0,kO.concatMap)(()=>p7o(t,"message",this.answers)),(0,kO.concatMap)(()=>p7o(t,"default",this.answers)),(0,kO.concatMap)(()=>p7o(t,"choices",this.answers)),(0,kO.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,kO.defer)(()=>(0,kO.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,kO.defer)(()=>(0,kO.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Gq_.get(this.answers,t.name)!==void 0)return kO.EMPTY;if(t.when===!1)return kO.EMPTY;if(typeof t.when!="function")return(0,kO.of)(t);let{answers:r}=this;return(0,kO.defer)(()=>(0,kO.from)((0,Hq_.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,kO.filter)(i=>i!=null)))}};function xq_(e){let t=function(r,i){let n;try{n=new lkn(t.prompts,e)}catch(o){return Promise.reject(o)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",wWa),this.registerPrompt("input",A_n),this.registerPrompt("number",EWa),this.registerPrompt("confirm",SWa),this.registerPrompt("rawlist",MWa),this.registerPrompt("expand",DWa),this.registerPrompt("checkbox",BWa),this.registerPrompt("password",IWa),this.registerPrompt("editor",QWa)},t.restoreDefaultPrompts(),t}var rwc=xq_();function WKM(e,t){rwc.registerPrompt(e,t)}function GKM(){rwc.restoreDefaultPrompts()}var HKM={prompt:rwc,ui:{BottomBar:UWa,Prompt:lkn},createPromptModule:xq_,registerPrompt:WKM,restoreDefaultPrompts:GKM,Separator:d$},_7o=HKM;var fkn=require("path");function Jq_(){let e=xKM();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function xKM(e=process.argv[1]?(0,fkn.dirname)(process.argv[1]):process.cwd(),t=fkn.sep==="\\"){let r=t?Kq_(e):e;return i=>{if(!i)return;let n=t?Kq_(i):i,{dir:a,base:o,ext:c}=fkn.posix.parse(n);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,-1*c.length));let d=decodeURIComponent(o);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let u=a.slice(r.length+1).replace(/\//g,".");return u?`${u}:${d}`:d}return d}}function Kq_(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var iwc=e=>{if("flags"in e){let t=$q_(e.flags),r=Yq_(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,Xq_(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,KKM(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function KKM(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var $q_=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,S_n(r)]).filter(([,t])=>t!==void 0)),Yq_=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let i=t[r];return i.enabled&&i.metadata&&i.metadata.payload!==void 0}).map(r=>{let i=t[r].metadata?.payload;return[r,i?Xq_(i):void 0]}))};var S_n=e=>e===void 0?void 0:e.variant??e.enabled,Xq_=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};var h7o="0123456789abcdef",y7o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}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/256,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;default: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)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=h7o.charAt(this.bytes[r]>>>4),t+=h7o.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=h7o.charAt(this.bytes[r]>>>4),t+=h7o.charAt(15&this.bytes[r]);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}},nwc=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??JKM()}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))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return y7o.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}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,y7o.ofInner(t)}},JKM=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),Zq_,HJt=()=>$KM().toString(),$KM=()=>(Zq_||(Zq_=new nwc)).generate();var YKM=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],kq_=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return YKM.concat(t).some(i=>{let n=i.toLowerCase();return r.indexOf(n)!==-1})};var _$=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e})({});var ZKM=Array.isArray,e1_=Object.prototype,RA9=e1_.hasOwnProperty,awc=e1_.toString,t1_=ZKM||function(e){return awc.call(e)==="[object Array]"};var dkn=e=>e===void 0,LWa=e=>awc.call(e)=="[object String]",r1_=e=>LWa(e)&&e.trim().length===0;var i1_=e=>awc.call(e)=="[object Number]";var owc=e=>e instanceof Error;function kKM(e,t){try{return e instanceof t}catch{return!1}}function VWa(e){return e===null||typeof e!="object"}function M_n(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function n1_(e){return M_n(e,"ErrorEvent")}function b7o(e){return!dkn(Event)&&kKM(e,Event)}function a1_(e){return M_n(e,"Object")}function WWa(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),i1_(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),WWa(n||r,t,r,i))}var eJM=864e5,v7o=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=WWa(t.bucketSize,0,100,t._logger),this._refillRate=WWa(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=WWa(t.refillInterval,0,eJM,t._logger)}_applyRefill(t,r){let i=r-t.lastAccess,n=Math.floor(i/this._refillInterval);if(n>0){let a=n*this._refillRate;t.tokens=Math.min(t.tokens+a,this._bucketSize),t.lastAccess=t.lastAccess+n*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),i=String(t),n=this._buckets[i];return n?this._applyRefill(n,r):(n={tokens:this._bucketSize,lastAccess:r},this._buckets[i]=n),n.tokens===0?!0:(n.tokens--,n.tokens===0&&this._onBucketRateLimited?.(t),n.tokens===0)}stop(){this._buckets={}}};var g7o=class{add(t){let r=HJt();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function tJM(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var o1_=(e,t,r)=>{function i(a,...o){t(()=>{let c=r[a];c(e,...o)})}return{info:(...a)=>{i("log",...a)},warn:(...a)=>{i("warn",...a)},error:(...a)=>{i("error",...a)},critical:(...a)=>{r.error(e,...a)},createLogger:a=>o1_(`${e} ${a}`,t,r)}},rJM=e=>e();function u1_(e,t=rJM){return o1_(e,t,tJM())}var _kn="Mobile",A7o="iOS",pkn="Android",s1_="Tablet",KA9=pkn+" "+s1_;var iJM="Apple",JA9=iJM+" Watch",c1_="Safari",m7o="BlackBerry",l1_="Samsung",nJM=l1_+"Browser",aJM=l1_+" Internet",P7o="Chrome",oJM=P7o+" OS",uJM=P7o+" "+A7o,f1_="Internet Explorer",sJM=f1_+" "+_kn,swc="Opera",$A9=swc+" Mini",d1_="Edge",cJM="Microsoft "+d1_,cwc="Firefox",lJM=cwc+" "+A7o,lwc="Nintendo",fwc="PlayStation",O7o="Xbox",fJM=pkn+" "+_kn,dJM=_kn+" "+c1_,GWa="Windows",pJM=GWa+" Phone";var p1_="Generic",YA9=p1_+" "+_kn.toLowerCase(),XA9=p1_+" "+s1_.toLowerCase(),_JM="Konqueror",IG="(\\d+(\\.\\d+)?)",uwc=new RegExp("Version/"+IG),ZA9=new RegExp(O7o,"i"),kA9=new RegExp(fwc+" \\w+","i"),em9=new RegExp(lwc+" \\w+","i"),hJM=new RegExp(m7o+"|PlayBook|BB10","i"),yJM={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var tm9={[sJM]:[new RegExp("rv:"+IG)],[cJM]:[new RegExp(d1_+"?\\/"+IG)],[P7o]:[new RegExp("("+P7o+"|CrMo)\\/"+IG)],[uJM]:[new RegExp("CriOS\\/"+IG)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+IG)],[c1_]:[uwc],[dJM]:[uwc],[swc]:[new RegExp("("+swc+"|OPR)\\/"+IG)],[cwc]:[new RegExp(cwc+"\\/"+IG)],[lJM]:[new RegExp("FxiOS\\/"+IG)],[_JM]:[new RegExp("Konqueror[:/]?"+IG,"i")],[m7o]:[new RegExp(m7o+" "+IG),uwc],[fJM]:[new RegExp("android\\s"+IG,"i")],[aJM]:[new RegExp(nJM+"\\/"+IG)],[f1_]:[new RegExp("(rv:|MSIE )"+IG)],Mozilla:[new RegExp("rv:"+IG)]};var rm9=[[new RegExp(O7o+"; "+O7o+" (.*?)[);]","i"),e=>[O7o,e&&e[1]||""]],[new RegExp(lwc,"i"),[lwc,""]],[new RegExp(fwc,"i"),[fwc,""]],[hJM,[m7o,""]],[new RegExp(GWa,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[pJM,""];if(new RegExp(_kn).test(t)&&!/IEMobile\b/.test(t))return[GWa+" "+_kn,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let i=r[1],n=yJM[i]||"";return/arm/i.test(t)&&(n="RT"),[GWa,n]}return[GWa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[A7o,t.join(".")]}return[A7o,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=dkn(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+pkn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+pkn+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[pkn,t.join(".")]}return[pkn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[oJM,""]],[/Linux|debian/i,["Linux",""]]];var _1_="utf8";function h1_(e,t){if(!e||typeof e!="string"||bJM(e))throw new Error(t)}function bJM(e){return e.trim().length===0}function y1_(e){return e?.replace(/\/+$/,"")}async function b1_(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 j7o(){return new Date().toISOString()}function D_n(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var v1_=e=>e instanceof Error;function dwc(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var w7o=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)}};function g1_(){return"CompressionStream"in globalThis}async function pwc(e,t=!0){try{let i=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(i).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var hkn=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},HWa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function O1_(e){if(e instanceof hkn){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function _wc(e){return typeof e=="object"&&(e instanceof hkn||e instanceof HWa)}function A1_(e){return typeof e=="object"&&e instanceof hkn&&e.status===413}var xWa=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new g7o,this._events=new w7o,this._isInitialized=!1,h1_(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=y1_(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.preloadFeatureFlags=r.preloadFeatureFlags??!0,this.defaultOptIn=r.defaultOptIn??!0,this.disableSurveys=r.disableSurveys??!1,this._retryOptions={retryCount:r.fetchRetryCount??3,retryDelay:r.fetchRetryDelay??3e3,retryCheck:_wc},this.requestTimeout=r.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r.disableGeoip??!0,this.disabled=r.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this.evaluationEnvironments=r?.evaluationEnvironments,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=u1_("[PostHog]",this.logMsgIfDebug.bind(this)),this.disableCompression=!g1_()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(_$.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(_$.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(_$.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>this._logger.info(i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){return this.promiseQueue.add(t)}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}async identifyStatelessImmediate(t,r,i){let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",n,i)}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}async captureStatelessImmediate(t,r,i,n){let a=this.buildPayload({distinct_id:t,event:r,properties:i});await this.sendImmediate("capture",a,n)}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}async aliasStatelessImmediate(t,r,i,n){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,n)}groupIdentifyStateless(t,r,i,n,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...o||{}}});this.enqueue("capture",c,n)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,i,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(n=>n.json()).catch(n=>{this._logger.error("Remote config could not be loaded",n),this._events.emit("error",n)})}async getFlags(t,r={},i={},n={},a={},o=!0){await this._initPromise;let c=o?"&config=true":"",d=`${this.host}/flags/?v=2${c}`,s={token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a};this.evaluationEnvironments&&this.evaluationEnvironments.length>0&&(s.evaluation_environments=this.evaluationEnvironments);let u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(s)};return this._logger.info("Flags URL",d),this.fetchWithRetry(d,u,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(l=>l.json()).then(l=>iwc(l)).catch(l=>{this._events.emit("error",l)})}async getFeatureFlagStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,i,n,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let d=S_n(c.response);return d===void 0&&(d=!1),{response:d,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,i,n,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId,evaluatedAt:c.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,i,n,a,o,[t]);if(!c)return;let d=c[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let d=await this.getFlags(t,r,i,n,c);if(d!==void 0)return d.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),d.quotaLimited?.includes("feature_flags")?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:d?.requestId}):d}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this._logger.info("Loading surveys is disabled."),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this._logger.error(c),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this._logger.error("Surveys API could not be loaded",a),this._events.emit("error",a)}))?.surveys;return n&&this._logger.info("Surveys fetched from API: ",JSON.stringify(n)),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(_$.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(_$.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(_$.Props,this.props)})}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let n=this.prepareMessage(t,r,i),a=this.getPersistedProperty(_$.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),a.push({message:n}),this.setPersistedProperty(_$.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=D_n(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,i){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let n={api_key:this.apiKey,batch:[this.prepareMessage(t,r,i)],sent_at:j7o()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),o=`${this.host}/batch/`,c=this.disableCompression?null:await pwc(a,this.isDebug),d={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...c!==null&&{"Content-Encoding":"gzip"}},body:c||a};try{await this.fetchWithRetry(o,d)}catch(s){this._events.emit("error",s)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:j7o(),uuid:i?.uuid?i.uuid:HJt()};return(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId),n}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await O1_(t)})}async flush(){let t=dwc([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),dwc([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(_$.Queue)||[];if(!t.length)return;let r=[],i=t.length;for(;t.length>0&&r.length<i;){let n=t.slice(0,this.maxBatchSize),a=n.map(_=>_.message),o=()=>{let h=(this.getPersistedProperty(_$.Queue)||[]).slice(n.length);this.setPersistedProperty(_$.Queue,h),t=h},c={api_key:this.apiKey,batch:a,sent_at:j7o()};this.historicalMigration&&(c.historical_migration=!0);let d=JSON.stringify(c),s=`${this.host}/batch/`,u=this.disableCompression?null:await pwc(d,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...u!==null&&{"Content-Encoding":"gzip"}},body:u||d},p={retryCheck:_=>A1_(_)?!1:_wc(_)};try{await this.fetchWithRetry(s,l,p)}catch(_){if(A1_(_)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this._logger.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw _ instanceof HWa||o(),this._events.emit("error",_),_}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){AbortSignal.timeout??=function(c){let d=new AbortController;return setTimeout(()=>d.abort(),c),d.signal};let a=r.body?r.body:"",o=-1;try{o=a instanceof Blob?a.size:Buffer.byteLength(a,_1_)}catch{a instanceof Blob?o=a.size:o=new TextEncoder().encode(a).length}return await b1_(async()=>{let c=null;try{c=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(s){throw new HWa(s)}if(!(r.mode==="no-cors")&&(c.status<200||c.status>=400))throw new hkn(c,o);return c},{...this._retryOptions,...i})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(_$.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!_wc(n))throw n;await O1_(n)}};return Promise.race([new Promise((n,a)=>{D_n(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),i()])}async shutdown(t=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}};var h$={};Zt(h$,{DOMExceptionCoercer:()=>ywc,ErrorCoercer:()=>bwc,ErrorEventCoercer:()=>vwc,ErrorPropertiesBuilder:()=>hwc,EventCoercer:()=>Awc,ObjectCoercer:()=>Owc,PrimitiveCoercer:()=>mwc,PromiseRejectionEventCoercer:()=>Pwc,ReduceableCache:()=>jwc,StringCoercer:()=>gwc,chromeStackLineParser:()=>j1_,createStackParser:()=>IJM,geckoStackLineParser:()=>E1_,nodeStackLineParser:()=>B1_,opera10StackLineParser:()=>S1_,opera11StackLineParser:()=>M1_,reverseAndStripFrames:()=>q1_,winjsStackLineParser:()=>w1_});var E7o,m1_,S7o;function P1_(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return S7o&&r.length===m1_||(m1_=r.length,S7o=r.reduce((i,n)=>{E7o||(E7o={});let a=E7o[n];if(a)i[a[0]]=a[1];else{let o=e(n);for(let c=o.length-1;c>=0;c--){let s=o[c]?.filename,u=t[n];if(s&&u){i[s]=u,E7o[n]=[s,u];break}}}return i},{})),S7o}var vJM=4,hwc=class{constructor(t,r,i=[]){this.coercers=t,this.stackParser=r,this.modifiers=i}buildFromUnknown(t,r={}){let n=r&&r.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(n,r,0).apply(t),c=this.buildParsingContext(),d=this.parseStacktrace(o,c);return{$exception_list:this.convertToExceptionList(d,n),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&t1_(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let i;t.cause!=null&&(i=this.parseStacktrace(t.cause,r));let n;return t.stack!=""&&t.stack!=null&&(n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),r.chunkIdMap)),{...t,cause:i,stack:n}}applyChunkIds(t,r){return t.map(i=>(i.filename&&r&&(i.chunk_id=r[i.filename]),i))}applyCoercers(t,r){for(let i of this.coercers)if(i.match(t))return i.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let i of this.modifiers)r=await i(r);return r}convertToExceptionList(t,r){let i={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(i.stacktrace={type:"raw",frames:t.stack});let n=[i];return t.cause!=null&&n.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),n}buildParsingContext(){return{chunkIdMap:P1_(this.stackParser)}}buildCoercingContext(t,r,i=0){let n=(o,c)=>{if(c<=vJM){let d=this.buildCoercingContext(t,r,c);return this.applyCoercers(o,d)}};return{...r,syntheticException:i==0?r.syntheticException:void 0,mechanism:t,apply:o=>n(o,i),next:o=>n(o,i+1)}}};var U4="?";function xJt(e,t,r,i,n){let a={platform:e,filename:t,function:r==="<anonymous>"?U4:r,in_app:!0};return dkn(i)||(a.lineno=i),dkn(n)||(a.colno=n),a}var M7o=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return r||i?[e.indexOf("@")!==-1?e.split("@")[0]:U4,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var gJM=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,OJM=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,AJM=/\((\S*)(?::(\d+))(?::(\d+))\)/,j1_=(e,t)=>{let r=gJM.exec(e);if(r){let[,n,a,o]=r;return xJt(t,n,U4,+a,+o)}let i=OJM.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){let c=AJM.exec(i[2]);c&&(i[2]=c[1],i[3]=c[2],i[4]=c[3])}let[a,o]=M7o(i[1]||U4,i[2]);return xJt(t,o,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}};var mJM=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,w1_=(e,t)=>{let r=mJM.exec(e);return r?xJt(t,r[2],r[1]||U4,+r[3],r[4]?+r[4]:void 0):void 0};var PJM=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,jJM=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,E1_=(e,t)=>{let r=PJM.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let o=jJM.exec(r[3]);o&&(r[1]=r[1]||"eval",r[3]=o[1],r[4]=o[2],r[5]="")}let n=r[3],a=r[1]||U4;return[a,n]=M7o(a,n),xJt(t,n,a,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var wJM=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,S1_=(e,t)=>{let r=wJM.exec(e);return r?xJt(t,r[2],r[3]||U4,+r[1]):void 0},EJM=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,M1_=(e,t)=>{let r=EJM.exec(e);return r?xJt(t,r[5],r[3]||r[4]||U4,+r[1],+r[2]):void 0};var SJM=/^\s*[-]{4,}$/,MJM=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,B1_=(e,t)=>{let r=e.match(MJM);if(r){let i,n,a,o,c;if(r[1]){a=r[1];let u=a.lastIndexOf(".");if(a[u-1]==="."&&u--,u>0){i=a.slice(0,u),n=a.slice(u+1);let l=i.indexOf(".Module");l>0&&(a=a.slice(l+1),i=i.slice(0,l))}o=void 0}n&&(o=i,c=n),n==="<anonymous>"&&(c=void 0,a=void 0),a===void 0&&(c=c||U4,a=o?`${o}.${c}`:c);let d=r[2]?.startsWith("file://")?r[2].slice(7):r[2],s=r[5]==="native";return d?.match(/\/[A-Z]:/)&&(d=d.slice(1)),!d&&r[5]&&!s&&(d=r[5]),{filename:d?decodeURI(d):void 0,module:void 0,function:a,lineno:D1_(r[3]),colno:D1_(r[4]),in_app:DJM(d||"",s),platform:t}}if(e.match(SJM))return{filename:e,platform:t}};function DJM(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function D1_(e){return parseInt(e||"",10)||void 0}var I1_=/\(error: (.*)\)/,C1_=50;function q1_(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,C1_).map(r=>({...r,filename:r.filename||BJM(t).filename,function:r.function||U4}))}function BJM(e){return e[e.length-1]||{}}function IJM(e,...t){return(r,i=0)=>{let n=[],a=r.split(`
1148
- `);for(let o=i;o<a.length;o++){let c=a[o];if(c.length>1024)continue;let d=I1_.test(c)?c.replace(I1_,"$1"):c;if(!d.match(/\S*Error: /)){for(let s of t){let u=s(d,e);if(u){n.push(u);break}}if(n.length>=C1_)break}}return q1_(n)}}var ywc=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let i=LWa(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return M_n(t,"DOMException")}isDOMError(t){return M_n(t,"DOMError")}};var bwc=class{match(t){return owc(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let i=t.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(t){return t.stacktrace||t.stack||void 0}};var vwc=class{constructor(){}match(t){return n1_(t)&&t.error!=null}coerce(t,r){let i=r.apply(t.error);return i||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var CJM=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,gwc=class{match(t){return typeof t=="string"}coerce(t,r){let[i,n]=this.getInfos(t);return{type:i??"Error",value:n??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",i=t,n=t.match(CJM);return n&&(r=n[1],i=n[2]),[r,i]}};var T1_=["fatal","error","warning","log","info","debug"];function D7o(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let i=r.length;i>0;i--){let n=r.slice(0,i).join(", ");if(!(n.length>t))return i===r.length||n.length<=t?n:`${n.slice(0,t)}...`}return""}var Owc=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let i=this.getErrorPropertyFromObject(t);return i?r.apply(i):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return b7o(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let n=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(n+=` with message: '${t.message}'`),n}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),i=D7o(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${i}`}isSeverityLevel(t){return LWa(t)&&!r1_(t)&&T1_.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(v1_(i))return i}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var Awc=class{match(t){return b7o(t)}coerce(t,r){let i=t.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${D7o(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var mwc=class{match(t){return VWa(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Pwc=class{match(t){return M_n(t,"PromiseRejectionEvent")}coerce(t,r){let i=this.getUnhandledRejectionReason(t);return VWa(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(i)}getUnhandledRejectionReason(t){if(VWa(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var jwc=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var N1_=require("fs"),F1_=require("readline"),B7o=new h$.ReduceableCache(25),Q1_=new h$.ReduceableCache(20),wwc=7,qJM=1e3,TJM=1e4;async function U1_(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||FJM(o)||QJM(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(Q1_.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let o=LJM(a);if(o.every(d=>UJM(n,d)))continue;let c=VJM(B7o,n,{});i.push(RJM(n,o,c))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&zJM(e,B7o),B7o.reduce(),e}function RJM(e,t,r){return new Promise(i=>{let n=(0,N1_.createReadStream)(e),a=(0,F1_.createInterface)({input:n});function o(){n.destroy(),i()}let c=0,d=0,s=t[d];if(s===void 0)return void o();let u=s[0],l=s[1];function p(){Q1_.set(e,1),a.close(),a.removeAllListeners(),o()}n.on("error",p),a.on("error",p),a.on("close",o),a.on("line",_=>{if(c++,!(c<u)&&(r[c]=WJM(_,0),c>=l)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let h=t[d];if(h===void 0){a.close(),a.removeAllListeners();return}u=h[0],l=h[1]}})})}function zJM(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;NJM(r.lineno,r,i)}}function NJM(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=L1_(e);n<e;n++){let a=r[n];if(a===void 0)return void R1_(t);t.pre_context.push(a)}if(r[e]===void 0)return void R1_(t);t.context_line=r[e];let i=V1_(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function R1_(e){delete e.pre_context,delete e.context_line,delete e.post_context}function FJM(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function QJM(e){return e.lineno!==void 0&&e.lineno>TJM||e.colno!==void 0&&e.colno>qJM}function UJM(e,t){let r=B7o.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function LJM(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=z1_(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+wwc:(n.push(i),i=z1_(a)),t++}return n}function z1_(e){return[L1_(e),V1_(e)]}function L1_(e){return Math.max(1,e-wwc)}function V1_(e){return e+wwc}function VJM(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function WJM(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}function GJM(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t(i))},{_posthogErrorHandler:!0})}function W1_(e,t){globalThis.process?.on("uncaughtException",GJM(e,t))}function G1_(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var HJM=2e3,SFi=class e{constructor(t,r,i){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=i,this._rateLimiter=new v7o({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static async buildEventMessage(t,r,i,n){let a={...n};i||(a.$process_person_profile=!1);let o=this.errorPropertiesBuilder.buildFromUnknown(t,r);return o.$exception_list=await this.errorPropertiesBuilder.modifyFrames(o.$exception_list),{event:"$exception",distinctId:i||HJt(),properties:{...o,...a}}}startAutocaptureIfEnabled(){this.isEnabled()&&(W1_(this.onException.bind(this),this.onFatalError.bind(this)),G1_(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{let i=await e.buildEventMessage(t,r),a=i.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(a)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:a}):this.client.capture(i)})())}async onFatalError(t){console.error(t),await this.client.shutdown(HJM),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var H1_="5.17.4";async function x1_(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}var xJM=6e4,KJM=1152921504606847e3,JJM=["is_not"],ykn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},v0=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},KJt=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},I7o=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=c.fetch||fetch,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.cacheProvider=c.cacheProvider,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;if(c=this.featureFlagsByKey[t],c!==void 0)try{o=(await this.computeFlagAndPayloadLocally(c,r,i,n,a)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(d){d instanceof KJt||d instanceof v0?this.logMsgIfDebug(()=>console.debug(`${d.name} when computing flag locally: ${t}: ${d.message}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return o}async getAllFlagsAndPayloads(t,r={},i={},n={},a){await this.loadFeatureFlags();let o={},c={},d=this.featureFlags.length==0,s=a?a.map(l=>this.featureFlagsByKey[l]).filter(Boolean):this.featureFlags,u={};return await Promise.all(s.map(async l=>{try{let{value:p,payload:_}=await this.computeFlagAndPayloadLocally(l,t,r,i,n,void 0,u);o[l.key]=p,_&&(c[l.key]=_)}catch(p){p instanceof KJt||p instanceof v0?this.logMsgIfDebug(()=>console.debug(`${p.name} when computing flag locally: ${l.key}: ${p.message}`)):p instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${l.key}: ${p}`)),d=!0}})),{response:o,payloads:c,fallbackToFlags:d}}async computeFlagAndPayloadLocally(t,r,i={},n={},a={},o,c,d=!1){if(d||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=o!==void 0?o:await this.computeFlagValueLocally(t,r,i,n,a,c);let u=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:u}}async computeFlagValueLocally(t,r,i={},n={},a={},o={}){if(t.ensure_experience_continuity)throw new v0("Flag has experience continuity enabled");if(!t.active)return!1;let d=(t.filters||{}).aggregation_group_type_index;if(d==null)return await this.matchFeatureFlagProperties(t,r,n,o);{let s=this.groupTypeMapping[String(d)];if(!s)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${d} for feature flag ${t.key}`)),new v0("Flag has unknown group type index");if(!(s in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[s];return await this.matchFeatureFlagProperties(t,i[s],u,o)}}getFeatureFlagPayload(t,r){let i=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),i!=null)){if(typeof i=="object")return i;if(typeof i=="string")try{return JSON.parse(i)}catch{}return i}return null}async evaluateFlagDependency(t,r,i,n){let a=t.key;if(!this.featureFlagsByKey)throw new v0("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new v0(`Flag dependency property for '${a}' is missing required 'dependency_chain' field`);let o=t.dependency_chain;if(!Array.isArray(o))throw new v0(`Flag dependency property for '${a}' has an invalid 'dependency_chain' (expected array, got ${typeof o})`);if(o.length===0)throw new v0(`Circular dependency detected for flag '${a}' (empty dependency chain)`);for(let d of o){if(!(d in n)){let u=this.featureFlagsByKey[d];if(u)if(u.active)try{let l=await this.matchFeatureFlagProperties(u,r,i,n);n[d]=l}catch(l){throw new v0(`Error evaluating flag dependency '${d}' for flag '${a}': ${l}`)}else n[d]=!1;else throw new v0(`Missing flag dependency '${d}' for flag '${a}'`)}if(n[d]==null)throw new v0(`Dependency '${d}' could not be evaluated`)}let c=n[a];return this.flagEvaluatesToExpectedValue(t.value,c)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,i,n={}){let a=t.filters||{},o=a.groups||[],c=!1,d;for(let s of o)try{if(await this.isConditionMatch(t,r,s,i,n)){let u=s.variant,l=a.multivariate?.variants||[];d=u&&l.some(p=>p.key===u)?u:await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof KJt)throw u;if(u instanceof v0)c=!0;else throw u}if(d!==void 0)return d;if(c)throw new v0("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n,a={}){let o=i.rollout_percentage,c=d=>{this.logMsgIfDebug(()=>console.warn(d))};if((i.properties||[]).length>0){for(let d of i.properties){let s=d.type,u=!1;if(u=s==="cohort"?X1_(d,n,this.cohorts,this.debugMode):s==="flag"?await this.evaluateFlagDependency(d,r,n,a):Y1_(d,n,c),!u)return!1}if(o==null)return!0}return!(o!=null&&await K1_(t.key,r)>o/100)}async getMatchingVariant(t,r){let i=await K1_(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{n=i+c.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:c.key}),i=n}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,i)=>(r[i.key]=i,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(xJM,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(i){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${i}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0;return;case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let i=await r.json()??{};if(!("flags"in i))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(i)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let n={flags:i.flags??[],groupTypeMapping:i.group_type_mapping||{},cohorts:i.cohorts||{}};if(this.updateFlagState(n),this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(n)}catch(a){this.onError?.(new Error(`Failed to store in cache: ${a}`))}this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof ykn&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let i={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(i["If-None-Match"]=r),{method:t,headers:i}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=D_n(()=>{n.abort()},this.timeout),r.signal=n.signal}try{let n=this.fetch;return n(t,r)}finally{clearTimeout(i)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((i,n)=>setTimeout(()=>n(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function K1_(e,t,r=""){let i=await x1_(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/KJM}function Y1_(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 v0("Operator is_not_set is not supported")}else throw new v0(`Property ${i} not found in propertyValues`);let o=t[i];if(o==null&&!JJM.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,u){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(u).toLowerCase()):String(s).toLowerCase()===String(u).toLowerCase()}function d(s,u,l){if(l==="gt")return s>u;if(l==="gte")return s>=u;if(l==="lt")return s<u;if(l==="lte")return s<=u;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(n,o);case"is_not":return!c(n,o);case"is_set":return i in t;case"icontains":return String(o).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(n).toLowerCase());case"regex":return J1_(String(n))&&String(o).match(String(n))!==null;case"not_regex":return J1_(String(n))&&String(o).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s==null||o==null?d(String(o),String(n),a):typeof o=="string"?d(o,String(n),a):d(o,s,a)}case"is_date_after":case"is_date_before":{if(typeof n=="boolean")throw new v0("Date operations cannot be performed on boolean values");let s=YJM(String(n));if(s==null&&(s=$1_(n)),s==null)throw new v0(`Invalid date: ${n}`);let u=$1_(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new v0(`Unknown operator: ${a}`)}}function $JM(e,t){if(!(e in t))throw new KJt(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function X1_(e,t,r,i=!1){let n=String(e.value);$JM(n,r);let a=r[n];return Z1_(a,t,r,i)}function Z1_(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let d=Z1_(c,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof KJt)throw d;if(d instanceof v0)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new v0("Can't match cohort without a given cohort property value");return n==="AND"}for(let c of a)try{let d;if(c.type==="cohort")d=X1_(c,t,r,i);else if(c.type==="flag"){i&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${c.key||"unknown"}'`);continue}else d=Y1_(c,t);let s=c.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof KJt)throw d;if(d instanceof v0)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new v0("can't match cohort without a given cohort property value");return n==="AND"}function J1_(e){try{return new RegExp(e),!0}catch{return!1}}function $1_(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 v0(`${e} is in an invalid date format`)}throw new v0(`The date provided ${e} must be a string, number, or date object`)}function YJM(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(!r)return null;{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()-7*n);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else{if(a!="y")return null;i.setUTCFullYear(i.getUTCFullYear()-n)}return i}}var C7o=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var XJM=100,k1_=3e4,ZJM=5e4,q7o=class extends xWa{constructor(t,r={}){if(super(t,r),this._memoryStorage=new C7o,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,XJM):k1_,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new I7o({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider}))}this.errorTracking=new SFi(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||ZJM}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):fetch(t,r)}getLibraryVersion(){return H1_}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:i,properties:n,options:a})=>super.captureStateless(r,i,n,{timestamp:a.timestamp,disableGeoip:a.disableGeoip,uuid:a.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:i,properties:n,options:a})=>super.captureStatelessImmediate(r,i,n,{timestamp:a.timestamp,disableGeoip:a.disableGeoip,uuid:a.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:i}){let{$set:n,$set_once:a,$anon_distinct_id:o,...c}=r,u={$set:n||c,$set_once:a||{},$anon_distinct_id:o??void 0};super.identifyStateless(t,u,{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:i}){let{$set:n,$set_once:a,$anon_distinct_id:o,...c}=r,u={$set:n||c,$set_once:a||{},$anon_distinct_id:o??void 0};super.identifyStatelessImmediate(t,u,{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=k1_){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:d,groupProperties:s}=i||{},u=this.addLocalPersonAndGroupProperties(r,n,d,s);d=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=this.options.sendFeatureFlagEvent??!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),p=l!==void 0,_,h,y;if(!p&&!o){let v=await super.getFeatureFlagDetailStateless(t,r,n,d,s,a);if(v===void 0)return;y=v.response,l=S_n(y),_=v?.requestId,h=v?.evaluatedAt}let b=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(b))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(b):this.distinctIdHasSentFlagCalls[r]=[b],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:y?.metadata?.id,$feature_flag_version:y?.metadata?.version,$feature_flag_reason:y?.reason?.description??y?.reason?.code,locally_evaluated:p,[`$feature/${t}`]:l,$feature_flag_request_id:_,$feature_flag_evaluated_at:h},groups:n,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:o}=n||{},{onlyEvaluateLocally:c,personProperties:d,groupProperties:s}=n||{},u=this.addLocalPersonAndGroupProperties(r,a,d,s);d=u.allPersonProperties,s=u.allGroupProperties;let l;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let h=this.featureFlagsPoller?.featureFlagsByKey[t];if(h)try{let y=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(h,r,a,d,s,i);y&&(i=y.value,l=y.payload)}catch(y){if(y instanceof KJt||y instanceof v0)this._logger?.info(`${y.name} when computing flag locally: ${h.key}: ${y.message}`);else throw y}}return c==null&&(c=!1),!(l!==void 0)&&!c&&(l=await super.getFeatureFlagPayloadStateless(t,r,a,d,s,o)),l}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let i=await r.json();if(typeof i=="string")try{return JSON.parse(i)}catch{}return i}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,flagKeys:a}=r||{},{onlyEvaluateLocally:o,personProperties:c,groupProperties:d}=r||{},s=this.addLocalPersonAndGroupProperties(t,i,c,d);c=s.allPersonProperties,d=s.allGroupProperties,o==null&&(o=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,c,d,a),l={},p={},_=!0;if(u&&(l=u.response,p=u.payloads,_=u.fallbackToFlags),_&&!o){let h=await super.getFeatureFlagsAndPayloadsStateless(t,i,c,d,n,a);l={...l,...h.flags||{}},p={...p,...h.payloads||{}}}return{featureFlags:l,featureFlagPayloads:p}}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)}withContext(t,r,i){return this.context?this.context.run(t,r,i):r()}getContext(){return this.context?.get()}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},n=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let a=new AbortController;n=D_n(()=>{a.abort()},this.options.requestTimeout),i.signal=a.signal}try{return await this.fetch(r,i)}catch(a){this._events.emit("error",a);return}finally{n&&clearTimeout(n)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let i={},n={};for(let[a,o]of Object.entries(t))if(a1_(o)&&r&&a in r){let c={};for(let[d,s]of Object.entries(o))c[String(d)]=String(s);n[String(a)]=c}else i[String(a)]=String(o);return{personProperties:i,groupProperties:n}}async getFeatureFlagsForEvent(t,r,i,n){let a=n?.personProperties||{},o=n?.groupProperties||{},c=n?.flagKeys;if(n?.onlyEvaluateLocally??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let s={};for(let[u,l]of Object.entries(r||{}))s[u]=String(l);return await this.getAllFlags(t,{groups:s,personProperties:a,groupProperties:o,disableGeoip:i,onlyEvaluateLocally:!0,flagKeys:c})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let s={};for(let[u,l]of Object.entries(r||{}))s[u]=String(l);return await this.getAllFlags(t,{groups:s,personProperties:a,groupProperties:o,disableGeoip:i,onlyEvaluateLocally:!0,flagKeys:c})}return(await super.getFeatureFlagsStateless(t,r,a,o,i)).flags}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...n?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,i){let n=new Error("PostHog syntheticException");this.addPendingPromise(SFi.buildEventMessage(t,{syntheticException:n},r,i).then(a=>this.capture(a)))}async captureExceptionImmediate(t,r,i){let n=new Error("PostHog syntheticException");this.addPendingPromise(SFi.buildEventMessage(t,{syntheticException:n},r,i).then(a=>this.captureImmediate(a)))}async prepareEventMessage(t){let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s}=t,u=this.context?.get(),l=r||u?.distinctId,p={...u?.properties||{},...n||{}};l||(l=HJt(),p.$process_person_profile=!1),u?.sessionId&&!p.$session_id&&(p.$session_id=u.sessionId);let _=this._runBeforeSend({distinctId:l,event:i,properties:p,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s});if(!_)return Promise.reject(null);let h=await Promise.resolve().then(async()=>{if(o){let y=typeof o=="object"?o:void 0;return await this.getFeatureFlagsForEvent(_.distinctId,a,d,y)}return _.event,{}}).then(y=>{let b={};if(y)for(let[O,A]of Object.entries(y))b[`$feature/${O}`]=A;let v=Object.keys(y||{}).filter(O=>y?.[O]!==!1).sort();return v.length>0&&(b.$active_feature_flags=v),b}).catch(()=>({})).then(y=>({...y,..._.properties||{},$groups:_.groups||a}));return _.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof h.$raw_user_agent=="string"&&kq_(h.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(_.event="$bot_pageview",h.$browser_type="bot"),{distinctId:_.distinctId,event:_.event,properties:h,options:{timestamp:_.timestamp,disableGeoip:_.disableGeoip,uuid:_.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let i=Array.isArray(r)?r:[r],n=t;for(let a of i){if(n=a(n),!n)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!n.properties||Object.keys(n.properties).length===0){let o=`Event '${n.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(o)}}return n}};var eT_=require("async_hooks"),T7o=class{constructor(){this.storage=new eT_.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,i){if(i?.fresh===!0)return this.storage.run(t,r);{let a=this.get()||{},o={distinctId:t.distinctId??a.distinctId,sessionId:t.sessionId??a.sessionId,properties:{...a.properties||{},...t.properties||{}}};return this.storage.run(o,r)}}};var tT_="posthog-node";function kJM(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}={}){return o=>{if(!(n==="*"||n.includes(o.level)))return o;o.tags||(o.tags={});let d=o.tags[Ewc.POSTHOG_ID_TAG];if(d===void 0)return o;let s=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${d}`,s).toString();o.tags["PostHog Person URL"]=u;let l=o.exception?.values||[],p=l.map(h=>({...h,stacktrace:h.stacktrace?{...h.stacktrace,type:"raw",frames:(h.stacktrace.frames||[]).map(y=>({...y,platform:"node:javascript"}))}:void 0})),_={$exception_message:l[0]?.value||o.message,$exception_type:l[0]?.type,$exception_level:o.level,$exception_list:p,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:l[0]?.value||o.message,$sentry_exception_type:l[0]?.type,$sentry_tags:o.tags};return t&&r&&(_.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+o.event_id),a&&e.capture({event:"$exception",distinctId:d,properties:_}),o}}var Ewc=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,i,n,a){this.name=tT_,this.name=tT_,this.setupOnce=function(o,c){let d=c()?.getClient()?.getDsn()?.projectId;o(kJM(t,{organization:r,projectId:d,prefix:i,severityAllowList:n,sendExceptionsToPostHog:a??!0}))}}};SFi.errorPropertiesBuilder=new h$.ErrorPropertiesBuilder([new h$.EventCoercer,new h$.ErrorCoercer,new h$.ObjectCoercer,new h$.StringCoercer,new h$.PrimitiveCoercer],h$.createStackParser("node:javascript",h$.nodeStackLineParser),[Jq_(),U1_]);var bkn=class extends q7o{getLibraryId(){return"posthog-node"}initializeContext(){return new T7o}};var R7o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new bkn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.30.3",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var KWa=class{async sendEvent(){}async identify(){}async flush(){}};var vkn=require("fs/promises"),aT_=require("os"),oT_=require("path");var rT_=ce(require("crypto")),N7o=new Uint8Array(256),z7o=N7o.length;function Swc(){return z7o>N7o.length-16&&(rT_.default.randomFillSync(N7o),z7o=0),N7o.slice(z7o,z7o+=16)}var L4=[];for(let e=0;e<256;++e)L4.push((e+256).toString(16).slice(1));function iT_(e,t=0){return L4[e[t+0]]+L4[e[t+1]]+L4[e[t+2]]+L4[e[t+3]]+"-"+L4[e[t+4]]+L4[e[t+5]]+"-"+L4[e[t+6]]+L4[e[t+7]]+"-"+L4[e[t+8]]+L4[e[t+9]]+"-"+L4[e[t+10]]+L4[e[t+11]]+L4[e[t+12]]+L4[e[t+13]]+L4[e[t+14]]+L4[e[t+15]]}var nT_=ce(require("crypto")),Mwc={randomUUID:nT_.default.randomUUID};function e$M(e,t,r){if(Mwc.randomUUID&&!t&&!e)return Mwc.randomUUID();e=e||{};let i=e.random||(e.rng||Swc)();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 iT_(i)}var ave=e$M;var t$M="id",r$M=".fern",JWa=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new bkn(r),this.userId=t==null?void 0:Ogc(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"3.30.3",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await I4({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ct(Cr.of((0,aT_.homedir)()),Ze.of(r$M),Ze.of(t$M));await ji(t)||(await(0,vkn.mkdir)((0,oT_.dirname)(t),{recursive:!0}),await(0,vkn.writeFile)(t,ave())),this.persistedDistinctId=(await(0,vkn.readFile)(t)).toString()}return this.persistedDistinctId}};var Dwc;async function gkn(){return Dwc==null&&(Dwc=await i$M()),Dwc}async function i$M(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new KWa;let r=await nWo();return r!=null?new JWa({token:r,posthogApiKey:e}):await MZn()!=null?new R7o({posthogApiKey:e}):new JWa({token:void 0,posthogApiKey:e})}catch{return new KWa}}function $Wa(e,t){return function(){return e.apply(t,arguments)}}var{toString:n$M}=Object.prototype,{getPrototypeOf:Iwc}=Object,{iterator:Q7o,toStringTag:sT_}=Symbol,U7o=(e=>t=>{let r=n$M.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),c3t=e=>(e=e.toLowerCase(),t=>U7o(t)===e),L7o=e=>t=>typeof t===e,{isArray:Akn}=Array,Okn=L7o("undefined");function YWa(e){return e!==null&&!Okn(e)&&e.constructor!==null&&!Okn(e.constructor)&&y$(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var cT_=c3t("ArrayBuffer");function a$M(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&cT_(e.buffer),t}var o$M=L7o("string"),y$=L7o("function"),lT_=L7o("number"),XWa=e=>e!==null&&typeof e=="object",u$M=e=>e===!0||e===!1,F7o=e=>{if(U7o(e)!=="object")return!1;let t=Iwc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(sT_ in e)&&!(Q7o in e)},s$M=e=>{if(!XWa(e)||YWa(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},c$M=c3t("Date"),l$M=c3t("File"),f$M=c3t("Blob"),d$M=c3t("FileList"),p$M=e=>XWa(e)&&y$(e.pipe),_$M=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||y$(e.append)&&((t=U7o(e))==="formdata"||t==="object"&&y$(e.toString)&&e.toString()==="[object FormData]"))},h$M=c3t("URLSearchParams"),[y$M,b$M,v$M,g$M]=["ReadableStream","Request","Response","Headers"].map(c3t),O$M=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ZWa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Akn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(YWa(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function fT_(e,t){if(YWa(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var B_n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dT_=e=>!Okn(e)&&e!==B_n;function Bwc(){let{caseless:e,skipUndefined:t}=dT_(this)&&this||{},r={},i=(n,a)=>{let o=e&&fT_(r,a)||a;F7o(r[o])&&F7o(n)?r[o]=Bwc(r[o],n):F7o(n)?r[o]=Bwc({},n):Akn(n)?r[o]=n.slice():(!t||!Okn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&ZWa(arguments[n],i);return r}var A$M=(e,t,r,{allOwnKeys:i}={})=>(ZWa(t,(n,a)=>{r&&y$(n)?e[a]=$Wa(n,r):e[a]=n},{allOwnKeys:i}),e),m$M=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),P$M=(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)},j$M=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&Iwc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},w$M=(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},E$M=e=>{if(!e)return null;if(Akn(e))return e;let t=e.length;if(!lT_(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},S$M=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Iwc(Uint8Array)),M$M=(e,t)=>{let i=(e&&e[Q7o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},D$M=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},B$M=c3t("HTMLFormElement"),I$M=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),uT_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),C$M=c3t("RegExp"),pT_=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ZWa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},q$M=e=>{pT_(e,(t,r)=>{if(y$(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(y$(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+"'")})}})},T$M=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return Akn(e)?i(e):i(String(e).split(t)),r},R$M=()=>{},z$M=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function N$M(e){return!!(e&&y$(e.append)&&e[sT_]==="FormData"&&e[Q7o])}var F$M=e=>{let t=new Array(10),r=(i,n)=>{if(XWa(i)){if(t.indexOf(i)>=0)return;if(YWa(i))return i;if(!("toJSON"in i)){t[n]=i;let a=Akn(i)?[]:{};return ZWa(i,(o,c)=>{let d=r(o,n+1);!Okn(d)&&(a[c]=d)}),t[n]=void 0,a}}return i};return r(e,0)},Q$M=c3t("AsyncFunction"),U$M=e=>e&&(XWa(e)||y$(e))&&y$(e.then)&&y$(e.catch),_T_=((e,t)=>e?setImmediate:t?((r,i)=>(B_n.addEventListener("message",({source:n,data:a})=>{n===B_n&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),B_n.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",y$(B_n.postMessage)),L$M=typeof queueMicrotask<"u"?queueMicrotask.bind(B_n):typeof process<"u"&&process.nextTick||_T_,V$M=e=>e!=null&&y$(e[Q7o]),rr={isArray:Akn,isArrayBuffer:cT_,isBuffer:YWa,isFormData:_$M,isArrayBufferView:a$M,isString:o$M,isNumber:lT_,isBoolean:u$M,isObject:XWa,isPlainObject:F7o,isEmptyObject:s$M,isReadableStream:y$M,isRequest:b$M,isResponse:v$M,isHeaders:g$M,isUndefined:Okn,isDate:c$M,isFile:l$M,isBlob:f$M,isRegExp:C$M,isFunction:y$,isStream:p$M,isURLSearchParams:h$M,isTypedArray:S$M,isFileList:d$M,forEach:ZWa,merge:Bwc,extend:A$M,trim:O$M,stripBOM:m$M,inherits:P$M,toFlatObject:j$M,kindOf:U7o,kindOfTest:c3t,endsWith:w$M,toArray:E$M,forEachEntry:M$M,matchAll:D$M,isHTMLForm:B$M,hasOwnProperty:uT_,hasOwnProp:uT_,reduceDescriptors:pT_,freezeMethods:q$M,toObjectSet:T$M,toCamelCase:I$M,noop:R$M,toFiniteNumber:z$M,findKey:fT_,global:B_n,isContextDefined:dT_,isSpecCompliantForm:N$M,toJSONObject:F$M,isAsyncFn:Q$M,isThenable:U$M,setImmediate:_T_,asap:L$M,isIterable:V$M};function mkn(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)}rr.inherits(mkn,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:rr.toJSONObject(this.config),code:this.code,status:this.status}}});var hT_=mkn.prototype,yT_={};["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=>{yT_[e]={value:e}});Object.defineProperties(mkn,yT_);Object.defineProperty(hT_,"isAxiosError",{value:!0});mkn.from=(e,t,r,i,n,a)=>{let o=Object.create(hT_);rr.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return mkn.call(o,c,d,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Ba=mkn;var bT_=ce(WXn(),1),V7o=bT_.default;function Cwc(e){return rr.isPlainObject(e)||rr.isArray(e)}function gT_(e){return rr.endsWith(e,"[]")?e.slice(0,-2):e}function vT_(e,t,r){return e?e.concat(t).map(function(n,a){return n=gT_(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function W$M(e){return rr.isArray(e)&&!e.some(Cwc)}var G$M=rr.toFlatObject(rr,{},null,function(t){return/^is[A-Z]/.test(t)});function H$M(e,t,r){if(!rr.isObject(e))throw new TypeError("target must be an object");t=t||new(V7o||FormData),r=rr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!rr.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&rr.isSpecCompliantForm(t);if(!rr.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(rr.isDate(h))return h.toISOString();if(rr.isBoolean(h))return h.toString();if(!d&&rr.isBlob(h))throw new Ba("Blob is not supported. Use a Buffer instead.");return rr.isArrayBuffer(h)||rr.isTypedArray(h)?d&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(rr.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(rr.isArray(h)&&W$M(h)||(rr.isFileList(h)||rr.endsWith(y,"[]"))&&(v=rr.toArray(h)))return y=gT_(y),v.forEach(function(A,g){!(rr.isUndefined(A)||A===null)&&t.append(o===!0?vT_([y],g,a):o===null?y:y+"[]",s(A))}),!1}return Cwc(h)?!0:(t.append(vT_(b,y,a),s(h)),!1)}let l=[],p=Object.assign(G$M,{defaultVisitor:u,convertValue:s,isVisitable:Cwc});function _(h,y){if(!rr.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),rr.forEach(h,function(v,O){(!(rr.isUndefined(v)||v===null)&&n.call(t,v,rr.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!rr.isObject(e))throw new TypeError("data must be an object");return _(e),t}var V7i=H$M;function OT_(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function AT_(e,t){this._pairs=[],e&&V7i(e,this,t)}var mT_=AT_.prototype;mT_.append=function(t,r){this._pairs.push([t,r])};mT_.toString=function(t){let r=t?function(i){return t.call(this,i,OT_)}:OT_;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var PT_=AT_;function x$M(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function I_n(e,t,r){if(!t)return e;let i=r&&r.encode||x$M;rr.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=rr.isURLSearchParams(t)?t.toString():new PT_(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var qwc=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){rr.forEach(this.handlers,function(i){i!==null&&t(i)})}},Twc=qwc;var Pkn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ST_=ce(require("crypto"),1);var jT_=ce(require("url"),1),wT_=jT_.default.URLSearchParams;var Rwc="abcdefghijklmnopqrstuvwxyz",ET_="0123456789",MT_={DIGIT:ET_,ALPHA:Rwc,ALPHA_DIGIT:Rwc+Rwc.toUpperCase()+ET_},K$M=(e=16,t=MT_.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);ST_.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},DT_={isNode:!0,classes:{URLSearchParams:wT_,FormData:V7o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:MT_,generateString:K$M,protocols:["http","https","file","data"]};var Fwc={};Zt(Fwc,{hasBrowserEnv:()=>Nwc,hasStandardBrowserEnv:()=>J$M,hasStandardBrowserWebWorkerEnv:()=>$$M,navigator:()=>zwc,origin:()=>Y$M});var Nwc=typeof window<"u"&&typeof document<"u",zwc=typeof navigator=="object"&&navigator||void 0,J$M=Nwc&&(!zwc||["ReactNative","NativeScript","NS"].indexOf(zwc.product)<0),$$M=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Y$M=Nwc&&window.location.href||"http://localhost";var om={...Fwc,...DT_};function Qwc(e,t){return V7i(e,new om.classes.URLSearchParams,{visitor:function(r,i,n,a){return om.isNode&&rr.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function X$M(e){return rr.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Z$M(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 k$M(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&rr.isArray(n)?n.length:o,d?(rr.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!rr.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&rr.isArray(n[o])&&(n[o]=Z$M(n[o])),!c)}if(rr.isFormData(e)&&rr.isFunction(e.entries)){let r={};return rr.forEachEntry(e,(i,n)=>{t(X$M(i),n,r,0)}),r}return null}var W7o=k$M;function eYM(e,t,r){if(rr.isString(e))try{return(t||JSON.parse)(e),rr.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Uwc={transitional:Pkn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=rr.isObject(t);if(a&&rr.isHTMLForm(t)&&(t=new FormData(t)),rr.isFormData(t))return n?JSON.stringify(W7o(t)):t;if(rr.isArrayBuffer(t)||rr.isBuffer(t)||rr.isStream(t)||rr.isFile(t)||rr.isBlob(t)||rr.isReadableStream(t))return t;if(rr.isArrayBufferView(t))return t.buffer;if(rr.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Qwc(t,this.formSerializer).toString();if((c=rr.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return V7i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),eYM(t)):t}],transformResponse:[function(t){let r=this.transitional||Uwc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(rr.isResponse(t)||rr.isReadableStream(t))return t;if(t&&rr.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Ba.from(c,Ba.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:om.classes.FormData,Blob:om.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};rr.forEach(["delete","get","head","post","put","patch"],e=>{Uwc.headers[e]={}});var jkn=Uwc;var tYM=rr.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"]),BT_=e=>{let t={},r,i,n;return e&&e.split(`
1148
+ `);for(let o=i;o<a.length;o++){let c=a[o];if(c.length>1024)continue;let d=I1_.test(c)?c.replace(I1_,"$1"):c;if(!d.match(/\S*Error: /)){for(let s of t){let u=s(d,e);if(u){n.push(u);break}}if(n.length>=C1_)break}}return q1_(n)}}var ywc=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let i=LWa(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return M_n(t,"DOMException")}isDOMError(t){return M_n(t,"DOMError")}};var bwc=class{match(t){return owc(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let i=t.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(t){return t.stacktrace||t.stack||void 0}};var vwc=class{constructor(){}match(t){return n1_(t)&&t.error!=null}coerce(t,r){let i=r.apply(t.error);return i||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var CJM=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,gwc=class{match(t){return typeof t=="string"}coerce(t,r){let[i,n]=this.getInfos(t);return{type:i??"Error",value:n??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",i=t,n=t.match(CJM);return n&&(r=n[1],i=n[2]),[r,i]}};var T1_=["fatal","error","warning","log","info","debug"];function D7o(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let i=r.length;i>0;i--){let n=r.slice(0,i).join(", ");if(!(n.length>t))return i===r.length||n.length<=t?n:`${n.slice(0,t)}...`}return""}var Owc=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let i=this.getErrorPropertyFromObject(t);return i?r.apply(i):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return b7o(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let n=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(n+=` with message: '${t.message}'`),n}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),i=D7o(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${i}`}isSeverityLevel(t){return LWa(t)&&!r1_(t)&&T1_.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(v1_(i))return i}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var Awc=class{match(t){return b7o(t)}coerce(t,r){let i=t.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${D7o(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var mwc=class{match(t){return VWa(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Pwc=class{match(t){return M_n(t,"PromiseRejectionEvent")}coerce(t,r){let i=this.getUnhandledRejectionReason(t);return VWa(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(i)}getUnhandledRejectionReason(t){if(VWa(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var jwc=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var N1_=require("fs"),F1_=require("readline"),B7o=new h$.ReduceableCache(25),Q1_=new h$.ReduceableCache(20),wwc=7,qJM=1e3,TJM=1e4;async function U1_(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||FJM(o)||QJM(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(Q1_.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let o=LJM(a);if(o.every(d=>UJM(n,d)))continue;let c=VJM(B7o,n,{});i.push(RJM(n,o,c))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&zJM(e,B7o),B7o.reduce(),e}function RJM(e,t,r){return new Promise(i=>{let n=(0,N1_.createReadStream)(e),a=(0,F1_.createInterface)({input:n});function o(){n.destroy(),i()}let c=0,d=0,s=t[d];if(s===void 0)return void o();let u=s[0],l=s[1];function p(){Q1_.set(e,1),a.close(),a.removeAllListeners(),o()}n.on("error",p),a.on("error",p),a.on("close",o),a.on("line",_=>{if(c++,!(c<u)&&(r[c]=WJM(_,0),c>=l)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let h=t[d];if(h===void 0){a.close(),a.removeAllListeners();return}u=h[0],l=h[1]}})})}function zJM(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;NJM(r.lineno,r,i)}}function NJM(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=L1_(e);n<e;n++){let a=r[n];if(a===void 0)return void R1_(t);t.pre_context.push(a)}if(r[e]===void 0)return void R1_(t);t.context_line=r[e];let i=V1_(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function R1_(e){delete e.pre_context,delete e.context_line,delete e.post_context}function FJM(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function QJM(e){return e.lineno!==void 0&&e.lineno>TJM||e.colno!==void 0&&e.colno>qJM}function UJM(e,t){let r=B7o.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function LJM(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=z1_(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+wwc:(n.push(i),i=z1_(a)),t++}return n}function z1_(e){return[L1_(e),V1_(e)]}function L1_(e){return Math.max(1,e-wwc)}function V1_(e){return e+wwc}function VJM(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function WJM(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}function GJM(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t(i))},{_posthogErrorHandler:!0})}function W1_(e,t){globalThis.process?.on("uncaughtException",GJM(e,t))}function G1_(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var HJM=2e3,SFi=class e{constructor(t,r,i){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=i,this._rateLimiter=new v7o({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static async buildEventMessage(t,r,i,n){let a={...n};i||(a.$process_person_profile=!1);let o=this.errorPropertiesBuilder.buildFromUnknown(t,r);return o.$exception_list=await this.errorPropertiesBuilder.modifyFrames(o.$exception_list),{event:"$exception",distinctId:i||HJt(),properties:{...o,...a}}}startAutocaptureIfEnabled(){this.isEnabled()&&(W1_(this.onException.bind(this),this.onFatalError.bind(this)),G1_(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{let i=await e.buildEventMessage(t,r),a=i.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(a)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:a}):this.client.capture(i)})())}async onFatalError(t){console.error(t),await this.client.shutdown(HJM),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var H1_="5.17.4";async function x1_(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}var xJM=6e4,KJM=1152921504606847e3,JJM=["is_not"],ykn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},v0=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},KJt=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},I7o=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=c.fetch||fetch,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.cacheProvider=c.cacheProvider,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;if(c=this.featureFlagsByKey[t],c!==void 0)try{o=(await this.computeFlagAndPayloadLocally(c,r,i,n,a)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(d){d instanceof KJt||d instanceof v0?this.logMsgIfDebug(()=>console.debug(`${d.name} when computing flag locally: ${t}: ${d.message}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return o}async getAllFlagsAndPayloads(t,r={},i={},n={},a){await this.loadFeatureFlags();let o={},c={},d=this.featureFlags.length==0,s=a?a.map(l=>this.featureFlagsByKey[l]).filter(Boolean):this.featureFlags,u={};return await Promise.all(s.map(async l=>{try{let{value:p,payload:_}=await this.computeFlagAndPayloadLocally(l,t,r,i,n,void 0,u);o[l.key]=p,_&&(c[l.key]=_)}catch(p){p instanceof KJt||p instanceof v0?this.logMsgIfDebug(()=>console.debug(`${p.name} when computing flag locally: ${l.key}: ${p.message}`)):p instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${l.key}: ${p}`)),d=!0}})),{response:o,payloads:c,fallbackToFlags:d}}async computeFlagAndPayloadLocally(t,r,i={},n={},a={},o,c,d=!1){if(d||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=o!==void 0?o:await this.computeFlagValueLocally(t,r,i,n,a,c);let u=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:u}}async computeFlagValueLocally(t,r,i={},n={},a={},o={}){if(t.ensure_experience_continuity)throw new v0("Flag has experience continuity enabled");if(!t.active)return!1;let d=(t.filters||{}).aggregation_group_type_index;if(d==null)return await this.matchFeatureFlagProperties(t,r,n,o);{let s=this.groupTypeMapping[String(d)];if(!s)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${d} for feature flag ${t.key}`)),new v0("Flag has unknown group type index");if(!(s in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[s];return await this.matchFeatureFlagProperties(t,i[s],u,o)}}getFeatureFlagPayload(t,r){let i=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),i!=null)){if(typeof i=="object")return i;if(typeof i=="string")try{return JSON.parse(i)}catch{}return i}return null}async evaluateFlagDependency(t,r,i,n){let a=t.key;if(!this.featureFlagsByKey)throw new v0("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new v0(`Flag dependency property for '${a}' is missing required 'dependency_chain' field`);let o=t.dependency_chain;if(!Array.isArray(o))throw new v0(`Flag dependency property for '${a}' has an invalid 'dependency_chain' (expected array, got ${typeof o})`);if(o.length===0)throw new v0(`Circular dependency detected for flag '${a}' (empty dependency chain)`);for(let d of o){if(!(d in n)){let u=this.featureFlagsByKey[d];if(u)if(u.active)try{let l=await this.matchFeatureFlagProperties(u,r,i,n);n[d]=l}catch(l){throw new v0(`Error evaluating flag dependency '${d}' for flag '${a}': ${l}`)}else n[d]=!1;else throw new v0(`Missing flag dependency '${d}' for flag '${a}'`)}if(n[d]==null)throw new v0(`Dependency '${d}' could not be evaluated`)}let c=n[a];return this.flagEvaluatesToExpectedValue(t.value,c)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,i,n={}){let a=t.filters||{},o=a.groups||[],c=!1,d;for(let s of o)try{if(await this.isConditionMatch(t,r,s,i,n)){let u=s.variant,l=a.multivariate?.variants||[];d=u&&l.some(p=>p.key===u)?u:await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof KJt)throw u;if(u instanceof v0)c=!0;else throw u}if(d!==void 0)return d;if(c)throw new v0("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n,a={}){let o=i.rollout_percentage,c=d=>{this.logMsgIfDebug(()=>console.warn(d))};if((i.properties||[]).length>0){for(let d of i.properties){let s=d.type,u=!1;if(u=s==="cohort"?X1_(d,n,this.cohorts,this.debugMode):s==="flag"?await this.evaluateFlagDependency(d,r,n,a):Y1_(d,n,c),!u)return!1}if(o==null)return!0}return!(o!=null&&await K1_(t.key,r)>o/100)}async getMatchingVariant(t,r){let i=await K1_(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{n=i+c.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:c.key}),i=n}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,i)=>(r[i.key]=i,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(xJM,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(i){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${i}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0;return;case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new ykn(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let i=await r.json()??{};if(!("flags"in i))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(i)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let n={flags:i.flags??[],groupTypeMapping:i.group_type_mapping||{},cohorts:i.cohorts||{}};if(this.updateFlagState(n),this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(n)}catch(a){this.onError?.(new Error(`Failed to store in cache: ${a}`))}this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof ykn&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let i={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(i["If-None-Match"]=r),{method:t,headers:i}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=D_n(()=>{n.abort()},this.timeout),r.signal=n.signal}try{let n=this.fetch;return n(t,r)}finally{clearTimeout(i)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((i,n)=>setTimeout(()=>n(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function K1_(e,t,r=""){let i=await x1_(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/KJM}function Y1_(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 v0("Operator is_not_set is not supported")}else throw new v0(`Property ${i} not found in propertyValues`);let o=t[i];if(o==null&&!JJM.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,u){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(u).toLowerCase()):String(s).toLowerCase()===String(u).toLowerCase()}function d(s,u,l){if(l==="gt")return s>u;if(l==="gte")return s>=u;if(l==="lt")return s<u;if(l==="lte")return s<=u;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(n,o);case"is_not":return!c(n,o);case"is_set":return i in t;case"icontains":return String(o).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(n).toLowerCase());case"regex":return J1_(String(n))&&String(o).match(String(n))!==null;case"not_regex":return J1_(String(n))&&String(o).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s==null||o==null?d(String(o),String(n),a):typeof o=="string"?d(o,String(n),a):d(o,s,a)}case"is_date_after":case"is_date_before":{if(typeof n=="boolean")throw new v0("Date operations cannot be performed on boolean values");let s=YJM(String(n));if(s==null&&(s=$1_(n)),s==null)throw new v0(`Invalid date: ${n}`);let u=$1_(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new v0(`Unknown operator: ${a}`)}}function $JM(e,t){if(!(e in t))throw new KJt(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function X1_(e,t,r,i=!1){let n=String(e.value);$JM(n,r);let a=r[n];return Z1_(a,t,r,i)}function Z1_(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let d=Z1_(c,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof KJt)throw d;if(d instanceof v0)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new v0("Can't match cohort without a given cohort property value");return n==="AND"}for(let c of a)try{let d;if(c.type==="cohort")d=X1_(c,t,r,i);else if(c.type==="flag"){i&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${c.key||"unknown"}'`);continue}else d=Y1_(c,t);let s=c.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof KJt)throw d;if(d instanceof v0)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new v0("can't match cohort without a given cohort property value");return n==="AND"}function J1_(e){try{return new RegExp(e),!0}catch{return!1}}function $1_(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 v0(`${e} is in an invalid date format`)}throw new v0(`The date provided ${e} must be a string, number, or date object`)}function YJM(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(!r)return null;{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()-7*n);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else{if(a!="y")return null;i.setUTCFullYear(i.getUTCFullYear()-n)}return i}}var C7o=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var XJM=100,k1_=3e4,ZJM=5e4,q7o=class extends xWa{constructor(t,r={}){if(super(t,r),this._memoryStorage=new C7o,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,XJM):k1_,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new I7o({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider}))}this.errorTracking=new SFi(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||ZJM}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):fetch(t,r)}getLibraryVersion(){return H1_}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:i,properties:n,options:a})=>super.captureStateless(r,i,n,{timestamp:a.timestamp,disableGeoip:a.disableGeoip,uuid:a.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:i,properties:n,options:a})=>super.captureStatelessImmediate(r,i,n,{timestamp:a.timestamp,disableGeoip:a.disableGeoip,uuid:a.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:i}){let{$set:n,$set_once:a,$anon_distinct_id:o,...c}=r,u={$set:n||c,$set_once:a||{},$anon_distinct_id:o??void 0};super.identifyStateless(t,u,{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:i}){let{$set:n,$set_once:a,$anon_distinct_id:o,...c}=r,u={$set:n||c,$set_once:a||{},$anon_distinct_id:o??void 0};super.identifyStatelessImmediate(t,u,{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=k1_){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:d,groupProperties:s}=i||{},u=this.addLocalPersonAndGroupProperties(r,n,d,s);d=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=this.options.sendFeatureFlagEvent??!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),p=l!==void 0,_,h,y;if(!p&&!o){let v=await super.getFeatureFlagDetailStateless(t,r,n,d,s,a);if(v===void 0)return;y=v.response,l=S_n(y),_=v?.requestId,h=v?.evaluatedAt}let b=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(b))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(b):this.distinctIdHasSentFlagCalls[r]=[b],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:y?.metadata?.id,$feature_flag_version:y?.metadata?.version,$feature_flag_reason:y?.reason?.description??y?.reason?.code,locally_evaluated:p,[`$feature/${t}`]:l,$feature_flag_request_id:_,$feature_flag_evaluated_at:h},groups:n,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:o}=n||{},{onlyEvaluateLocally:c,personProperties:d,groupProperties:s}=n||{},u=this.addLocalPersonAndGroupProperties(r,a,d,s);d=u.allPersonProperties,s=u.allGroupProperties;let l;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let h=this.featureFlagsPoller?.featureFlagsByKey[t];if(h)try{let y=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(h,r,a,d,s,i);y&&(i=y.value,l=y.payload)}catch(y){if(y instanceof KJt||y instanceof v0)this._logger?.info(`${y.name} when computing flag locally: ${h.key}: ${y.message}`);else throw y}}return c==null&&(c=!1),!(l!==void 0)&&!c&&(l=await super.getFeatureFlagPayloadStateless(t,r,a,d,s,o)),l}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let i=await r.json();if(typeof i=="string")try{return JSON.parse(i)}catch{}return i}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,flagKeys:a}=r||{},{onlyEvaluateLocally:o,personProperties:c,groupProperties:d}=r||{},s=this.addLocalPersonAndGroupProperties(t,i,c,d);c=s.allPersonProperties,d=s.allGroupProperties,o==null&&(o=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,c,d,a),l={},p={},_=!0;if(u&&(l=u.response,p=u.payloads,_=u.fallbackToFlags),_&&!o){let h=await super.getFeatureFlagsAndPayloadsStateless(t,i,c,d,n,a);l={...l,...h.flags||{}},p={...p,...h.payloads||{}}}return{featureFlags:l,featureFlagPayloads:p}}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)}withContext(t,r,i){return this.context?this.context.run(t,r,i):r()}getContext(){return this.context?.get()}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},n=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let a=new AbortController;n=D_n(()=>{a.abort()},this.options.requestTimeout),i.signal=a.signal}try{return await this.fetch(r,i)}catch(a){this._events.emit("error",a);return}finally{n&&clearTimeout(n)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let i={},n={};for(let[a,o]of Object.entries(t))if(a1_(o)&&r&&a in r){let c={};for(let[d,s]of Object.entries(o))c[String(d)]=String(s);n[String(a)]=c}else i[String(a)]=String(o);return{personProperties:i,groupProperties:n}}async getFeatureFlagsForEvent(t,r,i,n){let a=n?.personProperties||{},o=n?.groupProperties||{},c=n?.flagKeys;if(n?.onlyEvaluateLocally??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let s={};for(let[u,l]of Object.entries(r||{}))s[u]=String(l);return await this.getAllFlags(t,{groups:s,personProperties:a,groupProperties:o,disableGeoip:i,onlyEvaluateLocally:!0,flagKeys:c})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let s={};for(let[u,l]of Object.entries(r||{}))s[u]=String(l);return await this.getAllFlags(t,{groups:s,personProperties:a,groupProperties:o,disableGeoip:i,onlyEvaluateLocally:!0,flagKeys:c})}return(await super.getFeatureFlagsStateless(t,r,a,o,i)).flags}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...n?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,i){let n=new Error("PostHog syntheticException");this.addPendingPromise(SFi.buildEventMessage(t,{syntheticException:n},r,i).then(a=>this.capture(a)))}async captureExceptionImmediate(t,r,i){let n=new Error("PostHog syntheticException");this.addPendingPromise(SFi.buildEventMessage(t,{syntheticException:n},r,i).then(a=>this.captureImmediate(a)))}async prepareEventMessage(t){let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s}=t,u=this.context?.get(),l=r||u?.distinctId,p={...u?.properties||{},...n||{}};l||(l=HJt(),p.$process_person_profile=!1),u?.sessionId&&!p.$session_id&&(p.$session_id=u.sessionId);let _=this._runBeforeSend({distinctId:l,event:i,properties:p,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s});if(!_)return Promise.reject(null);let h=await Promise.resolve().then(async()=>{if(o){let y=typeof o=="object"?o:void 0;return await this.getFeatureFlagsForEvent(_.distinctId,a,d,y)}return _.event,{}}).then(y=>{let b={};if(y)for(let[O,A]of Object.entries(y))b[`$feature/${O}`]=A;let v=Object.keys(y||{}).filter(O=>y?.[O]!==!1).sort();return v.length>0&&(b.$active_feature_flags=v),b}).catch(()=>({})).then(y=>({...y,..._.properties||{},$groups:_.groups||a}));return _.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof h.$raw_user_agent=="string"&&kq_(h.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(_.event="$bot_pageview",h.$browser_type="bot"),{distinctId:_.distinctId,event:_.event,properties:h,options:{timestamp:_.timestamp,disableGeoip:_.disableGeoip,uuid:_.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let i=Array.isArray(r)?r:[r],n=t;for(let a of i){if(n=a(n),!n)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!n.properties||Object.keys(n.properties).length===0){let o=`Event '${n.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(o)}}return n}};var eT_=require("async_hooks"),T7o=class{constructor(){this.storage=new eT_.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,i){if(i?.fresh===!0)return this.storage.run(t,r);{let a=this.get()||{},o={distinctId:t.distinctId??a.distinctId,sessionId:t.sessionId??a.sessionId,properties:{...a.properties||{},...t.properties||{}}};return this.storage.run(o,r)}}};var tT_="posthog-node";function kJM(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}={}){return o=>{if(!(n==="*"||n.includes(o.level)))return o;o.tags||(o.tags={});let d=o.tags[Ewc.POSTHOG_ID_TAG];if(d===void 0)return o;let s=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${d}`,s).toString();o.tags["PostHog Person URL"]=u;let l=o.exception?.values||[],p=l.map(h=>({...h,stacktrace:h.stacktrace?{...h.stacktrace,type:"raw",frames:(h.stacktrace.frames||[]).map(y=>({...y,platform:"node:javascript"}))}:void 0})),_={$exception_message:l[0]?.value||o.message,$exception_type:l[0]?.type,$exception_level:o.level,$exception_list:p,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:l[0]?.value||o.message,$sentry_exception_type:l[0]?.type,$sentry_tags:o.tags};return t&&r&&(_.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+o.event_id),a&&e.capture({event:"$exception",distinctId:d,properties:_}),o}}var Ewc=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,i,n,a){this.name=tT_,this.name=tT_,this.setupOnce=function(o,c){let d=c()?.getClient()?.getDsn()?.projectId;o(kJM(t,{organization:r,projectId:d,prefix:i,severityAllowList:n,sendExceptionsToPostHog:a??!0}))}}};SFi.errorPropertiesBuilder=new h$.ErrorPropertiesBuilder([new h$.EventCoercer,new h$.ErrorCoercer,new h$.ObjectCoercer,new h$.StringCoercer,new h$.PrimitiveCoercer],h$.createStackParser("node:javascript",h$.nodeStackLineParser),[Jq_(),U1_]);var bkn=class extends q7o{getLibraryId(){return"posthog-node"}initializeContext(){return new T7o}};var R7o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new bkn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.30.4",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var KWa=class{async sendEvent(){}async identify(){}async flush(){}};var vkn=require("fs/promises"),aT_=require("os"),oT_=require("path");var rT_=ce(require("crypto")),N7o=new Uint8Array(256),z7o=N7o.length;function Swc(){return z7o>N7o.length-16&&(rT_.default.randomFillSync(N7o),z7o=0),N7o.slice(z7o,z7o+=16)}var L4=[];for(let e=0;e<256;++e)L4.push((e+256).toString(16).slice(1));function iT_(e,t=0){return L4[e[t+0]]+L4[e[t+1]]+L4[e[t+2]]+L4[e[t+3]]+"-"+L4[e[t+4]]+L4[e[t+5]]+"-"+L4[e[t+6]]+L4[e[t+7]]+"-"+L4[e[t+8]]+L4[e[t+9]]+"-"+L4[e[t+10]]+L4[e[t+11]]+L4[e[t+12]]+L4[e[t+13]]+L4[e[t+14]]+L4[e[t+15]]}var nT_=ce(require("crypto")),Mwc={randomUUID:nT_.default.randomUUID};function e$M(e,t,r){if(Mwc.randomUUID&&!t&&!e)return Mwc.randomUUID();e=e||{};let i=e.random||(e.rng||Swc)();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 iT_(i)}var ave=e$M;var t$M="id",r$M=".fern",JWa=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new bkn(r),this.userId=t==null?void 0:Ogc(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"3.30.4",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await I4({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ct(Cr.of((0,aT_.homedir)()),Ze.of(r$M),Ze.of(t$M));await ji(t)||(await(0,vkn.mkdir)((0,oT_.dirname)(t),{recursive:!0}),await(0,vkn.writeFile)(t,ave())),this.persistedDistinctId=(await(0,vkn.readFile)(t)).toString()}return this.persistedDistinctId}};var Dwc;async function gkn(){return Dwc==null&&(Dwc=await i$M()),Dwc}async function i$M(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new KWa;let r=await nWo();return r!=null?new JWa({token:r,posthogApiKey:e}):await MZn()!=null?new R7o({posthogApiKey:e}):new JWa({token:void 0,posthogApiKey:e})}catch{return new KWa}}function $Wa(e,t){return function(){return e.apply(t,arguments)}}var{toString:n$M}=Object.prototype,{getPrototypeOf:Iwc}=Object,{iterator:Q7o,toStringTag:sT_}=Symbol,U7o=(e=>t=>{let r=n$M.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),c3t=e=>(e=e.toLowerCase(),t=>U7o(t)===e),L7o=e=>t=>typeof t===e,{isArray:Akn}=Array,Okn=L7o("undefined");function YWa(e){return e!==null&&!Okn(e)&&e.constructor!==null&&!Okn(e.constructor)&&y$(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var cT_=c3t("ArrayBuffer");function a$M(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&cT_(e.buffer),t}var o$M=L7o("string"),y$=L7o("function"),lT_=L7o("number"),XWa=e=>e!==null&&typeof e=="object",u$M=e=>e===!0||e===!1,F7o=e=>{if(U7o(e)!=="object")return!1;let t=Iwc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(sT_ in e)&&!(Q7o in e)},s$M=e=>{if(!XWa(e)||YWa(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},c$M=c3t("Date"),l$M=c3t("File"),f$M=c3t("Blob"),d$M=c3t("FileList"),p$M=e=>XWa(e)&&y$(e.pipe),_$M=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||y$(e.append)&&((t=U7o(e))==="formdata"||t==="object"&&y$(e.toString)&&e.toString()==="[object FormData]"))},h$M=c3t("URLSearchParams"),[y$M,b$M,v$M,g$M]=["ReadableStream","Request","Response","Headers"].map(c3t),O$M=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ZWa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Akn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(YWa(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function fT_(e,t){if(YWa(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var B_n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dT_=e=>!Okn(e)&&e!==B_n;function Bwc(){let{caseless:e,skipUndefined:t}=dT_(this)&&this||{},r={},i=(n,a)=>{let o=e&&fT_(r,a)||a;F7o(r[o])&&F7o(n)?r[o]=Bwc(r[o],n):F7o(n)?r[o]=Bwc({},n):Akn(n)?r[o]=n.slice():(!t||!Okn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&ZWa(arguments[n],i);return r}var A$M=(e,t,r,{allOwnKeys:i}={})=>(ZWa(t,(n,a)=>{r&&y$(n)?e[a]=$Wa(n,r):e[a]=n},{allOwnKeys:i}),e),m$M=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),P$M=(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)},j$M=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&Iwc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},w$M=(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},E$M=e=>{if(!e)return null;if(Akn(e))return e;let t=e.length;if(!lT_(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},S$M=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Iwc(Uint8Array)),M$M=(e,t)=>{let i=(e&&e[Q7o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},D$M=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},B$M=c3t("HTMLFormElement"),I$M=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),uT_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),C$M=c3t("RegExp"),pT_=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ZWa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},q$M=e=>{pT_(e,(t,r)=>{if(y$(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(y$(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+"'")})}})},T$M=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return Akn(e)?i(e):i(String(e).split(t)),r},R$M=()=>{},z$M=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function N$M(e){return!!(e&&y$(e.append)&&e[sT_]==="FormData"&&e[Q7o])}var F$M=e=>{let t=new Array(10),r=(i,n)=>{if(XWa(i)){if(t.indexOf(i)>=0)return;if(YWa(i))return i;if(!("toJSON"in i)){t[n]=i;let a=Akn(i)?[]:{};return ZWa(i,(o,c)=>{let d=r(o,n+1);!Okn(d)&&(a[c]=d)}),t[n]=void 0,a}}return i};return r(e,0)},Q$M=c3t("AsyncFunction"),U$M=e=>e&&(XWa(e)||y$(e))&&y$(e.then)&&y$(e.catch),_T_=((e,t)=>e?setImmediate:t?((r,i)=>(B_n.addEventListener("message",({source:n,data:a})=>{n===B_n&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),B_n.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",y$(B_n.postMessage)),L$M=typeof queueMicrotask<"u"?queueMicrotask.bind(B_n):typeof process<"u"&&process.nextTick||_T_,V$M=e=>e!=null&&y$(e[Q7o]),rr={isArray:Akn,isArrayBuffer:cT_,isBuffer:YWa,isFormData:_$M,isArrayBufferView:a$M,isString:o$M,isNumber:lT_,isBoolean:u$M,isObject:XWa,isPlainObject:F7o,isEmptyObject:s$M,isReadableStream:y$M,isRequest:b$M,isResponse:v$M,isHeaders:g$M,isUndefined:Okn,isDate:c$M,isFile:l$M,isBlob:f$M,isRegExp:C$M,isFunction:y$,isStream:p$M,isURLSearchParams:h$M,isTypedArray:S$M,isFileList:d$M,forEach:ZWa,merge:Bwc,extend:A$M,trim:O$M,stripBOM:m$M,inherits:P$M,toFlatObject:j$M,kindOf:U7o,kindOfTest:c3t,endsWith:w$M,toArray:E$M,forEachEntry:M$M,matchAll:D$M,isHTMLForm:B$M,hasOwnProperty:uT_,hasOwnProp:uT_,reduceDescriptors:pT_,freezeMethods:q$M,toObjectSet:T$M,toCamelCase:I$M,noop:R$M,toFiniteNumber:z$M,findKey:fT_,global:B_n,isContextDefined:dT_,isSpecCompliantForm:N$M,toJSONObject:F$M,isAsyncFn:Q$M,isThenable:U$M,setImmediate:_T_,asap:L$M,isIterable:V$M};function mkn(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)}rr.inherits(mkn,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:rr.toJSONObject(this.config),code:this.code,status:this.status}}});var hT_=mkn.prototype,yT_={};["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=>{yT_[e]={value:e}});Object.defineProperties(mkn,yT_);Object.defineProperty(hT_,"isAxiosError",{value:!0});mkn.from=(e,t,r,i,n,a)=>{let o=Object.create(hT_);rr.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return mkn.call(o,c,d,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Ba=mkn;var bT_=ce(WXn(),1),V7o=bT_.default;function Cwc(e){return rr.isPlainObject(e)||rr.isArray(e)}function gT_(e){return rr.endsWith(e,"[]")?e.slice(0,-2):e}function vT_(e,t,r){return e?e.concat(t).map(function(n,a){return n=gT_(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function W$M(e){return rr.isArray(e)&&!e.some(Cwc)}var G$M=rr.toFlatObject(rr,{},null,function(t){return/^is[A-Z]/.test(t)});function H$M(e,t,r){if(!rr.isObject(e))throw new TypeError("target must be an object");t=t||new(V7o||FormData),r=rr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!rr.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&rr.isSpecCompliantForm(t);if(!rr.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(rr.isDate(h))return h.toISOString();if(rr.isBoolean(h))return h.toString();if(!d&&rr.isBlob(h))throw new Ba("Blob is not supported. Use a Buffer instead.");return rr.isArrayBuffer(h)||rr.isTypedArray(h)?d&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(rr.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(rr.isArray(h)&&W$M(h)||(rr.isFileList(h)||rr.endsWith(y,"[]"))&&(v=rr.toArray(h)))return y=gT_(y),v.forEach(function(A,g){!(rr.isUndefined(A)||A===null)&&t.append(o===!0?vT_([y],g,a):o===null?y:y+"[]",s(A))}),!1}return Cwc(h)?!0:(t.append(vT_(b,y,a),s(h)),!1)}let l=[],p=Object.assign(G$M,{defaultVisitor:u,convertValue:s,isVisitable:Cwc});function _(h,y){if(!rr.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),rr.forEach(h,function(v,O){(!(rr.isUndefined(v)||v===null)&&n.call(t,v,rr.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!rr.isObject(e))throw new TypeError("data must be an object");return _(e),t}var V7i=H$M;function OT_(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function AT_(e,t){this._pairs=[],e&&V7i(e,this,t)}var mT_=AT_.prototype;mT_.append=function(t,r){this._pairs.push([t,r])};mT_.toString=function(t){let r=t?function(i){return t.call(this,i,OT_)}:OT_;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var PT_=AT_;function x$M(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function I_n(e,t,r){if(!t)return e;let i=r&&r.encode||x$M;rr.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=rr.isURLSearchParams(t)?t.toString():new PT_(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var qwc=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){rr.forEach(this.handlers,function(i){i!==null&&t(i)})}},Twc=qwc;var Pkn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ST_=ce(require("crypto"),1);var jT_=ce(require("url"),1),wT_=jT_.default.URLSearchParams;var Rwc="abcdefghijklmnopqrstuvwxyz",ET_="0123456789",MT_={DIGIT:ET_,ALPHA:Rwc,ALPHA_DIGIT:Rwc+Rwc.toUpperCase()+ET_},K$M=(e=16,t=MT_.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);ST_.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},DT_={isNode:!0,classes:{URLSearchParams:wT_,FormData:V7o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:MT_,generateString:K$M,protocols:["http","https","file","data"]};var Fwc={};Zt(Fwc,{hasBrowserEnv:()=>Nwc,hasStandardBrowserEnv:()=>J$M,hasStandardBrowserWebWorkerEnv:()=>$$M,navigator:()=>zwc,origin:()=>Y$M});var Nwc=typeof window<"u"&&typeof document<"u",zwc=typeof navigator=="object"&&navigator||void 0,J$M=Nwc&&(!zwc||["ReactNative","NativeScript","NS"].indexOf(zwc.product)<0),$$M=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Y$M=Nwc&&window.location.href||"http://localhost";var om={...Fwc,...DT_};function Qwc(e,t){return V7i(e,new om.classes.URLSearchParams,{visitor:function(r,i,n,a){return om.isNode&&rr.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function X$M(e){return rr.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Z$M(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 k$M(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&rr.isArray(n)?n.length:o,d?(rr.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!rr.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&rr.isArray(n[o])&&(n[o]=Z$M(n[o])),!c)}if(rr.isFormData(e)&&rr.isFunction(e.entries)){let r={};return rr.forEachEntry(e,(i,n)=>{t(X$M(i),n,r,0)}),r}return null}var W7o=k$M;function eYM(e,t,r){if(rr.isString(e))try{return(t||JSON.parse)(e),rr.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Uwc={transitional:Pkn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=rr.isObject(t);if(a&&rr.isHTMLForm(t)&&(t=new FormData(t)),rr.isFormData(t))return n?JSON.stringify(W7o(t)):t;if(rr.isArrayBuffer(t)||rr.isBuffer(t)||rr.isStream(t)||rr.isFile(t)||rr.isBlob(t)||rr.isReadableStream(t))return t;if(rr.isArrayBufferView(t))return t.buffer;if(rr.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Qwc(t,this.formSerializer).toString();if((c=rr.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return V7i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),eYM(t)):t}],transformResponse:[function(t){let r=this.transitional||Uwc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(rr.isResponse(t)||rr.isReadableStream(t))return t;if(t&&rr.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Ba.from(c,Ba.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:om.classes.FormData,Blob:om.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};rr.forEach(["delete","get","head","post","put","patch"],e=>{Uwc.headers[e]={}});var jkn=Uwc;var tYM=rr.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"]),BT_=e=>{let t={},r,i,n;return e&&e.split(`
1149
1149
  `).forEach(function(o){n=o.indexOf(":"),r=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!r||t[r]&&tYM[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var IT_=Symbol("internals");function kWa(e){return e&&String(e).trim().toLowerCase()}function G7o(e){return e===!1||e==null?e:rr.isArray(e)?e.map(G7o):String(e)}function rYM(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 iYM=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Lwc(e,t,r,i,n){if(rr.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!rr.isString(t)){if(rr.isString(i))return t.indexOf(i)!==-1;if(rr.isRegExp(i))return i.test(t)}}function nYM(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function aYM(e,t){let r=rr.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,o){return this[i].call(this,t,n,a,o)},configurable:!0})})}var wkn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(c,d,s){let u=kWa(d);if(!u)throw new Error("header name must be a non-empty string");let l=rr.findKey(n,u);(!l||n[l]===void 0||s===!0||s===void 0&&n[l]!==!1)&&(n[l||d]=G7o(c))}let o=(c,d)=>rr.forEach(c,(s,u)=>a(s,u,d));if(rr.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(rr.isString(t)&&(t=t.trim())&&!iYM(t))o(BT_(t),r);else if(rr.isObject(t)&&rr.isIterable(t)){let c={},d,s;for(let u of t){if(!rr.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[s=u[0]]=(d=c[s])?rr.isArray(d)?[...d,u[1]]:[d,u[1]]:u[1]}o(c,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=kWa(t),t){let i=rr.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return rYM(n);if(rr.isFunction(r))return r.call(this,n,i);if(rr.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=kWa(t),t){let i=rr.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||Lwc(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(o){if(o=kWa(o),o){let c=rr.findKey(i,o);c&&(!r||Lwc(i,i[c],c,r))&&(delete i[c],n=!0)}}return rr.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||Lwc(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return rr.forEach(this,(n,a)=>{let o=rr.findKey(i,a);if(o){r[o]=G7o(n),delete r[a];return}let c=t?nYM(a):String(a).trim();c!==a&&delete r[a],r[c]=G7o(n),i[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return rr.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&rr.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(`
1150
1150
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[IT_]=this[IT_]={accessors:{}}).accessors,n=this.prototype;function a(o){let c=kWa(o);i[c]||(aYM(n,o),i[c]=!0)}return rr.isArray(t)?t.forEach(a):a(t),this}};wkn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);rr.reduceDescriptors(wkn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});rr.freezeMethods(wkn);var iD=wkn;function e5a(e,t){let r=this||jkn,i=t||r,n=iD.from(i.headers),a=i.data;return rr.forEach(e,function(c){a=c.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function t5a(e){return!!(e&&e.__CANCEL__)}function CT_(e,t,r){Ba.call(this,e??"canceled",Ba.ERR_CANCELED,t,r),this.name="CanceledError"}rr.inherits(CT_,Ba,{__CANCEL__:!0});var ove=CT_;function JJt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Ba("Request failed with status code "+r.status,[Ba.ERR_BAD_REQUEST,Ba.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Vwc(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Wwc(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function C_n(e,t,r){let i=!Vwc(t);return e&&(i||r==!1)?Wwc(e,t):t}var rR_=ce(Gwc(),1),iR_=ce(require("http"),1),nR_=ce(require("https"),1),aR_=ce(require("util"),1),oR_=ce(UT_(),1),DFi=ce(require("zlib"),1);var R_n="1.12.2";function o5a(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var mYM=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function iEc(e,t,r){let i=r&&r.Blob||om.classes.Blob,n=o5a(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=mYM.exec(e);if(!a)throw new Ba("Invalid URL",Ba.ERR_INVALID_URL);let o=a[1],c=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),c?"base64":"utf8");if(t){if(!i)throw new Ba("Blob is not supported",Ba.ERR_NOT_SUPPORT);return new i([s],{type:o})}return s}throw new Ba("Unsupported protocol "+n,Ba.ERR_NOT_SUPPORT)}var N_n=ce(require("stream"),1);var LT_=ce(require("stream"),1);var nEc=Symbol("internals"),aEc=class extends LT_.default.Transform{constructor(t){t=rr.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!rr.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[nEc]={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[nEc];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[nEc],a=n.maxRate,o=this.readableHighWaterMark,c=n.timeWindow,d=1e3/c,s=a/d,u=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,l=(_,h)=>{let y=Buffer.byteLength(_);n.bytesSeen+=y,n.bytes+=y,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(_)?process.nextTick(h):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(h)}},p=(_,h)=>{let y=Buffer.byteLength(_),b=null,v=o,O,A=0;if(a){let g=Date.now();(!n.ts||(A=g-n.ts)>=c)&&(n.ts=g,O=s-n.bytes,n.bytes=O<0?-O:0,A=0),O=s-n.bytes}if(a){if(O<=0)return setTimeout(()=>{h(null,_)},c-A);O<v&&(v=O)}v&&y>v&&y-v>u&&(b=_.subarray(v),_=_.subarray(0,v)),l(_,b?()=>{process.nextTick(h,null,b)}:h)};p(t,function _(h,y){if(h)return i(h);y?p(y,_):i(null)})}},oEc=aEc;var uR_=require("events");var WT_=ce(require("util"),1),GT_=require("stream");var{asyncIterator:VT_}=Symbol,PYM=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[VT_]?yield*e[VT_]():yield e},H7o=PYM;var jYM=om.ALPHABET.ALPHA_DIGIT+"-_",u5a=typeof TextEncoder=="function"?new TextEncoder:new WT_.default.TextEncoder,z_n=`\r
1151
1151
  `,wYM=u5a.encode(z_n),EYM=2,uEc=class{constructor(t,r){let{escapeName:i}=this.constructor,n=rr.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${z_n}`;n?r=u5a.encode(String(r).replace(/\r?\n|\r\n?/g,z_n)):a+=`Content-Type: ${r.type||"application/octet-stream"}${z_n}`,this.headers=u5a.encode(a+z_n),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+EYM,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;rr.isTypedArray(t)?yield t:yield*H7o(t),yield wYM}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},SYM=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+om.generateString(n,jYM)}=r||{};if(!rr.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=u5a.encode("--"+a+z_n),c=u5a.encode("--"+a+"--"+z_n),d=c.byteLength,s=Array.from(e.entries()).map(([l,p])=>{let _=new uEc(l,p);return d+=_.size,_});d+=o.byteLength*s.length,d=rr.toFiniteNumber(d);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(u["Content-Length"]=d),t&&t(u),GT_.Readable.from((async function*(){for(let l of s)yield o,yield*l.encode();yield c})())},HT_=SYM;var xT_=ce(require("stream"),1),sEc=class extends xT_.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)}},KT_=sEc;var MYM=(e,t)=>rr.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,JT_=MYM;function DYM(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,o;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),u=i[a];o||(o=s),r[n]=d,i[n]=s;let l=a,p=0;for(;l!==n;)p+=r[l++],l=l%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-o<t)return;let _=u&&s-u;return _?Math.round(p*1e3/_):void 0}}var $T_=DYM;function BYM(e,t){let r=0,i=1e3/t,n,a,o=(s,u=Date.now())=>{r=u,n=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let u=Date.now(),l=u-r;l>=i?o(s,u):(n=s,a||(a=setTimeout(()=>{a=null,o(n)},i-l)))},()=>n&&o(n)]}var YT_=BYM;var MFi=(e,t,r=3)=>{let i=0,n=$T_(50,250);return YT_(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,d=o-i,s=n(d),u=o<=c;i=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:d,rate:s||void 0,estimated:s&&c&&u?(c-o)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},Skn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},Mkn=e=>(...t)=>rr.asap(()=>e(...t));function cEc(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),i=e.slice(t+1);if(/;base64/i.test(r)){let a=i.length,o=i.length;for(let p=0;p<o;p++)if(i.charCodeAt(p)===37&&p+2<o){let _=i.charCodeAt(p+1),h=i.charCodeAt(p+2);(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(a-=2,p+=2)}let c=0,d=o-1,s=p=>p>=2&&i.charCodeAt(p-2)===37&&i.charCodeAt(p-1)===51&&(i.charCodeAt(p)===68||i.charCodeAt(p)===100);d>=0&&(i.charCodeAt(d)===61?(c++,d--):s(d)&&(c++,d-=3)),c===1&&d>=0&&(i.charCodeAt(d)===61||s(d))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(i,"utf8")}var XT_={flush:DFi.default.constants.Z_SYNC_FLUSH,finishFlush:DFi.default.constants.Z_SYNC_FLUSH},IYM={flush:DFi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:DFi.default.constants.BROTLI_OPERATION_FLUSH},ZT_=rr.isFunction(DFi.default.createBrotliDecompress),{http:CYM,https:qYM}=oR_.default,TYM=/https:?/,kT_=om.protocols.map(e=>e+":"),eR_=(e,[t,r])=>(e.on("end",r).on("error",r),t);function RYM(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function sR_(e,t,r){let i=t;if(!i&&i!==!1){let n=rR_.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){sR_(a,t,a.href)}}var zYM=typeof process<"u"&&rr.kindOf(process)==="process",NYM=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},o=d=>{a(d),t(d)},c=d=>{a(d,!0),r(d)};e(o,c,d=>i=d).catch(c)}),FYM=({address:e,family:t})=>{if(!rr.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},tR_=(e,t)=>FYM(rr.isObject(e)?e:{address:e,family:t}),cR_=zYM&&function(t){return NYM(async function(i,n,a){let{data:o,lookup:c,family:d}=t,{responseType:s,responseEncoding:u}=t,l=t.method.toUpperCase(),p,_=!1,h;if(c){let k=JT_(c,je=>rr.isArray(je)?je:[je]);c=(je,ve,H)=>{k(je,ve,(G,Ee,ue)=>{if(G)return H(G);let Oe=rr.isArray(Ee)?Ee.map(Qe=>tR_(Qe)):[tR_(Ee,ue)];ve.all?H(G,Oe):H(G,Oe[0].address,Oe[0].family)})}}let y=new uR_.EventEmitter,b=()=>{t.cancelToken&&t.cancelToken.unsubscribe(v),t.signal&&t.signal.removeEventListener("abort",v),y.removeAllListeners()};a((k,je)=>{p=!0,je&&(_=!0,b())});function v(k){y.emit("abort",!k||k.type?new ove(null,t,h):k)}y.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(v),t.signal&&(t.signal.aborted?v():t.signal.addEventListener("abort",v)));let O=C_n(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(O,om.hasBrowserEnv?om.origin:void 0),g=A.protocol||kT_[0];if(g==="data:"){if(t.maxContentLength>-1){let je=String(t.url||O||"");if(cEc(je)>t.maxContentLength)return n(new Ba("maxContentLength size of "+t.maxContentLength+" exceeded",Ba.ERR_BAD_RESPONSE,t))}let k;if(l!=="GET")return JJt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{k=iEc(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(je){throw Ba.from(je,Ba.ERR_BAD_REQUEST,t)}return s==="text"?(k=k.toString(u),(!u||u==="utf8")&&(k=rr.stripBOM(k))):s==="stream"&&(k=N_n.default.Readable.from(k)),JJt(i,n,{data:k,status:200,statusText:"OK",headers:new iD,config:t})}if(kT_.indexOf(g)===-1)return n(new Ba("Unsupported protocol "+g,Ba.ERR_BAD_REQUEST,t));let m=iD.from(t.headers).normalize();m.set("User-Agent","axios/"+R_n,!1);let{onUploadProgress:j,onDownloadProgress:S}=t,w=t.maxRate,D,B;if(rr.isSpecCompliantForm(o)){let k=m.getContentType(/boundary=([-_\w\d]{10,70})/i);o=HT_(o,je=>{m.set(je)},{tag:`axios-${R_n}-boundary`,boundary:k&&k[1]||void 0})}else if(rr.isFormData(o)&&rr.isFunction(o.getHeaders)){if(m.set(o.getHeaders()),!m.hasContentLength())try{let k=await aR_.default.promisify(o.getLength).call(o);Number.isFinite(k)&&k>=0&&m.setContentLength(k)}catch{}}else if(rr.isBlob(o)||rr.isFile(o))o.size&&m.setContentType(o.type||"application/octet-stream"),m.setContentLength(o.size||0),o=N_n.default.Readable.from(H7o(o));else if(o&&!rr.isStream(o)){if(!Buffer.isBuffer(o))if(rr.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(rr.isString(o))o=Buffer.from(o,"utf-8");else return n(new Ba("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Ba.ERR_BAD_REQUEST,t));if(m.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return n(new Ba("Request body larger than maxBodyLength limit",Ba.ERR_BAD_REQUEST,t))}let R=rr.toFiniteNumber(m.getContentLength());rr.isArray(w)?(D=w[0],B=w[1]):D=B=w,o&&(j||D)&&(rr.isStream(o)||(o=N_n.default.Readable.from(o,{objectMode:!1})),o=N_n.default.pipeline([o,new oEc({maxRate:rr.toFiniteNumber(D)})],rr.noop),j&&o.on("progress",eR_(o,Skn(R,MFi(Mkn(j),!1,3)))));let N;if(t.auth){let k=t.auth.username||"",je=t.auth.password||"";N=k+":"+je}if(!N&&A.username){let k=A.username,je=A.password;N=k+":"+je}N&&m.delete("authorization");let z;try{z=I_n(A.pathname+A.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(k){let je=new Error(k.message);return je.config=t,je.url=t.url,je.exists=!0,n(je)}m.set("Accept-Encoding","gzip, compress, deflate"+(ZT_?", br":""),!1);let F={path:z,method:l,headers:m.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:N,protocol:g,family:d,beforeRedirect:RYM,beforeRedirects:{}};!rr.isUndefined(c)&&(F.lookup=c),t.socketPath?F.socketPath=t.socketPath:(F.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,F.port=A.port,sR_(F,t.proxy,g+"//"+A.hostname+(A.port?":"+A.port:"")+F.path));let U,x=TYM.test(F.protocol);if(F.agent=x?t.httpsAgent:t.httpAgent,t.transport?U=t.transport:t.maxRedirects===0?U=x?nR_.default:iR_.default:(t.maxRedirects&&(F.maxRedirects=t.maxRedirects),t.beforeRedirect&&(F.beforeRedirects.config=t.beforeRedirect),U=x?qYM:CYM),t.maxBodyLength>-1?F.maxBodyLength=t.maxBodyLength:F.maxBodyLength=1/0,t.insecureHTTPParser&&(F.insecureHTTPParser=t.insecureHTTPParser),h=U.request(F,function(je){if(h.destroyed)return;let ve=[je],H=+je.headers["content-length"];if(S||B){let Qe=new oEc({maxRate:rr.toFiniteNumber(B)});S&&Qe.on("progress",eR_(Qe,Skn(H,MFi(Mkn(S),!0,3)))),ve.push(Qe)}let G=je,Ee=je.req||h;if(t.decompress!==!1&&je.headers["content-encoding"])switch((l==="HEAD"||je.statusCode===204)&&delete je.headers["content-encoding"],(je.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":ve.push(DFi.default.createUnzip(XT_)),delete je.headers["content-encoding"];break;case"deflate":ve.push(new KT_),ve.push(DFi.default.createUnzip(XT_)),delete je.headers["content-encoding"];break;case"br":ZT_&&(ve.push(DFi.default.createBrotliDecompress(IYM)),delete je.headers["content-encoding"])}G=ve.length>1?N_n.default.pipeline(ve,rr.noop):ve[0];let ue=N_n.default.finished(G,()=>{ue(),b()}),Oe={status:je.statusCode,statusText:je.statusMessage,headers:new iD(je.headers),config:t,request:Ee};if(s==="stream")Oe.data=G,JJt(i,n,Oe);else{let Qe=[],se=0;G.on("data",function($e){Qe.push($e),se+=$e.length,t.maxContentLength>-1&&se>t.maxContentLength&&(_=!0,G.destroy(),n(new Ba("maxContentLength size of "+t.maxContentLength+" exceeded",Ba.ERR_BAD_RESPONSE,t,Ee)))}),G.on("aborted",function(){if(_)return;let $e=new Ba("stream has been aborted",Ba.ERR_BAD_RESPONSE,t,Ee);G.destroy($e),n($e)}),G.on("error",function($e){h.destroyed||n(Ba.from($e,null,t,Ee))}),G.on("end",function(){try{let $e=Qe.length===1?Qe[0]:Buffer.concat(Qe);s!=="arraybuffer"&&($e=$e.toString(u),(!u||u==="utf8")&&($e=rr.stripBOM($e))),Oe.data=$e}catch($e){return n(Ba.from($e,null,t,Oe.request,Oe))}JJt(i,n,Oe)})}y.once("abort",Qe=>{G.destroyed||(G.emit("error",Qe),G.destroy())})}),y.once("abort",k=>{n(k),h.destroy(k)}),h.on("error",function(je){n(Ba.from(je,null,t,h))}),h.on("socket",function(je){je.setKeepAlive(!0,1e3*60)}),t.timeout){let k=parseInt(t.timeout,10);if(Number.isNaN(k)){n(new Ba("error trying to parse `config.timeout` to int",Ba.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(k,function(){if(p)return;let ve=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",H=t.transitional||Pkn;t.timeoutErrorMessage&&(ve=t.timeoutErrorMessage),n(new Ba(ve,H.clarifyTimeoutError?Ba.ETIMEDOUT:Ba.ECONNABORTED,t,h)),v()})}if(rr.isStream(o)){let k=!1,je=!1;o.on("end",()=>{k=!0}),o.once("error",ve=>{je=!0,h.destroy(ve)}),o.on("close",()=>{!k&&!je&&v(new ove("Request stream has been aborted",t,h))}),o.pipe(h)}else h.end(o)})};var lR_=om.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,om.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(om.origin),om.navigator&&/(msie|trident)/i.test(om.navigator.userAgent)):()=>!0;var fR_=om.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let o=[e+"="+encodeURIComponent(t)];rr.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),rr.isString(i)&&o.push("path="+i),rr.isString(n)&&o.push("domain="+n),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var dR_=e=>e instanceof iD?{...e}:e;function l3t(e,t){t=t||{};let r={};function i(s,u,l,p){return rr.isPlainObject(s)&&rr.isPlainObject(u)?rr.merge.call({caseless:p},s,u):rr.isPlainObject(u)?rr.merge({},u):rr.isArray(u)?u.slice():u}function n(s,u,l,p){if(rr.isUndefined(u)){if(!rr.isUndefined(s))return i(void 0,s,l,p)}else return i(s,u,l,p)}function a(s,u){if(!rr.isUndefined(u))return i(void 0,u)}function o(s,u){if(rr.isUndefined(u)){if(!rr.isUndefined(s))return i(void 0,s)}else return i(void 0,u)}function c(s,u,l){if(l in t)return i(s,u);if(l in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(s,u,l)=>n(dR_(s),dR_(u),l,!0)};return rr.forEach(Object.keys({...e,...t}),function(u){let l=d[u]||n,p=l(e[u],t[u],u);rr.isUndefined(p)&&l!==c||(r[u]=p)}),r}var x7o=e=>{let t=l3t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=iD.from(o),t.url=I_n(C_n(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),rr.isFormData(r)){if(om.hasStandardBrowserEnv||om.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(rr.isFunction(r.getHeaders)){let d=r.getHeaders(),s=["content-type","content-length"];Object.entries(d).forEach(([u,l])=>{s.includes(u.toLowerCase())&&o.set(u,l)})}}if(om.hasStandardBrowserEnv&&(i&&rr.isFunction(i)&&(i=i(t)),i||i!==!1&&lR_(t.url))){let d=n&&a&&fR_.read(a);d&&o.set(n,d)}return t};var QYM=typeof XMLHttpRequest<"u",pR_=QYM&&function(e){return new Promise(function(r,i){let n=x7o(e),a=n.data,o=iD.from(n.headers).normalize(),{responseType:c,onUploadProgress:d,onDownloadProgress:s}=n,u,l,p,_,h;function y(){_&&_(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(n.method.toUpperCase(),n.url,!0),b.timeout=n.timeout;function v(){if(!b)return;let A=iD.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),m={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:A,config:e,request:b};JJt(function(S){r(S),y()},function(S){i(S),y()},m),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(i(new Ba("Request aborted",Ba.ECONNABORTED,e,b)),b=null)},b.onerror=function(g){let m=g&&g.message?g.message:"Network Error",j=new Ba(m,Ba.ERR_NETWORK,e,b);j.event=g||null,i(j),b=null},b.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",m=n.transitional||Pkn;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),i(new Ba(g,m.clarifyTimeoutError?Ba.ETIMEDOUT:Ba.ECONNABORTED,e,b)),b=null},a===void 0&&o.setContentType(null),"setRequestHeader"in b&&rr.forEach(o.toJSON(),function(g,m){b.setRequestHeader(m,g)}),rr.isUndefined(n.withCredentials)||(b.withCredentials=!!n.withCredentials),c&&c!=="json"&&(b.responseType=n.responseType),s&&([p,h]=MFi(s,!0),b.addEventListener("progress",p)),d&&b.upload&&([l,_]=MFi(d),b.upload.addEventListener("progress",l),b.upload.addEventListener("loadend",_)),(n.cancelToken||n.signal)&&(u=A=>{b&&(i(!A||A.type?new ove(null,e,b):A),b.abort(),b=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let O=o5a(n.url);if(O&&om.protocols.indexOf(O)===-1){i(new Ba("Unsupported protocol "+O+":",Ba.ERR_BAD_REQUEST,e));return}b.send(a||null)})};var UYM=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,c();let u=s instanceof Error?s:this.reason;i.abort(u instanceof Ba?u:new ove(u instanceof Error?u.message:u))}},o=t&&setTimeout(()=>{o=null,a(new Ba(`timeout ${t} of ms exceeded`,Ba.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>rr.asap(c),d}},_R_=UYM;var LYM=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},VYM=async function*(e,t){for await(let r of WYM(e))yield*LYM(r,t)},WYM=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()}},lEc=(e,t,r,i)=>{let n=VYM(e,t),a=0,o,c=d=>{o||(o=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:u}=await n.next();if(s){c(),d.close();return}let l=u.byteLength;if(r){let p=a+=l;r(p)}d.enqueue(new Uint8Array(u))}catch(s){throw c(s),s}},cancel(d){return c(d),n.return()}},{highWaterMark:2})};var hR_=64*1024,{isFunction:K7o}=rr,GYM=(({Request:e,Response:t})=>({Request:e,Response:t}))(rr.global),{ReadableStream:yR_,TextEncoder:bR_}=rr.global,vR_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},HYM=e=>{e=rr.merge.call({skipUndefined:!0},GYM,e);let{fetch:t,Request:r,Response:i}=e,n=t?K7o(t):typeof fetch=="function",a=K7o(r),o=K7o(i);if(!n)return!1;let c=n&&K7o(yR_),d=n&&(typeof bR_=="function"?(h=>y=>h.encode(y))(new bR_):async h=>new Uint8Array(await new r(h).arrayBuffer())),s=a&&c&&vR_(()=>{let h=!1,y=new r(om.origin,{body:new yR_,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!y}),u=o&&c&&vR_(()=>rr.isReadableStream(new i("").body)),l={stream:u&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!l[h]&&(l[h]=(y,b)=>{let v=y&&y[h];if(v)return v.call(y);throw new Ba(`Response type '${h}' is not supported`,Ba.ERR_NOT_SUPPORT,b)})});let p=async h=>{if(h==null)return 0;if(rr.isBlob(h))return h.size;if(rr.isSpecCompliantForm(h))return(await new r(om.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(rr.isArrayBufferView(h)||rr.isArrayBuffer(h))return h.byteLength;if(rr.isURLSearchParams(h)&&(h=h+""),rr.isString(h))return(await d(h)).byteLength},_=async(h,y)=>{let b=rr.toFiniteNumber(h.getContentLength());return b??p(y)};return async h=>{let{url:y,method:b,data:v,signal:O,cancelToken:A,timeout:g,onDownloadProgress:m,onUploadProgress:j,responseType:S,headers:w,withCredentials:D="same-origin",fetchOptions:B}=x7o(h),R=t||fetch;S=S?(S+"").toLowerCase():"text";let N=_R_([O,A&&A.toAbortSignal()],g),z=null,F=N&&N.unsubscribe&&(()=>{N.unsubscribe()}),U;try{if(j&&s&&b!=="get"&&b!=="head"&&(U=await _(w,v))!==0){let G=new r(y,{method:"POST",body:v,duplex:"half"}),Ee;if(rr.isFormData(v)&&(Ee=G.headers.get("content-type"))&&w.setContentType(Ee),G.body){let[ue,Oe]=Skn(U,MFi(Mkn(j)));v=lEc(G.body,hR_,ue,Oe)}}rr.isString(D)||(D=D?"include":"omit");let x=a&&"credentials"in r.prototype,k={...B,signal:N,method:b.toUpperCase(),headers:w.normalize().toJSON(),body:v,duplex:"half",credentials:x?D:void 0};z=a&&new r(y,k);let je=await(a?R(z,B):R(y,k)),ve=u&&(S==="stream"||S==="response");if(u&&(m||ve&&F)){let G={};["status","statusText","headers"].forEach(Qe=>{G[Qe]=je[Qe]});let Ee=rr.toFiniteNumber(je.headers.get("content-length")),[ue,Oe]=m&&Skn(Ee,MFi(Mkn(m),!0))||[];je=new i(lEc(je.body,hR_,ue,()=>{Oe&&Oe(),F&&F()}),G)}S=S||"text";let H=await l[rr.findKey(l,S)||"text"](je,h);return!ve&&F&&F(),await new Promise((G,Ee)=>{JJt(G,Ee,{data:H,headers:iD.from(je.headers),status:je.status,statusText:je.statusText,config:h,request:z})})}catch(x){throw F&&F(),x&&x.name==="TypeError"&&/Load failed|fetch/i.test(x.message)?Object.assign(new Ba("Network Error",Ba.ERR_NETWORK,h,z),{cause:x.cause||x}):Ba.from(x,x&&x.code,h,z)}}},xYM=new Map,fEc=e=>{let t=e?e.env:{},{fetch:r,Request:i,Response:n}=t,a=[i,n,r],o=a.length,c=o,d,s,u=xYM;for(;c--;)d=a[c],s=u.get(d),s===void 0&&u.set(d,s=c?new Map:HYM(t)),u=s;return s},RE9=fEc();var dEc={http:cR_,xhr:pR_,fetch:{get:fEc}};rr.forEach(dEc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var gR_=e=>`- ${e}`,JYM=e=>rr.isFunction(e)||e===null||e===!1,J7o={getAdapter:(e,t)=>{e=rr.isArray(e)?e:[e];let{length:r}=e,i,n,a={};for(let o=0;o<r;o++){i=e[o];let c;if(n=i,!JYM(i)&&(n=dEc[(c=String(i)).toLowerCase()],n===void 0))throw new Ba(`Unknown adapter '${c}'`);if(n&&(rr.isFunction(n)||(n=n.get(t))))break;a[c||"#"+o]=n}if(!n){let o=Object.entries(a).map(([d,s])=>`adapter ${d} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
@@ -1246,7 +1246,7 @@ errors:
1246
1246
  status-code: 404
1247
1247
  type: MovieId
1248
1248
  `;async function nQ_({directoryOfWorkspace:e,cliVersion:t,context:r}){await ji(e)||await(0,rxi.mkdir)(e),await oQ_({filepath:Ct(e,Ze.of(YM)),cliVersion:t,context:r});let i=Ct(e,Ze.of(qq));await gtD({directoryOfDefinition:i})}async function aQ_({directoryOfWorkspace:e,openAPIFilePath:t,cliVersion:r,context:i}){await ji(e)||await(0,rxi.mkdir)(e),await oQ_({filepath:Ct(e,Ze.of(YM)),cliVersion:r,context:i,apiConfiguration:{specs:[{openapi:N_(e,t)}]}})}async function btD({cliVersion:e,context:t,apiConfiguration:r}){let i="fernapi/fern-typescript-sdk",n="fern-typescript-sdk",a=zVa[i],o=a.version,c=await FVt({cliVersion:e,generatorName:i,channel:void 0});c!=null?o=c:t.logger.debug(`Failed to get latest version for ${i} that is compatible with CLI ${e}, falling back to preset version ${o}`);let d={"default-group":IQa,groups:{[IQa]:{generators:[{name:n,...a,version:o}]}}};return r!=null&&(d.api=r),d}async function oQ_({filepath:e,cliVersion:t,context:r,apiConfiguration:i}){await(0,rxi.writeFile)(e,`# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
1249
- `+Bi.dump(await btD({cliVersion:t,context:r,apiConfiguration:i}),{sortKeys:(n,a)=>n==="api"?-1:a==="api"?1:n.localeCompare(a)}))}var vtD={name:"api","error-discrimination":{strategy:"status-code"}};async function gtD({directoryOfDefinition:e}){await(0,rxi.mkdir)(e),await(0,rxi.writeFile)(Ct(e,Ze.of(AB)),Bi.dump(vtD));let t=Ct(e,Ze.of("imdb.yml"));await(0,rxi.writeFile)(t,await G5a({fileContents:iQ_}))}async function jMc({organization:e,versionOfCli:t,openApiPath:r,context:i}){let{absolutePathToFernDirectory:n}=await uxo({organization:e,versionOfCli:t,taskContext:i}),a=await OtD({absolutePathToFernDirectory:n,taskContext:i});r!=null?(await aQ_({directoryOfWorkspace:a,openAPIFilePath:r,cliVersion:t,context:i}),i.logger.info(It.green("Created new API: ./"+uQ_.default.relative(process.cwd(),a)))):(await nQ_({directoryOfWorkspace:a,cliVersion:t,context:i}),i.logger.info(It.green("Created new fern folder")))}async function OtD({absolutePathToFernDirectory:e,taskContext:t}){if(await AtD({absolutePathToFernDirectory:e})){let n=0,a=Ct(e,Ze.of(czi)),o=Ct(a,Ze.of(`${Zec}`));for(;await ji(o);)o=Ct(a,Ze.of(`${Zec}${++n}`));return o}if(await mtD({absolutePathToFernDirectory:e})){t.logger.info("Creating workspaces to support multiple API Definitions.");let n=Ct(e,Ze.of(czi),Ze.of("api")),a=Ct(e,Ze.of(qq)),o=Ct(n,Ze.of(qq));await(0,mMc.mkdir)(n,{recursive:!0}),await PMc.default.move(a,o);let c=Ct(e,Ze.of(YM)),d=Ct(n,Ze.of(YM));await PMc.default.move(c,d);let s=Ct(e,Ze.of(czi),Ze.of("api1"));return await(0,mMc.mkdir)(o,{recursive:!0}),s}return e}async function AtD({absolutePathToFernDirectory:e}){let t=Ct(e,Ze.of(czi));return await ji(t)}async function mtD({absolutePathToFernDirectory:e}){let t=Ct(e,Ze.of(qq));return await ji(t)}var cQ_=require("fs/promises");var sQ_=ce(eQa(),1);function wMc(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,sQ_.default)(e,{special:PtD}).replace(/V\s(\d)/g,"V$1")}var PtD=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];async function EMc({organization:e,taskContext:t,versionOfCli:r}){let i=await uxo({organization:e,versionOfCli:r,taskContext:t});if(i.absolutePathToFernDirectory){let n=Ct(i.absolutePathToFernDirectory,Ze.of(c0));if(await ji(n)){t.logger.info(It.yellow(`Docs configuration already exists at: ${n}`));return}else try{let a=jtD(i.organization);await(0,cQ_.writeFile)(n,Bi.dump(a)),t.logger.info(It.green("Created docs configuration"));return}catch(a){let o=a instanceof Error?a.message:String(a);throw t.logger.debug(`Encountered an error while writing docs configuration: ${o}`),t.logger.error(It.red("Failed to write docs configuration")),a}}}function jtD(e){return{instances:[{url:`https://${e}.docs.buildwithfern.com`}],title:`${wMc(e)} | Documentation`,navigation:[{api:"API Reference",paginated:!0}],colors:{accentPrimary:"#ffffff",background:"#000000"}}}var H5a={searchbarPlacement:"header",pageWidth:"full",tabsPlacement:"header"};var G_n=class{context;constructor({context:t}){this.context=t}};var eKo=class{};var ywe=require("fs/promises");var H_n=class extends eKo{openApiSpecs={};nonTabbedNavigation=new MMc;tabbedNavigation={};markdownPages={};assets={};docsYml={instances:[]};generatorsYml={api:{specs:[]}};addOpenAPI({relativePathToOpenAPI:t,absolutePathToOpenAPI:r}){this.openApiSpecs[t]=r}addMarkdownPage({frontmatter:t,markdown:r,relativeFilePathFromDocsYml:i}){this.markdownPages[i]={markdown:r,frontmatter:t}}addAsset({absoluteFilePathToAsset:t,relativeFilePathFromDocsYml:r}){this.assets[r]={absoluteFilePathToAsset:t}}getNavigationBuilder(t){if(t!=null){let r=this.tabbedNavigation[t.tabId];return r==null&&(r=new SMc(t.tabId,t.tabConfig),this.tabbedNavigation[t.tabId]=r),r}return this.nonTabbedNavigation}addVersion({versionConfig:t,navigation:r}){throw new Error("Method not implemented.")}addNavbarLink({link:t}){this.docsYml.navbarLinks==null&&(this.docsYml.navbarLinks=[t]),this.docsYml.navbarLinks.push(t)}setTitle({title:t}){this.docsYml.title=t}setFavicon({favicon:t}){this.docsYml.favicon=t}setLogo({logo:t}){this.docsYml.logo=t}setColors({colors:t}){this.docsYml.colors=t}setLayout({layout:t}){this.docsYml.layout=t}async build({outputDirectory:t}){let r=Ct(t,Ze.of(QT));if(await(0,ywe.mkdir)(r,{recursive:!0}),Object.keys(this.tabbedNavigation).length>0){this.docsYml.tabs=Object.fromEntries(Object.entries(this.tabbedNavigation).map(([n,a])=>[a.tabId,a.tabConfig]));let i=[];Object.entries(this.tabbedNavigation).forEach(([n,a])=>{let o={tab:a.tabId,...a.items.length>0?{layout:a.items}:{}};i.push(o)}),this.docsYml.navigation=i}else this.nonTabbedNavigation!=null&&(this.docsYml.navigation=this.nonTabbedNavigation.items);Object.entries(this.openApiSpecs).length>0&&this.generatorsYml?.api!=null&&(typeof this.generatorsYml.api!="string"&&(this.generatorsYml.api={specs:Object.entries(this.openApiSpecs).map(([i])=>({openapi:i}))}),await(0,ywe.writeFile)(Ct(r,Ze.of(YM)),Bi.dump(_n.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml))),await Promise.all(Object.entries(this.openApiSpecs).map(async([i,n])=>{let a=Ct(r,Ze.of(i));await(0,ywe.mkdir)(tn(a),{recursive:!0}),await(0,ywe.cp)(n,a)}))),await(0,ywe.writeFile)(Ct(r,Ze.of(c0)),Bi.dump(fJ.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml,{omitUndefined:!0}))),await Promise.all(Object.entries(this.markdownPages).map(async([i,n])=>{let a=Ct(r,Ze.of(i));await(0,ywe.mkdir)(tn(a),{recursive:!0});let o=Object.keys(n.frontmatter).length>0?`---
1249
+ `+Bi.dump(await btD({cliVersion:t,context:r,apiConfiguration:i}),{sortKeys:(n,a)=>n==="api"?-1:a==="api"?1:n.localeCompare(a)}))}var vtD={name:"api","error-discrimination":{strategy:"status-code"}};async function gtD({directoryOfDefinition:e}){await(0,rxi.mkdir)(e),await(0,rxi.writeFile)(Ct(e,Ze.of(AB)),Bi.dump(vtD));let t=Ct(e,Ze.of("imdb.yml"));await(0,rxi.writeFile)(t,await G5a({fileContents:iQ_}))}async function jMc({organization:e,versionOfCli:t,openApiPath:r,context:i}){let{absolutePathToFernDirectory:n}=await uxo({organization:e,versionOfCli:t,taskContext:i}),a=await OtD({absolutePathToFernDirectory:n,taskContext:i});r!=null?(await aQ_({directoryOfWorkspace:a,openAPIFilePath:r,cliVersion:t,context:i}),i.logger.info(It.green("Created new API: ./"+uQ_.default.relative(process.cwd(),a)))):(await nQ_({directoryOfWorkspace:a,cliVersion:t,context:i}),i.logger.info(It.green("Created new fern folder")))}async function OtD({absolutePathToFernDirectory:e,taskContext:t}){if(await AtD({absolutePathToFernDirectory:e})){let n=0,a=Ct(e,Ze.of(czi)),o=Ct(a,Ze.of(`${Zec}`));for(;await ji(o);)o=Ct(a,Ze.of(`${Zec}${++n}`));return o}if(await mtD({absolutePathToFernDirectory:e})){t.logger.info("Creating workspaces to support multiple API Definitions.");let n=Ct(e,Ze.of(czi),Ze.of("api")),a=Ct(e,Ze.of(qq)),o=Ct(n,Ze.of(qq));await(0,mMc.mkdir)(n,{recursive:!0}),await PMc.default.move(a,o);let c=Ct(e,Ze.of(YM)),d=Ct(n,Ze.of(YM));await PMc.default.move(c,d);let s=Ct(e,Ze.of(czi),Ze.of("api1"));return await(0,mMc.mkdir)(o,{recursive:!0}),s}return e}async function AtD({absolutePathToFernDirectory:e}){let t=Ct(e,Ze.of(czi));return await ji(t)}async function mtD({absolutePathToFernDirectory:e}){let t=Ct(e,Ze.of(qq));return await ji(t)}var cQ_=require("fs/promises");var sQ_=ce(eQa(),1);function wMc(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,sQ_.default)(e,{special:PtD}).replace(/V\s(\d)/g,"V$1")}var PtD=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","ACH","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];async function EMc({organization:e,taskContext:t,versionOfCli:r}){let i=await uxo({organization:e,versionOfCli:r,taskContext:t});if(i.absolutePathToFernDirectory){let n=Ct(i.absolutePathToFernDirectory,Ze.of(c0));if(await ji(n)){t.logger.info(It.yellow(`Docs configuration already exists at: ${n}`));return}else try{let a=jtD(i.organization);await(0,cQ_.writeFile)(n,Bi.dump(a)),t.logger.info(It.green("Created docs configuration"));return}catch(a){let o=a instanceof Error?a.message:String(a);throw t.logger.debug(`Encountered an error while writing docs configuration: ${o}`),t.logger.error(It.red("Failed to write docs configuration")),a}}}function jtD(e){return{instances:[{url:`https://${e}.docs.buildwithfern.com`}],title:`${wMc(e)} | Documentation`,navigation:[{api:"API Reference",paginated:!0}],colors:{accentPrimary:"#ffffff",background:"#000000"}}}var H5a={searchbarPlacement:"header",pageWidth:"full",tabsPlacement:"header"};var G_n=class{context;constructor({context:t}){this.context=t}};var eKo=class{};var ywe=require("fs/promises");var H_n=class extends eKo{openApiSpecs={};nonTabbedNavigation=new MMc;tabbedNavigation={};markdownPages={};assets={};docsYml={instances:[]};generatorsYml={api:{specs:[]}};addOpenAPI({relativePathToOpenAPI:t,absolutePathToOpenAPI:r}){this.openApiSpecs[t]=r}addMarkdownPage({frontmatter:t,markdown:r,relativeFilePathFromDocsYml:i}){this.markdownPages[i]={markdown:r,frontmatter:t}}addAsset({absoluteFilePathToAsset:t,relativeFilePathFromDocsYml:r}){this.assets[r]={absoluteFilePathToAsset:t}}getNavigationBuilder(t){if(t!=null){let r=this.tabbedNavigation[t.tabId];return r==null&&(r=new SMc(t.tabId,t.tabConfig),this.tabbedNavigation[t.tabId]=r),r}return this.nonTabbedNavigation}addVersion({versionConfig:t,navigation:r}){throw new Error("Method not implemented.")}addNavbarLink({link:t}){this.docsYml.navbarLinks==null&&(this.docsYml.navbarLinks=[t]),this.docsYml.navbarLinks.push(t)}setTitle({title:t}){this.docsYml.title=t}setFavicon({favicon:t}){this.docsYml.favicon=t}setLogo({logo:t}){this.docsYml.logo=t}setColors({colors:t}){this.docsYml.colors=t}setLayout({layout:t}){this.docsYml.layout=t}async build({outputDirectory:t}){let r=Ct(t,Ze.of(QT));if(await(0,ywe.mkdir)(r,{recursive:!0}),Object.keys(this.tabbedNavigation).length>0){this.docsYml.tabs=Object.fromEntries(Object.entries(this.tabbedNavigation).map(([n,a])=>[a.tabId,a.tabConfig]));let i=[];Object.entries(this.tabbedNavigation).forEach(([n,a])=>{let o={tab:a.tabId,...a.items.length>0?{layout:a.items}:{}};i.push(o)}),this.docsYml.navigation=i}else this.nonTabbedNavigation!=null&&(this.docsYml.navigation=this.nonTabbedNavigation.items);Object.entries(this.openApiSpecs).length>0&&this.generatorsYml?.api!=null&&(typeof this.generatorsYml.api!="string"&&(this.generatorsYml.api={specs:Object.entries(this.openApiSpecs).map(([i])=>({openapi:i}))}),await(0,ywe.writeFile)(Ct(r,Ze.of(YM)),Bi.dump(_n.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml))),await Promise.all(Object.entries(this.openApiSpecs).map(async([i,n])=>{let a=Ct(r,Ze.of(i));await(0,ywe.mkdir)(tn(a),{recursive:!0}),await(0,ywe.cp)(n,a)}))),await(0,ywe.writeFile)(Ct(r,Ze.of(c0)),Bi.dump(fJ.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml,{omitUndefined:!0}))),await Promise.all(Object.entries(this.markdownPages).map(async([i,n])=>{let a=Ct(r,Ze.of(i));await(0,ywe.mkdir)(tn(a),{recursive:!0});let o=Object.keys(n.frontmatter).length>0?`---
1250
1250
  ${Bi.dump(JSON.parse(JSON.stringify(n.frontmatter)))}---
1251
1251
 
1252
1252
  `:"";await(0,ywe.writeFile)(a,`${o}${n.markdown}`)})),await Promise.all(Object.entries(this.assets).map(async([i,n])=>{let a=Ct(r,Ze.of(i));await(0,ywe.mkdir)(tn(a),{recursive:!0}),await(0,ywe.cp)(n.absoluteFilePathToAsset,a)}))}setInstance({companyName:t}){let i=`https://${t.toLowerCase().replace(" ","-")}.docs.buildwithfern.com`;return this.docsYml.instances.push({url:i}),i}},SMc=class{tabId;tabConfig;items=[];constructor(t,r){this.tabId=t,this.tabConfig=r}addItem({item:t}){this.items.push(t)}},MMc=class{items=[];addItem({item:t}){this.items.push(t)}};var gQ_=require("fs/promises");function lQ_(e){return{accentPrimary:{dark:e.dark??e.primary,light:e.light??e.primary},background:{dark:e.background?.dark,light:e.background?.light}}}var fQ_=28;function dQ_({logo:e,builder:t,absolutePathToMintJson:r}){if(e==null)return;if(typeof e=="string"){let a=Ze.of(Z3(e));return t.addAsset({absoluteFilePathToAsset:Ct(tn(r),a),relativeFilePathFromDocsYml:a}),{light:a,dark:a,height:fQ_}}let i=Ze.of(Z3(e.light));t.addAsset({absoluteFilePathToAsset:Ct(tn(r),i),relativeFilePathFromDocsYml:i});let n=Ze.of(Z3(e.dark));return t.addAsset({absoluteFilePathToAsset:Ct(tn(r),n),relativeFilePathFromDocsYml:n}),{light:i,dark:n,href:e.href,height:fQ_}}var pQ_=require("fs/promises"),_Q_=ce(Gbe(),1);async function hQ_({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,relativeFilepathFromRoot:r,builder:i}){let n=await(0,pQ_.readFile)(t,"utf-8"),{data:a,content:o}=wtD(n),c=r.replace(/\.(md|mdx)$/,""),d=StD({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,content:o,builder:i});return{mintlifyFrontmatter:a,relativeFilepathFromRoot:r,sidebarTitle:a.sidebarTitle??a.title??"Introduction",frontmatter:{"max-toc-depth":void 0,title:a.title,subtitle:a.description,layout:a.mode!=null?"reference":void 0,image:a["og:image"],slug:c,headline:void 0,description:void 0,"edit-this-page-url":void 0,"hide-toc":void 0,"hide-page-actions":void 0,"hide-feedback":void 0,"no-image-zoom":void 0,"force-toc":void 0,"hide-nav-links":void 0,"last-updated":void 0,breadcrumb:void 0,excerpt:void 0,"canonical-url":void 0,"og:site_name":void 0,"og:title":void 0,"og:description":void 0,"og:url":void 0,"og:image":void 0,"og:image:width":void 0,"og:image:height":void 0,"og:locale":void 0,"og:logo":void 0,"twitter:title":void 0,"twitter:description":void 0,"twitter:handle":void 0,"twitter:image":void 0,"twitter:site":void 0,"twitter:url":void 0,"twitter:card":void 0,noindex:void 0,nofollow:void 0,"jsonld:breadcrumb":void 0,logo:void 0,keywords:void 0,tags:void 0},content:d}}function wtD(e){let{data:t,content:r}=(0,_Q_.default)(e);return{data:t,content:r}}function EtD(e){return e.startsWith("http:")||e.startsWith("https:")||e.startsWith("mailto:")||e.startsWith("tel:")}function StD({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,content:r,builder:i}){return r.replaceAll(/src=["']([^"']+)["']/g,(a,o)=>{if(EtD(o))return a;if(o.startsWith("/")){let c=Ze.of(o.substring(1)),d=Ct(tn(e),c);return i.addAsset({absoluteFilePathToAsset:d,relativeFilePathFromDocsYml:c}),`src="${c}"`}return a})}async function DMc({absolutePathToMintJson:e,item:t,builder:r,context:i}){return{section:t.group,contents:(await Promise.all(t.pages.map(async a=>{if(typeof a=="string"){let o=Ze.of(a.endsWith("mdx")?a:`${a}.mdx`),c=Ct(tn(e),o);if(!await ji(c))return;let s=await hQ_({absolutePathToMintJson:e,relativeFilepathFromRoot:o,absoluteFilepathToMarkdown:c,builder:r});return s.mintlifyFrontmatter.openapi!=null?void 0:(r.addMarkdownPage({frontmatter:s.frontmatter,markdown:s.content,relativeFilePathFromDocsYml:o}),{page:s.sidebarTitle??"",icon:s.mintlifyFrontmatter.icon,path:o})}else return await DMc({absolutePathToMintJson:e,item:a,builder:r,context:i})}))).filter(As)}}function yQ_(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function bQ_({mintItem:e}){let t=vQ_({item:e});if(t!=null)return MtD({path:t})}function vQ_({item:e}){for(let t of e.pages){if(typeof t=="string")return t;{let r=vQ_({item:t});if(r!=null)return r}}}function MtD({path:e}){return e.split("/")[0]}var tKo=class extends G_n{documentationTab=void 0;tabUrlToInfo={};async import({args:t,builder:r}){let i=await(0,gQ_.readFile)(t.absolutePathToMintJson,"utf-8"),n=JSON.parse(i);r.setTitle({title:n.name});let a=Ze.of(n.favicon.substring(1));r.setFavicon({favicon:a}),r.addAsset({absoluteFilePathToAsset:Ct(tn(t.absolutePathToMintJson),a),relativeFilePathFromDocsYml:a});let o=dQ_({logo:n.logo,builder:r,absolutePathToMintJson:t.absolutePathToMintJson});o!=null&&r.setLogo({logo:o}),this.context.logger.debug("Converted logo");let c=lQ_(n.colors);if(c!=null&&r.setColors({colors:c}),this.context.logger.debug("Converted color configuration"),r.setLayout({layout:H5a}),n.tabs!=null)for(let s of n.tabs??[])this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.url,tabConfig:{slug:s.url,displayName:s.name}})};else if(n.anchors!=null)for(let s of n.anchors)"url"in s&&s.url!=null&&s.url.startsWith("https://")?this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.name,tabConfig:{href:s.url,displayName:s.name}})}:"url"in s&&s.url!=null&&(this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.url,tabConfig:{slug:s.url,displayName:s.name}})});for(let s of n.navigation){let u=await DMc({absolutePathToMintJson:t.absolutePathToMintJson,item:s,builder:r,context:this.context}),l=await this.getNavigationBuilder({mintItem:s,builder:r});u!=null&&l.addItem({item:u})}if(this.context.logger.debug("Converted navigation"),typeof n.openapi=="string"){let s=Ct(tn(t.absolutePathToMintJson),Ze.of(Z3(n.openapi)));r.addOpenAPI({relativePathToOpenAPI:Ze.of(Z3(n.openapi)),absolutePathToOpenAPI:s})}else if(n.openapi!=null)for(let s of n.openapi){let u=Ct(tn(t.absolutePathToMintJson),Ze.of(Z3(s)));r.addOpenAPI({relativePathToOpenAPI:Ze.of(Z3(s)),absolutePathToOpenAPI:u})}else if(n.anchors!=null){for(let s of n.anchors)if("openapi"in s&&s.openapi!=null){let u=Ct(tn(t.absolutePathToMintJson),Ze.of(Z3(s.openapi)));r.addOpenAPI({relativePathToOpenAPI:Ze.of(Z3(s.openapi)),absolutePathToOpenAPI:u})}}this.context.logger.debug("Imported OpenAPI specs");let d=r.setInstance({companyName:yQ_(n.name)});this.context.logger.debug(`Added instance ${d} to docs.yml`)}async getNavigationBuilder({mintItem:t,builder:r}){if(Object.keys(this.tabUrlToInfo).length>0){let i=bQ_({mintItem:t});return i==null?this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${t.group}`):(this.tabUrlToInfo[i]??this.getDefaultDocumentationTab(r)).navigationBuilder}return r.getNavigationBuilder()}getDefaultDocumentationTab(t){return this.documentationTab==null&&(this.documentationTab={name:"Documentation",url:"documentation",navigationBuilder:t.getNavigationBuilder({tabId:"documentation",tabConfig:{displayName:"Documentation",slug:"documentation"}})}),this.documentationTab}};var OQ_=require("fs/promises");async function BMc({absolutePathToMintJson:e,outputPath:t,taskContext:r,versionOfCli:i,organization:n}){let a=new tKo({context:r}),o=new H_n;await a.import({args:{absolutePathToMintJson:e},builder:o}),await o.build({outputDirectory:t}),await(0,OQ_.writeFile)(Ct(Cr.of(t),Ze.of(QT),Ze.of(t4)),JSON.stringify({version:i,organization:n},void 0,4))}var IMc=async({pathToMintJson:e,taskContext:t,versionOfCli:r,organization:i})=>{if(!e?.includes("mint.json")){t.failAndThrow("Provide a path to a mint.json file");return}let n;if(ufn(e)){t.failAndThrow("Clone the repo locally and run this command again by referencing the path to the local mint.json file");return}else n=Cr.of($u(XA(),e));if(!await ji(n)||!n){t.failAndThrow(`${n} does not exist`);return}let o=Cr.of(XA());await BMc({absolutePathToMintJson:n,outputPath:o,taskContext:t,versionOfCli:r,organization:i})};var bwe=(function(e){if(e==null)return CtD;if(typeof e=="function")return rKo(e);if(typeof e=="object")return Array.isArray(e)?DtD(e):BtD(e);if(typeof e=="string")return ItD(e);throw new Error("Expected function, string, or object as test")});function DtD(e){let t=[],r=-1;for(;++r<e.length;)t[r]=bwe(e[r]);return rKo(i);function i(...n){let a=-1;for(;++a<t.length;)if(t[a].apply(this,n))return!0;return!1}}function BtD(e){let t=e;return rKo(r);function r(i){let n=i,a;for(a in e)if(n[a]!==t[a])return!1;return!0}}function ItD(e){return rKo(t);function t(r){return r&&r.type===e}}function rKo(e){return t;function t(r,i,n){return!!(qtD(r)&&e.call(this,r,typeof i=="number"?i:void 0,n||void 0))}}function CtD(){return!0}function qtD(e){return e!==null&&typeof e=="object"&&"type"in e}function AQ_(e){return"\x1B[33m"+e+"\x1B[39m"}var mQ_=[],oa=!0,V_=!1,uve="skip";function x_n(e,t,r,i){let n;typeof t=="function"&&typeof r!="function"?(i=r,r=t):n=t;let a=bwe(n),o=i?-1:1;c(e,void 0,[])();function c(d,s,u){let l=d&&typeof d=="object"?d:{};if(typeof l.type=="string"){let _=typeof l.tagName=="string"?l.tagName:typeof l.name=="string"?l.name:void 0;Object.defineProperty(p,"name",{value:"node ("+AQ_(d.type+(_?"<"+_+">":""))+")"})}return p;function p(){let _=mQ_,h,y,b;if((!t||a(d,s,u[u.length-1]||void 0))&&(_=TtD(r(d,u)),_[0]===V_))return _;if("children"in d&&d.children){let v=d;if(v.children&&_[0]!==uve)for(y=(i?v.children.length:-1)+o,b=u.concat(v);y>-1&&y<v.children.length;){let O=v.children[y];if(h=c(O,y,b)(),h[0]===V_)return h;y=typeof h[1]=="number"?h[1]:y+o}}return _}}}function TtD(e){return Array.isArray(e)?e:typeof e=="number"?[oa,e]:e==null?mQ_:[e]}function Ui(e,t,r,i){let n,a,o;typeof t=="function"&&typeof r!="function"?(a=void 0,o=t,n=r):(a=t,o=r,n=i),x_n(e,a,c,n);function c(d,s){let u=s[s.length-1],l=u?u.children.indexOf(d):void 0;return o(d,l,u)}}var RtD=zt.array(zt.string());function iKo(e){zt.number().parse(e)}function Hkn(e){if(e===void 0||e==null)throw new Error("Value is nullable.")}function PQ_(e){RtD.parse(e)}var eKi=require("fs/promises");async function jQ_(e){let t="";return Ui(e,"element",function(r){return r.tagName==="link"&&Array.isArray(r.properties.rel)&&r.properties.rel.includes("icon")?(t=r.properties.href,V_):oa}),t}function vwe(e,t={delete:!0,nodeType:void 0,tagName:void 0}){let r="";return e?(Ui(e,t.nodeType?t.nodeType:e,function(i){return t.tagName&&i.type==="element"&&i.tagName!==t.tagName?oa:(Ui(i,"text",function(n,a,o){r+=n.value,t.delete&&o&&typeof a=="number"&&o.children.splice(a,1)}),V_)}),t.escaped?r.trim().replace(/"/g,'\\"'):r.trim()):r}function wQ_(e){let t;return Ui(e,"heading",function(r,i,n){return t=r,n&&typeof i=="number"&&n.children.splice(i,1),V_}),vwe(t,{delete:!0,escaped:!0})}function EQ_(e){let t;return Ui(e,"paragraph",function(r,i,n){return typeof i!="number"||i!==0||!n||n.type!=="root"?V_:(t=r,typeof i=="number"&&n.children.splice(i,1),V_)}),vwe(t,{delete:!0,escaped:!0})}function SQ_(e){e.startsWith("http")&&(e=new URL(e).pathname);let r=(e.split("/").at(-1)??"").split("-").flatMap(i=>i.split("_"));return r.forEach((i,n)=>{r[n]=i[0]?`${i[0].toUpperCase()}${i.substring(1)}`:i}),r.join(" ")}async function MQ_(e){let t="ENTER TITLE HERE",r;if(Ui(e,"element",function(a){return a.tagName!=="title"?oa:(Ui(a,"text",function(o){return r=o.value,V_}),r?V_:oa)}),!r)return t;let i=r,n="";return i.includes("|")?n=(i.split("|").at(-1)??"").trim():i.includes("\u2013")?n=(i.split("\u2013").at(-1)??"").trim():i.includes("-")?n=(i.split("-").at(-1)??"").trim():n=i.trim(),n||t}function xkn(e,t){let r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,n=r.indexOf(t);for(;n!==-1;)i++,n=r.indexOf(t,n+t.length);return i}var UI=ixi(/[A-Za-z]/),RB=ixi(/[\dA-Za-z]/),DQ_=ixi(/[#-'*+\--9=?A-Z^-~]/);function K_n(e){return e!==null&&(e<32||e===127)}var x5a=ixi(/\d/),BQ_=ixi(/[\dA-Fa-f]/),IQ_=ixi(/[!-/:-@[-`{-~]/);function on(e){return e!==null&&e<-2}function gd(e){return e!==null&&(e<0||e===32)}function xs(e){return e===-2||e===-1||e===32}var J_n=ixi(new RegExp("\\p{P}|\\p{S}","u")),iR=ixi(/\s/);function ixi(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function CMc(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qMc(e,t,r){let n=bwe((r||{}).ignore||[]),a=ztD(t),o=-1;for(;++o<a.length;)x_n(e,"text",c);function c(s,u){let l=-1,p;for(;++l<u.length;){let _=u[l],h=p?p.children:void 0;if(n(_,h?h.indexOf(_):void 0,p))return;p=_}if(p)return d(s,u)}function d(s,u){let l=u[u.length-1],p=a[o][0],_=a[o][1],h=0,b=l.children.indexOf(s),v=!1,O=[];p.lastIndex=0;let A=p.exec(s.value);for(;A;){let g=A.index,m={index:A.index,input:A.input,stack:[...u,s]},j=_(...A,m);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?p.lastIndex=g+1:(h!==g&&O.push({type:"text",value:s.value.slice(h,g)}),Array.isArray(j)?O.push(...j):j&&O.push(j),h=g+A[0].length,v=!0),!p.global)break;A=p.exec(s.value)}return v?(h<s.value.length&&O.push({type:"text",value:s.value.slice(h)}),l.children.splice(b,1,...O)):O=[s],b+O.length}}function ztD(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],i=-1;for(;++i<r.length;){let n=r[i];t.push([NtD(n[0]),FtD(n[1])])}return t}function NtD(e){return typeof e=="string"?new RegExp(CMc(e),"g"):e}function FtD(e){return typeof e=="function"?e:function(){return e}}var TMc="phrasing",RMc=["autolink","link","image","label"];function NMc(){return{transforms:[GtD],enter:{literalAutolink:QtD,literalAutolinkEmail:zMc,literalAutolinkHttp:zMc,literalAutolinkWww:zMc},exit:{literalAutolink:WtD,literalAutolinkEmail:VtD,literalAutolinkHttp:UtD,literalAutolinkWww:LtD}}}function FMc(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:TMc,notInConstruct:RMc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:TMc,notInConstruct:RMc},{character:":",before:"[ps]",after:"\\/",inConstruct:TMc,notInConstruct:RMc}]}}function QtD(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function zMc(e){this.config.enter.autolinkProtocol.call(this,e)}function UtD(e){this.config.exit.autolinkProtocol.call(this,e)}function LtD(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function VtD(e){this.config.exit.autolinkEmail.call(this,e)}function WtD(e){this.exit(e)}function GtD(e){qMc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,HtD],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xtD]],{ignore:["link","linkReference"]})}function HtD(e,t,r,i,n){let a="";if(!CQ_(n)||(/^w/i.test(t)&&(r=t+r,t="",a="http://"),!KtD(r)))return!1;let o=JtD(r+i);if(!o[0])return!1;let c={type:"link",title:null,url:a+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[c,{type:"text",value:o[1]}]:c}function xtD(e,t,r,i){return!CQ_(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function KtD(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function JtD(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],i=r.indexOf(")"),n=xkn(e,"("),a=xkn(e,")");for(;i!==-1&&n>a;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),a++;return[e,r]}function CQ_(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||iR(r)||J_n(r))&&(!t||r!==47)}function B8(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}qQ_.peek=irD;function $tD(){this.buffer()}function YtD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function XtD(){this.buffer()}function ZtD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ktD(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=B8(this.sliceSerialize(e)).toLowerCase(),r.label=t}function erD(e){this.exit(e)}function trD(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=B8(this.sliceSerialize(e)).toLowerCase(),r.label=t}function rrD(e){this.exit(e)}function irD(){return"["}function qQ_(e,t,r,i){let n=r.createTracker(i),a=n.move("[^"),o=r.enter("footnoteReference"),c=r.enter("reference");return a+=n.move(r.safe(r.associationId(e),{after:"]",before:a})),c(),o(),a+=n.move("]"),a}function QMc(){return{enter:{gfmFootnoteCallString:$tD,gfmFootnoteCall:YtD,gfmFootnoteDefinitionLabelString:XtD,gfmFootnoteDefinition:ZtD},exit:{gfmFootnoteCallString:ktD,gfmFootnoteCall:erD,gfmFootnoteDefinitionLabelString:trD,gfmFootnoteDefinition:rrD}}}function UMc(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:qQ_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,n,a,o){let c=a.createTracker(o),d=c.move("[^"),s=a.enter("footnoteDefinition"),u=a.enter("label");return d+=c.move(a.safe(a.associationId(i),{before:d,after:"]"})),u(),d+=c.move("]:"),i.children&&i.children.length>0&&(c.shift(4),d+=c.move((t?`
@@ -1389,7 +1389,7 @@ ${g}${O}${m}${Ona}`});function Qsu({message:e,error:t,logger:r,logLevel:i=yc.Err
1389
1389
  Run ${It.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1390
1390
  Run ${It.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),H7i(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function K4c({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!frh(e))return;let n=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,d)=>c.generatorName.localeCompare(d.generatorName)||c.currentVersion.localeCompare(d.currentVersion));for(let c of o)n+=`
1391
1391
  ${await RID(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+It.dim(c.currentVersion)+It.reset(" \u2192 ")+It.green(c.latestVersion);return n+=`
1392
- `,i?H7i(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function RID(e){let r=await new lrh.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 zID({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=xGi(u.name,l),_=await FVt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=xGi(s.name,u),p=await FVt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await eve({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(c==null||c.groups==null)return;let d=i!=null?yN(i):void 0;for(let s of c.groups)if(!(n!=null&&s.groupName!==n))for(let u of s.generators)d!=null&&u.name!==d||await r(a.workspaceName,s.groupName,u,o)})}))}function _rh(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let d=U$(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function Wsu({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await zID({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(..._rh(s,d,t.logger));else o.push(..._rh(c.versions,void 0,t.logger))}return o}var OHa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var jna=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var J4c=(()=>{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})(),hrh=typeof globalThis.AbortController=="function",yrh=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",brh=typeof globalThis.ReadableStream=="function",vrh=typeof globalThis.FormData=="function",Gsu=["get","post","put","patch","head","delete"],NID=()=>{};NID();var grh={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Hsu=2147483647,Orh=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,xsu=Symbol("stop"),Arh={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},mrh={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 FID=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=Orh,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},Prh=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},jrh=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(Prh(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wrh=(e,t,r)=>{if(!e.body)return e;let i=FID(r??e.body);return new Request(e,{duplex:"half",body:Prh(e.body,i,t)})};var wna=e=>e!==null&&typeof e=="object";var AHa=(...e)=>{for(let t of e)if((!wna(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return X4c({},...e)},$4c=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Ksu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:X4c(e[r]??[],t[r]??[])}var Y4c=(e={},t={})=>({beforeRequest:Ksu(e,t,"beforeRequest"),beforeRetry:Ksu(e,t,"beforeRetry"),afterResponse:Ksu(e,t,"afterResponse"),beforeError:Ksu(e,t,"beforeError")}),X4c=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(wna(n)){for(let[a,o]of Object.entries(n))wna(o)&&a in t&&(o=X4c(t[a],o)),t={...t,[a]:o};wna(n.hooks)&&(i=Y4c(i,n.hooks),t.hooks=i),wna(n.headers)&&(r=$4c(r,n.headers),t.headers=r)}return t};var Srh=e=>Gsu.includes(e)?e.toUpperCase():e,QID=["get","put","head","delete","options","trace"],UID=[408,413,429,500,502,503,504],LID=[413,429,503],Erh={limit:2,methods:QID,statusCodes:UID,afterStatusCodes:LID,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Mrh=(e={})=>{if(typeof e=="number")return{...Erh,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{...Erh,...e}};async function Z4c(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jna(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function k4c(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 Drh=(e,t)=>{let r={};for(let i in t)!(i in mrh)&&!(i in Arh)&&!(i in e)&&(r[i]=t[i]);return r},Brh=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var mHa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Hsu)throw new RangeError(`The \`timeout\` option cannot be greater than ${Hsu}`);await Promise.resolve();let c=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let d=new OHa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!brh)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return jrh(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),i.request.bodyUsed||d.push(i.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(grh))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:$4c(this._input.headers,r.headers),hooks:Y4c({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Srh(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Mrh(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(hrh&&yrh){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(J4c&&(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),Brh(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(vrh&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!J4c)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wrh(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jna)throw t;if(t instanceof OHa){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),Hsu);if(this._retryCount<1)throw r;await k4c(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})===xsu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Drh(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):Z4c(this._originalRequest,t,this.abortController,this._options)}};var eLc=e=>{let t=(r,i)=>mHa.create(r,AHa(e,i));for(let r of Gsu)t[r]=(i,n)=>mHa.create(i,AHa(e,n,{method:r}));return t.create=r=>eLc(AHa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),eLc(AHa(e,r))),t.stop=xsu,t},VID=eLc(),Irh=VID;var eih=ce(krh(),1);function aLc(e){let t=(0,eih.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Jih=ce(Kih(),1),$ih=ce(Sbe(),1),vLc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},gLc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function OLc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??aLc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Jih.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await Irh(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new vLc(e):l}if(t.allVersions)return s;let u=new gLc(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(i&&!l)for(let[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=$ih.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function MHa(e,t){let{version:r}=await OLc(e.toLowerCase(),t);return r}async function QKi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:MHa(e.packageName,{version:t?"prerelease":"latest"})}var Yih=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],acu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=yc.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new Vsu(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.30.3"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${It.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new YS}failWithoutThrowing(t,r){this.didSucceed=!1,Qsu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await gkn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await drh({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1392
+ `,i?H7i(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function RID(e){let r=await new lrh.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 zID({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=xGi(u.name,l),_=await FVt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=xGi(s.name,u),p=await FVt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function prh({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await eve({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(c==null||c.groups==null)return;let d=i!=null?yN(i):void 0;for(let s of c.groups)if(!(n!=null&&s.groupName!==n))for(let u of s.generators)d!=null&&u.name!==d||await r(a.workspaceName,s.groupName,u,o)})}))}function _rh(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let d=U$(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function Wsu({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await zID({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(..._rh(s,d,t.logger));else o.push(..._rh(c.versions,void 0,t.logger))}return o}var OHa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var jna=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var J4c=(()=>{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})(),hrh=typeof globalThis.AbortController=="function",yrh=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",brh=typeof globalThis.ReadableStream=="function",vrh=typeof globalThis.FormData=="function",Gsu=["get","post","put","patch","head","delete"],NID=()=>{};NID();var grh={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Hsu=2147483647,Orh=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,xsu=Symbol("stop"),Arh={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},mrh={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 FID=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=Orh,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},Prh=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},jrh=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(Prh(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wrh=(e,t,r)=>{if(!e.body)return e;let i=FID(r??e.body);return new Request(e,{duplex:"half",body:Prh(e.body,i,t)})};var wna=e=>e!==null&&typeof e=="object";var AHa=(...e)=>{for(let t of e)if((!wna(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return X4c({},...e)},$4c=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Ksu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:X4c(e[r]??[],t[r]??[])}var Y4c=(e={},t={})=>({beforeRequest:Ksu(e,t,"beforeRequest"),beforeRetry:Ksu(e,t,"beforeRetry"),afterResponse:Ksu(e,t,"afterResponse"),beforeError:Ksu(e,t,"beforeError")}),X4c=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(wna(n)){for(let[a,o]of Object.entries(n))wna(o)&&a in t&&(o=X4c(t[a],o)),t={...t,[a]:o};wna(n.hooks)&&(i=Y4c(i,n.hooks),t.hooks=i),wna(n.headers)&&(r=$4c(r,n.headers),t.headers=r)}return t};var Srh=e=>Gsu.includes(e)?e.toUpperCase():e,QID=["get","put","head","delete","options","trace"],UID=[408,413,429,500,502,503,504],LID=[413,429,503],Erh={limit:2,methods:QID,statusCodes:UID,afterStatusCodes:LID,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Mrh=(e={})=>{if(typeof e=="number")return{...Erh,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{...Erh,...e}};async function Z4c(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jna(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function k4c(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 Drh=(e,t)=>{let r={};for(let i in t)!(i in mrh)&&!(i in Arh)&&!(i in e)&&(r[i]=t[i]);return r},Brh=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var mHa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Hsu)throw new RangeError(`The \`timeout\` option cannot be greater than ${Hsu}`);await Promise.resolve();let c=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let d=new OHa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!brh)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return jrh(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),i.request.bodyUsed||d.push(i.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(grh))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:$4c(this._input.headers,r.headers),hooks:Y4c({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Srh(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Mrh(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(hrh&&yrh){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(J4c&&(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),Brh(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(vrh&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!J4c)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wrh(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jna)throw t;if(t instanceof OHa){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),Hsu);if(this._retryCount<1)throw r;await k4c(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})===xsu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Drh(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):Z4c(this._originalRequest,t,this.abortController,this._options)}};var eLc=e=>{let t=(r,i)=>mHa.create(r,AHa(e,i));for(let r of Gsu)t[r]=(i,n)=>mHa.create(i,AHa(e,n,{method:r}));return t.create=r=>eLc(AHa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),eLc(AHa(e,r))),t.stop=xsu,t},VID=eLc(),Irh=VID;var eih=ce(krh(),1);function aLc(e){let t=(0,eih.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Jih=ce(Kih(),1),$ih=ce(Sbe(),1),vLc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},gLc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function OLc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??aLc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Jih.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await Irh(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new vLc(e):l}if(t.allVersions)return s;let u=new gLc(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(i&&!l)for(let[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=$ih.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function MHa(e,t){let{version:r}=await OLc(e.toLowerCase(),t);return r}async function QKi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:MHa(e.packageName,{version:t?"prerelease":"latest"})}var Yih=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],acu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=yc.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new Vsu(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.30.4"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${It.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new YS}failWithoutThrowing(t,r){this.didSucceed=!1,Qsu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await gkn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await drh({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1393
1393
  `)||(r+=`
1394
1394
  `),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=B2s(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 _Ha(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 YS}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await gkn()).sendEvent(t)}logger=zHt((t,...r)=>this.log(t,...r));stderr=zHt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=Xih(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Xih(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=Yih[this.numTasks++%Yih.length],o=It.hex(a)(n);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===jw.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let i=t.filter(n=>hGi.indexOf(n.level)>=hGi.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===yc.Debug,stderr:r})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await QKi({cliEnvironment:this.environment,includePreReleases:t}),i=U$(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await Wsu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await R4c({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:It.yellow("?"),style:{answer:n=>It.cyan(n),message:n=>It.bold(n),highlight:n=>It.cyan(n)}}})}catch(i){throw i?.name==="ExitPromptError"?(this.logger.info(`
1395
1395
  Cancelled by user.`),new YS):i}}async getInput(t){return await I4c({message:t.message,default:t.default})}};function Xih(e){return`[${e}]:`}var L3t=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};function ocu(e,t,r,i){if(typeof r!="function")throw new Error("method for before hook must be a function");return i||(i={}),Array.isArray(t)?t.reverse().reduce((n,a)=>ocu.bind(null,e,a,n,i),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((n,a)=>a.hook.bind(null,n,i),r)():r(i))}function Zih(e,t,r,i){let n=i;e.registry[r]||(e.registry[r]=[]),t==="before"&&(i=(a,o)=>Promise.resolve().then(n.bind(null,o)).then(a.bind(null,o))),t==="after"&&(i=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(d=>(c=d,n(c,o))).then(()=>c)}),t==="error"&&(i=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>n(c,o))),e.registry[r].push({hook:i,orig:n})}function kih(e,t,r){if(!e.registry[t])return;let i=e.registry[t].map(n=>n.orig).indexOf(r);i!==-1&&e.registry[t].splice(i,1)}var enh=Function.bind,tnh=enh.bind(enh);function rnh(e,t,r){let i=tnh(kih,null).apply(null,r?[t,r]:[t]);e.api={remove:i},e.remove=i,["before","error","after","wrap"].forEach(n=>{let a=r?[t,n,r]:[t,n];e[n]=e.api[n]=tnh(Zih,null).apply(null,a)})}function JCD(){let e=Symbol("Singular"),t={registry:{}},r=ocu.bind(null,t,e);return rnh(r,t,e),r}function $CD(){let e={registry:{}},t=ocu.bind(null,e);return rnh(t,e),t}var inh={Singular:JCD,Collection:$CD};var YCD="0.0.0-development",XCD=`octokit-endpoint.js/${YCD} ${AN()}`,ZCD={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":XCD},mediaType:{format:""}};function kCD(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function eqD(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function onh(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(i=>{eqD(t[i])?i in e?r[i]=onh(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})}),r}function nnh(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function mLc(e,t,r){if(typeof t=="string"){let[n,a]=t.split(" ");r=Object.assign(a?{method:n,url:a}:{url:n},r)}else r=Object.assign({},t);r.headers=kCD(r.headers),nnh(r),nnh(r.headers);let i=onh(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(i.mediaType.previews=e.mediaType.previews.filter(n=>!i.mediaType.previews.includes(n)).concat(i.mediaType.previews)),i.mediaType.previews=(i.mediaType.previews||[]).map(n=>n.replace(/-preview/,""))),i}function tqD(e,t){let r=/\?/.test(e)?"&":"?",i=Object.keys(t);return i.length===0?e:e+r+i.map(n=>n==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${n}=${encodeURIComponent(t[n])}`).join("&")}var rqD=/\{[^{}}]+\}/g;function iqD(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function nqD(e){let t=e.match(rqD);return t?t.map(iqD).reduce((r,i)=>r.concat(i),[]):[]}function anh(e,t){let r={__proto__:null};for(let i of Object.keys(e))t.indexOf(i)===-1&&(r[i]=e[i]);return r}function unh(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function qna(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function DHa(e,t,r){return t=e==="+"||e==="#"?unh(t):qna(t),r?qna(r)+"="+t:t}function Cna(e){return e!=null}function ALc(e){return e===";"||e==="&"||e==="?"}function aqD(e,t,r,i){var n=e[r],a=[];if(Cna(n)&&n!=="")if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")n=n.toString(),i&&i!=="*"&&(n=n.substring(0,parseInt(i,10))),a.push(DHa(t,n,ALc(t)?r:""));else if(i==="*")Array.isArray(n)?n.filter(Cna).forEach(function(o){a.push(DHa(t,o,ALc(t)?r:""))}):Object.keys(n).forEach(function(o){Cna(n[o])&&a.push(DHa(t,n[o],o))});else{let o=[];Array.isArray(n)?n.filter(Cna).forEach(function(c){o.push(DHa(t,c))}):Object.keys(n).forEach(function(c){Cna(n[c])&&(o.push(qna(c)),o.push(DHa(t,n[c].toString())))}),ALc(t)?a.push(qna(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?Cna(n)&&a.push(qna(r)):n===""&&(t==="&"||t==="?")?a.push(qna(r)+"="):n===""&&a.push("");return a}function oqD(e){return{expand:uqD.bind(null,e)}}function uqD(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(i,n,a){if(n){let c="",d=[];if(r.indexOf(n.charAt(0))!==-1&&(c=n.charAt(0),n=n.substr(1)),n.split(/,/g).forEach(function(s){var u=/([^:\*]*)(?::(\d+)|(\*))?/.exec(s);d.push(aqD(t,c,u[1],u[2]||u[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(d.length!==0?c:"")+d.join(o)}else return d.join(",")}else return unh(a)}),e==="/"?e:e.replace(/\/$/,"")}function snh(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),i=Object.assign({},e.headers),n,a=anh(e,["method","baseUrl","url","headers","request","mediaType"]),o=nqD(r);r=oqD(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(u=>o.includes(u)).concat("baseUrl"),d=anh(a,c);if(!/application\/octet-stream/i.test(i.accept)&&(e.mediaType.format&&(i.accept=i.accept.split(/,/).map(u=>u.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let u=i.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];i.accept=u.concat(e.mediaType.previews).map(l=>{let p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?r=tqD(r,d):"data"in d?n=d.data:Object.keys(d).length&&(n=d),!i["content-type"]&&typeof n<"u"&&(i["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof n>"u"&&(n=""),Object.assign({method:t,url:r,headers:i},typeof n<"u"?{body:n}:null,e.request?{request:e.request}:null)}function sqD(e,t,r){return snh(mLc(e,t,r))}function cnh(e,t){let r=mLc(e,t),i=sqD.bind(null,r);return Object.assign(i,{DEFAULTS:r,defaults:cnh.bind(null,r),merge:mLc.bind(null,r),parse:snh})}var lnh=cnh(null,ZCD);var ynh=ce(_nh(),1);var V3t=class extends Error{name;status;request;response;constructor(t,r,i){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in i&&(this.response=i.response);let n=Object.assign({},i.request);i.request.headers.authorization&&(n.headers=Object.assign({},i.request.headers,{authorization:i.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),n.url=n.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=n}};var cqD="10.0.6",lqD={headers:{"user-agent":`octokit-request.js/${cqD} ${AN()}`}};function fqD(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function hnh(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,i=e.request?.parseSuccessResponseBody!==!1,n=fqD(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,p])=>[l,String(p)])),o;try{o=await t(e.url,{method:e.method,body:n,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let p="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;p=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?p=l.cause.message:typeof l.cause=="string"&&(p=l.cause))}let _=new V3t(p,500,{request:e});throw _.cause=l,_}let c=o.status,d=o.url,s={};for(let[l,p]of o.headers)s[l]=p;let u={url:d,status:c,headers:s,data:""};if("deprecation"in s){let l=s.link&&s.link.match(/<([^<>]+)>; rel="deprecation"/),p=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${s.sunset}${p?`. See ${p}`:""}`)}if(c===204||c===205)return u;if(e.method==="HEAD"){if(c<400)return u;throw new V3t(o.statusText,c,{response:u,request:e})}if(c===304)throw u.data=await PLc(o),new V3t("Not modified",c,{response:u,request:e});if(c>=400)throw u.data=await PLc(o),new V3t(pqD(u.data),c,{response:u,request:e});return u.data=i?await PLc(o):o.body,u}async function PLc(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,ynh.safeParse)(t);if(dqD(r)){let i="";try{return i=await e.text(),JSON.parse(i)}catch{return i}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function dqD(e){return e.type==="application/json"||e.type==="application/scim+json"}function pqD(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function jLc(e,t){let r=e.defaults(t);return Object.assign(function(n,a){let o=r.merge(n,a);if(!o.request||!o.request.hook)return hnh(r.parse(o));let c=(d,s)=>hnh(r.parse(r.merge(d,s)));return Object.assign(c,{endpoint:r,defaults:jLc.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:jLc.bind(null,r)})}var MA=jLc(lnh,lqD);var _qD="0.0.0-development";function hqD(e){return`Request failed due to following response errors:
@@ -1781,7 +1781,7 @@ A valid API configuration was not found at the path: fern/apis/${t.apiName}.
1781
1781
  Learn more about project structure:
1782
1782
  https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions`:`Failed to load API Definition referenced in docs.
1783
1783
  Learn more about project structure:
1784
- https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions`;throw new Error(r)}async toRootNode(){let t=Rt.V1.SlugGenerator.init(Rt.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),i=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:i,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(n=>Rt.RoleId(n)),featureFlags:void 0}}async toRootChild(t){return Tln(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let i=Rt.PageId(this.toRelativeFilepath(t.absolutePath)),n=r.apply({urlSlug:t.slug??KE(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(i),title:t.title,slug:n.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:i,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:i}){let n=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,i):void 0,o=r.type==="tabbed"?await this.convertTabbedNavigation(n,r.items,i):await this.toSidebarRootNode(n,r.items,i);return{type:"unversioned",id:n,landingPage:a,child:o}}async toVersionedNode(t,r){let i=this.#e.get("versioned"),n=t.versions[0];if(n?.hidden===!0)throw new Error(`The default version "${n.version}" cannot be hidden. Please set a non-hidden version as the first version in your versions list, or remove the hidden flag from the default version.`);return{id:i,type:"versioned",children:await Promise.all(t.versions.map((a,o)=>this.toVersionNode(a,r,o===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:i}){let n=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,i):void 0;return{id:n,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(o=>this.toProductNode(o,i)))}}async toProductNode(t,r){if(t.type==="internal"){let i=r.setProductSlug(t.slug??KE(t.product)),n;switch(t.navigation.type){case"tabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,i)};break;case"untabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,i)};break;case"versioned":n=await this.toVersionedNode(t.navigation,i);break;default:gt(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:Rt.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:i.get(),child:n,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,announcement:t.announcement!=null?{text:t.announcement.message}:void 0}}else return{type:"productLink",id:this.#e.get(t.product),productId:Rt.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",href:yG.Url(t.href??""),target:t.target,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,viewers:t.viewers,orphaned:t.orphaned}}async toVersionNode(t,r,i){let n=this.#e.get(t.version),a=r.setVersionSlug(t.slug??KE(t.version)),o=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(n,t.navigation.items,a):await this.toSidebarRootNode(n,t.navigation.items,a);return{type:"version",id:n,versionId:Rt.VersionId(t.version),title:t.version,slug:a.get(),child:o,default:i,availability:t.availability!=null?ndB(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags,announcement:t.announcement!=null?{text:t.announcement.message}:void 0}}async toSidebarRootNode(t,r,i){let n=this.#e.get(`${t}/root`),a=await Promise.all(r.map(c=>this.toNavigationChild({prefix:n,item:c,parentSlug:i}))),o=[];return a.forEach(c=>{if(c.type==="apiReference"){o.push(c);return}if(c.type==="section"&&!c.collapsed){o.push(c);return}let d=o.length>0?o[o.length-1]:void 0,s;d?.type==="sidebarGroup"?s=d:(s={id:this.#e.get(`${n}/group`),type:"sidebarGroup",children:[]},o.push(s)),s.children.push(c)}),{type:"sidebarRoot",id:n,children:o}}async toSidebarRootNodeWithVariants(t,r,i){let n=this.#e.get(`${t}/root`);return{type:"sidebarRoot",id:n,children:[{type:"varianted",id:n,children:await Promise.all(r.map(a=>this.toVariantNode(a,n,i)))}]}}async toVariantNode(t,r,i){let n=this.#e.get(`${r}/variant/${t.slug??KE(t.title)}`),a=i.apply({urlSlug:t.slug??KE(t.title),skipUrlSlug:t.skipUrlSlug}),o=await Promise.all(t.layout.map(c=>this.toVariantChild(c,n,a)));return{type:"variant",id:n,variantId:Rt.V1.VariantId(t.title),subtitle:t.subtitle??"",default:t.default??!1,image:void 0,children:o,title:t.title,slug:a.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,pointsTo:void 0}}async toVariantChild(t,r,i){return Tln(t)._visit({page:async n=>this.toPageNode({item:n,parentSlug:i}),apiSection:async n=>this.toApiSectionNode({item:n,parentSlug:i}),section:async n=>this.toSectionNode({prefix:r,item:n,parentSlug:i}),link:async n=>this.toLinkNode(n),changelog:async n=>this.toChangelogNode(n,i)})}async toNavigationChild({prefix:t,item:r,parentSlug:i,hideChildren:n,parentAvailability:a}){return Tln(r)._visit({page:async o=>this.toPageNode({item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),apiSection:async o=>this.toApiSectionNode({item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),section:async o=>this.toSectionNode({prefix:t,item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),link:async o=>this.toLinkNode(o),changelog:async o=>this.toChangelogNode(o,i,n)})}async toApiSectionNode({item:t,parentSlug:r,hideChildren:i,parentAvailability:n}){let a=IMh(t.snippetsConfiguration),o,c=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),d=this.parsedDocsConfig.experimental?.openapiParserV3,s=d==null||d;if(s)try{o=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1,logWarnings:!1})}catch{}let u;if(t.tagDescriptionPages&&s)try{let b=await this.getOpenApiWorkspaceForApiSection(t).getOpenAPIIr({context:this.taskContext});b.tags.tagsById&&(u=Object.fromEntries(Object.entries(b.tags.tagsById).filter(([v,O])=>O.description&&O.description.trim().length>0).map(([v,O])=>[v,{id:String(O.id),description:O.description}])))}catch(y){this.taskContext.logger.warn("Failed to extract OpenAPI tags for tag description pages",String(y))}o==null&&(o=lS({workspace:c,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new cS(this.taskContext,c)})),this.docsWorkspace.config.settings?.substituteEnvVars&&(o=FT(o,{onError:y=>this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${y}`)},{substituteAsEmpty:!1}));let l=await this.registerApi({ir:o,snippetsConfig:a,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName,workspace:c}),p=UKa({ir:o,apiDefinitionId:l,playgroundConfig:{oauth:t.playground?.oauth},context:this.taskContext}),_=new Ggu(t,p,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.#e,this.collectedFileIds,c,i,n??t.availability,u),h=_.getTagDescriptionContent();for(let[y,b]of h.entries()){let v=y.split("/").pop()||y,O=Ze.of(v),A=b;this.docsWorkspace.config.settings?.substituteEnvVars&&(A=FT(b,{onError:g=>this.taskContext.logger.error(`Error in tag description environment variable substitution: ${g}`)},{substituteAsEmpty:!1})),this.rawMarkdownFiles[O]=A,this.parsedDocsConfig.pages[O]=A}return _.get()}async toChangelogNode(t,r,i){return new Mvn(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:i||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:Rt.V1.Url(t.url),icon:this.resolveIconFileId(t.icon),target:t.target}}async toPageNode({item:t,parentSlug:r,hideChildren:i,parentAvailability:n}){let a=Rt.PageId(this.toRelativeFilepath(t.absolutePath)),o=r.apply({urlSlug:t.slug??KE(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(a),type:"page",slug:o.get(),title:this.markdownFilesToSidebarTitle.get(t.absolutePath)??t.title,icon:this.resolveIconFileId(t.icon),hidden:i||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:a,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags,availability:t.availability??n}}async toSectionNode({prefix:t,item:r,parentSlug:i,hideChildren:n,parentAvailability:a}){let o=this.toRelativeFilepath(r.overviewAbsolutePath),c=o?Rt.PageId(o):void 0,d=this.#e.get(c??`${t}/section`),s=i.apply({urlSlug:r.slug??KE(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),u=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,l=n||r.hidden;return{id:d,type:"section",overviewPageId:c,slug:s.get(),title:r.overviewAbsolutePath!=null?this.markdownFilesToSidebarTitle.get(r.overviewAbsolutePath)??r.title:r.title,icon:this.resolveIconFileId(r.icon),collapsed:r.collapsed,hidden:l,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(p=>this.toNavigationChild({prefix:d,item:p,parentSlug:s,hideChildren:l,parentAvailability:r.availability??a}))),authed:void 0,pointsTo:void 0,noindex:u,featureFlags:r.featureFlags,availability:r.availability??a}}async convertTabbedNavigation(t,r,i){let n=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:n,children:await Promise.all(r.map(a=>this.toTabChild(n,a,i)))}}async toTabChild(t,r,i){return Tln(r.child)._visit({link:({href:n,target:a})=>this.toTabLinkNode(r,n,a),layout:({layout:n})=>this.toTabNode(t,r,n,i),changelog:({changelog:n})=>this.toTabChangelogNode(r,n,i),variants:({variants:n})=>this.toTabNodeWithVariants(t,r,n,i)})}async toTabChangelogNode(t,r,i){return new Mvn(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:i,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r,i){return{type:"link",id:this.#e.get(r),title:t.title,url:Rt.V1.Url(r),target:i,icon:this.resolveIconFileId(t.icon)}}async toTabNode(t,r,i,n){let a=this.#e.get(`${t}/tab`),o=n.apply({urlSlug:r.slug??KE(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,i,o),featureFlags:r.featureFlags}}async toTabNodeWithVariants(t,r,i,n){let a=this.#e.get(`${t}/tab`),o=n.apply({urlSlug:r.slug??KE(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNodeWithVariants(a,i,o),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):yG.FileId(r)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}convertPageActions(){if(this.parsedDocsConfig.pageActions!=null)return{default:this.parsedDocsConfig.pageActions.default,options:{askAi:this.parsedDocsConfig.pageActions.options.askAi,copyPage:this.parsedDocsConfig.pageActions.options.copyPage,viewAsMarkdown:this.parsedDocsConfig.pageActions.options.viewAsMarkdown,openAi:this.parsedDocsConfig.pageActions.options.openAi,claude:this.parsedDocsConfig.pageActions.options.claude,cursor:this.parsedDocsConfig.pageActions.options.cursor,vscode:this.parsedDocsConfig.pageActions.options.vscode,custom:this.parsedDocsConfig.pageActions.options.custom.map(t=>({title:t.title,subtitle:t.subtitle,url:t.url,icon:this.resolveIconFileId(t.icon),default:t.default}))}}}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:i}=this.parsedDocsConfig,n=r?.[t],a=i?.[t];return{logo:this.getFileId(n),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let i=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${i}`,variants:t.variants.map(n=>({fontFile:this.getFileId(n.absolutePath),weight:n.weight,style:n.style!=null?[n.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(As),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:yG.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":i,...n}=this.parsedDocsConfig.metadata;return{...n,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(i)}}convertFileIdOrUrl(t){if(t!=null)return Tln(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:yG.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function idB(e,t){if(e?.github==null)return;let{owner:r,repo:i,branch:n="main",host:a="https://github.com"}=e.github;return`${mR(a)}/${r}/${i}/blob/${n}/fern/${t}?plain=1`}function ndB(e){switch(e){case"beta":return Rt.V1.NavigationV1Availability.Beta;case"deprecated":return Rt.V1.NavigationV1Availability.Deprecated;case"ga":return Rt.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return Rt.V1.NavigationV1Availability.Stable;default:gt(e)}}async function dL(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof sS?t:null))).filter(As)}async function Pxc(e,t,r){if(e instanceof LEe){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof sS))return;let i=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1,logWarnings:!1});return pH({ir:i,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:{oauth:!0},context:t})}var oc={};Zt(oc,{AlgoliaSearchIndex:()=>XMh,ApiDefinitionId:()=>vDh,ApiId:()=>mDh,Availability:()=>NDh,DocsConfigId:()=>PDh,EndpointId:()=>wDh,EndpointPathLiteral:()=>RDh,EnvironmentId:()=>jDh,FileId:()=>BDh,HttpMethod:()=>zDh,IndexSegmentId:()=>ZMh,JqString:()=>CDh,OrgId:()=>ODh,PageId:()=>DDh,PayloadLocation:()=>lBh,PropertyKey:()=>qDh,PullRequestState:()=>aBh,RoleId:()=>TDh,TokenId:()=>ADh,TypeId:()=>MDh,Url:()=>IDh,VersionId:()=>gDh,WebSocketId:()=>EDh,WebhookId:()=>SDh,algolia:()=>jxc,api:()=>Txc,commons:()=>Rxc,diff:()=>FDh,docs:()=>Gxc,generators:()=>xxc,git:()=>Kxc,navigation:()=>Yxc,sdks:()=>Zxc,snippets:()=>sBh,snippetsFactory:()=>cBh,templates:()=>kxc,tokens:()=>fBh});var jxc={};Zt(jxc,{AlgoliaSearchIndex:()=>XMh,IndexSegmentId:()=>ZMh});function XMh(e){return e}function ZMh(e){return e}var Txc={};Zt(Txc,{latest:()=>Sxc,v1:()=>qxc});var Sxc={};Zt(Sxc,{AuthSchemeId:()=>kMh,WebhookHttpMethod:()=>iDh,auth:()=>wxc,commons:()=>eDh,endpoint:()=>tDh,type_:()=>rDh,webhook:()=>Exc,websocket:()=>nDh});var wxc={};Zt(wxc,{AuthSchemeId:()=>kMh});function kMh(e){return e}var eDh={};var tDh={};var rDh={};var Exc={};Zt(Exc,{WebhookHttpMethod:()=>iDh});var iDh={Get:"GET",Post:"POST"};var nDh={};var qxc={};Zt(qxc,{SubpackageId:()=>_Dh,WebSocketMessageId:()=>hDh,WebSocketMessageOrigin:()=>yDh,WebhookHttpMethod:()=>bDh,commons:()=>Cxc,db:()=>Mxc,read:()=>Bxc,register:()=>Ixc});var Mxc={};Zt(Mxc,{endpoint:()=>aDh});var aDh={};var Bxc={};Zt(Bxc,{SupportedLanguage:()=>oDh,endpoint:()=>Dxc,type_:()=>uDh,webhook:()=>sDh,websocket:()=>cDh});var Dxc={};Zt(Dxc,{SupportedLanguage:()=>oDh});var oDh={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var uDh={};var sDh={};var cDh={};var Ixc={};Zt(Ixc,{SourceId:()=>adB,endpoint:()=>lDh,type_:()=>fDh,webhook:()=>dDh,websocket:()=>pDh});var lDh={};var fDh={};var dDh={};var pDh={};function adB(e){return e}var Cxc={};Zt(Cxc,{SubpackageId:()=>_Dh,WebSocketMessageId:()=>hDh,WebSocketMessageOrigin:()=>yDh,WebhookHttpMethod:()=>bDh});function _Dh(e){return e}function hDh(e){return e}var yDh={Client:"client",Server:"server"};var bDh={Get:"GET",Post:"POST"};var Rxc={};Zt(Rxc,{ApiDefinitionId:()=>vDh,ApiId:()=>mDh,Availability:()=>NDh,DocsConfigId:()=>PDh,EndpointId:()=>wDh,EndpointPathLiteral:()=>RDh,EnvironmentId:()=>jDh,FileId:()=>BDh,HttpMethod:()=>zDh,JqString:()=>CDh,OrgId:()=>ODh,PageId:()=>DDh,PropertyKey:()=>qDh,RoleId:()=>TDh,TokenId:()=>ADh,TypeId:()=>MDh,Url:()=>IDh,VersionId:()=>gDh,WebSocketId:()=>EDh,WebhookId:()=>SDh});function vDh(e){return e}function gDh(e){return e}function ODh(e){return e}function ADh(e){return e}function mDh(e){return e}function PDh(e){return e}function jDh(e){return e}function wDh(e){return e}function EDh(e){return e}function SDh(e){return e}function MDh(e){return e}function DDh(e){return e}function BDh(e){return e}function IDh(e){return e}function CDh(e){return e}function qDh(e){return e}function TDh(e){return e}function RDh(e){return e}var zDh={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var NDh={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var FDh={};var Gxc={};Zt(Gxc,{latest:()=>Fxc,v1:()=>Vxc,v2:()=>Wxc});var Fxc={};Zt(Fxc,{Layout:()=>UDh,MdxEngine:()=>odB,TwitterCardSetting:()=>LDh,commons:()=>QDh,frontmatter:()=>zxc,seo:()=>Nxc});var odB={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var QDh={};var zxc={};Zt(zxc,{Layout:()=>UDh});var UDh={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var Nxc={};Zt(Nxc,{TwitterCardSetting:()=>LDh});var LDh={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var Vxc={};Zt(Vxc,{commons:()=>Lxc,db:()=>VDh,read:()=>WDh,write:()=>Qxc});var VDh={};var WDh={};var Qxc={};Zt(Qxc,{DocsRegistrationId:()=>sdB,FilePath:()=>udB});function udB(e){return e}function sdB(e){return e}var Lxc={};Zt(Lxc,{ContentAlignment:()=>KDh,FontDisplay:()=>ZDh,FontStyle:()=>XDh,HeaderPosition:()=>JDh,JsScriptStrategy:()=>YDh,ProgrammingLanguage:()=>GDh,SearchbarPlacement:()=>HDh,TabsPlacement:()=>xDh,TwitterCardSetting:()=>$Dh,commons:()=>Uxc});var Uxc={};Zt(Uxc,{ContentAlignment:()=>KDh,FontDisplay:()=>ZDh,FontStyle:()=>XDh,HeaderPosition:()=>JDh,JsScriptStrategy:()=>YDh,ProgrammingLanguage:()=>GDh,SearchbarPlacement:()=>HDh,TabsPlacement:()=>xDh,TwitterCardSetting:()=>$Dh});var GDh={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var HDh={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var xDh={Header:"HEADER",Sidebar:"SIDEBAR"};var KDh={Center:"CENTER",Left:"LEFT"};var JDh={Fixed:"FIXED",Absolute:"ABSOLUTE"};var $Dh={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var YDh={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var XDh={Normal:"normal",Italic:"italic"};var ZDh={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var Wxc={};Zt(Wxc,{read:()=>kDh,write:()=>eBh});var kDh={};var eBh={};var xxc={};Zt(xxc,{ChangelogEntryType:()=>rBh,GeneratorId:()=>cdB,GeneratorLanguage:()=>ldB,ReleaseType:()=>iBh,cli:()=>tBh,commons:()=>Hxc,versions:()=>nBh});var tBh={};var Hxc={};Zt(Hxc,{ChangelogEntryType:()=>rBh,ReleaseType:()=>iBh});var rBh={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var iBh={Ga:"GA",Rc:"RC"};var nBh={};function cdB(e){return e}var ldB={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var Kxc={};Zt(Kxc,{PullRequestState:()=>aBh});var aBh={Open:"open",Closed:"closed",Merged:"merged"};var Yxc={};Zt(Yxc,{latest:()=>Jxc,v1:()=>$xc});var Jxc={};Zt(Jxc,{NodeId:()=>pdB,ProductId:()=>_dB,Slug:()=>fdB,TabId:()=>ddB});function fdB(e){return e}function ddB(e){return e}function pdB(e){return e}function _dB(e){return e}var $xc={};Zt($xc,{NavigationV1Availability:()=>gdB,NodeId:()=>bdB,ProductId:()=>vdB,Slug:()=>hdB,TabId:()=>ydB});function hdB(e){return e}function ydB(e){return e}function bdB(e){return e}function vdB(e){return e}var gdB={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var Zxc={};Zt(Zxc,{Language:()=>oBh,VersionBump:()=>uBh,versions:()=>Xxc});var Xxc={};Zt(Xxc,{Language:()=>oBh,VersionBump:()=>uBh});var oBh={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var uBh={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var sBh={};var cBh={};var kxc={};Zt(kxc,{PayloadLocation:()=>lBh});var lBh={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var fBh={};var kgu=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function Lo(e){return e!=null}var pBh=ce(eQa(),1);var dBh=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function QYt(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,pBh.default)(e,{special:dBh}).replace(/V\s(\d)/g,"V$1")}function _Bh({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(i=>{let n=[];i.namespace?.forEach(a=>{let o=[...n,a],c=oc.api.v1.SubpackageId(o.join("."));r[c]={id:c,name:a,displayName:QYt(a)},n.push(a)})}),r}var eOu=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function hBh(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var ho=class extends eOu{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){if(super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,n!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((o,c)=>o===this.accessPath[this.accessPath.length-a.length+c])||this.accessPath.push(...a)}r.logger.debug(`Processing ${hBh(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},pC=class extends ho{},oY=class extends pC{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var yBh="x-fern-base-path",bBh="x-fern-availability",tOu="x-fern-sdk-group-name",vBh="x-fern-global-headers",gBh="x-fern-sdk-method-name";var OBh="x-fern-webhook",ABh="x-fern-access-token-locator",mBh="x-fern-basic",PBh="x-fern-username-variable-name",jBh="x-fern-password-variable-name",wBh="x-fern-bearer",EBh="x-fern-token-variable-name",SBh="x-fern-header",MBh="x-fern-header-variable-name",DBh="x-fern-server-name",BBh="x-fern-examples";var rOu=class extends ho{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[DBh]}convert(){if(this.serverName!=null)return this.serverName}};var iOu=class extends ho{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,i])=>t.replace(`{${r}}`,i.default),this.input.url)??this.input.url,this.serverName=new rOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:oc.EnvironmentId(t),baseUrl:this.url}}};function v$i(e,t,r,i){let n=e??[],a=new Set(n.map(c=>c.url)),o=(t??[]).filter(c=>!a.has(c.url)).map((c,d)=>new iOu({input:c,context:r,accessPath:i,pathId:["servers",`${d}`]}));return[...n,...o]}function xv(e){return typeof e=="object"&&Lo(e)&&"$ref"in e&&typeof e.$ref=="string"}function pL(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(xv(n)&&(n=pL(n,t,r)),n)}function nOu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return xv(r)?pL(r,t,void 0):r}var AIh=ce(ZS());var aOu=class extends ho{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[mBh];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var oOu=class extends ho{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[jBh]}convert(){return this.passwordVariableName}};var uOu=class extends ho{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[PBh]}convert(){return this.usernameVariableName}};var sOu=class extends ho{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[wBh];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var cOu=class extends ho{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[EBh]}convert(){return this.tokenVariableName}};function IBh(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var CBh="x-bearer-format",qBh="x-code-samples",TBh="x-codeSamples";var lOu=class extends ho{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[CBh]}convert(){return this.bearerFormat}};var fOu=class extends ho{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[SBh];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var dOu=class extends ho{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[MBh]}convert(){return this.headerVariableName}};function RBh(e){return e.type==="apiKey"}var Uua=class extends ho{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){RBh(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new fOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new dOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new lOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function pOu(e){return e}function _Ou(e){return e==="__proto__"}function hOu(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Lua(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function LKa(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(LKa).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function yOu(e){if(Array.isArray(e))return e.map(Lua);if(typeof e=="symbol")return[e];e=LKa(e);let t=[],r=e.length;if(r===0)return t;let i=0,n="",a="",o=!1;for(e.charCodeAt(0)===46&&(t.push(""),i++);i<r;){let c=e[i];a?c==="\\"&&i+1<r?(i++,n+=e[i]):c===a?a="":n+=c:o?c==='"'||c==="'"?a=c:c==="]"?(o=!1,t.push(n),n=""):n+=c:c==="["?(o=!0,n&&(t.push(n),n="")):c==="."?n&&(t.push(n),n=""):n+=c,i++}return n&&t.push(n),t}function VKa(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(_Ou(t))return r;let i=e[t];return i===void 0?hOu(t)?VKa(e,yOu(t),r):r:i}case"number":case"symbol":{typeof t=="number"&&(t=Lua(t));let i=e[t];return i===void 0?r:i}default:{if(Array.isArray(t))return OdB(e,t,r);if(Object.is(t?.valueOf(),-0)?t="-0":t=String(t),_Ou(t))return r;let i=e[t];return i===void 0?r:i}}}function OdB(e,t,r){if(t.length===0)return r;let i=e;for(let n=0;n<t.length;n++){if(i==null||_Ou(t[n]))return r;i=i[t[n]]}return i===void 0?r:i}function zBh(e){return function(t){return VKa(t,e)}}function NBh(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function bOu(e){return e==null||typeof e!="object"&&typeof e!="function"}function eKc(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function rKc(e,t,r){return typeof r!="function"?rKc(e,t,()=>{}):tKc(e,t,function i(n,a,o,c,d,s){let u=r(n,a,o,c,d,s);return u!==void 0?!!u:tKc(n,a,i,s)},new Map)}function tKc(e,t,r,i){if(t===e)return!0;switch(typeof t){case"object":return AdB(e,t,r,i);case"function":return Object.keys(t).length>0?tKc(e,{...t},r,i):eKc(e,t);default:return NBh(e)?typeof t=="string"?t==="":!0:eKc(e,t)}}function AdB(e,t,r,i){if(t==null)return!0;if(Array.isArray(t))return FBh(e,t,r,i);if(t instanceof Map)return mdB(e,t,r,i);if(t instanceof Set)return PdB(e,t,r,i);let n=Object.keys(t);if(e==null)return n.length===0;if(n.length===0)return!0;if(i?.has(t))return i.get(t)===e;i?.set(t,e);try{for(let a=0;a<n.length;a++){let o=n[a];if(!bOu(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,i))return!1}return!0}finally{i?.delete(t)}}function mdB(e,t,r,i){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[n,a]of t.entries()){let o=e.get(n);if(r(o,a,n,e,t,i)===!1)return!1}return!0}function FBh(e,t,r,i){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let n=new Set;for(let a=0;a<t.length;a++){let o=t[a],c=!1;for(let d=0;d<e.length;d++){if(n.has(d))continue;let s=e[d],u=!1;if(r(s,o,a,e,t,i)&&(u=!0),u){n.add(d),c=!0;break}}if(!c)return!1}return!0}function PdB(e,t,r,i){return t.size===0?!0:e instanceof Set?FBh([...e],[...t],r,i):!1}function vOu(e,t){return rKc(e,t,()=>{})}function QBh(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function gOu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var UBh="[object RegExp]",OOu="[object String]",AOu="[object Number]",mOu="[object Boolean]",POu="[object Arguments]",LBh="[object Symbol]",VBh="[object Date]",WBh="[object Map]",GBh="[object Set]",HBh="[object Array]";var xBh="[object ArrayBuffer]",KBh="[object Object]";var JBh="[object DataView]",$Bh="[object Uint8Array]",YBh="[object Uint8ClampedArray]",XBh="[object Uint16Array]",ZBh="[object Uint32Array]";var kBh="[object Int8Array]",eIh="[object Int16Array]",tIh="[object Int32Array]";var rIh="[object Float32Array]",iIh="[object Float64Array]";function nIh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function aIh(e,t){return g$i(e,void 0,e,new Map,t)}function g$i(e,t,r,i=new Map,n=void 0){let a=n?.(e,t,r,i);if(a!==void 0)return a;if(bOu(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let o=new Array(e.length);i.set(e,o);for(let c=0;c<e.length;c++)o[c]=g$i(e[c],c,r,i,n);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){let o=new Map;i.set(e,o);for(let[c,d]of e)o.set(c,g$i(d,c,r,i,n));return o}if(e instanceof Set){let o=new Set;i.set(e,o);for(let c of e)o.add(g$i(c,void 0,r,i,n));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(nIh(e)){let o=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,o);for(let c=0;c<e.length;c++)o[c]=g$i(e[c],c,r,i,n);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof File<"u"&&e instanceof File){let o=new File([e],e.name,{type:e.type});return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof Blob<"u"&&e instanceof Blob){let o=new Blob([e],{type:e.type});return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof Error){let o=new e.constructor;return i.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,v8t(o,e,r,i,n),o}if(e instanceof Boolean){let o=new Boolean(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof Number){let o=new Number(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof String){let o=new String(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof e=="object"&&jdB(e)){let o=Object.create(Object.getPrototypeOf(e));return i.set(e,o),v8t(o,e,r,i,n),o}return e}function v8t(e,t,r=e,i,n){let a=[...Object.keys(t),...QBh(t)];for(let o=0;o<a.length;o++){let c=a[o],d=Object.getOwnPropertyDescriptor(e,c);(d==null||d.writable)&&(e[c]=g$i(t[c],c,r,i,n))}}function jdB(e){switch(gOu(e)){case POu:case HBh:case xBh:case JBh:case mOu:case VBh:case rIh:case iIh:case kBh:case eIh:case tIh:case WBh:case AOu:case KBh:case UBh:case GBh:case OOu:case LBh:case $Bh:case YBh:case XBh:case ZBh:return!0;default:return!1}}function oIh(e){return g$i(e,void 0,e,new Map,void 0)}function uIh(e){return e=oIh(e),t=>vOu(t,e)}function sIh(e,t){return aIh(e,(r,i,n,a)=>{let o=t?.(r,i,n,a);if(o!==void 0)return o;if(typeof e=="object")switch(Object.prototype.toString.call(e)){case AOu:case OOu:case mOu:{let c=new e.constructor(e?.valueOf());return v8t(c,e),c}case POu:{let c={};return v8t(c,e),c.length=e.length,c[Symbol.iterator]=e[Symbol.iterator],c}default:return}})}function cIh(e){return sIh(e)}var wdB=/^(?:0|[1-9]\d*)$/;function lIh(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return wdB.test(e)}}function fIh(e){return e!==null&&typeof e=="object"&&gOu(e)==="[object Arguments]"}function dIh(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&hOu(t)&&e?.[t]==null?r=yOu(t):r=[t],r.length===0)return!1;let i=e;for(let n=0;n<r.length;n++){let a=r[n];if((i==null||!Object.hasOwn(i,a))&&!((Array.isArray(i)||fIh(i))&&lIh(a)&&a<i.length))return!1;i=i[a]}return!0}function pIh(e,t){switch(typeof e){case"object":{Object.is(e?.valueOf(),-0)&&(e="-0");break}case"number":{e=Lua(e);break}}return t=cIh(t),function(r){let i=VKa(r,e);return i===void 0?dIh(r,e):t===void 0?i===void 0:vOu(i,t)}}function _Ih(e){if(e==null)return pOu;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?pIh(e[0],e[1]):uIh(e);case"string":case"symbol":case"number":return zBh(e)}}function hIh(e,t){let r={},i=Object.keys(e);for(let n=0;n<i.length;n++){let a=i[n],o=e[a];r[a]=t(o,a,e)}return r}function jOu(e,t=pOu){return e==null?{}:hIh(e,_Ih(t))}function yIh(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}var EdB=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function bIh(e){return Array.from(e.match(EdB)??[])}function vIh(e){let t=bIh(e);if(t.length===0)return"";let[r,...i]=t;return`${r.toLowerCase()}${i.map(n=>yIh(n)).join("")}`}function gIh(e){return typeof e!="string"&&(e=LKa(e)),e.replace(/['\u2019]/g,"")}function g8t(e){return vIh(gIh(e))}function HP(e){if(e!=null)return Array.isArray(e)?e:[e]}function wOu({namespace:e,path:t,method:r,sdkMethodName:i,operationId:n,displayName:a,isWebhook:o}){if(t==null)return;let c=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(i==null&&n==null&&a==null&&c==null))return`${SdB(o)}${MdB(e)}.${DdB(i,n,a,c)}`}function SdB(e){return e?"webhook_":"endpoint_"}function MdB(e){return e!=null?HP(e)?.map(t=>g8t(t)).join("/"):""}function DdB(e,t,r,i){return e||t||g8t(r??"")||g8t(i??"")}function OIh(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var EOu=class extends ho{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[ABh],this.accessTokenLocator!=null&&(OIh(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var SOu=class extends ho{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new Uua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new EOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=wOu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:oc.EndpointId(r),accessTokenLocator:oc.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var Vua=class extends ho{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new aOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new uOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new oOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new sOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new cOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{IBh(this.input)?(this.authScheme="header",this.headerAuthNode=new Uua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new SOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new AIh.UnreachableCaseError(this.authScheme);return}}};var Wua=class extends ho{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(i=>{let n=nOu(i,this.context.document);if(n==null){this.context.errors.warning({message:`No auth scheme found for ${i}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new Vua({input:n,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[i]=a):this.context.errors.warning({message:`No auth scheme found for ${i}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[t,i]}).filter(Lo))}};var MOu=class extends ho{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[yBh],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function mIh(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function PIh(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function Gua(e,t){return e==null?void 0:Object.entries(e).map(([i,n])=>HP(n.convert())?.map(o=>((t!=null&&!t.includes(i)||t==null&&!mIh(n))&&(o=PIh(o,o.type==="enum"?o.default:void 0)),{key:oc.PropertyKey(i),valueShape:o,description:n.description,availability:n.availability?.convert()})).filter(Lo)).filter(Lo).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(o=>[...a,o]):[[...a]]),[[]])}function DOu(e,t){return xv(e)?pL(e,t,void 0):e}function O$i(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function jIh(e,t){let r={...e};for(let[i,n]of Object.entries(t??{}))r[i]=[...r[i]??[],...n];return Object.keys(r).length>0?r:void 0}function wIh(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let i of e)for(let n of t)r.push({path:i.path??n.path,responseStatusCode:i.responseStatusCode??n.responseStatusCode,name:i.name??n.name,description:i.description??n.description,pathParameters:i.pathParameters??n.pathParameters,queryParameters:i.queryParameters??n.queryParameters,headers:i.headers??n.headers,requestBody:i.requestBody??n.requestBody,responseBody:i.responseBody??n.responseBody,snippets:{...n.snippets,...i.snippets}});return r}var EIh=ce(ZS());var iKc=["decimal","decimal128","double-int","double","float","sf-decimal"],nKc=["int16","int32","int64","int8","sf-integer","uint8"],aKc=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],oKc=["beta","pre-release","in-development","generally-available","deprecated"];function _C(e,t){return xv(e)?pL(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var ZEe=class extends ho{availability;constructor(t){super(t),this.safeParse()}parse(){if(_C(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[bBh];r!=null&&(oKc.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${oKc.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return oc.Availability.Beta;case"in-development":return oc.Availability.InDevelopment;case"generally-available":return oc.Availability.GenerallyAvailable;case"deprecated":return oc.Availability.Deprecated;case void 0:return;default:new EIh.UnreachableCaseError(this.availability);return}}};var IOu=ce(ZS());function SIh(e){return typeof e=="object"&&e!=null&&"language"in e}function MIh(e){return typeof e=="object"&&e!=null&&"sdk"in e}function DIh(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function BIh(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function BOu(e){return typeof e=="object"&&e!=null&&"event"in e}function uKc(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(BOu)}function A$i(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function IIh(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var COu=class extends ho{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,i,n,a){super(t),this.path=r,this.successResponseStatusCode=i,this.requestBodyByContentType=n,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[BBh]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([n,a])=>{let o=typeof r=="object"?r[n]:void 0;switch(a.multipartType){case"file":return A$i(o)?[n,{type:"filenameWithData",filename:o.filename,data:oc.FileId(o.data)}]:o!=null?[n,{type:"filename",value:o}]:void 0;case"files":{if(Array.isArray(o)){if(o.every(c=>A$i(c)))return[n,{type:"filenamesWithData",value:o.map(c=>({filename:c.filename,data:oc.FileId(c.data)}))}];if(o.every(c=>typeof c=="string"))return[n,{type:"filenames",value:o}]}return}case"property":return[n,{type:"json",value:o}];case void 0:return;default:new IOu.UnreachableCaseError(a.multipartType);return}}).filter(Lo))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(i=>{let n=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(n!=null)switch(n.contentType){case"form-data":a=IIh(r.request)?this.convertFormDataExampleRequest(n,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new IOu.UnreachableCaseError(n.contentType);break}let o;switch(i.contentType){case"application/json":{DIh(r.response)&&(o={type:"json",value:r.response.body});break}case"text/event-stream":{uKc(r.response)&&(o={type:"sse",value:r.response.stream.map(l=>({event:l.event,data:l.data}))});break}case"application/octet-stream":!uKc(r.response)&&BIh(r.response)&&(o={type:"stream",value:r.response.stream});break;case void 0:break;default:new IOu.UnreachableCaseError(i.contentType);break}let c={};r["code-samples"]?.forEach(l=>{SIh(l)?l.language!=null&&(c[l.language]??=[],c[l.language]?.push({name:l.name,language:l.language,install:l.install,code:l.code,generated:!1,description:l.docs})):MIh(l)&&l.sdk!=null&&(c[l.sdk]??=[],c[l.sdk]?.push({name:l.name,language:l.sdk,install:void 0,code:l.code,generated:!1,description:l.docs}))});let d=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([l,p])=>[oc.PropertyKey(l),p])),s=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([l,p])=>[oc.PropertyKey(l),p])),u=Object.fromEntries(Object.entries(r.headers??{}).map(([l,p])=>[oc.PropertyKey(l),p]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,headers:Object.keys(u).length>0?u:void 0,requestBody:a,responseBody:o,snippets:c}}))}};var WKa=class extends ho{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[tOu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>oc.api.v1.SubpackageId(g8t(r)))}};var qOu=class extends ho{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[gBh]}convert(){return this.sdkMethodName}};var TOu=class extends ho{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[OBh]}convert(){return this.isWebhook}};var ROu=class extends ho{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[qBh]??[],...this.input[TBh]??[]],this.codeSamples.forEach(t=>{[...Object.values(oc.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var Dvn=ce(ZS());function sKc(e,t){return xv(e)?pL(e,t,void 0):e}function CIh(e,t){return e.replace(/{(\w+)}/g,(r,i)=>t[i]!=null&&typeof t[i]=="string"||typeof t[i]=="number"||typeof t[i]=="boolean"?`${t[i]}`:r)}var yF="",UYt=class extends ho{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,i,n,a){super(t),this.path=r,this.responseStatusCode=i,this.name=n,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,i])=>{let n=this.resolvedRequestInput?.value[r];switch(i.multipartType){case"file":return t&&(A$i(n)||typeof n=="string");case"files":return t&&Array.isArray(n)&&n.every(a=>A$i(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new Dvn.UnreachableCaseError(i.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=sKc(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=sKc(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(BOu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,i])=>{let n=this.resolvedRequestInput?.value?.[r];switch(i.multipartType){case"file":return A$i(n)?[r,{type:"filenameWithData",filename:n.filename,data:oc.FileId(n.data)}]:[r,{type:"filename",value:n}];case"files":{if(Array.isArray(n)){if(n.every(a=>A$i(a)))return[r,{type:"filenamesWithData",value:n.map(a=>({filename:a.filename,data:oc.FileId(a.data)}))}];if(n.every(a=>typeof a=="string"))return[r,{type:"filenames",value:n}]}return}case"property":return[r,{type:"json",value:n}];case void 0:return;default:new Dvn.UnreachableCaseError(i.multipartType);return}}).filter(Lo))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new Dvn.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let i=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([o,c])=>[o,c.example({includeOptionals:!1,override:o})]));i=Object.keys(i).length>0?i:void 0;let n=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(Lo));n=Object.keys(n).length>0?n:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(Lo));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&n==null&&i==null))return{path:CIh(this.path,i??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?QYt(this.name):this.summary!=null?QYt(this.summary):void 0,description:this.convertDescription(),pathParameters:i,queryParameters:n,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function qIh(e,t){return xv(e)?pL(e,t,void 0):e}var xIh=ce(ZS());var TIh="#/components/schemas/";function Hua(e){if(e.$ref.startsWith(TIh))return e.$ref.replace(TIh,"")}function BUi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function m$i(e){return typeof e.type=="string"&&e.type==="array"}function RIh(e){return e.type==="boolean"}function zIh(e){return e.type==="integer"}function P$i(e){return!Array.isArray(e.type)&&!m$i(e)}function NIh(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||P$i(t)||m$i(t))}function FIh(e){return"nullable"in e&&typeof e.nullable=="boolean"}function QIh(e){return e.type==="null"}function UIh(e){return e.type==="number"}function cKc(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function LIh(e){return e.type==="string"}var zOu=class extends oY{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new ew({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return HP(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var NOu=class extends pC{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var FOu=class extends oY{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new ew({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(Lo)}convert(){if(this.typeNodes==null)return;let i=this.typeNodes.map(n=>HP(n.convert())?.map(o=>({displayName:n.name,shape:o,description:n.description,availability:n.availability?.convert()}))).filter(Lo).reduce((n,a)=>n.flatMap(o=>a.length>0?a.map(c=>[...o,c]):[[...o]]),[[]]).map(n=>({type:"undiscriminatedUnion",variants:n}));return this.nullable?i.map(BUi).filter(Lo):i}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function QOu(e){return e!=null&&e.length>0?e:[void 0]}var xua=class extends oY{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new ew({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(xv(t))return Hua(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([i,n])=>[i,new ew({input:n,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",i],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(Lo))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return Gua(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:HP(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(Lo)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(i=>QOu(r).map(n=>(this.extends==null||this.extends.length===0)&&i.length===0&&n!=null?{type:"alias",value:n}:{type:"object",extends:this.extends.map(a=>oc.TypeId(a)),properties:i,extraProperties:n}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(i=>{let n=_C(i,this.context.document);n!=null&&(r={...r,...Object.fromEntries(Object.entries(n.properties??{}).map(([a,o])=>[a,new ew({input:o,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((i,n)=>{let a=r?.[n];return i[n]=a?.example({includeOptionals:t,override:n}),i},{}):Object.entries(r).reduce((i,[n,a])=>(i[n]=a?.example({includeOptionals:t,override:n}),i),{}))}};var UOu=class extends oY{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>_C(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>_C(t,this.context.document)?.type!=="null"?new ew({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(Lo);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([i,n])=>{let a=_C({$ref:n},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${n}`,path:[...this.accessPath,"discriminator","mapping",i]});return}r[i]=new ew({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",i],pathId:i,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let n=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(Lo);return this.isNullable&&n!=null?n.map(BUi).filter(Lo):n}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:oc.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([n,a])=>HP(a.convert())?.map(c=>{if(!(c==null||c.type!=="object"))return{discriminantValue:n,displayName:a.name??QYt(n),availability:a.availability?.convert(),description:a.description,...c}}).filter(Lo)).filter(Lo)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(n=>HP(n.convert())?.map(o=>{if(o==null)return;t+=1;let c=o.type==="object"?QYt(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:n.name??(o.type==="alias"&&o.value.type==="id"?QYt(o.value.id):c),shape:o,description:n.description,availability:n.availability?.convert()}}).filter(Lo)).filter(Lo)}:void 0,i=this.isNullable?BUi(r):r;return i!=null?[i]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var LOu=class extends pC{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var j$i=class extends pC{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,i)=>{if(t){if(xv(r)){let n=_C(r,this.context.document);r=typeof n=="string"?n:typeof n?.default=="string"?n?.default:typeof n?.example=="string"?n.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${i}]`]}),t=!1;return}return r}}).filter(Lo),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var VIh=ce(ZS());function BdB(e){return nKc.includes(e)}var VOu=class extends pC{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(BdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${nKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new VIh.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var WOu=class extends pC{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return BUi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var WIh=ce(ZS());function IdB(e){return iKc.includes(e)}var GOu=class extends pC{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(IdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${iKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new WIh.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var GIh=ce(ZS());function CdB(e){return aKc.includes(e)}var HOu=class extends pC{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new GIh.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(CdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${aKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new j$i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var HIh=ce(ZS());var xOu=class extends pC{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,HIh.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var Bvn=class extends oY{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=Hua(this.input);let t=_C(this.input,this.context.document);t?.enum!=null&&P$i(t)&&(this.maybeEnumConverterNode=new j$i({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:oc.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=_C(this.input,this.context.document);if(r!=null)return new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var ew=class e extends oY{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),P$i(this.input)&&FIh(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),xv(this.input)){let t=Hua(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new Bvn({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new NOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(NIh(this.input))this.typeShapeNode=new FOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(P$i(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new UOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(cKc(this.input)&&this.input.allOf!=null)this.typeShapeNode=new xua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(P$i(this.input)&&this.input.enum!=null)this.typeShapeNode=new j$i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":cKc(this.input)&&(this.typeShapeNode=new xua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":m$i(this.input)&&(this.typeShapeNode=new zOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":RIh(this.input)&&(this.typeShapeNode=new LOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":zIh(this.input)&&(this.typeShapeNode=new VOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":UIh(this.input)&&(this.typeShapeNode=new GOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":LIh(this.input)&&(this.typeShapeNode=new HOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":QIh(this.input)&&(this.typeShapeNode=new WOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new xIh.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new xua({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new xOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!xv(this.input)&&(!m$i(this.input)&&this.input==null||m$i(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=HP(t)?.map(i=>this.nullable?BUi(i):i).filter(Lo);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function w$i(e){if(e!=null)return Gua(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(Lo))}var LYt=class extends pC{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;xv(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new ZEe({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let i=qIh(this.input,this.context.document);this.inputExample=i?.example??Object.values(i?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function KIh(e,t){return xv(e)?pL(e,t,void 0):e}var lKc=ce(ZS());function KOu(e){let{uniqueId:t,type:r,contextTypes:i,description:n,availability:a}=e;i[oc.TypeId(t)]={name:t,shape:r,description:n,availability:a}}var JIh=ce(h2s(),1),Kua=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,o){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=JIh.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function qdB(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var JOu=class extends ho{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),qdB(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],i)=>{let n;if(xv(r)?n=nOu(r.$ref,this.context.document):n=r,n!=null)return[t,new Vua({input:n,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${i}`]})]}).filter(Lo)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[oc.api.latest.AuthSchemeId(t),i]}).filter(Lo)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let i=r.name??t,n=HP(r.convert());return n==null?[t,void 0]:[oc.TypeId(t),{name:i,shape:n[0],description:r.description,availability:void 0}]}).filter(([t,r])=>Lo(r))):void 0}}};var $Ou=class extends ew{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=_C(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${xv(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=_C(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var YOu=class extends ho{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let i=_C(this.input.schema,this.context.document);this.availability=new ZEe({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=xv(this.input.schema)?new Bvn({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let n=Kua.parse(t);n?.containsJSON()?(this.contentType="json",this.schema=this.schema??new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):n?.isOctetStream()?(this.contentType="bytes",this.isOptional=i?.required==null):n?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=i?.required,this.fields=Object.fromEntries(Object.entries(i?.properties??{}).map(([a,o])=>{if(o!=null)return[a,new $Ou({input:o,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(Lo))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[yF]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[yF]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:HP(t)?.map(i=>{let n=i.type;switch(n){case"object":case"alias":return i;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=g8t([this.method,this.path,this.contentType,"request"].join("_"));return KOu({uniqueId:a,type:i,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:oc.TypeId(a),default:i.type==="enum"&&i.default!=null?{type:"enum",value:i.default}:void 0}}}case void 0:return;default:new lKc.UnreachableCaseError(n);return}}).filter(Lo)}convert(){if(this.schema instanceof Bvn)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([i,n])=>{switch(n.multipartType){case"file":return[{type:n.multipartType,key:oc.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"files":return[{type:n.multipartType,key:oc.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"property":{let a=HP(n.convert()),o=n.multipartType;return a?.map(c=>({type:o,key:oc.PropertyKey(i),contentType:n.contentType,exploded:void 0,valueShape:c,description:n.description,availability:n.availability?.convert()}))}case void 0:return[];default:return new lKc.UnreachableCaseError(n.multipartType),[]}}).filter(Lo).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(o=>[...a,o]):[[...a]]),[[]]).map(i=>({type:"formData",fields:i,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var XOu=class extends ho{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let i=KIh(this.input,this.context.document);if(i==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(i.content).forEach(([n,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[n]=new YOu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:n,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>HP(r.convert())?.map(n=>({description:this.description,contentType:t,body:n}))).filter(Lo)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>HP(t.convert())?.map(i=>{if(!(i.type!=="alias"&&i.type!=="object"))return{description:this.description,shape:i}})).filter(Lo)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var $Ih={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function YIh(e,t){if(xv(e)){let r=pL(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var ZOu=ce(ZS());var XIh="application/json";var ZIh="application/octet-stream";function kIh(e,t){return e===t||t===yF||e===yF}var GKa=class extends ho{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,i,n,a,o,c,d){super(t),this.streamingFormat=i,this.path=n,this.method=a,this.statusCode=o,this.requests=c,this.shapes=d,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,i){for(let n of t)for(let[a,o]of Object.entries(n?.examples??{}))for(let[c,d]of Object.entries(r))for(let s of d)kIh(c,a)&&(i.add(c),this.examples?.push(new UYt({input:{requestExample:o,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,O$i(a,c),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let i=0;for(let n of t){let a=0;for(let[o,c]of r){if(a===i){let[d,s,u]=n??[void 0,void 0,void 0];this.examples?.push(...c.map(l=>new UYt({input:{requestExample:u,responseExample:l},context:this.context,accessPath:this.accessPath,pathId:s!=null&&s!==""?["examples",s]:"examples"},this.path,this.statusCode,O$i(s,o),{requestBody:d,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}i++}if(t.length>r.length)for(let n of t.slice(r.length)){let[a,o]=r[r.length-1]??[void 0,void 0],[c,d,s]=n??[void 0,void 0,void 0];this.examples?.push(...(o??[void 0]).map(u=>new UYt({input:{requestExample:s,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:d!=null&&d!==""?["examples",d]:"examples"},this.path,this.statusCode,O$i(d,a),{requestBody:c,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[n,a,o]=t[t.length-1]??[void 0,void 0,void 0];for(let[c,d]of r.slice(t.length))this.examples?.push(...d.map(s=>new UYt({input:{requestExample:o,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,O$i(a,c),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,i,n){let a=t[yF];if(a!=null)for(let o of a)this.examples?.push(new UYt({input:{requestExample:n,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:i!=null&&i!==""?["examples",i]:"examples"},this.path,this.statusCode,O$i(i,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let i of t)if(Object.keys(i.examples??{}).length===0)this.pushResponseExample(r,i,void 0,void 0);else for(let[n,a]of Object.entries(i.examples??{}))this.pushResponseExample(r,i,n,a)}parse(t){if(t==="empty")this.empty=!0;else{let c=Kua.parse(t);if(c?.isJSON()||c?.isEventStream())this.contentType=XIh,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(c?.isOctetStream())this.contentType=ZIh,this.contentSubtype=_C(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=jOu(this.input.examples,c=>[c])),this.input.example!=null&&Object.keys(r).length===0&&(r[yF]??=[],r[yF]=[{value:this.input.example}]);let i=_C(this.input.schema,this.context.document);if(i!=null&&(i.examples!=null&&Object.keys(r).length===0&&(r=jOu(i.examples,c=>[c])),i.example!=null&&Object.keys(r).length===0&&(r[yF]??=[],r[yF]?.push({value:i.example}))),Object.keys(r).length===0){let c=this.schema?.example({includeOptionals:!0,override:void 0});r[yF]??=[],r[yF]?.push(c!=null?{value:c}:void 0)}this.examples??=[];let n=new Set;this.matchRequestResponseExamplesByName(this.requests,r,n);let a=[];for(let c of this.requests)a.push(...Object.entries(c.examples??{}).filter(([d])=>!n.has(d)&&d!==yF).map(([d,s])=>[c,d,s]));let o=Object.entries(r).filter(([c,d])=>!n.has(c)&&Lo(d)&&c!==yF);Object.keys(r).every(c=>c===yF)||this.matchExamplesByIndex(a,o),!n.has(yF)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return HP(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new ZOu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return HP(this.schema?.convert())?.map(r=>{let i=r.type;switch(i){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let n=g8t([this.method,this.path,this.statusCode,"response"].join("_"));return KOu({uniqueId:n,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:oc.TypeId(n),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new ZOu.UnreachableCaseError(i);return}}).filter(Lo)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new ZOu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var HKa=class extends ho{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,i,n,a,o){super(t),this.path=r,this.method=i,this.statusCode=n,this.requests=a,this.shapes=o,this.safeParse()}parse(t){this.description=this.input.description;let r=YIh(this.input,this.context.document);if(r==null){this.context.errors.error({message:xv(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([i,n])=>{this.headers??={},this.headers[i]=new LYt({input:n,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:i})}),r.content==null?(this.responses??=[],this.responses.push(new GKa({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([i,n])=>{this.responses??=[],this.responses.push(new GKa({input:n,context:this.context,accessPath:this.accessPath,pathId:["content",i]},i,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(Lo)}};var kOu=class extends ho{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,i,n,a){super(t),this.path=r,this.method=i,this.requests=n,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,i])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new HKa({input:{...t,...i},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new HKa({input:i,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let i=r.convert();if(i!=null)return QOu(w$i(r.headers)).flatMap(n=>i?.map(a=>({headers:n,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(o=>(o.examples??[]).map(c=>c.convert()).filter(Lo))})))}).filter(Lo)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(i=>{let n=i.schema,a=HP(n?.convert());if(n!=null)return a?.map(o=>({statusCode:parseInt(t),shape:o,description:r.description??n.description,availability:n.availability?.convert(),name:n.name??$Ih[parseInt(t)]??"UNKNOWN ERROR",examples:i.examples?.map(c=>{let d=c.convert();if(d!=null&&d.responseBody?.type==="json")return{name:d.name,description:d.description,responseBody:d.responseBody}}).filter(Lo)})).filter(Lo)})).filter(Lo)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var E$i=class extends ho{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,i){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new UYt({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,O$i(i,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=v$i(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new TOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((i,n)=>{if(xv(i)){let a=DOu(i,this.context.document);if(a!=null)i=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${i.$ref}`,path:[...this.accessPath,`parameters[${n}]`]});return}}i.in==="path"?i.schema!=null&&(this.pathParameters??={},this.pathParameters[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="query"?i.schema!=null&&(this.queryParameters??={},this.queryParameters[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="header"&&i.schema!=null&&(this.requestHeaders??={},this.requestHeaders[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name}))});for(let i of this.extractPathParameterIds()??[])this.pathParameters?.[i]==null&&this.context.errors.warning({message:`Path parameter not defined: ${i}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new ROu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new XOu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new kOu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let i=this.requests?.requestBodiesByContentType;i==null||Object.keys(i).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(i).forEach(n=>{if(Object.keys(n.examples??{}).length===0){let a=n.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},n,void 0)}else Object.entries(n.examples??{}).forEach(([a,o])=>{this.pushEmptyResponseExample(o,n,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(i=>Number(i)>=200&&Number(i)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new Wua({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new WKa({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(i=>i.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((i,n)=>new WKa({input:{[tOu]:i},context:this.context,accessPath:this.accessPath,pathId:["tags",`${n}`]})));let r=new qOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(i=>wOu({namespace:HP(i?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(Lo),this.xFernExamplesNode=new COu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(Lo)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((n,a)=>(n.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?n.push({type:"pathParameter",value:oc.PropertyKey(a.slice(1,-1).trim())}):n.push({type:"literal",value:a}),n),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},i=this.emptyResponseExamples?.map(u=>u.convert()).filter(Lo),n=wIh(this.xFernExamplesNode?.convert(),[...i??[],...t?.flatMap(u=>u.examples)??[]])?.map(u=>({...u,snippets:jIh(u.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((u,l)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:oc.WebhookId(u),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[l]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(p=>p.value.toString())??[],queryParameters:w$i(this.queryParameters)?.flat(),headers:w$i(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(Lo)}}).filter(Lo);let a=this.servers?.map(u=>u.convert()).filter(Lo),o=this.convertPathToPathParts();if(o==null)return;let c,d=this.auth?.convert();d!=null&&(c=Object.keys(d));let s=t?.flatMap(u=>u.headers).filter(Lo);return this.endpointIds.map((u,l)=>({id:oc.EndpointId(u),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[l]?.convert()?.map(p=>oc.api.v1.SubpackageId(p)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:o,auth:c?.map(p=>oc.api.latest.AuthSchemeId(p)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:w$i(this.pathParameters)?.flat(),queryParameters:w$i(this.queryParameters)?.flat(),requestHeaders:w$i(this.requestHeaders)?.flat(),responseHeaders:s!=null&&s.length>0?s:void 0,requests:this.requests?.convert(),responses:t?.map(p=>p.response),errors:r,examples:n,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var Jua=class extends ho{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i,isWebhook:n}){this.description=this.input.description;let a=v$i(t,this.input.servers,this.context,this.accessPath),o=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new E$i({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:o,method:"GET",basePath:i,isWebhook:n})),this.input.post!=null&&(this.post=new E$i({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:o,method:"POST",basePath:i,isWebhook:n})),this.input.put!=null&&(this.put=new E$i({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:o,method:"PUT",basePath:i,isWebhook:!1})),this.input.patch!=null&&(this.patch=new E$i({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:o,method:"PATCH",basePath:i,isWebhook:!1})),this.input.delete!=null&&(this.delete=new E$i({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:o,method:"DELETE",basePath:i,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(Lo)}};function eAu(e){return"payloads"in e}var tAu=class extends ho{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.paths=Object.entries(this.input).map(([n,a])=>{if(a!=null)return new Jua({input:a,context:this.context,accessPath:this.accessPath,pathId:n,servers:v$i(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:i,isWebhook:void 0})}).filter(Lo)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(i=>{let n=i.convert();n?.forEach(a=>{eAu(a)?r[oc.WebhookId(a.id)]=a:t[oc.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var rAu=class extends ho{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[vBh]?.map(r=>{let{header:i,...n}=r;return(n.optional!=null&&!n.optional||DOu(n,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(i)),[i,new LYt({input:n,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:i})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return Gua(this.globalHeaders,this.requiredProperties)?.flat()}};function eCh(e,t){if(xv(e)){let r=pL(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var iAu=class extends ho{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.webhooks=Object.entries(this.input??{}).map(([n,a])=>{let o=eCh(a,this.context.document);if(o!=null)return new Jua({input:o,context:this.context,accessPath:this.accessPath,pathId:n,servers:t,globalAuth:r,basePath:i,isWebhook:!0})}).filter(Lo)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(i=>{eAu(i)&&(t[oc.WebhookId(i.id)]=i)}),t),{})}};var nAu=class extends ho{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=v$i(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new Wua({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new MOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new tAu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new iAu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new JOu({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new rAu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=ave(),{webhookEndpoints:r,endpoints:i}=this.paths?.convert()??{},n={...this.webhooks?.convert()??{},...r??{}},a=_Bh({endpoints:i,webhookEndpoints:n}),{types:o,auths:c}=this.components?.convert()??{};return{id:oc.ApiDefinitionId(t),endpoints:i??{},websockets:{},webhooks:n,types:{...o,...this.context.generatedTypes},subpackages:a,auths:{...c,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};async function fKc(e,t){if(e instanceof LEe){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof sS))return;let r=new u8t(e.absoluteFilePath),i=await WEe({context:t,specs:e.specs}),n=await r.loadDocuments({context:t,specs:i}),a;for(let o of n){if(o.type!=="openapi")continue;let c={document:o.value,logger:t.logger,errors:new kgu,generatedTypes:{}},d=new nAu({input:o.value,context:c,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=I2s(a,d.convert())}return a}var vLh=ce(_Kc(),1),gLh=ce(xAu(),1),yPu=require("fs/promises"),OLh=ce(require("http"),1),ALh=ce(require("path"),1);var nzh=require("events"),XAu=ce(require("fs"),1),Uvn=ce(require("path"),1);var URh=ce(require("os"),1),LRh=300,q$i=20,_Ja=1e7,VRh=URh.default.platform();var tOB=VRh==="darwin",TJc=VRh==="win32",T$i=tOB||TJc,WRh=3e3,GRh=2e4,RJc=1250;var HYt;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(HYt||(HYt={}));var Qvn;(function(e){e.CHANGE="change",e.RENAME="rename"})(Qvn||(Qvn={}));var hJa;(function(e){e.CHANGE="change",e.ERROR="error"})(hJa||(hJa={}));var tf;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(tf||(tf={}));var yH;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(yH||(yH={}));var rOB=(e,t=1,r)=>{t=Math.max(1,t);let i=r?.leading??!1,n=r?.trailing??!0,a=Math.max(r?.maxWait??1/0,t),o,c,d=0,s=0,u=()=>{let g=Date.now(),m=g-d,j=g-s,S=m>=t||j>=a;return[g,S]},l=g=>{if(s=g,!o)return;let m=o;o=void 0,e.apply(void 0,m)},p=()=>{O(0)},_=()=>{c&&(p(),l(Date.now()))},h=g=>{if(s=g,i)return l(g)},y=g=>{if(n&&o)return l(g);o=void 0},b=()=>{c=void 0;let[g,m]=u();return m?y(g):v(g)},v=g=>{let m=g-d,j=g-s,S=t-m,w=a-j,D=Math.min(S,w);return O(D)},O=g=>{c&&clearTimeout(c),!(g<=0)&&(c=setTimeout(b,g))},A=(...g)=>{let[m,j]=u(),S=!!c;if(o=g,d=m,(j||!c)&&O(t),j)return S?l(m):h(m)};return A.cancel=p,A.flush=_,A},KAu=rOB;var QJc=ce(require("fs"),1),$Au=ce(require("path"),1);var iA=ce(require("fs"),1),_L=require("util");var CUi=(e,t)=>function(...i){return e.apply(void 0,i).catch(t)},xYt=(e,t)=>function(...i){try{return e.apply(void 0,i)}catch(n){return t(n)}};var zJc=ce(require("process"),1),HRh=zJc.default.getuid?!zJc.default.getuid():!1,xRh=1e4,lY=()=>{};var yJa={isChangeErrorOk:e=>{if(!yJa.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!HRh&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!yJa.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!yJa.isNodeError(e))throw e;if(!yJa.isChangeErrorOk(e))throw e}},hC=yJa;var NJc=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=xRh,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(i),i=()=>t(r);this.add(i)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},KRh=new NJc;var qUi=(e,t)=>function(i){return function n(...a){return KRh.schedule().then(o=>{let c=s=>(o(),s),d=s=>{if(o(),Date.now()>=i)throw s;if(t(s)){let u=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,u)).then(()=>n.apply(void 0,a))}throw s};return e.apply(void 0,a).then(c,d)})}},TUi=(e,t)=>function(i){return function n(...a){try{return e.apply(void 0,a)}catch(o){if(Date.now()>i)throw o;if(t(o))return n.apply(void 0,a);throw o}}};var iOB={attempt:{chmod:CUi((0,_L.promisify)(iA.default.chmod),hC.onChangeError),chown:CUi((0,_L.promisify)(iA.default.chown),hC.onChangeError),close:CUi((0,_L.promisify)(iA.default.close),lY),fsync:CUi((0,_L.promisify)(iA.default.fsync),lY),mkdir:CUi((0,_L.promisify)(iA.default.mkdir),lY),realpath:CUi((0,_L.promisify)(iA.default.realpath),lY),stat:CUi((0,_L.promisify)(iA.default.stat),lY),unlink:CUi((0,_L.promisify)(iA.default.unlink),lY),chmodSync:xYt(iA.default.chmodSync,hC.onChangeError),chownSync:xYt(iA.default.chownSync,hC.onChangeError),closeSync:xYt(iA.default.closeSync,lY),existsSync:xYt(iA.default.existsSync,lY),fsyncSync:xYt(iA.default.fsync,lY),mkdirSync:xYt(iA.default.mkdirSync,lY),realpathSync:xYt(iA.default.realpathSync,lY),statSync:xYt(iA.default.statSync,lY),unlinkSync:xYt(iA.default.unlinkSync,lY)},retry:{close:qUi((0,_L.promisify)(iA.default.close),hC.isRetriableError),fsync:qUi((0,_L.promisify)(iA.default.fsync),hC.isRetriableError),open:qUi((0,_L.promisify)(iA.default.open),hC.isRetriableError),readFile:qUi((0,_L.promisify)(iA.default.readFile),hC.isRetriableError),rename:qUi((0,_L.promisify)(iA.default.rename),hC.isRetriableError),stat:qUi((0,_L.promisify)(iA.default.stat),hC.isRetriableError),write:qUi((0,_L.promisify)(iA.default.write),hC.isRetriableError),writeFile:qUi((0,_L.promisify)(iA.default.writeFile),hC.isRetriableError),closeSync:TUi(iA.default.closeSync,hC.isRetriableError),fsyncSync:TUi(iA.default.fsyncSync,hC.isRetriableError),openSync:TUi(iA.default.openSync,hC.isRetriableError),readFileSync:TUi(iA.default.readFileSync,hC.isRetriableError),renameSync:TUi(iA.default.renameSync,hC.isRetriableError),statSync:TUi(iA.default.statSync,hC.isRetriableError),writeSync:TUi(iA.default.writeSync,hC.isRetriableError),writeFileSync:TUi(iA.default.writeFileSync,hC.isRetriableError)}},JRh=iOB;var JAu=ce(require("fs"),1),bJa=ce(require("path"),1);var FJc=()=>{};var nOB=()=>{let e=FJc,t=FJc,r=!1,i=!1;return{promise:new Promise((d,s)=>{e=u=>(r=!0,d(u)),t=u=>(i=!0,s(u))}),resolve:e,reject:t,isPending:()=>!r&&!i,isResolved:()=>r,isRejected:()=>i}},$Rh=nOB;var aOB=()=>{let{promise:e,resolve:t,isPending:r}=$Rh(),i=0,n=()=>{i+=1},a=()=>{i-=1,!i&&t()};return(()=>{n(),queueMicrotask(a)})(),{promise:e,isPending:r,increment:n,decrement:a}},YRh=aOB;var XRh={then:e=>{e()}};var ZRh=e=>Array.isArray(e)?e:[e],kRh=e=>typeof e=="function";var oOB=(e,t)=>{let r=t?.followSymlinks??!1,i=t?.depth??1/0,n=t?.limit??1/0,a=t?.ignore??[],o=ZRh(a).map(H=>kRh(H)?H:G=>H.test(G)),c=H=>o.some(G=>G(H)),d=t?.signal??{aborted:!1},s=t?.onDirents||(()=>{}),u=[],l=new Set,p={},_=[],h=new Set,y={},b=[],v=new Set,O={},A={},g=new Set,m={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},j={directories:u,directoriesNames:l,directoriesNamesToPaths:p,files:_,filesNames:h,filesNamesToPaths:y,symlinks:b,symlinksNames:v,symlinksNamesToPaths:O,map:A},{promise:S,increment:w,decrement:D}=YRh(),B=0,R=(H,G,Ee,ue)=>{g.has(G)||B>=n||(B+=1,H.directories.push(G),H.directoriesNames.add(Ee),u.push(G),l.add(Ee),p.propertyIsEnumerable(Ee)||(p[Ee]=[]),p[Ee].push(G),g.add(G),!(ue>=i)&&(B>=n||k(G,ue+1)))},N=(H,G,Ee)=>{g.has(G)||B>=n||(B+=1,H.files.push(G),H.filesNames.add(Ee),_.push(G),h.add(Ee),y.propertyIsEnumerable(Ee)||(y[Ee]=[]),y[Ee].push(G),g.add(G))},z=(H,G,Ee,ue)=>{g.has(G)||B>=n||(B+=1,H.symlinks.push(G),H.symlinksNames.add(Ee),b.push(G),v.add(Ee),O.propertyIsEnumerable(Ee)||(O[Ee]=[]),O[Ee].push(G),g.add(G),r&&(ue>=i||B>=n||je(G,ue+1)))},F=(H,G,Ee,ue,Oe)=>{d.aborted||c(G)||(ue.isDirectory()?R(H,G,Ee,Oe):ue.isFile()?N(H,G,Ee):ue.isSymbolicLink()&&z(H,G,Ee,Oe))},U=(H,G,Ee,ue)=>{if(d.aborted)return;let Oe=G===bJa.default.sep?"":bJa.default.sep,Qe=Ee.name,se=`${G}${Oe}${Qe}`;c(se)||(Ee.isDirectory()?R(H,se,Qe,ue):Ee.isFile()?N(H,se,Qe):Ee.isSymbolicLink()&&z(H,se,Qe,ue))},x=(H,G,Ee,ue)=>{for(let Oe=0,Qe=Ee.length;Oe<Qe;Oe++)U(H,G,Ee[Oe],ue)},k=(H,G)=>{d.aborted||G>i||B>=n||(w(),JAu.default.readdir(H,{withFileTypes:!0},(Ee,ue)=>{if(Ee||d.aborted||!ue.length)return D();(s(ue)||XRh).then(()=>{let Qe=A[H]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};x(Qe,H,ue,G),D()})}))},je=(H,G)=>{w(),JAu.default.realpath(H,(Ee,ue)=>{if(Ee||d.aborted)return D();JAu.default.stat(ue,(Oe,Qe)=>{if(Oe||d.aborted)return D();let se=bJa.default.basename(ue),ne=A[H]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};F(ne,ue,se,Qe,G),D()})})};return(async(H,G=1)=>(H=bJa.default.normalize(H),g.add(H),k(H,G),await S,d.aborted?m:j))(e)},ezh=oOB;var KYt={lang:{debounce:KAu,attempt:e=>{try{return e()}catch(t){return KYt.lang.castError(t)}},castArray:e=>KYt.lang.isArray(e)?e:[e],castError:e=>KYt.lang.isError(e)?e:KYt.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(KYt.lang.isNaN(e))return KYt.lang.isNaN(t);if(KYt.lang.isPrimitive(e)||KYt.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split($Au.default.sep).length-1),getRealPath:(e,t)=>{try{return t?QJc.default.realpathSync.native(e):QJc.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===$Au.default.sep&&t.length-e.length>$Au.default.sep.length,poll:(e,t=GRh)=>JRh.retry.stat(t)(e,{bigint:!0}).catch(KYt.lang.noop),readdir:async(e,t,r=1/0,i=1/0,n,a)=>{if(a&&r===1&&e in a){let o=a[e];return[o.directories,o.files]}else{let o=await ezh(e,{depth:r,limit:i,ignore:t,signal:n});return[o.directories,o.files]}}}},Fp=KYt;var YAu=ce(require("path"),1);var UJc=class{constructor(t,r,i){this.base=i,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Fp.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=LRh){return(()=>{let r=this.watcher._readyWait,i=[],n=new Set,a=async(c,d)=>{let s=this.options.ignoreInitial?[]:c,u=await this.eventsPopulate([...d]),l=this.eventsDeduplicate([...s,...u]);this.onTargetEvents(l)},o=Fp.lang.debounce(()=>{this.watcher.isClosed()||(r=a(i,n),i=[],n=new Set)},t);return async(c,d="",s=!1)=>{s?await this.eventsPopulate([d],i,!0):n.add(d),r.then(o)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((i,n)=>{let[a,o]=n,c=r[o];return a===c||a===tf.CHANGE&&c===tf.ADD||(r[o]=a,i.push(n)),i},[])}async eventsPopulate(t,r=[],i=!1){return await Promise.all(t.map(async n=>{let a=await this.watcher._poller.update(n,this.options.pollingTimeout);await Promise.all(a.map(async o=>{r.push([o,n]),o===tf.ADD_DIR?await this.eventsPopulateAddDir(t,n,r,i):o===tf.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,n,r,i)}))})),r}async eventsPopulateAddDir(t,r,i=[],n=!1){if(n)return i;let a=this.options.recursive?this.options.depth??q$i:Math.min(1,this.options.depth??q$i),o=this.options.limit??_Ja,[c,d]=await Fp.fs.readdir(r,this.options.ignore,a,o,this.watcher._closeSignal),s=[...c,...d];return await Promise.all(s.map(u=>{if(!this.watcher.isIgnored(u,this.options.ignore)&&!t.includes(u))return this.eventsPopulate([u],i,!0)})),i}async eventsPopulateUnlinkDir(t,r,i=[],n=!1){if(n)return i;for(let a of this.watcher._poller.stats.keys())Fp.fs.isSubPath(r,a)&&(t.includes(a)||await this.eventsPopulate([a],i,!0));return i}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(tf.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!T$i&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(tf.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(tf.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(YAu.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(tf.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(YAu.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(tf.UNLINK_DIR,t))}onTargetEvent(t){let[r,i]=t;r===tf.ADD?this.onTargetAdd(i):r===tf.ADD_DIR?this.onTargetAddDir(i):r===tf.CHANGE?this.onTargetChange(i):r===tf.UNLINK?this.onTargetUnlink(i):r===tf.UNLINK_DIR&&this.onTargetUnlinkDir(i)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,i=!1){return this.handlerBatched(t,r,i)}onWatcherChange(t=Qvn.CHANGE,r){if(this.watcher.isClosed())return;let i=YAu.default.resolve(this.folderPath,r||"");this.filePath&&i!==this.folderPath&&i!==this.filePath||this.watcher.isIgnored(i,this.options.ignore)||this.onWatcherEvent(t,i)}onWatcherError(t){TJc&&t.code==="EPERM"?this.onWatcherChange(Qvn.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(hJa.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(hJa.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(Qvn.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&T$i&&this.options.native!==!1?this.options.depth??q$i:Math.min(1,this.options.depth??q$i),i=this.options.limit??_Ja,[n,a]=await Fp.fs.readdir(this.folderPath,this.options.ignore,r,i,this.watcher._closeSignal,this.options.readdirMap),o=[this.folderPath,...n,...a];await Promise.all(o.map(c=>{if(!this.watcher._poller.stats.has(c)&&!this.watcher.isIgnored(c,this.options.ignore))return this.onWatcherEvent(Qvn.CHANGE,c,t)}))}}},tzh=UJc;var bH={interval:100,intervalId:void 0,fns:new Map,init:()=>{bH.intervalId||(bH.intervalId=setInterval(bH.resolve,bH.interval))},reset:()=>{bH.intervalId&&(clearInterval(bH.intervalId),delete bH.intervalId)},add:(e,t)=>{bH.fns.set(e,Date.now()+t),bH.init()},remove:e=>{bH.fns.delete(e)},resolve:()=>{if(!bH.fns.size)return bH.reset();let e=Date.now();for(let[t,r]of bH.fns)r>=e||(bH.remove(t),t())}},vJa=bH;var gJa=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=RJc){let{ino:i,targetPath:n,events:a,locks:o}=t,c=()=>{let l=this._watcher._poller.paths.find(i||-1,p=>p!==n);if(l&&l!==n){if(Fp.fs.getRealPath(n,!0)===l)return;this._watcher.event(a.rename,l,n)}else this._watcher.event(a.add,n)};if(!i)return c();let d=()=>{o.add.delete(i),vJa.remove(s)},s=()=>{d(),c()};vJa.add(s,r);let u=()=>{let l=o.unlink.get(i);if(!l)return;d();let p=l();n===p?a.change&&this._watcher._poller.stats.has(n)&&this._watcher.event(a.change,n):this._watcher.event(a.rename,p,n)};o.add.set(i,u),u()}getLockUnlink(t,r=RJc){let{ino:i,targetPath:n,events:a,locks:o}=t,c=()=>{this._watcher.event(a.unlink,n)};if(!i)return c();let d=()=>{o.unlink.delete(i),vJa.remove(s)},s=()=>{d(),c()};vJa.add(s,r);let u=()=>(d(),n);o.unlink.set(i,u),o.add.get(i)?.()}getLockTargetAdd(t,r){let i=this._watcher._poller.getIno(t,tf.ADD,HYt.FILE);return this.getLockAdd({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let i=this._watcher._poller.getIno(t,tf.ADD_DIR,HYt.DIR);return this.getLockAdd({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let i=this._watcher._poller.getIno(t,tf.UNLINK,HYt.FILE);return this.getLockUnlink({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let i=this._watcher._poller.getIno(t,tf.UNLINK_DIR,HYt.DIR);return this.getLockUnlink({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};gJa.DIR_EVENTS={add:tf.ADD_DIR,rename:tf.RENAME_DIR,unlink:tf.UNLINK_DIR};gJa.FILE_EVENTS={add:tf.ADD,change:tf.CHANGE,rename:tf.RENAME,unlink:tf.UNLINK};var rzh=gJa;var LJc=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Fp.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let i=this.map.get(t);if(Fp.lang.isSet(i)){let n=i.delete(r);return i.size||this.map.delete(t),n}else if(i===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let i=this.map.get(t);if(Fp.lang.isSet(i))return Array.from(i).find(r);if(r(i))return i}}get(t){return this.map.get(t)}has(t,r){if(Fp.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let i=this.map.get(t);return Fp.lang.isSet(i)?i.has(r):i===r}return!1}set(t,r){if(this.map.has(t)){let i=this.map.get(t);Fp.lang.isSet(i)?i.add(r):i!==r&&this.map.set(t,new Set([i,r]))}else this.map.set(t,r);return this}},VJc=LJc;var WJc=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},izh=WJc;var GJc=class{constructor(){this.inos={},this.paths=new VJc,this.stats=new Map}getIno(t,r,i){let n=this.inos[r];if(!n)return;let a=n[t];if(a&&!(i&&a[1]!==i))return a[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let i=await Fp.fs.poll(t,r);if(!(!i||!(i.isFile()||i.isDirectory())))return new izh(i)}reset(){this.inos={},this.paths=new VJc,this.stats=new Map}async update(t,r){let i=this.getStats(t),n=await this.poll(t,r);if(this.updateStats(t,n),!i&&n){if(n.isFile())return this.updateIno(t,tf.ADD,n),[tf.ADD];if(n.isDirectory())return this.updateIno(t,tf.ADD_DIR,n),[tf.ADD_DIR]}else if(i&&!n){if(i.isFile())return this.updateIno(t,tf.UNLINK,i),[tf.UNLINK];if(i.isDirectory())return this.updateIno(t,tf.UNLINK_DIR,i),[tf.UNLINK_DIR]}else if(i&&n){if(i.isFile()){if(n.isFile())return i.ino===n.ino&&!i.size&&!n.size?[]:(this.updateIno(t,tf.CHANGE,n),[tf.CHANGE]);if(n.isDirectory())return this.updateIno(t,tf.UNLINK,i),this.updateIno(t,tf.ADD_DIR,n),[tf.UNLINK,tf.ADD_DIR]}else if(i.isDirectory()){if(n.isFile())return this.updateIno(t,tf.UNLINK_DIR,i),this.updateIno(t,tf.ADD,n),[tf.UNLINK_DIR,tf.ADD];if(n.isDirectory())return i.ino===n.ino?[]:(this.updateIno(t,tf.UNLINK_DIR,i),this.updateIno(t,tf.ADD_DIR,n),[tf.UNLINK_DIR,tf.ADD_DIR])}}return[]}updateIno(t,r,i){let n=this.inos[r]=this.inos[r]||(this.inos[r]={}),a=i.isFile()?HYt.FILE:HYt.DIR;n[t]=[i.ino,a]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let i=this.stats.get(t)?.ino||-1;this.paths.delete(i,t),this.stats.delete(t)}}},HJc=GJc;var xJc=class e extends nzh.EventEmitter{constructor(t,r,i){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(yH.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(n=>this.on(yH.CLOSE,n)),this._readyWait=new Promise(n=>this.on(yH.READY,n)),this._locker=new rzh(this),this._roots=new Set,this._poller=new HJc,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,i)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Fp.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(yH.CLOSE))}error(t){if(this.isClosed())return!1;let r=Fp.lang.castError(t);return this.emit(yH.ERROR,r)}event(t,r,i){return this.isClosed()?!1:(this.emit(yH.ALL,t,r,i),this.emit(t,r,i))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(yH.READY))}pollerExists(t,r){for(let i of this._pollers)if(i.targetPath===t&&Fp.lang.isShallowEqual(i.options,r))return!0;return!1}subwatcherExists(t,r){for(let i of this._subwatchers)if(i.targetPath===t&&Fp.lang.isShallowEqual(i.options,r))return!0;return!1}watchersClose(t,r,i=!0){if(t){let n=this._watchers[t];if(n)for(let a of[...n])r&&a.filePath!==r||this.watcherClose(a);if(i)for(let a in this._watchers)Fp.fs.isSubPath(t,a)&&this.watchersClose(a,r,!1)}else for(let n in this._watchers)this.watchersClose(n,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,i]of t)this.watchPath(r,i.options,i.handler)}async watcherAdd(t,r){let{folderPath:i}=t;(this._watchers[i]=this._watchers[i]||[]).push(t);let a=new tzh(this,t,r);return await a.init(),a}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let a=r.indexOf(t);r.splice(a,1),r.length||delete this._watchers[t.folderPath]}let i=t.filePath||t.folderPath;this._roots.has(i)&&(this._watchersRestorable[i]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Fp.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,i,n){if(this._watchers[t]?.find(c=>c.handler===i&&(!c.filePath||c.filePath===n)&&c.options.ignore===r.ignore&&!!c.options.native==!!r.native&&(!r.recursive||c.options.recursive)))return!0;let o=Uvn.default.dirname(t);for(let c=1;c<1/0;c++){if(this._watchers[o]?.find(u=>(c===1||u.options.recursive&&c<=(u.options.depth??q$i))&&u.handler===i&&(!u.filePath||u.filePath===n)&&u.options.ignore===r.ignore&&!!u.options.native==!!r.native&&(!r.recursive||u.options.recursive&&T$i&&u.options.native!==!1)))return!0;if(!T$i)break;let s=Uvn.default.dirname(t);if(o===s)break;o=s}return!1}async watchDirectories(t,r,i,n,a){if(this.isClosed())return;t=Fp.lang.uniq(t).sort();let o;for(let c of t)if(!this.isIgnored(c,r.ignore)&&!this.watcherExists(c,r,i,n))try{let d=!r.recursive||T$i&&r.native!==!1?r:{...r,recursive:!1},u={watcher:XAu.default.watch(c,d),handler:i,options:r,folderPath:c,filePath:n},l=o=await this.watcherAdd(u,a);if(this._roots.has(n||c)){let _={...r,ignoreInitial:!0,recursive:!1},h=Uvn.default.dirname(c),y=c;await this.watchDirectories([h],_,i,y,l)}}catch(d){this.error(d)}return o}async watchDirectory(t,r,i,n,a){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||T$i&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,i,n,a));{r={...r,recursive:!0};let o=r.depth??q$i,c=r.limit??_Ja,[d]=await Fp.fs.readdir(t,r.ignore,o,c,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let s=await this.watchDirectories([t],r,i,n,a);if(d.length){let u=Fp.fs.getDepth(t);for(let l of d){let p=Fp.fs.getDepth(l),_=Math.max(0,o-(p-u)),h={...r,depth:_};await this.watchDirectories([l],h,i,n,a||s)}}})}}}async watchFileOnce(t,r,i){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let n={targetPath:t,options:r},a=(s,u)=>{u===t&&(d(),i())},o=new e(a),c=()=>{this._subwatchers.add(n),this.on(yH.CLOSE,d),o.watchFile(t,r,a)},d=()=>{this._subwatchers.delete(n),this.removeListener(yH.CLOSE,d),o.close()};return c()}async watchFile(t,r,i){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let n=Uvn.default.dirname(t);return this.watchDirectory(n,r,i,t)}async watchPollingOnce(t,r,i){if(this.isClosed())return;let n=!1,a=new HJc,o=await this.watchPolling(t,r,async()=>{n||!(await a.update(t,r.pollingTimeout)).length||n||(n=!0,o(),i())})}async watchPolling(t,r,i){if(this.isClosed())return Fp.lang.noop;if(this.pollerExists(t,r))return Fp.lang.noop;let n={...r,interval:r.pollingInterval??WRh},a={targetPath:t,options:r},o=()=>{this._pollers.add(a),this.on(yH.CLOSE,c),XAu.default.watchFile(t,n,i)},c=()=>{this._pollers.delete(a),this.removeListener(yH.CLOSE,c),XAu.default.unwatchFile(t,i)};return Fp.lang.attempt(o),()=>Fp.lang.attempt(c)}async watchUnknownChild(t,r,i){if(this.isClosed())return;let n=()=>this.watchPath(t,r,i);return this.watchFileOnce(t,r,n)}async watchUnknownTarget(t,r,i){if(this.isClosed())return;let n=()=>this.watchPath(t,r,i);return this.watchPollingOnce(t,r,n)}async watchPaths(t,r,i){if(this.isClosed())return;if(t=Fp.lang.uniq(t).sort(),t.every((a,o)=>t.every((c,d)=>d===o||!Fp.fs.isSubPath(a,c))))await Promise.all(t.map(a=>this.watchPath(a,r,i)));else for(let a of t)await this.watchPath(a,r,i)}async watchPath(t,r,i){if(this.isClosed()||(t=Uvn.default.resolve(t),this.isIgnored(t,r.ignore)))return;let n=await Fp.fs.poll(t,r.pollingTimeout);if(n){if(n.isFile())return this.watchFile(t,r,i);if(n.isDirectory())return this.watchDirectory(t,r,i);this.error(`"${t}" is not supported`)}else{let a=Uvn.default.dirname(t);return(await Fp.fs.poll(a,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,i):this.watchUnknownTarget(t,r,i)}}async watch(t,r,i=Fp.lang.noop){if(Fp.lang.isFunction(t))return this.watch([],{},t);if(Fp.lang.isUndefined(t))return this.watch([],r,i);if(Fp.lang.isFunction(r))return this.watch(t,{},r);if(Fp.lang.isUndefined(r))return this.watch(t,{},i);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let n=Fp.lang.castArray(t);n.forEach(a=>this._roots.add(a)),await this.watchPaths(n,r,i),!this.isClosed()&&(i!==Fp.lang.noop&&this.on(yH.ALL,i),r.readdirMap=void 0,this.ready())}},ZAu=xJc;zXo();var lsa=require("fs/promises"),azh=require("os"),ozh=ce(require("path"),1),uOB=".fern",sOB="logs";function cOB(){return"cli@3.30.3"}var OJa=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=Ct(Cr.of((0,azh.homedir)()),Ze.of(uOB)),r=Ct(t,Ze.of(sOB));await ji(r)||await(0,lsa.mkdir)(r,{recursive:!0});let n=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ct(r,Ze.of(n));let a=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${ozh.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
1784
+ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions`;throw new Error(r)}async toRootNode(){let t=Rt.V1.SlugGenerator.init(Rt.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),i=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:i,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(n=>Rt.RoleId(n)),featureFlags:void 0}}async toRootChild(t){return Tln(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let i=Rt.PageId(this.toRelativeFilepath(t.absolutePath)),n=r.apply({urlSlug:t.slug??KE(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(i),title:t.title,slug:n.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:i,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:i}){let n=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,i):void 0,o=r.type==="tabbed"?await this.convertTabbedNavigation(n,r.items,i):await this.toSidebarRootNode(n,r.items,i);return{type:"unversioned",id:n,landingPage:a,child:o}}async toVersionedNode(t,r){let i=this.#e.get("versioned"),n=t.versions[0];if(n?.hidden===!0)throw new Error(`The default version "${n.version}" cannot be hidden. Please set a non-hidden version as the first version in your versions list, or remove the hidden flag from the default version.`);return{id:i,type:"versioned",children:await Promise.all(t.versions.map((a,o)=>this.toVersionNode(a,r,o===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:i}){let n=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,i):void 0;return{id:n,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(o=>this.toProductNode(o,i)))}}async toProductNode(t,r){if(t.type==="internal"){let i=r.setProductSlug(t.slug??KE(t.product)),n;switch(t.navigation.type){case"tabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,i)};break;case"untabbed":n={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,i)};break;case"versioned":n=await this.toVersionedNode(t.navigation,i);break;default:gt(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:Rt.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:i.get(),child:n,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,announcement:t.announcement!=null?{text:t.announcement.message}:void 0}}else return{type:"productLink",id:this.#e.get(t.product),productId:Rt.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",href:yG.Url(t.href??""),target:t.target,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,viewers:t.viewers,orphaned:t.orphaned}}async toVersionNode(t,r,i){let n=this.#e.get(t.version),a=r.setVersionSlug(t.slug??KE(t.version)),o=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(n,t.navigation.items,a):await this.toSidebarRootNode(n,t.navigation.items,a);return{type:"version",id:n,versionId:Rt.VersionId(t.version),title:t.version,slug:a.get(),child:o,default:i,availability:t.availability!=null?ndB(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags,announcement:t.announcement!=null?{text:t.announcement.message}:void 0}}async toSidebarRootNode(t,r,i){let n=this.#e.get(`${t}/root`),a=await Promise.all(r.map(c=>this.toNavigationChild({prefix:n,item:c,parentSlug:i}))),o=[];return a.forEach(c=>{if(c.type==="apiReference"){o.push(c);return}if(c.type==="section"&&!c.collapsed){o.push(c);return}let d=o.length>0?o[o.length-1]:void 0,s;d?.type==="sidebarGroup"?s=d:(s={id:this.#e.get(`${n}/group`),type:"sidebarGroup",children:[]},o.push(s)),s.children.push(c)}),{type:"sidebarRoot",id:n,children:o}}async toSidebarRootNodeWithVariants(t,r,i){let n=this.#e.get(`${t}/root`);return{type:"sidebarRoot",id:n,children:[{type:"varianted",id:n,children:await Promise.all(r.map(a=>this.toVariantNode(a,n,i)))}]}}async toVariantNode(t,r,i){let n=this.#e.get(`${r}/variant/${t.slug??KE(t.title)}`),a=i.apply({urlSlug:t.slug??KE(t.title),skipUrlSlug:t.skipUrlSlug}),o=await Promise.all(t.layout.map(c=>this.toVariantChild(c,n,a)));return{type:"variant",id:n,variantId:Rt.V1.VariantId(t.title),subtitle:t.subtitle??"",default:t.default??!1,image:void 0,children:o,title:t.title,slug:a.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,pointsTo:void 0}}async toVariantChild(t,r,i){return Tln(t)._visit({page:async n=>this.toPageNode({item:n,parentSlug:i}),apiSection:async n=>this.toApiSectionNode({item:n,parentSlug:i}),section:async n=>this.toSectionNode({prefix:r,item:n,parentSlug:i}),link:async n=>this.toLinkNode(n),changelog:async n=>this.toChangelogNode(n,i)})}async toNavigationChild({prefix:t,item:r,parentSlug:i,hideChildren:n,parentAvailability:a}){return Tln(r)._visit({page:async o=>this.toPageNode({item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),apiSection:async o=>this.toApiSectionNode({item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),section:async o=>this.toSectionNode({prefix:t,item:o,parentSlug:i,hideChildren:n,parentAvailability:a}),link:async o=>this.toLinkNode(o),changelog:async o=>this.toChangelogNode(o,i,n)})}async toApiSectionNode({item:t,parentSlug:r,hideChildren:i,parentAvailability:n}){let a=IMh(t.snippetsConfiguration),o,c=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),d=this.parsedDocsConfig.experimental?.openapiParserV3,s=d==null||d;if(s)try{o=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1,logWarnings:!1})}catch{}let u;if(t.tagDescriptionPages&&s)try{let b=await this.getOpenApiWorkspaceForApiSection(t).getOpenAPIIr({context:this.taskContext});b.tags.tagsById&&(u=Object.fromEntries(Object.entries(b.tags.tagsById).filter(([v,O])=>O.description&&O.description.trim().length>0).map(([v,O])=>[v,{id:String(O.id),description:O.description}])))}catch(y){this.taskContext.logger.warn("Failed to extract OpenAPI tags for tag description pages",String(y))}o==null&&(o=lS({workspace:c,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new cS(this.taskContext,c)})),this.docsWorkspace.config.settings?.substituteEnvVars&&(o=FT(o,{onError:y=>this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${y}`)},{substituteAsEmpty:!1}));let l=await this.registerApi({ir:o,snippetsConfig:a,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName,workspace:c}),p=UKa({ir:o,apiDefinitionId:l,playgroundConfig:{oauth:t.playground?.oauth},context:this.taskContext}),_=new Ggu(t,p,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.#e,this.collectedFileIds,c,i,n??t.availability,u),h=_.getTagDescriptionContent();for(let[y,b]of h.entries()){let v=y.split("/").pop()||y,O=Ze.of(v),A=b;this.docsWorkspace.config.settings?.substituteEnvVars&&(A=FT(b,{onError:g=>this.taskContext.logger.error(`Error in tag description environment variable substitution: ${g}`)},{substituteAsEmpty:!1})),this.rawMarkdownFiles[O]=A,this.parsedDocsConfig.pages[O]=A}return _.get()}async toChangelogNode(t,r,i){return new Mvn(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:i||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:Rt.V1.Url(t.url),icon:this.resolveIconFileId(t.icon),target:t.target}}async toPageNode({item:t,parentSlug:r,hideChildren:i,parentAvailability:n}){let a=Rt.PageId(this.toRelativeFilepath(t.absolutePath)),o=r.apply({urlSlug:t.slug??KE(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(a),type:"page",slug:o.get(),title:this.markdownFilesToSidebarTitle.get(t.absolutePath)??t.title,icon:this.resolveIconFileId(t.icon),hidden:i||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:a,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags,availability:t.availability??n}}async toSectionNode({prefix:t,item:r,parentSlug:i,hideChildren:n,parentAvailability:a}){let o=this.toRelativeFilepath(r.overviewAbsolutePath),c=o?Rt.PageId(o):void 0,d=this.#e.get(c??`${t}/section`),s=i.apply({urlSlug:r.slug??KE(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),u=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,l=n||r.hidden;return{id:d,type:"section",overviewPageId:c,slug:s.get(),title:r.overviewAbsolutePath!=null?this.markdownFilesToSidebarTitle.get(r.overviewAbsolutePath)??r.title:r.title,icon:this.resolveIconFileId(r.icon),collapsed:r.collapsed,hidden:l,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(p=>this.toNavigationChild({prefix:d,item:p,parentSlug:s,hideChildren:l,parentAvailability:r.availability??a}))),authed:void 0,pointsTo:void 0,noindex:u,featureFlags:r.featureFlags,availability:r.availability??a}}async convertTabbedNavigation(t,r,i){let n=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:n,children:await Promise.all(r.map(a=>this.toTabChild(n,a,i)))}}async toTabChild(t,r,i){return Tln(r.child)._visit({link:({href:n,target:a})=>this.toTabLinkNode(r,n,a),layout:({layout:n})=>this.toTabNode(t,r,n,i),changelog:({changelog:n})=>this.toTabChangelogNode(r,n,i),variants:({variants:n})=>this.toTabNodeWithVariants(t,r,n,i)})}async toTabChangelogNode(t,r,i){return new Mvn(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:i,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r,i){return{type:"link",id:this.#e.get(r),title:t.title,url:Rt.V1.Url(r),target:i,icon:this.resolveIconFileId(t.icon)}}async toTabNode(t,r,i,n){let a=this.#e.get(`${t}/tab`),o=n.apply({urlSlug:r.slug??KE(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,i,o),featureFlags:r.featureFlags}}async toTabNodeWithVariants(t,r,i,n){let a=this.#e.get(`${t}/tab`),o=n.apply({urlSlug:r.slug??KE(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNodeWithVariants(a,i,o),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):yG.FileId(r)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}convertPageActions(){if(this.parsedDocsConfig.pageActions!=null)return{default:this.parsedDocsConfig.pageActions.default,options:{askAi:this.parsedDocsConfig.pageActions.options.askAi,copyPage:this.parsedDocsConfig.pageActions.options.copyPage,viewAsMarkdown:this.parsedDocsConfig.pageActions.options.viewAsMarkdown,openAi:this.parsedDocsConfig.pageActions.options.openAi,claude:this.parsedDocsConfig.pageActions.options.claude,cursor:this.parsedDocsConfig.pageActions.options.cursor,vscode:this.parsedDocsConfig.pageActions.options.vscode,custom:this.parsedDocsConfig.pageActions.options.custom.map(t=>({title:t.title,subtitle:t.subtitle,url:t.url,icon:this.resolveIconFileId(t.icon),default:t.default}))}}}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:i}=this.parsedDocsConfig,n=r?.[t],a=i?.[t];return{logo:this.getFileId(n),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let i=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${i}`,variants:t.variants.map(n=>({fontFile:this.getFileId(n.absolutePath),weight:n.weight,style:n.style!=null?[n.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(As),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:yG.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":i,...n}=this.parsedDocsConfig.metadata;return{...n,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(i)}}convertFileIdOrUrl(t){if(t!=null)return Tln(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:yG.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function idB(e,t){if(e?.github==null)return;let{owner:r,repo:i,branch:n="main",host:a="https://github.com"}=e.github;return`${mR(a)}/${r}/${i}/blob/${n}/fern/${t}?plain=1`}function ndB(e){switch(e){case"beta":return Rt.V1.NavigationV1Availability.Beta;case"deprecated":return Rt.V1.NavigationV1Availability.Deprecated;case"ga":return Rt.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return Rt.V1.NavigationV1Availability.Stable;default:gt(e)}}async function dL(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof sS?t:null))).filter(As)}async function Pxc(e,t,r){if(e instanceof LEe){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof sS))return;let i=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1,logWarnings:!1});return pH({ir:i,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:{oauth:!0},context:t})}var oc={};Zt(oc,{AlgoliaSearchIndex:()=>XMh,ApiDefinitionId:()=>vDh,ApiId:()=>mDh,Availability:()=>NDh,DocsConfigId:()=>PDh,EndpointId:()=>wDh,EndpointPathLiteral:()=>RDh,EnvironmentId:()=>jDh,FileId:()=>BDh,HttpMethod:()=>zDh,IndexSegmentId:()=>ZMh,JqString:()=>CDh,OrgId:()=>ODh,PageId:()=>DDh,PayloadLocation:()=>lBh,PropertyKey:()=>qDh,PullRequestState:()=>aBh,RoleId:()=>TDh,TokenId:()=>ADh,TypeId:()=>MDh,Url:()=>IDh,VersionId:()=>gDh,WebSocketId:()=>EDh,WebhookId:()=>SDh,algolia:()=>jxc,api:()=>Txc,commons:()=>Rxc,diff:()=>FDh,docs:()=>Gxc,generators:()=>xxc,git:()=>Kxc,navigation:()=>Yxc,sdks:()=>Zxc,snippets:()=>sBh,snippetsFactory:()=>cBh,templates:()=>kxc,tokens:()=>fBh});var jxc={};Zt(jxc,{AlgoliaSearchIndex:()=>XMh,IndexSegmentId:()=>ZMh});function XMh(e){return e}function ZMh(e){return e}var Txc={};Zt(Txc,{latest:()=>Sxc,v1:()=>qxc});var Sxc={};Zt(Sxc,{AuthSchemeId:()=>kMh,WebhookHttpMethod:()=>iDh,auth:()=>wxc,commons:()=>eDh,endpoint:()=>tDh,type_:()=>rDh,webhook:()=>Exc,websocket:()=>nDh});var wxc={};Zt(wxc,{AuthSchemeId:()=>kMh});function kMh(e){return e}var eDh={};var tDh={};var rDh={};var Exc={};Zt(Exc,{WebhookHttpMethod:()=>iDh});var iDh={Get:"GET",Post:"POST"};var nDh={};var qxc={};Zt(qxc,{SubpackageId:()=>_Dh,WebSocketMessageId:()=>hDh,WebSocketMessageOrigin:()=>yDh,WebhookHttpMethod:()=>bDh,commons:()=>Cxc,db:()=>Mxc,read:()=>Bxc,register:()=>Ixc});var Mxc={};Zt(Mxc,{endpoint:()=>aDh});var aDh={};var Bxc={};Zt(Bxc,{SupportedLanguage:()=>oDh,endpoint:()=>Dxc,type_:()=>uDh,webhook:()=>sDh,websocket:()=>cDh});var Dxc={};Zt(Dxc,{SupportedLanguage:()=>oDh});var oDh={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var uDh={};var sDh={};var cDh={};var Ixc={};Zt(Ixc,{SourceId:()=>adB,endpoint:()=>lDh,type_:()=>fDh,webhook:()=>dDh,websocket:()=>pDh});var lDh={};var fDh={};var dDh={};var pDh={};function adB(e){return e}var Cxc={};Zt(Cxc,{SubpackageId:()=>_Dh,WebSocketMessageId:()=>hDh,WebSocketMessageOrigin:()=>yDh,WebhookHttpMethod:()=>bDh});function _Dh(e){return e}function hDh(e){return e}var yDh={Client:"client",Server:"server"};var bDh={Get:"GET",Post:"POST"};var Rxc={};Zt(Rxc,{ApiDefinitionId:()=>vDh,ApiId:()=>mDh,Availability:()=>NDh,DocsConfigId:()=>PDh,EndpointId:()=>wDh,EndpointPathLiteral:()=>RDh,EnvironmentId:()=>jDh,FileId:()=>BDh,HttpMethod:()=>zDh,JqString:()=>CDh,OrgId:()=>ODh,PageId:()=>DDh,PropertyKey:()=>qDh,RoleId:()=>TDh,TokenId:()=>ADh,TypeId:()=>MDh,Url:()=>IDh,VersionId:()=>gDh,WebSocketId:()=>EDh,WebhookId:()=>SDh});function vDh(e){return e}function gDh(e){return e}function ODh(e){return e}function ADh(e){return e}function mDh(e){return e}function PDh(e){return e}function jDh(e){return e}function wDh(e){return e}function EDh(e){return e}function SDh(e){return e}function MDh(e){return e}function DDh(e){return e}function BDh(e){return e}function IDh(e){return e}function CDh(e){return e}function qDh(e){return e}function TDh(e){return e}function RDh(e){return e}var zDh={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var NDh={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var FDh={};var Gxc={};Zt(Gxc,{latest:()=>Fxc,v1:()=>Vxc,v2:()=>Wxc});var Fxc={};Zt(Fxc,{Layout:()=>UDh,MdxEngine:()=>odB,TwitterCardSetting:()=>LDh,commons:()=>QDh,frontmatter:()=>zxc,seo:()=>Nxc});var odB={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var QDh={};var zxc={};Zt(zxc,{Layout:()=>UDh});var UDh={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var Nxc={};Zt(Nxc,{TwitterCardSetting:()=>LDh});var LDh={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var Vxc={};Zt(Vxc,{commons:()=>Lxc,db:()=>VDh,read:()=>WDh,write:()=>Qxc});var VDh={};var WDh={};var Qxc={};Zt(Qxc,{DocsRegistrationId:()=>sdB,FilePath:()=>udB});function udB(e){return e}function sdB(e){return e}var Lxc={};Zt(Lxc,{ContentAlignment:()=>KDh,FontDisplay:()=>ZDh,FontStyle:()=>XDh,HeaderPosition:()=>JDh,JsScriptStrategy:()=>YDh,ProgrammingLanguage:()=>GDh,SearchbarPlacement:()=>HDh,TabsPlacement:()=>xDh,TwitterCardSetting:()=>$Dh,commons:()=>Uxc});var Uxc={};Zt(Uxc,{ContentAlignment:()=>KDh,FontDisplay:()=>ZDh,FontStyle:()=>XDh,HeaderPosition:()=>JDh,JsScriptStrategy:()=>YDh,ProgrammingLanguage:()=>GDh,SearchbarPlacement:()=>HDh,TabsPlacement:()=>xDh,TwitterCardSetting:()=>$Dh});var GDh={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var HDh={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var xDh={Header:"HEADER",Sidebar:"SIDEBAR"};var KDh={Center:"CENTER",Left:"LEFT"};var JDh={Fixed:"FIXED",Absolute:"ABSOLUTE"};var $Dh={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var YDh={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var XDh={Normal:"normal",Italic:"italic"};var ZDh={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var Wxc={};Zt(Wxc,{read:()=>kDh,write:()=>eBh});var kDh={};var eBh={};var xxc={};Zt(xxc,{ChangelogEntryType:()=>rBh,GeneratorId:()=>cdB,GeneratorLanguage:()=>ldB,ReleaseType:()=>iBh,cli:()=>tBh,commons:()=>Hxc,versions:()=>nBh});var tBh={};var Hxc={};Zt(Hxc,{ChangelogEntryType:()=>rBh,ReleaseType:()=>iBh});var rBh={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var iBh={Ga:"GA",Rc:"RC"};var nBh={};function cdB(e){return e}var ldB={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var Kxc={};Zt(Kxc,{PullRequestState:()=>aBh});var aBh={Open:"open",Closed:"closed",Merged:"merged"};var Yxc={};Zt(Yxc,{latest:()=>Jxc,v1:()=>$xc});var Jxc={};Zt(Jxc,{NodeId:()=>pdB,ProductId:()=>_dB,Slug:()=>fdB,TabId:()=>ddB});function fdB(e){return e}function ddB(e){return e}function pdB(e){return e}function _dB(e){return e}var $xc={};Zt($xc,{NavigationV1Availability:()=>gdB,NodeId:()=>bdB,ProductId:()=>vdB,Slug:()=>hdB,TabId:()=>ydB});function hdB(e){return e}function ydB(e){return e}function bdB(e){return e}function vdB(e){return e}var gdB={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var Zxc={};Zt(Zxc,{Language:()=>oBh,VersionBump:()=>uBh,versions:()=>Xxc});var Xxc={};Zt(Xxc,{Language:()=>oBh,VersionBump:()=>uBh});var oBh={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var uBh={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var sBh={};var cBh={};var kxc={};Zt(kxc,{PayloadLocation:()=>lBh});var lBh={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var fBh={};var kgu=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function Lo(e){return e!=null}var pBh=ce(eQa(),1);var dBh=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function QYt(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,pBh.default)(e,{special:dBh}).replace(/V\s(\d)/g,"V$1")}function _Bh({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(i=>{let n=[];i.namespace?.forEach(a=>{let o=[...n,a],c=oc.api.v1.SubpackageId(o.join("."));r[c]={id:c,name:a,displayName:QYt(a)},n.push(a)})}),r}var eOu=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function hBh(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var ho=class extends eOu{context;accessPath;pathId;constructor({input:t,context:r,accessPath:i,pathId:n}){if(super(t,r),this.context=r,this.accessPath=[...i],this.pathId=n,n!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((o,c)=>o===this.accessPath[this.accessPath.length-a.length+c])||this.accessPath.push(...a)}r.logger.debug(`Processing ${hBh(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},pC=class extends ho{},oY=class extends pC{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var yBh="x-fern-base-path",bBh="x-fern-availability",tOu="x-fern-sdk-group-name",vBh="x-fern-global-headers",gBh="x-fern-sdk-method-name";var OBh="x-fern-webhook",ABh="x-fern-access-token-locator",mBh="x-fern-basic",PBh="x-fern-username-variable-name",jBh="x-fern-password-variable-name",wBh="x-fern-bearer",EBh="x-fern-token-variable-name",SBh="x-fern-header",MBh="x-fern-header-variable-name",DBh="x-fern-server-name",BBh="x-fern-examples";var rOu=class extends ho{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[DBh]}convert(){if(this.serverName!=null)return this.serverName}};var iOu=class extends ho{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,i])=>t.replace(`{${r}}`,i.default),this.input.url)??this.input.url,this.serverName=new rOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:oc.EnvironmentId(t),baseUrl:this.url}}};function v$i(e,t,r,i){let n=e??[],a=new Set(n.map(c=>c.url)),o=(t??[]).filter(c=>!a.has(c.url)).map((c,d)=>new iOu({input:c,context:r,accessPath:i,pathId:["servers",`${d}`]}));return[...n,...o]}function xv(e){return typeof e=="object"&&Lo(e)&&"$ref"in e&&typeof e.$ref=="string"}function pL(e,t,r){let i=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),n=t;for(let a of i){if(typeof n!="object"||n==null)return r;n=n[a]}return n==null?r:(xv(n)&&(n=pL(n,t,r)),n)}function nOu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return xv(r)?pL(r,t,void 0):r}var AIh=ce(ZS());var aOu=class extends ho{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[mBh];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var oOu=class extends ho{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[jBh]}convert(){return this.passwordVariableName}};var uOu=class extends ho{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[PBh]}convert(){return this.usernameVariableName}};var sOu=class extends ho{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[wBh];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var cOu=class extends ho{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[EBh]}convert(){return this.tokenVariableName}};function IBh(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var CBh="x-bearer-format",qBh="x-code-samples",TBh="x-codeSamples";var lOu=class extends ho{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[CBh]}convert(){return this.bearerFormat}};var fOu=class extends ho{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[SBh];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var dOu=class extends ho{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[MBh]}convert(){return this.headerVariableName}};function RBh(e){return e.type==="apiKey"}var Uua=class extends ho{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){RBh(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new fOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new dOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new lOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function pOu(e){return e}function _Ou(e){return e==="__proto__"}function hOu(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Lua(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function LKa(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(LKa).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function yOu(e){if(Array.isArray(e))return e.map(Lua);if(typeof e=="symbol")return[e];e=LKa(e);let t=[],r=e.length;if(r===0)return t;let i=0,n="",a="",o=!1;for(e.charCodeAt(0)===46&&(t.push(""),i++);i<r;){let c=e[i];a?c==="\\"&&i+1<r?(i++,n+=e[i]):c===a?a="":n+=c:o?c==='"'||c==="'"?a=c:c==="]"?(o=!1,t.push(n),n=""):n+=c:c==="["?(o=!0,n&&(t.push(n),n="")):c==="."?n&&(t.push(n),n=""):n+=c,i++}return n&&t.push(n),t}function VKa(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(_Ou(t))return r;let i=e[t];return i===void 0?hOu(t)?VKa(e,yOu(t),r):r:i}case"number":case"symbol":{typeof t=="number"&&(t=Lua(t));let i=e[t];return i===void 0?r:i}default:{if(Array.isArray(t))return OdB(e,t,r);if(Object.is(t?.valueOf(),-0)?t="-0":t=String(t),_Ou(t))return r;let i=e[t];return i===void 0?r:i}}}function OdB(e,t,r){if(t.length===0)return r;let i=e;for(let n=0;n<t.length;n++){if(i==null||_Ou(t[n]))return r;i=i[t[n]]}return i===void 0?r:i}function zBh(e){return function(t){return VKa(t,e)}}function NBh(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function bOu(e){return e==null||typeof e!="object"&&typeof e!="function"}function eKc(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function rKc(e,t,r){return typeof r!="function"?rKc(e,t,()=>{}):tKc(e,t,function i(n,a,o,c,d,s){let u=r(n,a,o,c,d,s);return u!==void 0?!!u:tKc(n,a,i,s)},new Map)}function tKc(e,t,r,i){if(t===e)return!0;switch(typeof t){case"object":return AdB(e,t,r,i);case"function":return Object.keys(t).length>0?tKc(e,{...t},r,i):eKc(e,t);default:return NBh(e)?typeof t=="string"?t==="":!0:eKc(e,t)}}function AdB(e,t,r,i){if(t==null)return!0;if(Array.isArray(t))return FBh(e,t,r,i);if(t instanceof Map)return mdB(e,t,r,i);if(t instanceof Set)return PdB(e,t,r,i);let n=Object.keys(t);if(e==null)return n.length===0;if(n.length===0)return!0;if(i?.has(t))return i.get(t)===e;i?.set(t,e);try{for(let a=0;a<n.length;a++){let o=n[a];if(!bOu(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,i))return!1}return!0}finally{i?.delete(t)}}function mdB(e,t,r,i){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[n,a]of t.entries()){let o=e.get(n);if(r(o,a,n,e,t,i)===!1)return!1}return!0}function FBh(e,t,r,i){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let n=new Set;for(let a=0;a<t.length;a++){let o=t[a],c=!1;for(let d=0;d<e.length;d++){if(n.has(d))continue;let s=e[d],u=!1;if(r(s,o,a,e,t,i)&&(u=!0),u){n.add(d),c=!0;break}}if(!c)return!1}return!0}function PdB(e,t,r,i){return t.size===0?!0:e instanceof Set?FBh([...e],[...t],r,i):!1}function vOu(e,t){return rKc(e,t,()=>{})}function QBh(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function gOu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var UBh="[object RegExp]",OOu="[object String]",AOu="[object Number]",mOu="[object Boolean]",POu="[object Arguments]",LBh="[object Symbol]",VBh="[object Date]",WBh="[object Map]",GBh="[object Set]",HBh="[object Array]";var xBh="[object ArrayBuffer]",KBh="[object Object]";var JBh="[object DataView]",$Bh="[object Uint8Array]",YBh="[object Uint8ClampedArray]",XBh="[object Uint16Array]",ZBh="[object Uint32Array]";var kBh="[object Int8Array]",eIh="[object Int16Array]",tIh="[object Int32Array]";var rIh="[object Float32Array]",iIh="[object Float64Array]";function nIh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function aIh(e,t){return g$i(e,void 0,e,new Map,t)}function g$i(e,t,r,i=new Map,n=void 0){let a=n?.(e,t,r,i);if(a!==void 0)return a;if(bOu(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let o=new Array(e.length);i.set(e,o);for(let c=0;c<e.length;c++)o[c]=g$i(e[c],c,r,i,n);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){let o=new Map;i.set(e,o);for(let[c,d]of e)o.set(c,g$i(d,c,r,i,n));return o}if(e instanceof Set){let o=new Set;i.set(e,o);for(let c of e)o.add(g$i(c,void 0,r,i,n));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(nIh(e)){let o=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,o);for(let c=0;c<e.length;c++)o[c]=g$i(e[c],c,r,i,n);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof File<"u"&&e instanceof File){let o=new File([e],e.name,{type:e.type});return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof Blob<"u"&&e instanceof Blob){let o=new Blob([e],{type:e.type});return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof Error){let o=new e.constructor;return i.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,v8t(o,e,r,i,n),o}if(e instanceof Boolean){let o=new Boolean(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof Number){let o=new Number(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(e instanceof String){let o=new String(e.valueOf());return i.set(e,o),v8t(o,e,r,i,n),o}if(typeof e=="object"&&jdB(e)){let o=Object.create(Object.getPrototypeOf(e));return i.set(e,o),v8t(o,e,r,i,n),o}return e}function v8t(e,t,r=e,i,n){let a=[...Object.keys(t),...QBh(t)];for(let o=0;o<a.length;o++){let c=a[o],d=Object.getOwnPropertyDescriptor(e,c);(d==null||d.writable)&&(e[c]=g$i(t[c],c,r,i,n))}}function jdB(e){switch(gOu(e)){case POu:case HBh:case xBh:case JBh:case mOu:case VBh:case rIh:case iIh:case kBh:case eIh:case tIh:case WBh:case AOu:case KBh:case UBh:case GBh:case OOu:case LBh:case $Bh:case YBh:case XBh:case ZBh:return!0;default:return!1}}function oIh(e){return g$i(e,void 0,e,new Map,void 0)}function uIh(e){return e=oIh(e),t=>vOu(t,e)}function sIh(e,t){return aIh(e,(r,i,n,a)=>{let o=t?.(r,i,n,a);if(o!==void 0)return o;if(typeof e=="object")switch(Object.prototype.toString.call(e)){case AOu:case OOu:case mOu:{let c=new e.constructor(e?.valueOf());return v8t(c,e),c}case POu:{let c={};return v8t(c,e),c.length=e.length,c[Symbol.iterator]=e[Symbol.iterator],c}default:return}})}function cIh(e){return sIh(e)}var wdB=/^(?:0|[1-9]\d*)$/;function lIh(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return wdB.test(e)}}function fIh(e){return e!==null&&typeof e=="object"&&gOu(e)==="[object Arguments]"}function dIh(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&hOu(t)&&e?.[t]==null?r=yOu(t):r=[t],r.length===0)return!1;let i=e;for(let n=0;n<r.length;n++){let a=r[n];if((i==null||!Object.hasOwn(i,a))&&!((Array.isArray(i)||fIh(i))&&lIh(a)&&a<i.length))return!1;i=i[a]}return!0}function pIh(e,t){switch(typeof e){case"object":{Object.is(e?.valueOf(),-0)&&(e="-0");break}case"number":{e=Lua(e);break}}return t=cIh(t),function(r){let i=VKa(r,e);return i===void 0?dIh(r,e):t===void 0?i===void 0:vOu(i,t)}}function _Ih(e){if(e==null)return pOu;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?pIh(e[0],e[1]):uIh(e);case"string":case"symbol":case"number":return zBh(e)}}function hIh(e,t){let r={},i=Object.keys(e);for(let n=0;n<i.length;n++){let a=i[n],o=e[a];r[a]=t(o,a,e)}return r}function jOu(e,t=pOu){return e==null?{}:hIh(e,_Ih(t))}function yIh(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}var EdB=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function bIh(e){return Array.from(e.match(EdB)??[])}function vIh(e){let t=bIh(e);if(t.length===0)return"";let[r,...i]=t;return`${r.toLowerCase()}${i.map(n=>yIh(n)).join("")}`}function gIh(e){return typeof e!="string"&&(e=LKa(e)),e.replace(/['\u2019]/g,"")}function g8t(e){return vIh(gIh(e))}function HP(e){if(e!=null)return Array.isArray(e)?e:[e]}function wOu({namespace:e,path:t,method:r,sdkMethodName:i,operationId:n,displayName:a,isWebhook:o}){if(t==null)return;let c=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(i==null&&n==null&&a==null&&c==null))return`${SdB(o)}${MdB(e)}.${DdB(i,n,a,c)}`}function SdB(e){return e?"webhook_":"endpoint_"}function MdB(e){return e!=null?HP(e)?.map(t=>g8t(t)).join("/"):""}function DdB(e,t,r,i){return e||t||g8t(r??"")||g8t(i??"")}function OIh(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var EOu=class extends ho{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[ABh],this.accessTokenLocator!=null&&(OIh(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var SOu=class extends ho{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new Uua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new EOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=wOu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:oc.EndpointId(r),accessTokenLocator:oc.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var Vua=class extends ho{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new aOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new uOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new oOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new sOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new cOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{IBh(this.input)?(this.authScheme="header",this.headerAuthNode=new Uua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new SOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new AIh.UnreachableCaseError(this.authScheme);return}}};var Wua=class extends ho{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(i=>{let n=nOu(i,this.context.document);if(n==null){this.context.errors.warning({message:`No auth scheme found for ${i}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new Vua({input:n,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[i]=a):this.context.errors.warning({message:`No auth scheme found for ${i}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[t,i]}).filter(Lo))}};var MOu=class extends ho{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[yBh],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function mIh(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function PIh(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function Gua(e,t){return e==null?void 0:Object.entries(e).map(([i,n])=>HP(n.convert())?.map(o=>((t!=null&&!t.includes(i)||t==null&&!mIh(n))&&(o=PIh(o,o.type==="enum"?o.default:void 0)),{key:oc.PropertyKey(i),valueShape:o,description:n.description,availability:n.availability?.convert()})).filter(Lo)).filter(Lo).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(o=>[...a,o]):[[...a]]),[[]])}function DOu(e,t){return xv(e)?pL(e,t,void 0):e}function O$i(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function jIh(e,t){let r={...e};for(let[i,n]of Object.entries(t??{}))r[i]=[...r[i]??[],...n];return Object.keys(r).length>0?r:void 0}function wIh(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let i of e)for(let n of t)r.push({path:i.path??n.path,responseStatusCode:i.responseStatusCode??n.responseStatusCode,name:i.name??n.name,description:i.description??n.description,pathParameters:i.pathParameters??n.pathParameters,queryParameters:i.queryParameters??n.queryParameters,headers:i.headers??n.headers,requestBody:i.requestBody??n.requestBody,responseBody:i.responseBody??n.responseBody,snippets:{...n.snippets,...i.snippets}});return r}var EIh=ce(ZS());var iKc=["decimal","decimal128","double-int","double","float","sf-decimal"],nKc=["int16","int32","int64","int8","sf-integer","uint8"],aKc=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],oKc=["beta","pre-release","in-development","generally-available","deprecated"];function _C(e,t){return xv(e)?pL(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var ZEe=class extends ho{availability;constructor(t){super(t),this.safeParse()}parse(){if(_C(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[bBh];r!=null&&(oKc.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${oKc.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return oc.Availability.Beta;case"in-development":return oc.Availability.InDevelopment;case"generally-available":return oc.Availability.GenerallyAvailable;case"deprecated":return oc.Availability.Deprecated;case void 0:return;default:new EIh.UnreachableCaseError(this.availability);return}}};var IOu=ce(ZS());function SIh(e){return typeof e=="object"&&e!=null&&"language"in e}function MIh(e){return typeof e=="object"&&e!=null&&"sdk"in e}function DIh(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function BIh(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function BOu(e){return typeof e=="object"&&e!=null&&"event"in e}function uKc(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(BOu)}function A$i(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function IIh(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var COu=class extends ho{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,i,n,a){super(t),this.path=r,this.successResponseStatusCode=i,this.requestBodyByContentType=n,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[BBh]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([n,a])=>{let o=typeof r=="object"?r[n]:void 0;switch(a.multipartType){case"file":return A$i(o)?[n,{type:"filenameWithData",filename:o.filename,data:oc.FileId(o.data)}]:o!=null?[n,{type:"filename",value:o}]:void 0;case"files":{if(Array.isArray(o)){if(o.every(c=>A$i(c)))return[n,{type:"filenamesWithData",value:o.map(c=>({filename:c.filename,data:oc.FileId(c.data)}))}];if(o.every(c=>typeof c=="string"))return[n,{type:"filenames",value:o}]}return}case"property":return[n,{type:"json",value:o}];case void 0:return;default:new IOu.UnreachableCaseError(a.multipartType);return}}).filter(Lo))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(i=>{let n=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(n!=null)switch(n.contentType){case"form-data":a=IIh(r.request)?this.convertFormDataExampleRequest(n,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new IOu.UnreachableCaseError(n.contentType);break}let o;switch(i.contentType){case"application/json":{DIh(r.response)&&(o={type:"json",value:r.response.body});break}case"text/event-stream":{uKc(r.response)&&(o={type:"sse",value:r.response.stream.map(l=>({event:l.event,data:l.data}))});break}case"application/octet-stream":!uKc(r.response)&&BIh(r.response)&&(o={type:"stream",value:r.response.stream});break;case void 0:break;default:new IOu.UnreachableCaseError(i.contentType);break}let c={};r["code-samples"]?.forEach(l=>{SIh(l)?l.language!=null&&(c[l.language]??=[],c[l.language]?.push({name:l.name,language:l.language,install:l.install,code:l.code,generated:!1,description:l.docs})):MIh(l)&&l.sdk!=null&&(c[l.sdk]??=[],c[l.sdk]?.push({name:l.name,language:l.sdk,install:void 0,code:l.code,generated:!1,description:l.docs}))});let d=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([l,p])=>[oc.PropertyKey(l),p])),s=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([l,p])=>[oc.PropertyKey(l),p])),u=Object.fromEntries(Object.entries(r.headers??{}).map(([l,p])=>[oc.PropertyKey(l),p]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,headers:Object.keys(u).length>0?u:void 0,requestBody:a,responseBody:o,snippets:c}}))}};var WKa=class extends ho{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[tOu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>oc.api.v1.SubpackageId(g8t(r)))}};var qOu=class extends ho{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[gBh]}convert(){return this.sdkMethodName}};var TOu=class extends ho{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[OBh]}convert(){return this.isWebhook}};var ROu=class extends ho{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[qBh]??[],...this.input[TBh]??[]],this.codeSamples.forEach(t=>{[...Object.values(oc.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var Dvn=ce(ZS());function sKc(e,t){return xv(e)?pL(e,t,void 0):e}function CIh(e,t){return e.replace(/{(\w+)}/g,(r,i)=>t[i]!=null&&typeof t[i]=="string"||typeof t[i]=="number"||typeof t[i]=="boolean"?`${t[i]}`:r)}var yF="",UYt=class extends ho{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,i,n,a){super(t),this.path=r,this.responseStatusCode=i,this.name=n,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,i])=>{let n=this.resolvedRequestInput?.value[r];switch(i.multipartType){case"file":return t&&(A$i(n)||typeof n=="string");case"files":return t&&Array.isArray(n)&&n.every(a=>A$i(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new Dvn.UnreachableCaseError(i.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=sKc(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=sKc(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(BOu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,i])=>{let n=this.resolvedRequestInput?.value?.[r];switch(i.multipartType){case"file":return A$i(n)?[r,{type:"filenameWithData",filename:n.filename,data:oc.FileId(n.data)}]:[r,{type:"filename",value:n}];case"files":{if(Array.isArray(n)){if(n.every(a=>A$i(a)))return[r,{type:"filenamesWithData",value:n.map(a=>({filename:a.filename,data:oc.FileId(a.data)}))}];if(n.every(a=>typeof a=="string"))return[r,{type:"filenames",value:n}]}return}case"property":return[r,{type:"json",value:n}];case void 0:return;default:new Dvn.UnreachableCaseError(i.multipartType);return}}).filter(Lo))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new Dvn.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new Dvn.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let i=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([o,c])=>[o,c.example({includeOptionals:!1,override:o})]));i=Object.keys(i).length>0?i:void 0;let n=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(Lo));n=Object.keys(n).length>0?n:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(Lo));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&n==null&&i==null))return{path:CIh(this.path,i??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?QYt(this.name):this.summary!=null?QYt(this.summary):void 0,description:this.convertDescription(),pathParameters:i,queryParameters:n,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function qIh(e,t){return xv(e)?pL(e,t,void 0):e}var xIh=ce(ZS());var TIh="#/components/schemas/";function Hua(e){if(e.$ref.startsWith(TIh))return e.$ref.replace(TIh,"")}function BUi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function m$i(e){return typeof e.type=="string"&&e.type==="array"}function RIh(e){return e.type==="boolean"}function zIh(e){return e.type==="integer"}function P$i(e){return!Array.isArray(e.type)&&!m$i(e)}function NIh(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||P$i(t)||m$i(t))}function FIh(e){return"nullable"in e&&typeof e.nullable=="boolean"}function QIh(e){return e.type==="null"}function UIh(e){return e.type==="number"}function cKc(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function LIh(e){return e.type==="string"}var zOu=class extends oY{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new ew({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return HP(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var NOu=class extends pC{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var FOu=class extends oY{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new ew({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(Lo)}convert(){if(this.typeNodes==null)return;let i=this.typeNodes.map(n=>HP(n.convert())?.map(o=>({displayName:n.name,shape:o,description:n.description,availability:n.availability?.convert()}))).filter(Lo).reduce((n,a)=>n.flatMap(o=>a.length>0?a.map(c=>[...o,c]):[[...o]]),[[]]).map(n=>({type:"undiscriminatedUnion",variants:n}));return this.nullable?i.map(BUi).filter(Lo):i}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function QOu(e){return e!=null&&e.length>0?e:[void 0]}var xua=class extends oY{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new ew({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(xv(t))return Hua(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([i,n])=>[i,new ew({input:n,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",i],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(Lo))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return Gua(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:HP(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(Lo)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(i=>QOu(r).map(n=>(this.extends==null||this.extends.length===0)&&i.length===0&&n!=null?{type:"alias",value:n}:{type:"object",extends:this.extends.map(a=>oc.TypeId(a)),properties:i,extraProperties:n}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(i=>{let n=_C(i,this.context.document);n!=null&&(r={...r,...Object.fromEntries(Object.entries(n.properties??{}).map(([a,o])=>[a,new ew({input:o,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((i,n)=>{let a=r?.[n];return i[n]=a?.example({includeOptionals:t,override:n}),i},{}):Object.entries(r).reduce((i,[n,a])=>(i[n]=a?.example({includeOptionals:t,override:n}),i),{}))}};var UOu=class extends oY{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>_C(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>_C(t,this.context.document)?.type!=="null"?new ew({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(Lo);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([i,n])=>{let a=_C({$ref:n},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${n}`,path:[...this.accessPath,"discriminator","mapping",i]});return}r[i]=new ew({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",i],pathId:i,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let n=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(Lo);return this.isNullable&&n!=null?n.map(BUi).filter(Lo):n}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:oc.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([n,a])=>HP(a.convert())?.map(c=>{if(!(c==null||c.type!=="object"))return{discriminantValue:n,displayName:a.name??QYt(n),availability:a.availability?.convert(),description:a.description,...c}}).filter(Lo)).filter(Lo)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(n=>HP(n.convert())?.map(o=>{if(o==null)return;t+=1;let c=o.type==="object"?QYt(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:n.name??(o.type==="alias"&&o.value.type==="id"?QYt(o.value.id):c),shape:o,description:n.description,availability:n.availability?.convert()}}).filter(Lo)).filter(Lo)}:void 0,i=this.isNullable?BUi(r):r;return i!=null?[i]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var LOu=class extends pC{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var j$i=class extends pC{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,i)=>{if(t){if(xv(r)){let n=_C(r,this.context.document);r=typeof n=="string"?n:typeof n?.default=="string"?n?.default:typeof n?.example=="string"?n.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${i}]`]}),t=!1;return}return r}}).filter(Lo),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var VIh=ce(ZS());function BdB(e){return nKc.includes(e)}var VOu=class extends pC{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(BdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${nKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new VIh.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var WOu=class extends pC{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return BUi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var WIh=ce(ZS());function IdB(e){return iKc.includes(e)}var GOu=class extends pC{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(IdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${iKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new WIh.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var GIh=ce(ZS());function CdB(e){return aKc.includes(e)}var HOu=class extends pC{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new GIh.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(CdB(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${aKc.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new j$i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var HIh=ce(ZS());var xOu=class extends pC{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,HIh.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var Bvn=class extends oY{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=Hua(this.input);let t=_C(this.input,this.context.document);t?.enum!=null&&P$i(t)&&(this.maybeEnumConverterNode=new j$i({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:oc.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=_C(this.input,this.context.document);if(r!=null)return new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var ew=class e extends oY{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),P$i(this.input)&&FIh(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),xv(this.input)){let t=Hua(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new Bvn({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new NOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(NIh(this.input))this.typeShapeNode=new FOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(P$i(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new UOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(cKc(this.input)&&this.input.allOf!=null)this.typeShapeNode=new xua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(P$i(this.input)&&this.input.enum!=null)this.typeShapeNode=new j$i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":cKc(this.input)&&(this.typeShapeNode=new xua({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":m$i(this.input)&&(this.typeShapeNode=new zOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":RIh(this.input)&&(this.typeShapeNode=new LOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":zIh(this.input)&&(this.typeShapeNode=new VOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":UIh(this.input)&&(this.typeShapeNode=new GOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":LIh(this.input)&&(this.typeShapeNode=new HOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":QIh(this.input)&&(this.typeShapeNode=new WOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new xIh.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new xua({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new xOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!xv(this.input)&&(!m$i(this.input)&&this.input==null||m$i(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=HP(t)?.map(i=>this.nullable?BUi(i):i).filter(Lo);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function w$i(e){if(e!=null)return Gua(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(Lo))}var LYt=class extends pC{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;xv(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new ZEe({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let i=qIh(this.input,this.context.document);this.inputExample=i?.example??Object.values(i?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function KIh(e,t){return xv(e)?pL(e,t,void 0):e}var lKc=ce(ZS());function KOu(e){let{uniqueId:t,type:r,contextTypes:i,description:n,availability:a}=e;i[oc.TypeId(t)]={name:t,shape:r,description:n,availability:a}}var JIh=ce(h2s(),1),Kua=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,i,n,a,o){this.type=t,this.subtype=r,this.essence=i,this.parameters=n,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=JIh.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function qdB(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var JOu=class extends ho{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new ew({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),qdB(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],i)=>{let n;if(xv(r)?n=nOu(r.$ref,this.context.document):n=r,n!=null)return[t,new Vua({input:n,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${i}`]})]}).filter(Lo)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let i=r.convert();if(i!=null)return[oc.api.latest.AuthSchemeId(t),i]}).filter(Lo)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let i=r.name??t,n=HP(r.convert());return n==null?[t,void 0]:[oc.TypeId(t),{name:i,shape:n[0],description:r.description,availability:void 0}]}).filter(([t,r])=>Lo(r))):void 0}}};var $Ou=class extends ew{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=_C(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${xv(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=_C(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var YOu=class extends ho{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let i=_C(this.input.schema,this.context.document);this.availability=new ZEe({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=xv(this.input.schema)?new Bvn({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let n=Kua.parse(t);n?.containsJSON()?(this.contentType="json",this.schema=this.schema??new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):n?.isOctetStream()?(this.contentType="bytes",this.isOptional=i?.required==null):n?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=i?.required,this.fields=Object.fromEntries(Object.entries(i?.properties??{}).map(([a,o])=>{if(o!=null)return[a,new $Ou({input:o,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(Lo))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[yF]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[yF]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:HP(t)?.map(i=>{let n=i.type;switch(n){case"object":case"alias":return i;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=g8t([this.method,this.path,this.contentType,"request"].join("_"));return KOu({uniqueId:a,type:i,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:oc.TypeId(a),default:i.type==="enum"&&i.default!=null?{type:"enum",value:i.default}:void 0}}}case void 0:return;default:new lKc.UnreachableCaseError(n);return}}).filter(Lo)}convert(){if(this.schema instanceof Bvn)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([i,n])=>{switch(n.multipartType){case"file":return[{type:n.multipartType,key:oc.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"files":return[{type:n.multipartType,key:oc.PropertyKey(i),isOptional:this.requiredFields?.includes(i)==null,contentType:n.contentType,description:n.description,availability:n.availability?.convert()}];case"property":{let a=HP(n.convert()),o=n.multipartType;return a?.map(c=>({type:o,key:oc.PropertyKey(i),contentType:n.contentType,exploded:void 0,valueShape:c,description:n.description,availability:n.availability?.convert()}))}case void 0:return[];default:return new lKc.UnreachableCaseError(n.multipartType),[]}}).filter(Lo).reduce((i,n)=>i.flatMap(a=>n.length>0?n.map(o=>[...a,o]):[[...a]]),[[]]).map(i=>({type:"formData",fields:i,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var XOu=class extends ho{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let i=KIh(this.input,this.context.document);if(i==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(i.content).forEach(([n,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[n]=new YOu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:n,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>HP(r.convert())?.map(n=>({description:this.description,contentType:t,body:n}))).filter(Lo)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>HP(t.convert())?.map(i=>{if(!(i.type!=="alias"&&i.type!=="object"))return{description:this.description,shape:i}})).filter(Lo)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var $Ih={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function YIh(e,t){if(xv(e)){let r=pL(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var ZOu=ce(ZS());var XIh="application/json";var ZIh="application/octet-stream";function kIh(e,t){return e===t||t===yF||e===yF}var GKa=class extends ho{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,i,n,a,o,c,d){super(t),this.streamingFormat=i,this.path=n,this.method=a,this.statusCode=o,this.requests=c,this.shapes=d,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,i){for(let n of t)for(let[a,o]of Object.entries(n?.examples??{}))for(let[c,d]of Object.entries(r))for(let s of d)kIh(c,a)&&(i.add(c),this.examples?.push(new UYt({input:{requestExample:o,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,O$i(a,c),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let i=0;for(let n of t){let a=0;for(let[o,c]of r){if(a===i){let[d,s,u]=n??[void 0,void 0,void 0];this.examples?.push(...c.map(l=>new UYt({input:{requestExample:u,responseExample:l},context:this.context,accessPath:this.accessPath,pathId:s!=null&&s!==""?["examples",s]:"examples"},this.path,this.statusCode,O$i(s,o),{requestBody:d,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}i++}if(t.length>r.length)for(let n of t.slice(r.length)){let[a,o]=r[r.length-1]??[void 0,void 0],[c,d,s]=n??[void 0,void 0,void 0];this.examples?.push(...(o??[void 0]).map(u=>new UYt({input:{requestExample:s,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:d!=null&&d!==""?["examples",d]:"examples"},this.path,this.statusCode,O$i(d,a),{requestBody:c,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[n,a,o]=t[t.length-1]??[void 0,void 0,void 0];for(let[c,d]of r.slice(t.length))this.examples?.push(...d.map(s=>new UYt({input:{requestExample:o,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,O$i(a,c),{requestBody:n,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,i,n){let a=t[yF];if(a!=null)for(let o of a)this.examples?.push(new UYt({input:{requestExample:n,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:i!=null&&i!==""?["examples",i]:"examples"},this.path,this.statusCode,O$i(i,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let i of t)if(Object.keys(i.examples??{}).length===0)this.pushResponseExample(r,i,void 0,void 0);else for(let[n,a]of Object.entries(i.examples??{}))this.pushResponseExample(r,i,n,a)}parse(t){if(t==="empty")this.empty=!0;else{let c=Kua.parse(t);if(c?.isJSON()||c?.isEventStream())this.contentType=XIh,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(c?.isOctetStream())this.contentType=ZIh,this.contentSubtype=_C(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new ew({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=jOu(this.input.examples,c=>[c])),this.input.example!=null&&Object.keys(r).length===0&&(r[yF]??=[],r[yF]=[{value:this.input.example}]);let i=_C(this.input.schema,this.context.document);if(i!=null&&(i.examples!=null&&Object.keys(r).length===0&&(r=jOu(i.examples,c=>[c])),i.example!=null&&Object.keys(r).length===0&&(r[yF]??=[],r[yF]?.push({value:i.example}))),Object.keys(r).length===0){let c=this.schema?.example({includeOptionals:!0,override:void 0});r[yF]??=[],r[yF]?.push(c!=null?{value:c}:void 0)}this.examples??=[];let n=new Set;this.matchRequestResponseExamplesByName(this.requests,r,n);let a=[];for(let c of this.requests)a.push(...Object.entries(c.examples??{}).filter(([d])=>!n.has(d)&&d!==yF).map(([d,s])=>[c,d,s]));let o=Object.entries(r).filter(([c,d])=>!n.has(c)&&Lo(d)&&c!==yF);Object.keys(r).every(c=>c===yF)||this.matchExamplesByIndex(a,o),!n.has(yF)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return HP(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new ZOu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return HP(this.schema?.convert())?.map(r=>{let i=r.type;switch(i){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let n=g8t([this.method,this.path,this.statusCode,"response"].join("_"));return KOu({uniqueId:n,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:oc.TypeId(n),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new ZOu.UnreachableCaseError(i);return}}).filter(Lo)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new ZOu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var HKa=class extends ho{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,i,n,a,o){super(t),this.path=r,this.method=i,this.statusCode=n,this.requests=a,this.shapes=o,this.safeParse()}parse(t){this.description=this.input.description;let r=YIh(this.input,this.context.document);if(r==null){this.context.errors.error({message:xv(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([i,n])=>{this.headers??={},this.headers[i]=new LYt({input:n,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:i})}),r.content==null?(this.responses??=[],this.responses.push(new GKa({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([i,n])=>{this.responses??=[],this.responses.push(new GKa({input:n,context:this.context,accessPath:this.accessPath,pathId:["content",i]},i,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(Lo)}};var kOu=class extends ho{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,i,n,a){super(t),this.path=r,this.method=i,this.requests=n,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,i])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new HKa({input:{...t,...i},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new HKa({input:i,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let i=r.convert();if(i!=null)return QOu(w$i(r.headers)).flatMap(n=>i?.map(a=>({headers:n,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(o=>(o.examples??[]).map(c=>c.convert()).filter(Lo))})))}).filter(Lo)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(i=>{let n=i.schema,a=HP(n?.convert());if(n!=null)return a?.map(o=>({statusCode:parseInt(t),shape:o,description:r.description??n.description,availability:n.availability?.convert(),name:n.name??$Ih[parseInt(t)]??"UNKNOWN ERROR",examples:i.examples?.map(c=>{let d=c.convert();if(d!=null&&d.responseBody?.type==="json")return{name:d.name,description:d.description,responseBody:d.responseBody}}).filter(Lo)})).filter(Lo)})).filter(Lo)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var E$i=class extends ho{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,i){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new UYt({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,O$i(i,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new ZEe({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=v$i(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new TOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((i,n)=>{if(xv(i)){let a=DOu(i,this.context.document);if(a!=null)i=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${i.$ref}`,path:[...this.accessPath,`parameters[${n}]`]});return}}i.in==="path"?i.schema!=null&&(this.pathParameters??={},this.pathParameters[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="query"?i.schema!=null&&(this.queryParameters??={},this.queryParameters[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name})):i.in==="header"&&i.schema!=null&&(this.requestHeaders??={},this.requestHeaders[i.name]=new LYt({input:i,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${n}`],parameterName:i.name}))});for(let i of this.extractPathParameterIds()??[])this.pathParameters?.[i]==null&&this.context.errors.warning({message:`Path parameter not defined: ${i}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new ROu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new XOu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new kOu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let i=this.requests?.requestBodiesByContentType;i==null||Object.keys(i).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(i).forEach(n=>{if(Object.keys(n.examples??{}).length===0){let a=n.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},n,void 0)}else Object.entries(n.examples??{}).forEach(([a,o])=>{this.pushEmptyResponseExample(o,n,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(i=>Number(i)>=200&&Number(i)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new Wua({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new WKa({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(i=>i.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((i,n)=>new WKa({input:{[tOu]:i},context:this.context,accessPath:this.accessPath,pathId:["tags",`${n}`]})));let r=new qOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(i=>wOu({namespace:HP(i?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(Lo),this.xFernExamplesNode=new COu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(Lo)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((n,a)=>(n.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?n.push({type:"pathParameter",value:oc.PropertyKey(a.slice(1,-1).trim())}):n.push({type:"literal",value:a}),n),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},i=this.emptyResponseExamples?.map(u=>u.convert()).filter(Lo),n=wIh(this.xFernExamplesNode?.convert(),[...i??[],...t?.flatMap(u=>u.examples)??[]])?.map(u=>({...u,snippets:jIh(u.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((u,l)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:oc.WebhookId(u),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[l]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(p=>p.value.toString())??[],queryParameters:w$i(this.queryParameters)?.flat(),headers:w$i(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(Lo)}}).filter(Lo);let a=this.servers?.map(u=>u.convert()).filter(Lo),o=this.convertPathToPathParts();if(o==null)return;let c,d=this.auth?.convert();d!=null&&(c=Object.keys(d));let s=t?.flatMap(u=>u.headers).filter(Lo);return this.endpointIds.map((u,l)=>({id:oc.EndpointId(u),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[l]?.convert()?.map(p=>oc.api.v1.SubpackageId(p)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:o,auth:c?.map(p=>oc.api.latest.AuthSchemeId(p)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:w$i(this.pathParameters)?.flat(),queryParameters:w$i(this.queryParameters)?.flat(),requestHeaders:w$i(this.requestHeaders)?.flat(),responseHeaders:s!=null&&s.length>0?s:void 0,requests:this.requests?.convert(),responses:t?.map(p=>p.response),errors:r,examples:n,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var Jua=class extends ho{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i,isWebhook:n}){this.description=this.input.description;let a=v$i(t,this.input.servers,this.context,this.accessPath),o=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new E$i({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:o,method:"GET",basePath:i,isWebhook:n})),this.input.post!=null&&(this.post=new E$i({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:o,method:"POST",basePath:i,isWebhook:n})),this.input.put!=null&&(this.put=new E$i({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:o,method:"PUT",basePath:i,isWebhook:!1})),this.input.patch!=null&&(this.patch=new E$i({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:o,method:"PATCH",basePath:i,isWebhook:!1})),this.input.delete!=null&&(this.delete=new E$i({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:o,method:"DELETE",basePath:i,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(Lo)}};function eAu(e){return"payloads"in e}var tAu=class extends ho{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.paths=Object.entries(this.input).map(([n,a])=>{if(a!=null)return new Jua({input:a,context:this.context,accessPath:this.accessPath,pathId:n,servers:v$i(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:i,isWebhook:void 0})}).filter(Lo)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(i=>{let n=i.convert();n?.forEach(a=>{eAu(a)?r[oc.WebhookId(a.id)]=a:t[oc.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var rAu=class extends ho{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[vBh]?.map(r=>{let{header:i,...n}=r;return(n.optional!=null&&!n.optional||DOu(n,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(i)),[i,new LYt({input:n,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:i})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return Gua(this.globalHeaders,this.requiredProperties)?.flat()}};function eCh(e,t){if(xv(e)){let r=pL(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var iAu=class extends ho{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:i}){this.webhooks=Object.entries(this.input??{}).map(([n,a])=>{let o=eCh(a,this.context.document);if(o!=null)return new Jua({input:o,context:this.context,accessPath:this.accessPath,pathId:n,servers:t,globalAuth:r,basePath:i,isWebhook:!0})}).filter(Lo)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(i=>{eAu(i)&&(t[oc.WebhookId(i.id)]=i)}),t),{})}};var nAu=class extends ho{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=v$i(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new Wua({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new MOu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new tAu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new iAu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new JOu({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new rAu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=ave(),{webhookEndpoints:r,endpoints:i}=this.paths?.convert()??{},n={...this.webhooks?.convert()??{},...r??{}},a=_Bh({endpoints:i,webhookEndpoints:n}),{types:o,auths:c}=this.components?.convert()??{};return{id:oc.ApiDefinitionId(t),endpoints:i??{},websockets:{},webhooks:n,types:{...o,...this.context.generatedTypes},subpackages:a,auths:{...c,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};async function fKc(e,t){if(e instanceof LEe){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof sS))return;let r=new u8t(e.absoluteFilePath),i=await WEe({context:t,specs:e.specs}),n=await r.loadDocuments({context:t,specs:i}),a;for(let o of n){if(o.type!=="openapi")continue;let c={document:o.value,logger:t.logger,errors:new kgu,generatedTypes:{}},d=new nAu({input:o.value,context:c,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=I2s(a,d.convert())}return a}var vLh=ce(_Kc(),1),gLh=ce(xAu(),1),yPu=require("fs/promises"),OLh=ce(require("http"),1),ALh=ce(require("path"),1);var nzh=require("events"),XAu=ce(require("fs"),1),Uvn=ce(require("path"),1);var URh=ce(require("os"),1),LRh=300,q$i=20,_Ja=1e7,VRh=URh.default.platform();var tOB=VRh==="darwin",TJc=VRh==="win32",T$i=tOB||TJc,WRh=3e3,GRh=2e4,RJc=1250;var HYt;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(HYt||(HYt={}));var Qvn;(function(e){e.CHANGE="change",e.RENAME="rename"})(Qvn||(Qvn={}));var hJa;(function(e){e.CHANGE="change",e.ERROR="error"})(hJa||(hJa={}));var tf;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(tf||(tf={}));var yH;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(yH||(yH={}));var rOB=(e,t=1,r)=>{t=Math.max(1,t);let i=r?.leading??!1,n=r?.trailing??!0,a=Math.max(r?.maxWait??1/0,t),o,c,d=0,s=0,u=()=>{let g=Date.now(),m=g-d,j=g-s,S=m>=t||j>=a;return[g,S]},l=g=>{if(s=g,!o)return;let m=o;o=void 0,e.apply(void 0,m)},p=()=>{O(0)},_=()=>{c&&(p(),l(Date.now()))},h=g=>{if(s=g,i)return l(g)},y=g=>{if(n&&o)return l(g);o=void 0},b=()=>{c=void 0;let[g,m]=u();return m?y(g):v(g)},v=g=>{let m=g-d,j=g-s,S=t-m,w=a-j,D=Math.min(S,w);return O(D)},O=g=>{c&&clearTimeout(c),!(g<=0)&&(c=setTimeout(b,g))},A=(...g)=>{let[m,j]=u(),S=!!c;if(o=g,d=m,(j||!c)&&O(t),j)return S?l(m):h(m)};return A.cancel=p,A.flush=_,A},KAu=rOB;var QJc=ce(require("fs"),1),$Au=ce(require("path"),1);var iA=ce(require("fs"),1),_L=require("util");var CUi=(e,t)=>function(...i){return e.apply(void 0,i).catch(t)},xYt=(e,t)=>function(...i){try{return e.apply(void 0,i)}catch(n){return t(n)}};var zJc=ce(require("process"),1),HRh=zJc.default.getuid?!zJc.default.getuid():!1,xRh=1e4,lY=()=>{};var yJa={isChangeErrorOk:e=>{if(!yJa.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!HRh&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!yJa.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!yJa.isNodeError(e))throw e;if(!yJa.isChangeErrorOk(e))throw e}},hC=yJa;var NJc=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=xRh,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(i),i=()=>t(r);this.add(i)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},KRh=new NJc;var qUi=(e,t)=>function(i){return function n(...a){return KRh.schedule().then(o=>{let c=s=>(o(),s),d=s=>{if(o(),Date.now()>=i)throw s;if(t(s)){let u=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,u)).then(()=>n.apply(void 0,a))}throw s};return e.apply(void 0,a).then(c,d)})}},TUi=(e,t)=>function(i){return function n(...a){try{return e.apply(void 0,a)}catch(o){if(Date.now()>i)throw o;if(t(o))return n.apply(void 0,a);throw o}}};var iOB={attempt:{chmod:CUi((0,_L.promisify)(iA.default.chmod),hC.onChangeError),chown:CUi((0,_L.promisify)(iA.default.chown),hC.onChangeError),close:CUi((0,_L.promisify)(iA.default.close),lY),fsync:CUi((0,_L.promisify)(iA.default.fsync),lY),mkdir:CUi((0,_L.promisify)(iA.default.mkdir),lY),realpath:CUi((0,_L.promisify)(iA.default.realpath),lY),stat:CUi((0,_L.promisify)(iA.default.stat),lY),unlink:CUi((0,_L.promisify)(iA.default.unlink),lY),chmodSync:xYt(iA.default.chmodSync,hC.onChangeError),chownSync:xYt(iA.default.chownSync,hC.onChangeError),closeSync:xYt(iA.default.closeSync,lY),existsSync:xYt(iA.default.existsSync,lY),fsyncSync:xYt(iA.default.fsync,lY),mkdirSync:xYt(iA.default.mkdirSync,lY),realpathSync:xYt(iA.default.realpathSync,lY),statSync:xYt(iA.default.statSync,lY),unlinkSync:xYt(iA.default.unlinkSync,lY)},retry:{close:qUi((0,_L.promisify)(iA.default.close),hC.isRetriableError),fsync:qUi((0,_L.promisify)(iA.default.fsync),hC.isRetriableError),open:qUi((0,_L.promisify)(iA.default.open),hC.isRetriableError),readFile:qUi((0,_L.promisify)(iA.default.readFile),hC.isRetriableError),rename:qUi((0,_L.promisify)(iA.default.rename),hC.isRetriableError),stat:qUi((0,_L.promisify)(iA.default.stat),hC.isRetriableError),write:qUi((0,_L.promisify)(iA.default.write),hC.isRetriableError),writeFile:qUi((0,_L.promisify)(iA.default.writeFile),hC.isRetriableError),closeSync:TUi(iA.default.closeSync,hC.isRetriableError),fsyncSync:TUi(iA.default.fsyncSync,hC.isRetriableError),openSync:TUi(iA.default.openSync,hC.isRetriableError),readFileSync:TUi(iA.default.readFileSync,hC.isRetriableError),renameSync:TUi(iA.default.renameSync,hC.isRetriableError),statSync:TUi(iA.default.statSync,hC.isRetriableError),writeSync:TUi(iA.default.writeSync,hC.isRetriableError),writeFileSync:TUi(iA.default.writeFileSync,hC.isRetriableError)}},JRh=iOB;var JAu=ce(require("fs"),1),bJa=ce(require("path"),1);var FJc=()=>{};var nOB=()=>{let e=FJc,t=FJc,r=!1,i=!1;return{promise:new Promise((d,s)=>{e=u=>(r=!0,d(u)),t=u=>(i=!0,s(u))}),resolve:e,reject:t,isPending:()=>!r&&!i,isResolved:()=>r,isRejected:()=>i}},$Rh=nOB;var aOB=()=>{let{promise:e,resolve:t,isPending:r}=$Rh(),i=0,n=()=>{i+=1},a=()=>{i-=1,!i&&t()};return(()=>{n(),queueMicrotask(a)})(),{promise:e,isPending:r,increment:n,decrement:a}},YRh=aOB;var XRh={then:e=>{e()}};var ZRh=e=>Array.isArray(e)?e:[e],kRh=e=>typeof e=="function";var oOB=(e,t)=>{let r=t?.followSymlinks??!1,i=t?.depth??1/0,n=t?.limit??1/0,a=t?.ignore??[],o=ZRh(a).map(H=>kRh(H)?H:G=>H.test(G)),c=H=>o.some(G=>G(H)),d=t?.signal??{aborted:!1},s=t?.onDirents||(()=>{}),u=[],l=new Set,p={},_=[],h=new Set,y={},b=[],v=new Set,O={},A={},g=new Set,m={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},j={directories:u,directoriesNames:l,directoriesNamesToPaths:p,files:_,filesNames:h,filesNamesToPaths:y,symlinks:b,symlinksNames:v,symlinksNamesToPaths:O,map:A},{promise:S,increment:w,decrement:D}=YRh(),B=0,R=(H,G,Ee,ue)=>{g.has(G)||B>=n||(B+=1,H.directories.push(G),H.directoriesNames.add(Ee),u.push(G),l.add(Ee),p.propertyIsEnumerable(Ee)||(p[Ee]=[]),p[Ee].push(G),g.add(G),!(ue>=i)&&(B>=n||k(G,ue+1)))},N=(H,G,Ee)=>{g.has(G)||B>=n||(B+=1,H.files.push(G),H.filesNames.add(Ee),_.push(G),h.add(Ee),y.propertyIsEnumerable(Ee)||(y[Ee]=[]),y[Ee].push(G),g.add(G))},z=(H,G,Ee,ue)=>{g.has(G)||B>=n||(B+=1,H.symlinks.push(G),H.symlinksNames.add(Ee),b.push(G),v.add(Ee),O.propertyIsEnumerable(Ee)||(O[Ee]=[]),O[Ee].push(G),g.add(G),r&&(ue>=i||B>=n||je(G,ue+1)))},F=(H,G,Ee,ue,Oe)=>{d.aborted||c(G)||(ue.isDirectory()?R(H,G,Ee,Oe):ue.isFile()?N(H,G,Ee):ue.isSymbolicLink()&&z(H,G,Ee,Oe))},U=(H,G,Ee,ue)=>{if(d.aborted)return;let Oe=G===bJa.default.sep?"":bJa.default.sep,Qe=Ee.name,se=`${G}${Oe}${Qe}`;c(se)||(Ee.isDirectory()?R(H,se,Qe,ue):Ee.isFile()?N(H,se,Qe):Ee.isSymbolicLink()&&z(H,se,Qe,ue))},x=(H,G,Ee,ue)=>{for(let Oe=0,Qe=Ee.length;Oe<Qe;Oe++)U(H,G,Ee[Oe],ue)},k=(H,G)=>{d.aborted||G>i||B>=n||(w(),JAu.default.readdir(H,{withFileTypes:!0},(Ee,ue)=>{if(Ee||d.aborted||!ue.length)return D();(s(ue)||XRh).then(()=>{let Qe=A[H]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};x(Qe,H,ue,G),D()})}))},je=(H,G)=>{w(),JAu.default.realpath(H,(Ee,ue)=>{if(Ee||d.aborted)return D();JAu.default.stat(ue,(Oe,Qe)=>{if(Oe||d.aborted)return D();let se=bJa.default.basename(ue),ne=A[H]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};F(ne,ue,se,Qe,G),D()})})};return(async(H,G=1)=>(H=bJa.default.normalize(H),g.add(H),k(H,G),await S,d.aborted?m:j))(e)},ezh=oOB;var KYt={lang:{debounce:KAu,attempt:e=>{try{return e()}catch(t){return KYt.lang.castError(t)}},castArray:e=>KYt.lang.isArray(e)?e:[e],castError:e=>KYt.lang.isError(e)?e:KYt.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(KYt.lang.isNaN(e))return KYt.lang.isNaN(t);if(KYt.lang.isPrimitive(e)||KYt.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split($Au.default.sep).length-1),getRealPath:(e,t)=>{try{return t?QJc.default.realpathSync.native(e):QJc.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===$Au.default.sep&&t.length-e.length>$Au.default.sep.length,poll:(e,t=GRh)=>JRh.retry.stat(t)(e,{bigint:!0}).catch(KYt.lang.noop),readdir:async(e,t,r=1/0,i=1/0,n,a)=>{if(a&&r===1&&e in a){let o=a[e];return[o.directories,o.files]}else{let o=await ezh(e,{depth:r,limit:i,ignore:t,signal:n});return[o.directories,o.files]}}}},Fp=KYt;var YAu=ce(require("path"),1);var UJc=class{constructor(t,r,i){this.base=i,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Fp.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=LRh){return(()=>{let r=this.watcher._readyWait,i=[],n=new Set,a=async(c,d)=>{let s=this.options.ignoreInitial?[]:c,u=await this.eventsPopulate([...d]),l=this.eventsDeduplicate([...s,...u]);this.onTargetEvents(l)},o=Fp.lang.debounce(()=>{this.watcher.isClosed()||(r=a(i,n),i=[],n=new Set)},t);return async(c,d="",s=!1)=>{s?await this.eventsPopulate([d],i,!0):n.add(d),r.then(o)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((i,n)=>{let[a,o]=n,c=r[o];return a===c||a===tf.CHANGE&&c===tf.ADD||(r[o]=a,i.push(n)),i},[])}async eventsPopulate(t,r=[],i=!1){return await Promise.all(t.map(async n=>{let a=await this.watcher._poller.update(n,this.options.pollingTimeout);await Promise.all(a.map(async o=>{r.push([o,n]),o===tf.ADD_DIR?await this.eventsPopulateAddDir(t,n,r,i):o===tf.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,n,r,i)}))})),r}async eventsPopulateAddDir(t,r,i=[],n=!1){if(n)return i;let a=this.options.recursive?this.options.depth??q$i:Math.min(1,this.options.depth??q$i),o=this.options.limit??_Ja,[c,d]=await Fp.fs.readdir(r,this.options.ignore,a,o,this.watcher._closeSignal),s=[...c,...d];return await Promise.all(s.map(u=>{if(!this.watcher.isIgnored(u,this.options.ignore)&&!t.includes(u))return this.eventsPopulate([u],i,!0)})),i}async eventsPopulateUnlinkDir(t,r,i=[],n=!1){if(n)return i;for(let a of this.watcher._poller.stats.keys())Fp.fs.isSubPath(r,a)&&(t.includes(a)||await this.eventsPopulate([a],i,!0));return i}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(tf.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!T$i&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(tf.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(tf.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(YAu.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(tf.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(YAu.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(tf.UNLINK_DIR,t))}onTargetEvent(t){let[r,i]=t;r===tf.ADD?this.onTargetAdd(i):r===tf.ADD_DIR?this.onTargetAddDir(i):r===tf.CHANGE?this.onTargetChange(i):r===tf.UNLINK?this.onTargetUnlink(i):r===tf.UNLINK_DIR&&this.onTargetUnlinkDir(i)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,i=!1){return this.handlerBatched(t,r,i)}onWatcherChange(t=Qvn.CHANGE,r){if(this.watcher.isClosed())return;let i=YAu.default.resolve(this.folderPath,r||"");this.filePath&&i!==this.folderPath&&i!==this.filePath||this.watcher.isIgnored(i,this.options.ignore)||this.onWatcherEvent(t,i)}onWatcherError(t){TJc&&t.code==="EPERM"?this.onWatcherChange(Qvn.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(hJa.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(hJa.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(Qvn.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&T$i&&this.options.native!==!1?this.options.depth??q$i:Math.min(1,this.options.depth??q$i),i=this.options.limit??_Ja,[n,a]=await Fp.fs.readdir(this.folderPath,this.options.ignore,r,i,this.watcher._closeSignal,this.options.readdirMap),o=[this.folderPath,...n,...a];await Promise.all(o.map(c=>{if(!this.watcher._poller.stats.has(c)&&!this.watcher.isIgnored(c,this.options.ignore))return this.onWatcherEvent(Qvn.CHANGE,c,t)}))}}},tzh=UJc;var bH={interval:100,intervalId:void 0,fns:new Map,init:()=>{bH.intervalId||(bH.intervalId=setInterval(bH.resolve,bH.interval))},reset:()=>{bH.intervalId&&(clearInterval(bH.intervalId),delete bH.intervalId)},add:(e,t)=>{bH.fns.set(e,Date.now()+t),bH.init()},remove:e=>{bH.fns.delete(e)},resolve:()=>{if(!bH.fns.size)return bH.reset();let e=Date.now();for(let[t,r]of bH.fns)r>=e||(bH.remove(t),t())}},vJa=bH;var gJa=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=RJc){let{ino:i,targetPath:n,events:a,locks:o}=t,c=()=>{let l=this._watcher._poller.paths.find(i||-1,p=>p!==n);if(l&&l!==n){if(Fp.fs.getRealPath(n,!0)===l)return;this._watcher.event(a.rename,l,n)}else this._watcher.event(a.add,n)};if(!i)return c();let d=()=>{o.add.delete(i),vJa.remove(s)},s=()=>{d(),c()};vJa.add(s,r);let u=()=>{let l=o.unlink.get(i);if(!l)return;d();let p=l();n===p?a.change&&this._watcher._poller.stats.has(n)&&this._watcher.event(a.change,n):this._watcher.event(a.rename,p,n)};o.add.set(i,u),u()}getLockUnlink(t,r=RJc){let{ino:i,targetPath:n,events:a,locks:o}=t,c=()=>{this._watcher.event(a.unlink,n)};if(!i)return c();let d=()=>{o.unlink.delete(i),vJa.remove(s)},s=()=>{d(),c()};vJa.add(s,r);let u=()=>(d(),n);o.unlink.set(i,u),o.add.get(i)?.()}getLockTargetAdd(t,r){let i=this._watcher._poller.getIno(t,tf.ADD,HYt.FILE);return this.getLockAdd({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let i=this._watcher._poller.getIno(t,tf.ADD_DIR,HYt.DIR);return this.getLockAdd({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let i=this._watcher._poller.getIno(t,tf.UNLINK,HYt.FILE);return this.getLockUnlink({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let i=this._watcher._poller.getIno(t,tf.UNLINK_DIR,HYt.DIR);return this.getLockUnlink({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};gJa.DIR_EVENTS={add:tf.ADD_DIR,rename:tf.RENAME_DIR,unlink:tf.UNLINK_DIR};gJa.FILE_EVENTS={add:tf.ADD,change:tf.CHANGE,rename:tf.RENAME,unlink:tf.UNLINK};var rzh=gJa;var LJc=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Fp.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let i=this.map.get(t);if(Fp.lang.isSet(i)){let n=i.delete(r);return i.size||this.map.delete(t),n}else if(i===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let i=this.map.get(t);if(Fp.lang.isSet(i))return Array.from(i).find(r);if(r(i))return i}}get(t){return this.map.get(t)}has(t,r){if(Fp.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let i=this.map.get(t);return Fp.lang.isSet(i)?i.has(r):i===r}return!1}set(t,r){if(this.map.has(t)){let i=this.map.get(t);Fp.lang.isSet(i)?i.add(r):i!==r&&this.map.set(t,new Set([i,r]))}else this.map.set(t,r);return this}},VJc=LJc;var WJc=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},izh=WJc;var GJc=class{constructor(){this.inos={},this.paths=new VJc,this.stats=new Map}getIno(t,r,i){let n=this.inos[r];if(!n)return;let a=n[t];if(a&&!(i&&a[1]!==i))return a[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let i=await Fp.fs.poll(t,r);if(!(!i||!(i.isFile()||i.isDirectory())))return new izh(i)}reset(){this.inos={},this.paths=new VJc,this.stats=new Map}async update(t,r){let i=this.getStats(t),n=await this.poll(t,r);if(this.updateStats(t,n),!i&&n){if(n.isFile())return this.updateIno(t,tf.ADD,n),[tf.ADD];if(n.isDirectory())return this.updateIno(t,tf.ADD_DIR,n),[tf.ADD_DIR]}else if(i&&!n){if(i.isFile())return this.updateIno(t,tf.UNLINK,i),[tf.UNLINK];if(i.isDirectory())return this.updateIno(t,tf.UNLINK_DIR,i),[tf.UNLINK_DIR]}else if(i&&n){if(i.isFile()){if(n.isFile())return i.ino===n.ino&&!i.size&&!n.size?[]:(this.updateIno(t,tf.CHANGE,n),[tf.CHANGE]);if(n.isDirectory())return this.updateIno(t,tf.UNLINK,i),this.updateIno(t,tf.ADD_DIR,n),[tf.UNLINK,tf.ADD_DIR]}else if(i.isDirectory()){if(n.isFile())return this.updateIno(t,tf.UNLINK_DIR,i),this.updateIno(t,tf.ADD,n),[tf.UNLINK_DIR,tf.ADD];if(n.isDirectory())return i.ino===n.ino?[]:(this.updateIno(t,tf.UNLINK_DIR,i),this.updateIno(t,tf.ADD_DIR,n),[tf.UNLINK_DIR,tf.ADD_DIR])}}return[]}updateIno(t,r,i){let n=this.inos[r]=this.inos[r]||(this.inos[r]={}),a=i.isFile()?HYt.FILE:HYt.DIR;n[t]=[i.ino,a]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let i=this.stats.get(t)?.ino||-1;this.paths.delete(i,t),this.stats.delete(t)}}},HJc=GJc;var xJc=class e extends nzh.EventEmitter{constructor(t,r,i){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(yH.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(n=>this.on(yH.CLOSE,n)),this._readyWait=new Promise(n=>this.on(yH.READY,n)),this._locker=new rzh(this),this._roots=new Set,this._poller=new HJc,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,i)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Fp.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(yH.CLOSE))}error(t){if(this.isClosed())return!1;let r=Fp.lang.castError(t);return this.emit(yH.ERROR,r)}event(t,r,i){return this.isClosed()?!1:(this.emit(yH.ALL,t,r,i),this.emit(t,r,i))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(yH.READY))}pollerExists(t,r){for(let i of this._pollers)if(i.targetPath===t&&Fp.lang.isShallowEqual(i.options,r))return!0;return!1}subwatcherExists(t,r){for(let i of this._subwatchers)if(i.targetPath===t&&Fp.lang.isShallowEqual(i.options,r))return!0;return!1}watchersClose(t,r,i=!0){if(t){let n=this._watchers[t];if(n)for(let a of[...n])r&&a.filePath!==r||this.watcherClose(a);if(i)for(let a in this._watchers)Fp.fs.isSubPath(t,a)&&this.watchersClose(a,r,!1)}else for(let n in this._watchers)this.watchersClose(n,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,i]of t)this.watchPath(r,i.options,i.handler)}async watcherAdd(t,r){let{folderPath:i}=t;(this._watchers[i]=this._watchers[i]||[]).push(t);let a=new tzh(this,t,r);return await a.init(),a}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let a=r.indexOf(t);r.splice(a,1),r.length||delete this._watchers[t.folderPath]}let i=t.filePath||t.folderPath;this._roots.has(i)&&(this._watchersRestorable[i]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Fp.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,i,n){if(this._watchers[t]?.find(c=>c.handler===i&&(!c.filePath||c.filePath===n)&&c.options.ignore===r.ignore&&!!c.options.native==!!r.native&&(!r.recursive||c.options.recursive)))return!0;let o=Uvn.default.dirname(t);for(let c=1;c<1/0;c++){if(this._watchers[o]?.find(u=>(c===1||u.options.recursive&&c<=(u.options.depth??q$i))&&u.handler===i&&(!u.filePath||u.filePath===n)&&u.options.ignore===r.ignore&&!!u.options.native==!!r.native&&(!r.recursive||u.options.recursive&&T$i&&u.options.native!==!1)))return!0;if(!T$i)break;let s=Uvn.default.dirname(t);if(o===s)break;o=s}return!1}async watchDirectories(t,r,i,n,a){if(this.isClosed())return;t=Fp.lang.uniq(t).sort();let o;for(let c of t)if(!this.isIgnored(c,r.ignore)&&!this.watcherExists(c,r,i,n))try{let d=!r.recursive||T$i&&r.native!==!1?r:{...r,recursive:!1},u={watcher:XAu.default.watch(c,d),handler:i,options:r,folderPath:c,filePath:n},l=o=await this.watcherAdd(u,a);if(this._roots.has(n||c)){let _={...r,ignoreInitial:!0,recursive:!1},h=Uvn.default.dirname(c),y=c;await this.watchDirectories([h],_,i,y,l)}}catch(d){this.error(d)}return o}async watchDirectory(t,r,i,n,a){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||T$i&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,i,n,a));{r={...r,recursive:!0};let o=r.depth??q$i,c=r.limit??_Ja,[d]=await Fp.fs.readdir(t,r.ignore,o,c,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let s=await this.watchDirectories([t],r,i,n,a);if(d.length){let u=Fp.fs.getDepth(t);for(let l of d){let p=Fp.fs.getDepth(l),_=Math.max(0,o-(p-u)),h={...r,depth:_};await this.watchDirectories([l],h,i,n,a||s)}}})}}}async watchFileOnce(t,r,i){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let n={targetPath:t,options:r},a=(s,u)=>{u===t&&(d(),i())},o=new e(a),c=()=>{this._subwatchers.add(n),this.on(yH.CLOSE,d),o.watchFile(t,r,a)},d=()=>{this._subwatchers.delete(n),this.removeListener(yH.CLOSE,d),o.close()};return c()}async watchFile(t,r,i){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let n=Uvn.default.dirname(t);return this.watchDirectory(n,r,i,t)}async watchPollingOnce(t,r,i){if(this.isClosed())return;let n=!1,a=new HJc,o=await this.watchPolling(t,r,async()=>{n||!(await a.update(t,r.pollingTimeout)).length||n||(n=!0,o(),i())})}async watchPolling(t,r,i){if(this.isClosed())return Fp.lang.noop;if(this.pollerExists(t,r))return Fp.lang.noop;let n={...r,interval:r.pollingInterval??WRh},a={targetPath:t,options:r},o=()=>{this._pollers.add(a),this.on(yH.CLOSE,c),XAu.default.watchFile(t,n,i)},c=()=>{this._pollers.delete(a),this.removeListener(yH.CLOSE,c),XAu.default.unwatchFile(t,i)};return Fp.lang.attempt(o),()=>Fp.lang.attempt(c)}async watchUnknownChild(t,r,i){if(this.isClosed())return;let n=()=>this.watchPath(t,r,i);return this.watchFileOnce(t,r,n)}async watchUnknownTarget(t,r,i){if(this.isClosed())return;let n=()=>this.watchPath(t,r,i);return this.watchPollingOnce(t,r,n)}async watchPaths(t,r,i){if(this.isClosed())return;if(t=Fp.lang.uniq(t).sort(),t.every((a,o)=>t.every((c,d)=>d===o||!Fp.fs.isSubPath(a,c))))await Promise.all(t.map(a=>this.watchPath(a,r,i)));else for(let a of t)await this.watchPath(a,r,i)}async watchPath(t,r,i){if(this.isClosed()||(t=Uvn.default.resolve(t),this.isIgnored(t,r.ignore)))return;let n=await Fp.fs.poll(t,r.pollingTimeout);if(n){if(n.isFile())return this.watchFile(t,r,i);if(n.isDirectory())return this.watchDirectory(t,r,i);this.error(`"${t}" is not supported`)}else{let a=Uvn.default.dirname(t);return(await Fp.fs.poll(a,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,i):this.watchUnknownTarget(t,r,i)}}async watch(t,r,i=Fp.lang.noop){if(Fp.lang.isFunction(t))return this.watch([],{},t);if(Fp.lang.isUndefined(t))return this.watch([],r,i);if(Fp.lang.isFunction(r))return this.watch(t,{},r);if(Fp.lang.isUndefined(r))return this.watch(t,{},i);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let n=Fp.lang.castArray(t);n.forEach(a=>this._roots.add(a)),await this.watchPaths(n,r,i),!this.isClosed()&&(i!==Fp.lang.noop&&this.on(yH.ALL,i),r.readdirMap=void 0,this.ready())}},ZAu=xJc;zXo();var lsa=require("fs/promises"),azh=require("os"),ozh=ce(require("path"),1),uOB=".fern",sOB="logs";function cOB(){return"cli@3.30.4"}var OJa=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=Ct(Cr.of((0,azh.homedir)()),Ze.of(uOB)),r=Ct(t,Ze.of(sOB));await ji(r)||await(0,lsa.mkdir)(r,{recursive:!0});let n=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ct(r,Ze.of(n));let a=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${ozh.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
1785
1785
  `);await(0,lsa.writeFile)(this.logFilePath,a,"utf-8"),this.initialized=!0}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
1786
1786
  `;try{await(0,lsa.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let i={timestamp:t.timestamp,source:cOB(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(i)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let i={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(i)}async logCliDocsGeneration(t,r){let i={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(i)}async logCliValidation(t,r){let i={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(i)}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var gYc=ce(t$c(),1),Z4h=ce(Wmu(),1),fY=require("fs/promises"),k4h=require("os"),eLh=ce(fG(),1),tLh=ce(Y4h(),1),oPu=process.platform==="win32",vYc=It.cyan("[docs]:"),DjB="etag",BjB=23,X4h=e=>e.padEnd(BjB," "),IjB="preview",CjB="app-preview",qjB="bundle",TjB=".next",RjB="standalone",zjB=".fern",NjB="packages/fern-docs/bundle/.next/server/instrumentation.js",FjB=".npmrc",QjB=".pnpmfile.cjs",UjB="pnpm-workspace.yaml",LjB='Cannot find matching keyid: {"signatures":';function VjB(){return Ct(Cr.of((0,k4h.homedir)()),Ze.of(zjB))}function Ssa({app:e=!1}){return Ct(VjB(),Ze.of(e?CjB:IjB))}function W$i({app:e=!1}){return Ct(Ssa({app:e}),Ze.of(e?TjB:qjB))}function GJa({app:e=!1}){return Ct(W$i({app:e}),Ze.of(RjB))}function WjB({app:e=!1}){return Ct(GJa({app:e}),Ze.of(NjB))}function GjB({app:e=!1}){return Ct(GJa({app:e}),Ze.of(UjB))}function HjB({app:e=!1}){return Ct(GJa({app:e}),Ze.of(QjB))}function xjB({app:e=!1}){return Ct(GJa({app:e}),Ze.of(FjB))}function Kvn(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function KjB({app:e=!1}){return Ct(Ssa({app:e}),Ze.of(DjB))}var JjB=`module.exports = {
1787
1787
  hooks: {