fern-api 0.54.0-rc5 → 0.54.0-rc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +2 -2
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1685,7 +1685,7 @@ ${c.indent}`:""}${zjf(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
|
|
|
1685
1685
|
`}),r.replaceAll(/\n$/g,"")}function U71(e){return e?ju.green(n3.radioOn):n3.radioOff}var Ono=mi(ywe(),1);function $Id(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var VGn=class extends n2{_run(t){this.done=t;let r=CL(this.rl),i=r.line.pipe((0,Ono.map)(this.filterInput.bind(this))),n=this.handleSubmitEvents(i);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,Ono.takeUntil)(n.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),i="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(i=`
|
|
1686
1686
|
`+ju.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?ju.cyan($Id(t,this.opt.mask)):ju.italic.dim("[hidden]"):this.opt.mask?$Id(t,this.opt.mask):ju.italic.dim("[input is hidden] ")}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var yRd=mi(hps(),1),vRd=mi(ywe(),1);var ZGn=class extends n2{_run(t){this.done=t,this.editorResult=new vRd.Subject;let r=CL(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"?ju.dim("Received"):ju.dim("Press <enter> to launch your preferred editor."),t&&(r=ju.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,yRd.editAsync)(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var SRd=mi(ORd(),1);var jRd=mi(require("readline"),1),wRd=mi(PRd(),1),twi=class{constructor(t){this.rl||=jRd.default.createInterface(T21(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 T21(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 wRd.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var kGn=class extends twi{constructor(t={}){super(t),this.log=(0,SRd.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return xGn(this.rl,this.bottomBar.split(`
|
|
1687
1687
|
`).length),this}updateBottomBar(t){return xGn(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+`
|
|
1688
|
-
`}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&&yno(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var IRd=mi(ARd(),1),zRd=mi(jfs(),1),RRd=mi(BRd(),1),nM=mi(ywe(),1),FRd=mi(W$n(),1);var Lno=mi(ywe(),1),xRd=mi(W$n(),1),Uno=function(e,t,r){return typeof e[t]!="function"?(0,Lno.of)(e):(0,Lno.from)((0,xRd.default)(e[t])(r).then(i=>(e[t]=i,e)))};var eQn={isPlainObject:IRd.default,set:RRd.default,get:zRd.default},Vun=class extends twi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=eQn.isPlainObject(r)?{...r}:{},eQn.isPlainObject(t)&&(t=Object.values(t).every(n=>eQn.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,nM.from)(t):t;return this.process=i.pipe((0,nM.concatMap)(this.processQuestion.bind(this)),(0,nM.publish)()),this.process.connect(),this.process.pipe((0,nM.reduce)((n,a)=>(eQn.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,nM.defer)(()=>(0,nM.of)(t).pipe((0,nM.concatMap)(this.setDefaultType.bind(this)),(0,nM.concatMap)(this.filterIfRunnable.bind(this)),(0,nM.concatMap)(()=>Uno(t,"message",this.answers)),(0,nM.concatMap)(()=>Uno(t,"default",this.answers)),(0,nM.concatMap)(()=>Uno(t,"choices",this.answers)),(0,nM.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,nM.defer)(()=>(0,nM.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,nM.defer)(()=>(0,nM.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&eQn.get(this.answers,t.name)!==void 0)return(0,nM.empty)();if(t.when===!1)return(0,nM.empty)();if(typeof t.when!="function")return(0,nM.of)(t);let{answers:r}=this;return(0,nM.defer)(()=>(0,nM.from)((0,FRd.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,nM.filter)(i=>i!=null)))}};function NRd(e){let t=function(r,i){let n;try{n=new Vun(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",zGn),this.registerPrompt("input",Qji),this.registerPrompt("number",RGn),this.registerPrompt("confirm",FGn),this.registerPrompt("rawlist",NGn),this.registerPrompt("expand",LGn),this.registerPrompt("checkbox",UGn),this.registerPrompt("password",VGn),this.registerPrompt("editor",ZGn)},t.restoreDefaultPrompts(),t}var bps=NRd();function K21(e,t){bps.registerPrompt(e,t)}function Y21(){bps.restoreDefaultPrompts()}var X21={prompt:bps,ui:{BottomBar:kGn,Prompt:Vun},createPromptModule:NRd,registerPrompt:K21,restoreDefaultPrompts:Y21,Separator:gte},Vno=X21;var KFd=mi(LRd()),m81="4.2.1",u2t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay"})(u2t||(u2t={}));function P81(e,t){if(!e)throw new Error(t)}function j81(e){return e?.replace(/\/+$/,"")}async function w81(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 S81(){return new Date().getTime()}function UFd(){return new Date().toISOString()}function YFd(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var dQn=String.fromCharCode,VFd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tao={};function D81(e,t){if(!tao[e]){tao[e]={};for(let r=0;r<e.length;r++)tao[e][e.charAt(r)]=r}return tao[e][t]}var pQn={compressToBase64:function(e){if(e==null)return"";let t=pQn._compress(e,6,function(r){return VFd.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:pQn._decompress(e.length,32,function(t){return D81(VFd,e.charAt(t))})},compress:function(e){return pQn._compress(e,16,function(t){return dQn(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,f="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(f=e.charAt(w),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=b++,n[f]=!0),s=o+f,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(f)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:pQn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,f=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=dQn(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=dQn(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,f),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=dQn(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=dQn(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,f),f++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,f),f++)}}},n_s=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var rao="0123456789abcdef",iao=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=rao.charAt(this.bytes[r]>>>4),t+=rao.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=rao.charAt(this.bytes[r]>>>4),t+=rao.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},a_s=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??E81()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return iao.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,iao.ofInner(t)}},E81=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),WFd,HFd=()=>A81().toString(),A81=()=>(WFd||(WFd=new a_s)).generate(),nao=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},_Qn=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function $Fd(e){return typeof e=="object"&&(e instanceof nao||e instanceof _Qn)}var o_s=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new n_s,this._isInitialized=!1,P81(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=j81(r?.host||"https://us.i.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r?.maxQueueSize??1e3),this.flushInterval=r?.flushInterval??1e4,this.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:$Fd},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(u2t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(u2t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(u2t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=HFd();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(f=>f.json()).catch(f=>{this._events.emit("error",f)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let f=l[t];return f===void 0&&(f=!1),f}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let f=l[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),f=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:f,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:UFd(),uuid:i?.uuid?i.uuid:HFd()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(u2t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(u2t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=YFd(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(u2t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(u2t.Queue)||[];this.setPersistedProperty(u2t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:UFd()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${S81()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,f=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(pQn.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,f)}catch(s){throw s instanceof _Qn||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let f=new AbortController;return setTimeout(()=>f.abort(),l),f.signal}),await w81(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(f){throw new _Qn(f)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new nao(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(u2t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!$Fd(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},u_s=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},s_s=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!s_s){let e=LFd();s_s=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var XFd=s_s,M81=1152921504606847e3,q81=["is_not"],aao=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},a2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},c_s=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||XFd,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let f of this.featureFlags)if(t===f.key){l=f;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(f){f instanceof a2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async f=>{try{let s=this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let o=await this.computeFeatureFlagPayloadLocally(f.key,s);o&&(u[f.key]=o)}catch(s){s instanceof a2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new a2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let f=this.groupTypeMapping[String(l)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new a2("Flag has unknown group type index");if(!(f in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[f];return this.matchFeatureFlagProperties(t,i[f],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,f=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of f)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof a2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new a2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let f=l.type,s=!1;if(f==="cohort"?s=kFd(l,n,this.cohorts,this.debugMode):s=ZFd(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&GFd(t.key,r)>a/100)}getMatchingVariant(t,r){let i=GFd(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new aao("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof aao&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=YFd(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function GFd(e,t,r=""){let i=(0,KFd.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/M81}function ZFd(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 a2("Operator is_not_set is not supported")}else throw new a2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!q81.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function f(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return QFd(String(n))&&String(u).match(String(n))!==null;case"not_regex":return QFd(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?f(u,String(n),a):f(u,s,a):f(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=T81(String(n));if(s==null&&(s=JFd(n)),s==null)throw new a2(`Invalid date: ${n}`);let o=JFd(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new a2(`Unknown operator: ${a}`)}}function kFd(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new a2("can't match cohort without a given cohort property value");let a=r[n];return eNd(a,t,r,i)}function eNd(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let f=eNd(l,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof a2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new a2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let f;l.type==="cohort"?f=kFd(l,t,r,i):f=ZFd(l,t);let s=l.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof a2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new a2("can't match cohort without a given cohort property value");return n==="AND"}}function QFd(e){try{return new RegExp(e),!0}catch{return!1}}function JFd(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 a2(`${e} is in an invalid date format`)}else throw new a2(`The date provided ${e} must be a string, number, or date object`)}function T81(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var C81=30*1e3,B81=50*1e3,Kun=class extends o_s{constructor(t,r={}){super(t,r),this._memoryStorage=new u_s,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new c_s({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:C81,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||B81}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):XFd(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return m81}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:f}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:f})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,w]of Object.entries(b))g[`$feature/${m}`]=w;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:f,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,f,s);f=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,f,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:f,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),f==null&&(f=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},f=this.addLocalPersonAndGroupProperties(t,i,u,l);u=f.allPersonProperties,l=f.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},l_s=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};l_s.POSTHOG_ID_TAG="posthog_distinct_id";var oao=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Kun(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.54.0-rc5",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var hQn=class{async sendEvent(){}async identify(){}async flush(){}};var Yun=require("fs/promises"),nNd=require("os"),aNd=require("path");var tNd=mi(require("crypto")),sao=new Uint8Array(256),uao=sao.length;function f_s(){return uao>sao.length-16&&(tNd.default.randomFillSync(sao),uao=0),sao.slice(uao,uao+=16)}var IL=[];for(let e=0;e<256;++e)IL.push((e+256).toString(16).slice(1));function rNd(e,t=0){return IL[e[t+0]]+IL[e[t+1]]+IL[e[t+2]]+IL[e[t+3]]+"-"+IL[e[t+4]]+IL[e[t+5]]+"-"+IL[e[t+6]]+IL[e[t+7]]+"-"+IL[e[t+8]]+IL[e[t+9]]+"-"+IL[e[t+10]]+IL[e[t+11]]+IL[e[t+12]]+IL[e[t+13]]+IL[e[t+14]]+IL[e[t+15]]}var iNd=mi(require("crypto")),d_s={randomUUID:iNd.default.randomUUID};function x81(e,t,r){if(d_s.randomUUID&&!t&&!e)return d_s.randomUUID();e=e||{};let i=e.random||(e.rng||f_s)();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 rNd(i)}var wte=x81;var I81="id",z81=".fern",yQn=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new Kun(r),this.userId=t==null?void 0:qos(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.54.0-rc5",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Yu(Ul.of((0,nNd.homedir)()),io.of(z81),io.of(I81));await xf(t)||(await(0,Yun.mkdir)((0,aNd.dirname)(t),{recursive:!0}),await(0,Yun.writeFile)(t,wte())),this.persistedDistinctId=(await(0,Yun.readFile)(t)).toString()}return this.persistedDistinctId}};var p_s;async function Xun(){return p_s==null&&(p_s=await R81()),p_s}async function R81(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new hQn;let r=await gZa();return r!=null?new yQn({token:r,posthogApiKey:e}):await bZa()!=null?new oao({posthogApiKey:e}):new yQn({token:void 0,posthogApiKey:e})}catch{return new hQn}}function vQn(e,t){return function(){return e.apply(t,arguments)}}var{toString:F81}=Object.prototype,{getPrototypeOf:y_s}=Object,lao=(e=>t=>{let r=F81.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),s2t=e=>(e=e.toLowerCase(),t=>lao(t)===e),fao=e=>t=>typeof t===e,{isArray:Zun}=Array,bQn=fao("undefined");function N81(e){return e!==null&&!bQn(e)&&e.constructor!==null&&!bQn(e.constructor)&&bwe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sNd=s2t("ArrayBuffer");function L81(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sNd(e.buffer),t}var U81=fao("string"),bwe=fao("function"),cNd=fao("number"),dao=e=>e!==null&&typeof e=="object",V81=e=>e===!0||e===!1,cao=e=>{if(lao(e)!=="object")return!1;let t=y_s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},W81=s2t("Date"),H81=s2t("File"),$81=s2t("Blob"),G81=s2t("FileList"),Q81=e=>dao(e)&&bwe(e.pipe),J81=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||bwe(e.append)&&((t=lao(e))==="formdata"||t==="object"&&bwe(e.toString)&&e.toString()==="[object FormData]"))},K81=s2t("URLSearchParams"),[Y81,X81,Z81,k81]=["ReadableStream","Request","Response","Headers"].map(s2t),e51=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gQn(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Zun(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function lNd(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var awi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fNd=e=>!bQn(e)&&e!==awi;function h_s(){let{caseless:e}=fNd(this)&&this||{},t={},r=(i,n)=>{let a=e&&lNd(t,n)||n;cao(t[a])&&cao(i)?t[a]=h_s(t[a],i):cao(i)?t[a]=h_s({},i):Zun(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&gQn(arguments[i],r);return t}var t51=(e,t,r,{allOwnKeys:i}={})=>(gQn(t,(n,a)=>{r&&bwe(n)?e[a]=vQn(n,r):e[a]=n},{allOwnKeys:i}),e),r51=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),i51=(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)},n51=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&y_s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},a51=(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},o51=e=>{if(!e)return null;if(Zun(e))return e;let t=e.length;if(!cNd(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},u51=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&y_s(Uint8Array)),s51=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},c51=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},l51=s2t("HTMLFormElement"),f51=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),oNd=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),d51=s2t("RegExp"),dNd=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};gQn(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},p51=e=>{dNd(e,(t,r)=>{if(bwe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(bwe(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+"'")})}})},_51=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return Zun(e)?i(e):i(String(e).split(t)),r},h51=()=>{},y51=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,__s="abcdefghijklmnopqrstuvwxyz",uNd="0123456789",pNd={DIGIT:uNd,ALPHA:__s,ALPHA_DIGIT:__s+__s.toUpperCase()+uNd},v51=(e=16,t=pNd.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function b51(e){return!!(e&&bwe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var g51=e=>{let t=new Array(10),r=(i,n)=>{if(dao(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=Zun(i)?[]:{};return gQn(i,(u,l)=>{let f=r(u,n+1);!bQn(f)&&(a[l]=f)}),t[n]=void 0,a}}return i};return r(e,0)},O51=s2t("AsyncFunction"),m51=e=>e&&(dao(e)||bwe(e))&&bwe(e.then)&&bwe(e.catch),_Nd=((e,t)=>e?setImmediate:t?((r,i)=>(awi.addEventListener("message",({source:n,data:a})=>{n===awi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),awi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",bwe(awi.postMessage)),P51=typeof queueMicrotask<"u"?queueMicrotask.bind(awi):typeof process<"u"&&process.nextTick||_Nd,os={isArray:Zun,isArrayBuffer:sNd,isBuffer:N81,isFormData:J81,isArrayBufferView:L81,isString:U81,isNumber:cNd,isBoolean:V81,isObject:dao,isPlainObject:cao,isReadableStream:Y81,isRequest:X81,isResponse:Z81,isHeaders:k81,isUndefined:bQn,isDate:W81,isFile:H81,isBlob:$81,isRegExp:d51,isFunction:bwe,isStream:Q81,isURLSearchParams:K81,isTypedArray:u51,isFileList:G81,forEach:gQn,merge:h_s,extend:t51,trim:e51,stripBOM:r51,inherits:i51,toFlatObject:n51,kindOf:lao,kindOfTest:s2t,endsWith:a51,toArray:o51,forEachEntry:s51,matchAll:c51,isHTMLForm:l51,hasOwnProperty:oNd,hasOwnProp:oNd,reduceDescriptors:dNd,freezeMethods:p51,toObjectSet:_51,toCamelCase:f51,noop:h51,toFiniteNumber:y51,findKey:lNd,global:awi,isContextDefined:fNd,ALPHABET:pNd,generateString:v51,isSpecCompliantForm:b51,toJSONObject:g51,isAsyncFn:O51,isThenable:m51,setImmediate:_Nd,asap:P51};function kun(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(kun,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var hNd=kun.prototype,yNd={};["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=>{yNd[e]={value:e}});Object.defineProperties(kun,yNd);Object.defineProperty(hNd,"isAxiosError",{value:!0});kun.from=(e,t,r,i,n,a)=>{let u=Object.create(hNd);return os.toFlatObject(e,u,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),kun.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var yp=kun;var vNd=mi(aUn(),1),pao=vNd.default;function v_s(e){return os.isPlainObject(e)||os.isArray(e)}function gNd(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function bNd(e,t,r){return e?e.concat(t).map(function(n,a){return n=gNd(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function j51(e){return os.isArray(e)&&!e.some(v_s)}var w51=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function S51(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(pao||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(!f&&os.isBlob(O))throw new yp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?f&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&j51(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=gNd(m),E.forEach(function(q,D){!(os.isUndefined(q)||q===null)&&t.append(u===!0?bNd([m],D,a):u===null?m:m+"[]",s(q))}),!1}return v_s(O)?!0:(t.append(bNd(w,m,a),s(O)),!1)}let c=[],b=Object.assign(w51,{defaultVisitor:o,convertValue:s,isVisitable:v_s});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,M){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(M)?M.trim():M,m,b))===!0&&g(E,m?m.concat(M):[M])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var dkr=S51;function ONd(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function mNd(e,t){this._pairs=[],e&&dkr(e,this,t)}var PNd=mNd.prototype;PNd.append=function(t,r){this._pairs.push([t,r])};PNd.toString=function(t){let r=t?function(i){return t.call(this,i,ONd)}:ONd;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var jNd=mNd;function D51(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function owi(e,t,r){if(!t)return e;let i=r&&r.encode||D51,n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new jNd(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var b_s=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},g_s=b_s;var esn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wNd=mi(require("url"),1),SNd=wNd.default.URLSearchParams;var DNd={isNode:!0,classes:{URLSearchParams:SNd,FormData:pao,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var P_s={};Ro(P_s,{hasBrowserEnv:()=>m_s,hasStandardBrowserEnv:()=>E51,hasStandardBrowserWebWorkerEnv:()=>A51,navigator:()=>O_s,origin:()=>M51});var m_s=typeof window<"u"&&typeof document<"u",O_s=typeof navigator=="object"&&navigator||void 0,E51=m_s&&(!O_s||["ReactNative","NativeScript","NS"].indexOf(O_s.product)<0),A51=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",M51=m_s&&window.location.href||"http://localhost";var sT={...P_s,...DNd};function j_s(e,t){return dkr(e,new sT.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sT.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function q51(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function T51(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 C51(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),f=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,f?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=T51(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(q51(i),n,r,0)}),r}return null}var _ao=C51;function B51(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var w_s={transitional:esn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(_ao(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return j_s(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return dkr(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),B51(t)):t}],transformResponse:[function(t){let r=this.transitional||w_s.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?yp.from(l,yp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sT.classes.FormData,Blob:sT.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{w_s.headers[e]={}});var tsn=w_s;var x51=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ENd=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1688
|
+
`}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&&yno(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var IRd=mi(ARd(),1),zRd=mi(jfs(),1),RRd=mi(BRd(),1),nM=mi(ywe(),1),FRd=mi(W$n(),1);var Lno=mi(ywe(),1),xRd=mi(W$n(),1),Uno=function(e,t,r){return typeof e[t]!="function"?(0,Lno.of)(e):(0,Lno.from)((0,xRd.default)(e[t])(r).then(i=>(e[t]=i,e)))};var eQn={isPlainObject:IRd.default,set:RRd.default,get:zRd.default},Vun=class extends twi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=eQn.isPlainObject(r)?{...r}:{},eQn.isPlainObject(t)&&(t=Object.values(t).every(n=>eQn.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,nM.from)(t):t;return this.process=i.pipe((0,nM.concatMap)(this.processQuestion.bind(this)),(0,nM.publish)()),this.process.connect(),this.process.pipe((0,nM.reduce)((n,a)=>(eQn.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,nM.defer)(()=>(0,nM.of)(t).pipe((0,nM.concatMap)(this.setDefaultType.bind(this)),(0,nM.concatMap)(this.filterIfRunnable.bind(this)),(0,nM.concatMap)(()=>Uno(t,"message",this.answers)),(0,nM.concatMap)(()=>Uno(t,"default",this.answers)),(0,nM.concatMap)(()=>Uno(t,"choices",this.answers)),(0,nM.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,nM.defer)(()=>(0,nM.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,nM.defer)(()=>(0,nM.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&eQn.get(this.answers,t.name)!==void 0)return(0,nM.empty)();if(t.when===!1)return(0,nM.empty)();if(typeof t.when!="function")return(0,nM.of)(t);let{answers:r}=this;return(0,nM.defer)(()=>(0,nM.from)((0,FRd.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,nM.filter)(i=>i!=null)))}};function NRd(e){let t=function(r,i){let n;try{n=new Vun(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",zGn),this.registerPrompt("input",Qji),this.registerPrompt("number",RGn),this.registerPrompt("confirm",FGn),this.registerPrompt("rawlist",NGn),this.registerPrompt("expand",LGn),this.registerPrompt("checkbox",UGn),this.registerPrompt("password",VGn),this.registerPrompt("editor",ZGn)},t.restoreDefaultPrompts(),t}var bps=NRd();function K21(e,t){bps.registerPrompt(e,t)}function Y21(){bps.restoreDefaultPrompts()}var X21={prompt:bps,ui:{BottomBar:kGn,Prompt:Vun},createPromptModule:NRd,registerPrompt:K21,restoreDefaultPrompts:Y21,Separator:gte},Vno=X21;var KFd=mi(LRd()),m81="4.2.1",u2t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay"})(u2t||(u2t={}));function P81(e,t){if(!e)throw new Error(t)}function j81(e){return e?.replace(/\/+$/,"")}async function w81(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 S81(){return new Date().getTime()}function UFd(){return new Date().toISOString()}function YFd(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var dQn=String.fromCharCode,VFd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tao={};function D81(e,t){if(!tao[e]){tao[e]={};for(let r=0;r<e.length;r++)tao[e][e.charAt(r)]=r}return tao[e][t]}var pQn={compressToBase64:function(e){if(e==null)return"";let t=pQn._compress(e,6,function(r){return VFd.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:pQn._decompress(e.length,32,function(t){return D81(VFd,e.charAt(t))})},compress:function(e){return pQn._compress(e,16,function(t){return dQn(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,f="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(f=e.charAt(w),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=b++,n[f]=!0),s=o+f,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(f)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:pQn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,f=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=dQn(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=dQn(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,f),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=dQn(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=dQn(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,f),f++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,f),f++)}}},n_s=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var rao="0123456789abcdef",iao=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=rao.charAt(this.bytes[r]>>>4),t+=rao.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=rao.charAt(this.bytes[r]>>>4),t+=rao.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},a_s=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??E81()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return iao.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,iao.ofInner(t)}},E81=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),WFd,HFd=()=>A81().toString(),A81=()=>(WFd||(WFd=new a_s)).generate(),nao=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},_Qn=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function $Fd(e){return typeof e=="object"&&(e instanceof nao||e instanceof _Qn)}var o_s=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new n_s,this._isInitialized=!1,P81(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=j81(r?.host||"https://us.i.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r?.maxQueueSize??1e3),this.flushInterval=r?.flushInterval??1e4,this.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:$Fd},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(u2t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(u2t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(u2t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=HFd();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(f=>f.json()).catch(f=>{this._events.emit("error",f)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let f=l[t];return f===void 0&&(f=!1),f}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let f=l[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),f=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:f,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:UFd(),uuid:i?.uuid?i.uuid:HFd()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(u2t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(u2t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=YFd(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(u2t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(u2t.Queue)||[];this.setPersistedProperty(u2t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:UFd()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${S81()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,f=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(pQn.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,f)}catch(s){throw s instanceof _Qn||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let f=new AbortController;return setTimeout(()=>f.abort(),l),f.signal}),await w81(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(f){throw new _Qn(f)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new nao(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(u2t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!$Fd(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},u_s=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},s_s=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!s_s){let e=LFd();s_s=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var XFd=s_s,M81=1152921504606847e3,q81=["is_not"],aao=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},a2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},c_s=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||XFd,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let f of this.featureFlags)if(t===f.key){l=f;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(f){f instanceof a2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async f=>{try{let s=this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let o=await this.computeFeatureFlagPayloadLocally(f.key,s);o&&(u[f.key]=o)}catch(s){s instanceof a2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new a2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let f=this.groupTypeMapping[String(l)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new a2("Flag has unknown group type index");if(!(f in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[f];return this.matchFeatureFlagProperties(t,i[f],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,f=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of f)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof a2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new a2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let f=l.type,s=!1;if(f==="cohort"?s=kFd(l,n,this.cohorts,this.debugMode):s=ZFd(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&GFd(t.key,r)>a/100)}getMatchingVariant(t,r){let i=GFd(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new aao("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof aao&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=YFd(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function GFd(e,t,r=""){let i=(0,KFd.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/M81}function ZFd(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 a2("Operator is_not_set is not supported")}else throw new a2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!q81.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function f(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return QFd(String(n))&&String(u).match(String(n))!==null;case"not_regex":return QFd(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?f(u,String(n),a):f(u,s,a):f(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=T81(String(n));if(s==null&&(s=JFd(n)),s==null)throw new a2(`Invalid date: ${n}`);let o=JFd(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new a2(`Unknown operator: ${a}`)}}function kFd(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new a2("can't match cohort without a given cohort property value");let a=r[n];return eNd(a,t,r,i)}function eNd(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let f=eNd(l,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof a2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new a2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let f;l.type==="cohort"?f=kFd(l,t,r,i):f=ZFd(l,t);let s=l.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof a2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new a2("can't match cohort without a given cohort property value");return n==="AND"}}function QFd(e){try{return new RegExp(e),!0}catch{return!1}}function JFd(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 a2(`${e} is in an invalid date format`)}else throw new a2(`The date provided ${e} must be a string, number, or date object`)}function T81(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var C81=30*1e3,B81=50*1e3,Kun=class extends o_s{constructor(t,r={}){super(t,r),this._memoryStorage=new u_s,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new c_s({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:C81,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||B81}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):XFd(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return m81}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:f}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:f})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,w]of Object.entries(b))g[`$feature/${m}`]=w;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:f,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,f,s);f=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,f,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:f,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),f==null&&(f=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},f=this.addLocalPersonAndGroupProperties(t,i,u,l);u=f.allPersonProperties,l=f.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},l_s=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};l_s.POSTHOG_ID_TAG="posthog_distinct_id";var oao=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Kun(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.54.0-rc6",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var hQn=class{async sendEvent(){}async identify(){}async flush(){}};var Yun=require("fs/promises"),nNd=require("os"),aNd=require("path");var tNd=mi(require("crypto")),sao=new Uint8Array(256),uao=sao.length;function f_s(){return uao>sao.length-16&&(tNd.default.randomFillSync(sao),uao=0),sao.slice(uao,uao+=16)}var IL=[];for(let e=0;e<256;++e)IL.push((e+256).toString(16).slice(1));function rNd(e,t=0){return IL[e[t+0]]+IL[e[t+1]]+IL[e[t+2]]+IL[e[t+3]]+"-"+IL[e[t+4]]+IL[e[t+5]]+"-"+IL[e[t+6]]+IL[e[t+7]]+"-"+IL[e[t+8]]+IL[e[t+9]]+"-"+IL[e[t+10]]+IL[e[t+11]]+IL[e[t+12]]+IL[e[t+13]]+IL[e[t+14]]+IL[e[t+15]]}var iNd=mi(require("crypto")),d_s={randomUUID:iNd.default.randomUUID};function x81(e,t,r){if(d_s.randomUUID&&!t&&!e)return d_s.randomUUID();e=e||{};let i=e.random||(e.rng||f_s)();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 rNd(i)}var wte=x81;var I81="id",z81=".fern",yQn=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new Kun(r),this.userId=t==null?void 0:qos(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.54.0-rc6",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Yu(Ul.of((0,nNd.homedir)()),io.of(z81),io.of(I81));await xf(t)||(await(0,Yun.mkdir)((0,aNd.dirname)(t),{recursive:!0}),await(0,Yun.writeFile)(t,wte())),this.persistedDistinctId=(await(0,Yun.readFile)(t)).toString()}return this.persistedDistinctId}};var p_s;async function Xun(){return p_s==null&&(p_s=await R81()),p_s}async function R81(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new hQn;let r=await gZa();return r!=null?new yQn({token:r,posthogApiKey:e}):await bZa()!=null?new oao({posthogApiKey:e}):new yQn({token:void 0,posthogApiKey:e})}catch{return new hQn}}function vQn(e,t){return function(){return e.apply(t,arguments)}}var{toString:F81}=Object.prototype,{getPrototypeOf:y_s}=Object,lao=(e=>t=>{let r=F81.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),s2t=e=>(e=e.toLowerCase(),t=>lao(t)===e),fao=e=>t=>typeof t===e,{isArray:Zun}=Array,bQn=fao("undefined");function N81(e){return e!==null&&!bQn(e)&&e.constructor!==null&&!bQn(e.constructor)&&bwe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sNd=s2t("ArrayBuffer");function L81(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sNd(e.buffer),t}var U81=fao("string"),bwe=fao("function"),cNd=fao("number"),dao=e=>e!==null&&typeof e=="object",V81=e=>e===!0||e===!1,cao=e=>{if(lao(e)!=="object")return!1;let t=y_s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},W81=s2t("Date"),H81=s2t("File"),$81=s2t("Blob"),G81=s2t("FileList"),Q81=e=>dao(e)&&bwe(e.pipe),J81=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||bwe(e.append)&&((t=lao(e))==="formdata"||t==="object"&&bwe(e.toString)&&e.toString()==="[object FormData]"))},K81=s2t("URLSearchParams"),[Y81,X81,Z81,k81]=["ReadableStream","Request","Response","Headers"].map(s2t),e51=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gQn(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Zun(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function lNd(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var awi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fNd=e=>!bQn(e)&&e!==awi;function h_s(){let{caseless:e}=fNd(this)&&this||{},t={},r=(i,n)=>{let a=e&&lNd(t,n)||n;cao(t[a])&&cao(i)?t[a]=h_s(t[a],i):cao(i)?t[a]=h_s({},i):Zun(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&gQn(arguments[i],r);return t}var t51=(e,t,r,{allOwnKeys:i}={})=>(gQn(t,(n,a)=>{r&&bwe(n)?e[a]=vQn(n,r):e[a]=n},{allOwnKeys:i}),e),r51=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),i51=(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)},n51=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&y_s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},a51=(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},o51=e=>{if(!e)return null;if(Zun(e))return e;let t=e.length;if(!cNd(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},u51=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&y_s(Uint8Array)),s51=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},c51=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},l51=s2t("HTMLFormElement"),f51=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),oNd=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),d51=s2t("RegExp"),dNd=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};gQn(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},p51=e=>{dNd(e,(t,r)=>{if(bwe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(bwe(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+"'")})}})},_51=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return Zun(e)?i(e):i(String(e).split(t)),r},h51=()=>{},y51=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,__s="abcdefghijklmnopqrstuvwxyz",uNd="0123456789",pNd={DIGIT:uNd,ALPHA:__s,ALPHA_DIGIT:__s+__s.toUpperCase()+uNd},v51=(e=16,t=pNd.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function b51(e){return!!(e&&bwe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var g51=e=>{let t=new Array(10),r=(i,n)=>{if(dao(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=Zun(i)?[]:{};return gQn(i,(u,l)=>{let f=r(u,n+1);!bQn(f)&&(a[l]=f)}),t[n]=void 0,a}}return i};return r(e,0)},O51=s2t("AsyncFunction"),m51=e=>e&&(dao(e)||bwe(e))&&bwe(e.then)&&bwe(e.catch),_Nd=((e,t)=>e?setImmediate:t?((r,i)=>(awi.addEventListener("message",({source:n,data:a})=>{n===awi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),awi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",bwe(awi.postMessage)),P51=typeof queueMicrotask<"u"?queueMicrotask.bind(awi):typeof process<"u"&&process.nextTick||_Nd,os={isArray:Zun,isArrayBuffer:sNd,isBuffer:N81,isFormData:J81,isArrayBufferView:L81,isString:U81,isNumber:cNd,isBoolean:V81,isObject:dao,isPlainObject:cao,isReadableStream:Y81,isRequest:X81,isResponse:Z81,isHeaders:k81,isUndefined:bQn,isDate:W81,isFile:H81,isBlob:$81,isRegExp:d51,isFunction:bwe,isStream:Q81,isURLSearchParams:K81,isTypedArray:u51,isFileList:G81,forEach:gQn,merge:h_s,extend:t51,trim:e51,stripBOM:r51,inherits:i51,toFlatObject:n51,kindOf:lao,kindOfTest:s2t,endsWith:a51,toArray:o51,forEachEntry:s51,matchAll:c51,isHTMLForm:l51,hasOwnProperty:oNd,hasOwnProp:oNd,reduceDescriptors:dNd,freezeMethods:p51,toObjectSet:_51,toCamelCase:f51,noop:h51,toFiniteNumber:y51,findKey:lNd,global:awi,isContextDefined:fNd,ALPHABET:pNd,generateString:v51,isSpecCompliantForm:b51,toJSONObject:g51,isAsyncFn:O51,isThenable:m51,setImmediate:_Nd,asap:P51};function kun(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(kun,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var hNd=kun.prototype,yNd={};["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=>{yNd[e]={value:e}});Object.defineProperties(kun,yNd);Object.defineProperty(hNd,"isAxiosError",{value:!0});kun.from=(e,t,r,i,n,a)=>{let u=Object.create(hNd);return os.toFlatObject(e,u,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),kun.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var yp=kun;var vNd=mi(aUn(),1),pao=vNd.default;function v_s(e){return os.isPlainObject(e)||os.isArray(e)}function gNd(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function bNd(e,t,r){return e?e.concat(t).map(function(n,a){return n=gNd(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function j51(e){return os.isArray(e)&&!e.some(v_s)}var w51=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function S51(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(pao||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(!f&&os.isBlob(O))throw new yp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?f&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&j51(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=gNd(m),E.forEach(function(q,D){!(os.isUndefined(q)||q===null)&&t.append(u===!0?bNd([m],D,a):u===null?m:m+"[]",s(q))}),!1}return v_s(O)?!0:(t.append(bNd(w,m,a),s(O)),!1)}let c=[],b=Object.assign(w51,{defaultVisitor:o,convertValue:s,isVisitable:v_s});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,M){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(M)?M.trim():M,m,b))===!0&&g(E,m?m.concat(M):[M])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var dkr=S51;function ONd(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function mNd(e,t){this._pairs=[],e&&dkr(e,this,t)}var PNd=mNd.prototype;PNd.append=function(t,r){this._pairs.push([t,r])};PNd.toString=function(t){let r=t?function(i){return t.call(this,i,ONd)}:ONd;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var jNd=mNd;function D51(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function owi(e,t,r){if(!t)return e;let i=r&&r.encode||D51,n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new jNd(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var b_s=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},g_s=b_s;var esn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wNd=mi(require("url"),1),SNd=wNd.default.URLSearchParams;var DNd={isNode:!0,classes:{URLSearchParams:SNd,FormData:pao,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var P_s={};Ro(P_s,{hasBrowserEnv:()=>m_s,hasStandardBrowserEnv:()=>E51,hasStandardBrowserWebWorkerEnv:()=>A51,navigator:()=>O_s,origin:()=>M51});var m_s=typeof window<"u"&&typeof document<"u",O_s=typeof navigator=="object"&&navigator||void 0,E51=m_s&&(!O_s||["ReactNative","NativeScript","NS"].indexOf(O_s.product)<0),A51=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",M51=m_s&&window.location.href||"http://localhost";var sT={...P_s,...DNd};function j_s(e,t){return dkr(e,new sT.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sT.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function q51(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function T51(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 C51(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),f=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,f?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=T51(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(q51(i),n,r,0)}),r}return null}var _ao=C51;function B51(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var w_s={transitional:esn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(_ao(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return j_s(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return dkr(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),B51(t)):t}],transformResponse:[function(t){let r=this.transitional||w_s.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?yp.from(l,yp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sT.classes.FormData,Blob:sT.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{w_s.headers[e]={}});var tsn=w_s;var x51=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ENd=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1689
1689
|
`).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&x51[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var ANd=Symbol("internals");function OQn(e){return e&&String(e).trim().toLowerCase()}function hao(e){return e===!1||e==null?e:os.isArray(e)?e.map(hao):String(e)}function I51(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 z51=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function S_s(e,t,r,i,n){if(os.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!os.isString(t)){if(os.isString(i))return t.indexOf(i)!==-1;if(os.isRegExp(i))return i.test(t)}}function R51(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function F51(e,t){let r=os.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var rsn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,f,s){let o=OQn(f);if(!o)throw new Error("header name must be a non-empty string");let c=os.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||f]=hao(l))}let u=(l,f)=>os.forEach(l,(s,o)=>a(s,o,f));if(os.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(os.isString(t)&&(t=t.trim())&&!z51(t))u(ENd(t),r);else if(os.isHeaders(t))for(let[l,f]of t.entries())a(f,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=OQn(t),t){let i=os.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return I51(n);if(os.isFunction(r))return r.call(this,n,i);if(os.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=OQn(t),t){let i=os.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||S_s(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=OQn(u),u){let l=os.findKey(i,u);l&&(!r||S_s(i,i[l],l,r))&&(delete i[l],n=!0)}}return os.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||S_s(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return os.forEach(this,(n,a)=>{let u=os.findKey(i,a);if(u){r[u]=hao(n),delete r[a];return}let l=t?R51(a):String(a).trim();l!==a&&delete r[a],r[l]=hao(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return os.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&os.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
1690
1690
|
`)}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[ANd]=this[ANd]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=OQn(u);i[l]||(F51(n,u),i[l]=!0)}return os.isArray(t)?t.forEach(a):a(t),this}};rsn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);os.reduceDescriptors(rsn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});os.freezeMethods(rsn);var lI=rsn;function mQn(e,t){let r=this||tsn,i=t||r,n=lI.from(i.headers),a=i.data;return os.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function PQn(e){return!!(e&&e.__CANCEL__)}function MNd(e,t,r){yp.call(this,e??"canceled",yp.ERR_CANCELED,t,r),this.name="CanceledError"}os.inherits(MNd,yp,{__CANCEL__:!0});var gwe=MNd;function OGt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new yp("Request failed with status code "+r.status,[yp.ERR_BAD_REQUEST,yp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function D_s(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function E_s(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function uwi(e,t){return e&&!D_s(t)?E_s(e,t):t}var $Nd=mi(rQn(),1),GNd=mi(require("http"),1),QNd=mi(require("https"),1),JNd=mi(require("util"),1),KNd=mi(Cps(),1),G4r=mi(require("zlib"),1);var swi="1.7.7";function jQn(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var N51=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function A_s(e,t,r){let i=r&&r.Blob||sT.classes.Blob,n=jQn(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=N51.exec(e);if(!a)throw new yp("Invalid URL",yp.ERR_INVALID_URL);let u=a[1],l=a[2],f=a[3],s=Buffer.from(decodeURIComponent(f),l?"base64":"utf8");if(t){if(!i)throw new yp("Blob is not supported",yp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new yp("Unsupported protocol "+n,yp.ERR_NOT_SUPPORT)}var cwi=mi(require("stream"),1);var qNd=mi(require("stream"),1);var M_s=Symbol("internals"),q_s=class extends qNd.default.Transform{constructor(t){t=os.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!os.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[M_s]={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[M_s];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[M_s],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,f=1e3/l,s=a/f,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),w=null,E=u,M,q=0;if(a){let D=Date.now();(!n.ts||(q=D-n.ts)>=l)&&(n.ts=D,M=s-n.bytes,n.bytes=M<0?-M:0,q=0),M=s-n.bytes}if(a){if(M<=0)return setTimeout(()=>{O(null,g)},l-q);M<E&&(E=M)}E&&m>E&&m-E>o&&(w=g.subarray(E),g=g.subarray(0,E)),c(g,w?()=>{process.nextTick(O,null,w)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},T_s=q_s;var YNd=require("events");var CNd=require("util"),BNd=require("stream");var{asyncIterator:TNd}=Symbol,L51=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[TNd]?yield*e[TNd]():yield e},yao=L51;var U51=os.ALPHABET.ALPHA_DIGIT+"-_",wQn=new CNd.TextEncoder,pkr=`\r
|
|
1691
1691
|
`,V51=wQn.encode(pkr),W51=2,C_s=class{constructor(t,r){let{escapeName:i}=this.constructor,n=os.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${pkr}`;n?r=wQn.encode(String(r).replace(/\r?\n|\r\n?/g,pkr)):a+=`Content-Type: ${r.type||"application/octet-stream"}${pkr}`,this.headers=wQn.encode(a+pkr),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+W51,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;os.isTypedArray(t)?yield t:yield*yao(t),yield V51}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},H51=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+os.generateString(n,U51)}=r||{};if(!os.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=wQn.encode("--"+a+pkr),l=wQn.encode("--"+a+"--"+pkr+pkr),f=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new C_s(c,b);return f+=g.size,g});f+=u.byteLength*s.length,f=os.toFiniteNumber(f);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(o["Content-Length"]=f),t&&t(o),BNd.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},xNd=H51;var INd=mi(require("stream"),1),B_s=class extends INd.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)}},zNd=B_s;var $51=(e,t)=>os.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,RNd=$51;function G51(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(f){let s=Date.now(),o=i[a];u||(u=s),r[n]=f,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var FNd=G51;function Q51(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var NNd=Q51;var $4r=(e,t,r=3)=>{let i=0,n=FNd(50,250);return NNd(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,f=u-i,s=n(f),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:f,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},isn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},nsn=e=>(...t)=>os.asap(()=>e(...t));var LNd={flush:G4r.default.constants.Z_SYNC_FLUSH,finishFlush:G4r.default.constants.Z_SYNC_FLUSH},J51={flush:G4r.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:G4r.default.constants.BROTLI_OPERATION_FLUSH},UNd=os.isFunction(G4r.default.createBrotliDecompress),{http:K51,https:Y51}=KNd.default,X51=/https:?/,VNd=sT.protocols.map(e=>e+":"),WNd=(e,[t,r])=>(e.on("end",r).on("error",r),t);function Z51(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function XNd(e,t,r){let i=t;if(!i&&i!==!1){let n=(0,$Nd.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){XNd(a,t,a.href)}}var k51=typeof process<"u"&&os.kindOf(process)==="process",e91=e=>new Promise((t,r)=>{let i,n,a=(f,s)=>{n||(n=!0,i&&i(f,s))},u=f=>{a(f),t(f)},l=f=>{a(f,!0),r(f)};e(u,l,f=>i=f).catch(l)}),t91=({address:e,family:t})=>{if(!os.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},HNd=(e,t)=>t91(os.isObject(e)?e:{address:e,family:t}),ZNd=k51&&function(t){return e91(async function(i,n,a){let{data:u,lookup:l,family:f}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let we=RNd(l,Xe=>os.isArray(Xe)?Xe:[Xe]);l=(Xe,At,De)=>{we(Xe,At,(Te,xt,Ee)=>{if(Te)return De(Te);let It=os.isArray(xt)?xt.map(st=>HNd(st)):[HNd(xt,Ee)];At.all?De(Te,It):De(Te,It[0].address,It[0].family)})}}let m=new YNd.EventEmitter,w=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((we,Xe)=>{b=!0,Xe&&(g=!0,w())});function E(we){m.emit("abort",!we||we.type?new gwe(null,t,O):we)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let M=uwi(t.baseURL,t.url),q=new URL(M,sT.hasBrowserEnv?sT.origin:void 0),D=q.protocol||VNd[0];if(D==="data:"){let we;if(c!=="GET")return OGt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{we=A_s(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Xe){throw yp.from(Xe,yp.ERR_BAD_REQUEST,t)}return s==="text"?(we=we.toString(o),(!o||o==="utf8")&&(we=os.stripBOM(we))):s==="stream"&&(we=cwi.default.Readable.from(we)),OGt(i,n,{data:we,status:200,statusText:"OK",headers:new lI,config:t})}if(VNd.indexOf(D)===-1)return n(new yp("Unsupported protocol "+D,yp.ERR_BAD_REQUEST,t));let C=lI.from(t.headers).normalize();C.set("User-Agent","axios/"+swi,!1);let{onUploadProgress:R,onDownloadProgress:$}=t,I=t.maxRate,U,H;if(os.isSpecCompliantForm(u)){let we=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=xNd(u,Xe=>{C.set(Xe)},{tag:`axios-${swi}-boundary`,boundary:we&&we[1]||void 0})}else if(os.isFormData(u)&&os.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let we=await JNd.default.promisify(u.getLength).call(u);Number.isFinite(we)&&we>=0&&C.setContentLength(we)}catch{}}else if(os.isBlob(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=cwi.default.Readable.from(yao(u));else if(u&&!os.isStream(u)){if(!Buffer.isBuffer(u))if(os.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(os.isString(u))u=Buffer.from(u,"utf-8");else return n(new yp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",yp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new yp("Request body larger than maxBodyLength limit",yp.ERR_BAD_REQUEST,t))}let k=os.toFiniteNumber(C.getContentLength());os.isArray(I)?(U=I[0],H=I[1]):U=H=I,u&&(R||U)&&(os.isStream(u)||(u=cwi.default.Readable.from(u,{objectMode:!1})),u=cwi.default.pipeline([u,new T_s({maxRate:os.toFiniteNumber(U)})],os.noop),R&&u.on("progress",WNd(u,isn(k,$4r(nsn(R),!1,3)))));let J;if(t.auth){let we=t.auth.username||"",Xe=t.auth.password||"";J=we+":"+Xe}if(!J&&q.username){let we=q.username,Xe=q.password;J=we+":"+Xe}J&&C.delete("authorization");let te;try{te=owi(q.pathname+q.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(we){let Xe=new Error(we.message);return Xe.config=t,Xe.url=t.url,Xe.exists=!0,n(Xe)}C.set("Accept-Encoding","gzip, compress, deflate"+(UNd?", br":""),!1);let fe={path:te,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:J,protocol:D,family:f,beforeRedirect:Z51,beforeRedirects:{}};!os.isUndefined(l)&&(fe.lookup=l),t.socketPath?fe.socketPath=t.socketPath:(fe.hostname=q.hostname.startsWith("[")?q.hostname.slice(1,-1):q.hostname,fe.port=q.port,XNd(fe,t.proxy,D+"//"+q.hostname+(q.port?":"+q.port:"")+fe.path));let me,be=X51.test(fe.protocol);if(fe.agent=be?t.httpsAgent:t.httpAgent,t.transport?me=t.transport:t.maxRedirects===0?me=be?QNd.default:GNd.default:(t.maxRedirects&&(fe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(fe.beforeRedirects.config=t.beforeRedirect),me=be?Y51:K51),t.maxBodyLength>-1?fe.maxBodyLength=t.maxBodyLength:fe.maxBodyLength=1/0,t.insecureHTTPParser&&(fe.insecureHTTPParser=t.insecureHTTPParser),O=me.request(fe,function(Xe){if(O.destroyed)return;let At=[Xe],De=+Xe.headers["content-length"];if($||H){let st=new T_s({maxRate:os.toFiniteNumber(H)});$&&st.on("progress",WNd(st,isn(De,$4r(nsn($),!0,3)))),At.push(st)}let Te=Xe,xt=Xe.req||O;if(t.decompress!==!1&&Xe.headers["content-encoding"])switch((c==="HEAD"||Xe.statusCode===204)&&delete Xe.headers["content-encoding"],(Xe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":At.push(G4r.default.createUnzip(LNd)),delete Xe.headers["content-encoding"];break;case"deflate":At.push(new zNd),At.push(G4r.default.createUnzip(LNd)),delete Xe.headers["content-encoding"];break;case"br":UNd&&(At.push(G4r.default.createBrotliDecompress(J51)),delete Xe.headers["content-encoding"])}Te=At.length>1?cwi.default.pipeline(At,os.noop):At[0];let Ee=cwi.default.finished(Te,()=>{Ee(),w()}),It={status:Xe.statusCode,statusText:Xe.statusMessage,headers:new lI(Xe.headers),config:t,request:xt};if(s==="stream")It.data=Te,OGt(i,n,It);else{let st=[],he=0;Te.on("data",function(Ot){st.push(Ot),he+=Ot.length,t.maxContentLength>-1&&he>t.maxContentLength&&(g=!0,Te.destroy(),n(new yp("maxContentLength size of "+t.maxContentLength+" exceeded",yp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let Ot=new yp("maxContentLength size of "+t.maxContentLength+" exceeded",yp.ERR_BAD_RESPONSE,t,xt);Te.destroy(Ot),n(Ot)}),Te.on("error",function(Ot){O.destroyed||n(yp.from(Ot,null,t,xt))}),Te.on("end",function(){try{let Ot=st.length===1?st[0]:Buffer.concat(st);s!=="arraybuffer"&&(Ot=Ot.toString(o),(!o||o==="utf8")&&(Ot=os.stripBOM(Ot))),It.data=Ot}catch(Ot){return n(yp.from(Ot,null,t,It.request,It))}OGt(i,n,It)})}m.once("abort",st=>{Te.destroyed||(Te.emit("error",st),Te.destroy())})}),m.once("abort",we=>{n(we),O.destroy(we)}),O.on("error",function(Xe){n(yp.from(Xe,null,t,O))}),O.on("socket",function(Xe){Xe.setKeepAlive(!0,1e3*60)}),t.timeout){let we=parseInt(t.timeout,10);if(Number.isNaN(we)){n(new yp("error trying to parse `config.timeout` to int",yp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(we,function(){if(b)return;let At=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||esn;t.timeoutErrorMessage&&(At=t.timeoutErrorMessage),n(new yp(At,De.clarifyTimeoutError?yp.ETIMEDOUT:yp.ECONNABORTED,t,O)),E()})}if(os.isStream(u)){let we=!1,Xe=!1;u.on("end",()=>{we=!0}),u.once("error",At=>{Xe=!0,O.destroy(At)}),u.on("close",()=>{!we&&!Xe&&E(new gwe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var kNd=sT.hasStandardBrowserEnv?function(){let t=sT.navigator&&/(msie|trident)/i.test(sT.navigator.userAgent),r=document.createElement("a"),i;function n(a){let u=a;return t&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=n(window.location.href),function(u){let l=os.isString(u)?n(u):u;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}();var e3d=sT.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];os.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),os.isString(i)&&u.push("path="+i),os.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var t3d=e=>e instanceof lI?{...e}:e;function c2t(e,t){t=t||{};let r={};function i(s,o,c){return os.isPlainObject(s)&&os.isPlainObject(o)?os.merge.call({caseless:c},s,o):os.isPlainObject(o)?os.merge({},o):os.isArray(o)?o.slice():o}function n(s,o,c){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s,c)}else return i(s,o,c)}function a(s,o){if(!os.isUndefined(o))return i(void 0,o)}function u(s,o){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let f={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o)=>n(t3d(s),t3d(o),!0)};return os.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=f[o]||n,b=c(e[o],t[o],o);os.isUndefined(b)&&c!==l||(r[o]=b)}),r}var vao=e=>{let t=c2t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=lI.from(u),t.url=owi(uwi(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let f;if(os.isFormData(r)){if(sT.hasStandardBrowserEnv||sT.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((f=u.getContentType())!==!1){let[s,...o]=f?f.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(sT.hasStandardBrowserEnv&&(i&&os.isFunction(i)&&(i=i(t)),i||i!==!1&&kNd(t.url))){let s=n&&a&&e3d.read(a);s&&u.set(n,s)}return t};var r91=typeof XMLHttpRequest<"u",r3d=r91&&function(e){return new Promise(function(r,i){let n=vao(e),a=n.data,u=lI.from(n.headers).normalize(),{responseType:l,onUploadProgress:f,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let w=new XMLHttpRequest;w.open(n.method.toUpperCase(),n.url,!0),w.timeout=n.timeout;function E(){if(!w)return;let q=lI.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:q,config:e,request:w};OGt(function($){r($),m()},function($){i($),m()},C),w=null}"onloadend"in w?w.onloadend=E:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(E)},w.onabort=function(){w&&(i(new yp("Request aborted",yp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new yp("Network Error",yp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||esn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new yp(D,C.clarifyTimeoutError?yp.ETIMEDOUT:yp.ECONNABORTED,e,w)),w=null},a===void 0&&u.setContentType(null),"setRequestHeader"in w&&os.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),os.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=$4r(s,!0),w.addEventListener("progress",b)),f&&w.upload&&([c,g]=$4r(f),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=q=>{w&&(i(!q||q.type?new gwe(null,e,w):q),w.abort(),w=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let M=jQn(n.url);if(M&&sT.protocols.indexOf(M)===-1){i(new yp("Unsupported protocol "+M+":",yp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var i91=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof yp?o:new gwe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new yp(`timeout ${t} of ms exceeded`,yp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:f}=i;return f.unsubscribe=()=>os.asap(l),f}},i3d=i91;var n91=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},a91=async function*(e,t){for await(let r of o91(e))yield*n91(r,t)},o91=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()}},x_s=(e,t,r,i)=>{let n=a91(e,t),a=0,u,l=f=>{u||(u=!0,i&&i(f))};return new ReadableStream({async pull(f){try{let{done:s,value:o}=await n.next();if(s){l(),f.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}f.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(f){return l(f),n.return()}},{highWaterMark:2})};var gao=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",a3d=gao&&typeof ReadableStream=="function",u91=gao&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),o3d=(e,...t)=>{try{return!!e(...t)}catch{return!1}},s91=a3d&&o3d(()=>{let e=!1,t=new Request(sT.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),n3d=64*1024,I_s=a3d&&o3d(()=>os.isReadableStream(new Response("").body)),bao={stream:I_s&&(e=>e.body)};gao&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!bao[t]&&(bao[t]=os.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new yp(`Response type '${t}' is not supported`,yp.ERR_NOT_SUPPORT,i)})})})(new Response);var c91=async e=>{if(e==null)return 0;if(os.isBlob(e))return e.size;if(os.isSpecCompliantForm(e))return(await new Request(sT.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(os.isArrayBufferView(e)||os.isArrayBuffer(e))return e.byteLength;if(os.isURLSearchParams(e)&&(e=e+""),os.isString(e))return(await u91(e)).byteLength},l91=async(e,t)=>{let r=os.toFiniteNumber(e.getContentLength());return r??c91(t)},u3d=gao&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:f,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=vao(e);s=s?(s+"").toLowerCase():"text";let g=i3d([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(f&&s91&&r!=="get"&&r!=="head"&&(w=await l91(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),R;if(os.isFormData(i)&&(R=C.headers.get("content-type"))&&o.setContentType(R),C.body){let[$,I]=isn(w,$4r(nsn(f)));i=x_s(C.body,n3d,$,I)}}os.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let M=await fetch(O),q=I_s&&(s==="stream"||s==="response");if(I_s&&(l||q&&m)){let C={};["status","statusText","headers"].forEach(U=>{C[U]=M[U]});let R=os.toFiniteNumber(M.headers.get("content-length")),[$,I]=l&&isn(R,$4r(nsn(l),!0))||[];M=new Response(x_s(M.body,n3d,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await bao[os.findKey(bao,s)||"text"](M,e);return!q&&m&&m(),await new Promise((C,R)=>{OGt(C,R,{data:D,headers:lI.from(M.headers),status:M.status,statusText:M.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new yp("Network Error",yp.ERR_NETWORK,e,O),{cause:E.cause||E}):yp.from(E,E&&E.code,e,O)}});var z_s={http:ZNd,xhr:r3d,fetch:u3d};os.forEach(z_s,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var s3d=e=>`- ${e}`,f91=e=>os.isFunction(e)||e===null||e===!1,Oao={getAdapter:e=>{e=os.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!f91(r)&&(i=z_s[(u=String(r)).toLowerCase()],i===void 0))throw new yp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
|
|
@@ -1923,7 +1923,7 @@ ${q}${M}${D}${Nup.default.cursorHide}`});var _Zn=mi(hPi(),1);function ASs(e,t){i
|
|
|
1923
1923
|
Run ${ju.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1924
1924
|
Run ${ju.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),osn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function NSs({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!csp(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,f)=>l.generatorName.localeCompare(f.generatorName)||l.currentVersion.localeCompare(f.currentVersion));for(let l of u)n+=`
|
|
1925
1925
|
${await UwS(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+ju.dim(l.currentVersion)+ju.reset(" \u2192 ")+ju.green(l.latestVersion);return n+=`
|
|
1926
|
-
`,i?osn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function UwS(e){let r=await new ssp.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 VwS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=LYr(o.name,c),g=await zWt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,f,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][f]==null&&(u.versions[l][f]={});let c=LYr(s.name,o),b=await zWt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][f][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await x7t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let f of l.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,u)}})}))}function dsp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let f=Ite(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function O_o({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await VwS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[f,s]of Object.entries(l.versions))u.push(...dsp(s,f,t.logger));else u.push(...dsp(l.versions,void 0,t.logger))}return u}var PZn=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Kfn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Yfn=e=>e!==null&&typeof e=="object";var jZn=(...e)=>{for(let t of e)if((!Yfn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return VSs({},...e)},LSs=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function m_o(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:VSs(e[r]??[],t[r]??[])}var USs=(e={},t={})=>({beforeRequest:m_o(e,t,"beforeRequest"),beforeRetry:m_o(e,t,"beforeRetry"),afterResponse:m_o(e,t,"afterResponse"),beforeError:m_o(e,t,"beforeError")}),VSs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Yfn(n)){for(let[a,u]of Object.entries(n))Yfn(u)&&a in t&&(u=VSs(t[a],u)),t={...t,[a]:u};Yfn(n.hooks)&&(i=USs(i,n.hooks),t.hooks=i),Yfn(n.headers)&&(r=LSs(r,n.headers),t.headers=r)}return t};var psp=(()=>{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})(),_sp=typeof globalThis.AbortController=="function",hsp=typeof globalThis.ReadableStream=="function",ysp=typeof globalThis.FormData=="function",P_o=["get","post","put","patch","head","delete"],WwS=()=>{};WwS();var vsp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},j_o=2147483647,w_o=Symbol("stop"),bsp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},gsp={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 msp=e=>P_o.includes(e)?e.toUpperCase():e,HwS=["get","put","head","delete","options","trace"],$wS=[408,413,429,500,502,503,504],GwS=[413,429,503],Osp={limit:2,methods:HwS,statusCodes:$wS,afterStatusCodes:GwS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Psp=(e={})=>{if(typeof e=="number")return{...Osp,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{...Osp,...e}};async function WSs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Kfn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function HSs(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 jsp=(e,t)=>{let r={};for(let i in t)!(i in gsp)&&!(i in bsp)&&!(i in e)&&(r[i]=t[i]);return r};var wZn=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>j_o)throw new RangeError(`The \`timeout\` option cannot be greater than ${j_o}`);await Promise.resolve();let l=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let f=new PZn(l,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hsp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,f]of Object.entries(vsp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:LSs(this._input.headers,r.headers),hooks:USs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:msp(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Psp(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(_sp){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(psp&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(ysp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Kfn)throw t;if(t instanceof PZn){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),j_o);if(this._retryCount<1)throw r;await HSs(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})===w_o)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=jsp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):WSs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:f,value:s}=await u.read();if(f){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var $Ss=e=>{let t=(r,i)=>wZn.create(r,jZn(e,i));for(let r of P_o)t[r]=(i,n)=>wZn.create(i,jZn(e,n,{method:r}));return t.create=r=>$Ss(jZn(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),$Ss(jZn(e,r))),t.stop=w_o,t},QwS=$Ss(),wsp=QwS;var Qsp=mi(Gsp(),1);function YSs(e){let t=(0,Qsp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Ucp=mi(Lcp(),1),Vcp=mi(hPi(),1),lDs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},fDs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function dDs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??YSs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,Ucp.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,l&&(f.authorization=`${l.type} ${l.token}`);let s;try{s=await wsp(u,{headers:f,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new lDs(e):c}if(t.allVersions)return s;let o=new fDs(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=Vcp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function qZn(e,t){let{version:r}=await dDs(e.toLowerCase(),t);return r}async function Fei({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:qZn(e.packageName,{version:t?"prerelease":"latest"})}var Wcp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],z_o=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=eg.Info;constructor(t){this.ttyAwareLogger=new g_o(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.54.0-rc5"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${ju.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Xk}failWithoutThrowing(t,r){this.didSucceed=!1,h_o({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await Xun()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await lsp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1926
|
+
`,i?osn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function UwS(e){let r=await new ssp.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 VwS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=LYr(o.name,c),g=await zWt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,f,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][f]==null&&(u.versions[l][f]={});let c=LYr(s.name,o),b=await zWt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][f][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function fsp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await x7t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let f of l.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,u)}})}))}function dsp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let f=Ite(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function O_o({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await VwS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[f,s]of Object.entries(l.versions))u.push(...dsp(s,f,t.logger));else u.push(...dsp(l.versions,void 0,t.logger))}return u}var PZn=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Kfn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Yfn=e=>e!==null&&typeof e=="object";var jZn=(...e)=>{for(let t of e)if((!Yfn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return VSs({},...e)},LSs=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function m_o(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:VSs(e[r]??[],t[r]??[])}var USs=(e={},t={})=>({beforeRequest:m_o(e,t,"beforeRequest"),beforeRetry:m_o(e,t,"beforeRetry"),afterResponse:m_o(e,t,"afterResponse"),beforeError:m_o(e,t,"beforeError")}),VSs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Yfn(n)){for(let[a,u]of Object.entries(n))Yfn(u)&&a in t&&(u=VSs(t[a],u)),t={...t,[a]:u};Yfn(n.hooks)&&(i=USs(i,n.hooks),t.hooks=i),Yfn(n.headers)&&(r=LSs(r,n.headers),t.headers=r)}return t};var psp=(()=>{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})(),_sp=typeof globalThis.AbortController=="function",hsp=typeof globalThis.ReadableStream=="function",ysp=typeof globalThis.FormData=="function",P_o=["get","post","put","patch","head","delete"],WwS=()=>{};WwS();var vsp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},j_o=2147483647,w_o=Symbol("stop"),bsp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},gsp={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 msp=e=>P_o.includes(e)?e.toUpperCase():e,HwS=["get","put","head","delete","options","trace"],$wS=[408,413,429,500,502,503,504],GwS=[413,429,503],Osp={limit:2,methods:HwS,statusCodes:$wS,afterStatusCodes:GwS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Psp=(e={})=>{if(typeof e=="number")return{...Osp,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{...Osp,...e}};async function WSs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Kfn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function HSs(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 jsp=(e,t)=>{let r={};for(let i in t)!(i in gsp)&&!(i in bsp)&&!(i in e)&&(r[i]=t[i]);return r};var wZn=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>j_o)throw new RangeError(`The \`timeout\` option cannot be greater than ${j_o}`);await Promise.resolve();let l=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let f=new PZn(l,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hsp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,f]of Object.entries(vsp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:LSs(this._input.headers,r.headers),hooks:USs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:msp(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Psp(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(_sp){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(psp&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(ysp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Kfn)throw t;if(t instanceof PZn){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),j_o);if(this._retryCount<1)throw r;await HSs(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})===w_o)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=jsp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):WSs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:f,value:s}=await u.read();if(f){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var $Ss=e=>{let t=(r,i)=>wZn.create(r,jZn(e,i));for(let r of P_o)t[r]=(i,n)=>wZn.create(i,jZn(e,n,{method:r}));return t.create=r=>$Ss(jZn(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),$Ss(jZn(e,r))),t.stop=w_o,t},QwS=$Ss(),wsp=QwS;var Qsp=mi(Gsp(),1);function YSs(e){let t=(0,Qsp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Ucp=mi(Lcp(),1),Vcp=mi(hPi(),1),lDs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},fDs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function dDs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??YSs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,Ucp.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,l&&(f.authorization=`${l.type} ${l.token}`);let s;try{s=await wsp(u,{headers:f,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new lDs(e):c}if(t.allVersions)return s;let o=new fDs(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=Vcp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function qZn(e,t){let{version:r}=await dDs(e.toLowerCase(),t);return r}async function Fei({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:qZn(e.packageName,{version:t?"prerelease":"latest"})}var Wcp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],z_o=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=eg.Info;constructor(t){this.ttyAwareLogger=new g_o(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.54.0-rc6"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${ju.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Xk}failWithoutThrowing(t,r){this.didSucceed=!1,h_o({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await Xun()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await lsp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1927
1927
|
`)||(r+=`
|
|
1928
1928
|
`),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=_Gu(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 hZn(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 Xk}finally{i.finish()}return n}async instrumentPostHogEvent(t){(await Xun()).sendEvent(t)}logger=S6r(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Hcp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Hcp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=Wcp[this.numTasks++%Wcp.length],u=ju.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===IT.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logImmediately(t){let r=t.filter(i=>rYr.indexOf(i.level)>=rYr.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===eg.Debug})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await Fei({cliEnvironment:this.environment,includePreReleases:t}),i=Ite(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await O_o({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await PSs({message:t,default:r})}async getInput(t){return await jSs({message:t.message,default:t.default})}};function Hcp(e){return`[${e}]:`}var eMp=require("fs/promises");function WBe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(ju.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(ju.dim(r)),i.join(`
|
|
1929
1929
|
`)}var Pwp=require("fs/promises");var V2t=class e{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;type=e.Type;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var Fwe=class extends V2t{definition;sources;constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var TZn=class{context;constructor(t){this.context=t}};var R_o=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let f=n!=null?Wh.of(`${n}${X3t}${u}`):Wh.of(u);t[f]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${X3t}${u}`:u,f=i.directories[u];r(f,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(X3t))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Wh.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var bSi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new R_o,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return k6r(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))Z1S(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:i}){if(t===r)return;let n=i??NP((kqe(r)+"/"+gmi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Wh.of(WN))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=g8a(kqe(arn.of(`/${t}`)),arn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=g8a(kqe(arn.of(`/${t}`)),arn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>U3t(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=Ez(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:Ez(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:Ez(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===m1?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function Z1S(e){return e?.header!=null}var zte={openapi:e=>({...e,type:"openapi",_visit:function(t){return zte._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return zte._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var idn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return idn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var k4={basic:e=>({...e,type:"basic",_visit:function(t){return k4._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return k4._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return k4._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return k4._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return k4._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var M0={primitive:e=>({value:e,type:"primitive",_visit:function(t){return M0._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return M0._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return M0._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return M0._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return M0._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return M0._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return M0._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return M0._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var Kp={int:e=>({value:e,type:"int",_visit:function(t){return Kp._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Kp._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Kp._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Kp._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Kp._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Kp._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Kp._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Kp._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Kp._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Kp._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Kp._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var ndn={boolean:e=>({value:e,type:"boolean",_visit:function(t){return ndn._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return ndn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var Nei={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return Nei._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return Nei._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var QL={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case QL.GenerallyAvailable:return t.generallyAvailable();case QL.Beta:return t.beta();case QL.Deprecated:return t.deprecated();default:return t._other()}}};var N8r={cursor:e=>({...e,type:"cursor",_visit:function(t){return N8r._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return N8r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);default:return t._other(e)}}};var L8r={language:e=>({...e,type:"language",_visit:function(t){return L8r._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return L8r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var JL={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm",_visit:(e,t)=>{switch(e){case JL.Curl:return t.curl();case JL.Python:return t.python();case JL.Javascript:return t.javascript();case JL.Typescript:return t.typescript();case JL.Go:return t.go();case JL.Ruby:return t.ruby();case JL.Csharp:return t.csharp();case JL.Java:return t.java();case JL.Js:return t.js();case JL.Node:return t.node();case JL.Ts:return t.ts();case JL.Nodets:return t.nodets();case JL.Golang:return t.golang();case JL.Dotnet:return t.dotnet();case JL.Jvm:return t.jvm();default:return t._other()}}};var W2t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return W2t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return W2t._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var HBe={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return HBe._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return HBe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var NH={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case NH.Get:return t.get();case NH.Post:return t.post();case NH.Put:return t.put();case NH.Patch:return t.patch();case NH.Delete:return t.delete();case NH.Head:return t.head();case NH.Options:return t.options();case NH.Trace:return t.trace();default:return t._other()}}};var Lei={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Lei._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Lei._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Lei._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var $Be={file:e=>({...e,type:"file",_visit:function(t){return $Be._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return $Be._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var Rte={file:e=>({...e,type:"file",_visit:function(t){return Rte._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Rte._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Rte._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Rte._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Rte._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Rte._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var ey={primitive:e=>({...e,type:"primitive",_visit:function(t){return ey._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ey._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ey._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ey._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ey._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ey._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ey._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ey._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ey._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ey._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ey._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var WP={int:e=>({...e,type:"int",_visit:function(t){return WP._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return WP._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return WP._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return WP._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return WP._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return WP._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return WP._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return WP._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return WP._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return WP._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return WP._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var gB={boolean:e=>({value:e,type:"boolean",_visit:function(t){return gB._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return gB._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var U8r={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return U8r._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return U8r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Nwe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Nwe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Nwe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Nwe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var OB={file:e=>({...e,type:"file",_visit:function(t){return OB._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return OB._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return OB._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return OB._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return OB._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return OB._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Dl={primitive:e=>({...e,type:"primitive",_visit:function(t){return Dl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Dl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Dl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Dl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Dl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Dl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Dl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Dl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Dl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Dl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Dl._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var hK={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return hK._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return hK._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Gd={int:e=>({...e,type:"int",_visit:function(t){return Gd._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Gd._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Gd._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Gd._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Gd._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Gd._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Gd._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Gd._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Gd._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Gd._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Gd._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var Uy={};Ro(Uy,{AllOfPropertyConflict:()=>Ddn,ArraySchema:()=>Yho,ArraySchemaWithExample:()=>wyo,Availability:()=>Q_o,Base64WithExample:()=>gyo,BasicSecurityScheme:()=>Y_o,BearerSecurityScheme:()=>X_o,BooleanSchema:()=>Hho,BooleanWithExample:()=>Oyo,CasingOverrides:()=>eho,CommonProperty:()=>nyo,CommonPropertyWithExample:()=>Byo,CursorPagination:()=>qho,CustomCodeSample:()=>Aho,CustomCodeSampleLanguage:()=>Sho,CustomCodeSampleSdk:()=>Eho,DateWithExample:()=>byo,DatetimeWithExample:()=>vyo,DiscriminatedOneOfSchema:()=>ryo,DiscriminatedOneOfSchemaWithExample:()=>Tyo,DoubleSchema:()=>Vho,DoubleWithExample:()=>hyo,Encoding:()=>G_o,Endpoint:()=>Cho,EndpointExample:()=>mdn,EndpointResponseExample:()=>who,EndpointSdkName:()=>lQt,EndpointWithExample:()=>Olp,EnumSchema:()=>sdn,EnumSchemaWithExample:()=>Pyo,EnumValue:()=>Wei,ErrorExample:()=>gho,FernExample:()=>mho,FileResponse:()=>ydn,FileSchema:()=>dho,FloatWithExample:()=>_yo,FullEndpointExample:()=>Mho,FullExample:()=>uM,FullObjectExample:()=>uho,FullOneOfExample:()=>cho,GlobalHeader:()=>Gho,Header:()=>$ei,HeaderExample:()=>Odn,HeaderSecurityScheme:()=>Z_o,HeaderWithExample:()=>Jei,HttpEndpointServer:()=>bdn,HttpError:()=>Oho,HttpErrorWithExample:()=>cyo,HttpMethod:()=>fdn,IdempotencyHeader:()=>Qho,Int64WithExample:()=>fyo,IntSchema:()=>Lho,IntWithExample:()=>lyo,JsonRequest:()=>yho,JsonRequestWithExample:()=>oyo,JsonResponse:()=>vdn,JsonResponseWithExample:()=>Mdn,KeyValuePair:()=>sho,LiteralExample:()=>oho,LiteralSchema:()=>Sdn,LiteralSchemaValue:()=>Jho,LongSchema:()=>Uho,MapSchema:()=>Xho,MapSchemaWithExample:()=>Syo,MultipartRequest:()=>hdn,MultipartRequestProperty:()=>hho,MultipartRequestPropertyEncoding:()=>_ho,MultipartSchema:()=>pho,NamedFullExample:()=>dQt,Namespace:()=>tho,NamespaceId:()=>aho,NullableSchema:()=>kho,NullableSchemaWithExample:()=>Eyo,OauthSecurityScheme:()=>iho,ObjectProperty:()=>tyo,ObjectPropertyConflictInfo:()=>Edn,ObjectPropertyWithExample:()=>qyo,ObjectSchema:()=>Kho,ObjectSchemaWithExample:()=>Ayo,OctetStreamRequest:()=>_dn,OffsetPagination:()=>Tho,OneOfSchema:()=>eyo,OneOfSchemaWithExample:()=>Myo,OpenApiIntermediateRepresentation:()=>blp,OpenApiSource:()=>V_o,OptionalSchema:()=>Zho,OptionalSchemaWithExample:()=>Dyo,Pagination:()=>Pdn,PathParameter:()=>ddn,PathParameterExample:()=>Pho,PathParameterWithExample:()=>ayo,PrimitiveExample:()=>ldn,PrimitiveSchema:()=>Qei,PrimitiveSchemaValue:()=>$ho,PrimitiveSchemaValueWithExample:()=>myo,PrimitiveSchemaWithExample:()=>qdn,PropertyKey:()=>cdn,ProtobufEncoding:()=>$_o,ProtobufSource:()=>W_o,QueryParameter:()=>pdn,QueryParameterExample:()=>gdn,QueryParameterWithExample:()=>Adn,QuerySecurityScheme:()=>k_o,ReferencedSchema:()=>fQt,Request:()=>vho,RequestWithExample:()=>uyo,Response:()=>bho,ResponseWithExample:()=>syo,Schema:()=>sO,SchemaId:()=>yK,SchemaWithExample:()=>QE,Schemas:()=>Nho,SdkGroup:()=>rho,SdkGroupInfo:()=>lho,SdkGroupName:()=>Hei,SecurityScheme:()=>nho,SecuritySchemeId:()=>K_o,Server:()=>IZn,Source:()=>H_o,StatusCode:()=>uQt,StreamingResponseExample:()=>jho,StringSchema:()=>Who,StringSchemaWithExample:()=>yyo,SupportedSdkLanguage:()=>Dho,Tag:()=>J_o,TagId:()=>vK,Tags:()=>fho,TextResponse:()=>Gei,Uint64WithExample:()=>pyo,UintWithExample:()=>dyo,UnDiscriminatedOneOfSchema:()=>iyo,UnDiscriminatedOneOfSchemaWithExample:()=>Cyo,UnknownSchemaWithExample:()=>jyo,Webhook:()=>Bho,WebhookExampleCall:()=>wdn,WebhookHttpMethod:()=>jdn,WebhookWithExample:()=>mlp,WebsocketChannel:()=>Fho,WebsocketHandshake:()=>xho,WebsocketHandshakeWithExample:()=>glp,WebsocketMessageExample:()=>zho,WebsocketServer:()=>Iho,WebsocketSessionExample:()=>Rho,WithAvailability:()=>J_,WithDescription:()=>vf,WithEncoding:()=>Fte,WithInline:()=>AD,WithName:()=>Ib,WithNamespace:()=>cQt,WithSdkGroupName:()=>uO,WithSource:()=>$h,WithStatusCode:()=>sQt,WithTitle:()=>oO,commons:()=>vDs,example:()=>bDs,finalIr:()=>gDs,parseIr:()=>ODs});var vDs={};Ro(vDs,{BasicSecurityScheme:()=>Y_o,BearerSecurityScheme:()=>X_o,Encoding:()=>G_o,HeaderSecurityScheme:()=>Z_o,Namespace:()=>tho,NamespaceId:()=>aho,OauthSecurityScheme:()=>iho,OpenApiSource:()=>V_o,ProtobufEncoding:()=>$_o,ProtobufSource:()=>W_o,QuerySecurityScheme:()=>k_o,SchemaId:()=>yK,SdkGroup:()=>rho,SdkGroupName:()=>Hei,SecurityScheme:()=>nho,SecuritySchemeId:()=>K_o,Server:()=>IZn,Source:()=>H_o,StatusCode:()=>uQt,Tag:()=>J_o,TagId:()=>vK,WithAvailability:()=>J_,WithDescription:()=>vf,WithEncoding:()=>Fte,WithInline:()=>AD,WithName:()=>Ib,WithNamespace:()=>cQt,WithSdkGroupName:()=>uO,WithSource:()=>$h,WithStatusCode:()=>sQt,WithTitle:()=>oO});var Mt={};Ro(Mt,{JsonError:()=>adn,ParseError:()=>odn,any:()=>alp,bigint:()=>Gcp,boolean:()=>olp,booleanLiteral:()=>nlp,date:()=>Qcp,discriminant:()=>hlp,enum_:()=>N_o,getObjectLikeUtils:()=>H2t,getObjectUtils:()=>gSi,getSchemaUtils:()=>oM,isProperty:()=>Vei,lazy:()=>Jcp,lazyObject:()=>tlp,list:()=>U_o,number:()=>ulp,object:()=>L_o,objectWithoutOptionalProperties:()=>elp,optional:()=>pDs,property:()=>Ycp,record:()=>flp,set:()=>dlp,string:()=>slp,stringLiteral:()=>ilp,transform:()=>_Ds,undiscriminatedUnion:()=>_lp,union:()=>vlp,unknown:()=>clp,withParsedProperties:()=>yDs});var OP={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function GE(e,t){return`Expected ${t}. Received ${k1S(e)}.`}function k1S(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 e8(e){return{...e,json:$cp(e.json),parse:$cp(e.parse)}}function $cp(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(`
|