@wistia/wistia-player-react 0.0.47 → 0.0.48

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.
@@ -625,7 +625,8 @@ function _initPublicApi(_x17, _x18) {
625
625
  }
626
626
  function _initPublicApi2() {
627
627
  _initPublicApi2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee21(mediaId, options) {
628
- var _this$api60, _this14 = this, _this$api61;
628
+ var _this14 = this, _this$api60;
629
+ var embeddedCallback;
629
630
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
630
631
  while (1) switch (_context21.prev = _context21.next) {
631
632
  case 0:
@@ -639,8 +640,7 @@ function _initPublicApi2() {
639
640
  (0, _utilities_simpleMetrics_js__WEBPACK_IMPORTED_MODULE_14__.WO)("player/failure/init-failed");
640
641
  throw new Error("Wistia.PublicApi is not defined");
641
642
  case 5:
642
- _classPrivateFieldSet(_api, this, new _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_1__.s.PublicApi(mediaId, options));
643
- (_this$api60 = this.api) === null || _this$api60 === void 0 ? void 0 : _this$api60.embedded(function() {
643
+ embeddedCallback = function embeddedCallback2() {
644
644
  var _classPrivateFieldGet13, _classPrivateFieldGet14;
645
645
  void _assertClassBrand(_WistiaPlayer_brand, _this14, _maybeInitializeMux).call(_this14);
646
646
  _classPrivateFieldSet(_preloadAspectRatio, _this14, void 0);
@@ -651,8 +651,13 @@ function _initPublicApi2() {
651
651
  if (_classPrivateFieldGet(_playPending, _this14)) {
652
652
  void _this14.play();
653
653
  }
654
+ };
655
+ this.addEventListener("embedded", embeddedCallback);
656
+ _classPrivateFieldGet(_removeEventListeners, this).push(function() {
657
+ _this14.removeEventListener("embedded", embeddedCallback);
654
658
  });
655
- (_this$api61 = this.api) === null || _this$api61 === void 0 ? void 0 : _this$api61.ready(function() {
659
+ _classPrivateFieldSet(_api, this, new _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_1__.s.PublicApi(mediaId, options));
660
+ (_this$api60 = this.api) === null || _this$api60 === void 0 ? void 0 : _this$api60.ready(function() {
656
661
  var _this14$api;
657
662
  _this14.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_27__.c5, {
658
663
  detail: {
@@ -673,7 +678,7 @@ function _initPublicApi2() {
673
678
  }
674
679
  _assertClassBrand(_WistiaPlayer_brand, _this14, _renderPreloadThumbnail).call(_this14);
675
680
  });
676
- case 8:
681
+ case 10:
677
682
  case "end":
678
683
  return _context21.stop();
679
684
  }
@@ -959,8 +964,8 @@ var init_wistia_player = __esm({
959
964
  exports.u4 = isRecord;
960
965
  const isEmptyRecord = (x) => (0, exports.u4)(x) && Object.keys(x).length === 0;
961
966
  __webpack_unused_export__ = isEmptyRecord;
962
- const isNonEmptyRecord = (x) => (0, exports.u4)(x) && Object.keys(x).length > 0;
963
- exports.uu = isNonEmptyRecord;
967
+ const isNonEmptyRecord2 = (x) => (0, exports.u4)(x) && Object.keys(x).length > 0;
968
+ exports.uu = isNonEmptyRecord2;
964
969
  const isArray2 = (x) => (0, exports.n9)(x) && typeof x === "object" && x instanceof Array;
965
970
  exports.cy = isArray2;
966
971
  const isNotArray = (x) => !(0, exports.cy)(x);
@@ -1004,10 +1009,10 @@ var init_wistia_player = __esm({
1004
1009
  var _svgs_OldBigPlayButtonSVG_tsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__3(1549);
1005
1010
  var _svgs_BigPlayButtonSVG_tsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__3(7880);
1006
1011
  var _shared_translations_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__3(4730);
1007
- var _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__3(5417);
1008
- var _utilities_core_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__3(1627);
1009
- var _utilities_detect_js__WEBPACK_IMPORTED_MODULE_6__2 = __webpack_require__3(7231);
1010
- var _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__3(1341);
1012
+ var _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__3(5417);
1013
+ var _utilities_core_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__3(1627);
1014
+ var _utilities_detect_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__3(7231);
1015
+ var _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__3(1341);
1011
1016
  var _utilities_interFontFamily_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__3(8213);
1012
1017
  function _slicedToArray2(r, e) {
1013
1018
  return _arrayWithHoles2(r) || _iterableToArrayLimit2(r, e) || _unsupportedIterableToArray2(r, e) || _nonIterableRest2();
@@ -1051,7 +1056,7 @@ var init_wistia_player = __esm({
1051
1056
  function _arrayWithHoles2(r) {
1052
1057
  if (Array.isArray(r)) return r;
1053
1058
  }
1054
- var detect = (0, _utilities_detect_js__WEBPACK_IMPORTED_MODULE_6__2.o1)();
1059
+ var detect = (0, _utilities_detect_js__WEBPACK_IMPORTED_MODULE_7__.o1)();
1055
1060
  var BASE_BUTTON_WIDTH = 125;
1056
1061
  var BASE_BUTTON_HEIGHT = 80;
1057
1062
  var BASE_FONT_SIZE = 18;
@@ -1066,7 +1071,7 @@ var init_wistia_player = __esm({
1066
1071
  var translate = function translate2(key) {
1067
1072
  return (0, _shared_translations_js__WEBPACK_IMPORTED_MODULE_4__.sC)(playerLanguage.code, "PLAY_BUTTON_".concat(key));
1068
1073
  };
1069
- var unescapedVideoName = (0, _utilities_core_js__WEBPACK_IMPORTED_MODULE_5__.Uh)(videoName);
1074
+ var unescapedVideoName = (0, _utilities_core_js__WEBPACK_IMPORTED_MODULE_6__.Uh)(videoName);
1070
1075
  var ariaLabel = "".concat(translate("TITLE_WHEN_NOT_PLAYING"), ": ").concat(unescapedVideoName);
1071
1076
  var wrapperStyle = {
1072
1077
  borderRadius: "".concat(borderRadius, "px"),
@@ -1087,7 +1092,7 @@ var init_wistia_player = __esm({
1087
1092
  width: "".concat(scaledWidth, "px")
1088
1093
  };
1089
1094
  var shouldMixBlendMode = !detect.edge && !noMixBlendMode;
1090
- var blendColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__.Q(color !== null && color !== void 0 ? color : "#000").alpha(1);
1095
+ var blendColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__.Q(color !== null && color !== void 0 ? color : "#000").alpha(1);
1091
1096
  var blendStyle = {
1092
1097
  background: blendColor.toRgba(),
1093
1098
  display: shouldMixBlendMode ? "block" : "none",
@@ -1098,7 +1103,7 @@ var init_wistia_player = __esm({
1098
1103
  top: 0,
1099
1104
  width: "".concat(scaledWidth, "px")
1100
1105
  };
1101
- var overlayColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__.Q(color !== null && color !== void 0 ? color : "#000");
1106
+ var overlayColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__.Q(color !== null && color !== void 0 ? color : "#000");
1102
1107
  var overlayAlphaValue = shouldMixBlendMode ? ALPHA_MIX_BLEND_MODE : ALPHA_NO_MIX_BLEND_MODE;
1103
1108
  overlayColor.alpha(overlayAlphaValue);
1104
1109
  if (isFocused) {
@@ -1161,7 +1166,7 @@ var init_wistia_player = __esm({
1161
1166
  })), shouldDisplayDuration ? (0, preact__WEBPACK_IMPORTED_MODULE_0__2.h)("div", {
1162
1167
  class: "w-bpb-time",
1163
1168
  style: timeStyle
1164
- }, (0, _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_7__.G5)(duration)) : null);
1169
+ }, (0, _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_8__.G5)(duration)) : null);
1165
1170
  };
1166
1171
  }
1167
1172
  ),
@@ -2753,6 +2758,147 @@ var init_wistia_player = __esm({
2753
2758
  }
2754
2759
  ),
2755
2760
  /***/
2761
+ 998: (
2762
+ /***/
2763
+ (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
2764
+ __webpack_require__3.d(__webpack_exports__3, {
2765
+ /* harmony export */
2766
+ K6: () => (
2767
+ /* binding */
2768
+ rgbToHsl
2769
+ ),
2770
+ /* harmony export */
2771
+ bJ: () => (
2772
+ /* binding */
2773
+ getContrast
2774
+ ),
2775
+ /* harmony export */
2776
+ s1: () => (
2777
+ /* binding */
2778
+ colorContrastRatiosByShape
2779
+ )
2780
+ /* harmony export */
2781
+ });
2782
+ var _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__3(4586);
2783
+ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(5417);
2784
+ var _sentryUtils_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__3(2621);
2785
+ var colorContrastRatiosByShape = {
2786
+ nonText: 3,
2787
+ // 3:1 - https://www.w3.org/TR/WCAG21/#non-text-contrast
2788
+ largeText: 3,
2789
+ // 3:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum
2790
+ paragraphText: 4.5,
2791
+ // 4.5:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum
2792
+ smallText: 5.5
2793
+ // We're making this up, but it should be more than the paragraph text
2794
+ };
2795
+ var rgbToHsl = function rgbToHsl2(color) {
2796
+ var colorArray = color;
2797
+ if (color instanceof _color_js__WEBPACK_IMPORTED_MODULE_0__.Q) {
2798
+ if ((0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.r) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.g) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.b)) {
2799
+ throw new Error("Color does not contain required RGB values");
2800
+ }
2801
+ colorArray = [color.r, color.g, color.b];
2802
+ } else if (typeof color === "string") {
2803
+ var colorInstance = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(color);
2804
+ if ((0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.r) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.g) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.b)) {
2805
+ throw new Error("Color does not contain required RGB values");
2806
+ }
2807
+ colorArray = [colorInstance.r, colorInstance.g, colorInstance.b];
2808
+ }
2809
+ var red = colorArray[0] / 255;
2810
+ var green = colorArray[1] / 255;
2811
+ var blue = colorArray[2] / 255;
2812
+ var max = Math.max(red, green, blue);
2813
+ var min = Math.min(red, green, blue);
2814
+ var hue = 0;
2815
+ var saturation = 0;
2816
+ var lightness = (max + min) / 2;
2817
+ if (max === min) {
2818
+ hue = 0;
2819
+ saturation = 0;
2820
+ }
2821
+ var delta = max - min;
2822
+ if (delta === 0) {
2823
+ return {
2824
+ hue,
2825
+ saturation,
2826
+ lightness: red * 100
2827
+ };
2828
+ }
2829
+ if (lightness > 0.5) {
2830
+ saturation = delta / (2 - max - min);
2831
+ } else {
2832
+ saturation = delta / (max + min);
2833
+ }
2834
+ if (max === red) {
2835
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
2836
+ } else if (max === green) {
2837
+ hue = (blue - red) / delta + 2;
2838
+ } else {
2839
+ hue = (red - green) / delta + 4;
2840
+ }
2841
+ hue /= 6;
2842
+ return {
2843
+ hue: hue * 360,
2844
+ saturation: saturation * 100,
2845
+ lightness: lightness * 100
2846
+ };
2847
+ };
2848
+ var getContrast = function getContrast2(foreground, background) {
2849
+ var foregroundColor = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(foreground);
2850
+ var backgroundColor = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(background);
2851
+ var l1 = foregroundColor.getRelativeLuminance();
2852
+ var l2 = backgroundColor.getRelativeLuminance();
2853
+ return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
2854
+ };
2855
+ var adjustColorForProperContrast = function adjustColorForProperContrast2(foreground, background) {
2856
+ var shape = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "paragraphText";
2857
+ var foregroundColor = new Color(foreground);
2858
+ var backgroundColor = new Color(background);
2859
+ if (isNil(foregroundColor.r) || isNil(foregroundColor.g) || isNil(foregroundColor.b)) {
2860
+ throw new Error("Color does not contain required RGB values");
2861
+ }
2862
+ var initialContrastRatio = getContrast(foregroundColor.toHexWithHash(), backgroundColor.toHexWithHash());
2863
+ if (foregroundColor.hasAccessibleContrast(backgroundColor, shape)) {
2864
+ return foregroundColor.toHexWithHash();
2865
+ }
2866
+ var _rgbToHsl = rgbToHsl([foregroundColor.r, foregroundColor.g, foregroundColor.b]), foregroundColorLightness = _rgbToHsl.lightness;
2867
+ var shouldForegroundColorBeLighter = foregroundColorLightness < 0.1 || foregroundColor.getContrastRatio(backgroundColor) > initialContrastRatio;
2868
+ if (foregroundColorLightness > 0.8 && initialContrastRatio === 1) {
2869
+ shouldForegroundColorBeLighter = false;
2870
+ }
2871
+ var adjustedForegroundColor = new Color(foregroundColor);
2872
+ var i2 = 0;
2873
+ while (!adjustedForegroundColor.hasAccessibleContrast(backgroundColor, shape)) {
2874
+ i2 += 1;
2875
+ if (i2 > 1e3) {
2876
+ reportError("other", new Error("Exceeded ".concat(i2, " attempts to find contrasting color")), {
2877
+ key: "adjust-color-for-proper-contrast",
2878
+ foregroundColor: foregroundColor.toHexWithHash(),
2879
+ backgroundColor: backgroundColor.toHexWithHash()
2880
+ });
2881
+ return "#".concat(adjustedForegroundColor.toHex());
2882
+ }
2883
+ var adjustedForegroundColorLuminance = adjustedForegroundColor.getRelativeLuminance();
2884
+ if (i2 > 1 && (adjustedForegroundColorLuminance === 1 || adjustedForegroundColorLuminance === 0)) {
2885
+ if (colorContrastRatiosByShape[shape] > 3) {
2886
+ return getContrast("#fff", backgroundColor.toHexWithHash()) > getContrast("#000", backgroundColor.toHexWithHash()) ? "#fff" : "#000";
2887
+ }
2888
+ shouldForegroundColorBeLighter = !shouldForegroundColorBeLighter;
2889
+ adjustedForegroundColor = foregroundColor;
2890
+ }
2891
+ if (shouldForegroundColorBeLighter) {
2892
+ adjustedForegroundColor.lighten(1);
2893
+ } else {
2894
+ adjustedForegroundColor.darken(1);
2895
+ }
2896
+ }
2897
+ return adjustedForegroundColor.toHexWithHash();
2898
+ };
2899
+ }
2900
+ ),
2901
+ /***/
2756
2902
  1341: (
2757
2903
  /***/
2758
2904
  (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
@@ -4165,6 +4311,78 @@ var init_wistia_player = __esm({
4165
4311
  }
4166
4312
  ),
4167
4313
  /***/
4314
+ 2621: (
4315
+ /***/
4316
+ (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
4317
+ var utilities_trackingConsentApi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(4755);
4318
+ var PLAYER_SAMPLE_RATE = 1e-4;
4319
+ var NON_PLAYER_EMBED_SAMPLE_RATE = 0.25;
4320
+ var IS_DEV_OR_TEST_ENV = (
4321
+ /* unused pure expression or super */
4322
+ null
4323
+ );
4324
+ var configureSentry = function configureSentry2() {
4325
+ if (window.Sentry && typeof window.Sentry.init === "function") {
4326
+ window.Sentry.init({
4327
+ allowUrls: [/^https:\/\/fast.wistia.(?:com|net|io|st)\/.*$/],
4328
+ // Only allow exceptions that are captured from scripts that are served by Wistia
4329
+ dsn: "https://a3591ba5e949a37083cc6f5a4191e903@o4505518331658240.ingest.us.sentry.io/4505794284290048",
4330
+ initialScope: {
4331
+ tags: {
4332
+ pillar: "publish"
4333
+ }
4334
+ },
4335
+ defaultIntegrations: false
4336
+ // We want different sample rates for errors from the player versus errors from forms, channels, and transcripts.
4337
+ // So we don't configure sampleRate here and instead have custom sampling logic in the reportError function.
4338
+ });
4339
+ }
4340
+ };
4341
+ var initializeSentry = function initializeSentry2() {
4342
+ if (!window.Sentry) {
4343
+ var sentryLoader = document.createElement("script");
4344
+ sentryLoader.onload = function() {
4345
+ return configureSentry();
4346
+ };
4347
+ sentryLoader.src = "https://js.sentry-cdn.com/a3591ba5e949a37083cc6f5a4191e903.min.js";
4348
+ sentryLoader.crossOrigin = "anonymous";
4349
+ document.head.appendChild(sentryLoader);
4350
+ }
4351
+ };
4352
+ var reportError2 = function reportError3(product, error, details) {
4353
+ try {
4354
+ var _window$Sentry;
4355
+ if (typeof ((_window$Sentry = window.Sentry) === null || _window$Sentry === void 0 ? void 0 : _window$Sentry.withScope) === "function") {
4356
+ var sampleRate = product === "player" ? PLAYER_SAMPLE_RATE : NON_PLAYER_EMBED_SAMPLE_RATE;
4357
+ var shouldSendToSentry = IS_DEV_OR_TEST_ENV;
4358
+ var cryptoObj = isNil(window.crypto) ? window.msCrypto : window.crypto;
4359
+ if (cryptoObj !== void 0) {
4360
+ var cryptoRandom = cryptoObj.getRandomValues(new Uint32Array(1));
4361
+ shouldSendToSentry = cryptoRandom[0] / (4294967295 + 1) < sampleRate;
4362
+ } else {
4363
+ var mathRandom = Math.random();
4364
+ shouldSendToSentry = mathRandom < sampleRate;
4365
+ }
4366
+ if (!shouldSendToSentry) {
4367
+ console.error(error);
4368
+ } else if (isVisitorTrackingEnabled()) {
4369
+ window.Sentry.withScope(function(scope) {
4370
+ var _window$Sentry2;
4371
+ scope.setTag("product", product);
4372
+ if (isNonEmptyRecord(details)) {
4373
+ scope.setTags(details);
4374
+ }
4375
+ (_window$Sentry2 = window.Sentry) === null || _window$Sentry2 === void 0 ? void 0 : _window$Sentry2.captureException(error);
4376
+ });
4377
+ }
4378
+ }
4379
+ } catch (err) {
4380
+ console.error(err);
4381
+ }
4382
+ };
4383
+ }
4384
+ ),
4385
+ /***/
4168
4386
  7211: (
4169
4387
  /***/
4170
4388
  (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
@@ -7291,10 +7509,11 @@ var init_wistia_player = __esm({
7291
7509
  /* harmony export */
7292
7510
  Q: () => (
7293
7511
  /* binding */
7294
- Color
7512
+ Color2
7295
7513
  )
7296
7514
  /* harmony export */
7297
7515
  });
7516
+ var _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(998);
7298
7517
  function _classCallCheck2(a, n) {
7299
7518
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
7300
7519
  }
@@ -7349,10 +7568,10 @@ var init_wistia_player = __esm({
7349
7568
  }
7350
7569
  return a;
7351
7570
  };
7352
- var Color = /* @__PURE__ */ function() {
7353
- function Color2(input) {
7354
- _classCallCheck2(this, Color2);
7355
- if (input instanceof Color2) {
7571
+ var Color2 = /* @__PURE__ */ function() {
7572
+ function Color3(input) {
7573
+ _classCallCheck2(this, Color3);
7574
+ if (input instanceof Color3) {
7356
7575
  this.r = input.r;
7357
7576
  this.g = input.g;
7358
7577
  this.b = input.b;
@@ -7364,11 +7583,17 @@ var init_wistia_player = __esm({
7364
7583
  this.a = 1;
7365
7584
  }
7366
7585
  }
7367
- return _createClass2(Color2, [{
7586
+ return _createClass2(Color3, [{
7368
7587
  key: "parse",
7369
7588
  value: function parse2(input) {
7370
- input = String(input);
7371
- if (rHex.test(input)) {
7589
+ if (Array.isArray(input)) {
7590
+ var _input$;
7591
+ this.r = input[0];
7592
+ this.g = input[1];
7593
+ this.b = input[2];
7594
+ this.a = (_input$ = input[3]) !== null && _input$ !== void 0 ? _input$ : 1;
7595
+ } else if (rHex.test(input)) {
7596
+ input = String(input);
7372
7597
  var stripped = input.replace(/^#/, "");
7373
7598
  if (stripped.length === 3 || stripped.length === 4) {
7374
7599
  stripped = stripped.replace(hexBit, "$1$1");
@@ -7382,6 +7607,7 @@ var init_wistia_player = __esm({
7382
7607
  this.a = 1;
7383
7608
  }
7384
7609
  } else if (rRgb.test(input)) {
7610
+ input = String(input);
7385
7611
  var parts = input.match(rRgb);
7386
7612
  this.r = parseFloat(p2v(parts[1]));
7387
7613
  this.g = parseFloat(p2v(parts[2]));
@@ -7397,46 +7623,16 @@ var init_wistia_player = __esm({
7397
7623
  }, {
7398
7624
  key: "clone",
7399
7625
  value: function clone2() {
7400
- return new Color2(this);
7626
+ return new Color3(this);
7401
7627
  }
7402
7628
  // Compute internal HSL values based on internal RGB values.
7403
7629
  }, {
7404
7630
  key: "_hslFromRgb",
7405
7631
  value: function _hslFromRgb() {
7406
- var r = this.r / 255;
7407
- var g = this.g / 255;
7408
- var b = this.b / 255;
7409
- var max = Math.max(r, g, b);
7410
- var min = Math.min(r, g, b);
7411
- var l = (max + min) / 2;
7412
- if (max === min) {
7413
- this._h = this._s = 0;
7414
- }
7415
- var d = max - min;
7416
- var s;
7417
- if (d === 0) {
7418
- this._h = 0;
7419
- this._s = 0;
7420
- this._l = r * 100;
7421
- return this;
7422
- }
7423
- if (l > 0.5) {
7424
- s = d / (2 - max - min);
7425
- } else {
7426
- s = d / (max + min);
7427
- }
7428
- var h;
7429
- if (max === r) {
7430
- h = (g - b) / d + (g < b ? 6 : 0);
7431
- } else if (max === g) {
7432
- h = (b - r) / d + 2;
7433
- } else {
7434
- h = (r - g) / d + 4;
7435
- }
7436
- h /= 6;
7437
- this._h = h * 360;
7438
- this._s = s * 100;
7439
- this._l = l * 100;
7632
+ var _rgbToHsl = (0, _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.K6)([this.r, this.g, this.b]), hue = _rgbToHsl.hue, saturation = _rgbToHsl.saturation, lightness = _rgbToHsl.lightness;
7633
+ this._h = hue;
7634
+ this._s = saturation;
7635
+ this._l = lightness;
7440
7636
  return this;
7441
7637
  }
7442
7638
  // Compute internal RGB values based on internal HSL values.
@@ -7457,7 +7653,11 @@ var init_wistia_player = __esm({
7457
7653
  // the strength of the blend.
7458
7654
  }, {
7459
7655
  key: "blendChannel",
7460
- value: function blendChannel(channel, value, alpha) {
7656
+ value: function blendChannel(channel, value, alpha, shouldUseLrgb) {
7657
+ if (shouldUseLrgb) {
7658
+ this[channel] = Math.sqrt(Math.pow(this[channel], 2) * (1 - alpha) + Math.pow(value, 2) * alpha);
7659
+ return this;
7660
+ }
7461
7661
  this[channel] = alpha * value + (1 - alpha) * this[channel];
7462
7662
  return this;
7463
7663
  }
@@ -7465,13 +7665,32 @@ var init_wistia_player = __esm({
7465
7665
  // channel individually.
7466
7666
  }, {
7467
7667
  key: "blend",
7468
- value: function blend(color, alpha) {
7469
- color = new Color2(color);
7470
- this.blendChannel("r", color.r, alpha);
7471
- this.blendChannel("g", color.g, alpha);
7472
- this.blendChannel("b", color.b, alpha);
7668
+ value: function blend(color, alpha, shouldUseLrgb) {
7669
+ color = new Color3(color);
7670
+ this.blendChannel("r", color.r, alpha, shouldUseLrgb);
7671
+ this.blendChannel("g", color.g, alpha, shouldUseLrgb);
7672
+ this.blendChannel("b", color.b, alpha, shouldUseLrgb);
7473
7673
  return this;
7474
7674
  }
7675
+ // background color can be a string or a Color
7676
+ }, {
7677
+ key: "getContrastRatio",
7678
+ value: function getContrastRatio(backgroundColor) {
7679
+ return (0, _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.bJ)(this.toHexWithHash(), new Color3(backgroundColor).toHexWithHash());
7680
+ }
7681
+ // background color can be a string or a Color
7682
+ // shape will be a key of colorContrastRatiosByShape
7683
+ }, {
7684
+ key: "hasAccessibleContrast",
7685
+ value: function hasAccessibleContrast(backgroundColor, shape) {
7686
+ return this.getContrastRatio(backgroundColor) >= _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.s1[shape];
7687
+ }
7688
+ }, {
7689
+ key: "hue",
7690
+ value: function hue() {
7691
+ this._hslFromRgb();
7692
+ return this._h;
7693
+ }
7475
7694
  // Increase a channel by a fixed value, but within the [0,255] range.
7476
7695
  }, {
7477
7696
  key: "lightenChannel",
@@ -7517,7 +7736,6 @@ var init_wistia_player = __esm({
7517
7736
  }, {
7518
7737
  key: "lightness",
7519
7738
  value: function lightness(l) {
7520
- this._hslFromRgb();
7521
7739
  if (l != null) {
7522
7740
  this._l = Math.max(0, Math.min(100, l));
7523
7741
  this._rgbFromHsl();
@@ -7540,6 +7758,21 @@ var init_wistia_player = __esm({
7540
7758
  }
7541
7759
  return this._s;
7542
7760
  }
7761
+ }, {
7762
+ key: "setHue",
7763
+ value: function setHue(hueValue) {
7764
+ this._hslFromRgb();
7765
+ if (hueValue != null) {
7766
+ this._h = Math.max(0, Math.min(360, hueValue));
7767
+ this._rgbFromHsl();
7768
+ return this;
7769
+ }
7770
+ }
7771
+ }, {
7772
+ key: "shade",
7773
+ value: function shade(percentage, shouldUseLrgb) {
7774
+ return this.blend("#000000", percentage, shouldUseLrgb);
7775
+ }
7543
7776
  // Gray level accounts for the strength of each individual channel.
7544
7777
  // This is more visually accurate than just averaging all the channels.
7545
7778
  }, {
@@ -7547,6 +7780,11 @@ var init_wistia_player = __esm({
7547
7780
  value: function grayLevel() {
7548
7781
  return (0.299 * this.r + 0.587 * this.g + 0.114 * this.b) / 255;
7549
7782
  }
7783
+ }, {
7784
+ key: "tint",
7785
+ value: function tint(percentage, shouldUseLrgb) {
7786
+ return this.blend("#ffffff", percentage, shouldUseLrgb);
7787
+ }
7550
7788
  // The white level is basically paleness, and is determined by the
7551
7789
  // minimum of all the RGB channels.
7552
7790
  }, {
@@ -7554,9 +7792,35 @@ var init_wistia_player = __esm({
7554
7792
  value: function whiteLevel() {
7555
7793
  return Math.min(Math.min(this.r, this.g), this.b);
7556
7794
  }
7795
+ }, {
7796
+ key: "getRelativeLuminance",
7797
+ value: function getRelativeLuminance() {
7798
+ var adjustChannel = function adjustChannel2(givenVal) {
7799
+ var val = givenVal * 3921569e-9;
7800
+ if (val <= 0.03928) {
7801
+ return val / 12.92;
7802
+ }
7803
+ return Math.pow((val + 0.055) / 1.055, 2.4);
7804
+ };
7805
+ var rAdjusted = adjustChannel(this.r);
7806
+ var gAdjusted = adjustChannel(this.g);
7807
+ var bAdjusted = adjustChannel(this.b);
7808
+ return 0.2126 * rAdjusted + 0.7152 * gAdjusted + 0.0722 * bAdjusted;
7809
+ }
7810
+ }, {
7811
+ key: "isDark",
7812
+ value: function isDark(shouldUseRL) {
7813
+ if (shouldUseRL) {
7814
+ return this.getRelativeLuminance() < 0.15;
7815
+ }
7816
+ return this.grayLevel() <= 0.4;
7817
+ }
7557
7818
  }, {
7558
7819
  key: "isLight",
7559
- value: function isLight() {
7820
+ value: function isLight(shouldUseRL) {
7821
+ if (shouldUseRL) {
7822
+ return this.getRelativeLuminance() >= 0.8;
7823
+ }
7560
7824
  return this.grayLevel() > 0.4;
7561
7825
  }
7562
7826
  }, {
@@ -7639,6 +7903,11 @@ var init_wistia_player = __esm({
7639
7903
  }
7640
7904
  return "".concat(a).concat(this.toHex());
7641
7905
  }
7906
+ }, {
7907
+ key: "toHexWithHash",
7908
+ value: function toHexWithHash() {
7909
+ return "#".concat(this.toHex());
7910
+ }
7642
7911
  }, {
7643
7912
  key: "toRgb",
7644
7913
  value: function toRgb() {
@@ -9351,7 +9620,7 @@ var init_wistia_player = __esm({
9351
9620
  var PROD_SSL_EMBED_HOST = "embed-ssl.wistia.com";
9352
9621
  var PROD_FASTLY_SSL_HOST = "embed-fastly.wistia.com";
9353
9622
  var SSL_EMBED_HOST = "embed-ssl.wistia.com";
9354
- var TAGGED_VERSION = "0.0.47";
9623
+ var TAGGED_VERSION = "0.0.48";
9355
9624
  var DEFAULT_PROTOCOL = function() {
9356
9625
  if (typeof window !== "undefined" && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z === window && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z.location) {
9357
9626
  return utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z.location.protocol;
@@ -11930,7 +12199,7 @@ var init_wistia_player = __esm({
11930
12199
  /* harmony export */
11931
12200
  D5: () => (
11932
12201
  /* binding */
11933
- isVisitorTrackingEnabled
12202
+ isVisitorTrackingEnabled2
11934
12203
  )
11935
12204
  /* harmony export */
11936
12205
  });
@@ -11987,7 +12256,7 @@ var init_wistia_player = __esm({
11987
12256
  }
11988
12257
  var consent = function consent2(val) {
11989
12258
  if (val == null) {
11990
- return isVisitorTrackingEnabled();
12259
+ return isVisitorTrackingEnabled2();
11991
12260
  }
11992
12261
  return setVisitorTrackingEnabled(val);
11993
12262
  };
@@ -12028,7 +12297,7 @@ var init_wistia_player = __esm({
12028
12297
  }
12029
12298
  }
12030
12299
  };
12031
- var isVisitorTrackingEnabled = function isVisitorTrackingEnabled2() {
12300
+ var isVisitorTrackingEnabled2 = function isVisitorTrackingEnabled3() {
12032
12301
  if (typeof _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_3__.s._visitorTracking === "boolean") {
12033
12302
  return _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_3__.s._visitorTracking;
12034
12303
  }
@@ -7,7 +7,7 @@ import {
7
7
  import { forwardRef, Suspense, lazy } from "react";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  var WistiaPlayerWrapper = lazy(
10
- async () => import("./WistiaPlayerWrapper-YKWOW7BD.mjs").then((module) => ({
10
+ async () => import("./WistiaPlayerWrapper-FEQ3PAYL.mjs").then((module) => ({
11
11
  default: module.WistiaPlayerWrapper
12
12
  }))
13
13
  );
@@ -22,7 +22,7 @@ var WistiaPlayerWrapper = forwardRef(
22
22
  setSwatchAspectRatio(ratio);
23
23
  });
24
24
  }
25
- void import("./wistia-player-I3TIECGL.mjs");
25
+ void import("./wistia-player-PYTKSONQ.mjs");
26
26
  void customElements.whenDefined("wistia-player").then(() => {
27
27
  setIsWistiaPlayerDefined(true);
28
28
  });
@@ -39,8 +39,8 @@ var __webpack_modules__ = {
39
39
  exports.u4 = isRecord;
40
40
  const isEmptyRecord = (x) => (0, exports.u4)(x) && Object.keys(x).length === 0;
41
41
  __webpack_unused_export__ = isEmptyRecord;
42
- const isNonEmptyRecord = (x) => (0, exports.u4)(x) && Object.keys(x).length > 0;
43
- exports.uu = isNonEmptyRecord;
42
+ const isNonEmptyRecord2 = (x) => (0, exports.u4)(x) && Object.keys(x).length > 0;
43
+ exports.uu = isNonEmptyRecord2;
44
44
  const isArray2 = (x) => (0, exports.n9)(x) && typeof x === "object" && x instanceof Array;
45
45
  exports.cy = isArray2;
46
46
  const isNotArray = (x) => !(0, exports.cy)(x);
@@ -84,10 +84,10 @@ var __webpack_modules__ = {
84
84
  var _svgs_OldBigPlayButtonSVG_tsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__3(1549);
85
85
  var _svgs_BigPlayButtonSVG_tsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__3(7880);
86
86
  var _shared_translations_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__3(4730);
87
- var _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__3(5417);
88
- var _utilities_core_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__3(1627);
89
- var _utilities_detect_js__WEBPACK_IMPORTED_MODULE_6__2 = __webpack_require__3(7231);
90
- var _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__3(1341);
87
+ var _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__3(5417);
88
+ var _utilities_core_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__3(1627);
89
+ var _utilities_detect_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__3(7231);
90
+ var _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__3(1341);
91
91
  var _utilities_interFontFamily_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__3(8213);
92
92
  function _slicedToArray2(r, e) {
93
93
  return _arrayWithHoles2(r) || _iterableToArrayLimit2(r, e) || _unsupportedIterableToArray2(r, e) || _nonIterableRest2();
@@ -131,7 +131,7 @@ var __webpack_modules__ = {
131
131
  function _arrayWithHoles2(r) {
132
132
  if (Array.isArray(r)) return r;
133
133
  }
134
- var detect = (0, _utilities_detect_js__WEBPACK_IMPORTED_MODULE_6__2.o1)();
134
+ var detect = (0, _utilities_detect_js__WEBPACK_IMPORTED_MODULE_7__.o1)();
135
135
  var BASE_BUTTON_WIDTH = 125;
136
136
  var BASE_BUTTON_HEIGHT = 80;
137
137
  var BASE_FONT_SIZE = 18;
@@ -146,7 +146,7 @@ var __webpack_modules__ = {
146
146
  var translate = function translate2(key) {
147
147
  return (0, _shared_translations_js__WEBPACK_IMPORTED_MODULE_4__.sC)(playerLanguage.code, "PLAY_BUTTON_".concat(key));
148
148
  };
149
- var unescapedVideoName = (0, _utilities_core_js__WEBPACK_IMPORTED_MODULE_5__.Uh)(videoName);
149
+ var unescapedVideoName = (0, _utilities_core_js__WEBPACK_IMPORTED_MODULE_6__.Uh)(videoName);
150
150
  var ariaLabel = "".concat(translate("TITLE_WHEN_NOT_PLAYING"), ": ").concat(unescapedVideoName);
151
151
  var wrapperStyle = {
152
152
  borderRadius: "".concat(borderRadius, "px"),
@@ -167,7 +167,7 @@ var __webpack_modules__ = {
167
167
  width: "".concat(scaledWidth, "px")
168
168
  };
169
169
  var shouldMixBlendMode = !detect.edge && !noMixBlendMode;
170
- var blendColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__.Q(color !== null && color !== void 0 ? color : "#000").alpha(1);
170
+ var blendColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__.Q(color !== null && color !== void 0 ? color : "#000").alpha(1);
171
171
  var blendStyle = {
172
172
  background: blendColor.toRgba(),
173
173
  display: shouldMixBlendMode ? "block" : "none",
@@ -178,7 +178,7 @@ var __webpack_modules__ = {
178
178
  top: 0,
179
179
  width: "".concat(scaledWidth, "px")
180
180
  };
181
- var overlayColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_8__.Q(color !== null && color !== void 0 ? color : "#000");
181
+ var overlayColor = new _utilities_color_js__WEBPACK_IMPORTED_MODULE_5__.Q(color !== null && color !== void 0 ? color : "#000");
182
182
  var overlayAlphaValue = shouldMixBlendMode ? ALPHA_MIX_BLEND_MODE : ALPHA_NO_MIX_BLEND_MODE;
183
183
  overlayColor.alpha(overlayAlphaValue);
184
184
  if (isFocused) {
@@ -241,7 +241,7 @@ var __webpack_modules__ = {
241
241
  })), shouldDisplayDuration ? (0, preact__WEBPACK_IMPORTED_MODULE_0__2.h)("div", {
242
242
  class: "w-bpb-time",
243
243
  style: timeStyle
244
- }, (0, _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_7__.G5)(duration)) : null);
244
+ }, (0, _utilities_duration_ts__WEBPACK_IMPORTED_MODULE_8__.G5)(duration)) : null);
245
245
  };
246
246
  }
247
247
  ),
@@ -1833,6 +1833,147 @@ var __webpack_modules__ = {
1833
1833
  }
1834
1834
  ),
1835
1835
  /***/
1836
+ 998: (
1837
+ /***/
1838
+ (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
1839
+ __webpack_require__3.d(__webpack_exports__3, {
1840
+ /* harmony export */
1841
+ K6: () => (
1842
+ /* binding */
1843
+ rgbToHsl
1844
+ ),
1845
+ /* harmony export */
1846
+ bJ: () => (
1847
+ /* binding */
1848
+ getContrast
1849
+ ),
1850
+ /* harmony export */
1851
+ s1: () => (
1852
+ /* binding */
1853
+ colorContrastRatiosByShape
1854
+ )
1855
+ /* harmony export */
1856
+ });
1857
+ var _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__3(4586);
1858
+ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(5417);
1859
+ var _sentryUtils_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__3(2621);
1860
+ var colorContrastRatiosByShape = {
1861
+ nonText: 3,
1862
+ // 3:1 - https://www.w3.org/TR/WCAG21/#non-text-contrast
1863
+ largeText: 3,
1864
+ // 3:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum
1865
+ paragraphText: 4.5,
1866
+ // 4.5:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum
1867
+ smallText: 5.5
1868
+ // We're making this up, but it should be more than the paragraph text
1869
+ };
1870
+ var rgbToHsl = function rgbToHsl2(color) {
1871
+ var colorArray = color;
1872
+ if (color instanceof _color_js__WEBPACK_IMPORTED_MODULE_0__.Q) {
1873
+ if ((0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.r) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.g) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(color.b)) {
1874
+ throw new Error("Color does not contain required RGB values");
1875
+ }
1876
+ colorArray = [color.r, color.g, color.b];
1877
+ } else if (typeof color === "string") {
1878
+ var colorInstance = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(color);
1879
+ if ((0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.r) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.g) || (0, _wistia_type_guards__WEBPACK_IMPORTED_MODULE_2__.gD)(colorInstance.b)) {
1880
+ throw new Error("Color does not contain required RGB values");
1881
+ }
1882
+ colorArray = [colorInstance.r, colorInstance.g, colorInstance.b];
1883
+ }
1884
+ var red = colorArray[0] / 255;
1885
+ var green = colorArray[1] / 255;
1886
+ var blue = colorArray[2] / 255;
1887
+ var max = Math.max(red, green, blue);
1888
+ var min = Math.min(red, green, blue);
1889
+ var hue = 0;
1890
+ var saturation = 0;
1891
+ var lightness = (max + min) / 2;
1892
+ if (max === min) {
1893
+ hue = 0;
1894
+ saturation = 0;
1895
+ }
1896
+ var delta = max - min;
1897
+ if (delta === 0) {
1898
+ return {
1899
+ hue,
1900
+ saturation,
1901
+ lightness: red * 100
1902
+ };
1903
+ }
1904
+ if (lightness > 0.5) {
1905
+ saturation = delta / (2 - max - min);
1906
+ } else {
1907
+ saturation = delta / (max + min);
1908
+ }
1909
+ if (max === red) {
1910
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
1911
+ } else if (max === green) {
1912
+ hue = (blue - red) / delta + 2;
1913
+ } else {
1914
+ hue = (red - green) / delta + 4;
1915
+ }
1916
+ hue /= 6;
1917
+ return {
1918
+ hue: hue * 360,
1919
+ saturation: saturation * 100,
1920
+ lightness: lightness * 100
1921
+ };
1922
+ };
1923
+ var getContrast = function getContrast2(foreground, background) {
1924
+ var foregroundColor = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(foreground);
1925
+ var backgroundColor = new _color_js__WEBPACK_IMPORTED_MODULE_0__.Q(background);
1926
+ var l1 = foregroundColor.getRelativeLuminance();
1927
+ var l2 = backgroundColor.getRelativeLuminance();
1928
+ return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
1929
+ };
1930
+ var adjustColorForProperContrast = function adjustColorForProperContrast2(foreground, background) {
1931
+ var shape = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "paragraphText";
1932
+ var foregroundColor = new Color(foreground);
1933
+ var backgroundColor = new Color(background);
1934
+ if (isNil(foregroundColor.r) || isNil(foregroundColor.g) || isNil(foregroundColor.b)) {
1935
+ throw new Error("Color does not contain required RGB values");
1936
+ }
1937
+ var initialContrastRatio = getContrast(foregroundColor.toHexWithHash(), backgroundColor.toHexWithHash());
1938
+ if (foregroundColor.hasAccessibleContrast(backgroundColor, shape)) {
1939
+ return foregroundColor.toHexWithHash();
1940
+ }
1941
+ var _rgbToHsl = rgbToHsl([foregroundColor.r, foregroundColor.g, foregroundColor.b]), foregroundColorLightness = _rgbToHsl.lightness;
1942
+ var shouldForegroundColorBeLighter = foregroundColorLightness < 0.1 || foregroundColor.getContrastRatio(backgroundColor) > initialContrastRatio;
1943
+ if (foregroundColorLightness > 0.8 && initialContrastRatio === 1) {
1944
+ shouldForegroundColorBeLighter = false;
1945
+ }
1946
+ var adjustedForegroundColor = new Color(foregroundColor);
1947
+ var i2 = 0;
1948
+ while (!adjustedForegroundColor.hasAccessibleContrast(backgroundColor, shape)) {
1949
+ i2 += 1;
1950
+ if (i2 > 1e3) {
1951
+ reportError("other", new Error("Exceeded ".concat(i2, " attempts to find contrasting color")), {
1952
+ key: "adjust-color-for-proper-contrast",
1953
+ foregroundColor: foregroundColor.toHexWithHash(),
1954
+ backgroundColor: backgroundColor.toHexWithHash()
1955
+ });
1956
+ return "#".concat(adjustedForegroundColor.toHex());
1957
+ }
1958
+ var adjustedForegroundColorLuminance = adjustedForegroundColor.getRelativeLuminance();
1959
+ if (i2 > 1 && (adjustedForegroundColorLuminance === 1 || adjustedForegroundColorLuminance === 0)) {
1960
+ if (colorContrastRatiosByShape[shape] > 3) {
1961
+ return getContrast("#fff", backgroundColor.toHexWithHash()) > getContrast("#000", backgroundColor.toHexWithHash()) ? "#fff" : "#000";
1962
+ }
1963
+ shouldForegroundColorBeLighter = !shouldForegroundColorBeLighter;
1964
+ adjustedForegroundColor = foregroundColor;
1965
+ }
1966
+ if (shouldForegroundColorBeLighter) {
1967
+ adjustedForegroundColor.lighten(1);
1968
+ } else {
1969
+ adjustedForegroundColor.darken(1);
1970
+ }
1971
+ }
1972
+ return adjustedForegroundColor.toHexWithHash();
1973
+ };
1974
+ }
1975
+ ),
1976
+ /***/
1836
1977
  1341: (
1837
1978
  /***/
1838
1979
  (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
@@ -3245,6 +3386,78 @@ var __webpack_modules__ = {
3245
3386
  }
3246
3387
  ),
3247
3388
  /***/
3389
+ 2621: (
3390
+ /***/
3391
+ (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
3392
+ var utilities_trackingConsentApi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(4755);
3393
+ var PLAYER_SAMPLE_RATE = 1e-4;
3394
+ var NON_PLAYER_EMBED_SAMPLE_RATE = 0.25;
3395
+ var IS_DEV_OR_TEST_ENV = (
3396
+ /* unused pure expression or super */
3397
+ null
3398
+ );
3399
+ var configureSentry = function configureSentry2() {
3400
+ if (window.Sentry && typeof window.Sentry.init === "function") {
3401
+ window.Sentry.init({
3402
+ allowUrls: [/^https:\/\/fast.wistia.(?:com|net|io|st)\/.*$/],
3403
+ // Only allow exceptions that are captured from scripts that are served by Wistia
3404
+ dsn: "https://a3591ba5e949a37083cc6f5a4191e903@o4505518331658240.ingest.us.sentry.io/4505794284290048",
3405
+ initialScope: {
3406
+ tags: {
3407
+ pillar: "publish"
3408
+ }
3409
+ },
3410
+ defaultIntegrations: false
3411
+ // We want different sample rates for errors from the player versus errors from forms, channels, and transcripts.
3412
+ // So we don't configure sampleRate here and instead have custom sampling logic in the reportError function.
3413
+ });
3414
+ }
3415
+ };
3416
+ var initializeSentry = function initializeSentry2() {
3417
+ if (!window.Sentry) {
3418
+ var sentryLoader = document.createElement("script");
3419
+ sentryLoader.onload = function() {
3420
+ return configureSentry();
3421
+ };
3422
+ sentryLoader.src = "https://js.sentry-cdn.com/a3591ba5e949a37083cc6f5a4191e903.min.js";
3423
+ sentryLoader.crossOrigin = "anonymous";
3424
+ document.head.appendChild(sentryLoader);
3425
+ }
3426
+ };
3427
+ var reportError2 = function reportError3(product, error, details) {
3428
+ try {
3429
+ var _window$Sentry;
3430
+ if (typeof ((_window$Sentry = window.Sentry) === null || _window$Sentry === void 0 ? void 0 : _window$Sentry.withScope) === "function") {
3431
+ var sampleRate = product === "player" ? PLAYER_SAMPLE_RATE : NON_PLAYER_EMBED_SAMPLE_RATE;
3432
+ var shouldSendToSentry = IS_DEV_OR_TEST_ENV;
3433
+ var cryptoObj = isNil(window.crypto) ? window.msCrypto : window.crypto;
3434
+ if (cryptoObj !== void 0) {
3435
+ var cryptoRandom = cryptoObj.getRandomValues(new Uint32Array(1));
3436
+ shouldSendToSentry = cryptoRandom[0] / (4294967295 + 1) < sampleRate;
3437
+ } else {
3438
+ var mathRandom = Math.random();
3439
+ shouldSendToSentry = mathRandom < sampleRate;
3440
+ }
3441
+ if (!shouldSendToSentry) {
3442
+ console.error(error);
3443
+ } else if (isVisitorTrackingEnabled()) {
3444
+ window.Sentry.withScope(function(scope) {
3445
+ var _window$Sentry2;
3446
+ scope.setTag("product", product);
3447
+ if (isNonEmptyRecord(details)) {
3448
+ scope.setTags(details);
3449
+ }
3450
+ (_window$Sentry2 = window.Sentry) === null || _window$Sentry2 === void 0 ? void 0 : _window$Sentry2.captureException(error);
3451
+ });
3452
+ }
3453
+ }
3454
+ } catch (err) {
3455
+ console.error(err);
3456
+ }
3457
+ };
3458
+ }
3459
+ ),
3460
+ /***/
3248
3461
  7211: (
3249
3462
  /***/
3250
3463
  (__unused_webpack_module, __webpack_exports__3, __webpack_require__3) => {
@@ -6371,10 +6584,11 @@ var __webpack_modules__ = {
6371
6584
  /* harmony export */
6372
6585
  Q: () => (
6373
6586
  /* binding */
6374
- Color
6587
+ Color2
6375
6588
  )
6376
6589
  /* harmony export */
6377
6590
  });
6591
+ var _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__3(998);
6378
6592
  function _classCallCheck2(a, n) {
6379
6593
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
6380
6594
  }
@@ -6429,10 +6643,10 @@ var __webpack_modules__ = {
6429
6643
  }
6430
6644
  return a;
6431
6645
  };
6432
- var Color = /* @__PURE__ */ function() {
6433
- function Color2(input) {
6434
- _classCallCheck2(this, Color2);
6435
- if (input instanceof Color2) {
6646
+ var Color2 = /* @__PURE__ */ function() {
6647
+ function Color3(input) {
6648
+ _classCallCheck2(this, Color3);
6649
+ if (input instanceof Color3) {
6436
6650
  this.r = input.r;
6437
6651
  this.g = input.g;
6438
6652
  this.b = input.b;
@@ -6444,11 +6658,17 @@ var __webpack_modules__ = {
6444
6658
  this.a = 1;
6445
6659
  }
6446
6660
  }
6447
- return _createClass2(Color2, [{
6661
+ return _createClass2(Color3, [{
6448
6662
  key: "parse",
6449
6663
  value: function parse2(input) {
6450
- input = String(input);
6451
- if (rHex.test(input)) {
6664
+ if (Array.isArray(input)) {
6665
+ var _input$;
6666
+ this.r = input[0];
6667
+ this.g = input[1];
6668
+ this.b = input[2];
6669
+ this.a = (_input$ = input[3]) !== null && _input$ !== void 0 ? _input$ : 1;
6670
+ } else if (rHex.test(input)) {
6671
+ input = String(input);
6452
6672
  var stripped = input.replace(/^#/, "");
6453
6673
  if (stripped.length === 3 || stripped.length === 4) {
6454
6674
  stripped = stripped.replace(hexBit, "$1$1");
@@ -6462,6 +6682,7 @@ var __webpack_modules__ = {
6462
6682
  this.a = 1;
6463
6683
  }
6464
6684
  } else if (rRgb.test(input)) {
6685
+ input = String(input);
6465
6686
  var parts = input.match(rRgb);
6466
6687
  this.r = parseFloat(p2v(parts[1]));
6467
6688
  this.g = parseFloat(p2v(parts[2]));
@@ -6477,46 +6698,16 @@ var __webpack_modules__ = {
6477
6698
  }, {
6478
6699
  key: "clone",
6479
6700
  value: function clone2() {
6480
- return new Color2(this);
6701
+ return new Color3(this);
6481
6702
  }
6482
6703
  // Compute internal HSL values based on internal RGB values.
6483
6704
  }, {
6484
6705
  key: "_hslFromRgb",
6485
6706
  value: function _hslFromRgb() {
6486
- var r = this.r / 255;
6487
- var g = this.g / 255;
6488
- var b = this.b / 255;
6489
- var max = Math.max(r, g, b);
6490
- var min = Math.min(r, g, b);
6491
- var l = (max + min) / 2;
6492
- if (max === min) {
6493
- this._h = this._s = 0;
6494
- }
6495
- var d = max - min;
6496
- var s;
6497
- if (d === 0) {
6498
- this._h = 0;
6499
- this._s = 0;
6500
- this._l = r * 100;
6501
- return this;
6502
- }
6503
- if (l > 0.5) {
6504
- s = d / (2 - max - min);
6505
- } else {
6506
- s = d / (max + min);
6507
- }
6508
- var h;
6509
- if (max === r) {
6510
- h = (g - b) / d + (g < b ? 6 : 0);
6511
- } else if (max === g) {
6512
- h = (b - r) / d + 2;
6513
- } else {
6514
- h = (r - g) / d + 4;
6515
- }
6516
- h /= 6;
6517
- this._h = h * 360;
6518
- this._s = s * 100;
6519
- this._l = l * 100;
6707
+ var _rgbToHsl = (0, _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.K6)([this.r, this.g, this.b]), hue = _rgbToHsl.hue, saturation = _rgbToHsl.saturation, lightness = _rgbToHsl.lightness;
6708
+ this._h = hue;
6709
+ this._s = saturation;
6710
+ this._l = lightness;
6520
6711
  return this;
6521
6712
  }
6522
6713
  // Compute internal RGB values based on internal HSL values.
@@ -6537,7 +6728,11 @@ var __webpack_modules__ = {
6537
6728
  // the strength of the blend.
6538
6729
  }, {
6539
6730
  key: "blendChannel",
6540
- value: function blendChannel(channel, value, alpha) {
6731
+ value: function blendChannel(channel, value, alpha, shouldUseLrgb) {
6732
+ if (shouldUseLrgb) {
6733
+ this[channel] = Math.sqrt(Math.pow(this[channel], 2) * (1 - alpha) + Math.pow(value, 2) * alpha);
6734
+ return this;
6735
+ }
6541
6736
  this[channel] = alpha * value + (1 - alpha) * this[channel];
6542
6737
  return this;
6543
6738
  }
@@ -6545,13 +6740,32 @@ var __webpack_modules__ = {
6545
6740
  // channel individually.
6546
6741
  }, {
6547
6742
  key: "blend",
6548
- value: function blend(color, alpha) {
6549
- color = new Color2(color);
6550
- this.blendChannel("r", color.r, alpha);
6551
- this.blendChannel("g", color.g, alpha);
6552
- this.blendChannel("b", color.b, alpha);
6743
+ value: function blend(color, alpha, shouldUseLrgb) {
6744
+ color = new Color3(color);
6745
+ this.blendChannel("r", color.r, alpha, shouldUseLrgb);
6746
+ this.blendChannel("g", color.g, alpha, shouldUseLrgb);
6747
+ this.blendChannel("b", color.b, alpha, shouldUseLrgb);
6553
6748
  return this;
6554
6749
  }
6750
+ // background color can be a string or a Color
6751
+ }, {
6752
+ key: "getContrastRatio",
6753
+ value: function getContrastRatio(backgroundColor) {
6754
+ return (0, _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.bJ)(this.toHexWithHash(), new Color3(backgroundColor).toHexWithHash());
6755
+ }
6756
+ // background color can be a string or a Color
6757
+ // shape will be a key of colorContrastRatiosByShape
6758
+ }, {
6759
+ key: "hasAccessibleContrast",
6760
+ value: function hasAccessibleContrast(backgroundColor, shape) {
6761
+ return this.getContrastRatio(backgroundColor) >= _color_utils_ts__WEBPACK_IMPORTED_MODULE_0__.s1[shape];
6762
+ }
6763
+ }, {
6764
+ key: "hue",
6765
+ value: function hue() {
6766
+ this._hslFromRgb();
6767
+ return this._h;
6768
+ }
6555
6769
  // Increase a channel by a fixed value, but within the [0,255] range.
6556
6770
  }, {
6557
6771
  key: "lightenChannel",
@@ -6597,7 +6811,6 @@ var __webpack_modules__ = {
6597
6811
  }, {
6598
6812
  key: "lightness",
6599
6813
  value: function lightness(l) {
6600
- this._hslFromRgb();
6601
6814
  if (l != null) {
6602
6815
  this._l = Math.max(0, Math.min(100, l));
6603
6816
  this._rgbFromHsl();
@@ -6620,6 +6833,21 @@ var __webpack_modules__ = {
6620
6833
  }
6621
6834
  return this._s;
6622
6835
  }
6836
+ }, {
6837
+ key: "setHue",
6838
+ value: function setHue(hueValue) {
6839
+ this._hslFromRgb();
6840
+ if (hueValue != null) {
6841
+ this._h = Math.max(0, Math.min(360, hueValue));
6842
+ this._rgbFromHsl();
6843
+ return this;
6844
+ }
6845
+ }
6846
+ }, {
6847
+ key: "shade",
6848
+ value: function shade(percentage, shouldUseLrgb) {
6849
+ return this.blend("#000000", percentage, shouldUseLrgb);
6850
+ }
6623
6851
  // Gray level accounts for the strength of each individual channel.
6624
6852
  // This is more visually accurate than just averaging all the channels.
6625
6853
  }, {
@@ -6627,6 +6855,11 @@ var __webpack_modules__ = {
6627
6855
  value: function grayLevel() {
6628
6856
  return (0.299 * this.r + 0.587 * this.g + 0.114 * this.b) / 255;
6629
6857
  }
6858
+ }, {
6859
+ key: "tint",
6860
+ value: function tint(percentage, shouldUseLrgb) {
6861
+ return this.blend("#ffffff", percentage, shouldUseLrgb);
6862
+ }
6630
6863
  // The white level is basically paleness, and is determined by the
6631
6864
  // minimum of all the RGB channels.
6632
6865
  }, {
@@ -6634,9 +6867,35 @@ var __webpack_modules__ = {
6634
6867
  value: function whiteLevel() {
6635
6868
  return Math.min(Math.min(this.r, this.g), this.b);
6636
6869
  }
6870
+ }, {
6871
+ key: "getRelativeLuminance",
6872
+ value: function getRelativeLuminance() {
6873
+ var adjustChannel = function adjustChannel2(givenVal) {
6874
+ var val = givenVal * 3921569e-9;
6875
+ if (val <= 0.03928) {
6876
+ return val / 12.92;
6877
+ }
6878
+ return Math.pow((val + 0.055) / 1.055, 2.4);
6879
+ };
6880
+ var rAdjusted = adjustChannel(this.r);
6881
+ var gAdjusted = adjustChannel(this.g);
6882
+ var bAdjusted = adjustChannel(this.b);
6883
+ return 0.2126 * rAdjusted + 0.7152 * gAdjusted + 0.0722 * bAdjusted;
6884
+ }
6885
+ }, {
6886
+ key: "isDark",
6887
+ value: function isDark(shouldUseRL) {
6888
+ if (shouldUseRL) {
6889
+ return this.getRelativeLuminance() < 0.15;
6890
+ }
6891
+ return this.grayLevel() <= 0.4;
6892
+ }
6637
6893
  }, {
6638
6894
  key: "isLight",
6639
- value: function isLight() {
6895
+ value: function isLight(shouldUseRL) {
6896
+ if (shouldUseRL) {
6897
+ return this.getRelativeLuminance() >= 0.8;
6898
+ }
6640
6899
  return this.grayLevel() > 0.4;
6641
6900
  }
6642
6901
  }, {
@@ -6719,6 +6978,11 @@ var __webpack_modules__ = {
6719
6978
  }
6720
6979
  return "".concat(a).concat(this.toHex());
6721
6980
  }
6981
+ }, {
6982
+ key: "toHexWithHash",
6983
+ value: function toHexWithHash() {
6984
+ return "#".concat(this.toHex());
6985
+ }
6722
6986
  }, {
6723
6987
  key: "toRgb",
6724
6988
  value: function toRgb() {
@@ -8431,7 +8695,7 @@ var __webpack_modules__ = {
8431
8695
  var PROD_SSL_EMBED_HOST = "embed-ssl.wistia.com";
8432
8696
  var PROD_FASTLY_SSL_HOST = "embed-fastly.wistia.com";
8433
8697
  var SSL_EMBED_HOST = "embed-ssl.wistia.com";
8434
- var TAGGED_VERSION = "0.0.47";
8698
+ var TAGGED_VERSION = "0.0.48";
8435
8699
  var DEFAULT_PROTOCOL = function() {
8436
8700
  if (typeof window !== "undefined" && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z === window && utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z.location) {
8437
8701
  return utilities_root_js__WEBPACK_IMPORTED_MODULE_0__.z.location.protocol;
@@ -11010,7 +11274,7 @@ var __webpack_modules__ = {
11010
11274
  /* harmony export */
11011
11275
  D5: () => (
11012
11276
  /* binding */
11013
- isVisitorTrackingEnabled
11277
+ isVisitorTrackingEnabled2
11014
11278
  )
11015
11279
  /* harmony export */
11016
11280
  });
@@ -11067,7 +11331,7 @@ var __webpack_modules__ = {
11067
11331
  }
11068
11332
  var consent = function consent2(val) {
11069
11333
  if (val == null) {
11070
- return isVisitorTrackingEnabled();
11334
+ return isVisitorTrackingEnabled2();
11071
11335
  }
11072
11336
  return setVisitorTrackingEnabled(val);
11073
11337
  };
@@ -11108,7 +11372,7 @@ var __webpack_modules__ = {
11108
11372
  }
11109
11373
  }
11110
11374
  };
11111
- var isVisitorTrackingEnabled = function isVisitorTrackingEnabled2() {
11375
+ var isVisitorTrackingEnabled2 = function isVisitorTrackingEnabled3() {
11112
11376
  if (typeof _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_3__.s._visitorTracking === "boolean") {
11113
11377
  return _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_3__.s._visitorTracking;
11114
11378
  }
@@ -14366,7 +14630,8 @@ function _initPublicApi(_x17, _x18) {
14366
14630
  }
14367
14631
  function _initPublicApi2() {
14368
14632
  _initPublicApi2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee21(mediaId, options) {
14369
- var _this$api60, _this14 = this, _this$api61;
14633
+ var _this14 = this, _this$api60;
14634
+ var embeddedCallback;
14370
14635
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
14371
14636
  while (1) switch (_context21.prev = _context21.next) {
14372
14637
  case 0:
@@ -14380,8 +14645,7 @@ function _initPublicApi2() {
14380
14645
  (0, _utilities_simpleMetrics_js__WEBPACK_IMPORTED_MODULE_14__.WO)("player/failure/init-failed");
14381
14646
  throw new Error("Wistia.PublicApi is not defined");
14382
14647
  case 5:
14383
- _classPrivateFieldSet(_api, this, new _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_1__.s.PublicApi(mediaId, options));
14384
- (_this$api60 = this.api) === null || _this$api60 === void 0 ? void 0 : _this$api60.embedded(function() {
14648
+ embeddedCallback = function embeddedCallback2() {
14385
14649
  var _classPrivateFieldGet13, _classPrivateFieldGet14;
14386
14650
  void _assertClassBrand(_WistiaPlayer_brand, _this14, _maybeInitializeMux).call(_this14);
14387
14651
  _classPrivateFieldSet(_preloadAspectRatio, _this14, void 0);
@@ -14392,8 +14656,13 @@ function _initPublicApi2() {
14392
14656
  if (_classPrivateFieldGet(_playPending, _this14)) {
14393
14657
  void _this14.play();
14394
14658
  }
14659
+ };
14660
+ this.addEventListener("embedded", embeddedCallback);
14661
+ _classPrivateFieldGet(_removeEventListeners, this).push(function() {
14662
+ _this14.removeEventListener("embedded", embeddedCallback);
14395
14663
  });
14396
- (_this$api61 = this.api) === null || _this$api61 === void 0 ? void 0 : _this$api61.ready(function() {
14664
+ _classPrivateFieldSet(_api, this, new _wistia_namespace_ts__WEBPACK_IMPORTED_MODULE_1__.s.PublicApi(mediaId, options));
14665
+ (_this$api60 = this.api) === null || _this$api60 === void 0 ? void 0 : _this$api60.ready(function() {
14397
14666
  var _this14$api;
14398
14667
  _this14.dispatchEvent(new CustomEvent(_utilities_eventConstants_ts__WEBPACK_IMPORTED_MODULE_27__.c5, {
14399
14668
  detail: {
@@ -14414,7 +14683,7 @@ function _initPublicApi2() {
14414
14683
  }
14415
14684
  _assertClassBrand(_WistiaPlayer_brand, _this14, _renderPreloadThumbnail).call(_this14);
14416
14685
  });
14417
- case 8:
14686
+ case 10:
14418
14687
  case "end":
14419
14688
  return _context21.stop();
14420
14689
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/wistia-player-react",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "packageManager": "yarn@4.2.2",
5
5
  "description": "An embeddable wistia-player web component and React wrapper to add responsive, lightweight, and SEO-friendly videos to your site.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "start:dev:yalc": "run build:react:dev --watch --yalc"
46
46
  },
47
47
  "dependencies": {
48
- "@wistia/wistia-player": "0.0.47"
48
+ "@wistia/wistia-player": "0.0.48"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@babel/core": "^7.25.2",