posthog-js 1.27.0-alpha4 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 1.27.0 - 2022-08-01
2
+
3
+ - refactor: Dummy commit to trigger release (#431)
4
+ - chore(typescript): convert library to typescript (#425)
5
+
6
+ ## 1.26.2 - 2022-07-28
7
+
8
+ - fix(session-id): reset session_id on reset() call (#430)
9
+
10
+ ## 1.26.1 - 2022-07-28
11
+
12
+ - fix(storage): Fix cross subdomain cookies for localpluscookie (#429)
13
+ - fix: Testcafe using Posthog cloud (#428)
14
+
1
15
  ## 1.26.0 - 2022-07-19
2
16
 
3
17
  - fix: dont set initial referrer (#426)
package/dist/array.js CHANGED
@@ -1,7 +1,7 @@
1
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"iwXh":[function(require,module,exports) {
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LZString=void 0;var o=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",n={};function t(o,r){if(!n[o]){n[o]={};for(var e=0;e<o.length;e++)n[o][o.charAt(e)]=e}return n[o][r]}var s={compressToBase64:function(o){if(null==o)return"";var e=s._compress(o,6,function(o){return r.charAt(o)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(o){return null==o?"":""==o?null:s._decompress(o.length,32,function(e){return t(r,o.charAt(e))})},compressToUTF16:function(r){return null==r?"":s._compress(r,15,function(r){return o(r+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:s._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=s.compress(o),e=new Uint8Array(2*r.length),n=0,t=r.length;n<t;n++){var i=r.charCodeAt(n);e[2*n]=i>>>8,e[2*n+1]=i%256}return e},decompressFromUint8Array:function(r){if(null==r)return s.decompress(r);for(var e=new Array(r.length/2),n=0,t=e.length;n<t;n++)e[n]=256*r[2*n]+r[2*n+1];var i=[];return e.forEach(function(r){i.push(o(r))}),s.decompress(i.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":s._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(o){return null==o?"":""==o?null:(o=o.replace(/ /g,"+"),s._decompress(o.length,32,function(r){return t(e,o.charAt(r))}))},compress:function(r){return s._compress(r,16,function(r){return o(r)})},_compress:function(o,r,e){if(null==o)return"";var n,t,s,i="",p="",c="",a=2,u=3,l=2,f=0,h=0,d={},m={},v=[];for(s=0;s<o.length;s+=1)if(i=o.charAt(s),Object.prototype.hasOwnProperty.call(d,i)||(d[i]=u++,m[i]=!0),p=c+i,Object.prototype.hasOwnProperty.call(d,p))c=p;else{if(Object.prototype.hasOwnProperty.call(m,c)){if(c.charCodeAt(0)<256){for(n=0;n<l;n++)f<<=1,h==r-1?(h=0,v.push(e(f)),f=0):h++;for(t=c.charCodeAt(0),n=0;n<8;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1}else{for(t=1,n=0;n<l;n++)f=f<<1|t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t=0;for(t=c.charCodeAt(0),n=0;n<16;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1}0==--a&&(a=Math.pow(2,l),l++),delete m[c]}else for(t=d[c],n=0;n<l;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1;0==--a&&(a=Math.pow(2,l),l++),d[p]=u++,c=String(i)}if(""!==c){if(Object.prototype.hasOwnProperty.call(m,c)){if(c.charCodeAt(0)<256){for(n=0;n<l;n++)f<<=1,h==r-1?(h=0,v.push(e(f)),f=0):h++;for(t=c.charCodeAt(0),n=0;n<8;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1}else{for(t=1,n=0;n<l;n++)f=f<<1|t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t=0;for(t=c.charCodeAt(0),n=0;n<16;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1}0==--a&&(a=Math.pow(2,l),l++),delete m[c]}else for(t=d[c],n=0;n<l;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1;0==--a&&(a=Math.pow(2,l),l++)}for(t=2,n=0;n<l;n++)f=f<<1|1&t,h==r-1?(h=0,v.push(e(f)),f=0):h++,t>>=1;for(;;){if(f<<=1,h==r-1){v.push(e(f));break}h++}return v.join("")},decompress:function(o){return null==o?"":""==o?null:s._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(r,e,n){var t,s,i,p,c,a,u,l=[],f=[],h={val:n(0),position:e,index:1},d=4,m=4,v=3,w="";for(t=0;t<3;t+=1)l[t]=t;for(i=0,c=Math.pow(2,2),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;switch(i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 2:return""}for(l[3]=u,s=u,f.push(u);;){if(h.index>r)return"";for(i=0,c=Math.pow(2,v),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;switch(u=i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;l[m++]=o(i),u=m-1,d--;break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=h.val&h.position,h.position>>=1,0==h.position&&(h.position=e,h.val=n(h.index++)),i|=(p>0?1:0)*a,a<<=1;l[m++]=o(i),u=m-1,d--;break;case 2:return f.join("")}if(0==d&&(d=Math.pow(2,v),v++),l[u])w=l[u];else{if(u!==m)return null;w=s+s.charAt(0)}f.push(w),l[m++]=s+w.charAt(0),s=w,0==--d&&(d=Math.pow(2,v),v++)}}};exports.LZString=s;
3
3
  },{}],"EHrm":[function(require,module,exports) {
4
- module.exports={name:"posthog-js",version:"1.27.0-alpha4",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.ts --out-file dist/array.js",serve:"parcel serve src/loader-globals.ts --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-rollup && yarn build-react","build-array":"parcel build src/loader-globals.ts --out-file dist/array.js --public-url=/static","build-rollup":"tsc -b && rollup -c","build-react":"cd react; yarn; yarn build;",lint:"eslint ./src/**/*.{ts,js}",prettier:"prettier --write src/**/*",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest","test-react":"cd react; yarn test","test-watch":"jest --watch",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",types:"dist/module.d.ts",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^7.2.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.14"},devDependencies:{"@babel/core":"7.18.9","@babel/preset-env":"7.18.9","@babel/preset-typescript":"^7.18.6","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-typescript":"^8.3.3","@typescript-eslint/eslint-plugin":"^5.30.7","@typescript-eslint/parser":"^5.30.7","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"10.3.1",eslint:"8.20.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.30.1","eslint-plugin-react-hooks":"^4.6.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^27.5.1",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"1.12.3","posthog-js":"link:.",prettier:"^2.7.1",rollup:"^2.77.0","rollup-plugin-dts":"^4.2.2",rrweb:"^1.1.3",sinon:"9.0.2",testcafe:"^1.19.0","testcafe-browser-provider-browserstack":"^1.14.0",tslib:"^2.4.0",typescript:"^4.7.4"},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint --fix","tsc --noEmit --esModuleInterop --jsx react"]}};
4
+ module.exports={name:"posthog-js",version:"1.28.0",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.ts --out-file dist/array.js",serve:"parcel serve src/loader-globals.ts --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-rollup && yarn build-react","build-array":"parcel build src/loader-globals.ts --out-file dist/array.js --public-url=/static","build-rollup":"tsc -b && rollup -c","build-react":"cd react; yarn; yarn build;",lint:"eslint ./src/**/*.{ts,js}",prettier:"prettier --write src/**/*",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest","test-react":"cd react; yarn test","test-watch":"jest --watch",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",types:"dist/module.d.ts",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^7.2.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.14"},devDependencies:{"@babel/core":"7.18.9","@babel/preset-env":"7.18.9","@babel/preset-typescript":"^7.18.6","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-typescript":"^8.3.3","@typescript-eslint/eslint-plugin":"^5.30.7","@typescript-eslint/parser":"^5.30.7","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"10.3.1",eslint:"8.20.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.30.1","eslint-plugin-react-hooks":"^4.6.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^27.5.1",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"1.12.3","posthog-js":"link:.",prettier:"^2.7.1",rollup:"^2.77.0","rollup-plugin-dts":"^4.2.2",rrweb:"^1.1.3",sinon:"9.0.2",testcafe:"^1.19.0","testcafe-browser-provider-browserstack":"^1.14.0",tslib:"^2.4.0",typescript:"^4.7.4"},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint --fix","tsc --noEmit --esModuleInterop --jsx react"]}};
5
5
  },{}],"C9JJ":[function(require,module,exports) {
6
6
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("../package.json"),r={DEBUG:!1,LIB_VERSION:e.version},t=r;exports.default=t;
7
7
  },{"../package.json":"EHrm"}],"UnXq":[function(require,module,exports) {
@@ -13,7 +13,7 @@ module.exports={name:"posthog-js",version:"1.27.0-alpha4",description:"Posthog-j
13
13
  },{}],"+QN3":[function(require,module,exports) {
14
14
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.autocapture=void 0;var e=require("./utils"),t=require("./autocapture-utils"),n=r(require("./extensions/rageclick"));function r(e){return e&&e.__esModule?e:{default:e}}var i={_initializedTokens:[],_previousElementSibling:function(e){if(e.previousElementSibling)return e.previousElementSibling;var n=e;do{n=n.previousSibling}while(n&&!(0,t.isElementNode)(n));return n},_getPropertiesFromElement:function(n,r,i){var o=n.tagName.toLowerCase(),a={tag_name:o};t.usefulElements.indexOf(o)>-1&&!i&&(a.$el_text=(0,t.getSafeText)(n));var u=(0,t.getClassName)(n);u.length>0&&(a.classes=u.split(" ").filter(function(e){return""!==e})),(0,e._each)(n.attributes,function(e){(0,t.isSensitiveElement)(n)&&-1===["name","id","class"].indexOf(e.name)||r||!(0,t.shouldCaptureValue)(e.value)||(0,t.isAngularStyleAttr)(e.name)||(a["attr__"+e.name]=e.value)});for(var s=1,l=1,c=n;c=this._previousElementSibling(c);)s++,c.tagName===n.tagName&&l++;return a.nth_child=s,a.nth_of_type=l,a},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(n){var r=[];return(0,e._each)(document.querySelectorAll(n.css_selector),function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),(0,t.shouldCaptureValue)(n)&&r.push(n)}),r.join(", ")},_getCustomProperties:function(n){var r=this,i={};return(0,e._each)(this._customProperties,function(o){(0,e._each)(o.event_selectors,function(a){var u=document.querySelectorAll(a);(0,e._each)(u,function(a){(0,e._includes)(n,a)&&(0,t.shouldCaptureElement)(a)&&(i[o.name]=r._extractCustomPropertyValue(o))})})}),i},_getEventTarget:function(e){var t;return void 0===e.target?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null},_captureEvent:function(n,r){var i,o=this,a=this._getEventTarget(n);if((0,t.isTextNode)(a)&&(a=a.parentNode||null),"click"===n.type&&n instanceof MouseEvent&&(null===(i=this.rageclicks)||void 0===i||i.click(n.clientX,n.clientY,(new Date).getTime())),a&&(0,t.shouldCaptureDomEvent)(a,n)){for(var u=[a],s=a;s.parentNode&&!(0,t.isTag)(s,"body");)(0,t.isDocumentFragment)(s.parentNode)?(u.push(s.parentNode.host),s=s.parentNode.host):(u.push(s.parentNode),s=s.parentNode);var l,c=[],_=!1;if((0,e._each)(u,function(n){var i=(0,t.shouldCaptureElement)(n);"a"===n.tagName.toLowerCase()&&(l=n.getAttribute("href"),l=i&&(0,t.shouldCaptureValue)(l)&&l);var a=(0,t.getClassName)(n).split(" ");(0,e._includes)(a,"ph-no-capture")&&(_=!0),c.push(o._getPropertiesFromElement(n,r.get_config("mask_all_element_attributes"),r.get_config("mask_all_text")))}),r.get_config("mask_all_text")||(c[0].$el_text=(0,t.getSafeText)(a)),l&&(c[0].attr__href=l),_)return!1;var d=(0,e._extend)(this._getDefaultProperties(n.type),{$elements:c},this._getCustomProperties(u));return r.capture("$autocapture",d),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(t){var n=this,r=function(e){e=e||window.event,n._captureEvent(e,t)};(0,e._register_event)(document,"submit",r,!1,!0),(0,e._register_event)(document,"change",r,!1,!0),(0,e._register_event)(document,"click",r,!1,!0)},_customProperties:[],rageclicks:null,init:function(e){this.rageclicks=new n.default(e)},afterDecideResponse:function(t,n){var r=n.get_config("token");this._initializedTokens.indexOf(r)>-1?e.logger.log('autocapture already initialized for token "'+r+'"'):(this._initializedTokens.push(r),t&&t.config&&t.config.enable_collect_everything&&n.get_config("autocapture")?(t.custom_properties&&(this._customProperties=t.custom_properties),this._addDomEventHandlers(n)):n.__autocapture_enabled=!1)},enabledForProject:function(t,n,r){if(!t)return!0;n=(0,e._isUndefined)(n)?10:n,r=(0,e._isUndefined)(r)?10:r;for(var i=0,o=0;o<t.length;o++)i+=t.charCodeAt(o);return i%n<r},isBrowserSupported:function(){return(0,e._isFunction)(document.querySelectorAll)}};exports.autocapture=i,(0,e._bind_instance_methods)(i),(0,e._safewrap_instance_methods)(i);
15
15
  },{"./utils":"UnXq","./autocapture-utils":"h4lk","./extensions/rageclick":"SHfu"}],"1GYW":[function(require,module,exports) {
16
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sessionStore=exports.resetSessionStorageSupported=exports.memoryStore=exports.localStore=exports.localPlusCookieStore=exports.cookieStore=void 0;var r=require("./utils"),e=t(require("./config"));function t(r){return r&&r.__esModule?r:{default:r}}var o=function(){return(o=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}).apply(this,arguments)},n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,i={is_supported:function(){return!0},error:function(e){r.logger.error("cookieStore error: "+e)},get:function(r){try{for(var e=r+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var n=t[o];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(i){}return null},parse:function(r){var e;try{e=JSON.parse(i.get(r))||{}}catch(t){}return e},set:function(r,e,t,o,i){try{var c="",s="",u="";if(o){var a=document.location.hostname.match(n),l=a?a[0]:"";c=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),s="; expires="+p.toUTCString()}i&&(u="; secure");var f=r+"="+encodeURIComponent(JSON.stringify(e))+s+"; path=/"+c+u;return document.cookie=f,f}catch(g){return}},remove:function(r,e){try{i.set(r,"",-1,e)}catch(t){return}}};exports.cookieStore=i;var c=null,s={is_supported:function(){if(null!==c)return c;var e=!0;if(window)try{var t="__mplssupport__";s.set(t,"xyz"),'"xyz"'!==s.get(t)&&(e=!1),s.remove(t)}catch(o){e=!1}else e=!1;return e||r.logger.error("localStorage unsupported; falling back to cookie store"),c=e,e},error:function(e){r.logger.error("localStorage error: "+e)},get:function(r){try{return window.localStorage.getItem(r)}catch(e){s.error(e)}return null},parse:function(r){try{return JSON.parse(s.get(r))||{}}catch(e){}return null},set:function(r,e){try{window.localStorage.setItem(r,JSON.stringify(e))}catch(t){s.error(t)}},remove:function(r){try{window.localStorage.removeItem(r)}catch(e){s.error(e)}}};exports.localStore=s;var u=o(o({},s),{parse:function(e){try{var t={};try{(t=i.parse(e)||{}).distinct_id&&i.set(e,{distinct_id:t.distinct_id})}catch(n){}var o=(0,r._extend)(t,JSON.parse(s.get(e)||"{}"));return s.set(e,o),o}catch(n){}return null},set:function(r,e){try{s.set(r,e),e.distinct_id&&i.set(r,{distinct_id:e.distinct_id})}catch(t){s.error(t)}},remove:function(r){try{window.localStorage.removeItem(r),i.remove(r)}catch(e){s.error(e)}}});exports.localPlusCookieStore=u;var a={},l={is_supported:function(){return!0},error:function(e){r.logger.error("memoryStorage error: "+e)},get:function(r){return a[r]||null},parse:function(r){return a[r]||null},set:function(r,e){a[r]=e},remove:function(r){delete a[r]}};exports.memoryStore=l;var p=null,f=function(){p=null};exports.resetSessionStorageSupported=f;var g={is_supported:function(){if(null!==p)return p;if(p=!0,window)try{var r="__support__";g.set(r,"xyz"),'"xyz"'!==g.get(r)&&(p=!1),g.remove(r)}catch(e){p=!1}else p=!1;return p},error:function(t){e.default.DEBUG&&r.logger.error("sessionStorage error: ",t)},get:function(r){try{return window.sessionStorage.getItem(r)}catch(e){g.error(e)}return null},parse:function(r){try{return JSON.parse(g.get(r))||null}catch(e){}return null},set:function(r,e){try{window.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){g.error(t)}},remove:function(r){try{window.sessionStorage.removeItem(r)}catch(e){g.error(e)}}};exports.sessionStore=g;
16
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sessionStore=exports.resetSessionStorageSupported=exports.memoryStore=exports.localStore=exports.localPlusCookieStore=exports.cookieStore=void 0;var r=require("./utils"),e=t(require("./config"));function t(r){return r&&r.__esModule?r:{default:r}}var o=function(){return(o=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}).apply(this,arguments)},n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,i={is_supported:function(){return!0},error:function(e){r.logger.error("cookieStore error: "+e)},get:function(r){try{for(var e=r+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var n=t[o];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(i){}return null},parse:function(r){var e;try{e=JSON.parse(i.get(r))||{}}catch(t){}return e},set:function(r,e,t,o,i){try{var c="",s="",u="";if(o){var a=document.location.hostname.match(n),l=a?a[0]:"";c=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),s="; expires="+p.toUTCString()}i&&(u="; secure");var f=r+"="+encodeURIComponent(JSON.stringify(e))+s+"; path=/"+c+u;return document.cookie=f,f}catch(g){return}},remove:function(r,e){try{i.set(r,"",-1,e)}catch(t){return}}};exports.cookieStore=i;var c=null,s={is_supported:function(){if(null!==c)return c;var e=!0;if(window)try{var t="__mplssupport__";s.set(t,"xyz"),'"xyz"'!==s.get(t)&&(e=!1),s.remove(t)}catch(o){e=!1}else e=!1;return e||r.logger.error("localStorage unsupported; falling back to cookie store"),c=e,e},error:function(e){r.logger.error("localStorage error: "+e)},get:function(r){try{return window.localStorage.getItem(r)}catch(e){s.error(e)}return null},parse:function(r){try{return JSON.parse(s.get(r))||{}}catch(e){}return null},set:function(r,e){try{window.localStorage.setItem(r,JSON.stringify(e))}catch(t){s.error(t)}},remove:function(r){try{window.localStorage.removeItem(r)}catch(e){s.error(e)}}};exports.localStore=s;var u=o(o({},s),{parse:function(e){try{var t={};try{(t=i.parse(e)||{}).distinct_id&&i.set(e,{distinct_id:t.distinct_id})}catch(n){}var o=(0,r._extend)(t,JSON.parse(s.get(e)||"{}"));return s.set(e,o),o}catch(n){}return null},set:function(r,e,t,o,n){try{s.set(r,e),e.distinct_id&&i.set(r,{distinct_id:e.distinct_id},t,o,n)}catch(c){s.error(c)}},remove:function(r,e){try{window.localStorage.removeItem(r),i.remove(r,e)}catch(t){s.error(t)}}});exports.localPlusCookieStore=u;var a={},l={is_supported:function(){return!0},error:function(e){r.logger.error("memoryStorage error: "+e)},get:function(r){return a[r]||null},parse:function(r){return a[r]||null},set:function(r,e){a[r]=e},remove:function(r){delete a[r]}};exports.memoryStore=l;var p=null,f=function(){p=null};exports.resetSessionStorageSupported=f;var g={is_supported:function(){if(null!==p)return p;if(p=!0,window)try{var r="__support__";g.set(r,"xyz"),'"xyz"'!==g.get(r)&&(p=!1),g.remove(r)}catch(e){p=!1}else p=!1;return p},error:function(t){e.default.DEBUG&&r.logger.error("sessionStorage error: ",t)},get:function(r){try{return window.sessionStorage.getItem(r)}catch(e){g.error(e)}return null},parse:function(r){try{return JSON.parse(g.get(r))||null}catch(e){}return null},set:function(r,e){try{window.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){g.error(t)}},remove:function(r){try{window.sessionStorage.removeItem(r)}catch(e){g.error(e)}}};exports.sessionStore=g;
17
17
  },{"./utils":"UnXq","./config":"C9JJ"}],"LECo":[function(require,module,exports) {
18
18
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addOptOutCheck=g,exports.clearOptInOut=u,exports.hasOptedIn=i,exports.hasOptedOut=c,exports.optIn=r,exports.optOut=n,exports.userOptedOut=l;var e=require("./utils"),t=require("./storage"),o="__ph_opt_in_out_";function r(e,t){_(!0,e,t)}function n(e,t){_(!1,e,t)}function i(e,t){return"1"===a(e,t)}function c(e,t){return!!f(t)||"0"===a(e,t)}function u(e,t){p(t=t||{}).remove(s(e,t),!!t.crossSubdomainCookie)}function p(e){return"localStorage"===(e=e||{}).persistenceType?t.localStore:"localStorage+cookie"===e.persistenceType?t.localPlusCookieStore:t.cookieStore}function s(e,t){return((t=t||{}).persistencePrefix||o)+e}function a(e,t){return p(t).get(s(e,t))}function f(t){if(t&&t.respectDnt){var o=t&&t.window||e.window,r=o.navigator||{},n=!1;return(0,e._each)([r.doNotTrack,r.msDoNotTrack,o.doNotTrack],function(t){(0,e._includes)([!0,1,"1","yes"],t)&&(n=!0)}),n}return!1}function _(t,o,r){(0,e._isString)(o)&&o.length?(p(r=r||{}).set(s(o,r),t?1:0,(0,e._isNumber)(r.cookieExpiration)?r.cookieExpiration:null,r.crossSubdomainCookie,r.secureCookie),r.capture&&t&&r.capture(r.captureEventName||"$opt_in",r.captureProperties||{},{send_instantly:!0})):console.error("gdpr."+(t?"optIn":"optOut")+" called with an invalid token")}function l(e,t){var o=!1;try{var r=e.get_config("token"),n=e.get_config("respect_dnt"),i=e.get_config("opt_out_capturing_persistence_type"),u=e.get_config("opt_out_capturing_cookie_prefix")||void 0,p=e.get_config("window");r&&(o=c(r,{respectDnt:n,persistenceType:i,persistencePrefix:u,window:p}))}catch(s){t||console.error("Unexpected error when checking capturing opt-out status: "+s)}return o}function g(e,t,o){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!l(e,o))return t.apply(this,r);var i=r[r.length-1];"function"==typeof i&&i(0)}}
19
19
  },{"./utils":"UnXq","./storage":"1GYW"}],"GxDb":[function(require,module,exports) {
@@ -53,7 +53,7 @@ module.exports={name:"posthog-js",version:"1.27.0-alpha4",description:"Posthog-j
53
53
  },{"./utils":"UnXq","./config":"C9JJ"}],"ivfD":[function(require,module,exports) {
54
54
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SentryIntegration=void 0;var e=function(){return function(e,t,n,s){this.name="posthog-js",this.setupOnce=function(o){o(function(o){if("error"!==o.level||!e.__loaded)return o;o.tags||(o.tags={}),o.tags["PostHog Person URL"]=e.config.api_host+"/person/"+e.get_distinct_id(),e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.config.api_host+"/recordings/#sessionRecordingId="+e.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId);var i={$sentry_event_id:o.event_id,$sentry_exception:o.exception};return t&&n&&(i.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),e.capture("$exception",i),o})}}}();exports.SentryIntegration=e;
55
55
  },{}],"fQdl":[function(require,module,exports) {
56
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostHog=void 0,exports.init_as_module=L,exports.init_from_snippet=U;var e=require("./lz-string"),t=m(require("./config")),i=require("./utils"),o=require("./autocapture"),r=require("./posthog-people"),s=require("./posthog-featureflags"),n=require("./posthog-persistence"),a=require("./extensions/sessionrecording"),c=require("./decide"),_=require("./extensions/toolbar"),p=require("./gdpr-utils"),u=require("./storage"),d=require("./request-queue"),g=require("./capture-metrics"),l=require("./compression"),h=require("./send-request"),f=require("./retry-queue"),y=require("./sessionid"),v=require("./apm"),b=require("./extensions/sentry-integration");function m(e){return e&&e.__esModule?e:{default:e}}var k,w,q,I=function(){return(I=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},x=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var o,r,s=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(a){r={error:a}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n},S=function(e,t,i){if(i||2===arguments.length)for(var o,r=0,s=t.length;r<s;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(k||(k={}));var E=function(){},F={},P="posthog",$=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,A=!$&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),M=function(){var e,t,o;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",token:"",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===(null===(t=null===(e=null===i.document||void 0===i.document?void 0:i.document.location)||void 0===e?void 0:e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:E,store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:!1,secure_cookie:"https:"===(null===(o=null===i.window||void 0===i.window?void 0:i.window.location)||void 0===o?void 0:o.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!0,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;console.error(t)},get_device_id:function(e){return e},_onCapture:E,_capture_metrics:!1,_capture_performance:!1,name:"posthog",callback_fn:"posthog._jsc"}},O=function(e,r,s){var n,c=s!==P&&q?s?q[s]:void 0:q;if(c&&w===k.INIT_MODULE)n=c;else{if(c&&!(0,i._isArray)(c))return void console.error("You have already initialized "+s);n=new T}if(n._init(e,r,s),n.toolbar.maybeLoadEditor(),n.sessionRecording=new a.SessionRecording(n),n.sessionRecording.startRecordingIfEnabled(),n.__autocapture_enabled=n.get_config("autocapture"),n.get_config("autocapture")){o.autocapture.enabledForProject(n.get_config("token"),100,100)?o.autocapture.isBrowserSupported()?o.autocapture.init(n):(n.__autocapture_enabled=!1,i.logger.log("Disabling Automatic Event Collection because this browser is not supported")):(n.__autocapture_enabled=!1,i.logger.log("Not in active bucket: disabling Automatic Event Collection."))}return t.default.DEBUG=t.default.DEBUG||n.get_config("debug"),void 0!==c&&(0,i._isArray)(c)&&(n._execute_array.call(n.people,c.people),n._execute_array(c)),n},T=function(){function o(){this.config=M(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=b.SentryIntegration,this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__autocapture_enabled=void 0,this._jsc=function(){},this.people=new r.PostHogPeople(this),this.featureFlags=new s.PostHogFeatureFlags(this),this.feature_flags=this.featureFlags,this.toolbar=new _.Toolbar(this),this._captureMetrics=void 0,this._requestQueue=void 0,this._retryQueue=void 0,this.persistence=void 0,this.sessionManager=void 0}return o.prototype.init=function(e,t,o){if((0,i._isUndefined)(o))console.error("You must name your new library: init(token, config, name)");else{if(o!==P){var r=O(e,t,o);return q[o]=r,r._loaded(),r}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},o.prototype._init=function(e,t,o){if(void 0===t&&(t={}),this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config((0,i._extend)({},M(),t,{name:o,token:e,callback_fn:(o===P?o:P+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new g.CaptureMetrics(this.get_config("_capture_metrics")),this._requestQueue=new d.RequestQueue(this._captureMetrics,this._handle_queued_event.bind(this)),this._retryQueue=new f.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new n.PostHogPersistence(this.config),this.sessionManager=new y.SessionIdManager(this.config,this.persistence),this._gdpr_init(),!this.get_distinct_id()){var r=this.get_config("get_device_id")((0,i._UUID)());this.register_once({distinct_id:r,$device_id:r},"")}i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},o.prototype._loaded=function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0}),this.get_config("advanced_disable_decide")||new c.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},o.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},o.prototype._dom_loaded=function(){var e=this;this.has_opted_out_capturing()||(0,i._eachArray)(this.__request_queue,function(t){e._send_request.apply(e,S([],x(t),!1))}),this.__request_queue=[],this._start_queue_if_opted_in()},o.prototype._prepare_callback=function(e,t){if((0,i._isUndefined)(e))return null;if($)return function(i){e(i,t)};var o=this._jsc,r=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},s},o.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics)),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendBeacon"})},o.prototype._handle_queued_event=function(e,t,i){var o=JSON.stringify(t);this.__compress_and_send_json_request(e,o,i||F,E)},o.prototype.__compress_and_send_json_request=function(e,t,i,o){var r=x((0,l.compressData)((0,l.decideCompression)(this.compression),t,i),2),s=r[0],n=r[1];this._send_request(e,s,n,o)},o.prototype._send_request=function(e,t,o,r){var s;if(A)this.__request_queue.push([e,t,o,r]);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=(0,i._extend)(n,o||{}),$||(o.method="GET");var a="sendBeacon"in i.window.navigator&&"sendBeacon"===o.transport;if(e=(0,h.addParamsToURL)(e,o.urlQueryArgs||{},{ip:this.get_config("ip")}),(0,i._isObject)(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(a)try{i.window.navigator.sendBeacon(e,(0,h.encodePostData)(t,I(I({},o),{sendBeacon:!0})))}catch(u){this.get_config("debug")&&console.error(u)}else if($)try{(0,h.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(u){console.error(u)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var p=i.document.getElementsByTagName("script")[0];null===(s=p.parentNode)||void 0===s||s.insertBefore(_,p)}}},o.prototype._execute_array=function(e){var t,o=this,r=[],s=[],n=[];(0,i._eachArray)(e,function(e){e&&(t=e[0],(0,i._isArray)(t)?n.push(e):"function"==typeof e?e.call(o):(0,i._isArray)(e)&&"alias"===t?r.push(e):(0,i._isArray)(e)&&-1!==t.indexOf("capture")&&"function"==typeof o[t]?n.push(e):s.push(e))});var a=function(e,t){(0,i._eachArray)(e,function(e){if((0,i._isArray)(e[0])){var o=t;(0,i._each)(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};a(r,this),a(s,this),a(n,this)},o.prototype.push=function(e){this._execute_array([e])},o.prototype.capture=function(e,t,o){if(void 0===o&&(o=F),this.__loaded&&!(0,p.userOptedOut)(this,!1)){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||F).transport;if(r&&(o.transport=r),(0,i._isUndefined)(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!(0,i._isBlockedUA)(i.userAgent)){var s=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var n={event:e,properties:this._calculate_event_properties(e,t||{},s)};"$identify"===e&&o.$set&&(n.$set=o.$set),n=(0,i._copyAndTruncateStrings)(n,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.logger.log("PostHog.js send",n);var a=JSON.stringify(n),c=this.get_config("api_host")+(o.endpoint||"/e/"),_=o!==F;return!this.get_config("request_batching")||_&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(c,a,o):(n.timestamp=new Date,this._requestQueue.enqueue(c,n,o)),this._invokeCaptureHooks(e,n),n}}},o.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},o.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),(0,i._each)(this.__captureHooks,function(t){return t(e)})},o.prototype._calculate_event_properties=function(e,t,o){var r=I({},t);if(r.token=this.get_config("token"),"$snapshot"===e){var s=this.persistence.properties();return r.distinct_id=s.distinct_id,r}if(void 0!==o){var n=(new Date).getTime()-o;r.$duration=parseFloat((n/1e3).toFixed(3))}if(this.sessionManager){var a=this.sessionManager.checkAndGetSessionAndWindowId(),c=a.sessionId,_=a.windowId;r.$session_id=c,r.$window_id=_}r=(0,i._extend)({},i._info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")&&(r=(0,i._extend)(r,(0,v.getPerformanceData)()));var p=this.get_config("property_blacklist");(0,i._isArray)(p)?(0,i._each)(p,function(e){delete r[e]}):console.error("Invalid value for property_blacklist config: "+p);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},o.prototype.register=function(e,t){this.persistence.register(e,t)},o.prototype.register_once=function(e,t,i){this.persistence.register_once(e,t,i)},o.prototype.unregister=function(e){this.persistence.unregister(e)},o.prototype._register_single=function(e,t){var i;this.register(((i={})[e]=t,i))},o.prototype.getFeatureFlag=function(e,t){return this.featureFlags.getFeatureFlag(e,t)},o.prototype.isFeatureEnabled=function(e,t){return this.featureFlags.isFeatureEnabled(e,t)},o.prototype.reloadFeatureFlags=function(){this.featureFlags.reloadFeatureFlags()},o.prototype.onFeatureFlags=function(e){return this.featureFlags.onFeatureFlags(e)},o.prototype.identify=function(e,t,i){if(e){this._captureMetrics.incr("identify");var o=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var r=o;this.register_once({$had_persisted_distinct_id:!0,$device_id:r},"")}e!==o&&e!==this.get_property(n.ALIAS_ID_KEY)&&(this.unregister(n.ALIAS_ID_KEY),this.register({distinct_id:e})),e===o||this.get_property("$device_id")&&o!==this.get_property("$device_id")?(t&&this.people.set(t),i&&this.people.set_once(i)):(this.capture("$identify",{distinct_id:e,$anon_distinct_id:o},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(o)),e!==o&&this.reloadFeatureFlags()}else console.error("Unique user id has not been set in posthog.identify")},o.prototype.group=function(e,t,i){var o;if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:I(I({},r),(o={},o[e]=t,o))}),i&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),r[e]!==t&&this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")},o.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=this.get_config("get_device_id")((0,i._UUID)());this.register_once({distinct_id:o,$device_id:e?o:t},"")},o.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},o.prototype.getGroups=function(){return this.get_property("$groups")||{}},o.prototype.alias=function(e,t){return e===this.get_property(n.PEOPLE_DISTINCT_ID_KEY)?(i.logger.critical("Attempting to create alias for existing People user - aborting."),-2):((0,i._isUndefined)(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(n.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))},o.prototype.set_config=function(e){var o=I({},this.config);(0,i._isObject)(e)&&((0,i._extend)(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),u.localStore.is_supported()&&"true"===u.localStore.get("ph_debug")&&(this.config.debug=!0),this.get_config("debug")&&(t.default.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&o.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},o.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},o.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},o.prototype.sessionRecordingStarted=function(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started())},o.prototype.get_config=function(e){var t;return null===(t=this.config)||void 0===t?void 0:t[e]},o.prototype.get_property=function(e){return this.persistence.props[e]},o.prototype.toString=function(){var e,t=null!==(e=this.get_config("name"))&&void 0!==e?e:P;return t!==P&&(t=P+"."+t),t},o.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&u.localStore.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!u.cookieStore.get("ph_optout")||(u.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},o.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t)},o.prototype._gdpr_call_func=function(e,t){return t=(0,i._extend)({capture:this.capture.bind(this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t||{}),u.localStore.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})},o.prototype.opt_in_capturing=function(e){e=(0,i._extend)({enable_persistence:!0},e||{}),this._gdpr_call_func(p.optIn,e),this._gdpr_update_persistence(e)},o.prototype.opt_out_capturing=function(e){var t=(0,i._extend)({clear_persistence:!0},e||{});this._gdpr_call_func(p.optOut,t),this._gdpr_update_persistence(t)},o.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(p.hasOptedIn,e)},o.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(p.hasOptedOut,e)},o.prototype.clear_opt_in_out_capturing=function(e){var t=(0,i._extend)({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(p.clearOptInOut,t),this._gdpr_update_persistence(t)},o.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(i.window.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))},o.prototype.decodeLZ64=function(t){return e.LZString.decompressFromBase64(t||null)},o}();exports.PostHog=T,(0,i._safewrap_class)(T,["identify"]);var D={},R=function(){(0,i._each)(D,function(e,t){t!==P&&(q[t]=e)})},H=function(){q.init=function(e,t,o){if(o)return q[o]||(q[o]=D[o]=O(e||"",t||{},o),q[o]._loaded()),q[o];var r=q;return D[P]?r=D[P]:e&&((r=O(e,t||{},P))._loaded(),D[P]=r),q=r,w===k.INIT_SNIPPET&&(i.window[P]=q),R(),r}},N=function(){function e(){e.done||(e.done=!0,A=!1,(0,i._each)(D,function(e){e._dom_loaded()}))}i.document.addEventListener&&("complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1)),(0,i._register_event)(i.window,"load",e,!0)};function U(){w=k.INIT_SNIPPET,(0,i._isUndefined)(i.window.posthog)&&(i.window.posthog=[]),(q=i.window.posthog).__loaded||q.config&&q.persistence?console.error("PostHog library has already been downloaded at least once."):((0,i._each)(q._i,function(e){e&&(0,i._isArray)(e)&&(D[e[2]]=O.apply(void 0,S([],x(e),!1)))}),H(),q.init(),(0,i._each)(D,function(e){e._loaded()}),N())}function L(){return w=k.INIT_MODULE,q=new T,H(),q.init(),N(),q}
56
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostHog=void 0,exports.init_as_module=L,exports.init_from_snippet=U;var e=require("./lz-string"),t=b(require("./config")),i=require("./utils"),o=require("./autocapture"),r=require("./posthog-people"),s=require("./posthog-featureflags"),n=require("./posthog-persistence"),a=require("./extensions/sessionrecording"),c=require("./decide"),_=require("./extensions/toolbar"),p=require("./gdpr-utils"),u=require("./storage"),d=require("./request-queue"),g=require("./capture-metrics"),l=require("./compression"),h=require("./send-request"),f=require("./retry-queue"),y=require("./sessionid"),v=require("./apm"),m=require("./extensions/sentry-integration");function b(e){return e&&e.__esModule?e:{default:e}}var k,w,q,I=function(){return(I=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},x=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var o,r,s=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(a){r={error:a}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n},S=function(e,t,i){if(i||2===arguments.length)for(var o,r=0,s=t.length;r<s;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(k||(k={}));var E=function(){},F={},P="posthog",$=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,A=!$&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),M=function(){var e,t,o;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",token:"",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===(null===(t=null===(e=null===i.document||void 0===i.document?void 0:i.document.location)||void 0===e?void 0:e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:E,store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:!1,secure_cookie:"https:"===(null===(o=null===i.window||void 0===i.window?void 0:i.window.location)||void 0===o?void 0:o.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!0,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;console.error(t)},get_device_id:function(e){return e},_onCapture:E,_capture_metrics:!1,_capture_performance:!1,name:"posthog",callback_fn:"posthog._jsc"}},O=function(e,r,s){var n,c=s!==P&&q?s?q[s]:void 0:q;if(c&&w===k.INIT_MODULE)n=c;else{if(c&&!(0,i._isArray)(c))return void console.error("You have already initialized "+s);n=new T}if(n._init(e,r,s),n.toolbar.maybeLoadEditor(),n.sessionRecording=new a.SessionRecording(n),n.sessionRecording.startRecordingIfEnabled(),n.__autocapture_enabled=n.get_config("autocapture"),n.get_config("autocapture")){o.autocapture.enabledForProject(n.get_config("token"),100,100)?o.autocapture.isBrowserSupported()?o.autocapture.init(n):(n.__autocapture_enabled=!1,i.logger.log("Disabling Automatic Event Collection because this browser is not supported")):(n.__autocapture_enabled=!1,i.logger.log("Not in active bucket: disabling Automatic Event Collection."))}return t.default.DEBUG=t.default.DEBUG||n.get_config("debug"),void 0!==c&&(0,i._isArray)(c)&&(n._execute_array.call(n.people,c.people),n._execute_array(c)),n},T=function(){function o(){this.config=M(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=m.SentryIntegration,this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__autocapture_enabled=void 0,this._jsc=function(){},this.people=new r.PostHogPeople(this),this.featureFlags=new s.PostHogFeatureFlags(this),this.feature_flags=this.featureFlags,this.toolbar=new _.Toolbar(this),this._captureMetrics=void 0,this._requestQueue=void 0,this._retryQueue=void 0,this.persistence=void 0,this.sessionManager=void 0}return o.prototype.init=function(e,t,o){if((0,i._isUndefined)(o))console.error("You must name your new library: init(token, config, name)");else{if(o!==P){var r=O(e,t,o);return q[o]=r,r._loaded(),r}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},o.prototype._init=function(e,t,o){if(void 0===t&&(t={}),this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config((0,i._extend)({},M(),t,{name:o,token:e,callback_fn:(o===P?o:P+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new g.CaptureMetrics(this.get_config("_capture_metrics")),this._requestQueue=new d.RequestQueue(this._captureMetrics,this._handle_queued_event.bind(this)),this._retryQueue=new f.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new n.PostHogPersistence(this.config),this.sessionManager=new y.SessionIdManager(this.config,this.persistence),this._gdpr_init(),!this.get_distinct_id()){var r=this.get_config("get_device_id")((0,i._UUID)());this.register_once({distinct_id:r,$device_id:r},"")}i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},o.prototype._loaded=function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0}),this.get_config("advanced_disable_decide")||new c.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},o.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},o.prototype._dom_loaded=function(){var e=this;this.has_opted_out_capturing()||(0,i._eachArray)(this.__request_queue,function(t){e._send_request.apply(e,S([],x(t),!1))}),this.__request_queue=[],this._start_queue_if_opted_in()},o.prototype._prepare_callback=function(e,t){if((0,i._isUndefined)(e))return null;if($)return function(i){e(i,t)};var o=this._jsc,r=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},s},o.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics)),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendBeacon"})},o.prototype._handle_queued_event=function(e,t,i){var o=JSON.stringify(t);this.__compress_and_send_json_request(e,o,i||F,E)},o.prototype.__compress_and_send_json_request=function(e,t,i,o){var r=x((0,l.compressData)((0,l.decideCompression)(this.compression),t,i),2),s=r[0],n=r[1];this._send_request(e,s,n,o)},o.prototype._send_request=function(e,t,o,r){var s;if(A)this.__request_queue.push([e,t,o,r]);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=(0,i._extend)(n,o||{}),$||(o.method="GET");var a="sendBeacon"in i.window.navigator&&"sendBeacon"===o.transport;if(e=(0,h.addParamsToURL)(e,o.urlQueryArgs||{},{ip:this.get_config("ip")}),(0,i._isObject)(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(a)try{i.window.navigator.sendBeacon(e,(0,h.encodePostData)(t,I(I({},o),{sendBeacon:!0})))}catch(u){this.get_config("debug")&&console.error(u)}else if($)try{(0,h.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(u){console.error(u)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var p=i.document.getElementsByTagName("script")[0];null===(s=p.parentNode)||void 0===s||s.insertBefore(_,p)}}},o.prototype._execute_array=function(e){var t,o=this,r=[],s=[],n=[];(0,i._eachArray)(e,function(e){e&&(t=e[0],(0,i._isArray)(t)?n.push(e):"function"==typeof e?e.call(o):(0,i._isArray)(e)&&"alias"===t?r.push(e):(0,i._isArray)(e)&&-1!==t.indexOf("capture")&&"function"==typeof o[t]?n.push(e):s.push(e))});var a=function(e,t){(0,i._eachArray)(e,function(e){if((0,i._isArray)(e[0])){var o=t;(0,i._each)(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};a(r,this),a(s,this),a(n,this)},o.prototype.push=function(e){this._execute_array([e])},o.prototype.capture=function(e,t,o){if(void 0===o&&(o=F),this.__loaded&&!(0,p.userOptedOut)(this,!1)){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||F).transport;if(r&&(o.transport=r),(0,i._isUndefined)(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!(0,i._isBlockedUA)(i.userAgent)){var s=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var n={event:e,properties:this._calculate_event_properties(e,t||{},s)};"$identify"===e&&o.$set&&(n.$set=o.$set),(n=(0,i._copyAndTruncateStrings)(n,o._noTruncate?null:this.get_config("properties_string_max_length"))).timestamp=o.timestamp||new Date,this.get_config("debug")&&i.logger.log("PostHog.js send",n);var a=JSON.stringify(n),c=this.get_config("api_host")+(o.endpoint||"/e/"),_=o!==F;return!this.get_config("request_batching")||_&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(c,a,o):this._requestQueue.enqueue(c,n,o),this._invokeCaptureHooks(e,n),n}}},o.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},o.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),(0,i._each)(this.__captureHooks,function(t){return t(e)})},o.prototype._calculate_event_properties=function(e,t,o){var r=I({},t);if(r.token=this.get_config("token"),"$snapshot"===e){var s=this.persistence.properties();return r.distinct_id=s.distinct_id,r}if(void 0!==o){var n=(new Date).getTime()-o;r.$duration=parseFloat((n/1e3).toFixed(3))}if(this.sessionManager){var a=this.sessionManager.checkAndGetSessionAndWindowId(),c=a.sessionId,_=a.windowId;r.$session_id=c,r.$window_id=_}r=(0,i._extend)({},i._info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")&&(r=(0,i._extend)(r,(0,v.getPerformanceData)()));var p=this.get_config("property_blacklist");(0,i._isArray)(p)?(0,i._each)(p,function(e){delete r[e]}):console.error("Invalid value for property_blacklist config: "+p);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},o.prototype.register=function(e,t){this.persistence.register(e,t)},o.prototype.register_once=function(e,t,i){this.persistence.register_once(e,t,i)},o.prototype.unregister=function(e){this.persistence.unregister(e)},o.prototype._register_single=function(e,t){var i;this.register(((i={})[e]=t,i))},o.prototype.getFeatureFlag=function(e,t){return this.featureFlags.getFeatureFlag(e,t)},o.prototype.isFeatureEnabled=function(e,t){return this.featureFlags.isFeatureEnabled(e,t)},o.prototype.reloadFeatureFlags=function(){this.featureFlags.reloadFeatureFlags()},o.prototype.onFeatureFlags=function(e){return this.featureFlags.onFeatureFlags(e)},o.prototype.identify=function(e,t,i){if(e){this._captureMetrics.incr("identify");var o=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var r=o;this.register_once({$had_persisted_distinct_id:!0,$device_id:r},"")}e!==o&&e!==this.get_property(n.ALIAS_ID_KEY)&&(this.unregister(n.ALIAS_ID_KEY),this.register({distinct_id:e})),e===o||this.get_property("$device_id")&&o!==this.get_property("$device_id")?(t&&this.people.set(t),i&&this.people.set_once(i)):(this.capture("$identify",{distinct_id:e,$anon_distinct_id:o},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(o)),e!==o&&this.reloadFeatureFlags()}else console.error("Unique user id has not been set in posthog.identify")},o.prototype.group=function(e,t,i){var o;if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:I(I({},r),(o={},o[e]=t,o))}),i&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),r[e]!==t&&this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")},o.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear(),this.sessionManager.resetSessionId();var o=this.get_config("get_device_id")((0,i._UUID)());this.register_once({distinct_id:o,$device_id:e?o:t},"")},o.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},o.prototype.getGroups=function(){return this.get_property("$groups")||{}},o.prototype.alias=function(e,t){return e===this.get_property(n.PEOPLE_DISTINCT_ID_KEY)?(i.logger.critical("Attempting to create alias for existing People user - aborting."),-2):((0,i._isUndefined)(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(n.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))},o.prototype.set_config=function(e){var o=I({},this.config);(0,i._isObject)(e)&&((0,i._extend)(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),u.localStore.is_supported()&&"true"===u.localStore.get("ph_debug")&&(this.config.debug=!0),this.get_config("debug")&&(t.default.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&o.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},o.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},o.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},o.prototype.sessionRecordingStarted=function(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started())},o.prototype.get_config=function(e){var t;return null===(t=this.config)||void 0===t?void 0:t[e]},o.prototype.get_property=function(e){return this.persistence.props[e]},o.prototype.toString=function(){var e,t=null!==(e=this.get_config("name"))&&void 0!==e?e:P;return t!==P&&(t=P+"."+t),t},o.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&u.localStore.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!u.cookieStore.get("ph_optout")||(u.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},o.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t)},o.prototype._gdpr_call_func=function(e,t){return t=(0,i._extend)({capture:this.capture.bind(this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t||{}),u.localStore.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})},o.prototype.opt_in_capturing=function(e){e=(0,i._extend)({enable_persistence:!0},e||{}),this._gdpr_call_func(p.optIn,e),this._gdpr_update_persistence(e)},o.prototype.opt_out_capturing=function(e){var t=(0,i._extend)({clear_persistence:!0},e||{});this._gdpr_call_func(p.optOut,t),this._gdpr_update_persistence(t)},o.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(p.hasOptedIn,e)},o.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(p.hasOptedOut,e)},o.prototype.clear_opt_in_out_capturing=function(e){var t=(0,i._extend)({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(p.clearOptInOut,t),this._gdpr_update_persistence(t)},o.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(i.window.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))},o.prototype.decodeLZ64=function(t){return e.LZString.decompressFromBase64(t||null)},o}();exports.PostHog=T,(0,i._safewrap_class)(T,["identify"]);var D={},R=function(){(0,i._each)(D,function(e,t){t!==P&&(q[t]=e)})},H=function(){q.init=function(e,t,o){if(o)return q[o]||(q[o]=D[o]=O(e||"",t||{},o),q[o]._loaded()),q[o];var r=q;return D[P]?r=D[P]:e&&((r=O(e,t||{},P))._loaded(),D[P]=r),q=r,w===k.INIT_SNIPPET&&(i.window[P]=q),R(),r}},N=function(){function e(){e.done||(e.done=!0,A=!1,(0,i._each)(D,function(e){e._dom_loaded()}))}i.document.addEventListener&&("complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1)),(0,i._register_event)(i.window,"load",e,!0)};function U(){w=k.INIT_SNIPPET,(0,i._isUndefined)(i.window.posthog)&&(i.window.posthog=[]),(q=i.window.posthog).__loaded||q.config&&q.persistence?console.error("PostHog library has already been downloaded at least once."):((0,i._each)(q._i,function(e){e&&(0,i._isArray)(e)&&(D[e[2]]=O.apply(void 0,S([],x(e),!1)))}),H(),q.init(),(0,i._each)(D,function(e){e._loaded()}),N())}function L(){return w=k.INIT_MODULE,q=new T,H(),q.init(),N(),q}
57
57
  },{"./lz-string":"iwXh","./config":"C9JJ","./utils":"UnXq","./autocapture":"+QN3","./posthog-people":"GxDb","./posthog-featureflags":"rr+t","./posthog-persistence":"8kGX","./extensions/sessionrecording":"3pq5","./decide":"UrLq","./extensions/toolbar":"1RJB","./gdpr-utils":"LECo","./storage":"1GYW","./request-queue":"YL63","./capture-metrics":"K3eQ","./compression":"/wh9","./send-request":"9tuT","./retry-queue":"8mr1","./sessionid":"Rb1F","./apm":"Z1nr","./extensions/sentry-integration":"ivfD"}],"SSOK":[function(require,module,exports) {
58
58
  "use strict";var r=require("./posthog-core");(0,r.init_from_snippet)();
59
59
  },{"./posthog-core":"fQdl"}]},{},["SSOK"], null)