@imtbl/sdk 1.44.0-alpha.2 → 1.44.0-alpha.3

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.
Files changed (36) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-cfec4fee.js → BridgeWidget-673d6a8d.js} +1 -1
  3. package/dist/browser/checkout/{OnRampWidget-19315ef0.js → OnRampWidget-5c13ce6c.js} +1 -1
  4. package/dist/browser/checkout/SaleWidget-f4e81633.js +1 -0
  5. package/dist/browser/checkout/{SpendingCapHero-74c15079.js → SpendingCapHero-98bdf024.js} +1 -1
  6. package/dist/browser/checkout/{SwapWidget-a5eba694.js → SwapWidget-3929b5bc.js} +1 -1
  7. package/dist/browser/checkout/{TopUpView-ee275f8a.js → TopUpView-cb134948.js} +1 -1
  8. package/dist/browser/checkout/{WalletWidget-13749f1f.js → WalletWidget-c7f8b7d9.js} +1 -1
  9. package/dist/browser/checkout/{auto-track-8b52d9c0.js → auto-track-8112e696.js} +1 -1
  10. package/dist/browser/checkout/{balance-6cb3d097.js → balance-43a6d0fc.js} +1 -1
  11. package/dist/browser/checkout/index-0ba9df7a.js +1 -0
  12. package/dist/browser/checkout/{index-ed7cf618.js → index-32a5dcd1.js} +1 -1
  13. package/dist/browser/checkout/{index-fab23bf6.js → index-724cc6ea.js} +1 -1
  14. package/dist/browser/checkout/{index-9f3ab170.js → index-81fdebbf.js} +3 -3
  15. package/dist/browser/checkout/{index-af982f55.js → index-9f9486d8.js} +1 -1
  16. package/dist/browser/checkout/{index-378ed3eb.js → index-c9d8eca6.js} +16 -16
  17. package/dist/browser/checkout/{index-477f188d.js → index-d760fc7e.js} +1 -1
  18. package/dist/browser/checkout/{index-2e5d6be1.js → index-f56bf7f4.js} +1 -1
  19. package/dist/browser/checkout/{index.umd-bc15f151.js → index.umd-4d3083b9.js} +1 -1
  20. package/dist/browser/checkout/{retry-808e8a9b.js → retry-febade36.js} +1 -1
  21. package/dist/browser/checkout/sdk.js +4 -4
  22. package/dist/browser/checkout/widgets-esm.js +1 -1
  23. package/dist/browser/checkout/widgets.js +74 -74
  24. package/dist/checkout.js +4 -4
  25. package/dist/config.js +1 -1
  26. package/dist/index.browser.js +4 -4
  27. package/dist/index.cjs +7 -7
  28. package/dist/index.js +7 -7
  29. package/dist/minting_backend.js +2 -2
  30. package/dist/orderbook.js +1 -1
  31. package/dist/passport.js +4 -4
  32. package/dist/webhook.js +1 -1
  33. package/dist/x.js +3 -3
  34. package/package.json +1 -1
  35. package/dist/browser/checkout/SaleWidget-0ae717b3.js +0 -1
  36. package/dist/browser/checkout/index-7aeb7812.js +0 -1
@@ -1,4 +1,4 @@
1
- import{cq as t,cr as e,cs as r,ct as o,cu as n,cv as i,cw as a,cx as l,cy as s}from"./index-9f3ab170.js";
1
+ import{ct as t,cu as e,cv as r,cw as o,cx as n,cy as i,cz as a,cA as l,cB as s}from"./index-81fdebbf.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
@@ -1,4 +1,4 @@
1
- import{cz as r,cA as e}from"./index-9f3ab170.js";for(var t={},n={},o=[],a=0;a<64;)o[a]=0|4294967296*Math.sin(++a%Math.PI);var i=r(Object.freeze({__proto__:null,default:function(r){var e,t,n,i=[e=1732584193,t=4023233417,~e,~t],u=[],f=unescape(encodeURI(r))+"€",c=f.length;for(r=--c/4+2|15,u[--r]=8*c;~c;)u[c>>2]|=f.charCodeAt(c)<<8*c--;for(a=f=0;a<r;a+=16){for(c=i;f<64;c=[n=c[3],e+((n=c[0]+[e&t|~e&n,n&e|~n&t,e^t^n,t^(e|~n)][c=f>>4]+o[f]+~~u[a|15&[f,5*f+1,3*f+5,7*f][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+f++%4])|n>>>-c),e,t])e=0|c[1],t=c[2];for(f=4;f;)i[--f]+=c[f]}for(r="";f<32;)r+=(i[f>>3]>>4*(1^f++)&15).toString(16);return r}})),u={exports:{}};u.exports=function(r,e,t,n,o){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)r=r?r[e[n]]:o;return r===o?t:r};var f=u.exports,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;
1
+ import{cC as r,cD as e}from"./index-81fdebbf.js";for(var t={},n={},o=[],a=0;a<64;)o[a]=0|4294967296*Math.sin(++a%Math.PI);var i=r(Object.freeze({__proto__:null,default:function(r){var e,t,n,i=[e=1732584193,t=4023233417,~e,~t],u=[],f=unescape(encodeURI(r))+"€",c=f.length;for(r=--c/4+2|15,u[--r]=8*c;~c;)u[c>>2]|=f.charCodeAt(c)<<8*c--;for(a=f=0;a<r;a+=16){for(c=i;f<64;c=[n=c[3],e+((n=c[0]+[e&t|~e&n,n&e|~n&t,e^t^n,t^(e|~n)][c=f>>4]+o[f]+~~u[a|15&[f,5*f+1,3*f+5,7*f][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+f++%4])|n>>>-c),e,t])e=0|c[1],t=c[2];for(f=4;f;)i[--f]+=c[f]}for(r="";f<32;)r+=(i[f>>3]>>4*(1^f++)&15).toString(16);return r}})),u={exports:{}};u.exports=function(r,e,t,n,o){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)r=r?r[e[n]]:o;return r===o?t:r};var f=u.exports,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;
2
2
  /**
3
3
  * @license Apache-2.0
4
4
  *
@@ -187,7 +187,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
187
187
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
188
  * See the License for the specific language governing permissions and
189
189
  * limitations under the License.
190
- */var x=function(r,e){return null!=r&&F.call(r,e)},T="function"==typeof Symbol?Symbol.toStringTag:"",C=x,H=T,J=I;
190
+ */var x=function(r,e){return null!=r&&F.call(r,e)},C="function"==typeof Symbol?Symbol.toStringTag:"",T=x,H=C,J=I;
191
191
  /**
192
192
  * @license Apache-2.0
193
193
  *
@@ -204,7 +204,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
204
204
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
205
  * See the License for the specific language governing permissions and
206
206
  * limitations under the License.
207
- */var G=M,L=function(r){var e,t,n;if(null==r)return J.call(r);t=r[H],e=C(r,H);try{r[H]=void 0}catch(e){return J.call(r)}return n=J.call(r),e?r[H]=t:delete r[H],n},D=U()?L:G,R=D,V="function"==typeof Uint32Array;
207
+ */var D=M,G=function(r){var e,t,n;if(null==r)return J.call(r);t=r[H],e=T(r,H);try{r[H]=void 0}catch(e){return J.call(r)}return n=J.call(r),e?r[H]=t:delete r[H],n},L=U()?G:D,R=L,V="function"==typeof Uint32Array;
208
208
  /**
209
209
  * @license Apache-2.0
210
210
  *
@@ -221,7 +221,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
221
221
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
222
222
  * See the License for the specific language governing permissions and
223
223
  * limitations under the License.
224
- */var W="function"==typeof Uint32Array?Uint32Array:null,z=function(r){return V&&r instanceof Uint32Array||"[object Uint32Array]"===R(r)},B=W;
224
+ */var W="function"==typeof Uint32Array?Uint32Array:null,B=function(r){return V&&r instanceof Uint32Array||"[object Uint32Array]"===R(r)},Q=W;
225
225
  /**
226
226
  * @license Apache-2.0
227
227
  *
@@ -238,7 +238,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
238
238
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
239
  * See the License for the specific language governing permissions and
240
240
  * limitations under the License.
241
- */var Q=function(){var r,e;if("function"!=typeof B)return!1;try{e=new B(e=[1,3.14,-3.14,4294967296,4294967297]),r=z(e)&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r};
241
+ */var Y=function(){var r,e;if("function"!=typeof Q)return!1;try{e=new Q(e=[1,3.14,-3.14,4294967296,4294967297]),r=B(e)&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r};
242
242
  /**
243
243
  * @license Apache-2.0
244
244
  *
@@ -255,7 +255,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
255
255
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256
256
  * See the License for the specific language governing permissions and
257
257
  * limitations under the License.
258
- */var Y="function"==typeof Uint32Array?Uint32Array:void 0,q=
258
+ */var q="function"==typeof Uint32Array?Uint32Array:void 0,z=
259
259
  /**
260
260
  * @license Apache-2.0
261
261
  *
@@ -273,7 +273,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
273
273
  * See the License for the specific language governing permissions and
274
274
  * limitations under the License.
275
275
  */
276
- function(){throw new Error("not implemented")},K=Q()?Y:q,X=D,Z="function"==typeof Float64Array;
276
+ function(){throw new Error("not implemented")},K=Y()?q:z,X=L,Z="function"==typeof Float64Array;
277
277
  /**
278
278
  * @license Apache-2.0
279
279
  *
@@ -342,7 +342,7 @@ function(){throw new Error("not implemented")},K=Q()?Y:q,X=D,Z="function"==typeo
342
342
  * See the License for the specific language governing permissions and
343
343
  * limitations under the License.
344
344
  */
345
- function(){throw new Error("not implemented")},ar=tr()?nr:or,ir=D,ur="function"==typeof Uint8Array;
345
+ function(){throw new Error("not implemented")},ar=tr()?nr:or,ir=L,ur="function"==typeof Uint8Array;
346
346
  /**
347
347
  * @license Apache-2.0
348
348
  *
@@ -411,7 +411,7 @@ function(){throw new Error("not implemented")},ar=tr()?nr:or,ir=D,ur="function"=
411
411
  * See the License for the specific language governing permissions and
412
412
  * limitations under the License.
413
413
  */
414
- function(){throw new Error("not implemented")},vr=sr()?pr:yr,dr=D,hr="function"==typeof Uint16Array;
414
+ function(){throw new Error("not implemented")},vr=sr()?pr:yr,dr=L,hr="function"==typeof Uint16Array;
415
415
  /**
416
416
  * @license Apache-2.0
417
417
  *
@@ -531,7 +531,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
531
531
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
532
532
  * See the License for the specific language governing permissions and
533
533
  * limitations under the License.
534
- */var xr=function(r,e,t,n){return Ir[0]=r,e[n]=Pr[Mr],e[n+t]=Pr[Fr],e},Tr=xr;
534
+ */var xr=function(r,e,t,n){return Ir[0]=r,e[n]=Pr[Mr],e[n+t]=Pr[Fr],e},Cr=xr;
535
535
  /**
536
536
  * @license Apache-2.0
537
537
  *
@@ -548,7 +548,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
548
548
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
549
549
  * See the License for the specific language governing permissions and
550
550
  * limitations under the License.
551
- */var Cr=function(r){return Tr(r,[0,0],1,0)};
551
+ */var Tr=function(r){return Cr(r,[0,0],1,0)};
552
552
  /**
553
553
  * @license Apache-2.0
554
554
  *
@@ -565,7 +565,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
565
565
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
566
566
  * See the License for the specific language governing permissions and
567
567
  * limitations under the License.
568
- */S(Cr,"assign",xr);var Hr=Cr,Jr=K,Gr=!0===Sr?1:0,Lr=new ar(1),Dr=new Jr(Lr.buffer);
568
+ */S(Tr,"assign",xr);var Hr=Tr,Jr=K,Dr=!0===Sr?1:0,Gr=new ar(1),Lr=new Jr(Gr.buffer);
569
569
  /**
570
570
  * @license Apache-2.0
571
571
  *
@@ -582,7 +582,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
582
582
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
583
583
  * See the License for the specific language governing permissions and
584
584
  * limitations under the License.
585
- */var Rr,Vr,Wr=function(r){return Lr[0]=r,Dr[Gr]};
585
+ */var Rr,Vr,Wr=function(r){return Gr[0]=r,Lr[Dr]};
586
586
  /**
587
587
  * @license Apache-2.0
588
588
  *
@@ -599,7 +599,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
599
599
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
600
600
  * See the License for the specific language governing permissions and
601
601
  * limitations under the License.
602
- */!0===Sr?(Rr=1,Vr=0):(Rr=0,Vr=1);var zr=K,Br={HIGH:Rr,LOW:Vr},Qr=new ar(1),Yr=new zr(Qr.buffer),qr=Br.HIGH,Kr=Br.LOW;
602
+ */!0===Sr?(Rr=1,Vr=0):(Rr=0,Vr=1);var Br=K,Qr={HIGH:Rr,LOW:Vr},Yr=new ar(1),qr=new Br(Yr.buffer),zr=Qr.HIGH,Kr=Qr.LOW;
603
603
  /**
604
604
  * @license Apache-2.0
605
605
  *
@@ -616,7 +616,7 @@ function(){throw new Error("not implemented")},Or={uint16:_r()?Ar:jr,uint8:vr};
616
616
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
617
617
  * See the License for the specific language governing permissions and
618
618
  * limitations under the License.
619
- */var Xr=function(r,e){return Yr[qr]=r,Yr[Kr]=e,Qr[0]},Zr=Xr,$r=Hr,re=Wr,ee=Zr,te=[0,0];
619
+ */var Xr=function(r,e){return qr[zr]=r,qr[Kr]=e,Yr[0]},Zr=Xr,$r=Hr,re=Wr,ee=Zr,te=[0,0];
620
620
  /**
621
621
  * @license Apache-2.0
622
622
  *
@@ -770,4 +770,4 @@ function(r){return Math.abs(r)};
770
770
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
771
771
  * See the License for the specific language governing permissions and
772
772
  * limitations under the License.
773
- */ke.dset=function(r,e,t){e.split&&(e=e.split("."));for(var n,o,a=0,i=e.length,u=r;a<i&&"__proto__"!==(o=e[a++])&&"constructor"!==o&&"prototype"!==o;)u=u[o]=a===i?t:typeof(n=u[o])==typeof e?n:0*e[a]!=0||~(""+e[a]).indexOf(".")?{}:[]};var Ne={},Se=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.unset=void 0;var Ee=Se(f);Ne.unset=function(r,e){if((0,Ee.default)(r,e)){for(var t=e.split("."),n=t.pop();t.length&&"\\"===t[t.length-1].slice(-1);)n=t.pop().slice(0,-1)+"."+n;for(;t.length;)r=r[e=t.shift()];return delete r[n]}return!0};var Ue=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(n,"__esModule",{value:!0});var Ie=Ue(i),Pe=Ue(f),Me=Ue(Oe),Fe=ke,xe=Ne;function Te(r,e){He(r,e.drop,(function(r,e){e.forEach((function(e){return delete r[e]}))}))}function Ce(r,e){He(r,e.allow,(function(r,e){Object.keys(r).forEach((function(t){e.includes(t)||delete r[t]}))}))}function He(r,e,t){Object.entries(e).forEach((function(e){var n=e[0],o=e[1],a=function(r){"object"==typeof r&&null!==r&&t(r,o)},i=""===n?r:(0,Pe.default)(r,n);Array.isArray(i)?i.forEach(a):a(i)}))}function Je(r,e){var t=JSON.parse(JSON.stringify(r));for(var n in e.map)if(e.map.hasOwnProperty(n)){var o=e.map[n],a=n.split("."),i=void 0;if(a.length>1?(a.pop(),i=(0,Pe.default)(t,a.join("."))):i=r,"object"==typeof i){if(o.copy){var u=(0,Pe.default)(t,o.copy);void 0!==u&&(0,Fe.dset)(r,n,u)}else if(o.move){var f=(0,Pe.default)(t,o.move);void 0!==f&&(0,Fe.dset)(r,n,f),(0,xe.unset)(r,o.move)}else o.hasOwnProperty("set")&&(0,Fe.dset)(r,n,o.set);if(o.to_string){var c=(0,Pe.default)(r,n);if("string"==typeof c||"object"==typeof c&&null!==c)continue;void 0!==c?(0,Fe.dset)(r,n,JSON.stringify(c)):(0,Fe.dset)(r,n,"undefined")}}}}function Ge(r,e){return!(e.sample.percent<=0)&&(e.sample.percent>=1||(e.sample.path?function(r,e){var t=(0,Pe.default)(r,e.sample.path),n=(0,Ie.default)(JSON.stringify(t)),o=-64,a=[];Le(n.slice(0,8),a);for(var i=0,u=0;u<64&&1!==a[u];u++)i++;if(0!==i){var f=[];Le(n.slice(9,16),f),o-=i,a.splice(0,i),f.splice(64-i),a=a.concat(f)}return a[63]=0===a[63]?1:0,(0,Me.default)(parseInt(a.join(""),2),o)<e.sample.percent}(r,e):(t=e.sample.percent,Math.random()<=t)));var t}function Le(r,e){for(var t=0;t<8;t++)for(var n=r[t],o=128;o>=1;o/=2)n-o>=0?(n-=o,e.push(1)):e.push(0)}n.default=function(r,e){for(var t=r,n=0,o=e;n<o.length;n++){var a=o[n];switch(a.type){case"drop":return null;case"drop_properties":Te(t,a.config);break;case"allow_properties":Ce(t,a.config);break;case"sample_event":if(Ge(t,a.config))break;return null;case"map_properties":Je(t,a.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(a.type,'" is unsupported.'))}}return t};var De={},Re=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(De,"__esModule",{value:!0});var Ve=Re(f);function We(r,e){if(!Array.isArray(r))return!0===ze(r,e);var t=r[0];switch(t){case"!":return!We(r[1],e);case"or":for(var n=1;n<r.length;n++)if(We(r[n],e))return!0;return!1;case"and":for(n=1;n<r.length;n++)if(!We(r[n],e))return!1;return!0;case"=":case"!=":return function(r,e,t,n){Be(r)&&(r=We(r,n));Be(e)&&(e=We(e,n));"object"==typeof r&&"object"==typeof e&&(r=JSON.stringify(r),e=JSON.stringify(e));switch(t){case"=":return r===e;case"!=":return r!==e;default:throw new Error("Invalid operator in compareItems: ".concat(t))}}(ze(r[1],e),ze(r[2],e),t,e);case"<=":case"<":case">":case">=":return function(r,e,t,n){Be(r)&&(r=We(r,n));Be(e)&&(e=We(e,n));if("number"!=typeof r||"number"!=typeof e)return!1;switch(t){case"<=":return r<=e;case">=":return r>=e;case"<":return r<e;case">":return r>e;default:throw new Error("Invalid operator in compareNumbers: ".concat(t))}}(ze(r[1],e),ze(r[2],e),t,e);case"in":return function(r,e,t){return void 0!==e.find((function(e){return ze(e,t)===r}))}(ze(r[1],e),ze(r[2],e),e);case"contains":return function(r,e){if("string"!=typeof r||"string"!=typeof e)return!1;return-1!==r.indexOf(e)}(ze(r[1],e),ze(r[2],e));case"match":return function(r,e){if("string"!=typeof r||"string"!=typeof e)return!1;return function(r,e){var t,n;r:for(;r.length>0;){var o=void 0,a=void 0;if(o=(t=Qe(r)).star,a=t.chunk,r=t.pattern,o&&""===a)return!0;var i=Ye(a,e),u=i.t,f=i.ok,c=i.err;if(c)return!1;if(!f||!(0===u.length||r.length>0)){if(o)for(var l=0;l<e.length;l++){if(u=(n=Ye(a,e.slice(l+1))).t,f=n.ok,c=n.err,f){if(0===r.length&&u.length>0)continue;e=u;continue r}if(c)return!1}return!1}e=u}return 0===e.length}(e,r)}(ze(r[1],e),ze(r[2],e));case"lowercase":var o=ze(r[1],e);return"string"!=typeof o?null:o.toLowerCase();case"typeof":return typeof ze(r[1],e);case"length":return function(r){if(null===r)return 0;if(!Array.isArray(r)&&"string"!=typeof r)return NaN;return r.length}(ze(r[1],e));default:throw new Error("FQL IR could not evaluate for token: ".concat(t))}}function ze(r,e){return Array.isArray(r)?r:"object"==typeof r?r.value:(0,Ve.default)(e,r)}function Be(r){return!!Array.isArray(r)&&(("lowercase"===r[0]||"length"===r[0]||"typeof"===r[0])&&2===r.length||("contains"===r[0]||"match"===r[0])&&3===r.length)}function Qe(r){for(var e={star:!1,chunk:"",pattern:""};r.length>0&&"*"===r[0];)r=r.slice(1),e.star=!0;var t,n=!1;r:for(t=0;t<r.length;t++)switch(r[t]){case"\\":t+1<r.length&&t++;break;case"[":n=!0;break;case"]":n=!1;break;case"*":if(!n)break r}return e.chunk=r.slice(0,t),e.pattern=r.slice(t),e}function Ye(r,e){for(var t,n,o={t:"",ok:!1,err:!1};r.length>0;){if(0===e.length)return o;switch(r[0]){case"[":var a=e[0];e=e.slice(1);var i=!0;(r=r.slice(1)).length>0&&"^"===r[0]&&(i=!1,r=r.slice(1));for(var u=!1,f=0;;){if(r.length>0&&"]"===r[0]&&f>0){r=r.slice(1);break}var c,l="";if(c=(t=qe(r)).char,r=t.newChunk,t.err)return o;if(l=c,"-"===r[0]&&(l=(n=qe(r.slice(1))).char,r=n.newChunk,n.err))return o;c<=a&&a<=l&&(u=!0),f++}if(u!==i)return o;break;case"?":e=e.slice(1),r=r.slice(1);break;case"\\":if(0===(r=r.slice(1)).length)return o.err=!0,o;default:if(r[0]!==e[0])return o;e=e.slice(1),r=r.slice(1)}}return o.t=e,o.ok=!0,o.err=!1,o}function qe(r){var e={char:"",newChunk:"",err:!1};return 0===r.length||"-"===r[0]||"]"===r[0]||"\\"===r[0]&&0===(r=r.slice(1)).length?(e.err=!0,e):(e.char=r[0],e.newChunk=r.slice(1),0===e.newChunk.length&&(e.err=!0),e)}De.default=function(r,e){if(!e)throw new Error("No matcher supplied!");switch(e.type){case"all":return!0;case"fql":return function(r,e){if(!r)return!1;try{r=JSON.parse(r)}catch(e){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(r,'": ').concat(e))}var t=We(r,e);if("boolean"!=typeof t)return!1;return t}(e.ir,r);default:throw new Error("Matcher of type ".concat(e.type," unsupported."))}};var Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});var Xe=function(){function r(r){this.rules=[],this.rules=r||[]}return r.prototype.getRulesByDestinationName=function(r){for(var e=[],t=0,n=this.rules;t<n.length;t++){var o=n[t];o.destinationName!==r&&void 0!==o.destinationName||e.push(o)}return e},r}();Ke.default=Xe,function(r){var t=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(r,"__esModule",{value:!0}),r.Store=r.matches=r.transform=void 0;var o=n;Object.defineProperty(r,"transform",{enumerable:!0,get:function(){return t(o).default}});var a=De;Object.defineProperty(r,"matches",{enumerable:!0,get:function(){return t(a).default}});var i=Ke;Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return t(i).default}})}(t);var Ze=function(r){return function(e){var n=e.payload,o=e.integration,a=e.next;new t.Store(r).getRulesByDestinationName(o).forEach((function(r){for(var e=r.matchers,o=r.transformers,i=0;i<e.length;i++)if(t.matches(n.obj,e[i])&&(n.obj=t.transform(n.obj,o[i]),null===n.obj))return a(null)})),a(n)}};export{Ze as tsubMiddleware};
773
+ */ke.dset=function(r,e,t){e.split&&(e=e.split("."));for(var n,o,a=0,i=e.length,u=r;a<i&&"__proto__"!==(o=e[a++])&&"constructor"!==o&&"prototype"!==o;)u=u[o]=a===i?t:typeof(n=u[o])==typeof e?n:0*e[a]!=0||~(""+e[a]).indexOf(".")?{}:[]};var Ne={},Se=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.unset=void 0;var Ee=Se(f);Ne.unset=function(r,e){if((0,Ee.default)(r,e)){for(var t=e.split("."),n=t.pop();t.length&&"\\"===t[t.length-1].slice(-1);)n=t.pop().slice(0,-1)+"."+n;for(;t.length;)r=r[e=t.shift()];return delete r[n]}return!0};var Ue=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(n,"__esModule",{value:!0});var Ie=Ue(i),Pe=Ue(f),Me=Ue(Oe),Fe=ke,xe=Ne;function Ce(r,e){He(r,e.drop,(function(r,e){e.forEach((function(e){return delete r[e]}))}))}function Te(r,e){He(r,e.allow,(function(r,e){Object.keys(r).forEach((function(t){e.includes(t)||delete r[t]}))}))}function He(r,e,t){Object.entries(e).forEach((function(e){var n=e[0],o=e[1],a=function(r){"object"==typeof r&&null!==r&&t(r,o)},i=""===n?r:(0,Pe.default)(r,n);Array.isArray(i)?i.forEach(a):a(i)}))}function Je(r,e){var t=JSON.parse(JSON.stringify(r));for(var n in e.map)if(e.map.hasOwnProperty(n)){var o=e.map[n],a=n.split("."),i=void 0;if(a.length>1?(a.pop(),i=(0,Pe.default)(t,a.join("."))):i=r,"object"==typeof i){if(o.copy){var u=(0,Pe.default)(t,o.copy);void 0!==u&&(0,Fe.dset)(r,n,u)}else if(o.move){var f=(0,Pe.default)(t,o.move);void 0!==f&&(0,Fe.dset)(r,n,f),(0,xe.unset)(r,o.move)}else o.hasOwnProperty("set")&&(0,Fe.dset)(r,n,o.set);if(o.to_string){var c=(0,Pe.default)(r,n);if("string"==typeof c||"object"==typeof c&&null!==c)continue;void 0!==c?(0,Fe.dset)(r,n,JSON.stringify(c)):(0,Fe.dset)(r,n,"undefined")}}}}function De(r,e){return!(e.sample.percent<=0)&&(e.sample.percent>=1||(e.sample.path?function(r,e){var t=(0,Pe.default)(r,e.sample.path),n=(0,Ie.default)(JSON.stringify(t)),o=-64,a=[];Ge(n.slice(0,8),a);for(var i=0,u=0;u<64&&1!==a[u];u++)i++;if(0!==i){var f=[];Ge(n.slice(9,16),f),o-=i,a.splice(0,i),f.splice(64-i),a=a.concat(f)}return a[63]=0===a[63]?1:0,(0,Me.default)(parseInt(a.join(""),2),o)<e.sample.percent}(r,e):(t=e.sample.percent,Math.random()<=t)));var t}function Ge(r,e){for(var t=0;t<8;t++)for(var n=r[t],o=128;o>=1;o/=2)n-o>=0?(n-=o,e.push(1)):e.push(0)}n.default=function(r,e){for(var t=r,n=0,o=e;n<o.length;n++){var a=o[n];switch(a.type){case"drop":return null;case"drop_properties":Ce(t,a.config);break;case"allow_properties":Te(t,a.config);break;case"sample_event":if(De(t,a.config))break;return null;case"map_properties":Je(t,a.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(a.type,'" is unsupported.'))}}return t};var Le={},Re=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Le,"__esModule",{value:!0});var Ve=Re(f);function We(r,e){if(!Array.isArray(r))return!0===Be(r,e);var t=r[0];switch(t){case"!":return!We(r[1],e);case"or":for(var n=1;n<r.length;n++)if(We(r[n],e))return!0;return!1;case"and":for(n=1;n<r.length;n++)if(!We(r[n],e))return!1;return!0;case"=":case"!=":return function(r,e,t,n){Qe(r)&&(r=We(r,n));Qe(e)&&(e=We(e,n));"object"==typeof r&&"object"==typeof e&&(r=JSON.stringify(r),e=JSON.stringify(e));switch(t){case"=":return r===e;case"!=":return r!==e;default:throw new Error("Invalid operator in compareItems: ".concat(t))}}(Be(r[1],e),Be(r[2],e),t,e);case"<=":case"<":case">":case">=":return function(r,e,t,n){Qe(r)&&(r=We(r,n));Qe(e)&&(e=We(e,n));if("number"!=typeof r||"number"!=typeof e)return!1;switch(t){case"<=":return r<=e;case">=":return r>=e;case"<":return r<e;case">":return r>e;default:throw new Error("Invalid operator in compareNumbers: ".concat(t))}}(Be(r[1],e),Be(r[2],e),t,e);case"in":return function(r,e,t){return void 0!==e.find((function(e){return Be(e,t)===r}))}(Be(r[1],e),Be(r[2],e),e);case"contains":return function(r,e){if("string"!=typeof r||"string"!=typeof e)return!1;return-1!==r.indexOf(e)}(Be(r[1],e),Be(r[2],e));case"match":return function(r,e){if("string"!=typeof r||"string"!=typeof e)return!1;return function(r,e){var t,n;r:for(;r.length>0;){var o=void 0,a=void 0;if(o=(t=Ye(r)).star,a=t.chunk,r=t.pattern,o&&""===a)return!0;var i=qe(a,e),u=i.t,f=i.ok,c=i.err;if(c)return!1;if(!f||!(0===u.length||r.length>0)){if(o)for(var l=0;l<e.length;l++){if(u=(n=qe(a,e.slice(l+1))).t,f=n.ok,c=n.err,f){if(0===r.length&&u.length>0)continue;e=u;continue r}if(c)return!1}return!1}e=u}return 0===e.length}(e,r)}(Be(r[1],e),Be(r[2],e));case"lowercase":var o=Be(r[1],e);return"string"!=typeof o?null:o.toLowerCase();case"typeof":return typeof Be(r[1],e);case"length":return function(r){if(null===r)return 0;if(!Array.isArray(r)&&"string"!=typeof r)return NaN;return r.length}(Be(r[1],e));default:throw new Error("FQL IR could not evaluate for token: ".concat(t))}}function Be(r,e){return Array.isArray(r)?r:"object"==typeof r?r.value:(0,Ve.default)(e,r)}function Qe(r){return!!Array.isArray(r)&&(("lowercase"===r[0]||"length"===r[0]||"typeof"===r[0])&&2===r.length||("contains"===r[0]||"match"===r[0])&&3===r.length)}function Ye(r){for(var e={star:!1,chunk:"",pattern:""};r.length>0&&"*"===r[0];)r=r.slice(1),e.star=!0;var t,n=!1;r:for(t=0;t<r.length;t++)switch(r[t]){case"\\":t+1<r.length&&t++;break;case"[":n=!0;break;case"]":n=!1;break;case"*":if(!n)break r}return e.chunk=r.slice(0,t),e.pattern=r.slice(t),e}function qe(r,e){for(var t,n,o={t:"",ok:!1,err:!1};r.length>0;){if(0===e.length)return o;switch(r[0]){case"[":var a=e[0];e=e.slice(1);var i=!0;(r=r.slice(1)).length>0&&"^"===r[0]&&(i=!1,r=r.slice(1));for(var u=!1,f=0;;){if(r.length>0&&"]"===r[0]&&f>0){r=r.slice(1);break}var c,l="";if(c=(t=ze(r)).char,r=t.newChunk,t.err)return o;if(l=c,"-"===r[0]&&(l=(n=ze(r.slice(1))).char,r=n.newChunk,n.err))return o;c<=a&&a<=l&&(u=!0),f++}if(u!==i)return o;break;case"?":e=e.slice(1),r=r.slice(1);break;case"\\":if(0===(r=r.slice(1)).length)return o.err=!0,o;default:if(r[0]!==e[0])return o;e=e.slice(1),r=r.slice(1)}}return o.t=e,o.ok=!0,o.err=!1,o}function ze(r){var e={char:"",newChunk:"",err:!1};return 0===r.length||"-"===r[0]||"]"===r[0]||"\\"===r[0]&&0===(r=r.slice(1)).length?(e.err=!0,e):(e.char=r[0],e.newChunk=r.slice(1),0===e.newChunk.length&&(e.err=!0),e)}Le.default=function(r,e){if(!e)throw new Error("No matcher supplied!");switch(e.type){case"all":return!0;case"fql":return function(r,e){if(!r)return!1;try{r=JSON.parse(r)}catch(e){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(r,'": ').concat(e))}var t=We(r,e);if("boolean"!=typeof t)return!1;return t}(e.ir,r);default:throw new Error("Matcher of type ".concat(e.type," unsupported."))}};var Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});var Xe=function(){function r(r){this.rules=[],this.rules=r||[]}return r.prototype.getRulesByDestinationName=function(r){for(var e=[],t=0,n=this.rules;t<n.length;t++){var o=n[t];o.destinationName!==r&&void 0!==o.destinationName||e.push(o)}return e},r}();Ke.default=Xe,function(r){var t=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(r,"__esModule",{value:!0}),r.Store=r.matches=r.transform=void 0;var o=n;Object.defineProperty(r,"transform",{enumerable:!0,get:function(){return t(o).default}});var a=Le;Object.defineProperty(r,"matches",{enumerable:!0,get:function(){return t(a).default}});var i=Ke;Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return t(i).default}})}(t);var Ze=function(r){return function(e){var n=e.payload,o=e.integration,a=e.next;new t.Store(r).getRulesByDestinationName(o).forEach((function(r){for(var e=r.matchers,o=r.transformers,i=0;i<e.length;i++)if(t.matches(n.obj,e[i])&&(n.obj=t.transform(n.obj,o[i]),null===n.obj))return a(null)})),a(n)}};export{Ze as tsubMiddleware};
@@ -1 +1 @@
1
- import{cB as t,cC as n,cD as i,cE as e,cF as r,cG as o,cH as s,cI as a,cJ as u,cK as c,cL as l,cM as d,cN as h,cO as v,cP as f,cQ as p,cR as g,cS as y,cT as m,cU as w}from"./index-9f3ab170.js";import{i as b}from"./is-plan-event-enabled-80f76ce6.js";function _(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function S(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function k(r,s,a,u){return t(this,void 0,void 0,(function(){var t,c,l,d,h,v;return n(this,(function(n){switch(n.label){case 0:t=_(s),c=S(t,u),l=e(),d="".concat(l,"/integrations/").concat(null!=c?c:t,"/").concat(a,"/").concat(null!=c?c:t,".dynamic.js.gz"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i(d)];case 2:return n.sent(),function(t,n,i){var e,r;try{var s=(null!==(r=null===(e=null===window||void 0===window?void 0:window.performance)||void 0===e?void 0:e.getEntriesByName(t,"resource"))&&void 0!==r?r:[])[0];s&&n.stats.gauge("legacy_destination_time",Math.round(s.duration),o([i],s.duration<100?["cached"]:[],!0))}catch(t){}}(d,r,s),[3,4];case 3:throw h=n.sent(),r.stats.gauge("legacy_destination_time",-1,["plugin:".concat(s),"failed"]),h;case 4:return v=window["".concat(t,"Deps")],[4,Promise.all(v.map((function(t){return i(l+t+".gz")})))];case 5:return n.sent(),window["".concat(t,"Loader")](),[2,window["".concat(t,"Integration")]]}}))}))}function z(i,e){return t(this,void 0,void 0,(function(){var r,o=this;return n(this,(function(a){switch(a.label){case 0:return r=[],s()?[2,e]:[4,f((function(){return e.length>0&&m()}),(function(){return t(o,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return(t=e.pop())?[4,y(t,i)]:[2];case 1:return o=n.sent(),o instanceof w||r.push(t),[2]}}))}))}))];case 1:return a.sent(),r.map((function(t){return e.pushWithBackoff(t)})),[2,e]}}))}))}var I=function(){function i(t,n,i,e,r,o){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=a({},e),this.disableAutoISOConversion=r.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new p(4,[]):new g(4,"".concat(i,":dest-").concat(t)),this.scheduleFlush()}return i.prototype.isLoaded=function(){return this._ready},i.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},i.prototype.load=function(i,e){var r;return t(this,void 0,void 0,(function(){var t,o,s=this;return n(this,(function(n){switch(n.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(r=this.integrationSource)||void 0===r?[3,1]:(o=r,[3,3]);case 1:return[4,k(i,this.name,this.version,this.options.obfuscate)];case 2:o=n.sent(),n.label=3;case 3:t=o,this.integration=function(t,n,i){var e;"Integration"in t?(t({user:function(){return i.user()},addIntegration:function(){}}),e=t.Integration):e=t;var r=new e(n);return r.analytics=i,r}(t,this.settings,e),this.onReady=new Promise((function(t){s.integration.once("ready",(function(){s._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){s.integration.on("initialize",(function(){s._initialized=!0,t(!0)}))}));try{i.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(t){throw i.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),t}return[2]}}))}))},i.prototype.unload=function(i,o){return function(i,o,s){return t(this,void 0,void 0,(function(){var t,a,u,c;return n(this,(function(n){return t=e(),a=_(i),u=S(i,s),c="".concat(t,"/integrations/").concat(null!=u?u:a,"/").concat(o,"/").concat(null!=u?u:a,".dynamic.js.gz"),[2,r(c)]}))}))}(this.name,this.version,this.options.obfuscate)},i.prototype.addMiddleware=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];this.middleware=(t=this.middleware).concat.apply(t,n)},i.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(s()||!1===this._ready||!1===this._initialized)},i.prototype.send=function(i,e,r){var o,s;return t(this,void 0,void 0,(function(){var t,l,d,h,v,f;return n(this,(function(n){switch(n.label){case 0:if(this.shouldBuffer(i))return this.buffer.push(i),this.scheduleFlush(),[2,i];if(t=null===(s=null===(o=this.options)||void 0===o?void 0:o.plan)||void 0===s?void 0:s.track,l=i.event.event,t&&l&&"Segment.io"!==this.name){if(d=t[l],!b(t,d))return i.updateEvent("integrations",a(a({},i.event.integrations),{All:!1,"Segment.io":!0})),i.cancel(new u({retry:!1,reason:"Event ".concat(l," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i];if(i.updateEvent("integrations",a(a({},i.event.integrations),null==d?void 0:d.integrations)),(null==d?void 0:d.enabled)&&!1===(null==d?void 0:d.integrations[this.name]))return i.cancel(new u({retry:!1,reason:"Event ".concat(l," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i]}return[4,c(this.name,i.event,this.middleware)];case 1:if(null===(h=n.sent()))return[2,i];v=new e(h,{traverse:!this.disableAutoISOConversion}),i.stats.increment("analytics_js.integration.invoke",1,["method:".concat(r),"integration_name:".concat(this.name)]),n.label=2;case 2:return n.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,r,v)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:throw f=n.sent(),i.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(r),"integration_name:".concat(this.name)]),f;case 6:return[2,i]}}))}))},i.prototype.track=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Track,"track")]}))}))},i.prototype.page=function(i){var e;return t(this,void 0,void 0,(function(){var t=this;return n(this,(function(n){return(null===(e=this.integration)||void 0===e?void 0:e._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return t.send(i,l.Page,"page")}))]}))}))},i.prototype.identify=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Identify,"identify")]}))}))},i.prototype.alias=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Alias,"alias")]}))}))},i.prototype.group=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Group,"group")]}))}))},i.prototype.scheduleFlush=function(){var i=this;this.flushing||setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,z(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},i}();function j(t,n,i,e,r,s){var u,c;if(void 0===i&&(i={}),void 0===e&&(e={}),d())return[];n.plan&&((e=null!=e?e:{}).plan=n.plan);var l=null!==(c=null===(u=n.middlewareSettings)||void 0===u?void 0:u.routingRules)&&void 0!==c?c:[],f=n.integrations,p=e.integrations,g=h(n,null!=e?e:{}),y=null==s?void 0:s.reduce((function(t,n){var i;return a(a({},t),((i={})[function(t){return("Integration"in t?t.Integration:t).prototype.name}(n)]=n,i))}),{}),m=new Set(o(o([],Object.keys(f).filter((function(t){return function(t,n){var i,e=n.type,r=n.bundlingStatus,o=n.versionSettings,s="unbundled"!==r&&("browser"===e||(null===(i=null==o?void 0:o.componentTypes)||void 0===i?void 0:i.includes("browser")));return!t.startsWith("Segment")&&"Iterable"!==t&&s}(t,f[t])})),!0),Object.keys(y||{}).filter((function(t){return v(f[t])||v(null==p?void 0:p[t])})),!0));return Array.from(m).filter((function(t){return!function(t,n){var i=!1===n.All&&void 0===n[t];return!1===n[t]||i}(t,i)})).map((function(n){var i=function(t){var n,i,e,r;return null!==(r=null!==(i=null===(n=null==t?void 0:t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==i?i:null===(e=null==t?void 0:t.versionSettings)||void 0===e?void 0:e.version)&&void 0!==r?r:"latest"}(f[n]),o=new I(n,i,t,g[n],e,null==y?void 0:y[n]);return l.filter((function(t){return t.destinationName===n})).length>0&&r&&o.addMiddleware(r),o}))}export{I as LegacyDestination,j as ajsDestinations};
1
+ import{cE as t,cF as n,cG as i,cH as e,cI as r,cJ as o,cK as s,cL as a,cM as u,cN as c,cO as l,cP as d,cQ as h,cR as v,cS as f,cT as p,cU as g,cV as y,cW as m,cX as w}from"./index-81fdebbf.js";import{i as b}from"./is-plan-event-enabled-80f76ce6.js";function _(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function S(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function k(r,s,a,u){return t(this,void 0,void 0,(function(){var t,c,l,d,h,v;return n(this,(function(n){switch(n.label){case 0:t=_(s),c=S(t,u),l=e(),d="".concat(l,"/integrations/").concat(null!=c?c:t,"/").concat(a,"/").concat(null!=c?c:t,".dynamic.js.gz"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i(d)];case 2:return n.sent(),function(t,n,i){var e,r;try{var s=(null!==(r=null===(e=null===window||void 0===window?void 0:window.performance)||void 0===e?void 0:e.getEntriesByName(t,"resource"))&&void 0!==r?r:[])[0];s&&n.stats.gauge("legacy_destination_time",Math.round(s.duration),o([i],s.duration<100?["cached"]:[],!0))}catch(t){}}(d,r,s),[3,4];case 3:throw h=n.sent(),r.stats.gauge("legacy_destination_time",-1,["plugin:".concat(s),"failed"]),h;case 4:return v=window["".concat(t,"Deps")],[4,Promise.all(v.map((function(t){return i(l+t+".gz")})))];case 5:return n.sent(),window["".concat(t,"Loader")](),[2,window["".concat(t,"Integration")]]}}))}))}function z(i,e){return t(this,void 0,void 0,(function(){var r,o=this;return n(this,(function(a){switch(a.label){case 0:return r=[],s()?[2,e]:[4,f((function(){return e.length>0&&m()}),(function(){return t(o,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return(t=e.pop())?[4,y(t,i)]:[2];case 1:return o=n.sent(),o instanceof w||r.push(t),[2]}}))}))}))];case 1:return a.sent(),r.map((function(t){return e.pushWithBackoff(t)})),[2,e]}}))}))}var I=function(){function i(t,n,i,e,r,o){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=a({},e),this.disableAutoISOConversion=r.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new p(4,[]):new g(4,"".concat(i,":dest-").concat(t)),this.scheduleFlush()}return i.prototype.isLoaded=function(){return this._ready},i.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},i.prototype.load=function(i,e){var r;return t(this,void 0,void 0,(function(){var t,o,s=this;return n(this,(function(n){switch(n.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(r=this.integrationSource)||void 0===r?[3,1]:(o=r,[3,3]);case 1:return[4,k(i,this.name,this.version,this.options.obfuscate)];case 2:o=n.sent(),n.label=3;case 3:t=o,this.integration=function(t,n,i){var e;"Integration"in t?(t({user:function(){return i.user()},addIntegration:function(){}}),e=t.Integration):e=t;var r=new e(n);return r.analytics=i,r}(t,this.settings,e),this.onReady=new Promise((function(t){s.integration.once("ready",(function(){s._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){s.integration.on("initialize",(function(){s._initialized=!0,t(!0)}))}));try{i.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(t){throw i.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),t}return[2]}}))}))},i.prototype.unload=function(i,o){return function(i,o,s){return t(this,void 0,void 0,(function(){var t,a,u,c;return n(this,(function(n){return t=e(),a=_(i),u=S(i,s),c="".concat(t,"/integrations/").concat(null!=u?u:a,"/").concat(o,"/").concat(null!=u?u:a,".dynamic.js.gz"),[2,r(c)]}))}))}(this.name,this.version,this.options.obfuscate)},i.prototype.addMiddleware=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];this.middleware=(t=this.middleware).concat.apply(t,n)},i.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(s()||!1===this._ready||!1===this._initialized)},i.prototype.send=function(i,e,r){var o,s;return t(this,void 0,void 0,(function(){var t,l,d,h,v,f;return n(this,(function(n){switch(n.label){case 0:if(this.shouldBuffer(i))return this.buffer.push(i),this.scheduleFlush(),[2,i];if(t=null===(s=null===(o=this.options)||void 0===o?void 0:o.plan)||void 0===s?void 0:s.track,l=i.event.event,t&&l&&"Segment.io"!==this.name){if(d=t[l],!b(t,d))return i.updateEvent("integrations",a(a({},i.event.integrations),{All:!1,"Segment.io":!0})),i.cancel(new u({retry:!1,reason:"Event ".concat(l," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i];if(i.updateEvent("integrations",a(a({},i.event.integrations),null==d?void 0:d.integrations)),(null==d?void 0:d.enabled)&&!1===(null==d?void 0:d.integrations[this.name]))return i.cancel(new u({retry:!1,reason:"Event ".concat(l," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i]}return[4,c(this.name,i.event,this.middleware)];case 1:if(null===(h=n.sent()))return[2,i];v=new e(h,{traverse:!this.disableAutoISOConversion}),i.stats.increment("analytics_js.integration.invoke",1,["method:".concat(r),"integration_name:".concat(this.name)]),n.label=2;case 2:return n.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,r,v)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:throw f=n.sent(),i.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(r),"integration_name:".concat(this.name)]),f;case 6:return[2,i]}}))}))},i.prototype.track=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Track,"track")]}))}))},i.prototype.page=function(i){var e;return t(this,void 0,void 0,(function(){var t=this;return n(this,(function(n){return(null===(e=this.integration)||void 0===e?void 0:e._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return t.send(i,l.Page,"page")}))]}))}))},i.prototype.identify=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Identify,"identify")]}))}))},i.prototype.alias=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Alias,"alias")]}))}))},i.prototype.group=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,l.Group,"group")]}))}))},i.prototype.scheduleFlush=function(){var i=this;this.flushing||setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,z(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},i}();function j(t,n,i,e,r,s){var u,c;if(void 0===i&&(i={}),void 0===e&&(e={}),d())return[];n.plan&&((e=null!=e?e:{}).plan=n.plan);var l=null!==(c=null===(u=n.middlewareSettings)||void 0===u?void 0:u.routingRules)&&void 0!==c?c:[],f=n.integrations,p=e.integrations,g=h(n,null!=e?e:{}),y=null==s?void 0:s.reduce((function(t,n){var i;return a(a({},t),((i={})[function(t){return("Integration"in t?t.Integration:t).prototype.name}(n)]=n,i))}),{}),m=new Set(o(o([],Object.keys(f).filter((function(t){return function(t,n){var i,e=n.type,r=n.bundlingStatus,o=n.versionSettings,s="unbundled"!==r&&("browser"===e||(null===(i=null==o?void 0:o.componentTypes)||void 0===i?void 0:i.includes("browser")));return!t.startsWith("Segment")&&"Iterable"!==t&&s}(t,f[t])})),!0),Object.keys(y||{}).filter((function(t){return v(f[t])||v(null==p?void 0:p[t])})),!0));return Array.from(m).filter((function(t){return!function(t,n){var i=!1===n.All&&void 0===n[t];return!1===n[t]||i}(t,i)})).map((function(n){var i=function(t){var n,i,e,r;return null!==(r=null!==(i=null===(n=null==t?void 0:t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==i?i:null===(e=null==t?void 0:t.versionSettings)||void 0===e?void 0:e.version)&&void 0!==r?r:"latest"}(f[n]),o=new I(n,i,t,g[n],e,null==y?void 0:y[n]);return l.filter((function(t){return t.destinationName===n})).length>0&&r&&o.addMiddleware(r),o}))}export{I as LegacyDestination,j as ajsDestinations};
@@ -1 +1 @@
1
- import{cB as e,cC as t,cM as r,cE as n,cD as a}from"./index-9f3ab170.js";function c(c,i,s){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=i.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,s&&(n=btoa(e).replace(/=/g,"")),i="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(i)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),c.log("error",o),c.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{c as remoteMiddlewares};
1
+ import{cE as e,cF as t,cP as r,cH as n,cG as a}from"./index-81fdebbf.js";function c(c,i,s){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=i.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,s&&(n=btoa(e).replace(/=/g,"")),i="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(i)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),c.log("error",o),c.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{c as remoteMiddlewares};
@@ -1 +1 @@
1
- import{cX as e}from"./index-9f3ab170.js";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(a){if("default"!==a&&!(a in e)){var n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,n.get?n:{enumerable:!0,get:function(){return t[a]}})}}))})),Object.freeze(e)}var a={exports:{}};window;var n=a.exports=function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)a.d(n,i,function(t){return e[t]}.bind(null,i));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}([function(e,t,a){a.r(t);var n="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(a,n){var i=new XMLHttpRequest;for(var r in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(r,t.headers[r]);function o(){var e,t=[],a=[],n={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,r,o){t.push(r=r.toLowerCase()),a.push([r,o]),e=n[r],n[r]=e?e+","+o:o})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:o,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return a},get:function(e){return n[e.toLowerCase()]},has:function(e){return e.toLowerCase()in n}}}}i.withCredentials="include"==t.credentials,i.onload=function(){a(o())},i.onerror=n,i.send(t.body)}))};t.default=n},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=function(){function e(t,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return n(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var n=r(a(3)),i=r(a(4));function r(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=n.default,t.YouTubeAnalytics=i.default},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return n.authToken=a,n.player=e,n.metadata={content:{},playback:{videoPlayer:"Vimeo"}},n.mostRecentHeartbeat=0,n.isPaused=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var a in t)this.registerHandler(a,t[a]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var a=this;this.player.on(e,(function(e){a.updateMetadata(e),t.call(a,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(a,n){var r=e.id;(0,i.default)("https://api.vimeo.com/videos/"+r,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():n(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),n(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(a,n){t.player.getVolume().then((function(n){n&&(t.metadata.playback.sound=100*n),t.metadata.playback.position=e.seconds,a()})).catch(n)}))}}]),t}(r(a(1)).default);t.default=o},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return n.player=e,n.apiKey=a,n.playerLoaded=!1,n.playbackStarted=!1,n.contentStarted=!1,n.isPaused=!1,n.isBuffering=!1,n.isSeeking=!1,n.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},n.metadata=[{playback:{video_player:"youtube"},content:{}}],n.playlistIndex=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,a){var n=e.player.getVideoData(),r=e.player.getPlaylist()||[n.video_id],o=r.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+o+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(a){e.metadata=[];for(var n=0,i=0;i<r.length;i++){var o=a.items[i];e.metadata.push({content:{title:o.snippet.title,description:o.snippet.description,keywords:o.snippet.tags,channel:o.snippet.channelTitle,airdate:o.snippet.publishedAt}}),n+=s(o.contentDetails.duration)}for(i=0;i<r.length;i++)e.metadata[i].playback={total_length:n,video_player:"youtube"};t()})).catch((function(t){e.metadata=r.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),a(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(r(a(1)).default);function s(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=o}]),i=t({__proto__:null,default:e(n)},[n]);export{i};
1
+ import{c_ as e}from"./index-81fdebbf.js";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(a){if("default"!==a&&!(a in e)){var n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,n.get?n:{enumerable:!0,get:function(){return t[a]}})}}))})),Object.freeze(e)}var a={exports:{}};window;var n=a.exports=function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)a.d(n,i,function(t){return e[t]}.bind(null,i));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}([function(e,t,a){a.r(t);var n="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(a,n){var i=new XMLHttpRequest;for(var r in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(r,t.headers[r]);function o(){var e,t=[],a=[],n={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,r,o){t.push(r=r.toLowerCase()),a.push([r,o]),e=n[r],n[r]=e?e+","+o:o})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:o,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return a},get:function(e){return n[e.toLowerCase()]},has:function(e){return e.toLowerCase()in n}}}}i.withCredentials="include"==t.credentials,i.onload=function(){a(o())},i.onerror=n,i.send(t.body)}))};t.default=n},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=function(){function e(t,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return n(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var n=r(a(3)),i=r(a(4));function r(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=n.default,t.YouTubeAnalytics=i.default},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return n.authToken=a,n.player=e,n.metadata={content:{},playback:{videoPlayer:"Vimeo"}},n.mostRecentHeartbeat=0,n.isPaused=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var a in t)this.registerHandler(a,t[a]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var a=this;this.player.on(e,(function(e){a.updateMetadata(e),t.call(a,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(a,n){var r=e.id;(0,i.default)("https://api.vimeo.com/videos/"+r,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():n(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),n(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(a,n){t.player.getVolume().then((function(n){n&&(t.metadata.playback.sound=100*n),t.metadata.playback.position=e.seconds,a()})).catch(n)}))}}]),t}(r(a(1)).default);t.default=o},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return n.player=e,n.apiKey=a,n.playerLoaded=!1,n.playbackStarted=!1,n.contentStarted=!1,n.isPaused=!1,n.isBuffering=!1,n.isSeeking=!1,n.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},n.metadata=[{playback:{video_player:"youtube"},content:{}}],n.playlistIndex=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,a){var n=e.player.getVideoData(),r=e.player.getPlaylist()||[n.video_id],o=r.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+o+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(a){e.metadata=[];for(var n=0,i=0;i<r.length;i++){var o=a.items[i];e.metadata.push({content:{title:o.snippet.title,description:o.snippet.description,keywords:o.snippet.tags,channel:o.snippet.channelTitle,airdate:o.snippet.publishedAt}}),n+=s(o.contentDetails.duration)}for(i=0;i<r.length;i++)e.metadata[i].playback={total_length:n,video_player:"youtube"};t()})).catch((function(t){e.metadata=r.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),a(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(r(a(1)).default);function s(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=o}]),i=t({__proto__:null,default:e(n)},[n]);export{i};
@@ -1 +1 @@
1
- import{r as e,bd as r,j as t,cj as n}from"./index-9f3ab170.js";function a({src:n,name:a,environment:s,theme:u,defaultImage:o,...c}){const[i,l]=e.useState(!1),f=e.useMemo((()=>!n||i?o||u&&r(s,u)||"":n),[n,i]);return t("img",{src:f,alt:a,onError:()=>l(!0),...c})}function s(r,t){const a=e.useRef(r),s=e.useRef(0);return n((()=>{a.current=r}),[r]),e.useEffect((()=>{if(t||0===t)return s.current=setInterval((()=>a.current()),t),()=>{clearInterval(s.current)}}),[t]),()=>{s.current&&clearInterval(s.current)}}const u=async(e,{retries:r,retryIntervalMs:t,nonRetryable:n,nonRetryableSilently:a})=>{let s=r;try{return await e()}catch(r){if(a&&a(r))return;if(n&&n(r))throw r;if(void 0!==s){if(s<=0)throw r;s-=1}return await((e=0)=>e&&new Promise((r=>setTimeout(r,e))))(t),u(e,{retries:s,retryIntervalMs:t,nonRetryable:n,nonRetryableSilently:a})}};export{a as T,u as r,s as u};
1
+ import{r as e,bf as r,j as t,cm as n}from"./index-81fdebbf.js";function a({src:n,name:a,environment:s,theme:u,defaultImage:o,...c}){const[i,l]=e.useState(!1),f=e.useMemo((()=>!n||i?o||u&&r(s,u)||"":n),[n,i]);return t("img",{src:f,alt:a,onError:()=>l(!0),...c})}function s(r,t){const a=e.useRef(r),s=e.useRef(0);return n((()=>{a.current=r}),[r]),e.useEffect((()=>{if(t||0===t)return s.current=setInterval((()=>a.current()),t),()=>{clearInterval(s.current)}}),[t]),()=>{s.current&&clearInterval(s.current)}}const u=async(e,{retries:r,retryIntervalMs:t,nonRetryable:n,nonRetryableSilently:a})=>{let s=r;try{return await e()}catch(r){if(a&&a(r))return;if(n&&n(r))throw r;if(void 0!==s){if(s<=0)throw r;s-=1}return await((e=0)=>e&&new Promise((r=>setTimeout(r,e))))(t),u(e,{retries:s,retryIntervalMs:t,nonRetryable:n,nonRetryableSilently:a})}};export{a as T,u as r,s as u};