fern-api 0.45.0-rc6 → 0.45.0-rc8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +3 -2
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";var $_O=Object.create;var xUi=Object.defineProperty;var Y_O=Object.getOwnPropertyDescriptor;var X_O=Object.getOwnPropertyNames;var Q_O=Object.getPrototypeOf,Z_O=Object.prototype.hasOwnProperty;var ap=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),td=(e,t)=>{for(var r in t)xUi(e,r,{get:t[r],enumerable:!0})},mqc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X_O(t))!Z_O.call(e,i)&&i!==r&&xUi(e,i,{get:()=>t[i],enumerable:!(n=Y_O(t,i))||n.enumerable});return e};var iu=(e,t,r)=>(r=e!=null?$_O(Q_O(e)):{},mqc(t||!e||!e.__esModule?xUi(r,"default",{value:e,enumerable:!0}):r,e)),RMe=e=>mqc(xUi({},"__esModule",{value:!0}),e);var Pai=p(p6r=>{"use strict";p6r.removeLeadingAndTrailingHTTPWhitespace=e=>e.replace(/^[ \t\n\r]+/u,"").replace(/[ \t\n\r]+$/u,"");p6r.removeTrailingHTTPWhitespace=e=>e.replace(/[ \t\n\r]+$/u,"");p6r.isHTTPWhitespaceChar=e=>e===" "||e===" "||e===`
2
3
  `||e==="\r";p6r.solelyContainsHTTPTokenCodePoints=e=>/^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u.test(e);p6r.soleyContainsHTTPQuotedStringTokenCodePoints=e=>/^[\t\u0020-\u007E\u0080-\u00FF]*$/u.test(e);p6r.asciiLowercase=e=>e.replace(/[A-Z]/ug,t=>t.toLowerCase());p6r.collectAnHTTPQuotedString=(e,t)=>{let r="";for(t++;;){for(;t<e.length&&e[t]!=='"'&&e[t]!=="\\";)r+=e[t],++t;if(t>=e.length)break;let n=e[t];if(++t,n==="\\"){if(t>=e.length){r+="\\";break}r+=e[t],++t}else break}return[r,t]}});var Pqc=p((hHC,Oqc)=>{"use strict";var{asciiLowercase:TUi,solelyContainsHTTPTokenCodePoints:phO,soleyContainsHTTPQuotedStringTokenCodePoints:_hO}=Pai();Oqc.exports=class{constructor(t){this._map=t}get size(){return this._map.size}get(t){return t=TUi(String(t)),this._map.get(t)}has(t){return t=TUi(String(t)),this._map.has(t)}set(t,r){if(t=TUi(String(t)),r=String(r),!phO(t))throw new Error(`Invalid MIME type parameter name "${t}": only HTTP token code points are valid.`);if(!_hO(r))throw new Error(`Invalid MIME type parameter value "${r}": only HTTP quoted-string token code points are valid.`);return this._map.set(t,r)}clear(){this._map.clear()}delete(t){return t=TUi(String(t)),this._map.delete(t)}forEach(t,r){this._map.forEach(t,r)}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}}});var Dqc=p((yHC,wqc)=>{"use strict";var{removeLeadingAndTrailingHTTPWhitespace:hhO,removeTrailingHTTPWhitespace:jqc,isHTTPWhitespaceChar:yhO,solelyContainsHTTPTokenCodePoints:O5o,soleyContainsHTTPQuotedStringTokenCodePoints:vhO,asciiLowercase:P5o,collectAnHTTPQuotedString:bhO}=Pai();wqc.exports=e=>{e=hhO(e);let t=0,r="";for(;t<e.length&&e[t]!=="/";)r+=e[t],++t;if(r.length===0||!O5o(r)||t>=e.length)return null;++t;let n="";for(;t<e.length&&e[t]!==";";)n+=e[t],++t;if(n=jqc(n),n.length===0||!O5o(n))return null;let i={type:P5o(r),subtype:P5o(n),parameters:new Map};for(;t<e.length;){for(++t;yhO(e[t]);)++t;let a="";for(;t<e.length&&e[t]!==";"&&e[t]!=="=";)a+=e[t],++t;if(a=P5o(a),t<e.length){if(e[t]===";")continue;++t}let u=null;if(e[t]==='"')for([u,t]=bhO(e,t);t<e.length&&e[t]!==";";)++t;else{for(u="";t<e.length&&e[t]!==";";)u+=e[t],++t;if(u=jqc(u),u==="")continue}a.length>0&&O5o(a)&&vhO(u)&&!i.parameters.has(a)&&i.parameters.set(a,u)}return i}});var Eqc=p((vHC,Sqc)=>{"use strict";var{solelyContainsHTTPTokenCodePoints:ghO}=Pai();Sqc.exports=e=>{let t=`${e.type}/${e.subtype}`;if(e.parameters.size===0)return t;for(let[r,n]of e.parameters)t+=";",t+=r,t+="=",(!ghO(n)||n.length===0)&&(n=n.replace(/(["\\])/ug,"\\$1"),n=`"${n}"`),t+=n;return t}});var qqc=p((gHC,Tqc)=>{"use strict";var mhO=Pqc(),OhO=Dqc(),PhO=Eqc(),{asciiLowercase:Mqc,solelyContainsHTTPTokenCodePoints:xqc}=Pai();Tqc.exports=class{constructor(t){t=String(t);let r=OhO(t);if(r===null)throw new Error(`Could not parse MIME type string "${t}"`);this._type=r.type,this._subtype=r.subtype,this._parameters=new mhO(r.parameters)}static parse(t){try{return new this(t)}catch{return null}}get essence(){return`${this.type}/${this.subtype}`}get type(){return this._type}set type(t){if(t=Mqc(String(t)),t.length===0)throw new Error("Invalid type: must be a non-empty string");if(!xqc(t))throw new Error(`Invalid type ${t}: must contain only HTTP token code points`);this._type=t}get subtype(){return this._subtype}set subtype(t){if(t=Mqc(String(t)),t.length===0)throw new Error("Invalid subtype: must be a non-empty string");if(!xqc(t))throw new Error(`Invalid subtype ${t}: must contain only HTTP token code points`);this._subtype=t}get parameters(){return this._parameters}toString(){return PhO(this)}isJavaScript({prohibitParameters:t=!1}={}){switch(this._type){case"text":switch(this._subtype){case"ecmascript":case"javascript":case"javascript1.0":case"javascript1.1":case"javascript1.2":case"javascript1.3":case"javascript1.4":case"javascript1.5":case"jscript":case"livescript":case"x-ecmascript":case"x-javascript":return!t||this._parameters.size===0;default:return!1}case"application":switch(this._subtype){case"ecmascript":case"javascript":case"x-ecmascript":case"x-javascript":return!t||this._parameters.size===0;default:return!1}default:return!1}}isXML(){return this._subtype==="xml"&&(this._type==="text"||this._type==="application")||this._subtype.endsWith("+xml")}isHTML(){return this._subtype==="html"&&this._type==="text"}}});var Z6c=p((sr6,Q6c)=>{"use strict";var uPO=["for","and","nor","but","or","yet","so"],sPO=["a","an","the"],cPO=["aboard","about","above","across","after","against","along","amid","among","anti","around","as","at","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","considering","despite","down","during","except","excepting","excluding","following","for","from","in","inside","into","like","minus","near","of","off","on","onto","opposite","over","past","per","plus","regarding","round","save","since","than","through","to","toward","towards","under","underneath","unlike","until","up","upon","versus","via","with","within","without"];Q6c.exports=new Set([...uPO,...sPO,...cPO])});var e7c=p((cr6,k6c)=>{"use strict";var lPO=["ZEIT","ZEIT Inc.","Vercel","Vercel Inc.","CLI","API","HTTP","HTTPS","JSX","DNS","URL","now.sh","now.json","vercel.app","vercel.json","CI","CD","CDN","package.json","package.lock","yarn.lock","GitHub","GitLab","CSS","Sass","JS","JavaScript","TypeScript","HTML","WordPress","Next.js","Node.js","Webpack","Docker","Bash","Kubernetes","SWR","TinaCMS","UI","UX","TS","TSX","iPhone","iPad","watchOS","iOS","iPadOS","macOS","PHP","composer.json","composer.lock","CMS","SQL","C","C#","GraphQL","GraphiQL","JWT","JWTs"];k6c.exports=lPO});var r7c=p((lr6,t7c)=>{"use strict";var fPO=Z6c(),dPO=e7c(),oVi=`[^\\s'\u2019\\(\\)!?;:"-]`,pPO=new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${oVi}))|(${oVi}))(${oVi}*[\u2019']*${oVi}*)`,"g"),_PO=e=>e.map(t=>[new RegExp(`\\b${t}\\b`,"gi"),t]);function hPO(e){let t=e[0];return/\s/.test(t)?e.slice(1):/[\(\)]/.test(t)?null:e}t7c.exports=(e,t={})=>{e=e.toLowerCase().replace(pPO,(a,u="",f,d,c,o,l)=>{let g=a.length+o>=l.length,O=hPO(a);if(!O)return a;if(!f){let j=d+c;if(fPO.has(j)&&!g)return O}return u+(d||f).toUpperCase()+c});let r=t.special||[],n=[...dPO,...r];return _PO(n).forEach(([a,u])=>{e=e.replace(a,u)}),e}});var $5o=p((Jr6,v7c)=>{"use strict";v7c.exports=h7c;function h7c(e,t,r){e instanceof RegExp&&(e=_7c(e,r)),t instanceof RegExp&&(t=_7c(t,r));var n=y7c(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function _7c(e,t){var r=t.match(e);return r?r[0]:null}h7c.range=y7c;function y7c(e,t,r){var n,i,a,u,f,d=r.indexOf(e),c=r.indexOf(t,d+1),o=d;if(d>=0&&c>0){if(e===t)return[d,c];for(n=[],a=r.length;o>=0&&!f;)o==d?(n.push(o),d=r.indexOf(e,o+1)):n.length==1?f=[n.pop(),c]:(i=n.pop(),i<a&&(a=i,u=c),c=r.indexOf(t,o+1)),o=d<c&&d>=0?d:c;n.length&&(f=[a,u])}return f}});var Q5o=p((Gr6,w7c)=>{"use strict";var b7c=$5o();w7c.exports=mPO;var g7c="\0SLASH"+Math.random()+"\0",m7c="\0OPEN"+Math.random()+"\0",X5o="\0CLOSE"+Math.random()+"\0",O7c="\0COMMA"+Math.random()+"\0",P7c="\0PERIOD"+Math.random()+"\0";function Y5o(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function bPO(e){return e.split("\\\\").join(g7c).split("\\{").join(m7c).split("\\}").join(X5o).split("\\,").join(O7c).split("\\.").join(P7c)}function gPO(e){return e.split(g7c).join("\\").split(m7c).join("{").split(X5o).join("}").split(O7c).join(",").split(P7c).join(".")}function j7c(e){if(!e)return[""];var t=[],r=b7c("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,u=n.split(",");u[u.length-1]+="{"+i+"}";var f=j7c(a);return a.length&&(u[u.length-1]+=f.shift(),u.push.apply(u,f)),t.push.apply(t,u),t}function mPO(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),Bai(bPO(e),!0).map(gPO)):[]}function OPO(e){return"{"+e+"}"}function PPO(e){return/^-?0\d/.test(e)}function jPO(e,t){return e<=t}function wPO(e,t){return e>=t}function Bai(e,t){var r=[],n=b7c("{","}",e);if(!n)return[e];var i=n.pre,a=n.post.length?Bai(n.post,!1):[""];if(/\$$/.test(n.pre))for(var u=0;u<a.length;u++){var f=i+"{"+n.body+"}"+a[u];r.push(f)}else{var d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),o=d||c,l=n.body.indexOf(",")>=0;if(!o&&!l)return n.post.match(/,.*\}/)?(e=n.pre+"{"+n.body+X5o+n.post,Bai(e)):[e];var g;if(o)g=n.body.split(/\.\./);else if(g=j7c(n.body),g.length===1&&(g=Bai(g[0],!1).map(OPO),g.length===1))return a.map(function(re){return n.pre+g[0]+re});var O;if(o){var j=Y5o(g[0]),S=Y5o(g[1]),T=Math.max(g[0].length,g[1].length),C=g.length==3?Math.abs(Y5o(g[2])):1,I=jPO,N=S<j;N&&(C*=-1,I=wPO);var A=g.some(PPO);O=[];for(var U=j;I(U,S);U+=C){var X;if(c)X=String.fromCharCode(U),X==="\\"&&(X="");else if(X=String(U),A){var ue=T-X.length;if(ue>0){var G=new Array(ue+1).join("0");U<0?X="-"+G+X.slice(1):X=G+X}}O.push(X)}}else{O=[];for(var $=0;$<g.length;$++)O.push.apply(O,Bai(g[$],!1))}for(var $=0;$<O.length;$++)for(var u=0;u<a.length;u++){var f=i+O[$]+a[u];(!t||o||f)&&r.push(f)}}return r}});var g4c=p(gIo=>{"use strict";var rYr=require("path"),C6r=process.platform==="win32",A6r=require("fs"),z1O=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function B1O(){var e;if(z1O){var t=new Error;e=r}else e=n;return e;function r(i){i&&(t.message=i.message,i=t,n(i))}function n(i){if(i){if(process.throwDeprecation)throw i;if(!process.noDeprecation){var a="fs: missing callback "+(i.stack||i.message);process.traceDeprecation?console.trace(a):console.error(a)}}}}function R1O(e){return typeof e=="function"?e:B1O()}var ci6=rYr.normalize;C6r?gjr=/(.*?)(?:[\/\\]+|$)/g:gjr=/(.*?)(?:[\/]+|$)/g;var gjr;C6r?kai=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:kai=/^[\/]*/;var kai;gIo.realpathSync=function(t,r){if(t=rYr.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return r[t];var n=t,i={},a={},u,f,d,c;o();function o(){var T=kai.exec(t);u=T[0].length,f=T[0],d=T[0],c="",C6r&&!a[d]&&(A6r.lstatSync(d),a[d]=!0)}for(;u<t.length;){gjr.lastIndex=u;var l=gjr.exec(t);if(c=f,f+=l[0],d=c+l[1],u=gjr.lastIndex,!(a[d]||r&&r[d]===d)){var g;if(r&&Object.prototype.hasOwnProperty.call(r,d))g=r[d];else{var O=A6r.lstatSync(d);if(!O.isSymbolicLink()){a[d]=!0,r&&(r[d]=d);continue}var j=null;if(!C6r){var S=O.dev.toString(32)+":"+O.ino.toString(32);i.hasOwnProperty(S)&&(j=i[S])}j===null&&(A6r.statSync(d),j=A6r.readlinkSync(d)),g=rYr.resolve(c,j),r&&(r[d]=g),C6r||(i[S]=j)}t=rYr.resolve(g,t.slice(u)),o()}}return r&&(r[n]=t),t};gIo.realpath=function(t,r,n){if(typeof n!="function"&&(n=R1O(r),r=null),t=rYr.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return process.nextTick(n.bind(null,null,r[t]));var i=t,a={},u={},f,d,c,o;l();function l(){var T=kai.exec(t);f=T[0].length,d=T[0],c=T[0],o="",C6r&&!u[c]?A6r.lstat(c,function(C){if(C)return n(C);u[c]=!0,g()}):process.nextTick(g)}function g(){if(f>=t.length)return r&&(r[i]=t),n(null,t);gjr.lastIndex=f;var T=gjr.exec(t);return o=d,d+=T[0],c=o+T[1],f=gjr.lastIndex,u[c]||r&&r[c]===c?process.nextTick(g):r&&Object.prototype.hasOwnProperty.call(r,c)?S(r[c]):A6r.lstat(c,O)}function O(T,C){if(T)return n(T);if(!C.isSymbolicLink())return u[c]=!0,r&&(r[c]=c),process.nextTick(g);if(!C6r){var I=C.dev.toString(32)+":"+C.ino.toString(32);if(a.hasOwnProperty(I))return j(null,a[I],c)}A6r.stat(c,function(N){if(N)return n(N);A6r.readlink(c,function(A,U){C6r||(a[I]=U),j(A,U)})})}function j(T,C,I){if(T)return n(T);var N=rYr.resolve(o,C);r&&(r[I]=N),S(N)}function S(T){t=rYr.resolve(T,t.slice(f)),l()}}});var jIo=p((fi6,j4c)=>{"use strict";j4c.exports=N6r;N6r.realpath=N6r;N6r.sync=PIo;N6r.realpathSync=PIo;N6r.monkeypatch=L1O;N6r.unmonkeypatch=U1O;var MEn=require("fs"),mIo=MEn.realpath,OIo=MEn.realpathSync,F1O=process.version,m4c=/^v[0-5]\./.test(F1O),O4c=g4c();function P4c(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function N6r(e,t,r){if(m4c)return mIo(e,t,r);typeof t=="function"&&(r=t,t=null),mIo(e,t,function(n,i){P4c(n)?O4c.realpath(e,t,r):r(n,i)})}function PIo(e,t){if(m4c)return OIo(e,t);try{return OIo(e,t)}catch(r){if(P4c(r))return O4c.realpathSync(e,t);throw r}}function L1O(){MEn.realpath=N6r,MEn.realpathSync=PIo}function U1O(){MEn.realpath=mIo,MEn.realpathSync=OIo}});var D4c=p((di6,w4c)=>{"use strict";w4c.exports=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=t(e[n],n);V1O(i)?r.push.apply(r,i):r.push(i)}return r};var V1O=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}});var C4c=p((pi6,A4c)=>{"use strict";var W1O=D4c(),S4c=$5o();A4c.exports=G1O;var E4c="\0SLASH"+Math.random()+"\0",M4c="\0OPEN"+Math.random()+"\0",DIo="\0CLOSE"+Math.random()+"\0",x4c="\0COMMA"+Math.random()+"\0",T4c="\0PERIOD"+Math.random()+"\0";function wIo(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function H1O(e){return e.split("\\\\").join(E4c).split("\\{").join(M4c).split("\\}").join(DIo).split("\\,").join(x4c).split("\\.").join(T4c)}function J1O(e){return e.split(E4c).join("\\").split(M4c).join("{").split(DIo).join("}").split(x4c).join(",").split(T4c).join(".")}function q4c(e){if(!e)return[""];var t=[],r=S4c("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,u=n.split(",");u[u.length-1]+="{"+i+"}";var f=q4c(a);return a.length&&(u[u.length-1]+=f.shift(),u.push.apply(u,f)),t.push.apply(t,u),t}function G1O(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),xEn(H1O(e),!0).map(J1O)):[]}function K1O(e){return"{"+e+"}"}function $1O(e){return/^-?0\d/.test(e)}function Y1O(e,t){return e<=t}function X1O(e,t){return e>=t}function xEn(e,t){var r=[],n=S4c("{","}",e);if(!n||/\$$/.test(n.pre))return[e];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),u=i||a,f=n.body.indexOf(",")>=0;if(!u&&!f)return n.post.match(/,.*\}/)?(e=n.pre+"{"+n.body+DIo+n.post,xEn(e)):[e];var d;if(u)d=n.body.split(/\.\./);else if(d=q4c(n.body),d.length===1&&(d=xEn(d[0],!1).map(K1O),d.length===1)){var o=n.post.length?xEn(n.post,!1):[""];return o.map(function(et){return n.pre+d[0]+et})}var c=n.pre,o=n.post.length?xEn(n.post,!1):[""],l;if(u){var g=wIo(d[0]),O=wIo(d[1]),j=Math.max(d[0].length,d[1].length),S=d.length==3?Math.abs(wIo(d[2])):1,T=Y1O,C=O<g;C&&(S*=-1,T=X1O);var I=d.some($1O);l=[];for(var N=g;T(N,O);N+=S){var A;if(a)A=String.fromCharCode(N),A==="\\"&&(A="");else if(A=String(N),I){var U=j-A.length;if(U>0){var X=new Array(U+1).join("0");N<0?A="-"+X+A.slice(1):A=X+A}}l.push(A)}}else l=W1O(d,function(re){return xEn(re,!1)});for(var ue=0;ue<l.length;ue++)for(var G=0;G<o.length;G++){var $=c+l[ue]+o[G];(!t||u||$)&&r.push($)}return r}});var BVi=p((_i6,R4c)=>{"use strict";R4c.exports=q1e;q1e.Minimatch=CV;var eoi=function(){try{return require("path")}catch{}}()||{sep:"/"};q1e.sep=eoi.sep;var MIo=q1e.GLOBSTAR=CV.GLOBSTAR={},Q1O=C4c(),N4c={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},SIo="[^/]",EIo=SIo+"*?",Z1O="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",k1O="(?:(?!(?:\\/|^)\\.).)*?",I4c=ejO("().*{}+?[]^$\\!");function ejO(e){return e.split("").reduce(function(t,r){return t[r]=!0,t},{})}var z4c=/\/+/;q1e.filter=tjO;function tjO(e,t){return t=t||{},function(r,n,i){return q1e(r,e,t)}}function I6r(e,t){t=t||{};var r={};return Object.keys(e).forEach(function(n){r[n]=e[n]}),Object.keys(t).forEach(function(n){r[n]=t[n]}),r}q1e.defaults=function(e){if(!e||typeof e!="object"||!Object.keys(e).length)return q1e;var t=q1e,r=function(i,a,u){return t(i,a,I6r(e,u))};return r.Minimatch=function(i,a){return new t.Minimatch(i,I6r(e,a))},r.Minimatch.defaults=function(i){return t.defaults(I6r(e,i)).Minimatch},r.filter=function(i,a){return t.filter(i,I6r(e,a))},r.defaults=function(i){return t.defaults(I6r(e,i))},r.makeRe=function(i,a){return t.makeRe(i,I6r(e,a))},r.braceExpand=function(i,a){return t.braceExpand(i,I6r(e,a))},r.match=function(n,i,a){return t.match(n,i,I6r(e,a))},r};CV.defaults=function(e){return q1e.defaults(e).Minimatch};function q1e(e,t,r){return zVi(t),r||(r={}),!r.nocomment&&t.charAt(0)==="#"?!1:new CV(t,r).match(e)}function CV(e,t){if(!(this instanceof CV))return new CV(e,t);zVi(e),t||(t={}),e=e.trim(),!t.allowWindowsEscape&&eoi.sep!=="/"&&(e=e.split(eoi.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}CV.prototype.debug=function(){};CV.prototype.make=rjO;function rjO(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,r),r=this.globParts=r.map(function(n){return n.split(z4c)}),this.debug(this.pattern,r),r=r.map(function(n,i,a){return n.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(n){return n.indexOf(!1)===-1}),this.debug(this.pattern,r),this.set=r}CV.prototype.parseNegate=njO;function njO(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=e.length;i<a&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}}q1e.braceExpand=function(e,t){return B4c(e,t)};CV.prototype.braceExpand=B4c;function B4c(e,t){return t||(this instanceof CV?t=this.options:t={}),e=typeof e>"u"?this.pattern:e,zVi(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Q1O(e)}var ijO=1024*64,zVi=function(e){if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>ijO)throw new TypeError("pattern is too long")};CV.prototype.parse=ajO;var IVi={};function ajO(e,t){zVi(e);var r=this.options;if(e==="**")if(r.noglobstar)e="*";else return MIo;if(e==="")return"";var n="",i=!!r.nocase,a=!1,u=[],f=[],d,c=!1,o=-1,l=-1,g=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",O=this;function j(){if(d){switch(d){case"*":n+=EIo,i=!0;break;case"?":n+=SIo,i=!0;break;default:n+="\\"+d;break}O.debug("clearStateChar %j %j",d,n),d=!1}}for(var S=0,T=e.length,C;S<T&&(C=e.charAt(S));S++){if(this.debug("%s %s %s %j",e,S,n,C),a&&I4c[C]){n+="\\"+C,a=!1;continue}switch(C){case"/":return!1;case"\\":j(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,S,n,C),c){this.debug(" in class"),C==="!"&&S===l+1&&(C="^"),n+=C;continue}O.debug("call clearStateChar %j",d),j(),d=C,r.noext&&j();continue;case"(":if(c){n+="(";continue}if(!d){n+="\\(";continue}u.push({type:d,start:S-1,reStart:n.length,open:N4c[d].open,close:N4c[d].close}),n+=d==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",d,n),d=!1;continue;case")":if(c||!u.length){n+="\\)";continue}j(),i=!0;var I=u.pop();n+=I.close,I.type==="!"&&f.push(I),I.reEnd=n.length;continue;case"|":if(c||!u.length||a){n+="\\|",a=!1;continue}j(),n+="|";continue;case"[":if(j(),c){n+="\\"+C;continue}c=!0,l=S,o=n.length,n+=C;continue;case"]":if(S===l+1||!c){n+="\\"+C,a=!1;continue}var N=e.substring(l+1,S);try{RegExp("["+N+"]")}catch{var A=this.parse(N,IVi);n=n.substr(0,o)+"\\["+A[0]+"\\]",i=i||A[1],c=!1;continue}i=!0,c=!1,n+=C;continue;default:j(),a?a=!1:I4c[C]&&!(C==="^"&&c)&&(n+="\\"),n+=C}}for(c&&(N=e.substr(l+1),A=this.parse(N,IVi),n=n.substr(0,o)+"\\["+A[0],i=i||A[1]),I=u.pop();I;I=u.pop()){var U=n.slice(I.reStart+I.open.length);this.debug("setting tail",n,I),U=U.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Nt,lr,Hr){return Hr||(Hr="\\"),lr+lr+Hr+"|"}),this.debug(`tail=%j
3
4
  %s`,U,U,I,n);var X=I.type==="*"?EIo:I.type==="?"?SIo:"\\"+I.type;i=!0,n=n.slice(0,I.reStart)+X+"\\("+U}j(),a&&(n+="\\\\");var ue=!1;switch(n.charAt(0)){case"[":case".":case"(":ue=!0}for(var G=f.length-1;G>-1;G--){var $=f[G],re=n.slice(0,$.reStart),et=n.slice($.reStart,$.reEnd-8),Ve=n.slice($.reEnd-8,$.reEnd),Dt=n.slice($.reEnd);Ve+=Dt;var At=re.split("(").length-1,Wt=Dt;for(S=0;S<At;S++)Wt=Wt.replace(/\)[+*?]?/,"");Dt=Wt;var It="";Dt===""&&t!==IVi&&(It="$");var ur=re+et+Dt+It+Ve;n=ur}if(n!==""&&i&&(n="(?=.)"+n),ue&&(n=g+n),t===IVi)return[n,i];if(!i)return ujO(e);var jr=r.nocase?"i":"";try{var Vr=new RegExp("^"+n+"$",jr)}catch{return new RegExp("$.")}return Vr._glob=e,Vr._src=n,Vr}q1e.makeRe=function(e,t){return new CV(e,t||{}).makeRe()};CV.prototype.makeRe=ojO;function ojO(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?EIo:t.dot?Z1O:k1O,n=t.nocase?"i":"",i=e.map(function(a){return a.map(function(u){return u===MIo?r:typeof u=="string"?sjO(u):u._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch{this.regexp=!1}return this.regexp}q1e.match=function(e,t,r){r=r||{};var n=new CV(t,r);return e=e.filter(function(i){return n.match(i)}),n.options.nonull&&!e.length&&e.push(t),e};CV.prototype.match=function(t,r){if(typeof r>"u"&&(r=this.partial),this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;var n=this.options;eoi.sep!=="/"&&(t=t.split(eoi.sep).join("/")),t=t.split(z4c),this.debug(this.pattern,"split",t);var i=this.set;this.debug(this.pattern,"set",i);var a,u;for(u=t.length-1;u>=0&&(a=t[u],!a);u--);for(u=0;u<i.length;u++){var f=i[u],d=t;n.matchBase&&f.length===1&&(d=[a]);var c=this.matchOne(d,f,r);if(c)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate};CV.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,u=e.length,f=t.length;i<u&&a<f;i++,a++){this.debug("matchOne loop");var d=t[a],c=e[i];if(this.debug(t,d,c),d===!1)return!1;if(d===MIo){this.debug("GLOBSTAR",[t,d,c]);var o=i,l=a+1;if(l===f){for(this.debug("** at the end");i<u;i++)if(e[i]==="."||e[i]===".."||!n.dot&&e[i].charAt(0)===".")return!1;return!0}for(;o<u;){var g=e[o];if(this.debug(`
@@ -1757,7 +1758,7 @@ ${l.indent}`:""}${h4c(o)}:${f.indent?" ":""}`;return u=!1,c=!0,f.objectItem=void
1757
1758
  `}),r.replaceAll(/\n$/g,"")}function HHP(e){return e?rl.green(O3r.radioOn):O3r.radioOff}var usa=iu(lje(),1);function dYl(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var wli=class extends PR{_run(t){this.done=t;let r=pW(this.rl),n=r.line.pipe((0,usa.map)(this.filterInput.bind(this))),i=this.handleSubmitEvents(n);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,usa.takeUntil)(i.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),n="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(n=`
1758
1759
  `+rl.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?rl.cyan(dYl(t,this.opt.mask)):rl.italic.dim("[hidden]"):this.opt.mask?dYl(t,this.opt.mask):rl.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 RXl=iu(BXl(),1),FXl=iu(lje(),1);var Nli=class extends PR{_run(t){this.done=t,this.editorResult=new FXl.Subject;let r=pW(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?rl.dim("Received"):rl.dim("Press <enter> to launch your preferred editor."),t&&(r=rl.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),(0,RXl.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 KXl=iu(VXl(),1);var JXl=iu(require("readline"),1),GXl=iu(HXl(),1),nZr=class{constructor(t){this.rl||=JXl.default.createInterface(NJP(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 NJP(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new GXl.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var Ili=class extends nZr{constructor(t={}){super(t),this.log=(0,KXl.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return yli(this.rl,this.bottomBar.split(`
1759
1760
  `).length),this}updateBottomBar(t){return yli(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+`
1760
- `}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&&nsa(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var nQl=iu(XXl(),1),iQl=iu(jQo(),1),aQl=iu(tQl(),1),fq=iu(lje(),1),oQl=iu(wci(),1);var Esa=iu(lje(),1),rQl=iu(wci(),1),Msa=function(e,t,r){return typeof e[t]!="function"?(0,Esa.of)(e):(0,Esa.from)((0,rQl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var zli={isPlainObject:nQl.default,set:aQl.default,get:iQl.default},gAn=class extends nZr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=zli.isPlainObject(r)?{...r}:{},zli.isPlainObject(t)&&(t=Object.values(t).every(i=>zli.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,fq.from)(t):t;return this.process=n.pipe((0,fq.concatMap)(this.processQuestion.bind(this)),(0,fq.publish)()),this.process.connect(),this.process.pipe((0,fq.reduce)((i,a)=>(zli.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,fq.defer)(()=>(0,fq.of)(t).pipe((0,fq.concatMap)(this.setDefaultType.bind(this)),(0,fq.concatMap)(this.filterIfRunnable.bind(this)),(0,fq.concatMap)(()=>Msa(t,"message",this.answers)),(0,fq.concatMap)(()=>Msa(t,"default",this.answers)),(0,fq.concatMap)(()=>Msa(t,"choices",this.answers)),(0,fq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,fq.defer)(()=>(0,fq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,fq.defer)(()=>(0,fq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&zli.get(this.answers,t.name)!==void 0)return(0,fq.empty)();if(t.when===!1)return(0,fq.empty)();if(typeof t.when!="function")return(0,fq.of)(t);let{answers:r}=this;return(0,fq.defer)(()=>(0,fq.from)((0,oQl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,fq.filter)(n=>n!=null)))}};function uQl(e){let t=function(r,n){let i;try{i=new gAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",bli),this.registerPrompt("input",XQr),this.registerPrompt("number",gli),this.registerPrompt("confirm",mli),this.registerPrompt("rawlist",Oli),this.registerPrompt("expand",Pli),this.registerPrompt("checkbox",jli),this.registerPrompt("password",wli),this.registerPrompt("editor",Nli)},t.restoreDefaultPrompts(),t}var mko=uQl();function ZJP(e,t){mko.registerPrompt(e,t)}function kJP(){mko.restoreDefaultPrompts()}var eGP={prompt:mko,ui:{BottomBar:Ili,Prompt:gAn},createPromptModule:uQl,registerPrompt:ZJP,restoreDefaultPrompts:kJP,Separator:one},xsa=eGP;var yQl=iu(sQl()),vQl=iu(NJo()),Pko=function(e,t){return Pko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Pko(e,t)};function mAn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Pko(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Bg=function(){return Bg=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Bg.apply(this,arguments)};function tGP(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function B2(e,t,r,n){function i(a){return a instanceof r?a:new r(function(u){u(a)})}return new(r||(r=Promise))(function(a,u){function f(o){try{c(n.next(o))}catch(l){u(l)}}function d(o){try{c(n.throw(o))}catch(l){u(l)}}function c(o){o.done?a(o.value):i(o.value).then(f,d)}c((n=n.apply(e,t||[])).next())})}function R2(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(c){return function(o){return d([c,o])}}function d(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(o){c=[6,o],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function bQl(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var jko="3.1.2",Y1;(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"})(Y1||(Y1={}));function rGP(e,t){if(!e)throw new Error(t)}function nGP(e){return e?.replace(/\/+$/,"")}function iGP(e,t){return t===void 0&&(t={}),B2(this,void 0,void 0,function(){var r,n,i,a,u,f,d,c,o,l;return R2(this,function(g){switch(g.label){case 0:r=t.retryCount,n=r===void 0?3:r,i=t.retryDelay,a=i===void 0?5e3:i,u=t.retryCheck,f=u===void 0?function(){return!0}:u,d=null,c=0,g.label=1;case 1:return c<n+1?c>0?[4,new Promise(function(O){return setTimeout(O,a)})]:[3,3]:[3,7];case 2:g.sent(),g.label=3;case 3:return g.trys.push([3,5,,6]),[4,e()];case 4:return o=g.sent(),[2,o];case 5:if(l=g.sent(),d=l,!f(l))throw l;return[3,6];case 6:return c++,[3,1];case 7:throw d}})})}function wko(e){var t=new Date().getTime(),r=e&&e.performance&&e.performance.now&&e.performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var i=Math.random()*16;return t>0?(i=(t+i)%16|0,t=Math.floor(t/16)):(i=(r+i)%16|0,r=Math.floor(r/16)),(n==="x"?i:i&3|8).toString(16)})}function aGP(){return new Date().getTime()}function cQl(){return new Date().toISOString()}function gQl(e,t){var r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Rli=String.fromCharCode,lQl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Tsa={};function oGP(e,t){if(!Tsa[e]){Tsa[e]={};for(var r=0;r<e.length;r++)Tsa[e][e.charAt(r)]=r}return Tsa[e][t]}var Fli={compressToBase64:function(e){if(e==null)return"";var t=Fli._compress(e,6,function(r){return lQl.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:Fli._decompress(e.length,32,function(t){return oGP(lQl,e.charAt(t))})},compress:function(e){return Fli._compress(e,16,function(t){return Rli(t)})},_compress:function(e,t,r){if(e==null)return"";var n={},i={},a=[],u,f,d="",c="",o="",l=2,g=3,O=2,j=0,S=0,T;for(T=0;T<e.length;T+=1)if(d=e.charAt(T),Object.prototype.hasOwnProperty.call(n,d)||(n[d]=g++,i[d]=!0),c=o+d,Object.prototype.hasOwnProperty.call(n,c))o=c;else{if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<O;u++)j=j<<1,S==t-1?(S=0,a.push(r(j)),j=0):S++;for(f=o.charCodeAt(0),u=0;u<8;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}else{for(f=1,u=0;u<O;u++)j=j<<1|f,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=0;for(f=o.charCodeAt(0),u=0;u<16;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[o]}else for(f=n[o],u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;l--,l==0&&(l=Math.pow(2,O),O++),n[c]=g++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<O;u++)j=j<<1,S==t-1?(S=0,a.push(r(j)),j=0):S++;for(f=o.charCodeAt(0),u=0;u<8;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}else{for(f=1,u=0;u<O;u++)j=j<<1|f,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=0;for(f=o.charCodeAt(0),u=0;u<16;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[o]}else for(f=n[o],u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;l--,l==0&&(l=Math.pow(2,O),O++)}for(f=2,u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;for(;;)if(j=j<<1,S==t-1){a.push(r(j));break}else S++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:Fli._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){var n=[],i=[],a={val:r(0),position:t,index:1},u=4,f=4,d=3,c="",o,l,g,O,j,S,T;for(o=0;o<3;o+=1)n[o]=o;for(g=0,j=Math.pow(2,2),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;switch(g){case 0:for(g=0,j=Math.pow(2,8),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;T=Rli(g);break;case 1:for(g=0,j=Math.pow(2,16),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;T=Rli(g);break;case 2:return""}for(n[3]=T,l=T,i.push(T);;){if(a.index>e)return"";for(g=0,j=Math.pow(2,d),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;switch(T=g){case 0:for(g=0,j=Math.pow(2,8),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;n[f++]=Rli(g),T=f-1,u--;break;case 1:for(g=0,j=Math.pow(2,16),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;n[f++]=Rli(g),T=f-1,u--;break;case 2:return i.join("")}if(u==0&&(u=Math.pow(2,d),d++),n[T])c=n[T];else if(T===f)c=l+l.charAt(0);else return null;i.push(c),n[f++]=l+c.charAt(0),u--,l=c,u==0&&(u=Math.pow(2,d),d++)}}},uGP=function(){function e(){this.events={},this.events={}}return e.prototype.on=function(t,r){var n=this;return this.events[t]||(this.events[t]=[]),this.events[t].push(r),function(){n.events[t]=n.events[t].filter(function(i){return i!==r})}},e.prototype.emit=function(t,r){for(var n=0,i=this.events[t]||[];n<i.length;n++){var a=i[n];a(r)}for(var u=0,f=this.events["*"]||[];u<f.length;u++){var a=f[u];a(t,r)}},e}(),sGP=function(e){mAn(t,e);function t(r){var n=e.call(this,"HTTP error while fetching PostHog: "+r.status)||this;return n.response=r,n.name="PostHogFetchHttpError",n}return t}(Error),cGP=function(e){mAn(t,e);function t(r){var n=e.call(this,"Network error while fetching PostHog",r instanceof Error?{cause:r}:{})||this;return n.error=r,n.name="PostHogFetchNetworkError",n}return t}(Error);function fQl(e){return typeof e=="object"&&(e.name==="PostHogFetchHttpError"||e.name==="PostHogFetchNetworkError")}var mQl=function(){function e(t,r){var n,i,a,u,f;this.debugMode=!1,this.pendingPromises={},this.disableGeoip=!0,this._events=new uGP,rGP(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=nGP(r?.host||"https://app.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.flushInterval=(n=r?.flushInterval)!==null&&n!==void 0?n:1e4,this.captureMode=r?.captureMode||"form",this._optoutOverride=r?.enable===!1,this._retryOptions={retryCount:(i=r?.fetchRetryCount)!==null&&i!==void 0?i:3,retryDelay:(a=r?.fetchRetryDelay)!==null&&a!==void 0?a:3e3,retryCheck:fQl},this.requestTimeout=(u=r?.requestTimeout)!==null&&u!==void 0?u:1e4,this.disableGeoip=(f=r?.disableGeoip)!==null&&f!==void 0?f:!0}return e.prototype.getCommonEventProperties=function(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}},Object.defineProperty(e.prototype,"optedOut",{get:function(){var t,r;return(r=(t=this.getPersistedProperty(Y1.OptedOut))!==null&&t!==void 0?t:this._optoutOverride)!==null&&r!==void 0?r:!1},enumerable:!1,configurable:!0}),e.prototype.optIn=function(){this.setPersistedProperty(Y1.OptedOut,!1)},e.prototype.optOut=function(){this.setPersistedProperty(Y1.OptedOut,!0)},e.prototype.on=function(t,r){return this._events.on(t,r)},e.prototype.debug=function(t){var r;t===void 0&&(t=!0),(r=this.removeDebugCallback)===null||r===void 0||r.call(this),this.debugMode=t,t&&(this.removeDebugCallback=this.on("*",function(n,i){return console.log("PostHog Debug",n,i)}))},e.prototype.buildPayload=function(t){return{distinct_id:t.distinct_id,event:t.event,properties:Bg(Bg({},t.properties||{}),this.getCommonEventProperties())}},e.prototype.identifyStateless=function(t,r,n){var i=Bg({},this.buildPayload({distinct_id:t,event:"$identify",properties:r}));return this.enqueue("identify",i,n),this},e.prototype.captureStateless=function(t,r,n,i){var a=this.buildPayload({distinct_id:t,event:r,properties:n});return this.enqueue("capture",a,i),this},e.prototype.aliasStateless=function(t,r,n,i){var a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:Bg(Bg({},n||{}),{distinct_id:r,alias:t})});return this.enqueue("alias",a,i),this},e.prototype.groupIdentifyStateless=function(t,r,n,i,a,u){var f=this.buildPayload({distinct_id:a||"$".concat(t,"_").concat(r),event:"$groupidentify",properties:Bg({$group_type:t,$group_key:r,$group_set:n||{}},u||{})});return this.enqueue("capture",f,i),this},e.prototype.getDecide=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var u,f;return R2(this,function(d){return u="".concat(this.host,"/decide/?v=3"),f={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Bg({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i},a))},[2,this.fetchWithRetry(u,f).then(function(c){return c.json()}).catch(function(c){console.error("Error fetching feature flags",c)})]})})},e.prototype.getFeatureFlagStateless=function(t,r,n,i,a,u){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var f,d;return R2(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagsStateless(r,n,i,a,u)];case 1:return f=c.sent(),f?(d=f[t],d===void 0&&(d=!1),[2,d]):[2,void 0]}})})},e.prototype.getFeatureFlagPayloadStateless=function(t,r,n,i,a,u){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var f,d;return R2(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagPayloadsStateless(r,n,i,a,u)];case 1:return f=c.sent(),f?(d=f[t],d===void 0?[2,null]:[2,this._parsePayload(d)]):[2,void 0]}})})},e.prototype.getFeatureFlagPayloadsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var u,f=this;return R2(this,function(d){switch(d.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a)];case 1:return u=d.sent().payloads,u?[2,Object.fromEntries(Object.entries(u).map(function(c){var o=c[0],l=c[1];return[o,f._parsePayload(l)]}))]:[2,u]}})})},e.prototype._parsePayload=function(t){try{return JSON.parse(t)}catch{return t}},e.prototype.getFeatureFlagsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){return R2(this,function(u){switch(u.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a)];case 1:return[2,u.sent().flags]}})})},e.prototype.getFeatureFlagsAndPayloadsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var u,f,d,c;return R2(this,function(o){switch(o.label){case 0:return u={},(a??this.disableGeoip)&&(u.geoip_disable=!0),[4,this.getDecide(t,r,n,i,u)];case 1:return f=o.sent(),d=f?.featureFlags,c=f?.featureFlagPayloads,[2,{flags:d,payloads:c}]}})})},e.prototype.enqueue=function(t,r,n){var i=this,a;if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.enable()");return}var u=Bg(Bg({},r),{type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:cQl()}),f=(a=n?.disableGeoip)!==null&&a!==void 0?a:this.disableGeoip;f&&(u.properties||(u.properties={}),u.properties.$geoip_disable=!0),u.distinctId&&(u.distinct_id=u.distinctId,delete u.distinctId);var d=this.getPersistedProperty(Y1.Queue)||[];d.push({message:u}),this.setPersistedProperty(Y1.Queue,d),this._events.emit(t,u),d.length>=this.flushAt&&this.flush(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=gQl(function(){return i.flush()},this.flushInterval))},e.prototype.flushAsync=function(){var t=this;return new Promise(function(r,n){t.flush(function(i,a){return i?n(i):r(a)})})},e.prototype.flush=function(t){var r=this;this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=null);var n=this.getPersistedProperty(Y1.Queue)||[];if(!n.length)return t?.();var i=n.splice(0,this.flushAt);this.setPersistedProperty(Y1.Queue,n);var a=i.map(function(O){return O.message}),u={api_key:this.apiKey,batch:a,sent_at:cQl()},f=wko(),d=function(O){O&&r._events.emit("error",O),t?.(O,a),delete r.pendingPromises[f],r._events.emit("flush",a)};this.getCustomUserAgent();var c=JSON.stringify(u),o=this.captureMode==="form"?"".concat(this.host,"/e/?ip=1&_=").concat(aGP(),"&v=").concat(this.getLibraryVersion()):"".concat(this.host,"/batch/"),l=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"data=".concat(encodeURIComponent(Fli.compressToBase64(c)),"&compression=lz64")}:{method:"POST",headers:{"Content-Type":"application/json"},body:c},g=this.fetchWithRetry(o,l);this.pendingPromises[f]=g,g.then(function(){return d()}).catch(function(O){d(O)})},e.prototype.fetchWithRetry=function(t,r,n){var i,a;return B2(this,void 0,void 0,function(){var u=this;return R2(this,function(f){switch(f.label){case 0:return(i=(a=AbortSignal).timeout)!==null&&i!==void 0||(a.timeout=function(c){var o=new AbortController;return setTimeout(function(){return o.abort()},c),o.signal}),[4,iGP(function(){return B2(u,void 0,void 0,function(){var d,c;return R2(this,function(o){switch(o.label){case 0:d=null,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.fetch(t,Bg({signal:AbortSignal.timeout(this.requestTimeout)},r))];case 2:return d=o.sent(),[3,4];case 3:throw c=o.sent(),new cGP(c);case 4:if(d.status<200||d.status>=400)throw new sGP(d);return[2,d]}})})},Bg(Bg({},this._retryOptions),n))];case 1:return[2,f.sent()]}})})},e.prototype.shutdownAsync=function(){return B2(this,void 0,void 0,function(){var t;return R2(this,function(r){switch(r.label){case 0:clearTimeout(this._flushTimer),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.flushAsync()];case 2:return r.sent(),[4,Promise.all(Object.values(this.pendingPromises).map(function(n){return n.catch(function(){})}))];case 3:return r.sent(),[3,5];case 4:if(t=r.sent(),!fQl(t))throw t;return console.error("Error while shutting down PostHog",t),[3,5];case 5:return[2]}})})},e.prototype.shutdown=function(){this.shutdownAsync()},e}();(function(e){mAn(t,e);function t(r,n){var i=this,a,u,f,d=(a=n?.disableGeoip)!==null&&a!==void 0?a:!1;return i=e.call(this,r,Bg(Bg({},n),{disableGeoip:d}))||this,i.flagCallReported={},i.sessionProps={},i.sendFeatureFlagEvent=(u=n?.sendFeatureFlagEvent)!==null&&u!==void 0?u:!0,i._sessionExpirationTimeSeconds=(f=n?.sessionExpirationTimeSeconds)!==null&&f!==void 0?f:1800,i}return t.prototype.setupBootstrap=function(r){var n,i,a,u;if(!((n=r?.bootstrap)===null||n===void 0)&&n.distinctId&&(!((i=r?.bootstrap)===null||i===void 0)&&i.isIdentifiedId?this.setPersistedProperty(Y1.DistinctId,r.bootstrap.distinctId):this.setPersistedProperty(Y1.AnonymousId,r.bootstrap.distinctId)),!((a=r?.bootstrap)===null||a===void 0)&&a.featureFlags){var f=Object.keys(((u=r.bootstrap)===null||u===void 0?void 0:u.featureFlags)||{}).filter(function(d){var c,o;return!!(!((o=(c=r.bootstrap)===null||c===void 0?void 0:c.featureFlags)===null||o===void 0)&&o[d])}).reduce(function(d,c){var o,l;return d[c]=((l=(o=r.bootstrap)===null||o===void 0?void 0:o.featureFlags)===null||l===void 0?void 0:l[c])||!1,d},{});this.setKnownFeatureFlags(f),r?.bootstrap.featureFlagPayloads&&this.setKnownFeatureFlagPayloads(r?.bootstrap.featureFlagPayloads)}},Object.defineProperty(t.prototype,"props",{get:function(){return this._props||(this._props=this.getPersistedProperty(Y1.Props)),this._props||{}},set:function(r){this._props=r},enumerable:!1,configurable:!0}),t.prototype.clearProps=function(){this.props=void 0,this.sessionProps={}},t.prototype.on=function(r,n){return this._events.on(r,n)},t.prototype.reset=function(r){var n=bQl([Y1.Queue],r||[],!0);this.clearProps();for(var i=0,a=Object.keys(Y1);i<a.length;i++){var u=a[i];n.includes(Y1[u])||this.setPersistedProperty(Y1[u],null)}},t.prototype.getCommonEventProperties=function(){var r=this.getFeatureFlags(),n={};if(r)for(var i=0,a=Object.entries(r);i<a.length;i++){var u=a[i],f=u[0],d=u[1];n["$feature/".concat(f)]=d}return Bg(Bg({$active_feature_flags:r?Object.keys(r):void 0},n),e.prototype.getCommonEventProperties.call(this))},t.prototype.enrichProperties=function(r){return Bg(Bg(Bg(Bg(Bg({},this.props),this.sessionProps),r||{}),this.getCommonEventProperties()),{$session_id:this.getSessionId()})},t.prototype.getSessionId=function(){var r=this.getPersistedProperty(Y1.SessionId),n=this.getPersistedProperty(Y1.SessionLastTimestamp)||0;return(!r||Date.now()-n>this._sessionExpirationTimeSeconds*1e3)&&(r=wko(globalThis),this.setPersistedProperty(Y1.SessionId,r)),this.setPersistedProperty(Y1.SessionLastTimestamp,Date.now()),r},t.prototype.resetSessionId=function(){this.setPersistedProperty(Y1.SessionId,null)},t.prototype.getAnonymousId=function(){var r=this.getPersistedProperty(Y1.AnonymousId);return r||(r=wko(globalThis),this.setPersistedProperty(Y1.AnonymousId,r)),r},t.prototype.getDistinctId=function(){return this.getPersistedProperty(Y1.DistinctId)||this.getAnonymousId()},t.prototype.unregister=function(r){delete this.props[r],this.setPersistedProperty(Y1.Props,this.props)},t.prototype.register=function(r){this.props=Bg(Bg({},this.props),r),this.setPersistedProperty(Y1.Props,this.props)},t.prototype.registerForSession=function(r){this.sessionProps=Bg(Bg({},this.sessionProps),r)},t.prototype.unregisterForSession=function(r){delete this.sessionProps[r]},t.prototype.identify=function(r,n,i){var a=this.getDistinctId();r=r||a,n?.$groups&&this.groups(n.$groups);var u=this.enrichProperties(Bg(Bg({},n),{$anon_distinct_id:this.getAnonymousId(),$set:n}));return r!==a&&(this.setPersistedProperty(Y1.AnonymousId,a),this.setPersistedProperty(Y1.DistinctId,r),this.reloadFeatureFlags()),e.prototype.identifyStateless.call(this,r,u,i),this},t.prototype.capture=function(r,n,i){var a=this.getDistinctId();n?.$groups&&this.groups(n.$groups);var u=this.enrichProperties(n);return e.prototype.captureStateless.call(this,a,r,u,i),this},t.prototype.alias=function(r){var n=this.getDistinctId(),i=this.enrichProperties({});return e.prototype.aliasStateless.call(this,r,n,i),this},t.prototype.autocapture=function(r,n,i,a){i===void 0&&(i={});var u=this.getDistinctId(),f={distinct_id:u,event:"$autocapture",properties:Bg(Bg({},this.enrichProperties(i)),{$event_type:r,$elements:n})};return this.enqueue("autocapture",f,a),this},t.prototype.groups=function(r){var n=this.props.$groups||{};return this.register({$groups:Bg(Bg({},n),r)}),Object.keys(r).find(function(i){return n[i]!==r[i]})&&this.reloadFeatureFlags(),this},t.prototype.group=function(r,n,i,a){var u;return this.groups((u={},u[r]=n,u)),i&&this.groupIdentify(r,n,i,a),this},t.prototype.groupIdentify=function(r,n,i,a){var u=this.getDistinctId(),f=this.enrichProperties({});return e.prototype.groupIdentifyStateless.call(this,r,n,i,a,u,f),this},t.prototype.personProperties=function(r){var n=this.getPersistedProperty(Y1.PersonProperties)||{};return this.setPersistedProperty(Y1.PersonProperties,Bg(Bg({},n),r)),this},t.prototype.groupProperties=function(r){var n=this.getPersistedProperty(Y1.GroupProperties)||{};return Object.keys(n).length!==0&&Object.keys(n).forEach(function(i){n[i]=Bg(Bg({},n[i]),r[i]),delete r[i]}),this.setPersistedProperty(Y1.GroupProperties,Bg(Bg({},n),r)),this},t.prototype.decideAsync=function(r){return r===void 0&&(r=!0),this._decideResponsePromise?this._decideResponsePromise:this._decideAsync(r)},t.prototype._decideAsync=function(r){return r===void 0&&(r=!0),B2(this,void 0,void 0,function(){var n,i,a,u,f,d=this;return R2(this,function(c){return n=this.getDistinctId(),i=this.props.$groups||{},a=this.getPersistedProperty(Y1.PersonProperties)||{},u=this.getPersistedProperty(Y1.GroupProperties)||{},f={$anon_distinct_id:r?this.getAnonymousId():void 0},this._decideResponsePromise=e.prototype.getDecide.call(this,n,i,a,u,f).then(function(o){if(o?.featureFlags){var l=o.featureFlags,g=o.featureFlagPayloads;if(o.errorsWhileComputingFlags){var O=d.getPersistedProperty(Y1.FeatureFlags),j=d.getPersistedProperty(Y1.FeatureFlagPayloads);l=Bg(Bg({},O),o.featureFlags),g=Bg(Bg({},j),o.featureFlagPayloads)}d.setKnownFeatureFlags(l),d.setKnownFeatureFlagPayloads(g)}return o}).finally(function(){d._decideResponsePromise=void 0}),[2,this._decideResponsePromise]})})},t.prototype.setKnownFeatureFlags=function(r){this.setPersistedProperty(Y1.FeatureFlags,r),this._events.emit("featureflags",r)},t.prototype.setKnownFeatureFlagPayloads=function(r){this.setPersistedProperty(Y1.FeatureFlagPayloads,r)},t.prototype.getFeatureFlag=function(r){var n=this.getFeatureFlags();if(n){var i=n[r];return i===void 0&&(i=!1),this.sendFeatureFlagEvent&&!this.flagCallReported[r]&&(this.flagCallReported[r]=!0,this.capture("$feature_flag_called",{$feature_flag:r,$feature_flag_response:i})),i}},t.prototype.getFeatureFlagPayload=function(r){var n=this.getFeatureFlagPayloads();if(n){var i=n[r];return i===void 0?null:this._parsePayload(i)}},t.prototype.getFeatureFlagPayloads=function(){var r=this,n=this.getPersistedProperty(Y1.FeatureFlagPayloads);return n&&Object.fromEntries(Object.entries(n).map(function(i){var a=i[0],u=i[1];return[a,r._parsePayload(u)]}))},t.prototype.getFeatureFlags=function(){var r=this.getPersistedProperty(Y1.FeatureFlags),n=this.getPersistedProperty(Y1.OverrideFeatureFlags);if(!n)return r;r=r||{};for(var i in n)n[i]?r[i]=n[i]:delete r[i];return r},t.prototype.getFeatureFlagsAndPayloads=function(){var r=this.getFeatureFlags(),n=this.getFeatureFlagPayloads();return{flags:r,payloads:n}},t.prototype.isFeatureEnabled=function(r){var n=this.getFeatureFlag(r);if(n!==void 0)return!!n},t.prototype.reloadFeatureFlags=function(r){this.decideAsync().then(function(n){r?.(void 0,n?.featureFlags)}).catch(function(n){r?.(n,void 0),r||console.log("[PostHog] Error reloading feature flags",n)})},t.prototype.reloadFeatureFlagsAsync=function(r){var n;return r===void 0&&(r=!0),B2(this,void 0,void 0,function(){return R2(this,function(i){switch(i.label){case 0:return[4,this.decideAsync(r)];case 1:return[2,(n=i.sent())===null||n===void 0?void 0:n.featureFlags]}})})},t.prototype.onFeatureFlags=function(r){var n=this;return this.on("featureflags",function(){return B2(n,void 0,void 0,function(){var i;return R2(this,function(a){return i=this.getFeatureFlags(),i&&r(i),[2]})})})},t.prototype.onFeatureFlag=function(r,n){var i=this;return this.on("featureflags",function(){return B2(i,void 0,void 0,function(){var a;return R2(this,function(u){return a=this.getFeatureFlag(r),a!==void 0&&n(a),[2]})})})},t.prototype.overrideFeatureFlag=function(r){return r===null?this.setPersistedProperty(Y1.OverrideFeatureFlags,null):this.setPersistedProperty(Y1.OverrideFeatureFlags,r)},t})(mQl);var lGP=function(){function e(){this._memoryStorage={}}return e.prototype.getProperty=function(t){return this._memoryStorage[t]},e.prototype.setProperty=function(t,r){this._memoryStorage[t]=r!==null?r:void 0},e}(),OQl=function(e,t){return B2(void 0,void 0,void 0,function(){var r;return R2(this,function(n){switch(n.label){case 0:return[4,vQl.default.request({url:e,headers:t.headers,method:t.method.toLowerCase(),data:t.body,signal:t.signal,validateStatus:function(){return!0}})];case 1:return r=n.sent(),[2,{status:r.status,text:function(){return B2(void 0,void 0,void 0,function(){return R2(this,function(i){return[2,r.data]})})},json:function(){return B2(void 0,void 0,void 0,function(){return R2(this,function(i){return[2,r.data]})})}}]}})})},fGP=1152921504606847e3,dQl=function(e){mAn(t,e);function t(r){var n=e.call(this)||this;return Error.captureStackTrace(n,n.constructor),n.name="ClientError",n.message=r,Object.setPrototypeOf(n,t.prototype),n}return t}(Error),vQ=function(e){mAn(t,e);function t(r){var n=e.call(this,r)||this;return n.name=n.constructor.name,Error.captureStackTrace(n,n.constructor),Object.setPrototypeOf(n,t.prototype),n}return t}(Error),dGP=function(){function e(t){var r=t.pollingInterval,n=t.personalApiKey,i=t.projectApiKey,a=t.timeout,u=t.host,f=tGP(t,["pollingInterval","personalApiKey","projectApiKey","timeout","host"]);this.debugMode=!1,this.pollingInterval=r,this.personalApiKey=n,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=a,this.projectApiKey=i,this.host=u,this.poller=void 0,this.fetch=f.fetch||OQl,this.loadFeatureFlags()}return e.prototype.debug=function(t){t===void 0&&(t=!0),this.debugMode=t},e.prototype.getFeatureFlag=function(t,r,n,i,a){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var u,f,d,c,o;return R2(this,function(l){switch(l.label){case 0:return[4,this.loadFeatureFlags()];case 1:if(l.sent(),u=void 0,f=void 0,!this.loadedSuccessfullyOnce)return[2,u];for(d=0,c=this.featureFlags;d<c.length;d++)if(o=c[d],t===o.key){f=o;break}if(f!==void 0)try{u=this.computeFlagLocally(f,r,n,i,a),this.debugMode&&console.debug("Successfully computed flag locally: ".concat(t," -> ").concat(u))}catch(g){g instanceof vQ?this.debugMode&&console.debug("InconclusiveMatchError when computing flag locally: ".concat(t,": ").concat(g)):g instanceof Error&&console.error("Error computing flag locally: ".concat(t,": ").concat(g))}return[2,u]}})})},e.prototype.computeFeatureFlagPayloadLocally=function(t,r){var n,i,a,u,f,d,c,o;return B2(this,void 0,void 0,function(){var l;return R2(this,function(g){switch(g.label){case 0:return[4,this.loadFeatureFlags()];case 1:return g.sent(),l=void 0,this.loadedSuccessfullyOnce?(typeof r=="boolean"?l=(u=(a=(i=(n=this.featureFlagsByKey)===null||n===void 0?void 0:n[t])===null||i===void 0?void 0:i.filters)===null||a===void 0?void 0:a.payloads)===null||u===void 0?void 0:u[r.toString()]:typeof r=="string"&&(l=(o=(c=(d=(f=this.featureFlagsByKey)===null||f===void 0?void 0:f[t])===null||d===void 0?void 0:d.filters)===null||c===void 0?void 0:c.payloads)===null||o===void 0?void 0:o[r]),l===void 0?[2,null]:[2,l]):[2,void 0]}})})},e.prototype.getAllFlagsAndPayloads=function(t,r,n,i){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var a,u,f,d=this;return R2(this,function(c){switch(c.label){case 0:return[4,this.loadFeatureFlags()];case 1:return c.sent(),a={},u={},f=this.featureFlags.length==0,this.featureFlags.map(function(o){return B2(d,void 0,void 0,function(){var l,g,O;return R2(this,function(j){switch(j.label){case 0:return j.trys.push([0,2,,3]),l=this.computeFlagLocally(o,t,r,n,i),a[o.key]=l,[4,this.computeFeatureFlagPayloadLocally(o.key,l)];case 1:return g=j.sent(),g&&(u[o.key]=g),[3,3];case 2:return O=j.sent(),O instanceof vQ||O instanceof Error&&console.error("Error computing flag locally: ".concat(o.key,": ").concat(O)),f=!0,[3,3];case 3:return[2]}})})}),[2,{response:a,payloads:u,fallbackToDecide:f}]}})})},e.prototype.computeFlagLocally=function(t,r,n,i,a){if(n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),t.ensure_experience_continuity)throw new vQ("Flag has experience continuity enabled");if(!t.active)return!1;var u=t.filters||{},f=u.aggregation_group_type_index;if(f!=null){var d=this.groupTypeMapping[String(f)];if(!d)throw console.warn("[FEATURE FLAGS] Unknown group type index ".concat(f," for feature flag ").concat(t.key)),new vQ("Flag has unknown group type index");if(!(d in n))return console.warn("[FEATURE FLAGS] Can't compute group feature flag: ".concat(t.key," without group names passed in")),!1;var c=a[d];return this.matchFeatureFlagProperties(t,n[d],c)}else return this.matchFeatureFlagProperties(t,r,i)},e.prototype.matchFeatureFlagProperties=function(t,r,n){for(var i,a=t.filters||{},u=a.groups||[],f=!1,d=void 0,c=bQl([],u,!0).sort(function(T,C){var I=!!T.variant,N=!!C.variant;return I&&N?0:I?-1:N?1:0}),o=function(T){try{if(l.isConditionMatch(t,r,T,n)){var C=T.variant,I=((i=a.multivariate)===null||i===void 0?void 0:i.variants)||[];return C&&I.some(function(N){return N.key===C})?d=C:d=l.getMatchingVariant(t,r)||!0,"break"}}catch(N){if(N instanceof vQ)f=!0;else throw N}},l=this,g=0,O=c;g<O.length;g++){var j=O[g],S=o(j);if(S==="break")break}if(d!==void 0)return d;if(f)throw new vQ("Can't determine if feature flag is enabled or not with given properties");return!1},e.prototype.isConditionMatch=function(t,r,n,i){var a=n.rollout_percentage;if((n.properties||[]).length>0){for(var u=0,f=n.properties;u<f.length;u++){var d=f[u],c=d.type,o=!1;if(c==="cohort"?o=jQl(d,i,this.cohorts):o=PQl(d,i),!o)return!1}if(a==null)return!0}return!(a!=null&&pQl(t.key,r)>a/100)},e.prototype.getMatchingVariant=function(t,r){var n=pQl(t.key,r,"variant"),i=this.variantLookupTable(t).find(function(a){return n>=a.valueMin&&n<a.valueMax});if(i)return i.key},e.prototype.variantLookupTable=function(t){var r,n=[],i=0,a=0,u=t.filters||{},f=((r=u.multivariate)===null||r===void 0?void 0:r.variants)||[];return f.forEach(function(d){a=i+d.rollout_percentage/100,n.push({valueMin:i,valueMax:a,key:d.key}),i=a}),n},e.prototype.loadFeatureFlags=function(t){return t===void 0&&(t=!1),B2(this,void 0,void 0,function(){return R2(this,function(r){switch(r.label){case 0:return!this.loadedSuccessfullyOnce||t?[4,this._loadFeatureFlags()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype._loadFeatureFlags=function(){return B2(this,void 0,void 0,function(){var t,r,n,i=this;return R2(this,function(a){switch(a.label){case 0:this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(function(){return i._loadFeatureFlags()},this.pollingInterval),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this._requestFeatureFlagDefinitions()];case 2:if(t=a.sent(),t&&t.status===401)throw new dQl("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");return t&&t.status!==200?[2]:[4,t.json()];case 3:return r=a.sent(),"flags"in r||console.error("Invalid response when getting feature flags: ".concat(JSON.stringify(r))),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce(function(u,f){return u[f.key]=f,u},{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0,[3,5];case 4:if(n=a.sent(),n instanceof dQl)throw n;return[3,5];case 5:return[2]}})})},e.prototype._requestFeatureFlagDefinitions=function(){return B2(this,void 0,void 0,function(){var t,r,n,i,a;return R2(this,function(u){switch(u.label){case 0:t="".concat(this.host,"/api/feature_flag/local_evaluation?token=").concat(this.projectApiKey,"&send_cohorts"),r={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(this.personalApiKey),"user-agent":"posthog-node/".concat(jko)}},n=null,this.timeout&&typeof this.timeout=="number"&&(i=new AbortController,n=gQl(function(){i.abort()},this.timeout),r.signal=i.signal),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.fetch(t,r)];case 2:return[2,u.sent()];case 3:throw a=u.sent(),a;case 4:return clearTimeout(n),[7];case 5:return[2]}})})},e.prototype.stopPoller=function(){clearTimeout(this.poller)},e}();function pQl(e,t,r){r===void 0&&(r="");var n=(0,yQl.createHash)();return n.update("".concat(e,".").concat(t).concat(r)),parseInt(n.digest("hex").slice(0,15),16)/fGP}function PQl(e,t){var r=e.key,n=e.value,i=e.operator||"exact";if(r in t){if(i==="is_not_set")throw new vQ("Operator is_not_set is not supported")}else throw new vQ("Property ".concat(r," not found in propertyValues"));var a=t[r];switch(i){case"exact":return Array.isArray(n)?n.indexOf(a)!==-1:n===a;case"is_not":return Array.isArray(n)?n.indexOf(a)===-1:n!==a;case"is_set":return r in t;case"icontains":return String(a).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(a).toLowerCase().includes(String(n).toLowerCase());case"regex":return _Ql(String(n))&&String(a).match(String(n))!==null;case"not_regex":return _Ql(String(n))&&String(a).match(String(n))===null;case"gt":return typeof a==typeof n&&a>n;case"gte":return typeof a==typeof n&&a>=n;case"lt":return typeof a==typeof n&&a<n;case"lte":return typeof a==typeof n&&a<=n;case"is_date_after":case"is_date_before":var u=hQl(n),f=hQl(a);return i==="is_date_before"?f<u:f>u;default:return console.error("Unknown operator: ".concat(i)),!1}}function jQl(e,t,r){var n=String(e.value);if(!(n in r))throw new vQ("can't match cohort without a given cohort property value");var i=r[n];return wQl(i,t,r)}function wQl(e,t,r){if(!e)return!0;var n=e.type,i=e.values;if(!i||i.length===0)return!0;var a=!1;if("values"in i[0]){for(var u=0,f=i;u<f.length;u++){var d=f[u];try{var c=wQl(d,t,r);if(n==="AND"){if(!c)return!1}else if(c)return!0}catch(O){if(O instanceof vQ)console.debug("Failed to compute property ".concat(d," locally: ").concat(O)),a=!0;else throw O}}if(a)throw new vQ("Can't match cohort without a given cohort property value");return n==="AND"}else{for(var o=0,l=i;o<l.length;o++){var d=l[o];try{var c=void 0;d.type==="cohort"?c=jQl(d,t,r):c=PQl(d,t);var g=d.negation||!1;if(n==="AND"){if(!c&&!g||c&&g)return!1}else if(c&&!g||!c&&g)return!0}catch(j){if(j instanceof vQ)console.debug("Failed to compute property ".concat(d," locally: ").concat(j)),a=!0;else throw j}}if(a)throw new vQ("can't match cohort without a given cohort property value");return n==="AND"}}function _Ql(e){try{return new RegExp(e),!0}catch{return!1}}function hQl(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){var t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new vQ("".concat(e," is in an invalid date format"))}else throw new vQ("The date provided ".concat(e," must be a string, number, or date object"))}var pGP=30*1e3,_GP=50*1e3,qsa=function(e){mAn(t,e);function t(r,n){n===void 0&&(n={});var i=this,a;return n.captureMode=n?.captureMode||"json",i=e.call(this,r,n)||this,i._memoryStorage=new lGP,i.options=n,n.personalApiKey&&(i.featureFlagsPoller=new dGP({pollingInterval:typeof n.featureFlagsPollingInterval=="number"?n.featureFlagsPollingInterval:pGP,personalApiKey:n.personalApiKey,projectApiKey:r,timeout:(a=n.requestTimeout)!==null&&a!==void 0?a:1e4,host:i.host,fetch:n.fetch})),i.distinctIdHasSentFlagCalls={},i.maxCacheSize=n.maxCacheSize||_GP,i}return t.prototype.getPersistedProperty=function(r){return this._memoryStorage.getProperty(r)},t.prototype.setPersistedProperty=function(r,n){return this._memoryStorage.setProperty(r,n)},t.prototype.fetch=function(r,n){return this.options.fetch?this.options.fetch(r,n):OQl(r,n)},t.prototype.getLibraryId=function(){return"posthog-node"},t.prototype.getLibraryVersion=function(){return jko},t.prototype.getCustomUserAgent=function(){return"posthog-node/".concat(jko)},t.prototype.enable=function(){return e.prototype.optIn.call(this)},t.prototype.disable=function(){return e.prototype.optOut.call(this)},t.prototype.debug=function(r){var n;r===void 0&&(r=!0),e.prototype.debug.call(this,r),(n=this.featureFlagsPoller)===null||n===void 0||n.debug(r)},t.prototype.capture=function(r){var n=this,i=r.distinctId,a=r.event,u=r.properties,f=r.groups,d=r.sendFeatureFlags,c=r.timestamp,o=r.disableGeoip,l=function(g){e.prototype.captureStateless.call(n,i,a,g,{timestamp:c,disableGeoip:o})};d?e.prototype.getFeatureFlagsStateless.call(this,i,f,void 0,void 0,o).then(function(g){var O={};if(g)for(var j=0,S=Object.entries(g);j<S.length;j++){var T=S[j],C=T[0],I=T[1];I!==!1&&(O["$feature/".concat(C)]=I)}var N=Object.keys(g||{}).filter(function(U){return g?.[U]!==!1}),A=Bg({$active_feature_flags:N||void 0},O);l(Bg(Bg(Bg({},u),{$groups:f}),A))}):l(Bg(Bg({},u),{$groups:f}))},t.prototype.identify=function(r){var n=r.distinctId,i=r.properties,a=r.disableGeoip,u=i?.$set||i;e.prototype.identifyStateless.call(this,n,{$set:u},{disableGeoip:a})},t.prototype.alias=function(r){e.prototype.aliasStateless.call(this,r.alias,r.distinctId,void 0,{disableGeoip:r.disableGeoip})},t.prototype.getFeatureFlag=function(r,n,i){var a;return B2(this,void 0,void 0,function(){var u,f,d,c,o,l,g,O,j,S,T,C;return R2(this,function(I){switch(I.label){case 0:return u=i||{},f=u.groups,d=u.personProperties,c=u.groupProperties,o=u.disableGeoip,l=i||{},g=l.onlyEvaluateLocally,O=l.sendFeatureFlagEvents,g==null&&(g=!1),O==null&&(O=!0),[4,(a=this.featureFlagsPoller)===null||a===void 0?void 0:a.getFeatureFlag(r,n,f,d,c)];case 1:return j=I.sent(),S=j!==void 0,!S&&!g?[4,e.prototype.getFeatureFlagStateless.call(this,r,n,f,d,c,o)]:[3,3];case 2:j=I.sent(),I.label=3;case 3:return T="".concat(r,"_").concat(j),O&&(!(n in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[n].includes(T))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[n])?this.distinctIdHasSentFlagCalls[n].push(T):this.distinctIdHasSentFlagCalls[n]=[T],this.capture({distinctId:n,event:"$feature_flag_called",properties:(C={$feature_flag:r,$feature_flag_response:j,locally_evaluated:S},C["$feature/".concat(r)]=j,C),groups:f,disableGeoip:o})),[2,j]}})})},t.prototype.getFeatureFlagPayload=function(r,n,i,a){var u;return B2(this,void 0,void 0,function(){var f,d,c,o,l,g,O,j,S;return R2(this,function(T){switch(T.label){case 0:return f=a||{},d=f.groups,c=f.personProperties,o=f.groupProperties,l=f.disableGeoip,g=a||{},O=g.onlyEvaluateLocally,g.sendFeatureFlagEvents,j=void 0,i?[3,2]:[4,this.getFeatureFlag(r,n,Bg(Bg({},a),{onlyEvaluateLocally:!0}))];case 1:i=T.sent(),T.label=2;case 2:return i?[4,(u=this.featureFlagsPoller)===null||u===void 0?void 0:u.computeFeatureFlagPayloadLocally(r,i)]:[3,4];case 3:j=T.sent(),T.label=4;case 4:return O==null&&(O=!1),O==null&&(O=!1),S=j!==void 0,!S&&!O?[4,e.prototype.getFeatureFlagPayloadStateless.call(this,r,n,d,c,o,l)]:[3,6];case 5:j=T.sent(),T.label=6;case 6:try{return[2,JSON.parse(j)]}catch{return[2,j]}return[2]}})})},t.prototype.isFeatureEnabled=function(r,n,i){return B2(this,void 0,void 0,function(){var a;return R2(this,function(u){switch(u.label){case 0:return[4,this.getFeatureFlag(r,n,i)];case 1:return a=u.sent(),a===void 0?[2,void 0]:[2,!!a||!1]}})})},t.prototype.getAllFlags=function(r,n){return B2(this,void 0,void 0,function(){var i;return R2(this,function(a){switch(a.label){case 0:return[4,this.getAllFlagsAndPayloads(r,n)];case 1:return i=a.sent(),[2,i.featureFlags]}})})},t.prototype.getAllFlagsAndPayloads=function(r,n){var i;return B2(this,void 0,void 0,function(){var a,u,f,d,c,o,l,g,O,j,S;return R2(this,function(T){switch(T.label){case 0:return a=n||{},u=a.groups,f=a.personProperties,d=a.groupProperties,c=a.disableGeoip,o=(n||{}).onlyEvaluateLocally,o==null&&(o=!1),[4,(i=this.featureFlagsPoller)===null||i===void 0?void 0:i.getAllFlagsAndPayloads(r,u,f,d)];case 1:return l=T.sent(),g={},O={},j=!0,l&&(g=l.response,O=l.payloads,j=l.fallbackToDecide),j&&!o?[4,e.prototype.getFeatureFlagsAndPayloadsStateless.call(this,r,u,f,d,c)]:[3,3];case 2:S=T.sent(),g=Bg(Bg({},g),S.flags||{}),O=Bg(Bg({},O),S.payloads||{}),T.label=3;case 3:return[2,{featureFlags:g,featureFlagPayloads:O}]}})})},t.prototype.groupIdentify=function(r){var n=r.groupType,i=r.groupKey,a=r.properties,u=r.distinctId,f=r.disableGeoip;e.prototype.groupIdentifyStateless.call(this,n,i,a,{disableGeoip:f},u)},t.prototype.reloadFeatureFlags=function(){var r;return B2(this,void 0,void 0,function(){return R2(this,function(n){switch(n.label){case 0:return[4,(r=this.featureFlagsPoller)===null||r===void 0?void 0:r.loadFeatureFlags(!0)];case 1:return n.sent(),[2]}})})},t.prototype.shutdown=function(){this.shutdownAsync()},t.prototype.shutdownAsync=function(){var r;return B2(this,void 0,void 0,function(){return R2(this,function(n){return(r=this.featureFlagsPoller)===null||r===void 0||r.stopPoller(),[2,e.prototype.shutdownAsync.call(this)]})})},t}(mQl);var Asa=class{posthog;constructor({posthogApiKey:t}){this.posthog=new qsa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.0.0",usingAccessToken:!0}})}flush(){this.posthog.flush()}};var Lli=class{async sendEvent(){}async identify(){}async flush(){}};var OAn=require("fs/promises"),MQl=require("os"),xQl=require("path");var DQl=iu(require("crypto")),Nsa=new Uint8Array(256),Csa=Nsa.length;function Dko(){return Csa>Nsa.length-16&&(DQl.default.randomFillSync(Nsa),Csa=0),Nsa.slice(Csa,Csa+=16)}var yW=[];for(let e=0;e<256;++e)yW.push((e+256).toString(16).slice(1));function SQl(e,t=0){return yW[e[t+0]]+yW[e[t+1]]+yW[e[t+2]]+yW[e[t+3]]+"-"+yW[e[t+4]]+yW[e[t+5]]+"-"+yW[e[t+6]]+yW[e[t+7]]+"-"+yW[e[t+8]]+yW[e[t+9]]+"-"+yW[e[t+10]]+yW[e[t+11]]+yW[e[t+12]]+yW[e[t+13]]+yW[e[t+14]]+yW[e[t+15]]}var EQl=iu(require("crypto")),Sko={randomUUID:EQl.default.randomUUID};function hGP(e,t,r){if(Sko.randomUUID&&!t&&!e)return Sko.randomUUID();e=e||{};let n=e.random||(e.rng||Dko)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return SQl(n)}var rNr=hGP;var yGP="id",vGP=".fern",Uli=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qsa(r),this.userId=t==null?void 0:NGo(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.0.0",...t,...t.properties}})}flush(){this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=_f(O_.of((0,MQl.homedir)()),Ms.of(vGP),Ms.of(yGP));await Bh(t)||(await(0,OAn.mkdir)((0,xQl.dirname)(t),{recursive:!0}),await(0,OAn.writeFile)(t,rNr())),this.persistedDistinctId=(await(0,OAn.readFile)(t)).toString()}return this.persistedDistinctId}};var Eko;async function PAn(){return Eko==null&&(Eko=await bGP()),Eko}async function bGP(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Lli;let r=await ura();return r!=null?new Uli({token:r,posthogApiKey:e}):await ora()!=null?new Asa({posthogApiKey:e}):new Uli({token:void 0,posthogApiKey:e})}catch{return new Lli}}function Vli(e,t){return function(){return e.apply(t,arguments)}}var{toString:gGP}=Object.prototype,{getPrototypeOf:Tko}=Object,zsa=(e=>t=>{let r=gGP.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),zAt=e=>(e=e.toLowerCase(),t=>zsa(t)===e),Bsa=e=>t=>typeof t===e,{isArray:jAn}=Array,Wli=Bsa("undefined");function mGP(e){return e!==null&&!Wli(e)&&e.constructor!==null&&!Wli(e.constructor)&&fje(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var AQl=zAt("ArrayBuffer");function OGP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&AQl(e.buffer),t}var PGP=Bsa("string"),fje=Bsa("function"),CQl=Bsa("number"),Rsa=e=>e!==null&&typeof e=="object",jGP=e=>e===!0||e===!1,Isa=e=>{if(zsa(e)!=="object")return!1;let t=Tko(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wGP=zAt("Date"),DGP=zAt("File"),SGP=zAt("Blob"),EGP=zAt("FileList"),MGP=e=>Rsa(e)&&fje(e.pipe),xGP=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fje(e.append)&&((t=zsa(e))==="formdata"||t==="object"&&fje(e.toString)&&e.toString()==="[object FormData]"))},TGP=zAt("URLSearchParams"),[qGP,AGP,CGP,NGP]=["ReadableStream","Request","Response","Headers"].map(zAt),IGP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hli(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),jAn(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,f;for(n=0;n<u;n++)f=a[n],t.call(null,e[f],f,e)}}function NQl(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var iZr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IQl=e=>!Wli(e)&&e!==iZr;function xko(){let{caseless:e}=IQl(this)&&this||{},t={},r=(n,i)=>{let a=e&&NQl(t,i)||i;Isa(t[a])&&Isa(n)?t[a]=xko(t[a],n):Isa(n)?t[a]=xko({},n):jAn(n)?t[a]=n.slice():t[a]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Hli(arguments[n],r);return t}var zGP=(e,t,r,{allOwnKeys:n}={})=>(Hli(t,(i,a)=>{r&&fje(i)?e[a]=Vli(i,r):e[a]=i},{allOwnKeys:n}),e),BGP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),RGP=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},FGP=(e,t,r,n)=>{let i,a,u,f={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)u=i[a],(!n||n(u,e,t))&&!f[u]&&(t[u]=e[u],f[u]=!0);e=r!==!1&&Tko(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LGP=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},UGP=e=>{if(!e)return null;if(jAn(e))return e;let t=e.length;if(!CQl(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},VGP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Tko(Uint8Array)),WGP=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},HGP=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},JGP=zAt("HTMLFormElement"),GGP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),TQl=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),KGP=zAt("RegExp"),zQl=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Hli(r,(i,a)=>{let u;(u=t(i,a,e))!==!1&&(n[a]=u||i)}),Object.defineProperties(e,n)},$GP=e=>{zQl(e,(t,r)=>{if(fje(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fje(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},YGP=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return jAn(e)?n(e):n(String(e).split(t)),r},XGP=()=>{},QGP=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Mko="abcdefghijklmnopqrstuvwxyz",qQl="0123456789",BQl={DIGIT:qQl,ALPHA:Mko,ALPHA_DIGIT:Mko+Mko.toUpperCase()+qQl},ZGP=(e=16,t=BQl.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function kGP(e){return!!(e&&fje(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var eKP=e=>{let t=new Array(10),r=(n,i)=>{if(Rsa(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let a=jAn(n)?[]:{};return Hli(n,(u,f)=>{let d=r(u,i+1);!Wli(d)&&(a[f]=d)}),t[i]=void 0,a}}return n};return r(e,0)},tKP=zAt("AsyncFunction"),rKP=e=>e&&(Rsa(e)||fje(e))&&fje(e.then)&&fje(e.catch),RQl=((e,t)=>e?setImmediate:t?((r,n)=>(iZr.addEventListener("message",({source:i,data:a})=>{i===iZr&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),iZr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fje(iZr.postMessage)),nKP=typeof queueMicrotask<"u"?queueMicrotask.bind(iZr):typeof process<"u"&&process.nextTick||RQl,Hl={isArray:jAn,isArrayBuffer:AQl,isBuffer:mGP,isFormData:xGP,isArrayBufferView:OGP,isString:PGP,isNumber:CQl,isBoolean:jGP,isObject:Rsa,isPlainObject:Isa,isReadableStream:qGP,isRequest:AGP,isResponse:CGP,isHeaders:NGP,isUndefined:Wli,isDate:wGP,isFile:DGP,isBlob:SGP,isRegExp:KGP,isFunction:fje,isStream:MGP,isURLSearchParams:TGP,isTypedArray:VGP,isFileList:EGP,forEach:Hli,merge:xko,extend:zGP,trim:IGP,stripBOM:BGP,inherits:RGP,toFlatObject:FGP,kindOf:zsa,kindOfTest:zAt,endsWith:LGP,toArray:UGP,forEachEntry:WGP,matchAll:HGP,isHTMLForm:JGP,hasOwnProperty:TQl,hasOwnProp:TQl,reduceDescriptors:zQl,freezeMethods:$GP,toObjectSet:YGP,toCamelCase:GGP,noop:XGP,toFiniteNumber:QGP,findKey:NQl,global:iZr,isContextDefined:IQl,ALPHABET:BQl,generateString:ZGP,isSpecCompliantForm:kGP,toJSONObject:eKP,isAsyncFn:tKP,isThenable:rKP,setImmediate:RQl,asap:nKP};function wAn(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Hl.inherits(wAn,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:Hl.toJSONObject(this.config),code:this.code,status:this.status}}});var FQl=wAn.prototype,LQl={};["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=>{LQl[e]={value:e}});Object.defineProperties(wAn,LQl);Object.defineProperty(FQl,"isAxiosError",{value:!0});wAn.from=(e,t,r,n,i,a)=>{let u=Object.create(FQl);return Hl.toFlatObject(e,u,function(d){return d!==Error.prototype},f=>f!=="isAxiosError"),wAn.call(u,e.message,t,r,n,i),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var xy=wAn;var UQl=iu(wXr(),1),Fsa=UQl.default;function qko(e){return Hl.isPlainObject(e)||Hl.isArray(e)}function WQl(e){return Hl.endsWith(e,"[]")?e.slice(0,-2):e}function VQl(e,t,r){return e?e.concat(t).map(function(i,a){return i=WQl(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function iKP(e){return Hl.isArray(e)&&!e.some(qko)}var aKP=Hl.toFlatObject(Hl,{},null,function(t){return/^is[A-Z]/.test(t)});function oKP(e,t,r){if(!Hl.isObject(e))throw new TypeError("target must be an object");t=t||new(Fsa||FormData),r=Hl.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,T){return!Hl.isUndefined(T[S])});let n=r.metaTokens,i=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Hl.isSpecCompliantForm(t);if(!Hl.isFunction(i))throw new TypeError("visitor must be a function");function c(j){if(j===null)return"";if(Hl.isDate(j))return j.toISOString();if(!d&&Hl.isBlob(j))throw new xy("Blob is not supported. Use a Buffer instead.");return Hl.isArrayBuffer(j)||Hl.isTypedArray(j)?d&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function o(j,S,T){let C=j;if(j&&!T&&typeof j=="object"){if(Hl.endsWith(S,"{}"))S=n?S:S.slice(0,-2),j=JSON.stringify(j);else if(Hl.isArray(j)&&iKP(j)||(Hl.isFileList(j)||Hl.endsWith(S,"[]"))&&(C=Hl.toArray(j)))return S=WQl(S),C.forEach(function(N,A){!(Hl.isUndefined(N)||N===null)&&t.append(u===!0?VQl([S],A,a):u===null?S:S+"[]",c(N))}),!1}return qko(j)?!0:(t.append(VQl(T,S,a),c(j)),!1)}let l=[],g=Object.assign(aKP,{defaultVisitor:o,convertValue:c,isVisitable:qko});function O(j,S){if(!Hl.isUndefined(j)){if(l.indexOf(j)!==-1)throw Error("Circular reference detected in "+S.join("."));l.push(j),Hl.forEach(j,function(C,I){(!(Hl.isUndefined(C)||C===null)&&i.call(t,C,Hl.isString(I)?I.trim():I,S,g))===!0&&O(C,S?S.concat(I):[I])}),l.pop()}}if(!Hl.isObject(e))throw new TypeError("data must be an object");return O(e),t}var nNr=oKP;function HQl(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function JQl(e,t){this._pairs=[],e&&nNr(e,this,t)}var GQl=JQl.prototype;GQl.append=function(t,r){this._pairs.push([t,r])};GQl.toString=function(t){let r=t?function(n){return t.call(this,n,HQl)}:HQl;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var KQl=JQl;function uKP(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function aZr(e,t,r){if(!t)return e;let n=r&&r.encode||uKP,i=r&&r.serialize,a;if(i?a=i(t,r):a=Hl.isURLSearchParams(t)?t.toString():new KQl(t,r).toString(n),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Ako=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Hl.forEach(this.handlers,function(n){n!==null&&t(n)})}},Cko=Ako;var DAn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var $Ql=iu(require("url"),1),YQl=$Ql.default.URLSearchParams;var XQl={isNode:!0,classes:{URLSearchParams:YQl,FormData:Fsa,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var zko={};td(zko,{hasBrowserEnv:()=>Iko,hasStandardBrowserEnv:()=>sKP,hasStandardBrowserWebWorkerEnv:()=>cKP,navigator:()=>Nko,origin:()=>lKP});var Iko=typeof window<"u"&&typeof document<"u",Nko=typeof navigator=="object"&&navigator||void 0,sKP=Iko&&(!Nko||["ReactNative","NativeScript","NS"].indexOf(Nko.product)<0),cKP=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",lKP=Iko&&window.location.href||"http://localhost";var wC={...zko,...XQl};function Bko(e,t){return nNr(e,new wC.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,a){return wC.isNode&&Hl.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function fKP(e){return Hl.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dKP(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function pKP(e){function t(r,n,i,a){let u=r[a++];if(u==="__proto__")return!0;let f=Number.isFinite(+u),d=a>=r.length;return u=!u&&Hl.isArray(i)?i.length:u,d?(Hl.hasOwnProp(i,u)?i[u]=[i[u],n]:i[u]=n,!f):((!i[u]||!Hl.isObject(i[u]))&&(i[u]=[]),t(r,n,i[u],a)&&Hl.isArray(i[u])&&(i[u]=dKP(i[u])),!f)}if(Hl.isFormData(e)&&Hl.isFunction(e.entries)){let r={};return Hl.forEachEntry(e,(n,i)=>{t(fKP(n),i,r,0)}),r}return null}var Lsa=pKP;function _KP(e,t,r){if(Hl.isString(e))try{return(t||JSON.parse)(e),Hl.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Rko={transitional:DAn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Hl.isObject(t);if(a&&Hl.isHTMLForm(t)&&(t=new FormData(t)),Hl.isFormData(t))return i?JSON.stringify(Lsa(t)):t;if(Hl.isArrayBuffer(t)||Hl.isBuffer(t)||Hl.isStream(t)||Hl.isFile(t)||Hl.isBlob(t)||Hl.isReadableStream(t))return t;if(Hl.isArrayBufferView(t))return t.buffer;if(Hl.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let f;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Bko(t,this.formSerializer).toString();if((f=Hl.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return nNr(f?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),_KP(t)):t}],transformResponse:[function(t){let r=this.transitional||Rko.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Hl.isResponse(t)||Hl.isReadableStream(t))return t;if(t&&Hl.isString(t)&&(n&&!this.responseType||i)){let u=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(f){if(u)throw f.name==="SyntaxError"?xy.from(f,xy.ERR_BAD_RESPONSE,this,null,this.response):f}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:wC.classes.FormData,Blob:wC.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hl.forEach(["delete","get","head","post","put","patch"],e=>{Rko.headers[e]={}});var SAn=Rko;var hKP=Hl.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"]),QQl=e=>{let t={},r,n,i;return e&&e.split(`
1761
+ `}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&&nsa(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var nQl=iu(XXl(),1),iQl=iu(jQo(),1),aQl=iu(tQl(),1),fq=iu(lje(),1),oQl=iu(wci(),1);var Esa=iu(lje(),1),rQl=iu(wci(),1),Msa=function(e,t,r){return typeof e[t]!="function"?(0,Esa.of)(e):(0,Esa.from)((0,rQl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var zli={isPlainObject:nQl.default,set:aQl.default,get:iQl.default},gAn=class extends nZr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=zli.isPlainObject(r)?{...r}:{},zli.isPlainObject(t)&&(t=Object.values(t).every(i=>zli.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,fq.from)(t):t;return this.process=n.pipe((0,fq.concatMap)(this.processQuestion.bind(this)),(0,fq.publish)()),this.process.connect(),this.process.pipe((0,fq.reduce)((i,a)=>(zli.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,fq.defer)(()=>(0,fq.of)(t).pipe((0,fq.concatMap)(this.setDefaultType.bind(this)),(0,fq.concatMap)(this.filterIfRunnable.bind(this)),(0,fq.concatMap)(()=>Msa(t,"message",this.answers)),(0,fq.concatMap)(()=>Msa(t,"default",this.answers)),(0,fq.concatMap)(()=>Msa(t,"choices",this.answers)),(0,fq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,fq.defer)(()=>(0,fq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,fq.defer)(()=>(0,fq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&zli.get(this.answers,t.name)!==void 0)return(0,fq.empty)();if(t.when===!1)return(0,fq.empty)();if(typeof t.when!="function")return(0,fq.of)(t);let{answers:r}=this;return(0,fq.defer)(()=>(0,fq.from)((0,oQl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,fq.filter)(n=>n!=null)))}};function uQl(e){let t=function(r,n){let i;try{i=new gAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",bli),this.registerPrompt("input",XQr),this.registerPrompt("number",gli),this.registerPrompt("confirm",mli),this.registerPrompt("rawlist",Oli),this.registerPrompt("expand",Pli),this.registerPrompt("checkbox",jli),this.registerPrompt("password",wli),this.registerPrompt("editor",Nli)},t.restoreDefaultPrompts(),t}var mko=uQl();function ZJP(e,t){mko.registerPrompt(e,t)}function kJP(){mko.restoreDefaultPrompts()}var eGP={prompt:mko,ui:{BottomBar:Ili,Prompt:gAn},createPromptModule:uQl,registerPrompt:ZJP,restoreDefaultPrompts:kJP,Separator:one},xsa=eGP;var yQl=iu(sQl()),vQl=iu(NJo()),Pko=function(e,t){return Pko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Pko(e,t)};function mAn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Pko(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Bg=function(){return Bg=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Bg.apply(this,arguments)};function tGP(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function B2(e,t,r,n){function i(a){return a instanceof r?a:new r(function(u){u(a)})}return new(r||(r=Promise))(function(a,u){function f(o){try{c(n.next(o))}catch(l){u(l)}}function d(o){try{c(n.throw(o))}catch(l){u(l)}}function c(o){o.done?a(o.value):i(o.value).then(f,d)}c((n=n.apply(e,t||[])).next())})}function R2(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(c){return function(o){return d([c,o])}}function d(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(o){c=[6,o],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function bQl(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var jko="3.1.2",Y1;(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"})(Y1||(Y1={}));function rGP(e,t){if(!e)throw new Error(t)}function nGP(e){return e?.replace(/\/+$/,"")}function iGP(e,t){return t===void 0&&(t={}),B2(this,void 0,void 0,function(){var r,n,i,a,u,f,d,c,o,l;return R2(this,function(g){switch(g.label){case 0:r=t.retryCount,n=r===void 0?3:r,i=t.retryDelay,a=i===void 0?5e3:i,u=t.retryCheck,f=u===void 0?function(){return!0}:u,d=null,c=0,g.label=1;case 1:return c<n+1?c>0?[4,new Promise(function(O){return setTimeout(O,a)})]:[3,3]:[3,7];case 2:g.sent(),g.label=3;case 3:return g.trys.push([3,5,,6]),[4,e()];case 4:return o=g.sent(),[2,o];case 5:if(l=g.sent(),d=l,!f(l))throw l;return[3,6];case 6:return c++,[3,1];case 7:throw d}})})}function wko(e){var t=new Date().getTime(),r=e&&e.performance&&e.performance.now&&e.performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var i=Math.random()*16;return t>0?(i=(t+i)%16|0,t=Math.floor(t/16)):(i=(r+i)%16|0,r=Math.floor(r/16)),(n==="x"?i:i&3|8).toString(16)})}function aGP(){return new Date().getTime()}function cQl(){return new Date().toISOString()}function gQl(e,t){var r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Rli=String.fromCharCode,lQl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Tsa={};function oGP(e,t){if(!Tsa[e]){Tsa[e]={};for(var r=0;r<e.length;r++)Tsa[e][e.charAt(r)]=r}return Tsa[e][t]}var Fli={compressToBase64:function(e){if(e==null)return"";var t=Fli._compress(e,6,function(r){return lQl.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:Fli._decompress(e.length,32,function(t){return oGP(lQl,e.charAt(t))})},compress:function(e){return Fli._compress(e,16,function(t){return Rli(t)})},_compress:function(e,t,r){if(e==null)return"";var n={},i={},a=[],u,f,d="",c="",o="",l=2,g=3,O=2,j=0,S=0,T;for(T=0;T<e.length;T+=1)if(d=e.charAt(T),Object.prototype.hasOwnProperty.call(n,d)||(n[d]=g++,i[d]=!0),c=o+d,Object.prototype.hasOwnProperty.call(n,c))o=c;else{if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<O;u++)j=j<<1,S==t-1?(S=0,a.push(r(j)),j=0):S++;for(f=o.charCodeAt(0),u=0;u<8;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}else{for(f=1,u=0;u<O;u++)j=j<<1|f,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=0;for(f=o.charCodeAt(0),u=0;u<16;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[o]}else for(f=n[o],u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;l--,l==0&&(l=Math.pow(2,O),O++),n[c]=g++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<O;u++)j=j<<1,S==t-1?(S=0,a.push(r(j)),j=0):S++;for(f=o.charCodeAt(0),u=0;u<8;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}else{for(f=1,u=0;u<O;u++)j=j<<1|f,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=0;for(f=o.charCodeAt(0),u=0;u<16;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[o]}else for(f=n[o],u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;l--,l==0&&(l=Math.pow(2,O),O++)}for(f=2,u=0;u<O;u++)j=j<<1|f&1,S==t-1?(S=0,a.push(r(j)),j=0):S++,f=f>>1;for(;;)if(j=j<<1,S==t-1){a.push(r(j));break}else S++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:Fli._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){var n=[],i=[],a={val:r(0),position:t,index:1},u=4,f=4,d=3,c="",o,l,g,O,j,S,T;for(o=0;o<3;o+=1)n[o]=o;for(g=0,j=Math.pow(2,2),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;switch(g){case 0:for(g=0,j=Math.pow(2,8),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;T=Rli(g);break;case 1:for(g=0,j=Math.pow(2,16),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;T=Rli(g);break;case 2:return""}for(n[3]=T,l=T,i.push(T);;){if(a.index>e)return"";for(g=0,j=Math.pow(2,d),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;switch(T=g){case 0:for(g=0,j=Math.pow(2,8),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;n[f++]=Rli(g),T=f-1,u--;break;case 1:for(g=0,j=Math.pow(2,16),S=1;S!=j;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),g|=(O>0?1:0)*S,S<<=1;n[f++]=Rli(g),T=f-1,u--;break;case 2:return i.join("")}if(u==0&&(u=Math.pow(2,d),d++),n[T])c=n[T];else if(T===f)c=l+l.charAt(0);else return null;i.push(c),n[f++]=l+c.charAt(0),u--,l=c,u==0&&(u=Math.pow(2,d),d++)}}},uGP=function(){function e(){this.events={},this.events={}}return e.prototype.on=function(t,r){var n=this;return this.events[t]||(this.events[t]=[]),this.events[t].push(r),function(){n.events[t]=n.events[t].filter(function(i){return i!==r})}},e.prototype.emit=function(t,r){for(var n=0,i=this.events[t]||[];n<i.length;n++){var a=i[n];a(r)}for(var u=0,f=this.events["*"]||[];u<f.length;u++){var a=f[u];a(t,r)}},e}(),sGP=function(e){mAn(t,e);function t(r){var n=e.call(this,"HTTP error while fetching PostHog: "+r.status)||this;return n.response=r,n.name="PostHogFetchHttpError",n}return t}(Error),cGP=function(e){mAn(t,e);function t(r){var n=e.call(this,"Network error while fetching PostHog",r instanceof Error?{cause:r}:{})||this;return n.error=r,n.name="PostHogFetchNetworkError",n}return t}(Error);function fQl(e){return typeof e=="object"&&(e.name==="PostHogFetchHttpError"||e.name==="PostHogFetchNetworkError")}var mQl=function(){function e(t,r){var n,i,a,u,f;this.debugMode=!1,this.pendingPromises={},this.disableGeoip=!0,this._events=new uGP,rGP(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=nGP(r?.host||"https://app.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.flushInterval=(n=r?.flushInterval)!==null&&n!==void 0?n:1e4,this.captureMode=r?.captureMode||"form",this._optoutOverride=r?.enable===!1,this._retryOptions={retryCount:(i=r?.fetchRetryCount)!==null&&i!==void 0?i:3,retryDelay:(a=r?.fetchRetryDelay)!==null&&a!==void 0?a:3e3,retryCheck:fQl},this.requestTimeout=(u=r?.requestTimeout)!==null&&u!==void 0?u:1e4,this.disableGeoip=(f=r?.disableGeoip)!==null&&f!==void 0?f:!0}return e.prototype.getCommonEventProperties=function(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}},Object.defineProperty(e.prototype,"optedOut",{get:function(){var t,r;return(r=(t=this.getPersistedProperty(Y1.OptedOut))!==null&&t!==void 0?t:this._optoutOverride)!==null&&r!==void 0?r:!1},enumerable:!1,configurable:!0}),e.prototype.optIn=function(){this.setPersistedProperty(Y1.OptedOut,!1)},e.prototype.optOut=function(){this.setPersistedProperty(Y1.OptedOut,!0)},e.prototype.on=function(t,r){return this._events.on(t,r)},e.prototype.debug=function(t){var r;t===void 0&&(t=!0),(r=this.removeDebugCallback)===null||r===void 0||r.call(this),this.debugMode=t,t&&(this.removeDebugCallback=this.on("*",function(n,i){return console.log("PostHog Debug",n,i)}))},e.prototype.buildPayload=function(t){return{distinct_id:t.distinct_id,event:t.event,properties:Bg(Bg({},t.properties||{}),this.getCommonEventProperties())}},e.prototype.identifyStateless=function(t,r,n){var i=Bg({},this.buildPayload({distinct_id:t,event:"$identify",properties:r}));return this.enqueue("identify",i,n),this},e.prototype.captureStateless=function(t,r,n,i){var a=this.buildPayload({distinct_id:t,event:r,properties:n});return this.enqueue("capture",a,i),this},e.prototype.aliasStateless=function(t,r,n,i){var a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:Bg(Bg({},n||{}),{distinct_id:r,alias:t})});return this.enqueue("alias",a,i),this},e.prototype.groupIdentifyStateless=function(t,r,n,i,a,u){var f=this.buildPayload({distinct_id:a||"$".concat(t,"_").concat(r),event:"$groupidentify",properties:Bg({$group_type:t,$group_key:r,$group_set:n||{}},u||{})});return this.enqueue("capture",f,i),this},e.prototype.getDecide=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var u,f;return R2(this,function(d){return u="".concat(this.host,"/decide/?v=3"),f={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Bg({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i},a))},[2,this.fetchWithRetry(u,f).then(function(c){return c.json()}).catch(function(c){console.error("Error fetching feature flags",c)})]})})},e.prototype.getFeatureFlagStateless=function(t,r,n,i,a,u){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var f,d;return R2(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagsStateless(r,n,i,a,u)];case 1:return f=c.sent(),f?(d=f[t],d===void 0&&(d=!1),[2,d]):[2,void 0]}})})},e.prototype.getFeatureFlagPayloadStateless=function(t,r,n,i,a,u){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var f,d;return R2(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagPayloadsStateless(r,n,i,a,u)];case 1:return f=c.sent(),f?(d=f[t],d===void 0?[2,null]:[2,this._parsePayload(d)]):[2,void 0]}})})},e.prototype.getFeatureFlagPayloadsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var u,f=this;return R2(this,function(d){switch(d.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a)];case 1:return u=d.sent().payloads,u?[2,Object.fromEntries(Object.entries(u).map(function(c){var o=c[0],l=c[1];return[o,f._parsePayload(l)]}))]:[2,u]}})})},e.prototype._parsePayload=function(t){try{return JSON.parse(t)}catch{return t}},e.prototype.getFeatureFlagsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){return R2(this,function(u){switch(u.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a)];case 1:return[2,u.sent().flags]}})})},e.prototype.getFeatureFlagsAndPayloadsStateless=function(t,r,n,i,a){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var u,f,d,c;return R2(this,function(o){switch(o.label){case 0:return u={},(a??this.disableGeoip)&&(u.geoip_disable=!0),[4,this.getDecide(t,r,n,i,u)];case 1:return f=o.sent(),d=f?.featureFlags,c=f?.featureFlagPayloads,[2,{flags:d,payloads:c}]}})})},e.prototype.enqueue=function(t,r,n){var i=this,a;if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.enable()");return}var u=Bg(Bg({},r),{type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:cQl()}),f=(a=n?.disableGeoip)!==null&&a!==void 0?a:this.disableGeoip;f&&(u.properties||(u.properties={}),u.properties.$geoip_disable=!0),u.distinctId&&(u.distinct_id=u.distinctId,delete u.distinctId);var d=this.getPersistedProperty(Y1.Queue)||[];d.push({message:u}),this.setPersistedProperty(Y1.Queue,d),this._events.emit(t,u),d.length>=this.flushAt&&this.flush(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=gQl(function(){return i.flush()},this.flushInterval))},e.prototype.flushAsync=function(){var t=this;return new Promise(function(r,n){t.flush(function(i,a){return i?n(i):r(a)})})},e.prototype.flush=function(t){var r=this;this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=null);var n=this.getPersistedProperty(Y1.Queue)||[];if(!n.length)return t?.();var i=n.splice(0,this.flushAt);this.setPersistedProperty(Y1.Queue,n);var a=i.map(function(O){return O.message}),u={api_key:this.apiKey,batch:a,sent_at:cQl()},f=wko(),d=function(O){O&&r._events.emit("error",O),t?.(O,a),delete r.pendingPromises[f],r._events.emit("flush",a)};this.getCustomUserAgent();var c=JSON.stringify(u),o=this.captureMode==="form"?"".concat(this.host,"/e/?ip=1&_=").concat(aGP(),"&v=").concat(this.getLibraryVersion()):"".concat(this.host,"/batch/"),l=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"data=".concat(encodeURIComponent(Fli.compressToBase64(c)),"&compression=lz64")}:{method:"POST",headers:{"Content-Type":"application/json"},body:c},g=this.fetchWithRetry(o,l);this.pendingPromises[f]=g,g.then(function(){return d()}).catch(function(O){d(O)})},e.prototype.fetchWithRetry=function(t,r,n){var i,a;return B2(this,void 0,void 0,function(){var u=this;return R2(this,function(f){switch(f.label){case 0:return(i=(a=AbortSignal).timeout)!==null&&i!==void 0||(a.timeout=function(c){var o=new AbortController;return setTimeout(function(){return o.abort()},c),o.signal}),[4,iGP(function(){return B2(u,void 0,void 0,function(){var d,c;return R2(this,function(o){switch(o.label){case 0:d=null,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.fetch(t,Bg({signal:AbortSignal.timeout(this.requestTimeout)},r))];case 2:return d=o.sent(),[3,4];case 3:throw c=o.sent(),new cGP(c);case 4:if(d.status<200||d.status>=400)throw new sGP(d);return[2,d]}})})},Bg(Bg({},this._retryOptions),n))];case 1:return[2,f.sent()]}})})},e.prototype.shutdownAsync=function(){return B2(this,void 0,void 0,function(){var t;return R2(this,function(r){switch(r.label){case 0:clearTimeout(this._flushTimer),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.flushAsync()];case 2:return r.sent(),[4,Promise.all(Object.values(this.pendingPromises).map(function(n){return n.catch(function(){})}))];case 3:return r.sent(),[3,5];case 4:if(t=r.sent(),!fQl(t))throw t;return console.error("Error while shutting down PostHog",t),[3,5];case 5:return[2]}})})},e.prototype.shutdown=function(){this.shutdownAsync()},e}();(function(e){mAn(t,e);function t(r,n){var i=this,a,u,f,d=(a=n?.disableGeoip)!==null&&a!==void 0?a:!1;return i=e.call(this,r,Bg(Bg({},n),{disableGeoip:d}))||this,i.flagCallReported={},i.sessionProps={},i.sendFeatureFlagEvent=(u=n?.sendFeatureFlagEvent)!==null&&u!==void 0?u:!0,i._sessionExpirationTimeSeconds=(f=n?.sessionExpirationTimeSeconds)!==null&&f!==void 0?f:1800,i}return t.prototype.setupBootstrap=function(r){var n,i,a,u;if(!((n=r?.bootstrap)===null||n===void 0)&&n.distinctId&&(!((i=r?.bootstrap)===null||i===void 0)&&i.isIdentifiedId?this.setPersistedProperty(Y1.DistinctId,r.bootstrap.distinctId):this.setPersistedProperty(Y1.AnonymousId,r.bootstrap.distinctId)),!((a=r?.bootstrap)===null||a===void 0)&&a.featureFlags){var f=Object.keys(((u=r.bootstrap)===null||u===void 0?void 0:u.featureFlags)||{}).filter(function(d){var c,o;return!!(!((o=(c=r.bootstrap)===null||c===void 0?void 0:c.featureFlags)===null||o===void 0)&&o[d])}).reduce(function(d,c){var o,l;return d[c]=((l=(o=r.bootstrap)===null||o===void 0?void 0:o.featureFlags)===null||l===void 0?void 0:l[c])||!1,d},{});this.setKnownFeatureFlags(f),r?.bootstrap.featureFlagPayloads&&this.setKnownFeatureFlagPayloads(r?.bootstrap.featureFlagPayloads)}},Object.defineProperty(t.prototype,"props",{get:function(){return this._props||(this._props=this.getPersistedProperty(Y1.Props)),this._props||{}},set:function(r){this._props=r},enumerable:!1,configurable:!0}),t.prototype.clearProps=function(){this.props=void 0,this.sessionProps={}},t.prototype.on=function(r,n){return this._events.on(r,n)},t.prototype.reset=function(r){var n=bQl([Y1.Queue],r||[],!0);this.clearProps();for(var i=0,a=Object.keys(Y1);i<a.length;i++){var u=a[i];n.includes(Y1[u])||this.setPersistedProperty(Y1[u],null)}},t.prototype.getCommonEventProperties=function(){var r=this.getFeatureFlags(),n={};if(r)for(var i=0,a=Object.entries(r);i<a.length;i++){var u=a[i],f=u[0],d=u[1];n["$feature/".concat(f)]=d}return Bg(Bg({$active_feature_flags:r?Object.keys(r):void 0},n),e.prototype.getCommonEventProperties.call(this))},t.prototype.enrichProperties=function(r){return Bg(Bg(Bg(Bg(Bg({},this.props),this.sessionProps),r||{}),this.getCommonEventProperties()),{$session_id:this.getSessionId()})},t.prototype.getSessionId=function(){var r=this.getPersistedProperty(Y1.SessionId),n=this.getPersistedProperty(Y1.SessionLastTimestamp)||0;return(!r||Date.now()-n>this._sessionExpirationTimeSeconds*1e3)&&(r=wko(globalThis),this.setPersistedProperty(Y1.SessionId,r)),this.setPersistedProperty(Y1.SessionLastTimestamp,Date.now()),r},t.prototype.resetSessionId=function(){this.setPersistedProperty(Y1.SessionId,null)},t.prototype.getAnonymousId=function(){var r=this.getPersistedProperty(Y1.AnonymousId);return r||(r=wko(globalThis),this.setPersistedProperty(Y1.AnonymousId,r)),r},t.prototype.getDistinctId=function(){return this.getPersistedProperty(Y1.DistinctId)||this.getAnonymousId()},t.prototype.unregister=function(r){delete this.props[r],this.setPersistedProperty(Y1.Props,this.props)},t.prototype.register=function(r){this.props=Bg(Bg({},this.props),r),this.setPersistedProperty(Y1.Props,this.props)},t.prototype.registerForSession=function(r){this.sessionProps=Bg(Bg({},this.sessionProps),r)},t.prototype.unregisterForSession=function(r){delete this.sessionProps[r]},t.prototype.identify=function(r,n,i){var a=this.getDistinctId();r=r||a,n?.$groups&&this.groups(n.$groups);var u=this.enrichProperties(Bg(Bg({},n),{$anon_distinct_id:this.getAnonymousId(),$set:n}));return r!==a&&(this.setPersistedProperty(Y1.AnonymousId,a),this.setPersistedProperty(Y1.DistinctId,r),this.reloadFeatureFlags()),e.prototype.identifyStateless.call(this,r,u,i),this},t.prototype.capture=function(r,n,i){var a=this.getDistinctId();n?.$groups&&this.groups(n.$groups);var u=this.enrichProperties(n);return e.prototype.captureStateless.call(this,a,r,u,i),this},t.prototype.alias=function(r){var n=this.getDistinctId(),i=this.enrichProperties({});return e.prototype.aliasStateless.call(this,r,n,i),this},t.prototype.autocapture=function(r,n,i,a){i===void 0&&(i={});var u=this.getDistinctId(),f={distinct_id:u,event:"$autocapture",properties:Bg(Bg({},this.enrichProperties(i)),{$event_type:r,$elements:n})};return this.enqueue("autocapture",f,a),this},t.prototype.groups=function(r){var n=this.props.$groups||{};return this.register({$groups:Bg(Bg({},n),r)}),Object.keys(r).find(function(i){return n[i]!==r[i]})&&this.reloadFeatureFlags(),this},t.prototype.group=function(r,n,i,a){var u;return this.groups((u={},u[r]=n,u)),i&&this.groupIdentify(r,n,i,a),this},t.prototype.groupIdentify=function(r,n,i,a){var u=this.getDistinctId(),f=this.enrichProperties({});return e.prototype.groupIdentifyStateless.call(this,r,n,i,a,u,f),this},t.prototype.personProperties=function(r){var n=this.getPersistedProperty(Y1.PersonProperties)||{};return this.setPersistedProperty(Y1.PersonProperties,Bg(Bg({},n),r)),this},t.prototype.groupProperties=function(r){var n=this.getPersistedProperty(Y1.GroupProperties)||{};return Object.keys(n).length!==0&&Object.keys(n).forEach(function(i){n[i]=Bg(Bg({},n[i]),r[i]),delete r[i]}),this.setPersistedProperty(Y1.GroupProperties,Bg(Bg({},n),r)),this},t.prototype.decideAsync=function(r){return r===void 0&&(r=!0),this._decideResponsePromise?this._decideResponsePromise:this._decideAsync(r)},t.prototype._decideAsync=function(r){return r===void 0&&(r=!0),B2(this,void 0,void 0,function(){var n,i,a,u,f,d=this;return R2(this,function(c){return n=this.getDistinctId(),i=this.props.$groups||{},a=this.getPersistedProperty(Y1.PersonProperties)||{},u=this.getPersistedProperty(Y1.GroupProperties)||{},f={$anon_distinct_id:r?this.getAnonymousId():void 0},this._decideResponsePromise=e.prototype.getDecide.call(this,n,i,a,u,f).then(function(o){if(o?.featureFlags){var l=o.featureFlags,g=o.featureFlagPayloads;if(o.errorsWhileComputingFlags){var O=d.getPersistedProperty(Y1.FeatureFlags),j=d.getPersistedProperty(Y1.FeatureFlagPayloads);l=Bg(Bg({},O),o.featureFlags),g=Bg(Bg({},j),o.featureFlagPayloads)}d.setKnownFeatureFlags(l),d.setKnownFeatureFlagPayloads(g)}return o}).finally(function(){d._decideResponsePromise=void 0}),[2,this._decideResponsePromise]})})},t.prototype.setKnownFeatureFlags=function(r){this.setPersistedProperty(Y1.FeatureFlags,r),this._events.emit("featureflags",r)},t.prototype.setKnownFeatureFlagPayloads=function(r){this.setPersistedProperty(Y1.FeatureFlagPayloads,r)},t.prototype.getFeatureFlag=function(r){var n=this.getFeatureFlags();if(n){var i=n[r];return i===void 0&&(i=!1),this.sendFeatureFlagEvent&&!this.flagCallReported[r]&&(this.flagCallReported[r]=!0,this.capture("$feature_flag_called",{$feature_flag:r,$feature_flag_response:i})),i}},t.prototype.getFeatureFlagPayload=function(r){var n=this.getFeatureFlagPayloads();if(n){var i=n[r];return i===void 0?null:this._parsePayload(i)}},t.prototype.getFeatureFlagPayloads=function(){var r=this,n=this.getPersistedProperty(Y1.FeatureFlagPayloads);return n&&Object.fromEntries(Object.entries(n).map(function(i){var a=i[0],u=i[1];return[a,r._parsePayload(u)]}))},t.prototype.getFeatureFlags=function(){var r=this.getPersistedProperty(Y1.FeatureFlags),n=this.getPersistedProperty(Y1.OverrideFeatureFlags);if(!n)return r;r=r||{};for(var i in n)n[i]?r[i]=n[i]:delete r[i];return r},t.prototype.getFeatureFlagsAndPayloads=function(){var r=this.getFeatureFlags(),n=this.getFeatureFlagPayloads();return{flags:r,payloads:n}},t.prototype.isFeatureEnabled=function(r){var n=this.getFeatureFlag(r);if(n!==void 0)return!!n},t.prototype.reloadFeatureFlags=function(r){this.decideAsync().then(function(n){r?.(void 0,n?.featureFlags)}).catch(function(n){r?.(n,void 0),r||console.log("[PostHog] Error reloading feature flags",n)})},t.prototype.reloadFeatureFlagsAsync=function(r){var n;return r===void 0&&(r=!0),B2(this,void 0,void 0,function(){return R2(this,function(i){switch(i.label){case 0:return[4,this.decideAsync(r)];case 1:return[2,(n=i.sent())===null||n===void 0?void 0:n.featureFlags]}})})},t.prototype.onFeatureFlags=function(r){var n=this;return this.on("featureflags",function(){return B2(n,void 0,void 0,function(){var i;return R2(this,function(a){return i=this.getFeatureFlags(),i&&r(i),[2]})})})},t.prototype.onFeatureFlag=function(r,n){var i=this;return this.on("featureflags",function(){return B2(i,void 0,void 0,function(){var a;return R2(this,function(u){return a=this.getFeatureFlag(r),a!==void 0&&n(a),[2]})})})},t.prototype.overrideFeatureFlag=function(r){return r===null?this.setPersistedProperty(Y1.OverrideFeatureFlags,null):this.setPersistedProperty(Y1.OverrideFeatureFlags,r)},t})(mQl);var lGP=function(){function e(){this._memoryStorage={}}return e.prototype.getProperty=function(t){return this._memoryStorage[t]},e.prototype.setProperty=function(t,r){this._memoryStorage[t]=r!==null?r:void 0},e}(),OQl=function(e,t){return B2(void 0,void 0,void 0,function(){var r;return R2(this,function(n){switch(n.label){case 0:return[4,vQl.default.request({url:e,headers:t.headers,method:t.method.toLowerCase(),data:t.body,signal:t.signal,validateStatus:function(){return!0}})];case 1:return r=n.sent(),[2,{status:r.status,text:function(){return B2(void 0,void 0,void 0,function(){return R2(this,function(i){return[2,r.data]})})},json:function(){return B2(void 0,void 0,void 0,function(){return R2(this,function(i){return[2,r.data]})})}}]}})})},fGP=1152921504606847e3,dQl=function(e){mAn(t,e);function t(r){var n=e.call(this)||this;return Error.captureStackTrace(n,n.constructor),n.name="ClientError",n.message=r,Object.setPrototypeOf(n,t.prototype),n}return t}(Error),vQ=function(e){mAn(t,e);function t(r){var n=e.call(this,r)||this;return n.name=n.constructor.name,Error.captureStackTrace(n,n.constructor),Object.setPrototypeOf(n,t.prototype),n}return t}(Error),dGP=function(){function e(t){var r=t.pollingInterval,n=t.personalApiKey,i=t.projectApiKey,a=t.timeout,u=t.host,f=tGP(t,["pollingInterval","personalApiKey","projectApiKey","timeout","host"]);this.debugMode=!1,this.pollingInterval=r,this.personalApiKey=n,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=a,this.projectApiKey=i,this.host=u,this.poller=void 0,this.fetch=f.fetch||OQl,this.loadFeatureFlags()}return e.prototype.debug=function(t){t===void 0&&(t=!0),this.debugMode=t},e.prototype.getFeatureFlag=function(t,r,n,i,a){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),B2(this,void 0,void 0,function(){var u,f,d,c,o;return R2(this,function(l){switch(l.label){case 0:return[4,this.loadFeatureFlags()];case 1:if(l.sent(),u=void 0,f=void 0,!this.loadedSuccessfullyOnce)return[2,u];for(d=0,c=this.featureFlags;d<c.length;d++)if(o=c[d],t===o.key){f=o;break}if(f!==void 0)try{u=this.computeFlagLocally(f,r,n,i,a),this.debugMode&&console.debug("Successfully computed flag locally: ".concat(t," -> ").concat(u))}catch(g){g instanceof vQ?this.debugMode&&console.debug("InconclusiveMatchError when computing flag locally: ".concat(t,": ").concat(g)):g instanceof Error&&console.error("Error computing flag locally: ".concat(t,": ").concat(g))}return[2,u]}})})},e.prototype.computeFeatureFlagPayloadLocally=function(t,r){var n,i,a,u,f,d,c,o;return B2(this,void 0,void 0,function(){var l;return R2(this,function(g){switch(g.label){case 0:return[4,this.loadFeatureFlags()];case 1:return g.sent(),l=void 0,this.loadedSuccessfullyOnce?(typeof r=="boolean"?l=(u=(a=(i=(n=this.featureFlagsByKey)===null||n===void 0?void 0:n[t])===null||i===void 0?void 0:i.filters)===null||a===void 0?void 0:a.payloads)===null||u===void 0?void 0:u[r.toString()]:typeof r=="string"&&(l=(o=(c=(d=(f=this.featureFlagsByKey)===null||f===void 0?void 0:f[t])===null||d===void 0?void 0:d.filters)===null||c===void 0?void 0:c.payloads)===null||o===void 0?void 0:o[r]),l===void 0?[2,null]:[2,l]):[2,void 0]}})})},e.prototype.getAllFlagsAndPayloads=function(t,r,n,i){return r===void 0&&(r={}),n===void 0&&(n={}),i===void 0&&(i={}),B2(this,void 0,void 0,function(){var a,u,f,d=this;return R2(this,function(c){switch(c.label){case 0:return[4,this.loadFeatureFlags()];case 1:return c.sent(),a={},u={},f=this.featureFlags.length==0,this.featureFlags.map(function(o){return B2(d,void 0,void 0,function(){var l,g,O;return R2(this,function(j){switch(j.label){case 0:return j.trys.push([0,2,,3]),l=this.computeFlagLocally(o,t,r,n,i),a[o.key]=l,[4,this.computeFeatureFlagPayloadLocally(o.key,l)];case 1:return g=j.sent(),g&&(u[o.key]=g),[3,3];case 2:return O=j.sent(),O instanceof vQ||O instanceof Error&&console.error("Error computing flag locally: ".concat(o.key,": ").concat(O)),f=!0,[3,3];case 3:return[2]}})})}),[2,{response:a,payloads:u,fallbackToDecide:f}]}})})},e.prototype.computeFlagLocally=function(t,r,n,i,a){if(n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a={}),t.ensure_experience_continuity)throw new vQ("Flag has experience continuity enabled");if(!t.active)return!1;var u=t.filters||{},f=u.aggregation_group_type_index;if(f!=null){var d=this.groupTypeMapping[String(f)];if(!d)throw console.warn("[FEATURE FLAGS] Unknown group type index ".concat(f," for feature flag ").concat(t.key)),new vQ("Flag has unknown group type index");if(!(d in n))return console.warn("[FEATURE FLAGS] Can't compute group feature flag: ".concat(t.key," without group names passed in")),!1;var c=a[d];return this.matchFeatureFlagProperties(t,n[d],c)}else return this.matchFeatureFlagProperties(t,r,i)},e.prototype.matchFeatureFlagProperties=function(t,r,n){for(var i,a=t.filters||{},u=a.groups||[],f=!1,d=void 0,c=bQl([],u,!0).sort(function(T,C){var I=!!T.variant,N=!!C.variant;return I&&N?0:I?-1:N?1:0}),o=function(T){try{if(l.isConditionMatch(t,r,T,n)){var C=T.variant,I=((i=a.multivariate)===null||i===void 0?void 0:i.variants)||[];return C&&I.some(function(N){return N.key===C})?d=C:d=l.getMatchingVariant(t,r)||!0,"break"}}catch(N){if(N instanceof vQ)f=!0;else throw N}},l=this,g=0,O=c;g<O.length;g++){var j=O[g],S=o(j);if(S==="break")break}if(d!==void 0)return d;if(f)throw new vQ("Can't determine if feature flag is enabled or not with given properties");return!1},e.prototype.isConditionMatch=function(t,r,n,i){var a=n.rollout_percentage;if((n.properties||[]).length>0){for(var u=0,f=n.properties;u<f.length;u++){var d=f[u],c=d.type,o=!1;if(c==="cohort"?o=jQl(d,i,this.cohorts):o=PQl(d,i),!o)return!1}if(a==null)return!0}return!(a!=null&&pQl(t.key,r)>a/100)},e.prototype.getMatchingVariant=function(t,r){var n=pQl(t.key,r,"variant"),i=this.variantLookupTable(t).find(function(a){return n>=a.valueMin&&n<a.valueMax});if(i)return i.key},e.prototype.variantLookupTable=function(t){var r,n=[],i=0,a=0,u=t.filters||{},f=((r=u.multivariate)===null||r===void 0?void 0:r.variants)||[];return f.forEach(function(d){a=i+d.rollout_percentage/100,n.push({valueMin:i,valueMax:a,key:d.key}),i=a}),n},e.prototype.loadFeatureFlags=function(t){return t===void 0&&(t=!1),B2(this,void 0,void 0,function(){return R2(this,function(r){switch(r.label){case 0:return!this.loadedSuccessfullyOnce||t?[4,this._loadFeatureFlags()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype._loadFeatureFlags=function(){return B2(this,void 0,void 0,function(){var t,r,n,i=this;return R2(this,function(a){switch(a.label){case 0:this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(function(){return i._loadFeatureFlags()},this.pollingInterval),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this._requestFeatureFlagDefinitions()];case 2:if(t=a.sent(),t&&t.status===401)throw new dQl("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");return t&&t.status!==200?[2]:[4,t.json()];case 3:return r=a.sent(),"flags"in r||console.error("Invalid response when getting feature flags: ".concat(JSON.stringify(r))),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce(function(u,f){return u[f.key]=f,u},{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0,[3,5];case 4:if(n=a.sent(),n instanceof dQl)throw n;return[3,5];case 5:return[2]}})})},e.prototype._requestFeatureFlagDefinitions=function(){return B2(this,void 0,void 0,function(){var t,r,n,i,a;return R2(this,function(u){switch(u.label){case 0:t="".concat(this.host,"/api/feature_flag/local_evaluation?token=").concat(this.projectApiKey,"&send_cohorts"),r={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(this.personalApiKey),"user-agent":"posthog-node/".concat(jko)}},n=null,this.timeout&&typeof this.timeout=="number"&&(i=new AbortController,n=gQl(function(){i.abort()},this.timeout),r.signal=i.signal),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.fetch(t,r)];case 2:return[2,u.sent()];case 3:throw a=u.sent(),a;case 4:return clearTimeout(n),[7];case 5:return[2]}})})},e.prototype.stopPoller=function(){clearTimeout(this.poller)},e}();function pQl(e,t,r){r===void 0&&(r="");var n=(0,yQl.createHash)();return n.update("".concat(e,".").concat(t).concat(r)),parseInt(n.digest("hex").slice(0,15),16)/fGP}function PQl(e,t){var r=e.key,n=e.value,i=e.operator||"exact";if(r in t){if(i==="is_not_set")throw new vQ("Operator is_not_set is not supported")}else throw new vQ("Property ".concat(r," not found in propertyValues"));var a=t[r];switch(i){case"exact":return Array.isArray(n)?n.indexOf(a)!==-1:n===a;case"is_not":return Array.isArray(n)?n.indexOf(a)===-1:n!==a;case"is_set":return r in t;case"icontains":return String(a).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(a).toLowerCase().includes(String(n).toLowerCase());case"regex":return _Ql(String(n))&&String(a).match(String(n))!==null;case"not_regex":return _Ql(String(n))&&String(a).match(String(n))===null;case"gt":return typeof a==typeof n&&a>n;case"gte":return typeof a==typeof n&&a>=n;case"lt":return typeof a==typeof n&&a<n;case"lte":return typeof a==typeof n&&a<=n;case"is_date_after":case"is_date_before":var u=hQl(n),f=hQl(a);return i==="is_date_before"?f<u:f>u;default:return console.error("Unknown operator: ".concat(i)),!1}}function jQl(e,t,r){var n=String(e.value);if(!(n in r))throw new vQ("can't match cohort without a given cohort property value");var i=r[n];return wQl(i,t,r)}function wQl(e,t,r){if(!e)return!0;var n=e.type,i=e.values;if(!i||i.length===0)return!0;var a=!1;if("values"in i[0]){for(var u=0,f=i;u<f.length;u++){var d=f[u];try{var c=wQl(d,t,r);if(n==="AND"){if(!c)return!1}else if(c)return!0}catch(O){if(O instanceof vQ)console.debug("Failed to compute property ".concat(d," locally: ").concat(O)),a=!0;else throw O}}if(a)throw new vQ("Can't match cohort without a given cohort property value");return n==="AND"}else{for(var o=0,l=i;o<l.length;o++){var d=l[o];try{var c=void 0;d.type==="cohort"?c=jQl(d,t,r):c=PQl(d,t);var g=d.negation||!1;if(n==="AND"){if(!c&&!g||c&&g)return!1}else if(c&&!g||!c&&g)return!0}catch(j){if(j instanceof vQ)console.debug("Failed to compute property ".concat(d," locally: ").concat(j)),a=!0;else throw j}}if(a)throw new vQ("can't match cohort without a given cohort property value");return n==="AND"}}function _Ql(e){try{return new RegExp(e),!0}catch{return!1}}function hQl(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){var t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new vQ("".concat(e," is in an invalid date format"))}else throw new vQ("The date provided ".concat(e," must be a string, number, or date object"))}var pGP=30*1e3,_GP=50*1e3,qsa=function(e){mAn(t,e);function t(r,n){n===void 0&&(n={});var i=this,a;return n.captureMode=n?.captureMode||"json",i=e.call(this,r,n)||this,i._memoryStorage=new lGP,i.options=n,n.personalApiKey&&(i.featureFlagsPoller=new dGP({pollingInterval:typeof n.featureFlagsPollingInterval=="number"?n.featureFlagsPollingInterval:pGP,personalApiKey:n.personalApiKey,projectApiKey:r,timeout:(a=n.requestTimeout)!==null&&a!==void 0?a:1e4,host:i.host,fetch:n.fetch})),i.distinctIdHasSentFlagCalls={},i.maxCacheSize=n.maxCacheSize||_GP,i}return t.prototype.getPersistedProperty=function(r){return this._memoryStorage.getProperty(r)},t.prototype.setPersistedProperty=function(r,n){return this._memoryStorage.setProperty(r,n)},t.prototype.fetch=function(r,n){return this.options.fetch?this.options.fetch(r,n):OQl(r,n)},t.prototype.getLibraryId=function(){return"posthog-node"},t.prototype.getLibraryVersion=function(){return jko},t.prototype.getCustomUserAgent=function(){return"posthog-node/".concat(jko)},t.prototype.enable=function(){return e.prototype.optIn.call(this)},t.prototype.disable=function(){return e.prototype.optOut.call(this)},t.prototype.debug=function(r){var n;r===void 0&&(r=!0),e.prototype.debug.call(this,r),(n=this.featureFlagsPoller)===null||n===void 0||n.debug(r)},t.prototype.capture=function(r){var n=this,i=r.distinctId,a=r.event,u=r.properties,f=r.groups,d=r.sendFeatureFlags,c=r.timestamp,o=r.disableGeoip,l=function(g){e.prototype.captureStateless.call(n,i,a,g,{timestamp:c,disableGeoip:o})};d?e.prototype.getFeatureFlagsStateless.call(this,i,f,void 0,void 0,o).then(function(g){var O={};if(g)for(var j=0,S=Object.entries(g);j<S.length;j++){var T=S[j],C=T[0],I=T[1];I!==!1&&(O["$feature/".concat(C)]=I)}var N=Object.keys(g||{}).filter(function(U){return g?.[U]!==!1}),A=Bg({$active_feature_flags:N||void 0},O);l(Bg(Bg(Bg({},u),{$groups:f}),A))}):l(Bg(Bg({},u),{$groups:f}))},t.prototype.identify=function(r){var n=r.distinctId,i=r.properties,a=r.disableGeoip,u=i?.$set||i;e.prototype.identifyStateless.call(this,n,{$set:u},{disableGeoip:a})},t.prototype.alias=function(r){e.prototype.aliasStateless.call(this,r.alias,r.distinctId,void 0,{disableGeoip:r.disableGeoip})},t.prototype.getFeatureFlag=function(r,n,i){var a;return B2(this,void 0,void 0,function(){var u,f,d,c,o,l,g,O,j,S,T,C;return R2(this,function(I){switch(I.label){case 0:return u=i||{},f=u.groups,d=u.personProperties,c=u.groupProperties,o=u.disableGeoip,l=i||{},g=l.onlyEvaluateLocally,O=l.sendFeatureFlagEvents,g==null&&(g=!1),O==null&&(O=!0),[4,(a=this.featureFlagsPoller)===null||a===void 0?void 0:a.getFeatureFlag(r,n,f,d,c)];case 1:return j=I.sent(),S=j!==void 0,!S&&!g?[4,e.prototype.getFeatureFlagStateless.call(this,r,n,f,d,c,o)]:[3,3];case 2:j=I.sent(),I.label=3;case 3:return T="".concat(r,"_").concat(j),O&&(!(n in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[n].includes(T))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[n])?this.distinctIdHasSentFlagCalls[n].push(T):this.distinctIdHasSentFlagCalls[n]=[T],this.capture({distinctId:n,event:"$feature_flag_called",properties:(C={$feature_flag:r,$feature_flag_response:j,locally_evaluated:S},C["$feature/".concat(r)]=j,C),groups:f,disableGeoip:o})),[2,j]}})})},t.prototype.getFeatureFlagPayload=function(r,n,i,a){var u;return B2(this,void 0,void 0,function(){var f,d,c,o,l,g,O,j,S;return R2(this,function(T){switch(T.label){case 0:return f=a||{},d=f.groups,c=f.personProperties,o=f.groupProperties,l=f.disableGeoip,g=a||{},O=g.onlyEvaluateLocally,g.sendFeatureFlagEvents,j=void 0,i?[3,2]:[4,this.getFeatureFlag(r,n,Bg(Bg({},a),{onlyEvaluateLocally:!0}))];case 1:i=T.sent(),T.label=2;case 2:return i?[4,(u=this.featureFlagsPoller)===null||u===void 0?void 0:u.computeFeatureFlagPayloadLocally(r,i)]:[3,4];case 3:j=T.sent(),T.label=4;case 4:return O==null&&(O=!1),O==null&&(O=!1),S=j!==void 0,!S&&!O?[4,e.prototype.getFeatureFlagPayloadStateless.call(this,r,n,d,c,o,l)]:[3,6];case 5:j=T.sent(),T.label=6;case 6:try{return[2,JSON.parse(j)]}catch{return[2,j]}return[2]}})})},t.prototype.isFeatureEnabled=function(r,n,i){return B2(this,void 0,void 0,function(){var a;return R2(this,function(u){switch(u.label){case 0:return[4,this.getFeatureFlag(r,n,i)];case 1:return a=u.sent(),a===void 0?[2,void 0]:[2,!!a||!1]}})})},t.prototype.getAllFlags=function(r,n){return B2(this,void 0,void 0,function(){var i;return R2(this,function(a){switch(a.label){case 0:return[4,this.getAllFlagsAndPayloads(r,n)];case 1:return i=a.sent(),[2,i.featureFlags]}})})},t.prototype.getAllFlagsAndPayloads=function(r,n){var i;return B2(this,void 0,void 0,function(){var a,u,f,d,c,o,l,g,O,j,S;return R2(this,function(T){switch(T.label){case 0:return a=n||{},u=a.groups,f=a.personProperties,d=a.groupProperties,c=a.disableGeoip,o=(n||{}).onlyEvaluateLocally,o==null&&(o=!1),[4,(i=this.featureFlagsPoller)===null||i===void 0?void 0:i.getAllFlagsAndPayloads(r,u,f,d)];case 1:return l=T.sent(),g={},O={},j=!0,l&&(g=l.response,O=l.payloads,j=l.fallbackToDecide),j&&!o?[4,e.prototype.getFeatureFlagsAndPayloadsStateless.call(this,r,u,f,d,c)]:[3,3];case 2:S=T.sent(),g=Bg(Bg({},g),S.flags||{}),O=Bg(Bg({},O),S.payloads||{}),T.label=3;case 3:return[2,{featureFlags:g,featureFlagPayloads:O}]}})})},t.prototype.groupIdentify=function(r){var n=r.groupType,i=r.groupKey,a=r.properties,u=r.distinctId,f=r.disableGeoip;e.prototype.groupIdentifyStateless.call(this,n,i,a,{disableGeoip:f},u)},t.prototype.reloadFeatureFlags=function(){var r;return B2(this,void 0,void 0,function(){return R2(this,function(n){switch(n.label){case 0:return[4,(r=this.featureFlagsPoller)===null||r===void 0?void 0:r.loadFeatureFlags(!0)];case 1:return n.sent(),[2]}})})},t.prototype.shutdown=function(){this.shutdownAsync()},t.prototype.shutdownAsync=function(){var r;return B2(this,void 0,void 0,function(){return R2(this,function(n){return(r=this.featureFlagsPoller)===null||r===void 0||r.stopPoller(),[2,e.prototype.shutdownAsync.call(this)]})})},t}(mQl);var Asa=class{posthog;constructor({posthogApiKey:t}){this.posthog=new qsa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.45.0-rc8",usingAccessToken:!0}})}flush(){this.posthog.flush()}};var Lli=class{async sendEvent(){}async identify(){}async flush(){}};var OAn=require("fs/promises"),MQl=require("os"),xQl=require("path");var DQl=iu(require("crypto")),Nsa=new Uint8Array(256),Csa=Nsa.length;function Dko(){return Csa>Nsa.length-16&&(DQl.default.randomFillSync(Nsa),Csa=0),Nsa.slice(Csa,Csa+=16)}var yW=[];for(let e=0;e<256;++e)yW.push((e+256).toString(16).slice(1));function SQl(e,t=0){return yW[e[t+0]]+yW[e[t+1]]+yW[e[t+2]]+yW[e[t+3]]+"-"+yW[e[t+4]]+yW[e[t+5]]+"-"+yW[e[t+6]]+yW[e[t+7]]+"-"+yW[e[t+8]]+yW[e[t+9]]+"-"+yW[e[t+10]]+yW[e[t+11]]+yW[e[t+12]]+yW[e[t+13]]+yW[e[t+14]]+yW[e[t+15]]}var EQl=iu(require("crypto")),Sko={randomUUID:EQl.default.randomUUID};function hGP(e,t,r){if(Sko.randomUUID&&!t&&!e)return Sko.randomUUID();e=e||{};let n=e.random||(e.rng||Dko)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return SQl(n)}var rNr=hGP;var yGP="id",vGP=".fern",Uli=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qsa(r),this.userId=t==null?void 0:NGo(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.45.0-rc8",...t,...t.properties}})}flush(){this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=_f(O_.of((0,MQl.homedir)()),Ms.of(vGP),Ms.of(yGP));await Bh(t)||(await(0,OAn.mkdir)((0,xQl.dirname)(t),{recursive:!0}),await(0,OAn.writeFile)(t,rNr())),this.persistedDistinctId=(await(0,OAn.readFile)(t)).toString()}return this.persistedDistinctId}};var Eko;async function PAn(){return Eko==null&&(Eko=await bGP()),Eko}async function bGP(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Lli;let r=await ura();return r!=null?new Uli({token:r,posthogApiKey:e}):await ora()!=null?new Asa({posthogApiKey:e}):new Uli({token:void 0,posthogApiKey:e})}catch{return new Lli}}function Vli(e,t){return function(){return e.apply(t,arguments)}}var{toString:gGP}=Object.prototype,{getPrototypeOf:Tko}=Object,zsa=(e=>t=>{let r=gGP.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),zAt=e=>(e=e.toLowerCase(),t=>zsa(t)===e),Bsa=e=>t=>typeof t===e,{isArray:jAn}=Array,Wli=Bsa("undefined");function mGP(e){return e!==null&&!Wli(e)&&e.constructor!==null&&!Wli(e.constructor)&&fje(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var AQl=zAt("ArrayBuffer");function OGP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&AQl(e.buffer),t}var PGP=Bsa("string"),fje=Bsa("function"),CQl=Bsa("number"),Rsa=e=>e!==null&&typeof e=="object",jGP=e=>e===!0||e===!1,Isa=e=>{if(zsa(e)!=="object")return!1;let t=Tko(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wGP=zAt("Date"),DGP=zAt("File"),SGP=zAt("Blob"),EGP=zAt("FileList"),MGP=e=>Rsa(e)&&fje(e.pipe),xGP=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fje(e.append)&&((t=zsa(e))==="formdata"||t==="object"&&fje(e.toString)&&e.toString()==="[object FormData]"))},TGP=zAt("URLSearchParams"),[qGP,AGP,CGP,NGP]=["ReadableStream","Request","Response","Headers"].map(zAt),IGP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hli(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),jAn(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,f;for(n=0;n<u;n++)f=a[n],t.call(null,e[f],f,e)}}function NQl(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var iZr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IQl=e=>!Wli(e)&&e!==iZr;function xko(){let{caseless:e}=IQl(this)&&this||{},t={},r=(n,i)=>{let a=e&&NQl(t,i)||i;Isa(t[a])&&Isa(n)?t[a]=xko(t[a],n):Isa(n)?t[a]=xko({},n):jAn(n)?t[a]=n.slice():t[a]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Hli(arguments[n],r);return t}var zGP=(e,t,r,{allOwnKeys:n}={})=>(Hli(t,(i,a)=>{r&&fje(i)?e[a]=Vli(i,r):e[a]=i},{allOwnKeys:n}),e),BGP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),RGP=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},FGP=(e,t,r,n)=>{let i,a,u,f={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)u=i[a],(!n||n(u,e,t))&&!f[u]&&(t[u]=e[u],f[u]=!0);e=r!==!1&&Tko(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LGP=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},UGP=e=>{if(!e)return null;if(jAn(e))return e;let t=e.length;if(!CQl(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},VGP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Tko(Uint8Array)),WGP=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},HGP=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},JGP=zAt("HTMLFormElement"),GGP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),TQl=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),KGP=zAt("RegExp"),zQl=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Hli(r,(i,a)=>{let u;(u=t(i,a,e))!==!1&&(n[a]=u||i)}),Object.defineProperties(e,n)},$GP=e=>{zQl(e,(t,r)=>{if(fje(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fje(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},YGP=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return jAn(e)?n(e):n(String(e).split(t)),r},XGP=()=>{},QGP=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Mko="abcdefghijklmnopqrstuvwxyz",qQl="0123456789",BQl={DIGIT:qQl,ALPHA:Mko,ALPHA_DIGIT:Mko+Mko.toUpperCase()+qQl},ZGP=(e=16,t=BQl.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function kGP(e){return!!(e&&fje(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var eKP=e=>{let t=new Array(10),r=(n,i)=>{if(Rsa(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let a=jAn(n)?[]:{};return Hli(n,(u,f)=>{let d=r(u,i+1);!Wli(d)&&(a[f]=d)}),t[i]=void 0,a}}return n};return r(e,0)},tKP=zAt("AsyncFunction"),rKP=e=>e&&(Rsa(e)||fje(e))&&fje(e.then)&&fje(e.catch),RQl=((e,t)=>e?setImmediate:t?((r,n)=>(iZr.addEventListener("message",({source:i,data:a})=>{i===iZr&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),iZr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fje(iZr.postMessage)),nKP=typeof queueMicrotask<"u"?queueMicrotask.bind(iZr):typeof process<"u"&&process.nextTick||RQl,Hl={isArray:jAn,isArrayBuffer:AQl,isBuffer:mGP,isFormData:xGP,isArrayBufferView:OGP,isString:PGP,isNumber:CQl,isBoolean:jGP,isObject:Rsa,isPlainObject:Isa,isReadableStream:qGP,isRequest:AGP,isResponse:CGP,isHeaders:NGP,isUndefined:Wli,isDate:wGP,isFile:DGP,isBlob:SGP,isRegExp:KGP,isFunction:fje,isStream:MGP,isURLSearchParams:TGP,isTypedArray:VGP,isFileList:EGP,forEach:Hli,merge:xko,extend:zGP,trim:IGP,stripBOM:BGP,inherits:RGP,toFlatObject:FGP,kindOf:zsa,kindOfTest:zAt,endsWith:LGP,toArray:UGP,forEachEntry:WGP,matchAll:HGP,isHTMLForm:JGP,hasOwnProperty:TQl,hasOwnProp:TQl,reduceDescriptors:zQl,freezeMethods:$GP,toObjectSet:YGP,toCamelCase:GGP,noop:XGP,toFiniteNumber:QGP,findKey:NQl,global:iZr,isContextDefined:IQl,ALPHABET:BQl,generateString:ZGP,isSpecCompliantForm:kGP,toJSONObject:eKP,isAsyncFn:tKP,isThenable:rKP,setImmediate:RQl,asap:nKP};function wAn(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Hl.inherits(wAn,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:Hl.toJSONObject(this.config),code:this.code,status:this.status}}});var FQl=wAn.prototype,LQl={};["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=>{LQl[e]={value:e}});Object.defineProperties(wAn,LQl);Object.defineProperty(FQl,"isAxiosError",{value:!0});wAn.from=(e,t,r,n,i,a)=>{let u=Object.create(FQl);return Hl.toFlatObject(e,u,function(d){return d!==Error.prototype},f=>f!=="isAxiosError"),wAn.call(u,e.message,t,r,n,i),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var xy=wAn;var UQl=iu(wXr(),1),Fsa=UQl.default;function qko(e){return Hl.isPlainObject(e)||Hl.isArray(e)}function WQl(e){return Hl.endsWith(e,"[]")?e.slice(0,-2):e}function VQl(e,t,r){return e?e.concat(t).map(function(i,a){return i=WQl(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function iKP(e){return Hl.isArray(e)&&!e.some(qko)}var aKP=Hl.toFlatObject(Hl,{},null,function(t){return/^is[A-Z]/.test(t)});function oKP(e,t,r){if(!Hl.isObject(e))throw new TypeError("target must be an object");t=t||new(Fsa||FormData),r=Hl.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,T){return!Hl.isUndefined(T[S])});let n=r.metaTokens,i=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Hl.isSpecCompliantForm(t);if(!Hl.isFunction(i))throw new TypeError("visitor must be a function");function c(j){if(j===null)return"";if(Hl.isDate(j))return j.toISOString();if(!d&&Hl.isBlob(j))throw new xy("Blob is not supported. Use a Buffer instead.");return Hl.isArrayBuffer(j)||Hl.isTypedArray(j)?d&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function o(j,S,T){let C=j;if(j&&!T&&typeof j=="object"){if(Hl.endsWith(S,"{}"))S=n?S:S.slice(0,-2),j=JSON.stringify(j);else if(Hl.isArray(j)&&iKP(j)||(Hl.isFileList(j)||Hl.endsWith(S,"[]"))&&(C=Hl.toArray(j)))return S=WQl(S),C.forEach(function(N,A){!(Hl.isUndefined(N)||N===null)&&t.append(u===!0?VQl([S],A,a):u===null?S:S+"[]",c(N))}),!1}return qko(j)?!0:(t.append(VQl(T,S,a),c(j)),!1)}let l=[],g=Object.assign(aKP,{defaultVisitor:o,convertValue:c,isVisitable:qko});function O(j,S){if(!Hl.isUndefined(j)){if(l.indexOf(j)!==-1)throw Error("Circular reference detected in "+S.join("."));l.push(j),Hl.forEach(j,function(C,I){(!(Hl.isUndefined(C)||C===null)&&i.call(t,C,Hl.isString(I)?I.trim():I,S,g))===!0&&O(C,S?S.concat(I):[I])}),l.pop()}}if(!Hl.isObject(e))throw new TypeError("data must be an object");return O(e),t}var nNr=oKP;function HQl(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function JQl(e,t){this._pairs=[],e&&nNr(e,this,t)}var GQl=JQl.prototype;GQl.append=function(t,r){this._pairs.push([t,r])};GQl.toString=function(t){let r=t?function(n){return t.call(this,n,HQl)}:HQl;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var KQl=JQl;function uKP(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function aZr(e,t,r){if(!t)return e;let n=r&&r.encode||uKP,i=r&&r.serialize,a;if(i?a=i(t,r):a=Hl.isURLSearchParams(t)?t.toString():new KQl(t,r).toString(n),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Ako=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Hl.forEach(this.handlers,function(n){n!==null&&t(n)})}},Cko=Ako;var DAn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var $Ql=iu(require("url"),1),YQl=$Ql.default.URLSearchParams;var XQl={isNode:!0,classes:{URLSearchParams:YQl,FormData:Fsa,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var zko={};td(zko,{hasBrowserEnv:()=>Iko,hasStandardBrowserEnv:()=>sKP,hasStandardBrowserWebWorkerEnv:()=>cKP,navigator:()=>Nko,origin:()=>lKP});var Iko=typeof window<"u"&&typeof document<"u",Nko=typeof navigator=="object"&&navigator||void 0,sKP=Iko&&(!Nko||["ReactNative","NativeScript","NS"].indexOf(Nko.product)<0),cKP=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",lKP=Iko&&window.location.href||"http://localhost";var wC={...zko,...XQl};function Bko(e,t){return nNr(e,new wC.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,a){return wC.isNode&&Hl.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function fKP(e){return Hl.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dKP(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function pKP(e){function t(r,n,i,a){let u=r[a++];if(u==="__proto__")return!0;let f=Number.isFinite(+u),d=a>=r.length;return u=!u&&Hl.isArray(i)?i.length:u,d?(Hl.hasOwnProp(i,u)?i[u]=[i[u],n]:i[u]=n,!f):((!i[u]||!Hl.isObject(i[u]))&&(i[u]=[]),t(r,n,i[u],a)&&Hl.isArray(i[u])&&(i[u]=dKP(i[u])),!f)}if(Hl.isFormData(e)&&Hl.isFunction(e.entries)){let r={};return Hl.forEachEntry(e,(n,i)=>{t(fKP(n),i,r,0)}),r}return null}var Lsa=pKP;function _KP(e,t,r){if(Hl.isString(e))try{return(t||JSON.parse)(e),Hl.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Rko={transitional:DAn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Hl.isObject(t);if(a&&Hl.isHTMLForm(t)&&(t=new FormData(t)),Hl.isFormData(t))return i?JSON.stringify(Lsa(t)):t;if(Hl.isArrayBuffer(t)||Hl.isBuffer(t)||Hl.isStream(t)||Hl.isFile(t)||Hl.isBlob(t)||Hl.isReadableStream(t))return t;if(Hl.isArrayBufferView(t))return t.buffer;if(Hl.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let f;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Bko(t,this.formSerializer).toString();if((f=Hl.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return nNr(f?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),_KP(t)):t}],transformResponse:[function(t){let r=this.transitional||Rko.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Hl.isResponse(t)||Hl.isReadableStream(t))return t;if(t&&Hl.isString(t)&&(n&&!this.responseType||i)){let u=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(f){if(u)throw f.name==="SyntaxError"?xy.from(f,xy.ERR_BAD_RESPONSE,this,null,this.response):f}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:wC.classes.FormData,Blob:wC.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hl.forEach(["delete","get","head","post","put","patch"],e=>{Rko.headers[e]={}});var SAn=Rko;var hKP=Hl.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"]),QQl=e=>{let t={},r,n,i;return e&&e.split(`
1761
1762
  `).forEach(function(u){i=u.indexOf(":"),r=u.substring(0,i).trim().toLowerCase(),n=u.substring(i+1).trim(),!(!r||t[r]&&hKP[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var ZQl=Symbol("internals");function Jli(e){return e&&String(e).trim().toLowerCase()}function Usa(e){return e===!1||e==null?e:Hl.isArray(e)?e.map(Usa):String(e)}function yKP(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var vKP=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Fko(e,t,r,n,i){if(Hl.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Hl.isString(t)){if(Hl.isString(n))return t.indexOf(n)!==-1;if(Hl.isRegExp(n))return n.test(t)}}function bKP(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function gKP(e,t){let r=Hl.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,u){return this[n].call(this,t,i,a,u)},configurable:!0})})}var EAn=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(f,d,c){let o=Jli(d);if(!o)throw new Error("header name must be a non-empty string");let l=Hl.findKey(i,o);(!l||i[l]===void 0||c===!0||c===void 0&&i[l]!==!1)&&(i[l||d]=Usa(f))}let u=(f,d)=>Hl.forEach(f,(c,o)=>a(c,o,d));if(Hl.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(Hl.isString(t)&&(t=t.trim())&&!vKP(t))u(QQl(t),r);else if(Hl.isHeaders(t))for(let[f,d]of t.entries())a(d,f,n);else t!=null&&a(r,t,n);return this}get(t,r){if(t=Jli(t),t){let n=Hl.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return yKP(i);if(Hl.isFunction(r))return r.call(this,i,n);if(Hl.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Jli(t),t){let n=Hl.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Fko(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(u){if(u=Jli(u),u){let f=Hl.findKey(n,u);f&&(!r||Fko(n,n[f],f,r))&&(delete n[f],i=!0)}}return Hl.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||Fko(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Hl.forEach(this,(i,a)=>{let u=Hl.findKey(n,a);if(u){r[u]=Usa(i),delete r[a];return}let f=t?bKP(a):String(a).trim();f!==a&&delete r[a],r[f]=Usa(i),n[f]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Hl.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Hl.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1762
1763
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[ZQl]=this[ZQl]={accessors:{}}).accessors,i=this.prototype;function a(u){let f=Jli(u);n[f]||(gKP(i,u),n[f]=!0)}return Hl.isArray(t)?t.forEach(a):a(t),this}};EAn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Hl.reduceDescriptors(EAn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Hl.freezeMethods(EAn);var T3=EAn;function Gli(e,t){let r=this||SAn,n=t||r,i=T3.from(n.headers),a=n.data;return Hl.forEach(e,function(f){a=f.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Kli(e){return!!(e&&e.__CANCEL__)}function kQl(e,t,r){xy.call(this,e??"canceled",xy.ERR_CANCELED,t,r),this.name="CanceledError"}Hl.inherits(kQl,xy,{__CANCEL__:!0});var dje=kQl;function _Bt(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new xy("Request failed with status code "+r.status,[xy.ERR_BAD_REQUEST,xy.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Lko(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Uko(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function oZr(e,t){return e&&!Lko(t)?Uko(e,t):t}var vZl=iu(tZl(),1),bZl=iu(require("http"),1),gZl=iu(require("https"),1),mZl=iu(require("util"),1),OZl=iu(Wta(),1),Gwr=iu(require("zlib"),1);var uZr="1.7.7";function $li(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var DKP=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Vko(e,t,r){let n=r&&r.Blob||wC.classes.Blob,i=$li(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=DKP.exec(e);if(!a)throw new xy("Invalid URL",xy.ERR_INVALID_URL);let u=a[1],f=a[2],d=a[3],c=Buffer.from(decodeURIComponent(d),f?"base64":"utf8");if(t){if(!n)throw new xy("Blob is not supported",xy.ERR_NOT_SUPPORT);return new n([c],{type:u})}return c}throw new xy("Unsupported protocol "+i,xy.ERR_NOT_SUPPORT)}var sZr=iu(require("stream"),1);var rZl=iu(require("stream"),1);var Wko=Symbol("internals"),Hko=class extends rZl.default.Transform{constructor(t){t=Hl.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Hl.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[Wko]={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",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[Wko];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[Wko],a=i.maxRate,u=this.readableHighWaterMark,f=i.timeWindow,d=1e3/f,c=a/d,o=i.minChunkSize!==!1?Math.max(i.minChunkSize,c*.01):0,l=(O,j)=>{let S=Buffer.byteLength(O);i.bytesSeen+=S,i.bytes+=S,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(O)?process.nextTick(j):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(j)}},g=(O,j)=>{let S=Buffer.byteLength(O),T=null,C=u,I,N=0;if(a){let A=Date.now();(!i.ts||(N=A-i.ts)>=f)&&(i.ts=A,I=c-i.bytes,i.bytes=I<0?-I:0,N=0),I=c-i.bytes}if(a){if(I<=0)return setTimeout(()=>{j(null,O)},f-N);I<C&&(C=I)}C&&S>C&&S-C>o&&(T=O.subarray(C),O=O.subarray(0,C)),l(O,T?()=>{process.nextTick(j,null,T)}:j)};g(t,function O(j,S){if(j)return n(j);S?g(S,O):n(null)})}},Jko=Hko;var PZl=require("events");var iZl=require("util"),aZl=require("stream");var{asyncIterator:nZl}=Symbol,SKP=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[nZl]?yield*e[nZl]():yield e},Vsa=SKP;var EKP=Hl.ALPHABET.ALPHA_DIGIT+"-_",Yli=new iZl.TextEncoder,iNr=`\r
1763
1764
  `,MKP=Yli.encode(iNr),xKP=2,Gko=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Hl.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${iNr}`;i?r=Yli.encode(String(r).replace(/\r?\n|\r\n?/g,iNr)):a+=`Content-Type: ${r.type||"application/octet-stream"}${iNr}`,this.headers=Yli.encode(a+iNr),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+xKP,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Hl.isTypedArray(t)?yield t:yield*Vsa(t),yield MKP}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},TKP=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+Hl.generateString(i,EKP)}=r||{};if(!Hl.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=Yli.encode("--"+a+iNr),f=Yli.encode("--"+a+"--"+iNr+iNr),d=f.byteLength,c=Array.from(e.entries()).map(([l,g])=>{let O=new Gko(l,g);return d+=O.size,O});d+=u.byteLength*c.length,d=Hl.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),aZl.Readable.from(async function*(){for(let l of c)yield u,yield*l.encode();yield f}())},oZl=TKP;var uZl=iu(require("stream"),1),Kko=class extends uZl.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},sZl=Kko;var qKP=(e,t)=>Hl.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,cZl=qKP;function AKP(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let c=Date.now(),o=n[a];u||(u=c),r[i]=d,n[i]=c;let l=a,g=0;for(;l!==i;)g+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-u<t)return;let O=o&&c-o;return O?Math.round(g*1e3/O):void 0}}var lZl=AKP;function CKP(e,t){let r=0,n=1e3/t,i,a,u=(c,o=Date.now())=>{r=o,i=null,a&&(clearTimeout(a),a=null),e.apply(null,c)};return[(...c)=>{let o=Date.now(),l=o-r;l>=n?u(c,o):(i=c,a||(a=setTimeout(()=>{a=null,u(i)},n-l)))},()=>i&&u(i)]}var fZl=CKP;var Jwr=(e,t,r=3)=>{let n=0,i=lZl(50,250);return fZl(a=>{let u=a.loaded,f=a.lengthComputable?a.total:void 0,d=u-n,c=i(d),o=u<=f;n=u;let l={loaded:u,total:f,progress:f?u/f:void 0,bytes:d,rate:c||void 0,estimated:c&&f&&o?(f-u)/c:void 0,event:a,lengthComputable:f!=null,[t?"download":"upload"]:!0};e(l)},r)},xAn=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},TAn=e=>(...t)=>Hl.asap(()=>e(...t));var dZl={flush:Gwr.default.constants.Z_SYNC_FLUSH,finishFlush:Gwr.default.constants.Z_SYNC_FLUSH},NKP={flush:Gwr.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Gwr.default.constants.BROTLI_OPERATION_FLUSH},pZl=Hl.isFunction(Gwr.default.createBrotliDecompress),{http:IKP,https:zKP}=OZl.default,BKP=/https:?/,_Zl=wC.protocols.map(e=>e+":"),hZl=(e,[t,r])=>(e.on("end",r).on("error",r),t);function RKP(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function jZl(e,t,r){let n=t;if(!n&&n!==!1){let i=(0,vZl.getProxyForUrl)(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){jZl(a,t,a.href)}}var FKP=typeof process<"u"&&Hl.kindOf(process)==="process",LKP=e=>new Promise((t,r)=>{let n,i,a=(d,c)=>{i||(i=!0,n&&n(d,c))},u=d=>{a(d),t(d)},f=d=>{a(d,!0),r(d)};e(u,f,d=>n=d).catch(f)}),UKP=({address:e,family:t})=>{if(!Hl.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},yZl=(e,t)=>UKP(Hl.isObject(e)?e:{address:e,family:t}),wZl=FKP&&function(t){return LKP(async function(n,i,a){let{data:u,lookup:f,family:d}=t,{responseType:c,responseEncoding:o}=t,l=t.method.toUpperCase(),g,O=!1,j;if(f){let ur=cZl(f,jr=>Hl.isArray(jr)?jr:[jr]);f=(jr,Vr,Nt)=>{ur(jr,Vr,(lr,Hr,Kt)=>{if(lr)return Nt(lr);let wn=Hl.isArray(Hr)?Hr.map(xn=>yZl(xn)):[yZl(Hr,Kt)];Vr.all?Nt(lr,wn):Nt(lr,wn[0].address,wn[0].family)})}}let S=new PZl.EventEmitter,T=()=>{t.cancelToken&&t.cancelToken.unsubscribe(C),t.signal&&t.signal.removeEventListener("abort",C),S.removeAllListeners()};a((ur,jr)=>{g=!0,jr&&(O=!0,T())});function C(ur){S.emit("abort",!ur||ur.type?new dje(null,t,j):ur)}S.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(C),t.signal&&(t.signal.aborted?C():t.signal.addEventListener("abort",C)));let I=oZr(t.baseURL,t.url),N=new URL(I,wC.hasBrowserEnv?wC.origin:void 0),A=N.protocol||_Zl[0];if(A==="data:"){let ur;if(l!=="GET")return _Bt(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{ur=Vko(t.url,c==="blob",{Blob:t.env&&t.env.Blob})}catch(jr){throw xy.from(jr,xy.ERR_BAD_REQUEST,t)}return c==="text"?(ur=ur.toString(o),(!o||o==="utf8")&&(ur=Hl.stripBOM(ur))):c==="stream"&&(ur=sZr.default.Readable.from(ur)),_Bt(n,i,{data:ur,status:200,statusText:"OK",headers:new T3,config:t})}if(_Zl.indexOf(A)===-1)return i(new xy("Unsupported protocol "+A,xy.ERR_BAD_REQUEST,t));let U=T3.from(t.headers).normalize();U.set("User-Agent","axios/"+uZr,!1);let{onUploadProgress:X,onDownloadProgress:ue}=t,G=t.maxRate,$,re;if(Hl.isSpecCompliantForm(u)){let ur=U.getContentType(/boundary=([-_\w\d]{10,70})/i);u=oZl(u,jr=>{U.set(jr)},{tag:`axios-${uZr}-boundary`,boundary:ur&&ur[1]||void 0})}else if(Hl.isFormData(u)&&Hl.isFunction(u.getHeaders)){if(U.set(u.getHeaders()),!U.hasContentLength())try{let ur=await mZl.default.promisify(u.getLength).call(u);Number.isFinite(ur)&&ur>=0&&U.setContentLength(ur)}catch{}}else if(Hl.isBlob(u))u.size&&U.setContentType(u.type||"application/octet-stream"),U.setContentLength(u.size||0),u=sZr.default.Readable.from(Vsa(u));else if(u&&!Hl.isStream(u)){if(!Buffer.isBuffer(u))if(Hl.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(Hl.isString(u))u=Buffer.from(u,"utf-8");else return i(new xy("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",xy.ERR_BAD_REQUEST,t));if(U.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return i(new xy("Request body larger than maxBodyLength limit",xy.ERR_BAD_REQUEST,t))}let et=Hl.toFiniteNumber(U.getContentLength());Hl.isArray(G)?($=G[0],re=G[1]):$=re=G,u&&(X||$)&&(Hl.isStream(u)||(u=sZr.default.Readable.from(u,{objectMode:!1})),u=sZr.default.pipeline([u,new Jko({maxRate:Hl.toFiniteNumber($)})],Hl.noop),X&&u.on("progress",hZl(u,xAn(et,Jwr(TAn(X),!1,3)))));let Ve;if(t.auth){let ur=t.auth.username||"",jr=t.auth.password||"";Ve=ur+":"+jr}if(!Ve&&N.username){let ur=N.username,jr=N.password;Ve=ur+":"+jr}Ve&&U.delete("authorization");let Dt;try{Dt=aZr(N.pathname+N.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(ur){let jr=new Error(ur.message);return jr.config=t,jr.url=t.url,jr.exists=!0,i(jr)}U.set("Accept-Encoding","gzip, compress, deflate"+(pZl?", br":""),!1);let At={path:Dt,method:l,headers:U.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Ve,protocol:A,family:d,beforeRedirect:RKP,beforeRedirects:{}};!Hl.isUndefined(f)&&(At.lookup=f),t.socketPath?At.socketPath=t.socketPath:(At.hostname=N.hostname.startsWith("[")?N.hostname.slice(1,-1):N.hostname,At.port=N.port,jZl(At,t.proxy,A+"//"+N.hostname+(N.port?":"+N.port:"")+At.path));let Wt,It=BKP.test(At.protocol);if(At.agent=It?t.httpsAgent:t.httpAgent,t.transport?Wt=t.transport:t.maxRedirects===0?Wt=It?gZl.default:bZl.default:(t.maxRedirects&&(At.maxRedirects=t.maxRedirects),t.beforeRedirect&&(At.beforeRedirects.config=t.beforeRedirect),Wt=It?zKP:IKP),t.maxBodyLength>-1?At.maxBodyLength=t.maxBodyLength:At.maxBodyLength=1/0,t.insecureHTTPParser&&(At.insecureHTTPParser=t.insecureHTTPParser),j=Wt.request(At,function(jr){if(j.destroyed)return;let Vr=[jr],Nt=+jr.headers["content-length"];if(ue||re){let xn=new Jko({maxRate:Hl.toFiniteNumber(re)});ue&&xn.on("progress",hZl(xn,xAn(Nt,Jwr(TAn(ue),!0,3)))),Vr.push(xn)}let lr=jr,Hr=jr.req||j;if(t.decompress!==!1&&jr.headers["content-encoding"])switch((l==="HEAD"||jr.statusCode===204)&&delete jr.headers["content-encoding"],(jr.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Vr.push(Gwr.default.createUnzip(dZl)),delete jr.headers["content-encoding"];break;case"deflate":Vr.push(new sZl),Vr.push(Gwr.default.createUnzip(dZl)),delete jr.headers["content-encoding"];break;case"br":pZl&&(Vr.push(Gwr.default.createBrotliDecompress(NKP)),delete jr.headers["content-encoding"])}lr=Vr.length>1?sZr.default.pipeline(Vr,Hl.noop):Vr[0];let Kt=sZr.default.finished(lr,()=>{Kt(),T()}),wn={status:jr.statusCode,statusText:jr.statusMessage,headers:new T3(jr.headers),config:t,request:Hr};if(c==="stream")wn.data=lr,_Bt(n,i,wn);else{let xn=[],Ht=0;lr.on("data",function(pn){xn.push(pn),Ht+=pn.length,t.maxContentLength>-1&&Ht>t.maxContentLength&&(O=!0,lr.destroy(),i(new xy("maxContentLength size of "+t.maxContentLength+" exceeded",xy.ERR_BAD_RESPONSE,t,Hr)))}),lr.on("aborted",function(){if(O)return;let pn=new xy("maxContentLength size of "+t.maxContentLength+" exceeded",xy.ERR_BAD_RESPONSE,t,Hr);lr.destroy(pn),i(pn)}),lr.on("error",function(pn){j.destroyed||i(xy.from(pn,null,t,Hr))}),lr.on("end",function(){try{let pn=xn.length===1?xn[0]:Buffer.concat(xn);c!=="arraybuffer"&&(pn=pn.toString(o),(!o||o==="utf8")&&(pn=Hl.stripBOM(pn))),wn.data=pn}catch(pn){return i(xy.from(pn,null,t,wn.request,wn))}_Bt(n,i,wn)})}S.once("abort",xn=>{lr.destroyed||(lr.emit("error",xn),lr.destroy())})}),S.once("abort",ur=>{i(ur),j.destroy(ur)}),j.on("error",function(jr){i(xy.from(jr,null,t,j))}),j.on("socket",function(jr){jr.setKeepAlive(!0,1e3*60)}),t.timeout){let ur=parseInt(t.timeout,10);if(Number.isNaN(ur)){i(new xy("error trying to parse `config.timeout` to int",xy.ERR_BAD_OPTION_VALUE,t,j));return}j.setTimeout(ur,function(){if(g)return;let Vr=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Nt=t.transitional||DAn;t.timeoutErrorMessage&&(Vr=t.timeoutErrorMessage),i(new xy(Vr,Nt.clarifyTimeoutError?xy.ETIMEDOUT:xy.ECONNABORTED,t,j)),C()})}if(Hl.isStream(u)){let ur=!1,jr=!1;u.on("end",()=>{ur=!0}),u.once("error",Vr=>{jr=!0,j.destroy(Vr)}),u.on("close",()=>{!ur&&!jr&&C(new dje("Request stream has been aborted",t,j))}),u.pipe(j)}else j.end(u)})};var DZl=wC.hasStandardBrowserEnv?function(){let t=wC.navigator&&/(msie|trident)/i.test(wC.navigator.userAgent),r=document.createElement("a"),n;function i(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 n=i(window.location.href),function(u){let f=Hl.isString(u)?i(u):u;return f.protocol===n.protocol&&f.host===n.host}}():function(){return function(){return!0}}();var SZl=wC.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let u=[e+"="+encodeURIComponent(t)];Hl.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),Hl.isString(n)&&u.push("path="+n),Hl.isString(i)&&u.push("domain="+i),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 EZl=e=>e instanceof T3?{...e}:e;function BAt(e,t){t=t||{};let r={};function n(c,o,l){return Hl.isPlainObject(c)&&Hl.isPlainObject(o)?Hl.merge.call({caseless:l},c,o):Hl.isPlainObject(o)?Hl.merge({},o):Hl.isArray(o)?o.slice():o}function i(c,o,l){if(Hl.isUndefined(o)){if(!Hl.isUndefined(c))return n(void 0,c,l)}else return n(c,o,l)}function a(c,o){if(!Hl.isUndefined(o))return n(void 0,o)}function u(c,o){if(Hl.isUndefined(o)){if(!Hl.isUndefined(c))return n(void 0,c)}else return n(void 0,o)}function f(c,o,l){if(l in t)return n(c,o);if(l in e)return n(void 0,c)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:f,headers:(c,o)=>i(EZl(c),EZl(o),!0)};return Hl.forEach(Object.keys(Object.assign({},e,t)),function(o){let l=d[o]||i,g=l(e[o],t[o],o);Hl.isUndefined(g)&&l!==f||(r[o]=g)}),r}var Wsa=e=>{let t=BAt({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:u,auth:f}=t;t.headers=u=T3.from(u),t.url=aZr(oZr(t.baseURL,t.url),e.params,e.paramsSerializer),f&&u.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):"")));let d;if(Hl.isFormData(r)){if(wC.hasStandardBrowserEnv||wC.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[c,...o]=d?d.split(";").map(l=>l.trim()).filter(Boolean):[];u.setContentType([c||"multipart/form-data",...o].join("; "))}}if(wC.hasStandardBrowserEnv&&(n&&Hl.isFunction(n)&&(n=n(t)),n||n!==!1&&DZl(t.url))){let c=i&&a&&SZl.read(a);c&&u.set(i,c)}return t};var VKP=typeof XMLHttpRequest<"u",MZl=VKP&&function(e){return new Promise(function(r,n){let i=Wsa(e),a=i.data,u=T3.from(i.headers).normalize(),{responseType:f,onUploadProgress:d,onDownloadProgress:c}=i,o,l,g,O,j;function S(){O&&O(),j&&j(),i.cancelToken&&i.cancelToken.unsubscribe(o),i.signal&&i.signal.removeEventListener("abort",o)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function C(){if(!T)return;let N=T3.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),U={data:!f||f==="text"||f==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:N,config:e,request:T};_Bt(function(ue){r(ue),S()},function(ue){n(ue),S()},U),T=null}"onloadend"in T?T.onloadend=C:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(C)},T.onabort=function(){T&&(n(new xy("Request aborted",xy.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new xy("Network Error",xy.ERR_NETWORK,e,T)),T=null},T.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",U=i.transitional||DAn;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),n(new xy(A,U.clarifyTimeoutError?xy.ETIMEDOUT:xy.ECONNABORTED,e,T)),T=null},a===void 0&&u.setContentType(null),"setRequestHeader"in T&&Hl.forEach(u.toJSON(),function(A,U){T.setRequestHeader(U,A)}),Hl.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),f&&f!=="json"&&(T.responseType=i.responseType),c&&([g,j]=Jwr(c,!0),T.addEventListener("progress",g)),d&&T.upload&&([l,O]=Jwr(d),T.upload.addEventListener("progress",l),T.upload.addEventListener("loadend",O)),(i.cancelToken||i.signal)&&(o=N=>{T&&(n(!N||N.type?new dje(null,e,T):N),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(o),i.signal&&(i.signal.aborted?o():i.signal.addEventListener("abort",o)));let I=$li(i.url);if(I&&wC.protocols.indexOf(I)===-1){n(new xy("Unsupported protocol "+I+":",xy.ERR_BAD_REQUEST,e));return}T.send(a||null)})};var WKP=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(c){if(!i){i=!0,f();let o=c instanceof Error?c:this.reason;n.abort(o instanceof xy?o:new dje(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new xy(`timeout ${t} of ms exceeded`,xy.ETIMEDOUT))},t),f=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>c.addEventListener("abort",a));let{signal:d}=n;return d.unsubscribe=()=>Hl.asap(f),d}},xZl=WKP;var HKP=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},JKP=async function*(e,t){for await(let r of GKP(e))yield*HKP(r,t)},GKP=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},$ko=(e,t,r,n)=>{let i=JKP(e,t),a=0,u,f=d=>{u||(u=!0,n&&n(d))};return new ReadableStream({async pull(d){try{let{done:c,value:o}=await i.next();if(c){f(),d.close();return}let l=o.byteLength;if(r){let g=a+=l;r(g)}d.enqueue(new Uint8Array(o))}catch(c){throw f(c),c}},cancel(d){return f(d),i.return()}},{highWaterMark:2})};var Jsa=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",qZl=Jsa&&typeof ReadableStream=="function",KKP=Jsa&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),AZl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$KP=qZl&&AZl(()=>{let e=!1,t=new Request(wC.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),TZl=64*1024,Yko=qZl&&AZl(()=>Hl.isReadableStream(new Response("").body)),Hsa={stream:Yko&&(e=>e.body)};Jsa&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Hsa[t]&&(Hsa[t]=Hl.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new xy(`Response type '${t}' is not supported`,xy.ERR_NOT_SUPPORT,n)})})})(new Response);var YKP=async e=>{if(e==null)return 0;if(Hl.isBlob(e))return e.size;if(Hl.isSpecCompliantForm(e))return(await new Request(wC.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Hl.isArrayBufferView(e)||Hl.isArrayBuffer(e))return e.byteLength;if(Hl.isURLSearchParams(e)&&(e=e+""),Hl.isString(e))return(await KKP(e)).byteLength},XKP=async(e,t)=>{let r=Hl.toFiniteNumber(e.getContentLength());return r??YKP(t)},CZl=Jsa&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:a,timeout:u,onDownloadProgress:f,onUploadProgress:d,responseType:c,headers:o,withCredentials:l="same-origin",fetchOptions:g}=Wsa(e);c=c?(c+"").toLowerCase():"text";let O=xZl([i,a&&a.toAbortSignal()],u),j,S=O&&O.unsubscribe&&(()=>{O.unsubscribe()}),T;try{if(d&&$KP&&r!=="get"&&r!=="head"&&(T=await XKP(o,n))!==0){let U=new Request(t,{method:"POST",body:n,duplex:"half"}),X;if(Hl.isFormData(n)&&(X=U.headers.get("content-type"))&&o.setContentType(X),U.body){let[ue,G]=xAn(T,Jwr(TAn(d)));n=$ko(U.body,TZl,ue,G)}}Hl.isString(l)||(l=l?"include":"omit");let C="credentials"in Request.prototype;j=new Request(t,{...g,signal:O,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:n,duplex:"half",credentials:C?l:void 0});let I=await fetch(j),N=Yko&&(c==="stream"||c==="response");if(Yko&&(f||N&&S)){let U={};["status","statusText","headers"].forEach($=>{U[$]=I[$]});let X=Hl.toFiniteNumber(I.headers.get("content-length")),[ue,G]=f&&xAn(X,Jwr(TAn(f),!0))||[];I=new Response($ko(I.body,TZl,ue,()=>{G&&G(),S&&S()}),U)}c=c||"text";let A=await Hsa[Hl.findKey(Hsa,c)||"text"](I,e);return!N&&S&&S(),await new Promise((U,X)=>{_Bt(U,X,{data:A,headers:T3.from(I.headers),status:I.status,statusText:I.statusText,config:e,request:j})})}catch(C){throw S&&S(),C&&C.name==="TypeError"&&/fetch/i.test(C.message)?Object.assign(new xy("Network Error",xy.ERR_NETWORK,e,j),{cause:C.cause||C}):xy.from(C,C&&C.code,e,j)}});var Xko={http:wZl,xhr:MZl,fetch:CZl};Hl.forEach(Xko,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var NZl=e=>`- ${e}`,QKP=e=>Hl.isFunction(e)||e===null||e===!1,Gsa={getAdapter:e=>{e=Hl.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let a=0;a<t;a++){r=e[a];let u;if(n=r,!QKP(r)&&(n=Xko[(u=String(r)).toLowerCase()],n===void 0))throw new xy(`Unknown adapter '${u}'`);if(n)break;i[u||"#"+a]=n}if(!n){let a=Object.entries(i).map(([f,d])=>`adapter ${f} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
@@ -1880,7 +1881,7 @@ errors:
1880
1881
  Run ${rl.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
1881
1882
  Run ${rl.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),AAn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function $ru({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!mif(e))return;let i=t??"",a=e.filter(f=>f.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((f,d)=>f.generatorName.localeCompare(d.generatorName)||f.currentVersion.localeCompare(d.currentVersion));for(let f of u)i+=`
1882
1883
  ${await _i1(f.generatorName)} (${f.apiName!=null?"API: "+f.apiName+", ":""}Group: ${f.generatorGroup}) `+rl.dim(f.currentVersion)+rl.reset(" \u2192 ")+rl.green(f.latestVersion);return i+=`
1883
- `,n?AAn(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function _i1(e){let r=await new gif.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 hi1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=rP.getGeneratorNameOrThrow(o.name,l),O=await rP.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=rP.getGeneratorNameOrThrow(c.name,o),g=await rP.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await rP.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function jif(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=cne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function rla({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await hi1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...jif(c,d,t.logger));else u.push(...jif(f.versions,void 0,t.logger))}return u}var Nfi=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var oCn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var uCn=e=>e!==null&&typeof e=="object";var Ifi=(...e)=>{for(let t of e)if((!uCn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Qru({},...e)},Yru=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function nla(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Qru(e[r]??[],t[r]??[])}var Xru=(e={},t={})=>({beforeRequest:nla(e,t,"beforeRequest"),beforeRetry:nla(e,t,"beforeRetry"),afterResponse:nla(e,t,"afterResponse"),beforeError:nla(e,t,"beforeError")}),Qru=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(uCn(i)){for(let[a,u]of Object.entries(i))uCn(u)&&a in t&&(u=Qru(t[a],u)),t={...t,[a]:u};uCn(i.hooks)&&(n=Xru(n,i.hooks),t.hooks=n),uCn(i.headers)&&(r=Yru(r,i.headers),t.headers=r)}return t};var wif=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),Dif=typeof globalThis.AbortController=="function",Sif=typeof globalThis.ReadableStream=="function",Eif=typeof globalThis.FormData=="function",ila=["get","post","put","patch","head","delete"],yi1=()=>{};yi1();var Mif={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},ala=2147483647,ola=Symbol("stop"),xif={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},Tif={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 Aif=e=>ila.includes(e)?e.toUpperCase():e,vi1=["get","put","head","delete","options","trace"],bi1=[408,413,429,500,502,503,504],gi1=[413,429,503],qif={limit:2,methods:vi1,statusCodes:bi1,afterStatusCodes:gi1,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Cif=(e={})=>{if(typeof e=="number")return{...qif,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{...qif,...e}};async function Zru(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new oCn(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function kru(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var Nif=(e,t)=>{let r={};for(let n in t)!(n in Tif)&&!(n in xif)&&!(n in e)&&(r[n]=t[n]);return r};var zfi=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>ala)throw new RangeError(`The \`timeout\` option cannot be greater than ${ala}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new Nfi(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Sif)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(Mif))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Yru(this._input.headers,r.headers),hooks:Xru({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Aif(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Cif(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(Dif){this.abortController=new globalThis.AbortController;let n=this._options.signal??this._input.signal;n?.addEventListener("abort",()=>{this.abortController.abort(n.reason)}),this._options.signal=this.abortController.signal}if(wif&&(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 i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(Eif&&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 oCn)throw t;if(t instanceof Nfi){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),ala);if(this._retryCount<1)throw r;await kru(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===ola)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Nif(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Zru(r,t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var enu=e=>{let t=(r,n)=>zfi.create(r,Ifi(e,n));for(let r of ila)t[r]=(n,i)=>zfi.create(n,Ifi(e,i,{method:r}));return t.create=r=>enu(Ifi(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),enu(Ifi(e,r))),t.stop=ola,t},mi1=enu(),Iif=mi1;var iaf=iu(naf(),1);function anu(e){let t=(0,iaf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Wuf=iu(Qaf(),1),Huf=iu(Vuf(),1),Bnu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Rnu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Fnu(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??anu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,Wuf.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Iif(u,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Bnu(e):l}if(t.allVersions)return c;let o=new Rnu(e,r);if(c["dist-tags"][r]){let{time:l}=c;c=c.versions[c["dist-tags"][r]],c.time=l}else if(r){let l=!!c.versions[r];if(n&&!l)for(let[O,j]of Object.entries(c.versions))j.deprecated&&delete c.versions[O];if(!l){let O=Object.keys(c.versions);if(r=Huf.default.maxSatisfying(O,r),!r)throw o}let{time:g}=c;if(c=c.versions[r],c.time=g,!c)throw o}return c}async function Yfi(e,t){let{version:r}=await Fnu(e.toLowerCase(),t);return r}async function yCn({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:Yfi(e.packageName,{version:t?"prerelease":"latest"})}var Juf=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Mla=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=OM.Info;constructor(t){this.ttyAwareLogger=new tla(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.0.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${rl.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new JMe}failWithoutThrowing(t,r){this.didSucceed=!1,Qca({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await PAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await Oif({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1884
+ `,n?AAn(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function _i1(e){let r=await new gif.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 hi1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=rP.getGeneratorNameOrThrow(o.name,l),O=await rP.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=rP.getGeneratorNameOrThrow(c.name,o),g=await rP.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function Pif({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await rP.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function jif(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=cne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function rla({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await hi1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...jif(c,d,t.logger));else u.push(...jif(f.versions,void 0,t.logger))}return u}var Nfi=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var oCn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var uCn=e=>e!==null&&typeof e=="object";var Ifi=(...e)=>{for(let t of e)if((!uCn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Qru({},...e)},Yru=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function nla(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Qru(e[r]??[],t[r]??[])}var Xru=(e={},t={})=>({beforeRequest:nla(e,t,"beforeRequest"),beforeRetry:nla(e,t,"beforeRetry"),afterResponse:nla(e,t,"afterResponse"),beforeError:nla(e,t,"beforeError")}),Qru=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(uCn(i)){for(let[a,u]of Object.entries(i))uCn(u)&&a in t&&(u=Qru(t[a],u)),t={...t,[a]:u};uCn(i.hooks)&&(n=Xru(n,i.hooks),t.hooks=n),uCn(i.headers)&&(r=Yru(r,i.headers),t.headers=r)}return t};var wif=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),Dif=typeof globalThis.AbortController=="function",Sif=typeof globalThis.ReadableStream=="function",Eif=typeof globalThis.FormData=="function",ila=["get","post","put","patch","head","delete"],yi1=()=>{};yi1();var Mif={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},ala=2147483647,ola=Symbol("stop"),xif={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},Tif={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 Aif=e=>ila.includes(e)?e.toUpperCase():e,vi1=["get","put","head","delete","options","trace"],bi1=[408,413,429,500,502,503,504],gi1=[413,429,503],qif={limit:2,methods:vi1,statusCodes:bi1,afterStatusCodes:gi1,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Cif=(e={})=>{if(typeof e=="number")return{...qif,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{...qif,...e}};async function Zru(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new oCn(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function kru(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var Nif=(e,t)=>{let r={};for(let n in t)!(n in Tif)&&!(n in xif)&&!(n in e)&&(r[n]=t[n]);return r};var zfi=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>ala)throw new RangeError(`The \`timeout\` option cannot be greater than ${ala}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new Nfi(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Sif)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(Mif))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Yru(this._input.headers,r.headers),hooks:Xru({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Aif(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Cif(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(Dif){this.abortController=new globalThis.AbortController;let n=this._options.signal??this._input.signal;n?.addEventListener("abort",()=>{this.abortController.abort(n.reason)}),this._options.signal=this.abortController.signal}if(wif&&(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 i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(Eif&&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 oCn)throw t;if(t instanceof Nfi){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),ala);if(this._retryCount<1)throw r;await kru(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===ola)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Nif(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Zru(r,t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var enu=e=>{let t=(r,n)=>zfi.create(r,Ifi(e,n));for(let r of ila)t[r]=(n,i)=>zfi.create(n,Ifi(e,i,{method:r}));return t.create=r=>enu(Ifi(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),enu(Ifi(e,r))),t.stop=ola,t},mi1=enu(),Iif=mi1;var iaf=iu(naf(),1);function anu(e){let t=(0,iaf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Wuf=iu(Qaf(),1),Huf=iu(Vuf(),1),Bnu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Rnu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Fnu(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??anu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,Wuf.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Iif(u,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Bnu(e):l}if(t.allVersions)return c;let o=new Rnu(e,r);if(c["dist-tags"][r]){let{time:l}=c;c=c.versions[c["dist-tags"][r]],c.time=l}else if(r){let l=!!c.versions[r];if(n&&!l)for(let[O,j]of Object.entries(c.versions))j.deprecated&&delete c.versions[O];if(!l){let O=Object.keys(c.versions);if(r=Huf.default.maxSatisfying(O,r),!r)throw o}let{time:g}=c;if(c=c.versions[r],c.time=g,!c)throw o}return c}async function Yfi(e,t){let{version:r}=await Fnu(e.toLowerCase(),t);return r}async function yCn({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:Yfi(e.packageName,{version:t?"prerelease":"latest"})}var Juf=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Mla=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=OM.Info;constructor(t){this.ttyAwareLogger=new tla(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.45.0-rc8"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${rl.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new JMe}failWithoutThrowing(t,r){this.didSucceed=!1,Qca({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await PAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await Oif({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1884
1885
  `)||(r+=`
1885
1886
  `),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=R5o(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new Efi(t);return this.ttyAwareLogger.registerTask(r),r}async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw n.failWithoutThrowing(void 0,a),new JMe}finally{n.finish()}return i}async instrumentPostHogEvent(t){(await PAn()).sendEvent(t)}logger=uoi(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Guf(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?Guf(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=Juf[this.numTasks++%Juf.length],u=rl.hex(a)(i);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===M4.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logImmediately(t){let r=t.filter(n=>R6r.indexOf(n.level)>=R6r.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===OM.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 yCn({cliEnvironment:this.environment,includePreReleases:t}),n=cne(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await rla({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}};function Guf(e){return`[${e}]:`}var mcf=iu(gcf(),1);async function Oje(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...u}={}){let f=i.reduce((o,l)=>({...o,[l]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[o,l]of Object.entries(f))d=d.replaceAll(o,l);e?.debug(`+ ${d}`);let c=(0,mcf.default)(t,r,u);return n||(c.stdout?.pipe(process.stdout),c.stderr?.pipe(process.stderr)),c}function zla(e,{logger:t,...r}={}){return(n,i)=>Oje(t,e,n,{...r,...i})}var Rla=require("fs/promises"),Ocf=iu(Vte(),1),fl1="buf.gen.yaml",Pcf="output",dl1=`${Pcf}/openapi.yaml`,pl1=`
1886
1887
  version: v1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.45.0-rc6",
3
+ "version": "0.45.0-rc8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",