Files
dotfiles/dotfiles/.vscode-oss/extensions/continue.continue-0.8.25-linux-x64/gui/assets/index.esm.js

9 lines
62 KiB
JavaScript

import{c as ne}from"./index.js";var V={exports:{}};(function(s,r){(function(t,i){s.exports=i()})(typeof self<"u"?self:ne,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(n,o,u){i.o(n,o)||Object.defineProperty(n,o,{configurable:!1,enumerable:!0,get:u})},i.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(o,"a",o),o},i.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},i.p="",i(i.s=3)}([function(e,t,i){function n(p,w){if(!(p instanceof w))throw new TypeError("Cannot call a class as a function")}var o=i(5),u=i(1),l=u.toHex,c=u.ceilHeapSize,h=i(6),y=function(p){for(p+=9;p%64>0;p+=1);return p},d=function(p,w){var g=new Uint8Array(p.buffer),m=w%4,F=w-m;switch(m){case 0:g[F+3]=0;case 1:g[F+2]=0;case 2:g[F+1]=0;case 3:g[F+0]=0}for(var _=(w>>2)+1;_<p.length;_++)p[_]=0},f=function(p,w,g){p[w>>2]|=128<<24-(w%4<<3),p[((w>>2)+2&-16)+14]=g/(1<<29)|0,p[((w>>2)+2&-16)+15]=g<<3},a=function(p,w){var g=new Int32Array(p,w+320,5),m=new Int32Array(5),F=new DataView(m.buffer);return F.setInt32(0,g[0],!1),F.setInt32(4,g[1],!1),F.setInt32(8,g[2],!1),F.setInt32(12,g[3],!1),F.setInt32(16,g[4],!1),m},v=function(){function p(w){if(n(this,p),w=w||64*1024,w%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=w,this._padMaxChunkLen=y(w),this._heap=new ArrayBuffer(c(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new o({Int32Array},{},this._heap)}return p.prototype._initState=function(g,m){this._offset=0;var F=new Int32Array(g,m+320,5);F[0]=1732584193,F[1]=-271733879,F[2]=-1732584194,F[3]=271733878,F[4]=-1009589776},p.prototype._padChunk=function(g,m){var F=y(g),_=new Int32Array(this._heap,0,F>>2);return d(_,g),f(_,g,m),F},p.prototype._write=function(g,m,F,_){h(g,this._h8,this._h32,m,F,_||0)},p.prototype._coreCall=function(g,m,F,_,S){var C=F;this._write(g,m,F),S&&(C=this._padChunk(F,_)),this._core.hash(C,this._padMaxChunkLen)},p.prototype.rawDigest=function(g){var m=g.byteLength||g.length||g.size||0;this._initState(this._heap,this._padMaxChunkLen);var F=0,_=this._maxChunkLen;for(F=0;m>F+_;F+=_)this._coreCall(g,F,_,m,!1);return this._coreCall(g,F,m-F,m,!0),a(this._heap,this._padMaxChunkLen)},p.prototype.digest=function(g){return l(this.rawDigest(g).buffer)},p.prototype.digestFromString=function(g){return this.digest(g)},p.prototype.digestFromBuffer=function(g){return this.digest(g)},p.prototype.digestFromArrayBuffer=function(g){return this.digest(g)},p.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},p.prototype.append=function(g){var m=0,F=g.byteLength||g.length||g.size||0,_=this._offset%this._maxChunkLen,S=void 0;for(this._offset+=F;m<F;)S=Math.min(F-m,this._maxChunkLen-_),this._write(g,m,S,_),_+=S,m+=S,_===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),_=0);return this},p.prototype.getState=function(){var g=this._offset%this._maxChunkLen,m=void 0;if(g)m=this._heap.slice(0);else{var F=new Int32Array(this._heap,this._padMaxChunkLen+320,5);m=F.buffer.slice(F.byteOffset,F.byteOffset+F.byteLength)}return{offset:this._offset,heap:m}},p.prototype.setState=function(g){if(this._offset=g.offset,g.heap.byteLength===20){var m=new Int32Array(this._heap,this._padMaxChunkLen+320,5);m.set(new Int32Array(g.heap))}else this._h32.set(new Int32Array(g.heap));return this},p.prototype.rawEnd=function(){var g=this._offset,m=g%this._maxChunkLen,F=this._padChunk(m,g);this._core.hash(F,this._padMaxChunkLen);var _=a(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),_},p.prototype.end=function(){return l(this.rawEnd().buffer)},p}();e.exports=v,e.exports._core=o},function(e,t){for(var i=new Array(256),n=0;n<256;n++)i[n]=(n<16?"0":"")+n.toString(16);e.exports.toHex=function(o){for(var u=new Uint8Array(o),l=new Array(o.byteLength),c=0;c<l.length;c++)l[c]=i[u[c]];return l.join("")},e.exports.ceilHeapSize=function(o){var u=0;if(o<=65536)return 65536;if(o<16777216)for(u=1;u<o;u=u<<1);else for(u=16777216;u<o;u+=16777216);return u},e.exports.isDedicatedWorkerScope=function(o){var u="WorkerGlobalScope"in o&&o instanceof o.WorkerGlobalScope,l="SharedWorkerGlobalScope"in o&&o instanceof o.SharedWorkerGlobalScope,c="ServiceWorkerGlobalScope"in o&&o instanceof o.ServiceWorkerGlobalScope;return u&&!l&&!c}},function(e,t,i){e.exports=function(){var n=i(0),o=function(c,h,y){try{return y(null,c.digest(h))}catch(d){return y(d)}},u=function(c,h,y,d,f){var a=new self.FileReader;a.onloadend=function(){if(a.error)return f(a.error);var p=a.result;h+=a.result.byteLength;try{c.append(p)}catch(w){f(w);return}h<d.size?u(c,h,y,d,f):f(null,c.end())},a.readAsArrayBuffer(d.slice(h,h+y))},l=!0;return self.onmessage=function(c){if(l){var h=c.data.data,y=c.data.file,d=c.data.id;if(!(typeof d>"u")&&!(!y&&!h)){var f=c.data.blockSize||4*1024*1024,a=new n(f);a.resetState();var v=function(p,w){p?self.postMessage({id:d,error:p.name}):self.postMessage({id:d,hash:w})};h&&o(a,h,v),y&&u(a,0,f,y,v)}}},function(){l=!1}}},function(e,t,i){var n=i(4),o=i(0),u=i(7),l=i(2),c=i(1),h=c.isDedicatedWorkerScope,y=typeof self<"u"&&h(self);o.disableWorkerBehaviour=y?l():function(){},o.createWorker=function(){var d=n(2),f=d.terminate;return d.terminate=function(){URL.revokeObjectURL(d.objectURL),f.call(d)},d},o.createHash=u,e.exports=o},function(e,t,i){function n(d){var f={};function a(p){if(f[p])return f[p].exports;var w=f[p]={i:p,l:!1,exports:{}};return d[p].call(w.exports,w,w.exports,a),w.l=!0,w.exports}a.m=d,a.c=f,a.i=function(p){return p},a.d=function(p,w,g){a.o(p,w)||Object.defineProperty(p,w,{configurable:!1,enumerable:!0,get:g})},a.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},a.n=function(p){var w=p&&p.__esModule?function(){return p.default}:function(){return p};return a.d(w,"a",w),w},a.o=function(p,w){return Object.prototype.hasOwnProperty.call(p,w)},a.p="/",a.oe=function(p){throw console.error(p),p};var v=a(a.s=ENTRY_MODULE);return v.default||v}var o="[\\.|\\-|\\+|\\w|/|@]+",u="\\((/\\*.*?\\*/)?s?.*?("+o+").*?\\)";function l(d){return(d+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function c(d,f,a){var v={};v[a]=[];var p=f.toString(),w=p.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!w)return v;for(var g=w[1],m=new RegExp("(\\\\n|\\W)"+l(g)+u,"g"),F;F=m.exec(p);)F[3]!=="dll-reference"&&v[a].push(F[3]);for(m=new RegExp("\\("+l(g)+'\\("(dll-reference\\s('+o+'))"\\)\\)'+u,"g");F=m.exec(p);)d[F[2]]||(v[a].push(F[1]),d[F[2]]=i(F[1]).m),v[F[2]]=v[F[2]]||[],v[F[2]].push(F[4]);return v}function h(d){var f=Object.keys(d);return f.reduce(function(a,v){return a||d[v].length>0},!1)}function y(d,f){for(var a={main:[f]},v={main:[]},p={main:{}};h(a);)for(var w=Object.keys(a),g=0;g<w.length;g++){var m=w[g],F=a[m],_=F.pop();if(p[m]=p[m]||{},!(p[m][_]||!d[m][_])){p[m][_]=!0,v[m]=v[m]||[],v[m].push(_);for(var S=c(d,d[m][_],m),C=Object.keys(S),O=0;O<C.length;O++)a[C[O]]=a[C[O]]||[],a[C[O]]=a[C[O]].concat(S[C[O]])}}return v}e.exports=function(d,f){f=f||{};var a={main:i.m},v=f.all?{main:Object.keys(a)}:y(a,d),p="";Object.keys(v).filter(function(_){return _!=="main"}).forEach(function(_){for(var S=0;v[_][S];)S++;v[_].push(S),a[_][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+_+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+v[_].map(function(C){return""+JSON.stringify(C)+": "+a[_][C].toString()}).join(",")+`});
`}),p=p+"("+n.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+v.main.map(function(_){return""+JSON.stringify(_)+": "+a.main[_].toString()}).join(",")+"})(self);";var w=new window.Blob([p],{type:"text/javascript"});if(f.bare)return w;var g=window.URL||window.webkitURL||window.mozURL||window.msURL,m=g.createObjectURL(w),F=new window.Worker(m);return F.objectURL=m,F}},function(e,t){e.exports=function(n,o,u){var l=new n.Int32Array(u);function c(h,y){h=h|0,y=y|0;var d=0,f=0,a=0,v=0,p=0,w=0,g=0,m=0,F=0,_=0,S=0,C=0,O=0,I=0;for(a=l[y+320>>2]|0,p=l[y+324>>2]|0,g=l[y+328>>2]|0,F=l[y+332>>2]|0,S=l[y+336>>2]|0,d=0;(d|0)<(h|0);d=d+64|0){for(v=a,w=p,m=g,_=F,C=S,f=0;(f|0)<64;f=f+4|0)I=l[d+f>>2]|0,O=((a<<5|a>>>27)+(p&g|~p&F)|0)+((I+S|0)+1518500249|0)|0,S=F,F=g,g=p<<30|p>>>2,p=a,a=O,l[h+f>>2]=I;for(f=h+64|0;(f|0)<(h+80|0);f=f+4|0)I=(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])<<1|(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])>>>31,O=((a<<5|a>>>27)+(p&g|~p&F)|0)+((I+S|0)+1518500249|0)|0,S=F,F=g,g=p<<30|p>>>2,p=a,a=O,l[f>>2]=I;for(f=h+80|0;(f|0)<(h+160|0);f=f+4|0)I=(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])<<1|(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])>>>31,O=((a<<5|a>>>27)+(p^g^F)|0)+((I+S|0)+1859775393|0)|0,S=F,F=g,g=p<<30|p>>>2,p=a,a=O,l[f>>2]=I;for(f=h+160|0;(f|0)<(h+240|0);f=f+4|0)I=(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])<<1|(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])>>>31,O=((a<<5|a>>>27)+(p&g|p&F|g&F)|0)+((I+S|0)-1894007588|0)|0,S=F,F=g,g=p<<30|p>>>2,p=a,a=O,l[f>>2]=I;for(f=h+240|0;(f|0)<(h+320|0);f=f+4|0)I=(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])<<1|(l[f-12>>2]^l[f-32>>2]^l[f-56>>2]^l[f-64>>2])>>>31,O=((a<<5|a>>>27)+(p^g^F)|0)+((I+S|0)-899497514|0)|0,S=F,F=g,g=p<<30|p>>>2,p=a,a=O,l[f>>2]=I;a=a+v|0,p=p+w|0,g=g+m|0,F=F+_|0,S=S+C|0}l[y+320>>2]=a,l[y+324>>2]=p,l[y+328>>2]=g,l[y+332>>2]=F,l[y+336>>2]=S}return{hash:c}}},function(e,t){var i=this,n=void 0;typeof self<"u"&&typeof self.FileReaderSync<"u"&&(n=new self.FileReaderSync);var o=function(c,h,y,d,f,a){var v=void 0,p=a%4,w=(f+p)%4,g=f-w;switch(p){case 0:h[a]=c.charCodeAt(d+3);case 1:h[a+1-(p<<1)|0]=c.charCodeAt(d+2);case 2:h[a+2-(p<<1)|0]=c.charCodeAt(d+1);case 3:h[a+3-(p<<1)|0]=c.charCodeAt(d)}if(!(f<w+(4-p))){for(v=4-p;v<g;v=v+4|0)y[a+v>>2]=c.charCodeAt(d+v)<<24|c.charCodeAt(d+v+1)<<16|c.charCodeAt(d+v+2)<<8|c.charCodeAt(d+v+3);switch(w){case 3:h[a+g+1|0]=c.charCodeAt(d+g+2);case 2:h[a+g+2|0]=c.charCodeAt(d+g+1);case 1:h[a+g+3|0]=c.charCodeAt(d+g)}}},u=function(c,h,y,d,f,a){var v=void 0,p=a%4,w=(f+p)%4,g=f-w;switch(p){case 0:h[a]=c[d+3];case 1:h[a+1-(p<<1)|0]=c[d+2];case 2:h[a+2-(p<<1)|0]=c[d+1];case 3:h[a+3-(p<<1)|0]=c[d]}if(!(f<w+(4-p))){for(v=4-p;v<g;v=v+4|0)y[a+v>>2|0]=c[d+v]<<24|c[d+v+1]<<16|c[d+v+2]<<8|c[d+v+3];switch(w){case 3:h[a+g+1|0]=c[d+g+2];case 2:h[a+g+2|0]=c[d+g+1];case 1:h[a+g+3|0]=c[d+g]}}},l=function(c,h,y,d,f,a){var v=void 0,p=a%4,w=(f+p)%4,g=f-w,m=new Uint8Array(n.readAsArrayBuffer(c.slice(d,d+f)));switch(p){case 0:h[a]=m[3];case 1:h[a+1-(p<<1)|0]=m[2];case 2:h[a+2-(p<<1)|0]=m[1];case 3:h[a+3-(p<<1)|0]=m[0]}if(!(f<w+(4-p))){for(v=4-p;v<g;v=v+4|0)y[a+v>>2|0]=m[v]<<24|m[v+1]<<16|m[v+2]<<8|m[v+3];switch(w){case 3:h[a+g+1|0]=m[g+2];case 2:h[a+g+2|0]=m[g+1];case 1:h[a+g+3|0]=m[g]}}};e.exports=function(c,h,y,d,f,a){if(typeof c=="string")return o(c,h,y,d,f,a);if(c instanceof Array||i&&i.Buffer&&i.Buffer.isBuffer(c))return u(c,h,y,d,f,a);if(c instanceof ArrayBuffer)return u(new Uint8Array(c),h,y,d,f,a);if(c.buffer instanceof ArrayBuffer)return u(new Uint8Array(c.buffer,c.byteOffset,c.byteLength),h,y,d,f,a);if(c instanceof Blob)return l(c,h,y,d,f,a);throw new Error("Unsupported data type.")}},function(e,t,i){var n=function(){function y(d,f){for(var a=0;a<f.length;a++){var v=f[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,f,a){return f&&y(d.prototype,f),a&&y(d,a),d}}();function o(y,d){if(!(y instanceof d))throw new TypeError("Cannot call a class as a function")}var u=i(0),l=i(1),c=l.toHex,h=function(){function y(){o(this,y),this._rusha=new u,this._rusha.resetState()}return y.prototype.update=function(f){return this._rusha.append(f),this},y.prototype.digest=function(f){var a=this._rusha.rawEnd().buffer;if(!f)return a;if(f==="hex")return c(a);throw new Error("unsupported digest encoding")},n(y,[{key:"state",get:function(){return this._rusha.getState()},set:function(d){this._rusha.setState(d)}}]),y}();e.exports=function(){return new h}}])})})(V);var ie=V.exports,T=function(s,r){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},T(s,r)};function k(s,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");T(s,r);function e(){this.constructor=s}s.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}var b=function(){return b=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},b.apply(this,arguments)};function oe(s,r){var e={};for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&r.indexOf(t)<0&&(e[t]=s[t]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(s);i<t.length;i++)r.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(s,t[i])&&(e[t[i]]=s[t[i]]);return e}function A(s,r,e,t){function i(n){return n instanceof e?n:new e(function(o){o(n)})}return new(e||(e=Promise))(function(n,o){function u(h){try{c(t.next(h))}catch(y){o(y)}}function l(h){try{c(t.throw(h))}catch(y){o(y)}}function c(h){h.done?n(h.value):i(h.value).then(u,l)}c((t=t.apply(s,r||[])).next())})}function x(s,r){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,i,n,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(c){return function(h){return l([c,h])}}function l(c){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,i&&(n=c[0]&2?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,i=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){e.label=c[1];break}if(c[0]===6&&e.label<n[1]){e.label=n[1],n=c;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(c);break}n[2]&&e.ops.pop(),e.trys.pop();continue}c=r.call(s,e)}catch(h){c=[6,h],i=0}finally{t=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Q(s,r,e){if(e||arguments.length===2)for(var t=0,i=r.length,n;t<i;t++)(n||!(t in r))&&(n||(n=Array.prototype.slice.call(r,0,t)),n[t]=r[t]);return s.concat(n||Array.prototype.slice.call(r))}var G="3.6.3",P;(function(s){s.AnonymousId="anonymous_id",s.DistinctId="distinct_id",s.Props="props",s.FeatureFlags="feature_flags",s.FeatureFlagPayloads="feature_flag_payloads",s.OverrideFeatureFlags="override_feature_flags",s.Queue="queue",s.OptedOut="opted_out",s.SessionId="session_id",s.SessionLastTimestamp="session_timestamp",s.PersonProperties="person_properties",s.GroupProperties="group_properties",s.InstalledAppBuild="installed_app_build",s.InstalledAppVersion="installed_app_version"})(P||(P={}));function ae(s,r){if(!s)throw new Error(r)}function se(s){return s==null?void 0:s.replace(/\/+$/,"")}function ue(s,r){return r===void 0&&(r={}),A(this,void 0,void 0,function(){var e,t,i,n,o,u,l,c,h,y;return x(this,function(d){switch(d.label){case 0:e=r.retryCount,t=e===void 0?3:e,i=r.retryDelay,n=i===void 0?5e3:i,o=r.retryCheck,u=o===void 0?function(){return!0}:o,l=null,c=0,d.label=1;case 1:return c<t+1?c>0?[4,new Promise(function(f){return setTimeout(f,n)})]:[3,3]:[3,7];case 2:d.sent(),d.label=3;case 3:return d.trys.push([3,5,,6]),[4,s()];case 4:return h=d.sent(),[2,h];case 5:if(y=d.sent(),l=y,!u(y))throw y;return[3,6];case 6:return c++,[3,1];case 7:throw l}})})}function le(){return new Date().getTime()}function $(){return new Date().toISOString()}function Y(s,r){var e=setTimeout(s,r);return e!=null&&e.unref&&(e==null||e.unref()),e}var L=String.fromCharCode,W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",M={};function ce(s,r){if(!M[s]){M[s]={};for(var e=0;e<s.length;e++)M[s][s.charAt(e)]=e}return M[s][r]}var j={compressToBase64:function(s){if(s==null)return"";var r=j._compress(s,6,function(e){return W.charAt(e)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(s){return s==null?"":s==""?null:j._decompress(s.length,32,function(r){return ce(W,s.charAt(r))})},compress:function(s){return j._compress(s,16,function(r){return L(r)})},_compress:function(s,r,e){if(s==null)return"";var t={},i={},n=[],o,u,l="",c="",h="",y=2,d=3,f=2,a=0,v=0,p;for(p=0;p<s.length;p+=1)if(l=s.charAt(p),Object.prototype.hasOwnProperty.call(t,l)||(t[l]=d++,i[l]=!0),c=h+l,Object.prototype.hasOwnProperty.call(t,c))h=c;else{if(Object.prototype.hasOwnProperty.call(i,h)){if(h.charCodeAt(0)<256){for(o=0;o<f;o++)a=a<<1,v==r-1?(v=0,n.push(e(a)),a=0):v++;for(u=h.charCodeAt(0),o=0;o<8;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1}else{for(u=1,o=0;o<f;o++)a=a<<1|u,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=0;for(u=h.charCodeAt(0),o=0;o<16;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1}y--,y==0&&(y=Math.pow(2,f),f++),delete i[h]}else for(u=t[h],o=0;o<f;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1;y--,y==0&&(y=Math.pow(2,f),f++),t[c]=d++,h=String(l)}if(h!==""){if(Object.prototype.hasOwnProperty.call(i,h)){if(h.charCodeAt(0)<256){for(o=0;o<f;o++)a=a<<1,v==r-1?(v=0,n.push(e(a)),a=0):v++;for(u=h.charCodeAt(0),o=0;o<8;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1}else{for(u=1,o=0;o<f;o++)a=a<<1|u,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=0;for(u=h.charCodeAt(0),o=0;o<16;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1}y--,y==0&&(y=Math.pow(2,f),f++),delete i[h]}else for(u=t[h],o=0;o<f;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1;y--,y==0&&(y=Math.pow(2,f),f++)}for(u=2,o=0;o<f;o++)a=a<<1|u&1,v==r-1?(v=0,n.push(e(a)),a=0):v++,u=u>>1;for(;;)if(a=a<<1,v==r-1){n.push(e(a));break}else v++;return n.join("")},decompress:function(s){return s==null?"":s==""?null:j._decompress(s.length,32768,function(r){return s.charCodeAt(r)})},_decompress:function(s,r,e){var t=[],i=[],n={val:e(0),position:r,index:1},o=4,u=4,l=3,c="",h,y,d,f,a,v,p;for(h=0;h<3;h+=1)t[h]=h;for(d=0,a=Math.pow(2,2),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;switch(d){case 0:for(d=0,a=Math.pow(2,8),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;p=L(d);break;case 1:for(d=0,a=Math.pow(2,16),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;p=L(d);break;case 2:return""}for(t[3]=p,y=p,i.push(p);;){if(n.index>s)return"";for(d=0,a=Math.pow(2,l),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;switch(p=d){case 0:for(d=0,a=Math.pow(2,8),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;t[u++]=L(d),p=u-1,o--;break;case 1:for(d=0,a=Math.pow(2,16),v=1;v!=a;)f=n.val&n.position,n.position>>=1,n.position==0&&(n.position=r,n.val=e(n.index++)),d|=(f>0?1:0)*v,v<<=1;t[u++]=L(d),p=u-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,l),l++),t[p])c=t[p];else if(p===u)c=y+y.charAt(0);else return null;i.push(c),t[u++]=y+c.charAt(0),o--,y=c,o==0&&(o=Math.pow(2,l),l++)}}},fe=function(){function s(){this.events={},this.events={}}return s.prototype.on=function(r,e){var t=this;return this.events[r]||(this.events[r]=[]),this.events[r].push(e),function(){t.events[r]=t.events[r].filter(function(i){return i!==e})}},s.prototype.emit=function(r,e){for(var t=0,i=this.events[r]||[];t<i.length;t++){var n=i[t];n(e)}for(var o=0,u=this.events["*"]||[];o<u.length;o++){var n=u[o];n(r,e)}},s}();/**
* uuidv7: An experimental implementation of the proposed UUID Version 7
*
* @license Apache-2.0
* @copyright 2021-2023 LiosK
* @packageDocumentation
*/var R="0123456789abcdef",K=function(){function s(r){this.bytes=r}return s.ofInner=function(r){if(r.length!==16)throw new TypeError("not 128-bit length");return new s(r)},s.fromFieldsV7=function(r,e,t,i){if(!Number.isInteger(r)||!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||r<0||e<0||t<0||i<0||r>0xffffffffffff||e>4095||t>1073741823||i>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=r/Math.pow(2,40),n[1]=r/Math.pow(2,32),n[2]=r/Math.pow(2,24),n[3]=r/Math.pow(2,16),n[4]=r/Math.pow(2,8),n[5]=r,n[6]=112|e>>>8,n[7]=e,n[8]=128|t>>>24,n[9]=t>>>16,n[10]=t>>>8,n[11]=t,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new s(n)},s.parse=function(r){var e,t,i,n,o=void 0;switch(r.length){case 32:o=(e=/^[0-9a-f]{32}$/i.exec(r))===null||e===void 0?void 0:e[0];break;case 36:o=(t=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(r))===null||t===void 0?void 0:t.slice(1,6).join("");break;case 38:o=(i=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(r))===null||i===void 0?void 0:i.slice(1,6).join("");break;case 45:o=(n=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(r))===null||n===void 0?void 0:n.slice(1,6).join("");break}if(o){for(var u=new Uint8Array(16),l=0;l<16;l+=4){var c=parseInt(o.substring(2*l,2*l+8),16);u[l+0]=c>>>24,u[l+1]=c>>>16,u[l+2]=c>>>8,u[l+3]=c}return new s(u)}else throw new SyntaxError("could not parse UUID string")},s.prototype.toString=function(){for(var r="",e=0;e<this.bytes.length;e++)r+=R.charAt(this.bytes[e]>>>4),r+=R.charAt(this.bytes[e]&15),(e===3||e===5||e===7||e===9)&&(r+="-");return r},s.prototype.toHex=function(){for(var r="",e=0;e<this.bytes.length;e++)r+=R.charAt(this.bytes[e]>>>4),r+=R.charAt(this.bytes[e]&15);return r},s.prototype.toJSON=function(){return this.toString()},s.prototype.getVariant=function(){var r=this.bytes[8]>>>4;if(r<0)throw new Error("unreachable");if(r<=7)return this.bytes.every(function(e){return e===0})?"NIL":"VAR_0";if(r<=11)return"VAR_10";if(r<=13)return"VAR_110";if(r<=15)return this.bytes.every(function(e){return e===255})?"MAX":"VAR_RESERVED";throw new Error("unreachable")},s.prototype.getVersion=function(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0},s.prototype.clone=function(){return new s(this.bytes.slice(0))},s.prototype.equals=function(r){return this.compareTo(r)===0},s.prototype.compareTo=function(r){for(var e=0;e<16;e++){var t=this.bytes[e]-r.bytes[e];if(t!==0)return Math.sign(t)}return 0},s}(),he=function(){function s(r){this.timestamp=0,this.counter=0,this.random=r??de()}return s.prototype.generate=function(){return this.generateOrResetCore(Date.now(),1e4)},s.prototype.generateOrAbort=function(){return this.generateOrAbortCore(Date.now(),1e4)},s.prototype.generateOrResetCore=function(r,e){var t=this.generateOrAbortCore(r,e);return t===void 0&&(this.timestamp=0,t=this.generateOrAbortCore(r,e)),t},s.prototype.generateOrAbortCore=function(r,e){var t=4398046511103;if(!Number.isInteger(r)||r<1||r>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(e<0||e>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(r>this.timestamp)this.timestamp=r,this.resetCounter();else if(r+e>=this.timestamp)this.counter++,this.counter>t&&(this.timestamp++,this.resetCounter());else return;return K.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())},s.prototype.resetCounter=function(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)},s.prototype.generateV4=function(){var r=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return r[6]=64|r[6]>>>4,r[8]=128|r[8]>>>2,K.ofInner(r)},s}(),de=function(){return{nextUint32:function(){return Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}}},z,D=function(){return pe().toString()},pe=function(){return(z||(z=new he)).generate()},ve=function(s){k(r,s);function r(e){var t=s.call(this,"HTTP error while fetching PostHog: "+e.status)||this;return t.response=e,t.name="PostHogFetchHttpError",t}return r}(Error),ye=function(s){k(r,s);function r(e){var t=s.call(this,"Network error while fetching PostHog",e instanceof Error?{cause:e}:{})||this;return t.error=e,t.name="PostHogFetchNetworkError",t}return r}(Error);function B(s){return typeof s=="object"&&(s.name==="PostHogFetchHttpError"||s.name==="PostHogFetchNetworkError")}var X=function(){function s(r,e){var t,i,n,o,u;this.debugMode=!1,this.disableGeoip=!0,this.pendingPromises={},this._events=new fe,ae(r,"You must pass your PostHog project's api key."),this.apiKey=r,this.host=se((e==null?void 0:e.host)||"https://app.posthog.com"),this.flushAt=e!=null&&e.flushAt?Math.max(e==null?void 0:e.flushAt,1):20,this.flushInterval=(t=e==null?void 0:e.flushInterval)!==null&&t!==void 0?t:1e4,this.captureMode=(e==null?void 0:e.captureMode)||"form",this._optoutOverride=(e==null?void 0:e.enable)===!1,this._retryOptions={retryCount:(i=e==null?void 0:e.fetchRetryCount)!==null&&i!==void 0?i:3,retryDelay:(n=e==null?void 0:e.fetchRetryDelay)!==null&&n!==void 0?n:3e3,retryCheck:B},this.requestTimeout=(o=e==null?void 0:e.requestTimeout)!==null&&o!==void 0?o:1e4,this.disableGeoip=(u=e==null?void 0:e.disableGeoip)!==null&&u!==void 0?u:!0}return s.prototype.getCommonEventProperties=function(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}},Object.defineProperty(s.prototype,"optedOut",{get:function(){var r,e;return(e=(r=this.getPersistedProperty(P.OptedOut))!==null&&r!==void 0?r:this._optoutOverride)!==null&&e!==void 0?e:!1},enumerable:!1,configurable:!0}),s.prototype.optIn=function(){this.setPersistedProperty(P.OptedOut,!1)},s.prototype.optOut=function(){this.setPersistedProperty(P.OptedOut,!0)},s.prototype.on=function(r,e){return this._events.on(r,e)},s.prototype.debug=function(r){var e;r===void 0&&(r=!0),(e=this.removeDebugCallback)===null||e===void 0||e.call(this),this.debugMode=r,r&&(this.removeDebugCallback=this.on("*",function(t,i){return console.log("PostHog Debug",t,i)}))},s.prototype.buildPayload=function(r){return{distinct_id:r.distinct_id,event:r.event,properties:b(b({},r.properties||{}),this.getCommonEventProperties())}},s.prototype.addPendingPromise=function(r){var e=this,t=D();this.pendingPromises[t]=r,r.finally(function(){delete e.pendingPromises[t]})},s.prototype.identifyStateless=function(r,e,t){var i=b({},this.buildPayload({distinct_id:r,event:"$identify",properties:e}));return this.enqueue("identify",i,t),this},s.prototype.captureStateless=function(r,e,t,i){var n=this.buildPayload({distinct_id:r,event:e,properties:t});return this.enqueue("capture",n,i),this},s.prototype.aliasStateless=function(r,e,t,i){var n=this.buildPayload({event:"$create_alias",distinct_id:e,properties:b(b({},t||{}),{distinct_id:e,alias:r})});return this.enqueue("alias",n,i),this},s.prototype.groupIdentifyStateless=function(r,e,t,i,n,o){var u=this.buildPayload({distinct_id:n||"$".concat(r,"_").concat(e),event:"$groupidentify",properties:b({$group_type:r,$group_key:e,$group_set:t||{}},o||{})});return this.enqueue("capture",u,i),this},s.prototype.getDecide=function(r,e,t,i,n){return e===void 0&&(e={}),t===void 0&&(t={}),i===void 0&&(i={}),n===void 0&&(n={}),A(this,void 0,void 0,function(){var o,u,l=this;return x(this,function(c){return o="".concat(this.host,"/decide/?v=3"),u={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b({token:this.apiKey,distinct_id:r,groups:e,person_properties:t,group_properties:i},n))},[2,this.fetchWithRetry(o,u).then(function(h){return h.json()}).catch(function(h){l._events.emit("error",h)})]})})},s.prototype.getFeatureFlagStateless=function(r,e,t,i,n,o){return t===void 0&&(t={}),i===void 0&&(i={}),n===void 0&&(n={}),A(this,void 0,void 0,function(){var u,l;return x(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagsStateless(e,t,i,n,o)];case 1:return u=c.sent(),u?(l=u[r],l===void 0&&(l=!1),[2,l]):[2,void 0]}})})},s.prototype.getFeatureFlagPayloadStateless=function(r,e,t,i,n,o){return t===void 0&&(t={}),i===void 0&&(i={}),n===void 0&&(n={}),A(this,void 0,void 0,function(){var u,l;return x(this,function(c){switch(c.label){case 0:return[4,this.getFeatureFlagPayloadsStateless(e,t,i,n,o)];case 1:return u=c.sent(),u?(l=u[r],l===void 0?[2,null]:[2,this._parsePayload(l)]):[2,void 0]}})})},s.prototype.getFeatureFlagPayloadsStateless=function(r,e,t,i,n){return e===void 0&&(e={}),t===void 0&&(t={}),i===void 0&&(i={}),A(this,void 0,void 0,function(){var o,u=this;return x(this,function(l){switch(l.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(r,e,t,i,n)];case 1:return o=l.sent().payloads,o?[2,Object.fromEntries(Object.entries(o).map(function(c){var h=c[0],y=c[1];return[h,u._parsePayload(y)]}))]:[2,o]}})})},s.prototype._parsePayload=function(r){try{return JSON.parse(r)}catch{return r}},s.prototype.getFeatureFlagsStateless=function(r,e,t,i,n){return e===void 0&&(e={}),t===void 0&&(t={}),i===void 0&&(i={}),A(this,void 0,void 0,function(){return x(this,function(o){switch(o.label){case 0:return[4,this.getFeatureFlagsAndPayloadsStateless(r,e,t,i,n)];case 1:return[2,o.sent().flags]}})})},s.prototype.getFeatureFlagsAndPayloadsStateless=function(r,e,t,i,n){return e===void 0&&(e={}),t===void 0&&(t={}),i===void 0&&(i={}),A(this,void 0,void 0,function(){var o,u,l,c;return x(this,function(h){switch(h.label){case 0:return o={},(n??this.disableGeoip)&&(o.geoip_disable=!0),[4,this.getDecide(r,e,t,i,o)];case 1:return u=h.sent(),l=u==null?void 0:u.featureFlags,c=u==null?void 0:u.featureFlagPayloads,[2,{flags:l,payloads:c}]}})})},s.prototype.enqueue=function(r,e,t){var i=this,n;if(this.optedOut){this._events.emit(r,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}var o=b(b({},e),{type:r,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:t!=null&&t.timestamp?t==null?void 0:t.timestamp:$(),uuid:t!=null&&t.uuid?t.uuid:D()}),u=(n=t==null?void 0:t.disableGeoip)!==null&&n!==void 0?n:this.disableGeoip;u&&(o.properties||(o.properties={}),o.properties.$geoip_disable=!0),o.distinctId&&(o.distinct_id=o.distinctId,delete o.distinctId);var l=this.getPersistedProperty(P.Queue)||[];l.push({message:o}),this.setPersistedProperty(P.Queue,l),this._events.emit(r,o),l.length>=this.flushAt&&this.flush(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Y(function(){return i.flush()},this.flushInterval))},s.prototype.flushAsync=function(){var r=this;return new Promise(function(e,t){r.flush(function(i,n){return i?t(i):e(n)})})},s.prototype.flush=function(r){var e=this;this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=null);var t=this.getPersistedProperty(P.Queue)||[];if(!t.length)return r==null?void 0:r();var i=t.splice(0,this.flushAt);this.setPersistedProperty(P.Queue,t);var n=i.map(function(d){return d.message}),o={api_key:this.apiKey,batch:n,sent_at:$()},u=function(d){d&&e._events.emit("error",d),r==null||r(d,n),e._events.emit("flush",n)};this.getCustomUserAgent();var l=JSON.stringify(o),c=this.captureMode==="form"?"".concat(this.host,"/e/?ip=1&_=").concat(le(),"&v=").concat(this.getLibraryVersion()):"".concat(this.host,"/batch/"),h=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"data=".concat(encodeURIComponent(j.compressToBase64(l)),"&compression=lz64")}:{method:"POST",headers:{"Content-Type":"application/json"},body:l},y=this.fetchWithRetry(c,h);this.addPendingPromise(y.then(function(){return u()}).catch(function(d){u(d)}))},s.prototype.fetchWithRetry=function(r,e,t){var i,n;return A(this,void 0,void 0,function(){var o=this;return x(this,function(u){switch(u.label){case 0:return(i=(n=AbortSignal).timeout)!==null&&i!==void 0||(n.timeout=function(c){var h=new AbortController;return setTimeout(function(){return h.abort()},c),h.signal}),[4,ue(function(){return A(o,void 0,void 0,function(){var l,c,h;return x(this,function(y){switch(y.label){case 0:l=null,y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.fetch(r,b({signal:AbortSignal.timeout(this.requestTimeout)},e))];case 2:return l=y.sent(),[3,4];case 3:throw c=y.sent(),new ye(c);case 4:if(h=e.mode==="no-cors",!h&&(l.status<200||l.status>=400))throw new ve(l);return[2,l]}})})},b(b({},this._retryOptions),t))];case 1:return[2,u.sent()]}})})},s.prototype.shutdownAsync=function(){return A(this,void 0,void 0,function(){var r;return x(this,function(e){switch(e.label){case 0:clearTimeout(this._flushTimer),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,this.flushAsync()];case 2:return e.sent(),[4,Promise.all(Object.values(this.pendingPromises).map(function(t){return t.catch(function(){})}))];case 3:return e.sent(),[4,this.flushAsync()];case 4:return e.sent(),[3,6];case 5:if(r=e.sent(),!B(r))throw r;return console.error("Error while shutting down PostHog",r),[3,6];case 6:return[2]}})})},s.prototype.shutdown=function(){this.shutdownAsync()},s}();(function(s){k(r,s);function r(e,t){var i=this,n,o,u,l=(n=t==null?void 0:t.disableGeoip)!==null&&n!==void 0?n:!1;return i=s.call(this,e,b(b({},t),{disableGeoip:l}))||this,i.flagCallReported={},i.sessionProps={},i.sendFeatureFlagEvent=(o=t==null?void 0:t.sendFeatureFlagEvent)!==null&&o!==void 0?o:!0,i._sessionExpirationTimeSeconds=(u=t==null?void 0:t.sessionExpirationTimeSeconds)!==null&&u!==void 0?u:1800,i}return r.prototype.setupBootstrap=function(e){var t,i,n,o;if(!((t=e==null?void 0:e.bootstrap)===null||t===void 0)&&t.distinctId&&(!((i=e==null?void 0:e.bootstrap)===null||i===void 0)&&i.isIdentifiedId?this.setPersistedProperty(P.DistinctId,e.bootstrap.distinctId):this.setPersistedProperty(P.AnonymousId,e.bootstrap.distinctId)),!((n=e==null?void 0:e.bootstrap)===null||n===void 0)&&n.featureFlags){var u=Object.keys(((o=e.bootstrap)===null||o===void 0?void 0:o.featureFlags)||{}).filter(function(l){var c,h;return!!(!((h=(c=e.bootstrap)===null||c===void 0?void 0:c.featureFlags)===null||h===void 0)&&h[l])}).reduce(function(l,c){var h,y;return l[c]=((y=(h=e.bootstrap)===null||h===void 0?void 0:h.featureFlags)===null||y===void 0?void 0:y[c])||!1,l},{});this.setKnownFeatureFlags(u),e!=null&&e.bootstrap.featureFlagPayloads&&this.setKnownFeatureFlagPayloads(e==null?void 0:e.bootstrap.featureFlagPayloads)}},Object.defineProperty(r.prototype,"props",{get:function(){return this._props||(this._props=this.getPersistedProperty(P.Props)),this._props||{}},set:function(e){this._props=e},enumerable:!1,configurable:!0}),r.prototype.clearProps=function(){this.props=void 0,this.sessionProps={}},r.prototype.on=function(e,t){return this._events.on(e,t)},r.prototype.reset=function(e){var t=Q([P.Queue],e||[],!0);this.clearProps();for(var i=0,n=Object.keys(P);i<n.length;i++){var o=n[i];t.includes(P[o])||this.setPersistedProperty(P[o],null)}},r.prototype.getCommonEventProperties=function(){var e=this.getFeatureFlags(),t={};if(e)for(var i=0,n=Object.entries(e);i<n.length;i++){var o=n[i],u=o[0],l=o[1];t["$feature/".concat(u)]=l}return b(b({$active_feature_flags:e?Object.keys(e):void 0},t),s.prototype.getCommonEventProperties.call(this))},r.prototype.enrichProperties=function(e){return b(b(b(b(b({},this.props),this.sessionProps),e||{}),this.getCommonEventProperties()),{$session_id:this.getSessionId()})},r.prototype.getSessionId=function(){var e=this.getPersistedProperty(P.SessionId),t=this.getPersistedProperty(P.SessionLastTimestamp)||0;return(!e||Date.now()-t>this._sessionExpirationTimeSeconds*1e3)&&(e=D(),this.setPersistedProperty(P.SessionId,e)),this.setPersistedProperty(P.SessionLastTimestamp,Date.now()),e},r.prototype.resetSessionId=function(){this.setPersistedProperty(P.SessionId,null)},r.prototype.getAnonymousId=function(){var e=this.getPersistedProperty(P.AnonymousId);return e||(e=D(),this.setPersistedProperty(P.AnonymousId,e)),e},r.prototype.getDistinctId=function(){return this.getPersistedProperty(P.DistinctId)||this.getAnonymousId()},r.prototype.unregister=function(e){delete this.props[e],this.setPersistedProperty(P.Props,this.props)},r.prototype.register=function(e){this.props=b(b({},this.props),e),this.setPersistedProperty(P.Props,this.props)},r.prototype.registerForSession=function(e){this.sessionProps=b(b({},this.sessionProps),e)},r.prototype.unregisterForSession=function(e){delete this.sessionProps[e]},r.prototype.identify=function(e,t,i){var n=this.getDistinctId();e=e||n,t!=null&&t.$groups&&this.groups(t.$groups);var o=this.enrichProperties(b(b({},t),{$anon_distinct_id:this.getAnonymousId(),$set:t}));return e!==n&&(this.setPersistedProperty(P.AnonymousId,n),this.setPersistedProperty(P.DistinctId,e),this.reloadFeatureFlags()),s.prototype.identifyStateless.call(this,e,o,i),this},r.prototype.capture=function(e,t,i){var n=this.getDistinctId();t!=null&&t.$groups&&this.groups(t.$groups);var o=this.enrichProperties(t);return s.prototype.captureStateless.call(this,n,e,o,i),this},r.prototype.alias=function(e){var t=this.getDistinctId(),i=this.enrichProperties({});return s.prototype.aliasStateless.call(this,e,t,i),this},r.prototype.autocapture=function(e,t,i,n){i===void 0&&(i={});var o=this.getDistinctId(),u={distinct_id:o,event:"$autocapture",properties:b(b({},this.enrichProperties(i)),{$event_type:e,$elements:t})};return this.enqueue("autocapture",u,n),this},r.prototype.groups=function(e){var t=this.props.$groups||{};return this.register({$groups:b(b({},t),e)}),Object.keys(e).find(function(i){return t[i]!==e[i]})&&this.reloadFeatureFlags(),this},r.prototype.group=function(e,t,i,n){var o;return this.groups((o={},o[e]=t,o)),i&&this.groupIdentify(e,t,i,n),this},r.prototype.groupIdentify=function(e,t,i,n){var o=this.getDistinctId(),u=this.enrichProperties({});return s.prototype.groupIdentifyStateless.call(this,e,t,i,n,o,u),this},r.prototype.setPersonPropertiesForFlags=function(e){var t=this.getPersistedProperty(P.PersonProperties)||{};return this.setPersistedProperty(P.PersonProperties,b(b({},t),e)),this},r.prototype.resetPersonPropertiesForFlags=function(){this.setPersistedProperty(P.PersonProperties,{})},r.prototype.personProperties=function(e){return this.setPersonPropertiesForFlags(e)},r.prototype.setGroupPropertiesForFlags=function(e){var t=this.getPersistedProperty(P.GroupProperties)||{};return Object.keys(t).length!==0&&Object.keys(t).forEach(function(i){t[i]=b(b({},t[i]),e[i]),delete e[i]}),this.setPersistedProperty(P.GroupProperties,b(b({},t),e)),this},r.prototype.resetGroupPropertiesForFlags=function(){this.setPersistedProperty(P.GroupProperties,{})},r.prototype.groupProperties=function(e){return this.setGroupPropertiesForFlags(e)},r.prototype.decideAsync=function(e){return e===void 0&&(e=!0),this._decideResponsePromise?this._decideResponsePromise:this._decideAsync(e)},r.prototype._decideAsync=function(e){return e===void 0&&(e=!0),A(this,void 0,void 0,function(){var t,i,n,o,u,l=this;return x(this,function(c){return t=this.getDistinctId(),i=this.props.$groups||{},n=this.getPersistedProperty(P.PersonProperties)||{},o=this.getPersistedProperty(P.GroupProperties)||{},u={$anon_distinct_id:e?this.getAnonymousId():void 0},this._decideResponsePromise=s.prototype.getDecide.call(this,t,i,n,o,u).then(function(h){if(h!=null&&h.featureFlags){var y=h.featureFlags,d=h.featureFlagPayloads;if(h.errorsWhileComputingFlags){var f=l.getPersistedProperty(P.FeatureFlags),a=l.getPersistedProperty(P.FeatureFlagPayloads);y=b(b({},f),h.featureFlags),d=b(b({},a),h.featureFlagPayloads)}l.setKnownFeatureFlags(y),l.setKnownFeatureFlagPayloads(d)}return h}).finally(function(){l._decideResponsePromise=void 0}),[2,this._decideResponsePromise]})})},r.prototype.setKnownFeatureFlags=function(e){this.setPersistedProperty(P.FeatureFlags,e),this._events.emit("featureflags",e)},r.prototype.setKnownFeatureFlagPayloads=function(e){this.setPersistedProperty(P.FeatureFlagPayloads,e)},r.prototype.getFeatureFlag=function(e){var t=this.getFeatureFlags();if(t){var i=t[e];return i===void 0&&(i=!1),this.sendFeatureFlagEvent&&!this.flagCallReported[e]&&(this.flagCallReported[e]=!0,this.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:i})),i}},r.prototype.getFeatureFlagPayload=function(e){var t=this.getFeatureFlagPayloads();if(t){var i=t[e];return i===void 0?null:this._parsePayload(i)}},r.prototype.getFeatureFlagPayloads=function(){var e=this,t=this.getPersistedProperty(P.FeatureFlagPayloads);return t&&Object.fromEntries(Object.entries(t).map(function(i){var n=i[0],o=i[1];return[n,e._parsePayload(o)]}))},r.prototype.getFeatureFlags=function(){var e=this.getPersistedProperty(P.FeatureFlags),t=this.getPersistedProperty(P.OverrideFeatureFlags);if(!t)return e;e=e||{};for(var i in t)t[i]?e[i]=t[i]:delete e[i];return e},r.prototype.getFeatureFlagsAndPayloads=function(){var e=this.getFeatureFlags(),t=this.getFeatureFlagPayloads();return{flags:e,payloads:t}},r.prototype.isFeatureEnabled=function(e){var t=this.getFeatureFlag(e);if(t!==void 0)return!!t},r.prototype.reloadFeatureFlags=function(e){this.decideAsync().then(function(t){e==null||e(void 0,t==null?void 0:t.featureFlags)}).catch(function(t){e==null||e(t,void 0),e||console.log("[PostHog] Error reloading feature flags",t)})},r.prototype.reloadFeatureFlagsAsync=function(e){var t;return e===void 0&&(e=!0),A(this,void 0,void 0,function(){return x(this,function(i){switch(i.label){case 0:return[4,this.decideAsync(e)];case 1:return[2,(t=i.sent())===null||t===void 0?void 0:t.featureFlags]}})})},r.prototype.onFeatureFlags=function(e){var t=this;return this.on("featureflags",function(){return A(t,void 0,void 0,function(){var i;return x(this,function(n){return i=this.getFeatureFlags(),i&&e(i),[2]})})})},r.prototype.onFeatureFlag=function(e,t){var i=this;return this.on("featureflags",function(){return A(i,void 0,void 0,function(){var n;return x(this,function(o){return n=this.getFeatureFlag(e),n!==void 0&&t(n),[2]})})})},r.prototype.overrideFeatureFlag=function(e){return e===null?this.setPersistedProperty(P.OverrideFeatureFlags,null):this.setPersistedProperty(P.OverrideFeatureFlags,e)},r})(X);var ge=function(){function s(){this._memoryStorage={}}return s.prototype.getProperty=function(r){return this._memoryStorage[r]},s.prototype.setProperty=function(r,e){this._memoryStorage[r]=e!==null?e:void 0},s}(),U=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!U){var we=require("axios");U=function(s,r){return A(void 0,void 0,void 0,function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,we.request({url:s,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:function(){return!0}})];case 1:return e=t.sent(),[2,{status:e.status,text:function(){return A(void 0,void 0,void 0,function(){return x(this,function(i){return[2,e.data]})})},json:function(){return A(void 0,void 0,void 0,function(){return x(this,function(i){return[2,e.data]})})}}]}})})}}var Z=U,Fe=1152921504606847e3,H=function(s){k(r,s);function r(e){var t=s.call(this)||this;return Error.captureStackTrace(t,t.constructor),t.name="ClientError",t.message=e,Object.setPrototypeOf(t,r.prototype),t}return r}(Error),E=function(s){k(r,s);function r(e){var t=s.call(this,e)||this;return t.name=t.constructor.name,Error.captureStackTrace(t,t.constructor),Object.setPrototypeOf(t,r.prototype),t}return r}(Error),me=function(){function s(r){var e=r.pollingInterval,t=r.personalApiKey,i=r.projectApiKey,n=r.timeout,o=r.host,u=oe(r,["pollingInterval","personalApiKey","projectApiKey","timeout","host"]);this.debugMode=!1,this.pollingInterval=e,this.personalApiKey=t,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=o,this.poller=void 0,this.fetch=u.fetch||Z,this.onError=u.onError,this.loadFeatureFlags()}return s.prototype.debug=function(r){r===void 0&&(r=!0),this.debugMode=r},s.prototype.getFeatureFlag=function(r,e,t,i,n){var o;return t===void 0&&(t={}),i===void 0&&(i={}),n===void 0&&(n={}),A(this,void 0,void 0,function(){var u,l,c,h,y;return x(this,function(d){switch(d.label){case 0:return[4,this.loadFeatureFlags()];case 1:if(d.sent(),u=void 0,l=void 0,!this.loadedSuccessfullyOnce)return[2,u];for(c=0,h=this.featureFlags;c<h.length;c++)if(y=h[c],r===y.key){l=y;break}if(l!==void 0)try{u=this.computeFlagLocally(l,e,t,i,n),this.debugMode&&console.debug("Successfully computed flag locally: ".concat(r," -> ").concat(u))}catch(f){f instanceof E?this.debugMode&&console.debug("InconclusiveMatchError when computing flag locally: ".concat(r,": ").concat(f)):f instanceof Error&&((o=this.onError)===null||o===void 0||o.call(this,new Error("Error computing flag locally: ".concat(r,": ").concat(f))))}return[2,u]}})})},s.prototype.computeFeatureFlagPayloadLocally=function(r,e){var t,i,n,o,u,l,c,h;return A(this,void 0,void 0,function(){var y;return x(this,function(d){switch(d.label){case 0:return[4,this.loadFeatureFlags()];case 1:return d.sent(),y=void 0,this.loadedSuccessfullyOnce?(typeof e=="boolean"?y=(o=(n=(i=(t=this.featureFlagsByKey)===null||t===void 0?void 0:t[r])===null||i===void 0?void 0:i.filters)===null||n===void 0?void 0:n.payloads)===null||o===void 0?void 0:o[e.toString()]:typeof e=="string"&&(y=(h=(c=(l=(u=this.featureFlagsByKey)===null||u===void 0?void 0:u[r])===null||l===void 0?void 0:l.filters)===null||c===void 0?void 0:c.payloads)===null||h===void 0?void 0:h[e]),y===void 0?[2,null]:[2,y]):[2,void 0]}})})},s.prototype.getAllFlagsAndPayloads=function(r,e,t,i){return e===void 0&&(e={}),t===void 0&&(t={}),i===void 0&&(i={}),A(this,void 0,void 0,function(){var n,o,u,l=this;return x(this,function(c){switch(c.label){case 0:return[4,this.loadFeatureFlags()];case 1:return c.sent(),n={},o={},u=this.featureFlags.length==0,this.featureFlags.map(function(h){return A(l,void 0,void 0,function(){var y,d,f,a;return x(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),y=this.computeFlagLocally(h,r,e,t,i),n[h.key]=y,[4,this.computeFeatureFlagPayloadLocally(h.key,y)];case 1:return d=v.sent(),d&&(o[h.key]=d),[3,3];case 2:return f=v.sent(),f instanceof E||f instanceof Error&&((a=this.onError)===null||a===void 0||a.call(this,new Error("Error computing flag locally: ".concat(h.key,": ").concat(f)))),u=!0,[3,3];case 3:return[2]}})})}),[2,{response:n,payloads:o,fallbackToDecide:u}]}})})},s.prototype.computeFlagLocally=function(r,e,t,i,n){if(t===void 0&&(t={}),i===void 0&&(i={}),n===void 0&&(n={}),r.ensure_experience_continuity)throw new E("Flag has experience continuity enabled");if(!r.active)return!1;var o=r.filters||{},u=o.aggregation_group_type_index;if(u!=null){var l=this.groupTypeMapping[String(u)];if(!l)throw this.debugMode&&console.warn("[FEATURE FLAGS] Unknown group type index ".concat(u," for feature flag ").concat(r.key)),new E("Flag has unknown group type index");if(!(l in t))return this.debugMode&&console.warn("[FEATURE FLAGS] Can't compute group feature flag: ".concat(r.key," without group names passed in")),!1;var c=n[l];return this.matchFeatureFlagProperties(r,t[l],c)}else return this.matchFeatureFlagProperties(r,e,i)},s.prototype.matchFeatureFlagProperties=function(r,e,t){for(var i,n=r.filters||{},o=n.groups||[],u=!1,l=void 0,c=Q([],o,!0).sort(function(p,w){var g=!!p.variant,m=!!w.variant;return g&&m?0:g?-1:m?1:0}),h=function(p){try{if(y.isConditionMatch(r,e,p,t)){var w=p.variant,g=((i=n.multivariate)===null||i===void 0?void 0:i.variants)||[];return w&&g.some(function(m){return m.key===w})?l=w:l=y.getMatchingVariant(r,e)||!0,"break"}}catch(m){if(m instanceof E)u=!0;else throw m}},y=this,d=0,f=c;d<f.length;d++){var a=f[d],v=h(a);if(v==="break")break}if(l!==void 0)return l;if(u)throw new E("Can't determine if feature flag is enabled or not with given properties");return!1},s.prototype.isConditionMatch=function(r,e,t,i){var n=t.rollout_percentage;if((t.properties||[]).length>0){for(var o=0,u=t.properties;o<u.length;o++){var l=u[o],c=l.type,h=!1;if(c==="cohort"?h=te(l,i,this.cohorts):h=ee(l,i),!h)return!1}if(n==null)return!0}return!(n!=null&&N(r.key,e)>n/100)},s.prototype.getMatchingVariant=function(r,e){var t=N(r.key,e,"variant"),i=this.variantLookupTable(r).find(function(n){return t>=n.valueMin&&t<n.valueMax});if(i)return i.key},s.prototype.variantLookupTable=function(r){var e,t=[],i=0,n=0,o=r.filters||{},u=((e=o.multivariate)===null||e===void 0?void 0:e.variants)||[];return u.forEach(function(l){n=i+l.rollout_percentage/100,t.push({valueMin:i,valueMax:n,key:l.key}),i=n}),t},s.prototype.loadFeatureFlags=function(r){return r===void 0&&(r=!1),A(this,void 0,void 0,function(){return x(this,function(e){switch(e.label){case 0:return!this.loadedSuccessfullyOnce||r?[4,this._loadFeatureFlags()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},s.prototype._loadFeatureFlags=function(){var r,e;return A(this,void 0,void 0,function(){var t,i,n,o=this;return x(this,function(u){switch(u.label){case 0:this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(function(){return o._loadFeatureFlags()},this.pollingInterval),u.label=1;case 1:return u.trys.push([1,4,,5]),[4,this._requestFeatureFlagDefinitions()];case 2:if(t=u.sent(),t&&t.status===401)throw new H("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 i=u.sent(),"flags"in i||(r=this.onError)===null||r===void 0||r.call(this,new Error("Invalid response when getting feature flags: ".concat(JSON.stringify(i)))),this.featureFlags=i.flags||[],this.featureFlagsByKey=this.featureFlags.reduce(function(l,c){return l[c.key]=c,l},{}),this.groupTypeMapping=i.group_type_mapping||{},this.cohorts=i.cohorts||[],this.loadedSuccessfullyOnce=!0,[3,5];case 4:return n=u.sent(),n instanceof H&&((e=this.onError)===null||e===void 0||e.call(this,n)),[3,5];case 5:return[2]}})})},s.prototype._requestFeatureFlagDefinitions=function(){return A(this,void 0,void 0,function(){var r,e,t,i;return x(this,function(n){switch(n.label){case 0:r="".concat(this.host,"/api/feature_flag/local_evaluation?token=").concat(this.projectApiKey,"&send_cohorts"),e={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(this.personalApiKey),"user-agent":"posthog-node/".concat(G)}},t=null,this.timeout&&typeof this.timeout=="number"&&(i=new AbortController,t=Y(function(){i.abort()},this.timeout),e.signal=i.signal),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.fetch(r,e)];case 2:return[2,n.sent()];case 3:return clearTimeout(t),[7];case 4:return[2]}})})},s.prototype.stopPoller=function(){clearTimeout(this.poller)},s}();function N(s,r,e){e===void 0&&(e="");var t=ie.createHash();return t.update("".concat(s,".").concat(r).concat(e)),parseInt(t.digest("hex").slice(0,15),16)/Fe}function ee(s,r){var e=s.key,t=s.value,i=s.operator||"exact";if(e in r){if(i==="is_not_set")throw new E("Operator is_not_set is not supported")}else throw new E("Property ".concat(e," not found in propertyValues"));var n=r[e];function o(y,d){return Array.isArray(y)?y.map(function(f){return String(f).toLowerCase()}).includes(String(d).toLowerCase()):String(y).toLowerCase()===String(d).toLowerCase()}function u(y,d,f){if(f==="gt")return y>d;if(f==="gte")return y>=d;if(f==="lt")return y<d;if(f==="lte")return y<=d;throw new Error("Invalid operator: ".concat(f))}switch(i){case"exact":return o(t,n);case"is_not":return!o(t,n);case"is_set":return e in r;case"icontains":return String(n).toLowerCase().includes(String(t).toLowerCase());case"not_icontains":return!String(n).toLowerCase().includes(String(t).toLowerCase());case"regex":return q(String(t))&&String(n).match(String(t))!==null;case"not_regex":return q(String(t))&&String(n).match(String(t))===null;case"gt":case"gte":case"lt":case"lte":{var l=typeof t=="number"?t:null;if(typeof t=="string")try{l=parseFloat(t)}catch{}return l!=null&&n!=null?typeof n=="string"?u(n,String(t),i):u(n,l,i):u(String(n),String(t),i)}case"is_date_after":case"is_date_before":{var c=be(String(t));if(c==null&&(c=J(t)),c==null)throw new E("Invalid date: ".concat(t));var h=J(n);return["is_date_before"].includes(i)?h<c:h>c}default:throw new E("Unknown operator: ".concat(i))}}function te(s,r,e){var t=String(s.value);if(!(t in e))throw new E("can't match cohort without a given cohort property value");var i=e[t];return re(i,r,e)}function re(s,r,e){if(!s)return!0;var t=s.type,i=s.values;if(!i||i.length===0)return!0;var n=!1;if("values"in i[0]){for(var o=0,u=i;o<u.length;o++){var l=u[o];try{var c=re(l,r,e);if(t==="AND"){if(!c)return!1}else if(c)return!0}catch(f){if(f instanceof E)console.debug("Failed to compute property ".concat(l," locally: ").concat(f)),n=!0;else throw f}}if(n)throw new E("Can't match cohort without a given cohort property value");return t==="AND"}else{for(var h=0,y=i;h<y.length;h++){var l=y[h];try{var c=void 0;l.type==="cohort"?c=te(l,r,e):c=ee(l,r);var d=l.negation||!1;if(t==="AND"){if(!c&&!d||c&&d)return!1}else if(c&&!d||!c&&d)return!0}catch(a){if(a instanceof E)console.debug("Failed to compute property ".concat(l," locally: ").concat(a)),n=!0;else throw a}}if(n)throw new E("can't match cohort without a given cohort property value");return t==="AND"}}function q(s){try{return new RegExp(s),!0}catch{return!1}}function J(s){if(s instanceof Date)return s;if(typeof s=="string"||typeof s=="number"){var r=new Date(s);if(!isNaN(r.valueOf()))return r;throw new E("".concat(s," is in an invalid date format"))}else throw new E("The date provided ".concat(s," must be a string, number, or date object"))}function be(s){var r=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,e=s.match(r),t=new Date(new Date().toISOString());if(e){if(!e.groups)return null;var i=parseInt(e.groups.number);if(i>=1e4)return null;var n=e.groups.interval;if(n=="h")t.setUTCHours(t.getUTCHours()-i);else if(n=="d")t.setUTCDate(t.getUTCDate()-i);else if(n=="w")t.setUTCDate(t.getUTCDate()-i*7);else if(n=="m")t.setUTCMonth(t.getUTCMonth()-i);else if(n=="y")t.setUTCFullYear(t.getUTCFullYear()-i);else return null;return t}else return null}var _e=30*1e3,Pe=50*1e3,Ae=function(s){k(r,s);function r(e,t){t===void 0&&(t={});var i=this,n;return t.captureMode=(t==null?void 0:t.captureMode)||"json",i=s.call(this,e,t)||this,i._memoryStorage=new ge,i.options=t,t.personalApiKey&&(i.featureFlagsPoller=new me({pollingInterval:typeof t.featureFlagsPollingInterval=="number"?t.featureFlagsPollingInterval:_e,personalApiKey:t.personalApiKey,projectApiKey:e,timeout:(n=t.requestTimeout)!==null&&n!==void 0?n:1e4,host:i.host,fetch:t.fetch,onError:function(o){i._events.emit("error",o)}})),i.distinctIdHasSentFlagCalls={},i.maxCacheSize=t.maxCacheSize||Pe,i}return r.prototype.getPersistedProperty=function(e){return this._memoryStorage.getProperty(e)},r.prototype.setPersistedProperty=function(e,t){return this._memoryStorage.setProperty(e,t)},r.prototype.fetch=function(e,t){return this.options.fetch?this.options.fetch(e,t):Z(e,t)},r.prototype.getLibraryId=function(){return"posthog-node"},r.prototype.getLibraryVersion=function(){return G},r.prototype.getCustomUserAgent=function(){return"posthog-node/".concat(G)},r.prototype.enable=function(){return s.prototype.optIn.call(this)},r.prototype.disable=function(){return s.prototype.optOut.call(this)},r.prototype.debug=function(e){var t;e===void 0&&(e=!0),s.prototype.debug.call(this,e),(t=this.featureFlagsPoller)===null||t===void 0||t.debug(e)},r.prototype.capture=function(e){var t=this,i=e.distinctId,n=e.event,o=e.properties,u=e.groups,l=e.sendFeatureFlags,c=e.timestamp,h=e.disableGeoip,y=e.uuid,d=function(a){s.prototype.captureStateless.call(t,i,n,a,{timestamp:c,disableGeoip:h,uuid:y})},f=Promise.resolve().then(function(){return A(t,void 0,void 0,function(){var a,v,p,w,g,m,F,_;return x(this,function(S){switch(S.label){case 0:return l?[4,s.prototype.getFeatureFlagsStateless.call(this,i,u,void 0,void 0,h)]:[3,2];case 1:return[2,S.sent()];case 2:if(!((((_=(F=this.featureFlagsPoller)===null||F===void 0?void 0:F.featureFlags)===null||_===void 0?void 0:_.length)||0)>0))return[3,4];for(a={},v=0,p=Object.entries(u||{});v<p.length;v++)w=p[v],g=w[0],m=w[1],a[g]=String(m);return[4,this.getAllFlags(i,{groups:a,disableGeoip:h,onlyEvaluateLocally:!0})];case 3:return[2,S.sent()];case 4:return[2,{}]}})})}).then(function(a){var v={};if(a)for(var p=0,w=Object.entries(a);p<w.length;p++){var g=w[p],m=g[0],F=g[1];v["$feature/".concat(m)]=F}var _=Object.keys(a||{}).filter(function(S){return(a==null?void 0:a[S])!==!1});return _.length>0&&(v.$active_feature_flags=_),v}).catch(function(){return{}}).then(function(a){d(b(b(b({},a),o),{$groups:u}))});this.addPendingPromise(f)},r.prototype.identify=function(e){var t=e.distinctId,i=e.properties,n=e.disableGeoip,o=(i==null?void 0:i.$set)||i;s.prototype.identifyStateless.call(this,t,{$set:o},{disableGeoip:n})},r.prototype.alias=function(e){s.prototype.aliasStateless.call(this,e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})},r.prototype.getFeatureFlag=function(e,t,i){var n;return A(this,void 0,void 0,function(){var o,u,l,c,h,y,d,f,a,v,p,w,g;return x(this,function(m){switch(m.label){case 0:return o=i||{},u=o.groups,l=o.disableGeoip,c=i||{},h=c.onlyEvaluateLocally,y=c.sendFeatureFlagEvents,d=c.personProperties,f=c.groupProperties,a=this.addLocalPersonAndGroupProperties(t,u,d,f),d=a.allPersonProperties,f=a.allGroupProperties,h==null&&(h=!1),y==null&&(y=!0),[4,(n=this.featureFlagsPoller)===null||n===void 0?void 0:n.getFeatureFlag(e,t,u,d,f)];case 1:return v=m.sent(),p=v!==void 0,!p&&!h?[4,s.prototype.getFeatureFlagStateless.call(this,e,t,u,d,f,l)]:[3,3];case 2:v=m.sent(),m.label=3;case 3:return w="".concat(e,"_").concat(v),y&&(!(t in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[t].includes(w))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[t])?this.distinctIdHasSentFlagCalls[t].push(w):this.distinctIdHasSentFlagCalls[t]=[w],this.capture({distinctId:t,event:"$feature_flag_called",properties:(g={$feature_flag:e,$feature_flag_response:v,locally_evaluated:p},g["$feature/".concat(e)]=v,g),groups:u,disableGeoip:l})),[2,v]}})})},r.prototype.getFeatureFlagPayload=function(e,t,i,n){var o;return A(this,void 0,void 0,function(){var u,l,c,h,y,d,f,a,v,p;return x(this,function(w){switch(w.label){case 0:return u=n||{},l=u.groups,c=u.disableGeoip,h=n||{},y=h.onlyEvaluateLocally,h.sendFeatureFlagEvents,d=h.personProperties,f=h.groupProperties,a=this.addLocalPersonAndGroupProperties(t,l,d,f),d=a.allPersonProperties,f=a.allGroupProperties,v=void 0,i?[3,2]:[4,this.getFeatureFlag(e,t,b(b({},n),{onlyEvaluateLocally:!0}))];case 1:i=w.sent(),w.label=2;case 2:return i?[4,(o=this.featureFlagsPoller)===null||o===void 0?void 0:o.computeFeatureFlagPayloadLocally(e,i)]:[3,4];case 3:v=w.sent(),w.label=4;case 4:return y==null&&(y=!1),y==null&&(y=!1),p=v!==void 0,!p&&!y?[4,s.prototype.getFeatureFlagPayloadStateless.call(this,e,t,l,d,f,c)]:[3,6];case 5:v=w.sent(),w.label=6;case 6:try{return[2,JSON.parse(v)]}catch{return[2,v]}return[2]}})})},r.prototype.isFeatureEnabled=function(e,t,i){return A(this,void 0,void 0,function(){var n;return x(this,function(o){switch(o.label){case 0:return[4,this.getFeatureFlag(e,t,i)];case 1:return n=o.sent(),n===void 0?[2,void 0]:[2,!!n||!1]}})})},r.prototype.getAllFlags=function(e,t){return A(this,void 0,void 0,function(){var i;return x(this,function(n){switch(n.label){case 0:return[4,this.getAllFlagsAndPayloads(e,t)];case 1:return i=n.sent(),[2,i.featureFlags]}})})},r.prototype.getAllFlagsAndPayloads=function(e,t){var i;return A(this,void 0,void 0,function(){var n,o,u,l,c,h,y,d,f,a,v,p,w;return x(this,function(g){switch(g.label){case 0:return n=t||{},o=n.groups,u=n.disableGeoip,l=t||{},c=l.onlyEvaluateLocally,h=l.personProperties,y=l.groupProperties,d=this.addLocalPersonAndGroupProperties(e,o,h,y),h=d.allPersonProperties,y=d.allGroupProperties,c==null&&(c=!1),[4,(i=this.featureFlagsPoller)===null||i===void 0?void 0:i.getAllFlagsAndPayloads(e,o,h,y)];case 1:return f=g.sent(),a={},v={},p=!0,f&&(a=f.response,v=f.payloads,p=f.fallbackToDecide),p&&!c?[4,s.prototype.getFeatureFlagsAndPayloadsStateless.call(this,e,o,h,y,u)]:[3,3];case 2:w=g.sent(),a=b(b({},a),w.flags||{}),v=b(b({},v),w.payloads||{}),g.label=3;case 3:return[2,{featureFlags:a,featureFlagPayloads:v}]}})})},r.prototype.groupIdentify=function(e){var t=e.groupType,i=e.groupKey,n=e.properties,o=e.distinctId,u=e.disableGeoip;s.prototype.groupIdentifyStateless.call(this,t,i,n,{disableGeoip:u},o)},r.prototype.reloadFeatureFlags=function(){var e;return A(this,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:return[4,(e=this.featureFlagsPoller)===null||e===void 0?void 0:e.loadFeatureFlags(!0)];case 1:return t.sent(),[2]}})})},r.prototype.shutdown=function(){this.shutdownAsync()},r.prototype.shutdownAsync=function(){var e;return A(this,void 0,void 0,function(){return x(this,function(t){return(e=this.featureFlagsPoller)===null||e===void 0||e.stopPoller(),[2,s.prototype.shutdownAsync.call(this)]})})},r.prototype.addLocalPersonAndGroupProperties=function(e,t,i,n){var o=b({distinct_id:e},i||{}),u={};if(t)for(var l=0,c=Object.keys(t);l<c.length;l++){var h=c[l];u[h]=b({$group_key:t[h]},(n==null?void 0:n[h])||{})}return{allPersonProperties:o,allGroupProperties:u}},r}(X),xe=function(){function s(r,e,t,i){var n;this.posthog=r,this.posthogHost=e,this.organization=t,this.prefix=i,this.name="posthog-node",this.posthogHost=(n=r.options.host)!==null&&n!==void 0?n:"https://app.posthog.com"}return s.prototype.setupOnce=function(r,e){var t=this;r(function(i){var n,o,u,l,c,h,y,d;if(((n=i.exception)===null||n===void 0?void 0:n.values)===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});var f=e(),a=i.tags[s.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL("/person/".concat(a),t.posthogHost).toString();var v={$exception_message:(o=i.exception.values[0])===null||o===void 0?void 0:o.value,$exception_type:(u=i.exception.values[0])===null||u===void 0?void 0:u.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(l=i.exception.values[0])===null||l===void 0?void 0:l.value,$sentry_exception_type:(c=i.exception.values[0])===null||c===void 0?void 0:c.type,$sentry_tags:i.tags},p=(y=(h=f.getClient())===null||h===void 0?void 0:h.getDsn())===null||y===void 0?void 0:y.projectId;return t.organization!==void 0&&p!==void 0&&i.event_id!==void 0&&(v.$sentry_url="".concat((d=t.prefix)!==null&&d!==void 0?d:"https://sentry.io/organizations","/").concat(t.organization,"/issues/?project=").concat(p,"&query=").concat(i.event_id)),t.posthog.capture({event:"$exception",distinctId:a,properties:v}),i})},s.POSTHOG_ID_TAG="posthog_distinct_id",s}();export{Ae as PostHog,xe as PostHogSentryIntegration};