posthog-js 1.17.9 → 1.18.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,8 @@
1
+ ## 1.18.0 - 2022-03-16
2
+
3
+ - Add console log recording (#367)
4
+ - fix(properties): dont modify input properties (#369)
5
+
1
6
  ## 1.17.9 - 2022-03-04
2
7
 
3
8
  - fix(web performance): calculate duration when it isn't present on navigation timing (#368)
package/dist/array.js CHANGED
@@ -1,19 +1,19 @@
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}({"zdbk":[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="",u="",l=2,f=3,h=2,d=[],m=0,v=0;for(s=0;s<o.length;s+=1)if(c=o.charAt(s),Object.prototype.hasOwnProperty.call(i,c)||(i[c]=f++,p[c]=!0),a=u+c,Object.prototype.hasOwnProperty.call(i,a))u=a;else{if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),i[a]=f++,u=String(c)}if(""!==u){if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(e(m));break}v++}return d.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=4,h=4,d=3,m="",v=[],w={val:n(0),position:e,index:1};for(t=0;t<3;t+=1)l[t]=t;for(i=0,c=Math.pow(2,2),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.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=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.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=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 2:return""}for(l[3]=u,s=u,v.push(u);;){if(w.index>r)return"";for(i=0,c=Math.pow(2,d),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.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=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[u])m=l[u];else{if(u!==h)return null;m=s+s.charAt(0)}v.push(m),l[h++]=s+m.charAt(0),s=m,0==--f&&(f=Math.pow(2,d),d++)}}};exports.LZString=s;
3
3
  },{}],"EHrm":[function(require,module,exports) {
4
- module.exports={name:"posthog-js",version:"1.17.9",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.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^9.2.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.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.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.0.6",sinon:"9.0.2",testcafe:"^1.17.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0,testEnvironment:"jsdom"}};
4
+ module.exports={name:"posthog-js",version:"1.18.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.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^9.2.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.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.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.1.2",sinon:"9.0.2",testcafe:"^1.17.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0,testEnvironment:"jsdom"}};
5
5
  },{}],"itQ5":[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"}],"FOZT":[function(require,module,exports) {
8
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.COPY_IN_PROGRESS_ATTRIBUTE=exports.document=exports.console=exports.userAgent=exports._=exports.window=void 0;var e=n(require("./config"));function n(e){return e&&e.__esModule?e:{default:e}}var r=Array.prototype,o=Function.prototype,t=Object.prototype,i=r.slice,c=t.toString,a=t.hasOwnProperty,s="undefined"!=typeof window?window:{},u=s.navigator||{userAgent:""},d=s.document||{},l=u.userAgent;exports.userAgent=l,exports.document=d,exports.window=s;var f=o.bind,p=r.forEach,h=r.indexOf,w=Array.isArray,g={},v={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};exports._=v;var b={log:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console)try{window.console.log.apply(window.console,arguments)}catch(n){v.each(arguments,function(e){window.console.log(e)})}},error:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console){var n=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,n)}catch(r){v.each(n,function(e){window.console.error(e)})}}},critical:function(){if(!v.isUndefined(window.console)&&window.console){var e=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,e)}catch(n){v.each(e,function(e){window.console.error(e)})}}}};exports.console=b,v.bind=function(e,n){var r,o;if(f&&e.bind===f)return f.apply(e,i.call(arguments,1));if(!v.isFunction(e))throw new TypeError;return r=i.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(n,r.concat(i.call(arguments)));var t={};t.prototype=e.prototype;var c=new t;t.prototype=null;var a=e.apply(c,r.concat(i.call(arguments)));return Object(a)===a?a:c}},v.bind_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.bind(e[n],e))},v.each=function(e,n,r){if(null!=e)if(p&&e.forEach===p)e.forEach(n,r);else if(e.length===+e.length){for(var o=0,t=e.length;o<t;o++)if(o in e&&n.call(r,e[o],o,e)===g)return}else for(var i in e)if(a.call(e,i)&&n.call(r,e[i],i,e)===g)return},v.extend=function(e){return v.each(i.call(arguments,1),function(n){for(var r in n)void 0!==n[r]&&(e[r]=n[r])}),e},v.isArray=w||function(e){return"[object Array]"===c.call(e)},v.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(n){return!1}},v.include=function(e,n){var r=!1;return null===e?r:h&&e.indexOf===h?-1!=e.indexOf(n):(v.each(e,function(e){if(r||(r=e===n))return g}),r)},v.includes=function(e,n){return-1!==e.indexOf(n)},v.isObject=function(e){return e===Object(e)&&!v.isArray(e)},v.isEmptyObject=function(e){if(v.isObject(e)){for(var n in e)if(a.call(e,n))return!1;return!0}return!1},v.isUndefined=function(e){return void 0===e},v.isString=function(e){return"[object String]"==c.call(e)},v.isDate=function(e){return"[object Date]"==c.call(e)},v.isNumber=function(e){return"[object Number]"==c.call(e)},v.encodeDates=function(e){return v.each(e,function(n,r){v.isDate(n)?e[r]=v.formatDate(n):v.isObject(n)&&(e[r]=v.encodeDates(n))}),e},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(e){function n(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())},v.safewrap=function(n){return function(){try{return n.apply(this,arguments)}catch(r){b.critical("Implementation error. Please turn on debug and contact support@posthog.com."),e.default.DEBUG&&b.critical(r)}}},v.safewrap_class=function(e,n){for(var r=0;r<n.length;r++)e.prototype[n[r]]=v.safewrap(e.prototype[n[r]])},v.safewrap_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.safewrap(e[n]))},v.strip_empty_properties=function(e){var n={};return v.each(e,function(e,r){v.isString(e)&&e.length>0&&(n[r]=e)}),n};var y="undefined"!=typeof Symbol?Symbol("__deepCircularCopyInProgress__"):"__deepCircularCopyInProgress__";function m(e,n,r){return e!==Object(e)?n?n(e,r):e:e[y]?void 0:(e[y]=!0,v.isArray(e)?(o=[],v.each(e,function(e){o.push(m(e,n))})):(o={},v.each(e,function(e,r){r!==y&&(o[r]=m(e,n,r))})),delete e[y],o);var o}exports.COPY_IN_PROGRESS_ATTRIBUTE=y;var _=["$performance_raw"];v.copyAndTruncateStrings=function(e,n){return m(e,function(e,r){return r&&_.indexOf(r)>-1?e:("string"==typeof e&&null!==n&&(e=e.slice(0,n)),e)})},v.base64Encode=function(e){var n,r,o,t,i,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,s=0,u="",d=[];if(!e)return e;e=v.utf8Encode(e);do{n=(i=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,r=i>>12&63,o=i>>6&63,t=63&i,d[s++]=c.charAt(n)+c.charAt(r)+c.charAt(o)+c.charAt(t)}while(a<e.length);switch(u=d.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u},v.utf8Encode=function(e){var n,r,o,t,i="";for(n=r=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,t=0;t<o;t++){var c=e.charCodeAt(t),a=null;c<128?r++:a=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==a&&(r>n&&(i+=e.substring(n,r)),i+=a,n=r=t+1)}return r>n&&(i+=e.substring(n,e.length)),i},v.UUID=function(){var e=function(){for(var e=1*new Date,n=0;e==1*new Date;)n++;return e.toString(16)+n.toString(16)};return function(){var n=(window.screen.height*window.screen.width).toString(16);return e()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,n,r=l,o=[],t=0;function i(e,n){var r,t=0;for(r=0;r<n.length;r++)t|=o[r]<<8*r;return e^t}for(e=0;e<r.length;e++)n=r.charCodeAt(e),o.unshift(255&n),o.length>=4&&(t=i(t,o),o=[]);return o.length>0&&(t=i(t,o)),t.toString(16)}()+"-"+n+"-"+e()}}(),v.isBlockedUA=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp)/i.test(e)},v.HTTPBuildQuery=function(e,n){var r,o,t=[];return v.isUndefined(n)&&(n="&"),v.each(e,function(e,n){r=encodeURIComponent(e.toString()),o=encodeURIComponent(n),t[t.length]=o+"="+r}),t.join(n)},v.getQueryParam=function(e,n){n=n.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(t){b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.getHashParam=function(e,n){var r=e.match(new RegExp(n+"=([^&]*)"));return r?r[1]:null},v.register_event=function(){function e(n){return n&&(n.preventDefault=e.preventDefault,n.stopPropagation=e.stopPropagation),n}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(n,r,o,t,i){if(n)if(n.addEventListener&&!t)n.addEventListener(r,o,!!i);else{var c="on"+r,a=n[c];n[c]=function(n,r,o){return function(t){if(t=t||e(window.event)){var i,c,a=!0;return v.isFunction(o)&&(i=o(t)),c=r.call(n,t),!1!==i&&!1!==c||(a=!1),a}}}(n,o,a)}else b.error("No valid element provided to register_event")}}(),v.info={campaignParams:function(){var e="utm_source utm_medium utm_campaign utm_content utm_term gclid".split(" "),n="",r={};return v.each(e,function(e){(n=v.getQueryParam(d.URL,e)).length&&(r[e]=n)}),r},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var n=v.info.searchEngine(e),r="yahoo"!=n?"q":"p",o={};if(null!==n){o.$search_engine=n;var t=v.getQueryParam(e,r);t.length&&(o.ph_keyword=t)}return o},browser:function(e,n,r){return n=n||"",r||v.includes(e," OPR/")?v.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":v.includes(e,"IEMobile")||v.includes(e,"WPDesktop")?"Internet Explorer Mobile":v.includes(e,"SamsungBrowser/")?"Samsung Internet":v.includes(e,"Edge")||v.includes(e,"Edg/")?"Microsoft Edge":v.includes(e,"FBIOS")?"Facebook Mobile":v.includes(e,"Chrome")?"Chrome":v.includes(e,"CriOS")?"Chrome iOS":v.includes(e,"UCWEB")||v.includes(e,"UCBrowser")?"UC Browser":v.includes(e,"FxiOS")?"Firefox iOS":v.includes(n,"Apple")?v.includes(e,"Mobile")?"Mobile Safari":"Safari":v.includes(e,"Android")?"Android Mobile":v.includes(e,"Konqueror")?"Konqueror":v.includes(e,"Firefox")?"Firefox":v.includes(e,"MSIE")||v.includes(e,"Trident/")?"Internet Explorer":v.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,n,r){var o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[v.info.browser(e,n,r)];if(void 0===o)return null;var t=e.match(o);return t?parseFloat(t[t.length-2]):null},os:function(){var e=l;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)&&!/Mobile/.test(e)?"Android Tablet":/Android/.test(e)?"Android":""},deviceType:function(e){var n=this.device(e);return"iPad"===n||"Android Tablet"===n?"Tablet":n?"Mobile":"Desktop"},referringDomain:function(e){var n=e.split("/");return n.length>=3?n[2]:""},properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera),$device:v.info.device(l),$device_type:v.info.deviceType(l)}),{$current_url:window.location.href,$host:window.location.host,$pathname:window.location.pathname,$browser_version:v.info.browserVersion(l,u.vendor,window.opera),$screen_height:window.screen.height,$screen_width:window.screen.width,$viewport_height:window.innerHeight,$viewport_width:window.innerWidth,$lib:"web",$lib_version:e.default.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:v.timestamp()/1e3})},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera)}),{$browser_version:v.info.browserVersion(l,u.vendor,window.opera)})}},v.isObject=v.isObject,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.info=v.info,v.info.device=v.info.device,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.properties=v.info.properties;
8
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.COPY_IN_PROGRESS_ATTRIBUTE=exports.document=exports.logger=exports.userAgent=exports._=exports.window=void 0;var e=r(require("./config"));function r(e){return e&&e.__esModule?e:{default:e}}var n=Array.prototype,o=Function.prototype,t=Object.prototype,i=n.slice,c=t.toString,a=t.hasOwnProperty,s="undefined"!=typeof window?window:{},u=s.navigator||{userAgent:""},d=s.document||{},l=u.userAgent;exports.userAgent=l,exports.document=d,exports.window=s;var f=o.bind,p=n.forEach,w=n.indexOf,g=Array.isArray,h={},b={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};exports._=b;var v={log:function(){if(e.default.DEBUG&&!b.isUndefined(window.console)&&window.console){var r=window.console.log.__rrweb_original__?window.console.log.__rrweb_original__:window.console.log;try{r.apply(window.console,arguments)}catch(n){b.each(arguments,function(e){r(e)})}}},error:function(){if(e.default.DEBUG&&!b.isUndefined(window.console)&&window.console){var r=["PostHog error:"].concat(Array.prototype.slice.call(arguments)),n=window.console.error.__rrweb_original__?window.console.error.__rrweb_original__:window.console.error;try{n.apply(window.console,r)}catch(o){b.each(r,function(e){n(e)})}}},critical:function(){if(!b.isUndefined(window.console)&&window.console){var e=["PostHog error:"].concat(Array.prototype.slice.call(arguments)),r=window.console.error.__rrweb_original__?window.console.error.__rrweb_original__:window.console.error;try{r.apply(window.console,e)}catch(n){b.each(e,function(e){r(e)})}}}};exports.logger=v,b.bind=function(e,r){var n,o;if(f&&e.bind===f)return f.apply(e,i.call(arguments,1));if(!b.isFunction(e))throw new TypeError;return n=i.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(r,n.concat(i.call(arguments)));var t={};t.prototype=e.prototype;var c=new t;t.prototype=null;var a=e.apply(c,n.concat(i.call(arguments)));return Object(a)===a?a:c}},b.bind_instance_methods=function(e){for(var r in e)"function"==typeof e[r]&&(e[r]=b.bind(e[r],e))},b.each=function(e,r,n){if(null!=e)if(p&&e.forEach===p)e.forEach(r,n);else if(e.length===+e.length){for(var o=0,t=e.length;o<t;o++)if(o in e&&r.call(n,e[o],o,e)===h)return}else for(var i in e)if(a.call(e,i)&&r.call(n,e[i],i,e)===h)return},b.extend=function(e){return b.each(i.call(arguments,1),function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])}),e},b.isArray=g||function(e){return"[object Array]"===c.call(e)},b.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(r){return!1}},b.include=function(e,r){var n=!1;return null===e?n:w&&e.indexOf===w?-1!=e.indexOf(r):(b.each(e,function(e){if(n||(n=e===r))return h}),n)},b.includes=function(e,r){return-1!==e.indexOf(r)},b.isObject=function(e){return e===Object(e)&&!b.isArray(e)},b.isEmptyObject=function(e){if(b.isObject(e)){for(var r in e)if(a.call(e,r))return!1;return!0}return!1},b.isUndefined=function(e){return void 0===e},b.isString=function(e){return"[object String]"==c.call(e)},b.isDate=function(e){return"[object Date]"==c.call(e)},b.isNumber=function(e){return"[object Number]"==c.call(e)},b.encodeDates=function(e){return b.each(e,function(r,n){b.isDate(r)?e[n]=b.formatDate(r):b.isObject(r)&&(e[n]=b.encodeDates(r))}),e},b.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},b.formatDate=function(e){function r(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+r(e.getUTCMonth()+1)+"-"+r(e.getUTCDate())+"T"+r(e.getUTCHours())+":"+r(e.getUTCMinutes())+":"+r(e.getUTCSeconds())},b.safewrap=function(r){return function(){try{return r.apply(this,arguments)}catch(n){v.critical("Implementation error. Please turn on debug and contact support@posthog.com."),e.default.DEBUG&&v.critical(n)}}},b.safewrap_class=function(e,r){for(var n=0;n<r.length;n++)e.prototype[r[n]]=b.safewrap(e.prototype[r[n]])},b.safewrap_instance_methods=function(e){for(var r in e)"function"==typeof e[r]&&(e[r]=b.safewrap(e[r]))},b.strip_empty_properties=function(e){var r={};return b.each(e,function(e,n){b.isString(e)&&e.length>0&&(r[n]=e)}),r};var _="undefined"!=typeof Symbol?Symbol("__deepCircularCopyInProgress__"):"__deepCircularCopyInProgress__";function y(e,r,n){return e!==Object(e)?r?r(e,n):e:e[_]?void 0:(e[_]=!0,b.isArray(e)?(o=[],b.each(e,function(e){o.push(y(e,r))})):(o={},b.each(e,function(e,n){n!==_&&(o[n]=y(e,r,n))})),delete e[_],o);var o}exports.COPY_IN_PROGRESS_ATTRIBUTE=_;var m=["$performance_raw"];b.copyAndTruncateStrings=function(e,r){return y(e,function(e,n){return n&&m.indexOf(n)>-1?e:("string"==typeof e&&null!==r&&(e=e.slice(0,r)),e)})},b.base64Encode=function(e){var r,n,o,t,i,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,s=0,u="",d=[];if(!e)return e;e=b.utf8Encode(e);do{r=(i=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=i>>12&63,o=i>>6&63,t=63&i,d[s++]=c.charAt(r)+c.charAt(n)+c.charAt(o)+c.charAt(t)}while(a<e.length);switch(u=d.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u},b.utf8Encode=function(e){var r,n,o,t,i="";for(r=n=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,t=0;t<o;t++){var c=e.charCodeAt(t),a=null;c<128?n++:a=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==a&&(n>r&&(i+=e.substring(r,n)),i+=a,r=n=t+1)}return n>r&&(i+=e.substring(r,e.length)),i},b.UUID=function(){var e=function(){for(var e=1*new Date,r=0;e==1*new Date;)r++;return e.toString(16)+r.toString(16)};return function(){var r=(window.screen.height*window.screen.width).toString(16);return e()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,r,n=l,o=[],t=0;function i(e,r){var n,t=0;for(n=0;n<r.length;n++)t|=o[n]<<8*n;return e^t}for(e=0;e<n.length;e++)r=n.charCodeAt(e),o.unshift(255&r),o.length>=4&&(t=i(t,o),o=[]);return o.length>0&&(t=i(t,o)),t.toString(16)}()+"-"+r+"-"+e()}}(),b.isBlockedUA=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp)/i.test(e)},b.HTTPBuildQuery=function(e,r){var n,o,t=[];return b.isUndefined(r)&&(r="&"),b.each(e,function(e,r){n=encodeURIComponent(e.toString()),o=encodeURIComponent(r),t[t.length]=o+"="+n}),t.join(r)},b.getQueryParam=function(e,r){r=r.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+r+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(t){v.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},b.getHashParam=function(e,r){var n=e.match(new RegExp(r+"=([^&]*)"));return n?n[1]:null},b.register_event=function(){function e(r){return r&&(r.preventDefault=e.preventDefault,r.stopPropagation=e.stopPropagation),r}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(r,n,o,t,i){if(r)if(r.addEventListener&&!t)r.addEventListener(n,o,!!i);else{var c="on"+n,a=r[c];r[c]=function(r,n,o){return function(t){if(t=t||e(window.event)){var i,c,a=!0;return b.isFunction(o)&&(i=o(t)),c=n.call(r,t),!1!==i&&!1!==c||(a=!1),a}}}(r,o,a)}else v.error("No valid element provided to register_event")}}(),b.info={campaignParams:function(){var e="utm_source utm_medium utm_campaign utm_content utm_term gclid".split(" "),r="",n={};return b.each(e,function(e){(r=b.getQueryParam(d.URL,e)).length&&(n[e]=r)}),n},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var r=b.info.searchEngine(e),n="yahoo"!=r?"q":"p",o={};if(null!==r){o.$search_engine=r;var t=b.getQueryParam(e,n);t.length&&(o.ph_keyword=t)}return o},browser:function(e,r,n){return r=r||"",n||b.includes(e," OPR/")?b.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":b.includes(e,"IEMobile")||b.includes(e,"WPDesktop")?"Internet Explorer Mobile":b.includes(e,"SamsungBrowser/")?"Samsung Internet":b.includes(e,"Edge")||b.includes(e,"Edg/")?"Microsoft Edge":b.includes(e,"FBIOS")?"Facebook Mobile":b.includes(e,"Chrome")?"Chrome":b.includes(e,"CriOS")?"Chrome iOS":b.includes(e,"UCWEB")||b.includes(e,"UCBrowser")?"UC Browser":b.includes(e,"FxiOS")?"Firefox iOS":b.includes(r,"Apple")?b.includes(e,"Mobile")?"Mobile Safari":"Safari":b.includes(e,"Android")?"Android Mobile":b.includes(e,"Konqueror")?"Konqueror":b.includes(e,"Firefox")?"Firefox":b.includes(e,"MSIE")||b.includes(e,"Trident/")?"Internet Explorer":b.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,r,n){var o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[b.info.browser(e,r,n)];if(void 0===o)return null;var t=e.match(o);return t?parseFloat(t[t.length-2]):null},os:function(){var e=l;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)&&!/Mobile/.test(e)?"Android Tablet":/Android/.test(e)?"Android":""},deviceType:function(e){var r=this.device(e);return"iPad"===r||"Android Tablet"===r?"Tablet":r?"Mobile":"Desktop"},referringDomain:function(e){var r=e.split("/");return r.length>=3?r[2]:""},properties:function(){return b.extend(b.strip_empty_properties({$os:b.info.os(),$browser:b.info.browser(l,u.vendor,window.opera),$device:b.info.device(l),$device_type:b.info.deviceType(l)}),{$current_url:window.location.href,$host:window.location.host,$pathname:window.location.pathname,$browser_version:b.info.browserVersion(l,u.vendor,window.opera),$screen_height:window.screen.height,$screen_width:window.screen.width,$viewport_height:window.innerHeight,$viewport_width:window.innerWidth,$lib:"web",$lib_version:e.default.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:b.timestamp()/1e3})},people_properties:function(){return b.extend(b.strip_empty_properties({$os:b.info.os(),$browser:b.info.browser(l,u.vendor,window.opera)}),{$browser_version:b.info.browserVersion(l,u.vendor,window.opera)})}},b.isObject=b.isObject,b.isBlockedUA=b.isBlockedUA,b.isEmptyObject=b.isEmptyObject,b.info=b.info,b.info.device=b.info.device,b.info.browser=b.info.browser,b.info.browserVersion=b.info.browserVersion,b.info.properties=b.info.properties;
9
9
  },{"./config":"itQ5"}],"RYfg":[function(require,module,exports) {
10
10
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getClassName=r,exports.getSafeText=n,exports.isElementNode=o,exports.isTag=s,exports.isTextNode=i,exports.shouldCaptureDomEvent=u,exports.shouldCaptureElement=a,exports.isSensitiveElement=p,exports.shouldCaptureValue=l,exports.isAngularStyleAttr=d,exports.loadScript=f,exports.usefulElements=void 0;var e=require("./utils");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e){switch(t(e.className)){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function n(t){var r="";return a(t)&&!p(t)&&t.childNodes&&t.childNodes.length&&e._.each(t.childNodes,function(t){i(t)&&t.textContent&&(r+=e._.trim(t.textContent).split(/(\s+)/).filter(l).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),e._.trim(r)}function o(e){return e&&1===e.nodeType}function s(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function i(e){return e&&3===e.nodeType}var c=["a","button","form","input","select","textarea","label"];function u(e,t){if(!e||s(e,"html")||!o(e))return!1;for(var r=!1,n=[e],i=!0,u=e;u.parentNode&&!s(u,"body");)if(11!==u.parentNode.nodeType){if(!(i=u.parentNode))break;if(c.indexOf(i.tagName.toLowerCase())>-1)r=!0;else{var a=window.getComputedStyle(i);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}n.push(i),u=i}else n.push(u.parentNode.host),u=u.parentNode.host;var p=window.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var l=e.tagName.toLowerCase();switch(l){case"html":return!1;case"form":return"submit"===t.type;case"input":return"change"===t.type||"click"===t.type;case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return r?"click"===t.type:"click"===t.type&&(c.indexOf(l)>-1||"true"===e.getAttribute("contenteditable"))}}function a(t){for(var n=t;n.parentNode&&!s(n,"body");n=n.parentNode){var o=r(n).split(" ");if(e._.includes(o,"ph-sensitive")||e._.includes(o,"ph-no-capture"))return!1}if(e._.includes(r(t).split(" "),"ph-include"))return!0;var i=t.type||"";if("string"==typeof i)switch(i.toLowerCase()){case"hidden":case"password":return!1}var c=t.name||t.id||"";if("string"==typeof c){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(c.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function p(e){return!!(s(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||s(e,"select")||s(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function l(t){if(null===t||e._.isUndefined(t))return!1;if("string"==typeof t){t=e._.trim(t);if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(t))return!1}return!0}function d(e){return"string"==typeof e&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function f(e,t){var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t;var n=document.getElementsByTagName("script");n.length>0?n[0].parentNode.insertBefore(r,n[0]):document.body.appendChild(r)}exports.usefulElements=c;
11
11
  },{"./utils":"FOZT"}],"Oszc":[function(require,module,exports) {
12
12
  "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var n=30,c=1e3,a=3,s=function(){function t(i){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.get_config("rageclick");e(this,t),this.clicks=[],this.instance=i,this.enabled=n}return i(t,[{key:"click",value:function(e,t,i){if(this.enabled){var s=this.clicks[this.clicks.length-1];s&&Math.abs(e-s.x)+Math.abs(t-s.y)<n&&i-s.timestamp<c?(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===a&&this.instance.capture("$rageclick")):this.clicks=[{x:e,y:t,timestamp:i}]}}}]),t}();exports.default=s;
13
13
  },{}],"gR3r":[function(require,module,exports) {
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;do{e=e.previousSibling}while(e&&!(0,t.isElementNode)(e));return e},_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 s=(0,t.getClassName)(n);s.length>0&&(a.classes=s.split(" ").filter(function(e){return""!==e})),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 u=1,c=1,l=n;l=this._previousElementSibling(l);)u++,l.tagName===n.tagName&&c++;return a.nth_child=u,a.nth_of_type=c,a},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(n){var r=[];return 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={};return e._.each(this._customProperties,function(i){e._.each(i.event_selectors,function(o){var a=document.querySelectorAll(o);e._.each(a,function(o){e._.includes(n,o)&&(0,t.shouldCaptureElement)(o)&&(r[i.name]=this._extractCustomPropertyValue(i))},this)},this)},this),r},_getEventTarget:function(e){return void 0===e.target?e.srcElement:e.target.shadowRoot?e.composedPath()[0]:e.target},_captureEvent:function(n,r){var i=this._getEventTarget(n);if((0,t.isTextNode)(i)&&(i=i.parentNode),"click"===n.type&&this.rageclicks.click(n.clientX,n.clientY,(new Date).getTime()),(0,t.shouldCaptureDomEvent)(i,n)){for(var o=[i],a=i;a.parentNode&&!(0,t.isTag)(a,"body");)11!==a.parentNode.nodeType?(o.push(a.parentNode),a=a.parentNode):(o.push(a.parentNode.host),a=a.parentNode.host);var s,u=[],c=!1;if(e._.each(o,function(n){var i=(0,t.shouldCaptureElement)(n);"a"===n.tagName.toLowerCase()&&(s=n.getAttribute("href"),s=i&&(0,t.shouldCaptureValue)(s)&&s);var o=(0,t.getClassName)(n).split(" ");e._.includes(o,"ph-no-capture")&&(c=!0),u.push(this._getPropertiesFromElement(n,r.get_config("mask_all_element_attributes"),r.get_config("mask_all_text")))},this),r.get_config("mask_all_text")||(u[0].$el_text=(0,t.getSafeText)(i)),s&&(u[0].attr__href=s),c)return!1;var l=e._.extend(this._getDefaultProperties(n.type),{$elements:u},this._getCustomProperties(o));return r.capture("$autocapture",l),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(t){var n=e._.bind(function(e){e=e||window.event,this._captureEvent(e,t)},this);e._.register_event(document,"submit",n,!1,!0),e._.register_event(document,"change",n,!1,!0),e._.register_event(document,"click",n,!1,!0)},_customProperties:{},init:function(e){this.rageclicks=new n.default(e)},afterDecideResponse:function(e,t){var n=t.get_config("token");this._initializedTokens.indexOf(n)>-1?console.log('autocapture already initialized for token "'+n+'"'):(this._initializedTokens.push(n),e&&e.config&&!0===e.config.enable_collect_everything&&t.get_config("autocapture")?(e.custom_properties&&(this._customProperties=e.custom_properties),this._addDomEventHandlers(t)):t.__autocapture_enabled=!1)},enabledForProject:function(t,n,r){n=e._.isUndefined(n)?10:n,r=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 e._.isFunction(document.querySelectorAll)}};exports.autocapture=i,e._.bind_instance_methods(i),e._.safewrap_instance_methods(i);
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;do{e=e.previousSibling}while(e&&!(0,t.isElementNode)(e));return e},_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 s=(0,t.getClassName)(n);s.length>0&&(a.classes=s.split(" ").filter(function(e){return""!==e})),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 u=1,l=1,c=n;c=this._previousElementSibling(c);)u++,c.tagName===n.tagName&&l++;return a.nth_child=u,a.nth_of_type=l,a},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(n){var r=[];return 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={};return e._.each(this._customProperties,function(i){e._.each(i.event_selectors,function(o){var a=document.querySelectorAll(o);e._.each(a,function(o){e._.includes(n,o)&&(0,t.shouldCaptureElement)(o)&&(r[i.name]=this._extractCustomPropertyValue(i))},this)},this)},this),r},_getEventTarget:function(e){return void 0===e.target?e.srcElement:e.target.shadowRoot?e.composedPath()[0]:e.target},_captureEvent:function(n,r){var i=this._getEventTarget(n);if((0,t.isTextNode)(i)&&(i=i.parentNode),"click"===n.type&&this.rageclicks.click(n.clientX,n.clientY,(new Date).getTime()),(0,t.shouldCaptureDomEvent)(i,n)){for(var o=[i],a=i;a.parentNode&&!(0,t.isTag)(a,"body");)11!==a.parentNode.nodeType?(o.push(a.parentNode),a=a.parentNode):(o.push(a.parentNode.host),a=a.parentNode.host);var s,u=[],l=!1;if(e._.each(o,function(n){var i=(0,t.shouldCaptureElement)(n);"a"===n.tagName.toLowerCase()&&(s=n.getAttribute("href"),s=i&&(0,t.shouldCaptureValue)(s)&&s);var o=(0,t.getClassName)(n).split(" ");e._.includes(o,"ph-no-capture")&&(l=!0),u.push(this._getPropertiesFromElement(n,r.get_config("mask_all_element_attributes"),r.get_config("mask_all_text")))},this),r.get_config("mask_all_text")||(u[0].$el_text=(0,t.getSafeText)(i)),s&&(u[0].attr__href=s),l)return!1;var c=e._.extend(this._getDefaultProperties(n.type),{$elements:u},this._getCustomProperties(o));return r.capture("$autocapture",c),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(t){var n=e._.bind(function(e){e=e||window.event,this._captureEvent(e,t)},this);e._.register_event(document,"submit",n,!1,!0),e._.register_event(document,"change",n,!1,!0),e._.register_event(document,"click",n,!1,!0)},_customProperties:{},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&&!0===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){n=e._.isUndefined(n)?10:n,r=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 e._.isFunction(document.querySelectorAll)}};exports.autocapture=i,e._.bind_instance_methods(i),e._.safewrap_instance_methods(i);
15
15
  },{"./utils":"FOZT","./autocapture-utils":"RYfg","./extensions/rageclick":"Oszc"}],"KZ7Y":[function(require,module,exports) {
16
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sessionStore=exports.memoryStore=exports.localPlusCookieStore=exports.localStore=exports.cookieStore=void 0;var e=require("./utils");function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(r){o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,s={get:function(e){try{for(var r=e+"=",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(r))return decodeURIComponent(n.substring(r.length,n.length))}}catch(s){}return null},parse:function(e){var r;try{r=JSON.parse(s.get(e))||{}}catch(t){}return r},set:function(e,r,t,o,s){try{var i="",c="",u="";if(o){var a=document.location.hostname.match(n),l=a?a[0]:"";i=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),c="; expires="+p.toGMTString()}s&&(u="; secure");var f=e+"="+encodeURIComponent(JSON.stringify(r))+c+"; path=/"+i+u;return document.cookie=f,f}catch(g){return}},remove:function(e,r){try{s.set(e,"",-1,r)}catch(t){return}}};exports.cookieStore=s;var i=null,c={is_supported:function(){if(null!==i)return i;var r=!0;if(window)try{var t="__mplssupport__";c.set(t,"xyz"),'"xyz"'!==c.get(t)&&(r=!1),c.remove(t)}catch(o){r=!1}else r=!1;return r||e.console.error("localStorage unsupported; falling back to cookie store"),i=r,r},error:function(r){e.console.error("localStorage error: "+r)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){c.error(r)}return null},parse:function(e){try{return JSON.parse(c.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){c.error(r)}}};exports.localStore=c;var u=t(t({},c),{},{parse:function(r){try{var t={};try{(t=s.parse(r)||{}).distinct_id&&s.set(r,{distinct_id:t.distinct_id})}catch(n){}var o=e._.extend(t,JSON.parse(c.get(r)||"{}"));return c.set(r,o),o}catch(n){}return null},set:function(e,r){try{c.set(e,r),r.distinct_id&&s.set(e,{distinct_id:r.distinct_id})}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e),s.remove(e)}catch(r){c.error(r)}}});exports.localPlusCookieStore=u;var a={},l={is_supported:function(){return!0},error:function(r){e.console.error("memoryStorage error: "+r)},parse:function(e){return a[e]||null},set:function(e,r){a[e]=r},remove:function(e){delete a[e]}};exports.memoryStore=l;var p={sessionStorageSupported:null,is_supported:function(){if(null!==p.sessionStorageSupported)return p.sessionStorageSupported;if(p.sessionStorageSupported=!0,window)try{var e="__support__";p.set(e,"xyz"),'"xyz"'!==p.get(e)&&(p.sessionStorageSupported=!1),p.remove(e)}catch(r){p.sessionStorageSupported=!1}else p.sessionStorageSupported=!1;return p.sessionStorageSupported},error:function(r){Config.DEBUG&&e.console.error("sessionStorage error: ",r)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(r){p.error(r)}return null},parse:function(e){try{return JSON.parse(p.get(e))||null}catch(r){}return null},set:function(e,r){try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch(t){p.error(t)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(r){p.error(r)}}};exports.sessionStore=p;
16
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sessionStore=exports.memoryStore=exports.localPlusCookieStore=exports.localStore=exports.cookieStore=void 0;var e=require("./utils");function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(r){o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,i={get:function(e){try{for(var r=e+"=",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(r))return decodeURIComponent(n.substring(r.length,n.length))}}catch(i){}return null},parse:function(e){var r;try{r=JSON.parse(i.get(e))||{}}catch(t){}return r},set:function(e,r,t,o,i){try{var s="",c="",u="";if(o){var a=document.location.hostname.match(n),l=a?a[0]:"";s=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),c="; expires="+p.toGMTString()}i&&(u="; secure");var g=e+"="+encodeURIComponent(JSON.stringify(r))+c+"; path=/"+s+u;return document.cookie=g,g}catch(f){return}},remove:function(e,r){try{i.set(e,"",-1,r)}catch(t){return}}};exports.cookieStore=i;var s=null,c={is_supported:function(){if(null!==s)return s;var r=!0;if(window)try{var t="__mplssupport__";c.set(t,"xyz"),'"xyz"'!==c.get(t)&&(r=!1),c.remove(t)}catch(o){r=!1}else r=!1;return r||e.logger.error("localStorage unsupported; falling back to cookie store"),s=r,r},error:function(r){e.logger.error("localStorage error: "+r)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){c.error(r)}return null},parse:function(e){try{return JSON.parse(c.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){c.error(r)}}};exports.localStore=c;var u=t(t({},c),{},{parse:function(r){try{var t={};try{(t=i.parse(r)||{}).distinct_id&&i.set(r,{distinct_id:t.distinct_id})}catch(n){}var o=e._.extend(t,JSON.parse(c.get(r)||"{}"));return c.set(r,o),o}catch(n){}return null},set:function(e,r){try{c.set(e,r),r.distinct_id&&i.set(e,{distinct_id:r.distinct_id})}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e),i.remove(e)}catch(r){c.error(r)}}});exports.localPlusCookieStore=u;var a={},l={is_supported:function(){return!0},error:function(r){e.logger.error("memoryStorage error: "+r)},parse:function(e){return a[e]||null},set:function(e,r){a[e]=r},remove:function(e){delete a[e]}};exports.memoryStore=l;var p={sessionStorageSupported:null,is_supported:function(){if(null!==p.sessionStorageSupported)return p.sessionStorageSupported;if(p.sessionStorageSupported=!0,window)try{var e="__support__";p.set(e,"xyz"),'"xyz"'!==p.get(e)&&(p.sessionStorageSupported=!1),p.remove(e)}catch(r){p.sessionStorageSupported=!1}else p.sessionStorageSupported=!1;return p.sessionStorageSupported},error:function(r){Config.DEBUG&&e.logger.error("sessionStorage error: ",r)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(r){p.error(r)}return null},parse:function(e){try{return JSON.parse(p.get(e))||null}catch(r){}return null},set:function(e,r){try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch(t){p.error(t)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(r){p.error(r)}}};exports.sessionStore=p;
17
17
  },{"./utils":"FOZT"}],"rxSh":[function(require,module,exports) {
18
18
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optIn=r,exports.optOut=n,exports.hasOptedIn=i,exports.hasOptedOut=c,exports.addOptOutCheckPostHogLib=u,exports.addOptOutCheckPostHogPeople=s,exports.clearOptInOut=p;var t=require("./utils"),e=require("./storage"),o="__ph_opt_in_out_";function r(t,e){d(!0,t,e)}function n(t,e){d(!1,t,e)}function i(t,e){return"1"===f(t,e)}function c(t,e){return!!_(e)||"0"===f(t,e)}function u(t,e){return h(t,function(t){return this.get_config(t)},e)}function s(t,e){return h(t,function(t){return this._get_config(t)},e)}function p(t,e){a(e=e||{}).remove(l(t,e),!!e.crossSubdomainCookie,e.cookieDomain)}function a(t){return"localStorage"===(t=t||{}).persistenceType?e.localStore:"localStorage+cookie"===t.persistenceType?e.localPlusCookieStore:e.cookieStore}function l(t,e){return((e=e||{}).persistencePrefix||o)+t}function f(t,e){return a(e).get(l(t,e))}function _(e){if(e&&e.respectDnt){var o=e&&e.window||t.window,r=o.navigator||{},n=!1;return t._.each([r.doNotTrack,r.msDoNotTrack,o.doNotTrack],function(e){t._.includes([!0,1,"1","yes"],e)&&(n=!0)}),n}return!1}function d(e,o,r){t._.isString(o)&&o.length?(a(r=r||{}).set(l(o,r),e?1:0,t._.isNumber(r.cookieExpiration)?r.cookieExpiration:null,!!r.crossSubdomainCookie,!!r.secureCookie,!!r.crossSiteCookie,r.cookieDomain),r.capture&&e&&r.capture(r.captureEventName||"$opt_in",r.captureProperties,{send_immediately:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function h(t,e,o){return function(){var r=!1;try{var n=e.call(this,"token"),i=e.call(this,"respect_dnt"),u=e.call(this,"opt_out_capturing_persistence_type"),s=e.call(this,"opt_out_capturing_cookie_prefix"),p=e.call(this,"window");n&&(r=c(n,{respectDnt:i,persistenceType:u,persistencePrefix:s,window:p}))}catch(l){o||console.error("Unexpected error when checking capturing opt-out status: "+l)}if(!r)return t.apply(this,arguments);var a=arguments[arguments.length-1];"function"==typeof a&&a(0)}}
19
19
  },{"./utils":"FOZT","./storage":"KZ7Y"}],"os8r":[function(require,module,exports) {
@@ -23,11 +23,11 @@ module.exports={name:"posthog-js",version:"1.17.9",description:"Posthog-js allow
23
23
  },{"./gdpr-utils":"rxSh","./api-actions":"os8r","./utils":"FOZT"}],"aVqC":[function(require,module,exports) {
24
24
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostHogFeatureFlags=exports.parseFeatureFlagDecideResponse=void 0;var e=require("./utils");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var s=function(e,t){var a=e.featureFlags;if(a)if(Array.isArray(a)){var r={};if(a)for(var s=0;s<a.length;s++)r[a[s]]=!0;t&&t.register({$active_feature_flags:a,$enabled_feature_flags:r})}else t&&t.register({$active_feature_flags:Object.keys(a||{}),$enabled_feature_flags:a||{}});else t&&(t.unregister("$active_feature_flags"),t.unregister("$enabled_feature_flags"))};exports.parseFeatureFlagDecideResponse=s;var i=function(){function a(e){t(this,a),this.instance=e,this._override_warning=!1,this.flagCallReported={},this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return r(a,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var t=this.instance.get_property("$enabled_feature_flags"),a=this.instance.get_property("$override_feature_flags");if(!a)return t||{};for(var r=e._.extend({},t),s=Object.keys(a),i=0;i<s.length;i++)!1===a[s[i]]?delete r[s[i]]:r[s[i]]=a[s[i]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:t,overriddenFlags:a,finalFlags:r}),this._override_warning=!0),r}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var t=this;this.setReloadingPaused(!0);var a=this.instance.get_config("token"),r=JSON.stringify({token:a,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups()}),s=e._.base64Encode(r);this.instance._send_request(this.instance.get_config("api_host")+"/decide/?v=2",{data:s},{method:"POST"},this.instance._prepare_callback(function(e){t.receivedFeatureFlags(e),t.setReloadingPaused(!1),t._startReloadTimer()}))}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.getFlags())return console.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time."),!1;var a=this.getFlagVariants()[e];return!t.send_event&&"send_event"in t||this.flagCallReported[e]||(this.flagCallReported[e]=!0,this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a})),a}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getFlags()?!!this.getFeatureFlag(e,t):(console.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time."),!1)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"receivedFeatureFlags",value:function(e){s(e,this.instance.persistence);var t=this.getFlags(),a=this.getFlagVariants();this.featureFlagEventHandlers.forEach(function(e){return e(t,a)})}},{key:"override",value:function(e){if(this._override_warning=!1,!1===e)this.instance.persistence.unregister("$override_feature_flags");else if(Array.isArray(e)){for(var t={},a=0;a<e.length;a++)t[e[a]]=!0;this.instance.persistence.register({$override_feature_flags:t})}else this.instance.persistence.register({$override_feature_flags:e})}},{key:"onFeatureFlags",value:function(e){(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit)&&e(this.getFlags(),this.getFlagVariants())}}]),a}();exports.PostHogFeatureFlags=i;
25
25
  },{"./utils":"FOZT"}],"MAdm":[function(require,module,exports) {
26
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SESSION_ID=exports.SESSION_RECORDING_ENABLED_SERVER_SIDE=exports.EVENT_TIMERS_KEY=exports.CAMPAIGN_IDS_KEY=exports.ALIAS_ID_KEY=exports.PEOPLE_DISTINCT_ID_KEY=exports.SET_ONCE_QUEUE_KEY=exports.SET_QUEUE_KEY=exports.PostHogPersistence=void 0;var e=require("./utils"),t=require("./storage");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s="__mps";exports.SET_QUEUE_KEY=s;var o="__mpso";exports.SET_ONCE_QUEUE_KEY=o;var i="__mpus",p="__mpa",n="__mpap",_="__mpr",a="__mpu",c="$people_distinct_id";exports.PEOPLE_DISTINCT_ID_KEY=c;var h="__alias";exports.ALIAS_ID_KEY=h;var u="__cmpns";exports.CAMPAIGN_IDS_KEY=u;var d="__timers";exports.EVENT_TIMERS_KEY=d;var f="$session_recording_enabled_server_side";exports.SESSION_RECORDING_ENABLED_SERVER_SIDE=f;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",E=[s,o,i,p,n,_,a,c,h,u,d,f,m,l],y=function(r){var s="";r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,r.persistence_name?this.name="ph_"+r.persistence_name:this.name="ph_"+s+"_posthog";var o=r.persistence;"cookie"!==o&&-1===o.indexOf("localStorage")&&"memory"!==o&&(e.console.critical("Unknown persistence type "+o+"; falling back to cookie"),o=r.persistence="cookie"),"localStorage"===o&&t.localStore.is_supported()?this.storage=t.localStore:"localStorage+cookie"===o&&t.localPlusCookieStore.is_supported()?this.storage=t.localPlusCookieStore:this.storage="memory"===o?t.memoryStore:t.cookieStore,this.load(),this.update_config(r),this.save()};exports.PostHogPersistence=y,y.prototype.properties=function(){var t={};return e._.each(this.props,function(s,o){if(o===l&&"object"===r(s))for(var i=Object.keys(s),p=0;p<i.length;p++)t["$feature/".concat(i[p])]=s[i[p]];else e._.include(E,o)||(t[o]=s)}),t},y.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},y.prototype.save=function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)},y.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},y.prototype.clear=function(){this.remove(),this.props={}},y.prototype.register_once=function(t,r,s){return!!e._.isObject(t)&&(void 0===r&&(r="None"),this.expire_days=void 0===s?this.default_expiry:s,e._.each(t,function(e,t){this.props.hasOwnProperty(t)&&this.props[t]!==r||(this.props[t]=e)},this),this.save(),!0)},y.prototype.register=function(t,r){return!!e._.isObject(t)&&(this.expire_days=void 0===r?this.default_expiry:r,e._.extend(this.props,t),this.save(),!0)},y.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},y.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},y.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},y.prototype.update_referrer_info=function(t){this.register_once({$initial_referrer:t||"$direct",$initial_referring_domain:e._.info.referringDomain(t)||"$direct"},""),this.register({$referrer:t||this.props.$referrer||"$direct",$referring_domain:e._.info.referringDomain(t)||this.props.$referring_domain||"$direct"})},y.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},y.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},y.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},y.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},y.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},y.prototype.get_cross_subdomain=function(){return this.cross_subdomain},y.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},y.prototype.set_event_timer=function(e,t){var r=this.props[d]||{};r[e]=t,this.props[d]=r,this.save()},y.prototype.remove_event_timer=function(t){var r=(this.props[d]||{})[t];return e._.isUndefined(r)||(delete this.props[d][t],this.save()),r};
26
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SESSION_ID=exports.SESSION_RECORDING_ENABLED_SERVER_SIDE=exports.EVENT_TIMERS_KEY=exports.CAMPAIGN_IDS_KEY=exports.ALIAS_ID_KEY=exports.PEOPLE_DISTINCT_ID_KEY=exports.SET_ONCE_QUEUE_KEY=exports.SET_QUEUE_KEY=exports.PostHogPersistence=void 0;var e=require("./utils"),t=require("./storage");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s="__mps";exports.SET_QUEUE_KEY=s;var o="__mpso";exports.SET_ONCE_QUEUE_KEY=o;var i="__mpus",p="__mpa",n="__mpap",_="__mpr",a="__mpu",c="$people_distinct_id";exports.PEOPLE_DISTINCT_ID_KEY=c;var h="__alias";exports.ALIAS_ID_KEY=h;var u="__cmpns";exports.CAMPAIGN_IDS_KEY=u;var d="__timers";exports.EVENT_TIMERS_KEY=d;var f="$session_recording_enabled_server_side";exports.SESSION_RECORDING_ENABLED_SERVER_SIDE=f;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",E=[s,o,i,p,n,_,a,c,h,u,d,f,m,l],y=function(r){var s="";r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,r.persistence_name?this.name="ph_"+r.persistence_name:this.name="ph_"+s+"_posthog";var o=r.persistence;"cookie"!==o&&-1===o.indexOf("localStorage")&&"memory"!==o&&(e.logger.critical("Unknown persistence type "+o+"; falling back to cookie"),o=r.persistence="cookie"),"localStorage"===o&&t.localStore.is_supported()?this.storage=t.localStore:"localStorage+cookie"===o&&t.localPlusCookieStore.is_supported()?this.storage=t.localPlusCookieStore:this.storage="memory"===o?t.memoryStore:t.cookieStore,this.load(),this.update_config(r),this.save()};exports.PostHogPersistence=y,y.prototype.properties=function(){var t={};return e._.each(this.props,function(s,o){if(o===l&&"object"===r(s))for(var i=Object.keys(s),p=0;p<i.length;p++)t["$feature/".concat(i[p])]=s[i[p]];else e._.include(E,o)||(t[o]=s)}),t},y.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},y.prototype.save=function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)},y.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},y.prototype.clear=function(){this.remove(),this.props={}},y.prototype.register_once=function(t,r,s){return!!e._.isObject(t)&&(void 0===r&&(r="None"),this.expire_days=void 0===s?this.default_expiry:s,e._.each(t,function(e,t){this.props.hasOwnProperty(t)&&this.props[t]!==r||(this.props[t]=e)},this),this.save(),!0)},y.prototype.register=function(t,r){return!!e._.isObject(t)&&(this.expire_days=void 0===r?this.default_expiry:r,e._.extend(this.props,t),this.save(),!0)},y.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},y.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},y.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},y.prototype.update_referrer_info=function(t){this.register_once({$initial_referrer:t||"$direct",$initial_referring_domain:e._.info.referringDomain(t)||"$direct"},""),this.register({$referrer:t||this.props.$referrer||"$direct",$referring_domain:e._.info.referringDomain(t)||this.props.$referring_domain||"$direct"})},y.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},y.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},y.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},y.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},y.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},y.prototype.get_cross_subdomain=function(){return this.cross_subdomain},y.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},y.prototype.set_event_timer=function(e,t){var r=this.props[d]||{};r[e]=t,this.props[d]=r,this.save()},y.prototype.remove_event_timer=function(t){var r=(this.props[d]||{})[t];return e._.isUndefined(r)||(delete this.props[d][t],this.save()),r};
27
27
  },{"./utils":"FOZT","./storage":"KZ7Y"}],"vmk3":[function(require,module,exports) {
28
28
  "use strict";function t(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=e(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var o=0,a=function(){};return{s:a,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return l=t.done,t},e:function(t){u=!0,i=t},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw i}}}}function e(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterDataURLsFromLargeDataObjects=a,exports.replacementImageURI=void 0;var o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==";function a(e){if(e&&"object"===n(e)){var r=JSON.stringify(e);if(r.length>5e6){var a,i=t(r.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(i.s();!(a=i.n()).done;){var l=a.value;r="image/"===l[1].toLocaleLowerCase().slice(0,6)?r.replace(l[0],o):r.replace(l[0],"")}}catch(u){i.e(u)}finally{i.f()}}return JSON.parse(r)}return e}exports.replacementImageURI=o;
29
29
  },{}],"Z2N4":[function(require,module,exports) {
30
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=exports.MUTATION_SOURCE_TYPE=exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=exports.META_EVENT_TYPE=exports.FULL_SNAPSHOT_EVENT_TYPE=void 0;var e=require("../autocapture-utils"),t=require("../utils"),n=require("../posthog-persistence"),r=s(require("../config")),i=require("./sessionrecording-utils");function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){return h(e)||l(e,t)||d(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(c){i=!0,s=c}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}}function h(e){if(Array.isArray(e))return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}var v="/e/",E=2;exports.FULL_SNAPSHOT_EVENT_TYPE=E;var S=4;exports.META_EVENT_TYPE=S;var y=3;exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=y;var w=3;exports.MUTATION_SOURCE_TYPE=w;var O=function(){function s(e){_(this,s),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=v,this.stopRrweb=null,this.windowId=null,this.sessionId=null,this.receivedDecide=!1}return g(s,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(n.SESSION_RECORDING_ENABLED_SERVER_SIDE),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"afterDecideResponse",value:function(e){var t,r;(this.receivedDecide=!0,this.instance.persistence&&this.instance.persistence.register(f({},n.SESSION_RECORDING_ENABLED_SERVER_SIDE,!!e.sessionRecording)),null===(t=e.sessionRecording)||void 0===t?void 0:t.endpoint)&&(this.endpoint=null===(r=e.sessionRecording)||void 0===r?void 0:r.endpoint);this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach(function(t){return e._captureSnapshot(t)})),this._startCapture()}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,e.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+r.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.instance.sessionManager.getSessionAndWindowId(e.timestamp||(new Date).getTime(),e),n=t.windowId,r=t.sessionId;this.windowId===n&&this.sessionId===r||-1!==[E,S].indexOf(e.type)||window.rrweb.record.takeFullSnapshot(),this.windowId=n,this.sessionId=r}},{key:"_onScriptLoaded",value:function(){for(var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},n=this.instance.get_config("session_recording"),r=0,s=Object.entries(n||{});r<s.length;r++){var o=c(s[r],2),u=o[0],d=o[1];u in t&&(t[u]=d)}this.stopRrweb=window.rrweb.record(a({emit:function(t){t=(0,i.filterDataURLsFromLargeDataObjects)(t),e._updateWindowAndSessionIds(t);var n={$snapshot_data:t,$session_id:e.sessionId,$window_id:e.windowId};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(n):e.snapshots.push(n)}},t)),this.instance._addCaptureHook(function(e){"$pageview"===e&&window.rrweb.record.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===E}})}}]),s}();exports.SessionRecording=O;
30
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=exports.MUTATION_SOURCE_TYPE=exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=exports.META_EVENT_TYPE=exports.FULL_SNAPSHOT_EVENT_TYPE=void 0;var e=require("../autocapture-utils"),t=require("../utils"),n=require("../posthog-persistence"),r=s(require("../config")),i=require("./sessionrecording-utils");function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){return h(e)||l(e,t)||d(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(c){i=!0,s=c}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}}function h(e){if(Array.isArray(e))return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}var w="/e/",v=2;exports.FULL_SNAPSHOT_EVENT_TYPE=v;var E=4;exports.META_EVENT_TYPE=E;var S=3;exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=S;var y=3;exports.MUTATION_SOURCE_TYPE=y;var O=function(){function s(e){_(this,s),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=w,this.stopRrweb=null,this.windowId=null,this.sessionId=null,this.receivedDecide=!1}return g(s,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(n.SESSION_RECORDING_ENABLED_SERVER_SIDE),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"afterDecideResponse",value:function(e){var t,r;(this.receivedDecide=!0,this.instance.persistence&&this.instance.persistence.register(f({},n.SESSION_RECORDING_ENABLED_SERVER_SIDE,!!e.sessionRecording)),null===(t=e.sessionRecording)||void 0===t?void 0:t.endpoint)&&(this.endpoint=null===(r=e.sessionRecording)||void 0===r?void 0:r.endpoint);this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach(function(t){return e._captureSnapshot(t)})),this._startCapture()}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,e.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+r.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.instance.sessionManager.getSessionAndWindowId(e.timestamp||(new Date).getTime(),e),n=t.windowId,r=t.sessionId;this.windowId===n&&this.sessionId===r||-1!==[v,E].indexOf(e.type)||this.rrwebRecord.takeFullSnapshot(),this.windowId=n,this.sessionId=r}},{key:"_onScriptLoaded",value:function(){var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var n=this.instance.get_config("session_recording"),r=0,s=Object.entries(n||{});r<s.length;r++){var o=c(s[r],2),u=o[0],d=o[1];u in t&&(t[u]=d)}this.stopRrweb=this.rrwebRecord(a({emit:function(t){t=(0,i.filterDataURLsFromLargeDataObjects)(t),e._updateWindowAndSessionIds(t);var n={$snapshot_data:t,$session_id:e.sessionId,$window_id:e.windowId};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(n):e.snapshots.push(n)},plugins:window.rrwebConsoleRecord&&this.instance.get_config("enable_recording_console_log")?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},t)),this.instance._addCaptureHook(function(t){"$pageview"===t&&e.rrwebRecord.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===v}})}}]),s}();exports.SessionRecording=O;
31
31
  },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
32
32
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils");function n(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}var c=function(){function r(e){o(this,r),this.instance=e,this.instance.decideEndpointWasHit=!1}return a(r,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r,verbose:!0},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var r=this;if(0!==(null==t?void 0:t.status)){if(this.instance.decideEndpointWasHit=!0,!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){r.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),this.instance.featureFlags.receivedFeatureFlags(t),t.supportedCompression){var i,o={},s=n(t.supportedCompression);try{for(s.s();!(i=s.n()).done;){o[i.value]=!0}}catch(a){s.e(a)}finally{s.f()}this.instance.compression=o}else this.instance.compression={}}else console.error("Failed to fetch feature flags from PostHog.")}}]),r}();exports.Decide=c;
33
33
  },{"./autocapture":"gR3r","./utils":"FOZT"}],"ZEpJ":[function(require,module,exports) {
@@ -43,7 +43,7 @@ module.exports={name:"posthog-js",version:"1.17.9",description:"Posthog-js allow
43
43
  },{}],"Ie9M":[function(require,module,exports) {
44
44
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decideCompression=s,exports.compressData=c;var e=require("./lz-string"),r=require("fflate"),t=require("./utils");function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach(function(r){i(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e){return e["gzip-js"]?"gzip-js":e.lz64?"lz64":"base64"}function c(n,i,s){return"lz64"===n?[{data:e.LZString.compressToBase64(i),compression:"lz64"},s]:"gzip-js"===n?[(0,r.gzipSync)((0,r.strToU8)(i),{mtime:0}),o(o({},s),{},{blob:!0,urlQueryArgs:{compression:"gzip-js"}})]:[{data:t._.base64Encode(i)},s]}
45
45
  },{"./lz-string":"zdbk","fflate":"UJm1","./utils":"FOZT"}],"tOu2":[function(require,module,exports) {
46
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.xhr=exports.encodePostData=void 0;var e=require("./utils"),r=function e(r,t){if(t.blob&&r.buffer)return new Blob([r.buffer],{type:"text/plain"});if(t.sendBeacon||t.blob){var o=e(r,{method:"POST"});return new Blob([o],{type:"application/x-www-form-urlencoded"})}if("POST"!==t.method)return null;var n,s;return n=Array.isArray(r)||(s=r,"[object Uint8Array]"===Object.prototype.toString.call(s))?"data="+encodeURIComponent(r):"data="+encodeURIComponent(r.data),r.compression&&(n+="&compression="+r.compression),n};exports.encodePostData=r;var t=function(t){var o=t.url,n=t.data,s=t.headers,a=t.options,i=t.captureMetrics,c=t.callback,d=t.retriesPerformedSoFar,u=t.retryQueue,p=t.onXHRError,l=new XMLHttpRequest;l.open(a.method,o,!0);var f=r(n,a);i.incr("_send_request"),i.incr("_send_request_inflight"),e._.each(s,function(e,r){l.setRequestHeader(r,e)}),"POST"!==a.method||a.blob||l.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l.withCredentials=!0,l.onreadystatechange=function(){if(4===l.readyState)if(i.incr("xhr-response"),i.incr("xhr-response-".concat(l.status)),i.decr("_send_request_inflight"),200===l.status){if(c){var r;try{r=JSON.parse(l.responseText)}catch(t){return void e.console.error(t)}c(r)}}else"function"==typeof p&&p(l),[401,403,404,500].indexOf(l.status)<0&&u.enqueue({url:o,data:n,options:a,headers:s,retriesPerformedSoFar:(d||0)+1,callback:c}),c&&(a.verbose?c({status:0,error:error}):c(0))},l.send(f)};exports.xhr=t;
46
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.xhr=exports.encodePostData=void 0;var e=require("./utils"),r=function e(r,t){if(t.blob&&r.buffer)return new Blob([r.buffer],{type:"text/plain"});if(t.sendBeacon||t.blob){var o=e(r,{method:"POST"});return new Blob([o],{type:"application/x-www-form-urlencoded"})}if("POST"!==t.method)return null;var n,a;return n=Array.isArray(r)||(a=r,"[object Uint8Array]"===Object.prototype.toString.call(a))?"data="+encodeURIComponent(r):"data="+encodeURIComponent(r.data),r.compression&&(n+="&compression="+r.compression),n};exports.encodePostData=r;var t=function(t){var o=t.url,n=t.data,a=t.headers,s=t.options,i=t.captureMetrics,c=t.callback,d=t.retriesPerformedSoFar,u=t.retryQueue,p=t.onXHRError,l=new XMLHttpRequest;l.open(s.method,o,!0);var f=r(n,s);i.incr("_send_request"),i.incr("_send_request_inflight"),e._.each(a,function(e,r){l.setRequestHeader(r,e)}),"POST"!==s.method||s.blob||l.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l.withCredentials=!0,l.onreadystatechange=function(){if(4===l.readyState)if(i.incr("xhr-response"),i.incr("xhr-response-".concat(l.status)),i.decr("_send_request_inflight"),200===l.status){if(c){var r;try{r=JSON.parse(l.responseText)}catch(t){return void e.logger.error(t)}c(r)}}else"function"==typeof p&&p(l),[401,403,404,500].indexOf(l.status)<0&&u.enqueue({url:o,data:n,options:s,headers:a,retriesPerformedSoFar:(d||0)+1,callback:c}),c&&(s.verbose?c({status:0,error:error}):c(0))},l.send(f)};exports.xhr=t;
47
47
  },{"./utils":"FOZT"}],"ennf":[function(require,module,exports) {
48
48
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RetryQueue=void 0;var e=require("./base-request-queue"),t=require("./send-request");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),e}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=v();return function(){var r,n=w(e);if(t){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function b(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?d(e):t}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var O=function(r){y(i,e.RequestQueueScaffold);var n=h(i);function i(e,t){var r;return l(this,i),(r=n.call(this)).captureMetrics=e,r.isPolling=!1,r.queue=[],r.areWeOnline=!0,r.onXHRError=t,"onLine"in window.navigator&&(r.areWeOnline=window.navigator.onLine,window.addEventListener("online",function(){r._handleWeAreNowOnline()}),window.addEventListener("offline",function(){r.areWeOnline=!1})),r}return s(i,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var r=3e3*Math.pow(2,t),n=new Date(Date.now()+r);console.warn("Enqueued failed request for retry in ".concat(r)),this.queue.push({retryAt:n,requestData:e}),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;clearTimeout(this._poller),this._poller=setTimeout(function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()},this._pollInterval)}},{key:"flush",value:function(){var e=new Date(Date.now()),t=this.queue.filter(function(t){return t.retryAt<e});if(t.length>0){this.queue=this.queue.filter(function(t){return t.retryAt>=e});var r,n=u(t);try{for(n.s();!(r=n.n()).done;){var o=r.value.requestData;this._executeXhrRequest(o)}}catch(i){n.e(i)}finally{n.f()}}}},{key:"unload",value:function(){clearTimeout(this._poller);var e,r=u(this.queue);try{for(r.s();!(e=r.n()).done;){var n=e.value.requestData,i=n.url,a=n.data,c=n.options;try{window.navigator.sendBeacon(i,(0,t.encodePostData)(a,o(o({},c),{},{sendBeacon:!0})))}catch(l){this.get_config("debug")&&console.error(l)}}}catch(f){r.e(f)}finally{r.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var r=e.url,n=e.data,o=e.options,i=e.headers,u=e.callback,a=e.retriesPerformedSoFar;(0,t.xhr)({url:r,data:n||{},options:o||{},headers:i||{},retriesPerformedSoFar:a||0,callback:u,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}();exports.RetryQueue=O;
49
49
  },{"./base-request-queue":"ae0g","./send-request":"tOu2"}],"tci7":[function(require,module,exports) {
@@ -51,7 +51,7 @@ module.exports={name:"posthog-js",version:"1.17.9",description:"Posthog-js allow
51
51
  },{"./extensions/sessionrecording":"Z2N4","./posthog-persistence":"MAdm","./storage":"KZ7Y","./utils":"FOZT"}],"eWVp":[function(require,module,exports) {
52
52
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optimisePerformanceData=i,exports.getPerformanceEntriesByType=o,exports.deduplicateKeys=a,exports.pageLoadFrom=u,exports.getPerformanceData=c;var e=require("./utils"),r=n(require("./config"));function n(e){return e&&e.__esModule?e:{default:e}}function t(e){return Number(e)===e&&e%1!=0}function i(e){return e.forEach(function(r,n){for(var i in r)t(r[i])&&r[i].toString().match(/^\d+\.\d{4,}$/)&&(e[n][i]=Number(r[i].toFixed(3))),["serverTiming","workerTiming"].includes(i)&&0===r[i].length&&delete e[n][i],"entryType"===i&&"resource"===r[i]&&delete e[n][i],"nextHopProtocol"===i&&delete e[n][i],0===r[i]&&delete e[n][i]}),a(e)}function o(n){try{return i(JSON.parse(JSON.stringify(e.window.performance.getEntriesByType(n))))}catch(t){return r.default.DEBUG&&console.warn("not able to capture performance data ("+n+") - "+t),[]}}function a(e){if(0===e.length)return[];var r=Object.keys(e[0]);return[r,e.map(function(e){return r.map(function(r){return e[r]})})]}function u(e){var r=e.navigation&&e.navigation[0],n=e.navigation&&e.navigation[1]&&e.navigation[1][0],t=r&&r.indexOf("duration");if(t>-1)return n[t];var i=r&&r.indexOf("loadEventEnd"),o=r&&r.indexOf("startTime");return i>-1?(n&&n[i])-(n&&n[o]||0):void 0}function c(){var e={navigation:o("navigation"),paint:o("paint"),resource:o("resource")},r={},n=u(e);return n&&(r.$performance_page_loaded=n),r.$performance_raw=JSON.stringify(e),r}
53
53
  },{"./utils":"FOZT","./config":"itQ5"}],"ok3T":[function(require,module,exports) {
54
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=Y,exports.init_as_module=G,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=w(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue"),m=require("./sessionid"),v=require("./apm");function w(e){return e&&e.__esModule?e:{default:e}}function k(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function q(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?k(Object(o),!0).forEach(function(t){P(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):k(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function P(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function S(e,t){return $(e)||E(e,t)||F(e,t)||x()}function x(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function F(e,t){if(e){if("string"==typeof e)return O(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function E(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function $(e){if(Array.isArray(e))return e}var I=0,H=1,j=function(){},A={},R="posthog",M=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,D=!M&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),L=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},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,secure_cookie:"https:"===i.window.location.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:[],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:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},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;i.console.error(t)},_onCapture:function(){},_capture_metrics:!1,_capture_performance:!1}},C=function(){};exports.PostHogLib=C;var U=function(o,a,_){var d,g=_===R?t:t[_];if(g&&e===I)d=g;else{if(g&&!i._.isArray(g))return void i.console.error("You have already initialized "+_);d=new C}if(d._init(o,a,_),d.people=new s.PostHogPeople,d.people._init(d),d.featureFlags=new p.PostHogFeatureFlags(d),d.feature_flags=d.featureFlags,d.toolbar=new u.Toolbar(d),d.toolbar.maybeLoadEditor(),d.sessionRecording=new c.SessionRecording(d),d.sessionRecording.startRecordingIfEnabled(),d.__autocapture_enabled=d.get_config("autocapture"),d.get_config("autocapture")){n.autocapture.enabledForProject(d.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(d):(d.__autocapture_enabled=!1,i.console.log("Disabling Automatic Event Collection because this browser is not supported")):(d.__autocapture_enabled=!1,i.console.log("Not in active bucket: disabling Automatic Event Collection."))}return r.default.DEBUG=r.default.DEBUG||d.get_config("debug"),!i._.isUndefined(g)&&i._.isArray(g)&&(d._execute_array.call(d.people,g.people),d._execute_array(g)),d};C.prototype.init=function(e,o,r){if(i._.isUndefined(r))i.console.error("You must name your new library: init(token, config, name)");else{if(r!==R){var n=U(e,o,r);return t[r]=n,n._loaded(),n}i.console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},C.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},L(),t,{name:o,token:e,callback_fn:(o===R?o:R+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics")),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this.sessionManager=new m.SessionIdManager(this.config,this.persistence),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},C.prototype._loaded=function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){i.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 _.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},C.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},C.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},C.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(M){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},C.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"})},C.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||A,j)},C.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=S((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},C.prototype._send_request=function(e,t,o,r){if(D)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),M||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)try{i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,q(q({},o),{},{sendBeacon:!0})))}catch(d){this.get_config("debug")&&i.console.error(d)}else if(M)try{(0,y.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(d){i.console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},C.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},C.prototype.push=function(e){this._execute_array([e])},C.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||A).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)i.console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=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 s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.console.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==A;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),C.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},C.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},C.prototype._calculate_event_properties=function(e,t,o){var r=t||{};if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}if(this.sessionManager){var p=this.sessionManager.getSessionAndWindowId(),a=p.sessionId,c=p.windowId;r.$session_id=a,r.$window_id=c}r=i._.extend({},i._.info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")&&(r=i._.extend(r,(0,v.getPerformanceData)()));var _=this.get_config("property_blacklist");i._.isArray(_)?i._.each(_,function(e){delete r[e]}):i.console.error("Invalid value for property_blacklist config: "+_);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},C.prototype.register=function(e,t){this.persistence.register(e,t)},C.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},C.prototype.unregister=function(e){this.persistence.unregister(e)},C.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},C.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},C.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},C.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},C.prototype.onFeatureFlags=function(e){this.featureFlags.onFeatureFlags(e)},C.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),e!==r&&this.reloadFeatureFlags()}else i.console.error("Unique user id has not been set in posthog.identify")},C.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:q(q({},r),{},P({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o}),r[e]!==t&&this.reloadFeatureFlags()}else i.console.error("posthog.group requires a group type and group key")},C.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},C.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},C.prototype.getGroups=function(){return this.get_property("$groups")||{}},C.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return i.console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(i.console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},C.prototype.set_config=function(e){var t=q({},this.config);i._.isObject(e)&&(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),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},C.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},C.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},C.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},C.prototype.get_config=function(e){return this.config[e]},C.prototype.get_property=function(e){return this.persistence.props[e]},C.prototype.toString=function(){var e=this.get_config("name");return e!==R&&(e=R+"."+e),e},C.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.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")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},C.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)},C.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,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),g.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})},C.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},C.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},C.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},C.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},C.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},C.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},C.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),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}))},C.prototype.decodeLZ64=o.LZString.decompressFromBase64,C.prototype.init=C.prototype.init,C.prototype.reset=C.prototype.reset,C.prototype.capture=C.prototype.capture,C.prototype.register=C.prototype.register,C.prototype.register_once=C.prototype.register_once,C.prototype.unregister=C.prototype.unregister,C.prototype.identify=C.prototype.identify,C.prototype.getGroups=C.prototype.getGroups,C.prototype.group=C.prototype.group,C.prototype.alias=C.prototype.alias,C.prototype.set_config=C.prototype.set_config,C.prototype.get_config=C.prototype.get_config,C.prototype.get_property=C.prototype.get_property,C.prototype.get_distinct_id=C.prototype.get_distinct_id,C.prototype.toString=C.prototype.toString,C.prototype.opt_out_captureing=C.prototype.opt_out_captureing,C.prototype.opt_in_captureing=C.prototype.opt_in_captureing,C.prototype.has_opted_out_captureing=C.prototype.has_opted_out_captureing,C.prototype.has_opted_in_captureing=C.prototype.has_opted_in_captureing,C.prototype.clear_opt_in_out_captureing=C.prototype.clear_opt_in_out_captureing,C.prototype.opt_out_capturing=C.prototype.opt_out_capturing,C.prototype.opt_in_capturing=C.prototype.opt_in_capturing,C.prototype.has_opted_out_capturing=C.prototype.has_opted_out_capturing,C.prototype.has_opted_in_capturing=C.prototype.has_opted_in_capturing,C.prototype.clear_opt_in_out_capturing=C.prototype.clear_opt_in_out_capturing,C.prototype.getFeatureFlag=C.prototype.getFeatureFlag,C.prototype.isFeatureEnabled=C.prototype.isFeatureEnabled,C.prototype.reloadFeatureFlags=C.prototype.reloadFeatureFlags,C.prototype.onFeatureFlags=C.prototype.onFeatureFlags,C.prototype.decodeLZ64=C.prototype.decodeLZ64,C.prototype.SentryIntegration=C.prototype.sentry_integration,C.prototype.debug=C.prototype.debug,C.prototype.LIB_VERSION=r.default.LIB_VERSION,C.prototype.startSessionRecording=C.prototype.startSessionRecording,C.prototype.stopSessionRecording=C.prototype.stopSessionRecording,C.prototype.sessionRecordingStarted=C.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(C,["identify"]);var T={},B=function(){i._.each(T,function(e,o){o!==R&&(t[o]=e)}),t._=i._},Q=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=T[n]=U(o,r,n),t[n]._loaded()),t[n];var s=t;T[R]?s=T[R]:o&&((s=U(o,r,R))._loaded(),T[R]=s),t=s,e===H&&(i.window[R]=t),B()}},N=function(){function e(){e.done||(e.done=!0,D=!1,i._.each(T,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function Y(){e=H,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?i.console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(T[e[e.length-1]]=U.apply(this,e))}),Q(),t.init(),i._.each(T,function(e){e._loaded()}),N())}function G(){return e=I,t=new C,Q(),t.init(),N(),t}
54
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=Y,exports.init_as_module=G,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=w(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue"),m=require("./sessionid"),v=require("./apm");function w(e){return e&&e.__esModule?e:{default:e}}function k(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function q(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?k(Object(o),!0).forEach(function(t){P(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):k(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function P(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function S(e,t){return $(e)||E(e,t)||F(e,t)||x()}function x(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function F(e,t){if(e){if("string"==typeof e)return O(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function E(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function $(e){if(Array.isArray(e))return e}var I=0,H=1,j=function(){},A={},R="posthog",M=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,D=!M&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),L=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},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:"===i.window.location.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:[],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:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},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)},_onCapture:function(){},_capture_metrics:!1,_capture_performance:!1}},C=function(){};exports.PostHogLib=C;var U=function(o,a,_){var d,g=_===R?t:t[_];if(g&&e===I)d=g;else{if(g&&!i._.isArray(g))return void console.error("You have already initialized "+_);d=new C}if(d._init(o,a,_),d.people=new s.PostHogPeople,d.people._init(d),d.featureFlags=new p.PostHogFeatureFlags(d),d.feature_flags=d.featureFlags,d.toolbar=new u.Toolbar(d),d.toolbar.maybeLoadEditor(),d.sessionRecording=new c.SessionRecording(d),d.sessionRecording.startRecordingIfEnabled(),d.__autocapture_enabled=d.get_config("autocapture"),d.get_config("autocapture")){n.autocapture.enabledForProject(d.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(d):(d.__autocapture_enabled=!1,i.logger.log("Disabling Automatic Event Collection because this browser is not supported")):(d.__autocapture_enabled=!1,i.logger.log("Not in active bucket: disabling Automatic Event Collection."))}return r.default.DEBUG=r.default.DEBUG||d.get_config("debug"),!i._.isUndefined(g)&&i._.isArray(g)&&(d._execute_array.call(d.people,g.people),d._execute_array(g)),d};C.prototype.init=function(e,o,r){if(i._.isUndefined(r))console.error("You must name your new library: init(token, config, name)");else{if(r!==R){var n=U(e,o,r);return t[r]=n,n._loaded(),n}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},C.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},L(),t,{name:o,token:e,callback_fn:(o===R?o:R+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics")),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this.sessionManager=new m.SessionIdManager(this.config,this.persistence),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},C.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 _.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},C.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},C.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},C.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(M){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},C.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"})},C.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||A,j)},C.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=S((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},C.prototype._send_request=function(e,t,o,r){if(D)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),M||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)try{i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,q(q({},o),{},{sendBeacon:!0})))}catch(d){this.get_config("debug")&&console.error(d)}else if(M)try{(0,y.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(d){console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},C.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},C.prototype.push=function(e){this._execute_array([e])},C.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||A).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=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 s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.logger.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==A;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),C.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},C.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},C.prototype._calculate_event_properties=function(e,t,o){var r=q({},t);if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}if(this.sessionManager){var p=this.sessionManager.getSessionAndWindowId(),a=p.sessionId,c=p.windowId;r.$session_id=a,r.$window_id=c}r=i._.extend({},i._.info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")&&(r=i._.extend(r,(0,v.getPerformanceData)()));var _=this.get_config("property_blacklist");i._.isArray(_)?i._.each(_,function(e){delete r[e]}):console.error("Invalid value for property_blacklist config: "+_);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},C.prototype.register=function(e,t){this.persistence.register(e,t)},C.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},C.prototype.unregister=function(e){this.persistence.unregister(e)},C.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},C.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},C.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},C.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},C.prototype.onFeatureFlags=function(e){this.featureFlags.onFeatureFlags(e)},C.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),e!==r&&this.reloadFeatureFlags()}else console.error("Unique user id has not been set in posthog.identify")},C.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:q(q({},r),{},P({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o}),r[e]!==t&&this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")},C.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},C.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},C.prototype.getGroups=function(){return this.get_property("$groups")||{}},C.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},C.prototype.set_config=function(e){var t=q({},this.config);i._.isObject(e)&&(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),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},C.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},C.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},C.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},C.prototype.get_config=function(e){return this.config[e]},C.prototype.get_property=function(e){return this.persistence.props[e]},C.prototype.toString=function(){var e=this.get_config("name");return e!==R&&(e=R+"."+e),e},C.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.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")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},C.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)},C.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,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),g.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})},C.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},C.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},C.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},C.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},C.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},C.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},C.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),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}))},C.prototype.decodeLZ64=o.LZString.decompressFromBase64,C.prototype.init=C.prototype.init,C.prototype.reset=C.prototype.reset,C.prototype.capture=C.prototype.capture,C.prototype.register=C.prototype.register,C.prototype.register_once=C.prototype.register_once,C.prototype.unregister=C.prototype.unregister,C.prototype.identify=C.prototype.identify,C.prototype.getGroups=C.prototype.getGroups,C.prototype.group=C.prototype.group,C.prototype.alias=C.prototype.alias,C.prototype.set_config=C.prototype.set_config,C.prototype.get_config=C.prototype.get_config,C.prototype.get_property=C.prototype.get_property,C.prototype.get_distinct_id=C.prototype.get_distinct_id,C.prototype.toString=C.prototype.toString,C.prototype.opt_out_captureing=C.prototype.opt_out_captureing,C.prototype.opt_in_captureing=C.prototype.opt_in_captureing,C.prototype.has_opted_out_captureing=C.prototype.has_opted_out_captureing,C.prototype.has_opted_in_captureing=C.prototype.has_opted_in_captureing,C.prototype.clear_opt_in_out_captureing=C.prototype.clear_opt_in_out_captureing,C.prototype.opt_out_capturing=C.prototype.opt_out_capturing,C.prototype.opt_in_capturing=C.prototype.opt_in_capturing,C.prototype.has_opted_out_capturing=C.prototype.has_opted_out_capturing,C.prototype.has_opted_in_capturing=C.prototype.has_opted_in_capturing,C.prototype.clear_opt_in_out_capturing=C.prototype.clear_opt_in_out_capturing,C.prototype.getFeatureFlag=C.prototype.getFeatureFlag,C.prototype.isFeatureEnabled=C.prototype.isFeatureEnabled,C.prototype.reloadFeatureFlags=C.prototype.reloadFeatureFlags,C.prototype.onFeatureFlags=C.prototype.onFeatureFlags,C.prototype.decodeLZ64=C.prototype.decodeLZ64,C.prototype.SentryIntegration=C.prototype.sentry_integration,C.prototype.debug=C.prototype.debug,C.prototype.LIB_VERSION=r.default.LIB_VERSION,C.prototype.startSessionRecording=C.prototype.startSessionRecording,C.prototype.stopSessionRecording=C.prototype.stopSessionRecording,C.prototype.sessionRecordingStarted=C.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(C,["identify"]);var T={},B=function(){i._.each(T,function(e,o){o!==R&&(t[o]=e)}),t._=i._},Q=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=T[n]=U(o,r,n),t[n]._loaded()),t[n];var s=t;T[R]?s=T[R]:o&&((s=U(o,r,R))._loaded(),T[R]=s),t=s,e===H&&(i.window[R]=t),B()}},N=function(){function e(){e.done||(e.done=!0,D=!1,i._.each(T,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function Y(){e=H,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(T[e[e.length-1]]=U.apply(this,e))}),Q(),t.init(),i._.each(T,function(e){e._loaded()}),N())}function G(){return e=I,t=new C,Q(),t.init(),N(),t}
55
55
  },{"./lz-string":"zdbk","./config":"itQ5","./utils":"FOZT","./autocapture":"gR3r","./posthog-people":"ecEG","./posthog-featureflags":"aVqC","./posthog-persistence":"MAdm","./extensions/sessionrecording":"Z2N4","./decide":"auG7","./extensions/toolbar":"ZEpJ","./gdpr-utils":"rxSh","./storage":"KZ7Y","./request-queue":"Je4H","./capture-metrics":"TeHW","./compression":"Ie9M","./send-request":"tOu2","./retry-queue":"ennf","./sessionid":"tci7","./apm":"eWVp"}],"e2xX":[function(require,module,exports) {
56
56
  "use strict";var r=require("./posthog-core");(0,r.init_from_snippet)();
57
57
  },{"./posthog-core":"ok3T"}]},{},["e2xX"], null)
package/dist/es.js CHANGED
@@ -863,7 +863,7 @@ var LZString = {
863
863
  }
864
864
  };
865
865
 
866
- var version = "1.17.9";
866
+ var version = "1.18.0";
867
867
 
868
868
  var Config$1 = {
869
869
  DEBUG: false,
@@ -900,15 +900,18 @@ var _ = {
900
900
  }
901
901
  }; // Console override
902
902
 
903
- var console$1 = {
903
+ var logger = {
904
904
  /** @type {function(...*)} */
905
905
  log: function log() {
906
906
  if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
907
+ // Don't log PostHog debug messages in rrweb
908
+ var log = window.console.log['__rrweb_original__'] ? window.console.log['__rrweb_original__'] : window.console.log;
909
+
907
910
  try {
908
- window.console.log.apply(window.console, arguments);
911
+ log.apply(window.console, arguments);
909
912
  } catch (err) {
910
913
  _.each(arguments, function (arg) {
911
- window.console.log(arg);
914
+ log(arg);
912
915
  });
913
916
  }
914
917
  }
@@ -917,13 +920,15 @@ var console$1 = {
917
920
  /** @type {function(...*)} */
918
921
  error: function error() {
919
922
  if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
920
- var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
923
+ var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments)); // Don't log PostHog debug messages in rrweb
924
+
925
+ var error = window.console.error['__rrweb_original__'] ? window.console.error['__rrweb_original__'] : window.console.error;
921
926
 
922
927
  try {
923
- window.console.error.apply(window.console, args);
928
+ error.apply(window.console, args);
924
929
  } catch (err) {
925
930
  _.each(args, function (arg) {
926
- window.console.error(arg);
931
+ error(arg);
927
932
  });
928
933
  }
929
934
  }
@@ -932,13 +937,15 @@ var console$1 = {
932
937
  /** @type {function(...*)} */
933
938
  critical: function critical() {
934
939
  if (!_.isUndefined(window.console) && window.console) {
935
- var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
940
+ var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments)); // Don't log PostHog debug messages in rrweb
941
+
942
+ var error = window.console.error['__rrweb_original__'] ? window.console.error['__rrweb_original__'] : window.console.error;
936
943
 
937
944
  try {
938
- window.console.error.apply(window.console, args);
945
+ error.apply(window.console, args);
939
946
  } catch (err) {
940
947
  _.each(args, function (arg) {
941
- window.console.error(arg);
948
+ error(arg);
942
949
  });
943
950
  }
944
951
  }
@@ -1138,10 +1145,10 @@ _.safewrap = function (f) {
1138
1145
  try {
1139
1146
  return f.apply(this, arguments);
1140
1147
  } catch (e) {
1141
- console$1.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1148
+ logger.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1142
1149
 
1143
1150
  if (Config$1.DEBUG) {
1144
- console$1.critical(e);
1151
+ logger.critical(e);
1145
1152
  }
1146
1153
  }
1147
1154
  };
@@ -1432,7 +1439,7 @@ _.getQueryParam = function (url, param) {
1432
1439
  try {
1433
1440
  result = decodeURIComponent(result);
1434
1441
  } catch (err) {
1435
- console$1.error('Skipping decoding for malformed query param: ' + result);
1442
+ logger.error('Skipping decoding for malformed query param: ' + result);
1436
1443
  }
1437
1444
 
1438
1445
  return result.replace(/\+/g, ' ');
@@ -1461,7 +1468,7 @@ _.register_event = function () {
1461
1468
  */
1462
1469
  var register_event = function register_event(element, type, handler, oldSchool, useCapture) {
1463
1470
  if (!element) {
1464
- console$1.error('No valid element provided to register_event');
1471
+ logger.error('No valid element provided to register_event');
1465
1472
  return;
1466
1473
  }
1467
1474
 
@@ -2302,7 +2309,7 @@ var autocapture = {
2302
2309
  var token = instance.get_config('token');
2303
2310
 
2304
2311
  if (this._initializedTokens.indexOf(token) > -1) {
2305
- console.log('autocapture already initialized for token "' + token + '"');
2312
+ logger.log('autocapture already initialized for token "' + token + '"');
2306
2313
  return;
2307
2314
  }
2308
2315
 
@@ -2441,14 +2448,14 @@ var localStore = {
2441
2448
  }
2442
2449
 
2443
2450
  if (!supported) {
2444
- console$1.error('localStorage unsupported; falling back to cookie store');
2451
+ logger.error('localStorage unsupported; falling back to cookie store');
2445
2452
  }
2446
2453
 
2447
2454
  _localStorage_supported = supported;
2448
2455
  return supported;
2449
2456
  },
2450
2457
  error: function error(msg) {
2451
- console$1.error('localStorage error: ' + msg);
2458
+ logger.error('localStorage error: ' + msg);
2452
2459
  },
2453
2460
  get: function get(name) {
2454
2461
  try {
@@ -2539,7 +2546,7 @@ var memoryStore = {
2539
2546
  return true;
2540
2547
  },
2541
2548
  error: function error(msg) {
2542
- console$1.error('memoryStorage error: ' + msg);
2549
+ logger.error('memoryStorage error: ' + msg);
2543
2550
  },
2544
2551
  parse: function parse(name) {
2545
2552
  return memoryStorage[name] || null;
@@ -2583,7 +2590,7 @@ var sessionStore = {
2583
2590
  },
2584
2591
  error: function error(msg) {
2585
2592
  if (Config.DEBUG) {
2586
- console$1.error('sessionStorage error: ', msg);
2593
+ logger.error('sessionStorage error: ', msg);
2587
2594
  }
2588
2595
  },
2589
2596
  get: function get(name) {
@@ -3443,7 +3450,7 @@ var PostHogPersistence = function PostHogPersistence(config) {
3443
3450
  var storage_type = config['persistence'];
3444
3451
 
3445
3452
  if (storage_type !== 'cookie' && storage_type.indexOf('localStorage') === -1 && storage_type !== 'memory') {
3446
- console$1.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3453
+ logger.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3447
3454
  storage_type = config['persistence'] = 'cookie';
3448
3455
  }
3449
3456
 
@@ -3831,7 +3838,7 @@ var SessionRecording = /*#__PURE__*/function () {
3831
3838
 
3832
3839
 
3833
3840
  if ((this.windowId !== windowId || this.sessionId !== sessionId) && [FULL_SNAPSHOT_EVENT_TYPE, META_EVENT_TYPE].indexOf(event.type) === -1) {
3834
- window.rrweb.record.takeFullSnapshot();
3841
+ this.rrwebRecord.takeFullSnapshot();
3835
3842
  }
3836
3843
 
3837
3844
  this.windowId = windowId;
@@ -3854,7 +3861,10 @@ var SessionRecording = /*#__PURE__*/function () {
3854
3861
  maskInputFn: null,
3855
3862
  slimDOMOptions: {},
3856
3863
  collectFonts: false
3857
- }; // only allows user to set our 'whitelisted' options
3864
+ }; // We switched from loading all of rrweb to just the record part, but
3865
+ // keep backwards compatibility if someone hasn't upgraded PostHog
3866
+
3867
+ this.rrwebRecord = window.rrweb ? window.rrweb.record : window.rrwebRecord; // only allows user to set our 'whitelisted' options
3858
3868
 
3859
3869
  var userSessionRecordingOptions = this.instance.get_config('session_recording');
3860
3870
 
@@ -3868,7 +3878,7 @@ var SessionRecording = /*#__PURE__*/function () {
3868
3878
  }
3869
3879
  }
3870
3880
 
3871
- this.stopRrweb = window.rrweb.record(_objectSpread2({
3881
+ this.stopRrweb = this.rrwebRecord(_objectSpread2({
3872
3882
  emit: function emit(event) {
3873
3883
  event = filterDataURLsFromLargeDataObjects(event);
3874
3884
 
@@ -3889,13 +3899,14 @@ var SessionRecording = /*#__PURE__*/function () {
3889
3899
  } else {
3890
3900
  _this2.snapshots.push(properties);
3891
3901
  }
3892
- }
3902
+ },
3903
+ plugins: window.rrwebConsoleRecord && this.instance.get_config('enable_recording_console_log') ? [window.rrwebConsoleRecord.getRecordConsolePlugin()] : []
3893
3904
  }, sessionRecordingOptions)); // :TRICKY: rrweb does not capture navigation within SPA-s, so hook into our $pageview events to get access to all events.
3894
3905
  // Dropping the initial event is fine (it's always captured by rrweb).
3895
3906
 
3896
3907
  this.instance._addCaptureHook(function (eventName) {
3897
3908
  if (eventName === '$pageview') {
3898
- window.rrweb.record.addCustomEvent('$pageview', {
3909
+ _this2.rrwebRecord.addCustomEvent('$pageview', {
3899
3910
  href: window.location.href
3900
3911
  });
3901
3912
  }
@@ -5234,7 +5245,7 @@ var xhr = function xhr(_ref) {
5234
5245
  try {
5235
5246
  response = JSON.parse(req.responseText);
5236
5247
  } catch (e) {
5237
- console$1.error(e);
5248
+ logger.error(e);
5238
5249
  return;
5239
5250
  }
5240
5251
 
@@ -5719,6 +5730,7 @@ var defaultConfig = function defaultConfig() {
5719
5730
  disable_session_recording: false,
5720
5731
  disable_persistence: false,
5721
5732
  disable_cookie: false,
5733
+ enable_recording_console_log: false,
5722
5734
  secure_cookie: win.location.protocol === 'https:',
5723
5735
  ip: true,
5724
5736
  opt_out_capturing_by_default: false,
@@ -5751,7 +5763,7 @@ var defaultConfig = function defaultConfig() {
5751
5763
  advanced_disable_toolbar_metrics: false,
5752
5764
  on_xhr_error: function on_xhr_error(req) {
5753
5765
  var error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText;
5754
- console$1.error(error);
5766
+ console.error(error);
5755
5767
  },
5756
5768
  // Used for internal testing
5757
5769
  _onCapture: function _onCapture() {},
@@ -5783,7 +5795,7 @@ var create_mplib = function create_mplib(token, config, name) {
5783
5795
  instance = target;
5784
5796
  } else {
5785
5797
  if (target && !_.isArray(target)) {
5786
- console$1.error('You have already initialized ' + name);
5798
+ console.error('You have already initialized ' + name);
5787
5799
  return;
5788
5800
  }
5789
5801
 
@@ -5810,10 +5822,10 @@ var create_mplib = function create_mplib(token, config, name) {
5810
5822
 
5811
5823
  if (!autocapture.enabledForProject(instance.get_config('token'), num_buckets, num_enabled_buckets)) {
5812
5824
  instance['__autocapture_enabled'] = false;
5813
- console$1.log('Not in active bucket: disabling Automatic Event Collection.');
5825
+ logger.log('Not in active bucket: disabling Automatic Event Collection.');
5814
5826
  } else if (!autocapture.isBrowserSupported()) {
5815
5827
  instance['__autocapture_enabled'] = false;
5816
- console$1.log('Disabling Automatic Event Collection because this browser is not supported');
5828
+ logger.log('Disabling Automatic Event Collection because this browser is not supported');
5817
5829
  } else {
5818
5830
  autocapture.init(instance);
5819
5831
  }
@@ -5855,12 +5867,12 @@ var create_mplib = function create_mplib(token, config, name) {
5855
5867
 
5856
5868
  PostHogLib.prototype.init = function (token, config, name) {
5857
5869
  if (_.isUndefined(name)) {
5858
- console$1.error('You must name your new library: init(token, config, name)');
5870
+ console.error('You must name your new library: init(token, config, name)');
5859
5871
  return;
5860
5872
  }
5861
5873
 
5862
5874
  if (name === PRIMARY_INSTANCE_NAME) {
5863
- console$1.error('You must initialize the main posthog object right after you include the PostHog js snippet');
5875
+ console.error('You must initialize the main posthog object right after you include the PostHog js snippet');
5864
5876
  return;
5865
5877
  }
5866
5878
 
@@ -5927,7 +5939,7 @@ PostHogLib.prototype._loaded = function () {
5927
5939
  try {
5928
5940
  this.get_config('loaded')(this);
5929
5941
  } catch (err) {
5930
- console$1.error('`loaded` function failed', err);
5942
+ console.error('`loaded` function failed', err);
5931
5943
  }
5932
5944
 
5933
5945
  this._start_queue_if_opted_in(); // this happens after so a user can call identify in
@@ -6090,7 +6102,7 @@ PostHogLib.prototype._send_request = function (url, data, options, callback) {
6090
6102
  })));
6091
6103
  } catch (e) {
6092
6104
  if (this.get_config('debug')) {
6093
- console$1.error(e);
6105
+ console.error(e);
6094
6106
  }
6095
6107
  }
6096
6108
  } else if (USE_XHR) {
@@ -6107,7 +6119,7 @@ PostHogLib.prototype._send_request = function (url, data, options, callback) {
6107
6119
  onXHRError: this.get_config('on_xhr_error')
6108
6120
  });
6109
6121
  } catch (e) {
6110
- console$1.error(e);
6122
+ console.error(e);
6111
6123
  }
6112
6124
  } else {
6113
6125
  var script = document$1.createElement('script');
@@ -6233,7 +6245,7 @@ PostHogLib.prototype.capture = addOptOutCheckPostHogLib(function (event_name, pr
6233
6245
  }
6234
6246
 
6235
6247
  if (_.isUndefined(event_name) || typeof event_name !== 'string') {
6236
- console$1.error('No event name provided to posthog.capture');
6248
+ console.error('No event name provided to posthog.capture');
6237
6249
  return;
6238
6250
  }
6239
6251
 
@@ -6265,7 +6277,7 @@ PostHogLib.prototype.capture = addOptOutCheckPostHogLib(function (event_name, pr
6265
6277
  data = _.copyAndTruncateStrings(data, options._noTruncate ? null : this.get_config('properties_string_max_length'));
6266
6278
 
6267
6279
  if (this.get_config('debug')) {
6268
- console$1.log('PostHog.js send', data);
6280
+ logger.log('PostHog.js send', data);
6269
6281
  }
6270
6282
 
6271
6283
  var jsonData = JSON.stringify(data);
@@ -6299,7 +6311,8 @@ PostHogLib.prototype._invokeCaptureHooks = function (eventName, eventData) {
6299
6311
 
6300
6312
  PostHogLib.prototype._calculate_event_properties = function (event_name, event_properties, start_timestamp) {
6301
6313
  // set defaults
6302
- var properties = event_properties || {};
6314
+ var properties = _objectSpread2({}, event_properties);
6315
+
6303
6316
  properties['token'] = this.get_config('token');
6304
6317
 
6305
6318
  if (event_name === '$snapshot') {
@@ -6340,7 +6353,7 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
6340
6353
  delete properties[blacklisted_prop];
6341
6354
  });
6342
6355
  } else {
6343
- console$1.error('Invalid value for property_blacklist config: ' + property_blacklist);
6356
+ console.error('Invalid value for property_blacklist config: ' + property_blacklist);
6344
6357
  }
6345
6358
 
6346
6359
  var sanitize_properties = this.get_config('sanitize_properties');
@@ -6509,7 +6522,7 @@ PostHogLib.prototype.onFeatureFlags = function (callback) {
6509
6522
  PostHogLib.prototype.identify = function (new_distinct_id, userPropertiesToSet, userPropertiesToSetOnce) {
6510
6523
  //if the new_distinct_id has not been set ignore the identify event
6511
6524
  if (!new_distinct_id) {
6512
- console$1.error('Unique user id has not been set in posthog.identify');
6525
+ console.error('Unique user id has not been set in posthog.identify');
6513
6526
  return;
6514
6527
  }
6515
6528
 
@@ -6579,7 +6592,7 @@ PostHogLib.prototype.identify = function (new_distinct_id, userPropertiesToSet,
6579
6592
 
6580
6593
  PostHogLib.prototype.group = function (groupType, groupKey, groupPropertiesToSet) {
6581
6594
  if (!groupType || !groupKey) {
6582
- console$1.error('posthog.group requires a group type and group key');
6595
+ console.error('posthog.group requires a group type and group key');
6583
6596
  return;
6584
6597
  }
6585
6598
 
@@ -6673,7 +6686,7 @@ PostHogLib.prototype.alias = function (alias, original) {
6673
6686
  // posthog.people.identify() call made for this user. It is VERY BAD to make an alias with
6674
6687
  // this ID, as it will duplicate users.
6675
6688
  if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {
6676
- console$1.critical('Attempting to create alias for existing People user - aborting.');
6689
+ console.critical('Attempting to create alias for existing People user - aborting.');
6677
6690
  return -2;
6678
6691
  }
6679
6692
 
@@ -6694,7 +6707,7 @@ PostHogLib.prototype.alias = function (alias, original) {
6694
6707
  _this.identify(alias);
6695
6708
  });
6696
6709
  } else {
6697
- console$1.error('alias matches current distinct_id - skipping api call.');
6710
+ console.error('alias matches current distinct_id - skipping api call.');
6698
6711
  this.identify(alias);
6699
6712
  return -1;
6700
6713
  }
package/dist/module.js CHANGED
@@ -865,7 +865,7 @@ var LZString = {
865
865
  }
866
866
  };
867
867
 
868
- var version = "1.17.9";
868
+ var version = "1.18.0";
869
869
 
870
870
  var Config$1 = {
871
871
  DEBUG: false,
@@ -902,15 +902,18 @@ var _ = {
902
902
  }
903
903
  }; // Console override
904
904
 
905
- var console$1 = {
905
+ var logger = {
906
906
  /** @type {function(...*)} */
907
907
  log: function log() {
908
908
  if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
909
+ // Don't log PostHog debug messages in rrweb
910
+ var log = window.console.log['__rrweb_original__'] ? window.console.log['__rrweb_original__'] : window.console.log;
911
+
909
912
  try {
910
- window.console.log.apply(window.console, arguments);
913
+ log.apply(window.console, arguments);
911
914
  } catch (err) {
912
915
  _.each(arguments, function (arg) {
913
- window.console.log(arg);
916
+ log(arg);
914
917
  });
915
918
  }
916
919
  }
@@ -919,13 +922,15 @@ var console$1 = {
919
922
  /** @type {function(...*)} */
920
923
  error: function error() {
921
924
  if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
922
- var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
925
+ var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments)); // Don't log PostHog debug messages in rrweb
926
+
927
+ var error = window.console.error['__rrweb_original__'] ? window.console.error['__rrweb_original__'] : window.console.error;
923
928
 
924
929
  try {
925
- window.console.error.apply(window.console, args);
930
+ error.apply(window.console, args);
926
931
  } catch (err) {
927
932
  _.each(args, function (arg) {
928
- window.console.error(arg);
933
+ error(arg);
929
934
  });
930
935
  }
931
936
  }
@@ -934,13 +939,15 @@ var console$1 = {
934
939
  /** @type {function(...*)} */
935
940
  critical: function critical() {
936
941
  if (!_.isUndefined(window.console) && window.console) {
937
- var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
942
+ var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments)); // Don't log PostHog debug messages in rrweb
943
+
944
+ var error = window.console.error['__rrweb_original__'] ? window.console.error['__rrweb_original__'] : window.console.error;
938
945
 
939
946
  try {
940
- window.console.error.apply(window.console, args);
947
+ error.apply(window.console, args);
941
948
  } catch (err) {
942
949
  _.each(args, function (arg) {
943
- window.console.error(arg);
950
+ error(arg);
944
951
  });
945
952
  }
946
953
  }
@@ -1140,10 +1147,10 @@ _.safewrap = function (f) {
1140
1147
  try {
1141
1148
  return f.apply(this, arguments);
1142
1149
  } catch (e) {
1143
- console$1.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1150
+ logger.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1144
1151
 
1145
1152
  if (Config$1.DEBUG) {
1146
- console$1.critical(e);
1153
+ logger.critical(e);
1147
1154
  }
1148
1155
  }
1149
1156
  };
@@ -1434,7 +1441,7 @@ _.getQueryParam = function (url, param) {
1434
1441
  try {
1435
1442
  result = decodeURIComponent(result);
1436
1443
  } catch (err) {
1437
- console$1.error('Skipping decoding for malformed query param: ' + result);
1444
+ logger.error('Skipping decoding for malformed query param: ' + result);
1438
1445
  }
1439
1446
 
1440
1447
  return result.replace(/\+/g, ' ');
@@ -1463,7 +1470,7 @@ _.register_event = function () {
1463
1470
  */
1464
1471
  var register_event = function register_event(element, type, handler, oldSchool, useCapture) {
1465
1472
  if (!element) {
1466
- console$1.error('No valid element provided to register_event');
1473
+ logger.error('No valid element provided to register_event');
1467
1474
  return;
1468
1475
  }
1469
1476
 
@@ -2304,7 +2311,7 @@ var autocapture = {
2304
2311
  var token = instance.get_config('token');
2305
2312
 
2306
2313
  if (this._initializedTokens.indexOf(token) > -1) {
2307
- console.log('autocapture already initialized for token "' + token + '"');
2314
+ logger.log('autocapture already initialized for token "' + token + '"');
2308
2315
  return;
2309
2316
  }
2310
2317
 
@@ -2443,14 +2450,14 @@ var localStore = {
2443
2450
  }
2444
2451
 
2445
2452
  if (!supported) {
2446
- console$1.error('localStorage unsupported; falling back to cookie store');
2453
+ logger.error('localStorage unsupported; falling back to cookie store');
2447
2454
  }
2448
2455
 
2449
2456
  _localStorage_supported = supported;
2450
2457
  return supported;
2451
2458
  },
2452
2459
  error: function error(msg) {
2453
- console$1.error('localStorage error: ' + msg);
2460
+ logger.error('localStorage error: ' + msg);
2454
2461
  },
2455
2462
  get: function get(name) {
2456
2463
  try {
@@ -2541,7 +2548,7 @@ var memoryStore = {
2541
2548
  return true;
2542
2549
  },
2543
2550
  error: function error(msg) {
2544
- console$1.error('memoryStorage error: ' + msg);
2551
+ logger.error('memoryStorage error: ' + msg);
2545
2552
  },
2546
2553
  parse: function parse(name) {
2547
2554
  return memoryStorage[name] || null;
@@ -2585,7 +2592,7 @@ var sessionStore = {
2585
2592
  },
2586
2593
  error: function error(msg) {
2587
2594
  if (Config.DEBUG) {
2588
- console$1.error('sessionStorage error: ', msg);
2595
+ logger.error('sessionStorage error: ', msg);
2589
2596
  }
2590
2597
  },
2591
2598
  get: function get(name) {
@@ -3445,7 +3452,7 @@ var PostHogPersistence = function PostHogPersistence(config) {
3445
3452
  var storage_type = config['persistence'];
3446
3453
 
3447
3454
  if (storage_type !== 'cookie' && storage_type.indexOf('localStorage') === -1 && storage_type !== 'memory') {
3448
- console$1.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3455
+ logger.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3449
3456
  storage_type = config['persistence'] = 'cookie';
3450
3457
  }
3451
3458
 
@@ -3833,7 +3840,7 @@ var SessionRecording = /*#__PURE__*/function () {
3833
3840
 
3834
3841
 
3835
3842
  if ((this.windowId !== windowId || this.sessionId !== sessionId) && [FULL_SNAPSHOT_EVENT_TYPE, META_EVENT_TYPE].indexOf(event.type) === -1) {
3836
- window.rrweb.record.takeFullSnapshot();
3843
+ this.rrwebRecord.takeFullSnapshot();
3837
3844
  }
3838
3845
 
3839
3846
  this.windowId = windowId;
@@ -3856,7 +3863,10 @@ var SessionRecording = /*#__PURE__*/function () {
3856
3863
  maskInputFn: null,
3857
3864
  slimDOMOptions: {},
3858
3865
  collectFonts: false
3859
- }; // only allows user to set our 'whitelisted' options
3866
+ }; // We switched from loading all of rrweb to just the record part, but
3867
+ // keep backwards compatibility if someone hasn't upgraded PostHog
3868
+
3869
+ this.rrwebRecord = window.rrweb ? window.rrweb.record : window.rrwebRecord; // only allows user to set our 'whitelisted' options
3860
3870
 
3861
3871
  var userSessionRecordingOptions = this.instance.get_config('session_recording');
3862
3872
 
@@ -3870,7 +3880,7 @@ var SessionRecording = /*#__PURE__*/function () {
3870
3880
  }
3871
3881
  }
3872
3882
 
3873
- this.stopRrweb = window.rrweb.record(_objectSpread2({
3883
+ this.stopRrweb = this.rrwebRecord(_objectSpread2({
3874
3884
  emit: function emit(event) {
3875
3885
  event = filterDataURLsFromLargeDataObjects(event);
3876
3886
 
@@ -3891,13 +3901,14 @@ var SessionRecording = /*#__PURE__*/function () {
3891
3901
  } else {
3892
3902
  _this2.snapshots.push(properties);
3893
3903
  }
3894
- }
3904
+ },
3905
+ plugins: window.rrwebConsoleRecord && this.instance.get_config('enable_recording_console_log') ? [window.rrwebConsoleRecord.getRecordConsolePlugin()] : []
3895
3906
  }, sessionRecordingOptions)); // :TRICKY: rrweb does not capture navigation within SPA-s, so hook into our $pageview events to get access to all events.
3896
3907
  // Dropping the initial event is fine (it's always captured by rrweb).
3897
3908
 
3898
3909
  this.instance._addCaptureHook(function (eventName) {
3899
3910
  if (eventName === '$pageview') {
3900
- window.rrweb.record.addCustomEvent('$pageview', {
3911
+ _this2.rrwebRecord.addCustomEvent('$pageview', {
3901
3912
  href: window.location.href
3902
3913
  });
3903
3914
  }
@@ -5236,7 +5247,7 @@ var xhr = function xhr(_ref) {
5236
5247
  try {
5237
5248
  response = JSON.parse(req.responseText);
5238
5249
  } catch (e) {
5239
- console$1.error(e);
5250
+ logger.error(e);
5240
5251
  return;
5241
5252
  }
5242
5253
 
@@ -5721,6 +5732,7 @@ var defaultConfig = function defaultConfig() {
5721
5732
  disable_session_recording: false,
5722
5733
  disable_persistence: false,
5723
5734
  disable_cookie: false,
5735
+ enable_recording_console_log: false,
5724
5736
  secure_cookie: win.location.protocol === 'https:',
5725
5737
  ip: true,
5726
5738
  opt_out_capturing_by_default: false,
@@ -5753,7 +5765,7 @@ var defaultConfig = function defaultConfig() {
5753
5765
  advanced_disable_toolbar_metrics: false,
5754
5766
  on_xhr_error: function on_xhr_error(req) {
5755
5767
  var error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText;
5756
- console$1.error(error);
5768
+ console.error(error);
5757
5769
  },
5758
5770
  // Used for internal testing
5759
5771
  _onCapture: function _onCapture() {},
@@ -5785,7 +5797,7 @@ var create_mplib = function create_mplib(token, config, name) {
5785
5797
  instance = target;
5786
5798
  } else {
5787
5799
  if (target && !_.isArray(target)) {
5788
- console$1.error('You have already initialized ' + name);
5800
+ console.error('You have already initialized ' + name);
5789
5801
  return;
5790
5802
  }
5791
5803
 
@@ -5812,10 +5824,10 @@ var create_mplib = function create_mplib(token, config, name) {
5812
5824
 
5813
5825
  if (!autocapture.enabledForProject(instance.get_config('token'), num_buckets, num_enabled_buckets)) {
5814
5826
  instance['__autocapture_enabled'] = false;
5815
- console$1.log('Not in active bucket: disabling Automatic Event Collection.');
5827
+ logger.log('Not in active bucket: disabling Automatic Event Collection.');
5816
5828
  } else if (!autocapture.isBrowserSupported()) {
5817
5829
  instance['__autocapture_enabled'] = false;
5818
- console$1.log('Disabling Automatic Event Collection because this browser is not supported');
5830
+ logger.log('Disabling Automatic Event Collection because this browser is not supported');
5819
5831
  } else {
5820
5832
  autocapture.init(instance);
5821
5833
  }
@@ -5857,12 +5869,12 @@ var create_mplib = function create_mplib(token, config, name) {
5857
5869
 
5858
5870
  PostHogLib.prototype.init = function (token, config, name) {
5859
5871
  if (_.isUndefined(name)) {
5860
- console$1.error('You must name your new library: init(token, config, name)');
5872
+ console.error('You must name your new library: init(token, config, name)');
5861
5873
  return;
5862
5874
  }
5863
5875
 
5864
5876
  if (name === PRIMARY_INSTANCE_NAME) {
5865
- console$1.error('You must initialize the main posthog object right after you include the PostHog js snippet');
5877
+ console.error('You must initialize the main posthog object right after you include the PostHog js snippet');
5866
5878
  return;
5867
5879
  }
5868
5880
 
@@ -5929,7 +5941,7 @@ PostHogLib.prototype._loaded = function () {
5929
5941
  try {
5930
5942
  this.get_config('loaded')(this);
5931
5943
  } catch (err) {
5932
- console$1.error('`loaded` function failed', err);
5944
+ console.error('`loaded` function failed', err);
5933
5945
  }
5934
5946
 
5935
5947
  this._start_queue_if_opted_in(); // this happens after so a user can call identify in
@@ -6092,7 +6104,7 @@ PostHogLib.prototype._send_request = function (url, data, options, callback) {
6092
6104
  })));
6093
6105
  } catch (e) {
6094
6106
  if (this.get_config('debug')) {
6095
- console$1.error(e);
6107
+ console.error(e);
6096
6108
  }
6097
6109
  }
6098
6110
  } else if (USE_XHR) {
@@ -6109,7 +6121,7 @@ PostHogLib.prototype._send_request = function (url, data, options, callback) {
6109
6121
  onXHRError: this.get_config('on_xhr_error')
6110
6122
  });
6111
6123
  } catch (e) {
6112
- console$1.error(e);
6124
+ console.error(e);
6113
6125
  }
6114
6126
  } else {
6115
6127
  var script = document$1.createElement('script');
@@ -6235,7 +6247,7 @@ PostHogLib.prototype.capture = addOptOutCheckPostHogLib(function (event_name, pr
6235
6247
  }
6236
6248
 
6237
6249
  if (_.isUndefined(event_name) || typeof event_name !== 'string') {
6238
- console$1.error('No event name provided to posthog.capture');
6250
+ console.error('No event name provided to posthog.capture');
6239
6251
  return;
6240
6252
  }
6241
6253
 
@@ -6267,7 +6279,7 @@ PostHogLib.prototype.capture = addOptOutCheckPostHogLib(function (event_name, pr
6267
6279
  data = _.copyAndTruncateStrings(data, options._noTruncate ? null : this.get_config('properties_string_max_length'));
6268
6280
 
6269
6281
  if (this.get_config('debug')) {
6270
- console$1.log('PostHog.js send', data);
6282
+ logger.log('PostHog.js send', data);
6271
6283
  }
6272
6284
 
6273
6285
  var jsonData = JSON.stringify(data);
@@ -6301,7 +6313,8 @@ PostHogLib.prototype._invokeCaptureHooks = function (eventName, eventData) {
6301
6313
 
6302
6314
  PostHogLib.prototype._calculate_event_properties = function (event_name, event_properties, start_timestamp) {
6303
6315
  // set defaults
6304
- var properties = event_properties || {};
6316
+ var properties = _objectSpread2({}, event_properties);
6317
+
6305
6318
  properties['token'] = this.get_config('token');
6306
6319
 
6307
6320
  if (event_name === '$snapshot') {
@@ -6342,7 +6355,7 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
6342
6355
  delete properties[blacklisted_prop];
6343
6356
  });
6344
6357
  } else {
6345
- console$1.error('Invalid value for property_blacklist config: ' + property_blacklist);
6358
+ console.error('Invalid value for property_blacklist config: ' + property_blacklist);
6346
6359
  }
6347
6360
 
6348
6361
  var sanitize_properties = this.get_config('sanitize_properties');
@@ -6511,7 +6524,7 @@ PostHogLib.prototype.onFeatureFlags = function (callback) {
6511
6524
  PostHogLib.prototype.identify = function (new_distinct_id, userPropertiesToSet, userPropertiesToSetOnce) {
6512
6525
  //if the new_distinct_id has not been set ignore the identify event
6513
6526
  if (!new_distinct_id) {
6514
- console$1.error('Unique user id has not been set in posthog.identify');
6527
+ console.error('Unique user id has not been set in posthog.identify');
6515
6528
  return;
6516
6529
  }
6517
6530
 
@@ -6581,7 +6594,7 @@ PostHogLib.prototype.identify = function (new_distinct_id, userPropertiesToSet,
6581
6594
 
6582
6595
  PostHogLib.prototype.group = function (groupType, groupKey, groupPropertiesToSet) {
6583
6596
  if (!groupType || !groupKey) {
6584
- console$1.error('posthog.group requires a group type and group key');
6597
+ console.error('posthog.group requires a group type and group key');
6585
6598
  return;
6586
6599
  }
6587
6600
 
@@ -6675,7 +6688,7 @@ PostHogLib.prototype.alias = function (alias, original) {
6675
6688
  // posthog.people.identify() call made for this user. It is VERY BAD to make an alias with
6676
6689
  // this ID, as it will duplicate users.
6677
6690
  if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {
6678
- console$1.critical('Attempting to create alias for existing People user - aborting.');
6691
+ console.critical('Attempting to create alias for existing People user - aborting.');
6679
6692
  return -2;
6680
6693
  }
6681
6694
 
@@ -6696,7 +6709,7 @@ PostHogLib.prototype.alias = function (alias, original) {
6696
6709
  _this.identify(alias);
6697
6710
  });
6698
6711
  } else {
6699
- console$1.error('alias matches current distinct_id - skipping api call.');
6712
+ console.error('alias matches current distinct_id - skipping api call.');
6700
6713
  this.identify(alias);
6701
6714
  return -1;
6702
6715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.17.9",
3
+ "version": "1.18.0",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",
@@ -60,7 +60,7 @@
60
60
  "posthog-js": "link:.",
61
61
  "prettier": "^2.0.5",
62
62
  "rollup": "^2.18.2",
63
- "rrweb": "^1.0.6",
63
+ "rrweb": "^1.1.2",
64
64
  "sinon": "9.0.2",
65
65
  "testcafe": "^1.17.1",
66
66
  "testcafe-browser-provider-browserstack": "^1.13.2-alpha.1",