posthog-js 1.14.1 → 1.14.5

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,16 @@
1
+ ## 1.14.4 - 2021-10-14
2
+
3
+ - filter data urls out of large payloads (#317)
4
+
5
+ ## 1.14.3 - 2021-10-12
6
+
7
+ - Expand allowed input types to 'button', 'checkbox', 'submit', 'reset' (#315)
8
+
9
+ ## 1.14.2 - 2021-10-12
10
+
11
+ - dont mind me, just bumping versions (#316)
12
+ - fix: localStorage access denied error being thrown (#312)
13
+
1
14
  ## 1.14.1 - 2021-10-06
2
15
 
3
16
  - Reduce code paths that could encode post data as the string undefined (#300)
package/README.md CHANGED
@@ -98,3 +98,5 @@ We tend to follow the following steps:
98
98
  ## Questions?
99
99
 
100
100
  ### [Join our Slack community.](https://posthog.com/slack)
101
+
102
+
package/dist/array.js CHANGED
@@ -1,21 +1,21 @@
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.14.1",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:"^6.1.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:"^26.1.0",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.3",sinon:"9.0.2",testcafe:"^1.10.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/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0}};
4
+ module.exports={name:"posthog-js",version:"1.14.5",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:"^6.1.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:"^26.1.0",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.3",sinon:"9.0.2",testcafe:"^1.10.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}};
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
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){return e!==Object(e)?n?n(e):e:e[y]?void 0:(e[y]=!0,v.isArray(e)?(r=[],v.each(e,function(e){r.push(m(e,n))})):(r={},v.each(e,function(e,o){o!==y&&(r[o]=m(e,n))})),delete e[y],r);var r}exports.COPY_IN_PROGRESS_ATTRIBUTE=y,v.copyAndTruncateStrings=function(e,n){return m(e,function(e){return"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;
9
9
  },{"./config":"itQ5"}],"RYfg":[function(require,module,exports) {
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=c,exports.shouldCaptureElement=u,exports.isSensitiveElement=p,exports.shouldCaptureValue=l,exports.isAngularContentAttr=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 u(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 a=["a","button","form","input","select","textarea","label"];function c(e,t){if(!e||s(e,"html")||!o(e))return!1;for(var r=!1,n=[e],i=!0,c=e;c.parentNode&&!s(c,"body");)if(11!==c.parentNode.nodeType){if(!(i=c.parentNode))break;if(a.indexOf(i.tagName.toLowerCase())>-1)r=!0;else{var u=window.getComputedStyle(i);u&&"pointer"===u.getPropertyValue("cursor")&&(r=!0)}n.push(i),c=i}else n.push(c.parentNode.host),c=c.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&&(a.indexOf(l)>-1||"true"===e.getAttribute("contenteditable"))}}function u(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 a=t.name||t.id||"";if("string"==typeof a){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function p(e){return!!(s(e,"input")&&"button"!=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)}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=a;
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.isAngularContentAttr=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)}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
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.isAngularContentAttr)(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);
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.memoryStore=exports.localStore=exports.cookieStore=void 0;var r=require("./utils"),e=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,t={get:function(r){try{for(var e=r+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var n=t[o];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(c){}return null},parse:function(r){var e;try{e=JSON.parse(t.get(r))||{}}catch(o){}return e},set:function(r,t,o,n,c){try{var a="",u="",i="";if(n){var l=document.location.hostname.match(e),s=l?l[0]:"";a=s?"; domain=."+s:""}if(o){var p=new Date;p.setTime(p.getTime()+24*o*60*60*1e3),u="; expires="+p.toGMTString()}c&&(i="; secure");var m=r+"="+encodeURIComponent(t)+u+"; path=/"+a+i;return document.cookie=m,m}catch(f){return}},remove:function(r,e){try{t.set(r,"",-1,e)}catch(o){return}}};exports.cookieStore=t;var o=null,n={is_supported:function(){if(null!==o)return o;var e=!0;try{var t="__mplssupport__";n.set(t,"xyz"),"xyz"!==n.get(t)&&(e=!1),n.remove(t)}catch(c){e=!1}return e||r.console.error("localStorage unsupported; falling back to cookie store"),o=e,e},error:function(e){r.console.error("localStorage error: "+e)},get:function(r){try{return window.localStorage.getItem(r)}catch(e){n.error(e)}return null},parse:function(r){try{return JSON.parse(n.get(r))||{}}catch(e){}return null},set:function(r,e){try{window.localStorage.setItem(r,e)}catch(t){n.error(t)}},remove:function(r){try{window.localStorage.removeItem(r)}catch(e){n.error(e)}}};exports.localStore=n;var c={},a={is_supported:function(){return!0},error:function(e){r.console.error("memoryStorage error: "+e)},parse:function(r){return c[r]||null},set:function(r,e){c[r]=e},remove:function(r){delete c[r]}};exports.memoryStore=a;
16
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),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,c={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(c){}return null},parse:function(e){var r;try{r=JSON.parse(c.get(e))||{}}catch(t){}return r},set:function(e,r,t,o,c){try{var i="",a="",u="";if(o){var s=document.location.hostname.match(n),l=s?s[0]:"";i=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),a="; expires="+p.toGMTString()}c&&(u="; secure");var f=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; path=/"+i+u;return document.cookie=f,f}catch(d){return}},remove:function(e,r){try{c.set(e,"",-1,r)}catch(t){return}}};exports.cookieStore=c;var i=null,a={is_supported:function(){if(null!==i)return i;var r=!0;if(window)try{var t="__mplssupport__";a.set(t,"xyz"),'"xyz"'!==a.get(t)&&(r=!1),a.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){a.error(r)}return null},parse:function(e){try{return JSON.parse(a.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(t){a.error(t)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){a.error(r)}}};exports.localStore=a;var u=t(t({},a),{},{parse:function(r){try{var t={};try{(t=c.parse(r)||{}).distinct_id&&c.set(r,{distinct_id:t.distinct_id})}catch(n){}var o=e._.extend(t,JSON.parse(a.get(r)||"{}"));return a.set(r,o),o}catch(n){}return null},set:function(e,r){try{a.set(e,r),r.distinct_id&&c.set(e,{distinct_id:r.distinct_id})}catch(t){a.error(t)}},remove:function(e){try{window.localStorage.removeItem(e),c.remove(e)}catch(r){a.error(r)}}});exports.localPlusCookieStore=u;var s={},l={is_supported:function(){return!0},error:function(r){e.console.error("memoryStorage error: "+r)},parse:function(e){return s[e]||null},set:function(e,r){s[e]=r},remove:function(e){delete s[e]}};exports.memoryStore=l;
17
17
  },{"./utils":"FOZT"}],"rxSh":[function(require,module,exports) {
18
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optIn=n,exports.optOut=r,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 n(t,e){d(!0,t,e)}function r(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: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,n=o.navigator||{},r=!1;return t._.each([n.doNotTrack,n.msDoNotTrack,o.doNotTrack],function(e){t._.includes([!0,1,"1","yes"],e)&&(r=!0)}),r}return!1}function d(e,o,n){t._.isString(o)&&o.length?(a(n=n||{}).set(l(o,n),e?1:0,t._.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties,{send_immediately:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function h(t,e,o){return function(){var n=!1;try{var r=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");r&&(n=c(r,{respectDnt:i,persistenceType:u,persistencePrefix:s,window:p}))}catch(l){o||console.error("Unexpected error when checking capturing opt-out status: "+l)}if(!n)return t.apply(this,arguments);var a=arguments[arguments.length-1];"function"==typeof a&&a(0)}}
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) {
20
20
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.apiActions=exports.SET_ACTION=void 0;var t=require("./utils"),e="$set";exports.SET_ACTION=e;var r="$set_once",i="$increment",n={set_action:function(t,r){return this.apiActionParser(e,t,r)},set_once_action:function(t,e){return this.apiActionParser(r,t,e)},increment_action:function(t,e){return this.apiActionParser(i,t,e)},apiActionParser:function(e,r,i){var n={},s={};return t._.isObject(r)?t._.each(r,function(t,e){this._is_reserved_property(e)||(s[e]=t)},this):s[r]=i,n[e]=s,n}};exports.apiActions=n;
21
21
  },{"./utils":"FOZT"}],"ecEG":[function(require,module,exports) {
@@ -23,15 +23,17 @@ module.exports={name:"posthog-js",version:"1.14.1",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 n=function(e,t){var a=e.featureFlags;if(a)if(Array.isArray(a)){var r={};if(a)for(var n=0;n<a.length;n++)r[a[n]]=!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=n;var i=function(){function a(e){t(this,a),this.instance=e,this._override_warning=!1,this.flagCallReported={},this.featureFlagEventHandlers=[]}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),n=Object.keys(a),i=0;i<n.length;i++)!1===a[n[i]]?delete r[n[i]]:r[n[i]]=a[n[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(){var t=this,a=this.instance.get_config("token"),r=JSON.stringify({token:a,distinct_id:this.instance.get_distinct_id()}),i=e._.base64Encode(r);this.instance._send_request(this.instance.get_config("api_host")+"/decide/?v=2",{data:i},{method:"POST"},this.instance._prepare_callback(function(e){n(e,t.instance.persistence),t.receivedFeatureFlags()}))}},{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(){var e=this.getFlags(),t=this.getFlagVariants();this.featureFlagEventHandlers.forEach(function(a){return a(e,t)})}},{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})}}]),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=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 i="__mpso";exports.SET_ONCE_QUEUE_KEY=i;var o="__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 f="__timers";exports.EVENT_TIMERS_KEY=f;var d="$session_recording_enabled";exports.SESSION_RECORDING_ENABLED=d;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",y=[s,i,o,p,n,_,a,c,h,u,f,d,m,l],E=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 i=r.persistence;"cookie"!==i&&"localStorage"!==i&&"memory"!==i&&(e.console.critical("Unknown persistence type "+i+"; falling back to cookie"),i=r.persistence="cookie"),"localStorage"===i&&t.localStore.is_supported()?this.storage=t.localStore:this.storage="memory"===i?t.memoryStore:t.cookieStore,this.load(),this.update_config(r),this.save()};exports.PostHogPersistence=E,E.prototype.properties=function(){var t={};return e._.each(this.props,function(s,i){if(i===l&&"object"===r(s))for(var o=Object.keys(s),p=0;p<o.length;p++)t["$feature/".concat(o[p])]=s[o[p]];else e._.include(y,i)||(t[i]=s)}),t},E.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},E.prototype.save=function(){this.disabled||this.storage.set(this.name,JSON.stringify(this.props),this.expire_days,this.cross_subdomain,this.secure)},E.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},E.prototype.clear=function(){this.remove(),this.props={}},E.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)},E.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)},E.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},E.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},E.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},E.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"})},E.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},E.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},E.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)},E.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},E.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},E.prototype.get_cross_subdomain=function(){return this.cross_subdomain},E.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},E.prototype.set_event_timer=function(e,t){var r=this.props[f]||{};r[e]=t,this.props[f]=r,this.save()},E.prototype.remove_event_timer=function(t){var r=(this.props[f]||{})[t];return e._.isUndefined(r)||(delete this.props[f][t],this.save()),r};
26
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SESSION_ID=exports.SESSION_RECORDING_ENABLED=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",a="__mpr",_="__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 f="__timers";exports.EVENT_TIMERS_KEY=f;var d="$session_recording_enabled";exports.SESSION_RECORDING_ENABLED=d;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",y=[s,o,i,p,n,a,_,c,h,u,f,d,m,l],E=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=E,E.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(y,o)||(t[o]=s)}),t},E.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},E.prototype.save=function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)},E.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},E.prototype.clear=function(){this.remove(),this.props={}},E.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)},E.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)},E.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},E.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},E.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},E.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"})},E.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},E.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},E.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)},E.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},E.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},E.prototype.get_cross_subdomain=function(){return this.cross_subdomain},E.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},E.prototype.set_event_timer=function(e,t){var r=this.props[f]||{};r[e]=t,this.props[f]=r,this.save()},E.prototype.remove_event_timer=function(t){var r=(this.props[f]||{})[t];return e._.isUndefined(r)||(delete this.props[f][t],this.save()),r};
27
27
  },{"./utils":"FOZT","./storage":"KZ7Y"}],"vjIe":[function(require,module,exports) {
28
28
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var r=require("../posthog-persistence"),e=require("../utils");function t(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function n(r,e){return l(r)||u(r,e)||i(r,e)||o()}function o(){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 i(r,e){if(r){if("string"==typeof r)return a(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function u(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],n=!0,o=!1,i=void 0;try{for(var a,u=r[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!e||t.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return t}}function l(r){if(Array.isArray(r))return r}var c=18e5,f=function(o,i){var a=n(o.props[r.SESSION_ID]||[0,null],2),u=a[0],l=a[1];return Math.abs(i-u)>c&&(l=e._.UUID()),o.register(t({},r.SESSION_ID,[i,l])),l};exports.default=f;
29
- },{"../posthog-persistence":"MAdm","../utils":"FOZT"}],"Z2N4":[function(require,module,exports) {
30
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=void 0;var t=require("../autocapture-utils"),e=require("../utils"),r=require("../posthog-persistence"),n=s(require("./sessionid")),i=s(require("../config"));function s(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function c(t,e){return f(t)||d(t,e)||p(t,e)||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 p(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(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 d(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,i=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,s=c}finally{try{n||null==a.return||a.return()}finally{if(i)throw s}}return r}}function f(t){if(Array.isArray(t))return t}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function y(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),t}var _="/e/",v=function(){function s(t){b(this,s),this.instance=t,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=_,this.stopRrweb=null}return y(s,[{key:"startRecordingIfEnabled",value:function(){this.instance.get_property(r.SESSION_RECORDING_ENABLED)&&!this.instance.get_config("disable_session_recording")&&this._startCapture()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"afterDecideResponse",value:function(t){var e=!this.instance.get_config("disable_session_recording")&&!!t.sessionRecording;this.instance.persistence&&this.instance.persistence.register(h({},r.SESSION_RECORDING_ENABLED,e)),e&&(t.sessionRecording.endpoint&&(this.endpoint=t.sessionRecording.endpoint),this.submitRecordings())}},{key:"submitRecordings",value:function(){var t=this;this.emit=!0,this._startCapture(),this.snapshots.forEach(function(e){return t._captureSnapshot(e)})}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,t.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+i.default.LIB_VERSION,e._.bind(this._onScriptLoaded,this))))}},{key:"_onScriptLoaded",value:function(){for(var t=this,e={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},r=this.instance.get_config("session_recording"),i=0,s=Object.entries(r||{});i<s.length;i++){var o=c(s[i],2),u=o[0],p=o[1];u in e&&(e[u]=p)}this.stopRrweb=window.rrweb.record(a({emit:function(e){var r={$snapshot_data:e,$session_id:(0,n.default)(t.instance.persistence,e.timestamp)};t.instance._captureMetrics.incr("rrweb-record"),t.instance._captureMetrics.incr("rrweb-record-".concat(e.type)),t.emit?t._captureSnapshot(r):t.snapshots.push(r)}},e)),this.instance._addCaptureHook(function(t){"$pageview"===t&&window.rrweb.record.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(t){this.instance.capture("$snapshot",t,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:2===t.$snapshot_data.type}})}}]),s}();exports.SessionRecording=v;
31
- },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","./sessionid":"vjIe","../config":"itQ5"}],"auG7":[function(require,module,exports) {
29
+ },{"../posthog-persistence":"MAdm","../utils":"FOZT"}],"vmk3":[function(require,module,exports) {
30
+ "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>19e6){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;
31
+ },{}],"Z2N4":[function(require,module,exports) {
32
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=void 0;var e=require("../autocapture-utils"),t=require("../utils"),r=require("../posthog-persistence"),n=o(require("./sessionid")),i=o(require("../config")),s=require("./sessionrecording-utils");function o(e){return e&&e.__esModule?e:{default:e}}function a(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 c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){b(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t){return h(e)||f(e,t)||l(e,t)||p()}function p(){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 l(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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 f(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(c){i=!0,s=c}finally{try{n||null==a.return||a.return()}finally{if(i)throw s}}return r}}function h(e){if(Array.isArray(e))return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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 _(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),e}var v="/e/",O=function(){function o(e){g(this,o),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=v,this.stopRrweb=null}return _(o,[{key:"startRecordingIfEnabled",value:function(){this.instance.get_property(r.SESSION_RECORDING_ENABLED)&&!this.instance.get_config("disable_session_recording")&&this._startCapture()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"afterDecideResponse",value:function(e){var t=!this.instance.get_config("disable_session_recording")&&!!e.sessionRecording;this.instance.persistence&&this.instance.persistence.register(b({},r.SESSION_RECORDING_ENABLED,t)),t&&(e.sessionRecording.endpoint&&(this.endpoint=e.sessionRecording.endpoint),this.submitRecordings())}},{key:"submitRecordings",value:function(){var e=this;this.emit=!0,this._startCapture(),this.snapshots.forEach(function(t){return e._captureSnapshot(t)})}},{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="+i.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{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},r=this.instance.get_config("session_recording"),i=0,o=Object.entries(r||{});i<o.length;i++){var a=u(o[i],2),p=a[0],l=a[1];p in t&&(t[p]=l)}this.stopRrweb=window.rrweb.record(c({emit:function(t){var r={$snapshot_data:t=(0,s.filterDataURLsFromLargeDataObjects)(t),$session_id:(0,n.default)(e.instance.persistence,t.timestamp)};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(r):e.snapshots.push(r)}},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:2===e.$snapshot_data.type}})}}]),o}();exports.SessionRecording=O;
33
+ },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","./sessionid":"vjIe","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
32
34
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils"),n=require("./posthog-featureflags");function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 i(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function o(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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}var u=function(){function i(e){s(this,i),this.instance=e}return c(i,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var i=this;if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){i.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),(0,n.parseFeatureFlagDecideResponse)(t,this.instance.persistence),t.supportedCompression){var o,s={},a=r(t.supportedCompression);try{for(a.s();!(o=a.n()).done;){s[o.value]=!0}}catch(c){a.e(c)}finally{a.f()}this.instance.compression=s}else this.instance.compression={}}}]),i}();exports.Decide=u;
33
35
  },{"./autocapture":"gR3r","./utils":"FOZT","./posthog-featureflags":"aVqC"}],"ZEpJ":[function(require,module,exports) {
34
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Toolbar=void 0;var e=require("../autocapture-utils"),t=require("../utils");function o(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 r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),e}var c=function(){function o(e){i(this,o),this.instance=e}return s(o,[{key:"afterDecideResponse",value:function(e){var t=e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&(this._loadEditor(r(r({},t),{},{apiURL:this.instance.get_config("api_host")})),this.instance.set_config({debug:!0}))}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.localStorage,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{var n,i=t._.getHashParam(e.hash,"__posthog")||t._.getHashParam(e.hash,"state"),a=i?JSON.parse(decodeURIComponent(i)):null;return a&&("mpeditor"===a.action||"ph_authorize"===a.action)?(n=a)&&Object.keys(n).length>0&&(o.setItem("_postHogEditorParams",JSON.stringify(n)),a.desiredHash?e.hash=a.desiredHash:r?r.replaceState("",document.title,e.pathname+e.search):e.hash=""):delete(n=JSON.parse(o.getItem("_postHogEditorParams")||"{}")).userIntent,n.apiURL=this.instance.get_config("api_host"),!(!n.token||this.instance.get_config("token")!==n.token)&&(this._loadEditor(n),!0)}catch(s){return!1}}},{key:"_loadEditor",value:function(o){var r=this;if(!window._postHogToolbarLoaded){window._postHogToolbarLoaded=!0;var n=o.jsURL||o.apiURL||this.instance.get_config("api_host"),i=n+(n.endsWith("/")?"":"/")+"static/toolbar.js?_ts="+(new Date).getTime();return(0,e.loadScript)(i,function(){window.ph_load_editor(o)}),t._.register_event(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,r._loadEditor(o)}),!0}return!1}}]),o}();exports.Toolbar=c;
36
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Toolbar=void 0;var e=require("../autocapture-utils"),t=require("../utils");function o(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 r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),e}var c=function(){function o(e){i(this,o),this.instance=e}return s(o,[{key:"afterDecideResponse",value:function(e){var t=e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&(this._loadEditor(r(r({},t),{},{apiURL:this.instance.get_config("api_host")})),this.instance.set_config({debug:!0}))}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,o=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!o){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(s){return!1}o=window.localStorage}var n,i=t._.getHashParam(e.hash,"__posthog")||t._.getHashParam(e.hash,"state"),a=i?JSON.parse(decodeURIComponent(i)):null;return a&&("mpeditor"===a.action||"ph_authorize"===a.action)?(n=a)&&Object.keys(n).length>0&&(o.setItem("_postHogEditorParams",JSON.stringify(n)),a.desiredHash?e.hash=a.desiredHash:r?r.replaceState("",document.title,e.pathname+e.search):e.hash=""):delete(n=JSON.parse(o.getItem("_postHogEditorParams")||"{}")).userIntent,n.apiURL=this.instance.get_config("api_host"),!(!n.token||this.instance.get_config("token")!==n.token)&&(this._loadEditor(n),!0)}catch(c){return!1}}},{key:"_loadEditor",value:function(o){var r=this;if(!window._postHogToolbarLoaded){window._postHogToolbarLoaded=!0;var n=o.jsURL||o.apiURL||this.instance.get_config("api_host"),i=n+(n.endsWith("/")?"":"/")+"static/toolbar.js?_ts="+(new Date).getTime();return(0,e.loadScript)(i,function(){window.ph_load_editor(o)}),t._.register_event(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,r._loadEditor(o)}),!0}return!1}}]),o}();exports.Toolbar=c;
35
37
  },{"../autocapture-utils":"RYfg","../utils":"FOZT"}],"ae0g":[function(require,module,exports) {
36
38
  "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 n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function n(e,n,u){return n&&t(e.prototype,n),u&&t(e,u),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestQueueScaffold=void 0;var u=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;e(this,t),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=function(){},this._pollInterval=n}return n(t,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"enqueue",value:function(){}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),t}();exports.RequestQueueScaffold=u;
37
39
  },{}],"Je4H":[function(require,module,exports) {
package/dist/es.js CHANGED
@@ -863,7 +863,7 @@ var LZString = {
863
863
  }
864
864
  };
865
865
 
866
- var version = "1.14.1";
866
+ var version = "1.14.5";
867
867
 
868
868
  var Config = {
869
869
  DEBUG: false,
@@ -1965,7 +1965,9 @@ function shouldCaptureElement(el) {
1965
1965
  function isSensitiveElement(el) {
1966
1966
  // don't send data from inputs or similar elements since there will always be
1967
1967
  // a risk of clientside javascript placing sensitive data in attributes
1968
- if (isTag(el, 'input') && el.type != 'button' || isTag(el, 'select') || isTag(el, 'textarea') || el.getAttribute('contenteditable') === 'true') {
1968
+ var allowedInputTypes = ['button', 'checkbox', 'submit', 'reset'];
1969
+
1970
+ if (isTag(el, 'input') && !allowedInputTypes.includes(el.type) || isTag(el, 'select') || isTag(el, 'textarea') || el.getAttribute('contenteditable') === 'true') {
1969
1971
  return true;
1970
1972
  }
1971
1973
 
@@ -2383,7 +2385,7 @@ var cookieStore = {
2383
2385
  secure = '; secure';
2384
2386
  }
2385
2387
 
2386
- var new_cookie_val = name + '=' + encodeURIComponent(value) + expires + '; path=/' + cdomain + secure;
2388
+ var new_cookie_val = name + '=' + encodeURIComponent(JSON.stringify(value)) + expires + '; path=/' + cdomain + secure;
2387
2389
  document.cookie = new_cookie_val;
2388
2390
  return new_cookie_val;
2389
2391
  } catch (err) {
@@ -2407,17 +2409,21 @@ var localStore = {
2407
2409
 
2408
2410
  var supported = true;
2409
2411
 
2410
- try {
2411
- var key = '__mplssupport__',
2412
- val = 'xyz';
2413
- localStore.set(key, val);
2412
+ if (window) {
2413
+ try {
2414
+ var key = '__mplssupport__',
2415
+ val = 'xyz';
2416
+ localStore.set(key, val);
2417
+
2418
+ if (localStore.get(key) !== '"xyz"') {
2419
+ supported = false;
2420
+ }
2414
2421
 
2415
- if (localStore.get(key) !== val) {
2422
+ localStore.remove(key);
2423
+ } catch (err) {
2416
2424
  supported = false;
2417
2425
  }
2418
-
2419
- localStore.remove(key);
2420
- } catch (err) {
2426
+ } else {
2421
2427
  supported = false;
2422
2428
  }
2423
2429
 
@@ -2450,7 +2456,7 @@ var localStore = {
2450
2456
  },
2451
2457
  set: function set(name, value) {
2452
2458
  try {
2453
- window.localStorage.setItem(name, value);
2459
+ window.localStorage.setItem(name, JSON.stringify(value));
2454
2460
  } catch (err) {
2455
2461
  localStore.error(err);
2456
2462
  }
@@ -2462,7 +2468,57 @@ var localStore = {
2462
2468
  localStore.error(err);
2463
2469
  }
2464
2470
  }
2465
- };
2471
+ }; // Use localstorage for most data but still use cookie for distinct_id
2472
+ // This solves issues with cookies having too much data in them causing headers too large
2473
+ // Also makes sure we don't have to send a ton of data to the server
2474
+
2475
+ var localPlusCookieStore = _objectSpread2(_objectSpread2({}, localStore), {}, {
2476
+ parse: function parse(name) {
2477
+ try {
2478
+ var extend = {};
2479
+
2480
+ try {
2481
+ // See if there's a cookie stored with data.
2482
+ extend = cookieStore.parse(name) || {};
2483
+
2484
+ if (extend['distinct_id']) {
2485
+ cookieStore.set(name, {
2486
+ distinct_id: extend['distinct_id']
2487
+ });
2488
+ }
2489
+ } catch (err) {}
2490
+
2491
+ var value = _.extend(extend, JSON.parse(localStore.get(name) || '{}'));
2492
+
2493
+ localStore.set(name, value);
2494
+ return value;
2495
+ } catch (err) {// noop
2496
+ }
2497
+
2498
+ return null;
2499
+ },
2500
+ set: function set(name, value) {
2501
+ try {
2502
+ localStore.set(name, value);
2503
+
2504
+ if (value.distinct_id) {
2505
+ cookieStore.set(name, {
2506
+ distinct_id: value.distinct_id
2507
+ });
2508
+ }
2509
+ } catch (err) {
2510
+ localStore.error(err);
2511
+ }
2512
+ },
2513
+ remove: function remove(name) {
2514
+ try {
2515
+ window.localStorage.removeItem(name);
2516
+ cookieStore.remove(name);
2517
+ } catch (err) {
2518
+ localStore.error(err);
2519
+ }
2520
+ }
2521
+ });
2466
2522
  var memoryStorage = {}; // Storage that only lasts the length of the pageview if we don't want to use cookies
2467
2523
 
2468
2524
  var memoryStore = {
@@ -2625,7 +2681,16 @@ function clearOptInOut(token, options) {
2625
2681
 
2626
2682
  function _getStorage(options) {
2627
2683
  options = options || {};
2628
- return options.persistenceType === 'localStorage' ? localStore : cookieStore;
2684
+
2685
+ if (options.persistenceType === 'localStorage') {
2686
+ return localStore;
2687
+ }
2688
+
2689
+ if (options.persistenceType === 'localStorage+cookie') {
2690
+ return localPlusCookieStore;
2691
+ }
2692
+
2693
+ return cookieStore;
2629
2694
  }
2630
2695
  /**
2631
2696
  * Get the name of the cookie that is used for the given opt type (capturing, cookie, etc.)
@@ -3261,13 +3326,15 @@ var PostHogPersistence = function PostHogPersistence(config) {
3261
3326
 
3262
3327
  var storage_type = config['persistence'];
3263
3328
 
3264
- if (storage_type !== 'cookie' && storage_type !== 'localStorage' && storage_type !== 'memory') {
3329
+ if (storage_type !== 'cookie' && storage_type.indexOf('localStorage') === -1 && storage_type !== 'memory') {
3265
3330
  console$1.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3266
3331
  storage_type = config['persistence'] = 'cookie';
3267
3332
  }
3268
3333
 
3269
3334
  if (storage_type === 'localStorage' && localStore.is_supported()) {
3270
3335
  this.storage = localStore;
3336
+ } else if (storage_type === 'localStorage+cookie' && localPlusCookieStore.is_supported()) {
3337
+ this.storage = localPlusCookieStore;
3271
3338
  } else if (storage_type === 'memory') {
3272
3339
  this.storage = memoryStore;
3273
3340
  } else {
@@ -3314,7 +3381,7 @@ PostHogPersistence.prototype.save = function () {
3314
3381
  return;
3315
3382
  }
3316
3383
 
3317
- this.storage.set(this.name, JSON.stringify(this['props']), this.expire_days, this.cross_subdomain, this.secure);
3384
+ this.storage.set(this.name, this['props'], this.expire_days, this.cross_subdomain, this.secure);
3318
3385
  };
3319
3386
 
3320
3387
  PostHogPersistence.prototype.remove = function () {
@@ -3500,6 +3567,56 @@ var sessionIdGenerator = (function (persistence, timestamp) {
3500
3567
  return sessionId;
3501
3568
  });
3502
3569
 
3570
+ var replacementImageURI = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==';
3571
+ /*
3572
+ * Check whether a data payload is nearing the 20mb limit (Posthog's data upload limit). If it is, it checks the data for
3573
+ * data URIs (the likely culprit for large payloads). If it finds data URIs, it either replaces
3574
+ * it with a generic image (if it's an image) or removes it.
3575
+ * @data {object} the rr-web data object
3576
+ * @returns {object} the rr-web data object with data uris filtered out
3577
+ */
3578
+
3579
+ function filterDataURLsFromLargeDataObjects(data) {
3580
+ if (data && _typeof(data) === 'object') {
3581
+ var stringifiedData = JSON.stringify(data); // String length of 19000000 is an approximation of 20mb
3582
+ // Note: with compression, this limit may be able to be increased
3583
+ // but we're assuming most of the size is from a data uri which
3584
+ // is unlikely to be compressed further
3585
+
3586
+ if (stringifiedData.length > 19000000) {
3587
+ // Regex that matches the pattern for a dataURI with the shape 'data:{mime type};{encoding},{data}'. It:
3588
+ // 1) Checks if the pattern starts with 'data:' (potentially, not at the start of the string)
3589
+ // 2) Extracts the mime type of the data uri in the first group
3590
+ // 3) Determines when the data URI ends.Depending on if it's used in the src tag or css, it can end with a ) or "
3591
+ var dataURIRegex = /data:([\w\/\-\.]+);(\w+),([^)"]*)/gim;
3592
+ var matches = stringifiedData.matchAll(dataURIRegex);
3593
+
3594
+ var _iterator = _createForOfIteratorHelper(matches),
3595
+ _step;
3596
+
3597
+ try {
3598
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3599
+ var match = _step.value;
3600
+
3601
+ if (match[1].toLocaleLowerCase().slice(0, 6) === 'image/') {
3602
+ stringifiedData = stringifiedData.replace(match[0], replacementImageURI);
3603
+ } else {
3604
+ stringifiedData = stringifiedData.replace(match[0], '');
3605
+ }
3606
+ }
3607
+ } catch (err) {
3608
+ _iterator.e(err);
3609
+ } finally {
3610
+ _iterator.f();
3611
+ }
3612
+ }
3613
+
3614
+ return JSON.parse(stringifiedData);
3615
+ }
3616
+
3617
+ return data;
3618
+ }
3619
+
3503
3620
  var BASE_ENDPOINT = '/e/';
3504
3621
  var SessionRecording = /*#__PURE__*/function () {
3505
3622
  function SessionRecording(instance) {
@@ -3616,6 +3733,7 @@ var SessionRecording = /*#__PURE__*/function () {
3616
3733
 
3617
3734
  this.stopRrweb = window.rrweb.record(_objectSpread2({
3618
3735
  emit: function emit(data) {
3736
+ data = filterDataURLsFromLargeDataObjects(data);
3619
3737
  var properties = {
3620
3738
  $snapshot_data: data,
3621
3739
  $session_id: sessionIdGenerator(_this2.instance.persistence, data.timestamp)
@@ -3772,10 +3890,23 @@ var Toolbar = /*#__PURE__*/function () {
3772
3890
  key: "maybeLoadEditor",
3773
3891
  value: function maybeLoadEditor() {
3774
3892
  var location = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location;
3775
- var localStorage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.localStorage;
3893
+ var localStorage = arguments.length > 1 ? arguments[1] : undefined;
3776
3894
  var history = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.history;
3777
3895
 
3778
3896
  try {
3897
+ // Before running the code we check if we can access localStorage, if not we opt-out
3898
+ if (!localStorage) {
3899
+ try {
3900
+ window.localStorage.setItem('test', 'test');
3901
+ window.localStorage.removeItem('test');
3902
+ } catch (error) {
3903
+ return false;
3904
+ } // If localStorage was undefined, and localStorage is supported we set the default value
3905
+
3906
+
3907
+ localStorage = window.localStorage;
3908
+ }
3909
+
3779
3910
  var stateHash = _.getHashParam(location.hash, '__posthog') || _.getHashParam(location.hash, 'state');
3780
3911
 
3781
3912
  var state = stateHash ? JSON.parse(decodeURIComponent(stateHash)) : null;
package/dist/module.js CHANGED
@@ -865,7 +865,7 @@ var LZString = {
865
865
  }
866
866
  };
867
867
 
868
- var version = "1.14.1";
868
+ var version = "1.14.5";
869
869
 
870
870
  var Config = {
871
871
  DEBUG: false,
@@ -1967,7 +1967,9 @@ function shouldCaptureElement(el) {
1967
1967
  function isSensitiveElement(el) {
1968
1968
  // don't send data from inputs or similar elements since there will always be
1969
1969
  // a risk of clientside javascript placing sensitive data in attributes
1970
- if (isTag(el, 'input') && el.type != 'button' || isTag(el, 'select') || isTag(el, 'textarea') || el.getAttribute('contenteditable') === 'true') {
1970
+ var allowedInputTypes = ['button', 'checkbox', 'submit', 'reset'];
1971
+
1972
+ if (isTag(el, 'input') && !allowedInputTypes.includes(el.type) || isTag(el, 'select') || isTag(el, 'textarea') || el.getAttribute('contenteditable') === 'true') {
1971
1973
  return true;
1972
1974
  }
1973
1975
 
@@ -2385,7 +2387,7 @@ var cookieStore = {
2385
2387
  secure = '; secure';
2386
2388
  }
2387
2389
 
2388
- var new_cookie_val = name + '=' + encodeURIComponent(value) + expires + '; path=/' + cdomain + secure;
2390
+ var new_cookie_val = name + '=' + encodeURIComponent(JSON.stringify(value)) + expires + '; path=/' + cdomain + secure;
2389
2391
  document.cookie = new_cookie_val;
2390
2392
  return new_cookie_val;
2391
2393
  } catch (err) {
@@ -2409,17 +2411,21 @@ var localStore = {
2409
2411
 
2410
2412
  var supported = true;
2411
2413
 
2412
- try {
2413
- var key = '__mplssupport__',
2414
- val = 'xyz';
2415
- localStore.set(key, val);
2414
+ if (window) {
2415
+ try {
2416
+ var key = '__mplssupport__',
2417
+ val = 'xyz';
2418
+ localStore.set(key, val);
2419
+
2420
+ if (localStore.get(key) !== '"xyz"') {
2421
+ supported = false;
2422
+ }
2416
2423
 
2417
- if (localStore.get(key) !== val) {
2424
+ localStore.remove(key);
2425
+ } catch (err) {
2418
2426
  supported = false;
2419
2427
  }
2420
-
2421
- localStore.remove(key);
2422
- } catch (err) {
2428
+ } else {
2423
2429
  supported = false;
2424
2430
  }
2425
2431
 
@@ -2452,7 +2458,7 @@ var localStore = {
2452
2458
  },
2453
2459
  set: function set(name, value) {
2454
2460
  try {
2455
- window.localStorage.setItem(name, value);
2461
+ window.localStorage.setItem(name, JSON.stringify(value));
2456
2462
  } catch (err) {
2457
2463
  localStore.error(err);
2458
2464
  }
@@ -2464,7 +2470,57 @@ var localStore = {
2464
2470
  localStore.error(err);
2465
2471
  }
2466
2472
  }
2467
- };
2473
+ }; // Use localstorage for most data but still use cookie for distinct_id
2474
+ // This solves issues with cookies having too much data in them causing headers too large
2475
+ // Also makes sure we don't have to send a ton of data to the server
2476
+
2477
+ var localPlusCookieStore = _objectSpread2(_objectSpread2({}, localStore), {}, {
2478
+ parse: function parse(name) {
2479
+ try {
2480
+ var extend = {};
2481
+
2482
+ try {
2483
+ // See if there's a cookie stored with data.
2484
+ extend = cookieStore.parse(name) || {};
2485
+
2486
+ if (extend['distinct_id']) {
2487
+ cookieStore.set(name, {
2488
+ distinct_id: extend['distinct_id']
2489
+ });
2490
+ }
2491
+ } catch (err) {}
2492
+
2493
+ var value = _.extend(extend, JSON.parse(localStore.get(name) || '{}'));
2494
+
2495
+ localStore.set(name, value);
2496
+ return value;
2497
+ } catch (err) {// noop
2498
+ }
2499
+
2500
+ return null;
2501
+ },
2502
+ set: function set(name, value) {
2503
+ try {
2504
+ localStore.set(name, value);
2505
+
2506
+ if (value.distinct_id) {
2507
+ cookieStore.set(name, {
2508
+ distinct_id: value.distinct_id
2509
+ });
2510
+ }
2511
+ } catch (err) {
2512
+ localStore.error(err);
2513
+ }
2514
+ },
2515
+ remove: function remove(name) {
2516
+ try {
2517
+ window.localStorage.removeItem(name);
2518
+ cookieStore.remove(name);
2519
+ } catch (err) {
2520
+ localStore.error(err);
2521
+ }
2522
+ }
2523
+ });
2468
2524
  var memoryStorage = {}; // Storage that only lasts the length of the pageview if we don't want to use cookies
2469
2525
 
2470
2526
  var memoryStore = {
@@ -2627,7 +2683,16 @@ function clearOptInOut(token, options) {
2627
2683
 
2628
2684
  function _getStorage(options) {
2629
2685
  options = options || {};
2630
- return options.persistenceType === 'localStorage' ? localStore : cookieStore;
2686
+
2687
+ if (options.persistenceType === 'localStorage') {
2688
+ return localStore;
2689
+ }
2690
+
2691
+ if (options.persistenceType === 'localStorage+cookie') {
2692
+ return localPlusCookieStore;
2693
+ }
2694
+
2695
+ return cookieStore;
2631
2696
  }
2632
2697
  /**
2633
2698
  * Get the name of the cookie that is used for the given opt type (capturing, cookie, etc.)
@@ -3263,13 +3328,15 @@ var PostHogPersistence = function PostHogPersistence(config) {
3263
3328
 
3264
3329
  var storage_type = config['persistence'];
3265
3330
 
3266
- if (storage_type !== 'cookie' && storage_type !== 'localStorage' && storage_type !== 'memory') {
3331
+ if (storage_type !== 'cookie' && storage_type.indexOf('localStorage') === -1 && storage_type !== 'memory') {
3267
3332
  console$1.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
3268
3333
  storage_type = config['persistence'] = 'cookie';
3269
3334
  }
3270
3335
 
3271
3336
  if (storage_type === 'localStorage' && localStore.is_supported()) {
3272
3337
  this.storage = localStore;
3338
+ } else if (storage_type === 'localStorage+cookie' && localPlusCookieStore.is_supported()) {
3339
+ this.storage = localPlusCookieStore;
3273
3340
  } else if (storage_type === 'memory') {
3274
3341
  this.storage = memoryStore;
3275
3342
  } else {
@@ -3316,7 +3383,7 @@ PostHogPersistence.prototype.save = function () {
3316
3383
  return;
3317
3384
  }
3318
3385
 
3319
- this.storage.set(this.name, JSON.stringify(this['props']), this.expire_days, this.cross_subdomain, this.secure);
3386
+ this.storage.set(this.name, this['props'], this.expire_days, this.cross_subdomain, this.secure);
3320
3387
  };
3321
3388
 
3322
3389
  PostHogPersistence.prototype.remove = function () {
@@ -3502,6 +3569,56 @@ var sessionIdGenerator = (function (persistence, timestamp) {
3502
3569
  return sessionId;
3503
3570
  });
3504
3571
 
3572
+ var replacementImageURI = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==';
3573
+ /*
3574
+ * Check whether a data payload is nearing the 20mb limit (Posthog's data upload limit). If it is, it checks the data for
3575
+ * data URIs (the likely culprit for large payloads). If it finds data URIs, it either replaces
3576
+ * it with a generic image (if it's an image) or removes it.
3577
+ * @data {object} the rr-web data object
3578
+ * @returns {object} the rr-web data object with data uris filtered out
3579
+ */
3580
+
3581
+ function filterDataURLsFromLargeDataObjects(data) {
3582
+ if (data && _typeof(data) === 'object') {
3583
+ var stringifiedData = JSON.stringify(data); // String length of 19000000 is an approximation of 20mb
3584
+ // Note: with compression, this limit may be able to be increased
3585
+ // but we're assuming most of the size is from a data uri which
3586
+ // is unlikely to be compressed further
3587
+
3588
+ if (stringifiedData.length > 19000000) {
3589
+ // Regex that matches the pattern for a dataURI with the shape 'data:{mime type};{encoding},{data}'. It:
3590
+ // 1) Checks if the pattern starts with 'data:' (potentially, not at the start of the string)
3591
+ // 2) Extracts the mime type of the data uri in the first group
3592
+ // 3) Determines when the data URI ends.Depending on if it's used in the src tag or css, it can end with a ) or "
3593
+ var dataURIRegex = /data:([\w\/\-\.]+);(\w+),([^)"]*)/gim;
3594
+ var matches = stringifiedData.matchAll(dataURIRegex);
3595
+
3596
+ var _iterator = _createForOfIteratorHelper(matches),
3597
+ _step;
3598
+
3599
+ try {
3600
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3601
+ var match = _step.value;
3602
+
3603
+ if (match[1].toLocaleLowerCase().slice(0, 6) === 'image/') {
3604
+ stringifiedData = stringifiedData.replace(match[0], replacementImageURI);
3605
+ } else {
3606
+ stringifiedData = stringifiedData.replace(match[0], '');
3607
+ }
3608
+ }
3609
+ } catch (err) {
3610
+ _iterator.e(err);
3611
+ } finally {
3612
+ _iterator.f();
3613
+ }
3614
+ }
3615
+
3616
+ return JSON.parse(stringifiedData);
3617
+ }
3618
+
3619
+ return data;
3620
+ }
3621
+
3505
3622
  var BASE_ENDPOINT = '/e/';
3506
3623
  var SessionRecording = /*#__PURE__*/function () {
3507
3624
  function SessionRecording(instance) {
@@ -3618,6 +3735,7 @@ var SessionRecording = /*#__PURE__*/function () {
3618
3735
 
3619
3736
  this.stopRrweb = window.rrweb.record(_objectSpread2({
3620
3737
  emit: function emit(data) {
3738
+ data = filterDataURLsFromLargeDataObjects(data);
3621
3739
  var properties = {
3622
3740
  $snapshot_data: data,
3623
3741
  $session_id: sessionIdGenerator(_this2.instance.persistence, data.timestamp)
@@ -3774,10 +3892,23 @@ var Toolbar = /*#__PURE__*/function () {
3774
3892
  key: "maybeLoadEditor",
3775
3893
  value: function maybeLoadEditor() {
3776
3894
  var location = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location;
3777
- var localStorage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.localStorage;
3895
+ var localStorage = arguments.length > 1 ? arguments[1] : undefined;
3778
3896
  var history = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.history;
3779
3897
 
3780
3898
  try {
3899
+ // Before running the code we check if we can access localStorage, if not we opt-out
3900
+ if (!localStorage) {
3901
+ try {
3902
+ window.localStorage.setItem('test', 'test');
3903
+ window.localStorage.removeItem('test');
3904
+ } catch (error) {
3905
+ return false;
3906
+ } // If localStorage was undefined, and localStorage is supported we set the default value
3907
+
3908
+
3909
+ localStorage = window.localStorage;
3910
+ }
3911
+
3781
3912
  var stateHash = _.getHashParam(location.hash, '__posthog') || _.getHashParam(location.hash, 'state');
3782
3913
 
3783
3914
  var state = stateHash ? JSON.parse(decodeURIComponent(stateHash)) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.14.1",
3
+ "version": "1.14.5",
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",
@@ -82,7 +82,8 @@
82
82
  "testPathIgnorePatterns": [
83
83
  "/node_modules/",
84
84
  "/cypress/",
85
- "/react/"
85
+ "/react/",
86
+ "/test_data/"
86
87
  ],
87
88
  "moduleFileExtensions": [
88
89
  "js",