@amplitude/session-replay-browser 1.39.0 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.39.0";
1
+ export declare const VERSION = "1.40.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Autogenerated by `pnpm version-file`. DO NOT EDIT
5
- exports.VERSION = '1.39.0';
5
+ exports.VERSION = '1.40.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.39.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.40.0';\n"]}
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.trackDestinationScript = exports.compressionScript = void 0;
5
5
  exports.compressionScript = "var WebWorker=function(e){\"use strict\";onmessage=function(e){var s=\"string\"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
6
- exports.trackDestinationScript = "var WebWorker=function(e){\"use strict\";var t,n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))(function(s,o){function a(e){try{i(r.next(e))}catch(e){o(e)}}function c(e){try{i(r.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}i((r=r.apply(e,t||[])).next())})}function s(e,t){var n,r,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create((\"function\"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),\"function\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(n)throw new TypeError(\"Generator is already executing.\");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(s=2&c[0]?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(6===c[0]&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}\"function\"==typeof SuppressedError&&SuppressedError,function(e){e.US=\"US\",e.EU=\"EU\",e.STAGING=\"STAGING\"}(t||(t={})),t.US;var o;!function(e){e.GET_SR_PROPS=\"get-sr-props\",e.DEBUG_INFO=\"debug-info\",e.FETCH_REQUEST=\"fetch-request\",e.METADATA=\"metadata\",e.TARGETING_DECISION=\"targeting-decision\"}(o||(o={}));function a(e,t){return r(this,void 0,void 0,function(){var n,o,a,c,i,u,l,d,f,p,h,v,y,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),n=t.CompressionStream,o=new n(\"gzip\"),a=o.writable.getWriter(),c=o.readable.getReader(),i=[],u=r(g,void 0,void 0,function(){var e,t,n;return s(this,function(r){switch(r.label){case 0:return[4,c.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];i.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,u];case 3:m.sent(),l=i.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),f=0;try{for(p=function(e){var t=\"function\"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&\"number\"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(i),h=p.next();!h.done;h=p.next())v=h.value,d.set(v,f),f+=v.length}catch(e){y={error:e}}finally{try{h&&!h.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function c(e,t){return r(this,void 0,void 0,function(){var r,o,c,i,u,l,d,f,p,h,v,y,b;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),\"CompressionStream\"in self?[4,a(e,self)]:[3,2];case 1:return o=s.sent(),[3,3];case 2:o=null,s.label=3;case 3:return r=o,c=\"\".concat(null!==(v=null===(h=t.version)||void 0===h?void 0:h.type)&&void 0!==v?v:\"standalone\",\"/\").concat(null!==(b=null===(y=t.version)||void 0===y?void 0:y.version)&&void 0!==b?b:t.sdkVersion),i=new URLSearchParams({device_id:t.deviceId,session_id:\"\".concat(t.sessionId),type:t.eventType}),u=\"\".concat((g=t.serverZone,m=t.trackServerUrl,m||(\"STAGING\"===g?\"https://api-sr.stag2.amplitude.com/sessions/v2/track\":\"EU\"===g?\"https://api-sr.eu.amplitude.com/sessions/v2/track\":\"https://api-sr.amplitude.com/sessions/v2/track\")),\"?\").concat(i.toString()),l=n({\"Content-Type\":\"application/json\",Accept:\"*/*\",Authorization:\"Bearer \".concat(t.apiKey),\"X-Client-Version\":t.sdkVersion,\"X-Client-Library\":c,\"X-Client-Url\":t.currentUrl.substring(0,1e3),\"X-Client-Sample-Rate\":\"\".concat(t.sampleRate),\"X-Sampling-Hash-Alg\":\"xxhash32\"},r?{\"Content-Encoding\":\"gzip\"}:{}),[4,fetch(u,{method:\"POST\",headers:l,body:null!=r?r:e})];case 4:return null===(d=s.sent())?[2,{shouldRetry:!1,success:!1,message:\"Unexpected error occurred\"}]:d.status>=200&&d.status<300?(f=Math.round(new Blob(t.events).size/1024),[2,{shouldRetry:!1,success:!0,message:\"Session replay event batch tracked successfully for session id \".concat(t.sessionId,\", size of events: \").concat(f,\" KB\")}]):d.status>=500||408===d.status||429===d.status||499===d.status?[2,{shouldRetry:!0,success:!1,message:\"HTTP \".concat(d.status)}]:[2,{shouldRetry:!1,success:!1,message:\"Network error occurred, event batch rejected\"}];case 5:return p=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(p)}];case 6:return[2]}var g,m})})}function i(e,t,n,o){return r(this,void 0,void 0,function(){var r,a,i;return s(this,function(s){switch(s.label){case 0:r=1,s.label=1;case 1:return[4,c(t,n)];case 2:return(a=s.sent()).success?(postMessage({type:\"log\",id:e,message:a.message}),postMessage({type:\"complete\",id:e}),[2]):o&&a.shouldRetry&&r<n.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*r*1e3)})]:[3,4];case 3:return s.sent(),r++,[3,5];case 4:return i=r>=n.flushMaxRetries?\"Session replay event batch rejected due to exceeded retry count\":a.message,postMessage({type:\"warn\",id:e,message:i}),postMessage({type:\"complete\",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return r(void 0,void 0,void 0,function(){var t,n,r,o,a,c,u;return s(this,function(s){switch(s.label){case 0:return t=e.data,n=t.type,r=t.id,o=t.payload,a=t.context,c=t.useRetry,\"send\"!==n?[3,2]:(u=JSON.stringify(o),[4,i(r,u,a,c)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var u=onmessage;return e.trackDestinationOnMessage=u,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
6
+ exports.trackDestinationScript = "var WebWorker=function(e){\"use strict\";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,o){function a(e){try{i(n.next(e))}catch(e){o(e)}}function c(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,c)}i((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create((\"function\"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),\"function\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(r)throw new TypeError(\"Generator is already executing.\");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&c[0]?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(6===c[0]&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}\"function\"==typeof SuppressedError&&SuppressedError,function(e){e.US=\"US\",e.EU=\"EU\",e.STAGING=\"STAGING\"}(t||(t={})),t.US;var o;!function(e){e.GET_SR_PROPS=\"get-sr-props\",e.DEBUG_INFO=\"debug-info\",e.FETCH_REQUEST=\"fetch-request\",e.METADATA=\"metadata\",e.TARGETING_DECISION=\"targeting-decision\"}(o||(o={}));function a(e,t){return n(this,void 0,void 0,function(){var r,o,a,c,i,u,l,d,f,p,h,v,y,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,o=new r(\"gzip\"),a=o.writable.getWriter(),c=o.readable.getReader(),i=[],u=n(g,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,c.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];i.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,u];case 3:m.sent(),l=i.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),f=0;try{for(p=function(e){var t=\"function\"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&\"number\"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(i),h=p.next();!h.done;h=p.next())v=h.value,d.set(v,f),f+=v.length}catch(e){y={error:e}}finally{try{h&&!h.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function c(e,t){var o,c,i,u;return n(this,void 0,void 0,function(){var n,l,d,f,p,h,v,y,b;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),\"CompressionStream\"in self?[4,a(e,self)]:[3,2];case 1:return l=s.sent(),[3,3];case 2:l=null,s.label=3;case 3:return n=l,d=\"\".concat(null!==(c=null===(o=t.version)||void 0===o?void 0:o.type)&&void 0!==c?c:\"standalone\",\"/\").concat(null!==(u=null===(i=t.version)||void 0===i?void 0:i.version)&&void 0!==u?u:t.sdkVersion),f=new URLSearchParams({device_id:t.deviceId,session_id:\"\".concat(t.sessionId),type:t.eventType}),p=\"\".concat((g=t.serverZone,m=t.trackServerUrl,m||(\"STAGING\"===g?\"https://api-sr.stag2.amplitude.com/sessions/v2/track\":\"EU\"===g?\"https://api-sr.eu.amplitude.com/sessions/v2/track\":\"https://api-sr.amplitude.com/sessions/v2/track\")),\"?\").concat(f.toString()),h=r({\"Content-Type\":\"application/json\",Accept:\"*/*\",Authorization:\"Bearer \".concat(t.apiKey),\"X-Client-Version\":t.sdkVersion,\"X-Client-Library\":d,\"X-Client-Url\":t.currentUrl.substring(0,1e3),\"X-Client-Sample-Rate\":\"\".concat(t.sampleRate),\"X-Sampling-Hash-Alg\":\"xxhash32\"},n?{\"Content-Encoding\":\"gzip\"}:{}),[4,fetch(p,{method:\"POST\",headers:h,body:null!=n?n:e})];case 4:return null===(v=s.sent())?[2,{shouldRetry:!1,success:!1,message:\"Unexpected error occurred\"}]:v.status>=200&&v.status<300?(y=Math.round(new Blob(t.events).size/1024),[2,{shouldRetry:!1,success:!0,message:\"Session replay event batch tracked successfully for session id \".concat(t.sessionId,\", size of events: \").concat(y,\" KB\")}]):v.status>=500||408===v.status||429===v.status||499===v.status?[2,{shouldRetry:!0,success:!1,message:\"HTTP \".concat(v.status)}]:[2,{shouldRetry:!1,success:!1,message:\"Network error occurred, event batch rejected\"}];case 5:return b=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(b)}];case 6:return[2]}var g,m})})}function i(e,t,r,o){return n(this,void 0,void 0,function(){var n,a,i;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,c(t,r)];case 2:return(a=s.sent()).success?(postMessage({type:\"log\",id:e,message:a.message}),postMessage({type:\"complete\",id:e}),[2]):o&&a.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return i=n>=r.flushMaxRetries?\"Session replay event batch rejected due to exceeded retry count\":a.message,postMessage({type:\"warn\",id:e,message:i}),postMessage({type:\"complete\",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return n(void 0,void 0,void 0,function(){var t,r,n,o,a,c,u;return s(this,function(s){switch(s.label){case 0:return t=e.data,r=t.type,n=t.id,o=t.payload,a=t.context,c=t.useRetry,\"send\"!==r?[3,2]:(u=JSON.stringify(o),[4,i(n,u,a,c)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var u=onmessage;return e.trackDestinationOnMessage=u,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.39.0";
1
+ export declare const VERSION = "1.40.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Autogenerated by `pnpm version-file`. DO NOT EDIT
2
- export var VERSION = '1.39.0';
2
+ export var VERSION = '1.40.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.39.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.40.0';\n"]}
@@ -1,4 +1,4 @@
1
1
  var compressionScript = "var WebWorker=function(e){\"use strict\";onmessage=function(e){var s=\"string\"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
2
- var trackDestinationScript = "var WebWorker=function(e){\"use strict\";var t,n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))(function(s,o){function a(e){try{i(r.next(e))}catch(e){o(e)}}function c(e){try{i(r.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}i((r=r.apply(e,t||[])).next())})}function s(e,t){var n,r,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create((\"function\"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),\"function\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(n)throw new TypeError(\"Generator is already executing.\");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(s=2&c[0]?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(6===c[0]&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}\"function\"==typeof SuppressedError&&SuppressedError,function(e){e.US=\"US\",e.EU=\"EU\",e.STAGING=\"STAGING\"}(t||(t={})),t.US;var o;!function(e){e.GET_SR_PROPS=\"get-sr-props\",e.DEBUG_INFO=\"debug-info\",e.FETCH_REQUEST=\"fetch-request\",e.METADATA=\"metadata\",e.TARGETING_DECISION=\"targeting-decision\"}(o||(o={}));function a(e,t){return r(this,void 0,void 0,function(){var n,o,a,c,i,u,l,d,f,p,h,v,y,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),n=t.CompressionStream,o=new n(\"gzip\"),a=o.writable.getWriter(),c=o.readable.getReader(),i=[],u=r(g,void 0,void 0,function(){var e,t,n;return s(this,function(r){switch(r.label){case 0:return[4,c.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];i.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,u];case 3:m.sent(),l=i.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),f=0;try{for(p=function(e){var t=\"function\"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&\"number\"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(i),h=p.next();!h.done;h=p.next())v=h.value,d.set(v,f),f+=v.length}catch(e){y={error:e}}finally{try{h&&!h.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function c(e,t){return r(this,void 0,void 0,function(){var r,o,c,i,u,l,d,f,p,h,v,y,b;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),\"CompressionStream\"in self?[4,a(e,self)]:[3,2];case 1:return o=s.sent(),[3,3];case 2:o=null,s.label=3;case 3:return r=o,c=\"\".concat(null!==(v=null===(h=t.version)||void 0===h?void 0:h.type)&&void 0!==v?v:\"standalone\",\"/\").concat(null!==(b=null===(y=t.version)||void 0===y?void 0:y.version)&&void 0!==b?b:t.sdkVersion),i=new URLSearchParams({device_id:t.deviceId,session_id:\"\".concat(t.sessionId),type:t.eventType}),u=\"\".concat((g=t.serverZone,m=t.trackServerUrl,m||(\"STAGING\"===g?\"https://api-sr.stag2.amplitude.com/sessions/v2/track\":\"EU\"===g?\"https://api-sr.eu.amplitude.com/sessions/v2/track\":\"https://api-sr.amplitude.com/sessions/v2/track\")),\"?\").concat(i.toString()),l=n({\"Content-Type\":\"application/json\",Accept:\"*/*\",Authorization:\"Bearer \".concat(t.apiKey),\"X-Client-Version\":t.sdkVersion,\"X-Client-Library\":c,\"X-Client-Url\":t.currentUrl.substring(0,1e3),\"X-Client-Sample-Rate\":\"\".concat(t.sampleRate),\"X-Sampling-Hash-Alg\":\"xxhash32\"},r?{\"Content-Encoding\":\"gzip\"}:{}),[4,fetch(u,{method:\"POST\",headers:l,body:null!=r?r:e})];case 4:return null===(d=s.sent())?[2,{shouldRetry:!1,success:!1,message:\"Unexpected error occurred\"}]:d.status>=200&&d.status<300?(f=Math.round(new Blob(t.events).size/1024),[2,{shouldRetry:!1,success:!0,message:\"Session replay event batch tracked successfully for session id \".concat(t.sessionId,\", size of events: \").concat(f,\" KB\")}]):d.status>=500||408===d.status||429===d.status||499===d.status?[2,{shouldRetry:!0,success:!1,message:\"HTTP \".concat(d.status)}]:[2,{shouldRetry:!1,success:!1,message:\"Network error occurred, event batch rejected\"}];case 5:return p=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(p)}];case 6:return[2]}var g,m})})}function i(e,t,n,o){return r(this,void 0,void 0,function(){var r,a,i;return s(this,function(s){switch(s.label){case 0:r=1,s.label=1;case 1:return[4,c(t,n)];case 2:return(a=s.sent()).success?(postMessage({type:\"log\",id:e,message:a.message}),postMessage({type:\"complete\",id:e}),[2]):o&&a.shouldRetry&&r<n.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*r*1e3)})]:[3,4];case 3:return s.sent(),r++,[3,5];case 4:return i=r>=n.flushMaxRetries?\"Session replay event batch rejected due to exceeded retry count\":a.message,postMessage({type:\"warn\",id:e,message:i}),postMessage({type:\"complete\",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return r(void 0,void 0,void 0,function(){var t,n,r,o,a,c,u;return s(this,function(s){switch(s.label){case 0:return t=e.data,n=t.type,r=t.id,o=t.payload,a=t.context,c=t.useRetry,\"send\"!==n?[3,2]:(u=JSON.stringify(o),[4,i(r,u,a,c)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var u=onmessage;return e.trackDestinationOnMessage=u,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
2
+ var trackDestinationScript = "var WebWorker=function(e){\"use strict\";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,o){function a(e){try{i(n.next(e))}catch(e){o(e)}}function c(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,c)}i((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create((\"function\"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),\"function\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(r)throw new TypeError(\"Generator is already executing.\");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&c[0]?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(6===c[0]&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}\"function\"==typeof SuppressedError&&SuppressedError,function(e){e.US=\"US\",e.EU=\"EU\",e.STAGING=\"STAGING\"}(t||(t={})),t.US;var o;!function(e){e.GET_SR_PROPS=\"get-sr-props\",e.DEBUG_INFO=\"debug-info\",e.FETCH_REQUEST=\"fetch-request\",e.METADATA=\"metadata\",e.TARGETING_DECISION=\"targeting-decision\"}(o||(o={}));function a(e,t){return n(this,void 0,void 0,function(){var r,o,a,c,i,u,l,d,f,p,h,v,y,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,o=new r(\"gzip\"),a=o.writable.getWriter(),c=o.readable.getReader(),i=[],u=n(g,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,c.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];i.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,u];case 3:m.sent(),l=i.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),f=0;try{for(p=function(e){var t=\"function\"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&\"number\"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(i),h=p.next();!h.done;h=p.next())v=h.value,d.set(v,f),f+=v.length}catch(e){y={error:e}}finally{try{h&&!h.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function c(e,t){var o,c,i,u;return n(this,void 0,void 0,function(){var n,l,d,f,p,h,v,y,b;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),\"CompressionStream\"in self?[4,a(e,self)]:[3,2];case 1:return l=s.sent(),[3,3];case 2:l=null,s.label=3;case 3:return n=l,d=\"\".concat(null!==(c=null===(o=t.version)||void 0===o?void 0:o.type)&&void 0!==c?c:\"standalone\",\"/\").concat(null!==(u=null===(i=t.version)||void 0===i?void 0:i.version)&&void 0!==u?u:t.sdkVersion),f=new URLSearchParams({device_id:t.deviceId,session_id:\"\".concat(t.sessionId),type:t.eventType}),p=\"\".concat((g=t.serverZone,m=t.trackServerUrl,m||(\"STAGING\"===g?\"https://api-sr.stag2.amplitude.com/sessions/v2/track\":\"EU\"===g?\"https://api-sr.eu.amplitude.com/sessions/v2/track\":\"https://api-sr.amplitude.com/sessions/v2/track\")),\"?\").concat(f.toString()),h=r({\"Content-Type\":\"application/json\",Accept:\"*/*\",Authorization:\"Bearer \".concat(t.apiKey),\"X-Client-Version\":t.sdkVersion,\"X-Client-Library\":d,\"X-Client-Url\":t.currentUrl.substring(0,1e3),\"X-Client-Sample-Rate\":\"\".concat(t.sampleRate),\"X-Sampling-Hash-Alg\":\"xxhash32\"},n?{\"Content-Encoding\":\"gzip\"}:{}),[4,fetch(p,{method:\"POST\",headers:h,body:null!=n?n:e})];case 4:return null===(v=s.sent())?[2,{shouldRetry:!1,success:!1,message:\"Unexpected error occurred\"}]:v.status>=200&&v.status<300?(y=Math.round(new Blob(t.events).size/1024),[2,{shouldRetry:!1,success:!0,message:\"Session replay event batch tracked successfully for session id \".concat(t.sessionId,\", size of events: \").concat(y,\" KB\")}]):v.status>=500||408===v.status||429===v.status||499===v.status?[2,{shouldRetry:!0,success:!1,message:\"HTTP \".concat(v.status)}]:[2,{shouldRetry:!1,success:!1,message:\"Network error occurred, event batch rejected\"}];case 5:return b=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(b)}];case 6:return[2]}var g,m})})}function i(e,t,r,o){return n(this,void 0,void 0,function(){var n,a,i;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,c(t,r)];case 2:return(a=s.sent()).success?(postMessage({type:\"log\",id:e,message:a.message}),postMessage({type:\"complete\",id:e}),[2]):o&&a.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return i=n>=r.flushMaxRetries?\"Session replay event batch rejected due to exceeded retry count\":a.message,postMessage({type:\"warn\",id:e,message:i}),postMessage({type:\"complete\",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return n(void 0,void 0,void 0,function(){var t,r,n,o,a,c,u;return s(this,function(s){switch(s.label){case 0:return t=e.data,r=t.type,n=t.id,o=t.payload,a=t.context,c=t.useRetry,\"send\"!==r?[3,2]:(u=JSON.stringify(o),[4,i(n,u,a,c)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var u=onmessage;return e.trackDestinationOnMessage=u,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({});\n";
3
3
 
4
4
  export { compressionScript, trackDestinationScript };