@wistia/vhs 5.0.4 → 5.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
 
2
2
  /*
3
- * @license @wistia/vhs v5.0.4
3
+ * @license @wistia/vhs v5.0.5
4
4
  *
5
5
  * Copyright (c) 2021-2026, Wistia, Inc. and its affiliates.
6
6
  *
7
7
  * This source code is unlicensed, all rights reserved.
8
8
  */
9
9
 
10
- import { hasKey, isArray, isBoolean, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isString, isUndefined } from "@wistia/type-guards";
10
+ import { hasKey, isArray, isBoolean, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isString as isString$1, isUndefined } from "@wistia/type-guards";
11
11
  import { addDays, addMonths, addYears, compareAsc, differenceInCalendarDays, differenceInDays, eachDayOfInterval, eachMonthOfInterval, endOfDay, endOfMonth, getDay, getDaysInMonth, getYear, isAfter, isBefore, isEqual, isFuture, isSameDay, isValid, isWithinInterval, startOfDay, startOfMonth } from "date-fns";
12
12
  import { daysInWeek } from "date-fns/constants";
13
13
  import { ThemeProvider, createGlobalStyle, css, keyframes, styled, useTheme as useTheme$1 } from "styled-components";
@@ -125,7 +125,7 @@ const dateOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
125
125
  * @param {string} options.timeZone - the timezone you want date displayed in, defaults to current users time zone
126
126
  * @returns {string} a formatted date string
127
127
  */
128
- const dateOnlyStringNumeric$1 = (date, { timeZone = defaultTimeZone } = {}) => {
128
+ const dateOnlyStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
129
129
  if (!isDate(date) || isInvalidDate(date)) return "";
130
130
  try {
131
131
  return new Intl.DateTimeFormat(defaultLocales, {
@@ -512,7 +512,7 @@ const millisecondsToDurationISOString = (numberOfMilliseconds) => {
512
512
  const datetimeHelpers = {
513
513
  isDate,
514
514
  dateOnlyString,
515
- dateOnlyStringNumeric: dateOnlyStringNumeric$1,
515
+ dateOnlyStringNumeric,
516
516
  dateOnlyISOString,
517
517
  monthDayStringNumeric,
518
518
  dayOfWeekString,
@@ -664,7 +664,7 @@ const gradientMap = Object.keys(gradients);
664
664
  * @param {GradientName} gradientName - The name of the gradient to retrieve.
665
665
  * @returns {FlattenSimpleInterpolation} The CSS string representing the specified gradient.
666
666
  */
667
- const getBackgroundGradient = (gradientName = void 0) => {
667
+ const getBackgroundGradient = (gradientName) => {
668
668
  return isNotNil(gradientName) ? gradients[gradientName] : gradients.defaultDarkOne;
669
669
  };
670
670
  //#endregion
@@ -677,9 +677,8 @@ const MULTIPLIER = 31;
677
677
  * @returns {GradientName} gradientName
678
678
  */
679
679
  const getSemiRandomBackgroundGradient = (id) => {
680
- let hashCode = null;
681
- if (typeof id === "string" && id) hashCode = Array.from(id).reduce((num, char) => Math.imul(MULTIPLIER, num) + char.charCodeAt(0) || 0, 0);
682
- else return gradientMap[0];
680
+ if (!(typeof id === "string" && id)) return gradientMap[0];
681
+ const hashCode = Array.from(id).reduce((num, char) => Math.imul(MULTIPLIER, num) + char.charCodeAt(0) || 0, 0);
683
682
  return gradientMap[Math.abs(hashCode) % gradientMap.length];
684
683
  };
685
684
  //#endregion
@@ -820,7 +819,7 @@ const coerceToString = (value) => value === null || value === void 0 ? "" : Stri
820
819
  * @param {*} value - a value of any type
821
820
  * @returns {boolean} - whether value is a string
822
821
  */
823
- const isString$1 = (value) => typeof value === "string" || value instanceof String;
822
+ const isString = (value) => typeof value === "string" || value instanceof String;
824
823
  //#endregion
825
824
  //#region src/helpers/stringHelpers/isHttpUrl.ts
826
825
  /**
@@ -830,11 +829,11 @@ const isString$1 = (value) => typeof value === "string" || value instanceof Stri
830
829
  * @return {boolean} - whether string is a valid http url
831
830
  */
832
831
  const isHttpUrl = (str) => {
833
- if (!isString$1(str)) return false;
832
+ if (!isString(str)) return false;
834
833
  try {
835
834
  const url = new URL(str);
836
835
  return url.protocol === "http:" || url.protocol === "https:";
837
- } catch (_) {
836
+ } catch {
838
837
  return false;
839
838
  }
840
839
  };
@@ -850,7 +849,7 @@ const isUrl = (str) => {
850
849
  const protocolAndDomain = /^(?:\w+:)?\/\/(\S+)$/;
851
850
  const localhostDomain = /^localhost[:?\d]*(?:[^:?\d]\S*)?$/;
852
851
  const nonLocalhostDomain = /^[^\s.]+\.\S{2,}$/;
853
- if (!isString$1(str)) return false;
852
+ if (!isString(str)) return false;
854
853
  const match = protocolAndDomain.exec(str);
855
854
  if (!match) return false;
856
855
  const remaining = match[1];
@@ -912,7 +911,7 @@ const stringHelpers = {
912
911
  coerceToBoolean,
913
912
  coerceToString,
914
913
  isHttpUrl,
915
- isString: isString$1,
914
+ isString,
916
915
  isUrl,
917
916
  lowerFirst,
918
917
  removeNewlines,
@@ -2805,8 +2804,8 @@ const buttonStyle = css`
2805
2804
  }}
2806
2805
  `;
2807
2806
  const ButtonStyledComponent = styled.button`
2808
- ${({ $noStyle }) => $noStyle ? buttonResetStyle : buttonStyle}
2809
- `;
2807
+ ${({ $noStyle }) => $noStyle ? buttonResetStyle : buttonStyle}
2808
+ `;
2810
2809
  //#endregion
2811
2810
  //#region src/components/Button/getButtonColor.ts
2812
2811
  const getButtonColor = (colorOverride, variant, allThemeColors) => {
@@ -2919,7 +2918,7 @@ const ToastPortal = ({ children }) => {
2919
2918
  return createPortal(children, container);
2920
2919
  };
2921
2920
  let displayTimer = null;
2922
- const Toast = memo(({ actionInterceptor = void 0, actionLabel = defaultActionLabel, colorOverride = void 0, renderInPlace = false, isOpen = false, message, onClose, timeout = defaultTimeout, variant = defaultVariant, ...otherProps }) => {
2921
+ const Toast = memo(({ actionInterceptor, actionLabel = defaultActionLabel, colorOverride, renderInPlace = false, isOpen = false, message, onClose, timeout = defaultTimeout, variant = defaultVariant, ...otherProps }) => {
2923
2922
  const [showToast, setShowToast] = useState(isOpen);
2924
2923
  const ariaLive = variant === "error" || variant === "warning" ? "assertive" : "polite";
2925
2924
  const stopTimer = useCallback(() => {
@@ -3547,28 +3546,28 @@ const initialRect = {
3547
3546
  const useElementObserver = () => {
3548
3547
  const ref = useRef(null);
3549
3548
  const [rect, setRect] = useState(initialRect);
3550
- const observer = useMemo(() => new window.ResizeObserver((entries) => {
3551
- if (entries[0]) {
3552
- const { width, height, top, left, bottom, right, x, y } = entries[0].contentRect;
3553
- setRect({
3554
- width,
3555
- height,
3556
- top,
3557
- left,
3558
- bottom,
3559
- right,
3560
- x,
3561
- y
3562
- });
3563
- }
3564
- }), []);
3565
3549
  useLayoutEffect(() => {
3566
3550
  if (!ref.current) return;
3551
+ const observer = new window.ResizeObserver((entries) => {
3552
+ if (entries[0]) {
3553
+ const { width, height, top, left, bottom, right, x, y } = entries[0].contentRect;
3554
+ setRect({
3555
+ width,
3556
+ height,
3557
+ top,
3558
+ left,
3559
+ bottom,
3560
+ right,
3561
+ x,
3562
+ y
3563
+ });
3564
+ }
3565
+ });
3567
3566
  observer.observe(ref.current);
3568
3567
  return () => {
3569
3568
  observer.disconnect();
3570
3569
  };
3571
- }, [observer]);
3570
+ }, []);
3572
3571
  return [ref, rect];
3573
3572
  };
3574
3573
  //#endregion
@@ -3830,7 +3829,7 @@ const useUpdateEffect = (effect, dependencies) => {
3830
3829
  };
3831
3830
  //#endregion
3832
3831
  //#region src/hooks/useKeyPressOnce/useKeyPressOnce.ts
3833
- const useKeyPressOnce = (key, keydownHandler = void 0, keyupHandler = void 0) => {
3832
+ const useKeyPressOnce = (key, keydownHandler, keyupHandler) => {
3834
3833
  const [pressed, event] = useKeyPress(key);
3835
3834
  useUpdateEffect(() => {
3836
3835
  if (!pressed && keyupHandler && event !== null) keyupHandler(event);
@@ -4455,7 +4454,7 @@ const TooltipContent = ({ id, active, direction, children, forceState, shouldWra
4455
4454
  const Truncate = ({ children, maxChars, terminator = "...", breakOnWords = false }) => {
4456
4455
  if (isNil(children)) return null;
4457
4456
  const canBeTruncated = children.length + terminator.length >= maxChars;
4458
- if (!isString(children) || maxChars <= 0 || !canBeTruncated) return /* @__PURE__ */ jsx(Fragment, { children });
4457
+ if (!isString$1(children) || maxChars <= 0 || !canBeTruncated) return /* @__PURE__ */ jsx(Fragment, { children });
4459
4458
  let truncatedChild = children.slice(0, maxChars - terminator.length);
4460
4459
  if (breakOnWords) {
4461
4460
  const index = Math.max(truncatedChild.lastIndexOf(" "), truncatedChild.lastIndexOf("\n"));
@@ -4472,7 +4471,7 @@ const TooltipWrapper$1 = styled.div`
4472
4471
  position: relative;
4473
4472
  width: inherit;
4474
4473
  `;
4475
- const Tooltip = ({ label, direction = "top", duration = 2e3, eventType = "hover", forceState = void 0, maxChars = null, children, id = null, shouldWrap = false, backgroundColorOverride, fontColorOverride, ...otherProps }) => {
4474
+ const Tooltip = ({ label, direction = "top", duration = 2e3, eventType = "hover", forceState, maxChars = null, children, id = null, shouldWrap = false, backgroundColorOverride, fontColorOverride, ...otherProps }) => {
4476
4475
  const [active, setActive] = useState(false);
4477
4476
  const generatedId = `vhs-tooltip-${useId()}`;
4478
4477
  const tooltipID = useMemo(() => id ?? generatedId, [id, generatedId]);
@@ -4512,7 +4511,7 @@ const Tooltip = ({ label, direction = "top", duration = 2e3, eventType = "hover"
4512
4511
  timer,
4513
4512
  duration
4514
4513
  ]);
4515
- if (isString(label) && !label.length) return /* @__PURE__ */ jsx(Fragment, { children });
4514
+ if (isString$1(label) && !label.length) return /* @__PURE__ */ jsx(Fragment, { children });
4516
4515
  let tooltipLabel = label;
4517
4516
  if (maxChars !== null) tooltipLabel = /* @__PURE__ */ jsx(Truncate, {
4518
4517
  breakOnWords: true,
@@ -4797,7 +4796,7 @@ const IllustrationWrapper = styled.div`
4797
4796
  * [Modal](?path=/docs/components-modal--docs) allows for a separate state control to toggle its visibility and is also more composable
4798
4797
  * allowing for more variation.
4799
4798
  */
4800
- const ActionModal = ({ alignHorizontal = "center", alignVertical = "center", buttons, children, className, elevated = true, fullHeight = false, closeIconColorOverride = void 0, illustration = null, illustrationBackgroundColor = "brandBlue", initialShownState = false, isDismissible = true, onBeforeHide, onHide, onShow, render, title, toggle, width = defaultWidth, ...otherProps }) => {
4799
+ const ActionModal = ({ alignHorizontal = "center", alignVertical = "center", buttons, children, className, elevated = true, fullHeight = false, closeIconColorOverride, illustration = null, illustrationBackgroundColor = "brandBlue", initialShownState = false, isDismissible = true, onBeforeHide, onHide, onShow, render, title, toggle, width = defaultWidth, ...otherProps }) => {
4801
4800
  return /* @__PURE__ */ jsx(ModalBase, {
4802
4801
  className,
4803
4802
  initialShownState,
@@ -4908,7 +4907,7 @@ const containsEmojiCharacter = (char) => {
4908
4907
  return /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu.test(char);
4909
4908
  };
4910
4909
  const formatInitialsForDisplay = (initials) => {
4911
- if (isNil(initials) || isEmptyString(initials) || isString(initials) && containsEmojiCharacter(initials)) return "U";
4910
+ if (isNil(initials) || isEmptyString(initials) || isString$1(initials) && containsEmojiCharacter(initials)) return "U";
4912
4911
  if (typeof initials !== "string") return "U";
4913
4912
  return initials.substring(0, 1).toUpperCase();
4914
4913
  };
@@ -5021,7 +5020,7 @@ const shouldWrap = (src) => {
5021
5020
  };
5022
5021
  const getBackgroundImageValue = (src) => {
5023
5022
  if (src !== void 0 && Array.isArray(src)) return src.map((imageSrc) => shouldWrap(imageSrc) ? `url('${imageSrc}')` : imageSrc).join(", ");
5024
- if (src !== void 0 && src !== "" && isString(src)) return shouldWrap(src) ? `url('${src}')` : src;
5023
+ if (src !== void 0 && src !== "" && isString$1(src)) return shouldWrap(src) ? `url('${src}')` : src;
5025
5024
  };
5026
5025
  const getOverflowStyle = (overflow) => {
5027
5026
  if (overflow !== "") {
@@ -5053,7 +5052,7 @@ const BackgroundImageComponent = styled.div`
5053
5052
  position: relative;
5054
5053
  width: ${({ $elWidth }) => $elWidth};
5055
5054
  `;
5056
- const BackgroundImage = ({ children = void 0, attachment: bgAttachment = "scroll", clip: bgClip = "border-box", color: bgColor = void 0, height: elHeight = "auto", origin: bgOrigin = void 0, overflow: elOverflow = "hidden", position: bgPosition = "center", repeat: bgRepeat = "no-repeat", size: bgSize = "cover", src: bgImage = void 0, width: elWidth = "100%", ...otherProps }) => /* @__PURE__ */ jsx(BackgroundImageComponent, {
5055
+ const BackgroundImage = ({ children, attachment: bgAttachment = "scroll", clip: bgClip = "border-box", color: bgColor, height: elHeight = "auto", origin: bgOrigin, overflow: elOverflow = "hidden", position: bgPosition = "center", repeat: bgRepeat = "no-repeat", size: bgSize = "cover", src: bgImage, width: elWidth = "100%", ...otherProps }) => /* @__PURE__ */ jsx(BackgroundImageComponent, {
5057
5056
  $bgAttachment: bgAttachment,
5058
5057
  $bgClip: bgClip,
5059
5058
  $bgColor: bgColor,
@@ -6157,7 +6156,7 @@ const DividerComponent = styled.hr`
6157
6156
  line-height: 0;
6158
6157
  margin: 0;
6159
6158
  `;
6160
- const Divider = ({ colorOverride = void 0, height = 1, variant = "dashed", ...otherProps }) => {
6159
+ const Divider = ({ colorOverride, height = 1, variant = "dashed", ...otherProps }) => {
6161
6160
  const defaultFillColor = useThemeColor("grey300");
6162
6161
  return /* @__PURE__ */ jsx(DividerComponent, {
6163
6162
  $borderHeight: height,
@@ -6661,15 +6660,15 @@ const inputStyle = css`
6661
6660
  }
6662
6661
  `;
6663
6662
  const InputStyledComponent = styled.input`
6664
- ${inputStyle}
6665
- ${({ as }) => as === "textarea" && textareaStyle};
6666
- ${({ as }) => as !== "textarea" && ellipsisStyle};
6667
- ${({ $clickToCopy }) => $clickToCopy && clickToCopyStyle};
6668
- ${({ disabled }) => disabled && disabledStyle$1};
6669
- ${({ $forceState }) => $forceState === "focus" && focusStyle$1};
6670
- ${({ $hasError }) => $hasError && errorStyle$1};
6671
- ${({ readOnly }) => readOnly && readOnlyStyle};
6672
- `;
6663
+ ${inputStyle}
6664
+ ${({ as }) => as === "textarea" && textareaStyle};
6665
+ ${({ as }) => as !== "textarea" && ellipsisStyle};
6666
+ ${({ $clickToCopy }) => $clickToCopy && clickToCopyStyle};
6667
+ ${({ disabled }) => disabled && disabledStyle$1};
6668
+ ${({ $forceState }) => $forceState === "focus" && focusStyle$1};
6669
+ ${({ $hasError }) => $hasError && errorStyle$1};
6670
+ ${({ readOnly }) => readOnly && readOnlyStyle};
6671
+ `;
6673
6672
  //#endregion
6674
6673
  //#region src/components/Input/ClickToCopy.tsx
6675
6674
  const clickToCopyWrapperEnabledStyles = css`
@@ -6780,7 +6779,6 @@ const formatString = (string) => {
6780
6779
  const [initialSeconds, initialMinutes, initialHours] = string.split(":").reverse().map((stringNumber) => parseNumber(stringNumber));
6781
6780
  let seconds = 0;
6782
6781
  let minutes = 0;
6783
- let hours = 0;
6784
6782
  if (isNotNil(initialSeconds)) {
6785
6783
  minutes = Math.floor(initialSeconds / SEC_AND_MIN_MAX);
6786
6784
  if (isNotNil(initialMinutes)) minutes += initialMinutes;
@@ -6789,14 +6787,14 @@ const formatString = (string) => {
6789
6787
  const secondsString = seconds.toString();
6790
6788
  if (secondsString.length === 1) seconds = secondsString.padStart(2, "0");
6791
6789
  const initialHoursOr0 = isNotUndefined(initialHours) ? initialHours : 0;
6792
- hours = Math.floor(minutes / SEC_AND_MIN_MAX) + initialHoursOr0;
6790
+ const hours = Math.floor(minutes / SEC_AND_MIN_MAX) + initialHoursOr0;
6793
6791
  minutes %= SEC_AND_MIN_MAX;
6794
6792
  const minutesString = minutes.toString();
6795
6793
  if (hours && minutesString.length === 1) minutes = minutesString.padStart(2, "0");
6796
6794
  return timeUnitsToString(seconds, minutes, hours);
6797
6795
  };
6798
6796
  const timePositionFormat = (value) => {
6799
- if (isNil(value) || !isString(value)) return "0:00";
6797
+ if (isNil(value) || !isString$1(value)) return "0:00";
6800
6798
  return formatString(stripInvalidCharacters(value));
6801
6799
  };
6802
6800
  //#endregion
@@ -7039,46 +7037,46 @@ const errorStyle = css`
7039
7037
  border: 1px solid ${({ theme }) => theme.color.error500};
7040
7038
  `;
7041
7039
  const SelectStyledComponent = styled.select`
7042
- ${ellipsisStyle}
7043
- appearance: none;
7044
- background-color: white;
7045
- border: 1px solid ${({ theme }) => theme.color.grey400};
7046
- border-radius: 4px;
7047
- color: ${({ theme }) => theme.color.grey900};
7048
- cursor: pointer;
7049
- display: block;
7050
- font-size: 14px;
7051
- height: ${({ multiple }) => multiple ? "66px" : "auto"};
7052
- line-height: 20px;
7053
- margin: 0;
7054
- outline: none;
7040
+ ${ellipsisStyle}
7041
+ appearance: none;
7042
+ background-color: white;
7043
+ border: 1px solid ${({ theme }) => theme.color.grey400};
7044
+ border-radius: 4px;
7045
+ color: ${({ theme }) => theme.color.grey900};
7046
+ cursor: pointer;
7047
+ display: block;
7048
+ font-size: 14px;
7049
+ height: ${({ multiple }) => multiple ? "66px" : "auto"};
7050
+ line-height: 20px;
7051
+ margin: 0;
7052
+ outline: none;
7055
7053
 
7056
- /* selects w/ multiple need to be able to scroll */
7057
- overflow-y: ${({ multiple }) => multiple ? "scroll" : "hidden"};
7054
+ /* selects w/ multiple need to be able to scroll */
7055
+ overflow-y: ${({ multiple }) => multiple ? "scroll" : "hidden"};
7058
7056
 
7059
- /* right padding is to prevent text collision with caret icon */
7060
- padding: ${({ theme }) => `7px ${theme.spacing.space06} 7px ${theme.spacing.space02}`};
7061
- width: 100%;
7057
+ /* right padding is to prevent text collision with caret icon */
7058
+ padding: ${({ theme }) => `7px ${theme.spacing.space06} 7px ${theme.spacing.space02}`};
7059
+ width: 100%;
7062
7060
 
7063
- &:focus {
7064
- ${focusStyle}
7065
- }
7061
+ &:focus {
7062
+ ${focusStyle}
7063
+ }
7066
7064
 
7067
- /* this removes a dotted border around select text when focusing in Firefox */
7068
- &:-moz-focusring {
7069
- color: transparent;
7070
- text-shadow: 0 0 0 #000000;
7071
- }
7065
+ /* this removes a dotted border around select text when focusing in Firefox */
7066
+ &:-moz-focusring {
7067
+ color: transparent;
7068
+ text-shadow: 0 0 0 #000000;
7069
+ }
7072
7070
 
7073
- /* remove drop-down arrow in IE */
7074
- &::-ms-expand {
7075
- display: none;
7076
- }
7071
+ /* remove drop-down arrow in IE */
7072
+ &::-ms-expand {
7073
+ display: none;
7074
+ }
7077
7075
 
7078
- ${({ disabled }) => disabled && disabledStyle}
7079
- ${({ $hasError }) => $hasError && errorStyle}
7076
+ ${({ disabled }) => disabled && disabledStyle}
7077
+ ${({ $hasError }) => $hasError && errorStyle}
7080
7078
  ${({ $forceState }) => $forceState === "focus" && focusStyle};
7081
- `;
7079
+ `;
7082
7080
  //#endregion
7083
7081
  //#region src/components/Select/Select.tsx
7084
7082
  const getSvgColor = (theme, disabled, focused) => {
@@ -7239,9 +7237,9 @@ const escapeHtml = (stringToEscape) => {
7239
7237
  const str = `${stringToEscape}`;
7240
7238
  const match = matchHtmlRegExp.exec(str);
7241
7239
  if (!match) return str;
7242
- let escape = "";
7240
+ let escape;
7243
7241
  let html = "";
7244
- let index = 0;
7242
+ let index;
7245
7243
  let lastIndex = 0;
7246
7244
  for (index = match.index; index < str.length; index++) {
7247
7245
  const charCode = str.charCodeAt(index);
@@ -7368,17 +7366,17 @@ const isCodeBlock = (element) => element.nodeName === "CODE";
7368
7366
  const isInlineCodeBlock = (element, elementChildren) => isCodeBlock(element) && isNotNil(elementChildren[0]) && !elementChildren[0].match(/\n/g);
7369
7367
  const shouldCreateBlock = (el, children) => !isInlineCodeBlock(el, children) && isNotNil(ELEMENT_TAGS[el.nodeName]);
7370
7368
  const shouldCreateText = (el, children) => isInlineCodeBlock(el, children) || isNotNil(TEXT_TAGS[el.nodeName]);
7371
- const htmlChildIsEmptyText = (child) => isNotNil(child) && !isString(child) && child.text?.trim() === "";
7369
+ const htmlChildIsEmptyText = (child) => isNotNil(child) && !isString$1(child) && child.text?.trim() === "";
7372
7370
  const createEditorBlockElements = (children, el) => {
7373
7371
  const { nodeName } = el;
7374
- if (nodeName !== "IMG" && children.length === 1 && !isString(children[0]) && isNotNil(children[0].text) && children[0].text?.trim() === "") return jsx$1("element", ELEMENT_TAGS.P(), emptyTextNode$1);
7372
+ if (nodeName !== "IMG" && children.length === 1 && !isString$1(children[0]) && isNotNil(children[0].text) && children[0].text?.trim() === "") return jsx$1("element", ELEMENT_TAGS.P(), emptyTextNode$1);
7375
7373
  return jsx$1("element", ELEMENT_TAGS[nodeName](el), children);
7376
7374
  };
7377
7375
  const createEditorTextElements = (children, el) => {
7378
7376
  const { nodeName } = el;
7379
7377
  const attrs = TEXT_TAGS[nodeName]();
7380
7378
  return children.map((child) => {
7381
- if (!isString(child) && isNotNil(child) && isNotNil(child.children)) return addAttrsToChildren(child, attrs);
7379
+ if (!isString$1(child) && isNotNil(child) && isNotNil(child.children)) return addAttrsToChildren(child, attrs);
7382
7380
  if (htmlChildIsEmptyText(child)) return jsx$1("text", {}, emptyTextNode$1);
7383
7381
  return jsx$1("text", attrs, child);
7384
7382
  });
@@ -7423,7 +7421,7 @@ const rteDeserializeHTML = (htmlString) => {
7423
7421
  };
7424
7422
  //#endregion
7425
7423
  //#region src/components/RichTextEditor/Leaf.tsx
7426
- const Leaf = ({ attributes = { "data-slate-leaf": true }, children, leaf = {} }) => {
7424
+ const Leaf = ({ attributes, children, leaf }) => {
7427
7425
  let kids = children;
7428
7426
  if (isNotNil(leaf.bold)) kids = /* @__PURE__ */ jsx("strong", { children: kids });
7429
7427
  if (isNotNil(leaf.italic)) kids = /* @__PURE__ */ jsx("em", { children: kids });
@@ -7488,10 +7486,7 @@ const EditorLink = styled.a`
7488
7486
  const EditorSpan = styled.span`
7489
7487
  font-weight: 400;
7490
7488
  `;
7491
- const Element$1 = ({ attributes = {
7492
- "data-slate-node": "element",
7493
- ref: void 0
7494
- }, children = void 0, element = {} }) => {
7489
+ const Element$1 = ({ attributes, children, element }) => {
7495
7490
  const selected = useSelected();
7496
7491
  const focused = useFocused();
7497
7492
  switch (element.type) {
@@ -7942,7 +7937,7 @@ const ButtonContainer = styled.div`
7942
7937
  */
7943
7938
  z-index: 1;
7944
7939
  `;
7945
- const EditorButton = ({ format = "", icon, disabled = false, onCustomClick, buttonType = "block" }) => {
7940
+ const EditorButton = ({ format = "", icon, disabled = false, onCustomClick, buttonType }) => {
7946
7941
  const editor = useSlate();
7947
7942
  const activeButtonColor = useThemeColor("brandBlue500");
7948
7943
  const isActive = buttonType === "block" ? isBlockActive(editor, format) : isMarkActive(editor, format);
@@ -7952,10 +7947,9 @@ const EditorButton = ({ format = "", icon, disabled = false, onCustomClick, butt
7952
7947
  else toggleMark(editor, format);
7953
7948
  if (onCustomClick) onCustomClick(event);
7954
7949
  };
7955
- const buttonColor = isActive ? activeButtonColor : void 0;
7956
7950
  return /* @__PURE__ */ jsx(IconButton, {
7957
7951
  "aria-pressed": isActive,
7958
- colorOverride: buttonColor,
7952
+ colorOverride: isActive ? activeButtonColor : void 0,
7959
7953
  disabled,
7960
7954
  icon,
7961
7955
  label: format,
@@ -8188,7 +8182,7 @@ RichTextEditor.displayName = "RichTextEditor_VHS";
8188
8182
  const Wrapper = styled.div`
8189
8183
  margin-top: ${({ theme }) => theme.spacing.space02};
8190
8184
  `;
8191
- const FormConnectorRichTextEditor = ({ field: { name, value, onChange }, form: { errors }, label, labelDescription, labelProps = {}, placeholder = "", disabled = false, enabledFormats = Object.values(rteFormatTypes), useExternalValue = false, height = void 0, ...otherProps }) => {
8185
+ const FormConnectorRichTextEditor = ({ field: { name, value, onChange }, form: { errors }, label, labelDescription, labelProps = {}, placeholder = "", disabled = false, enabledFormats = Object.values(rteFormatTypes), useExternalValue = false, height, ...otherProps }) => {
8192
8186
  const [rteValue, setRTEValue] = useState(rteDeserializeHTML(coerceToString(value)));
8193
8187
  const labelId = isNotUndefined(label) ? `${name}-label-id` : void 0;
8194
8188
  useEffect(() => {
@@ -8250,7 +8244,7 @@ const fieldsMap = {
8250
8244
  FormConnectorHidden,
8251
8245
  FormConnectorRichTextEditor
8252
8246
  };
8253
- const FormField = forwardRef(({ resize = "vertical", customComponent, direction = "column", disabled = false, label, labelDescription, labelProps = {}, name = "", onChangeCustom, options, placeholder = null, type = "text", ...otherProps }, ref) => /* @__PURE__ */ jsx(FormFieldSet, {
8247
+ const FormField = forwardRef(({ resize = "vertical", customComponent, direction = "column", disabled = false, label, labelDescription, labelProps = {}, name = "", onChangeCustom, options, placeholder = null, type, ...otherProps }, ref) => /* @__PURE__ */ jsx(FormFieldSet, {
8254
8248
  disabled,
8255
8249
  id: `fieldset-${name}`,
8256
8250
  children: /* @__PURE__ */ jsx(FieldWrapper, {
@@ -9079,7 +9073,7 @@ const HeaderText = styled.span`
9079
9073
  font-weight: 700;
9080
9074
  line-height: 24px;
9081
9075
  `;
9082
- const MenuHeader = ({ label, onCloseClick, overrideMenuHeader = void 0 }) => /* @__PURE__ */ jsxs(HeaderAndButton, { children: [isNotNil(overrideMenuHeader) ? overrideMenuHeader : /* @__PURE__ */ jsx(HeaderText, { children: label || "Menu" }), /* @__PURE__ */ jsx(ModalCloseButton$1, { onClick: onCloseClick })] });
9076
+ const MenuHeader = ({ label, onCloseClick, overrideMenuHeader }) => /* @__PURE__ */ jsxs(HeaderAndButton, { children: [isNotNil(overrideMenuHeader) ? overrideMenuHeader : /* @__PURE__ */ jsx(HeaderText, { children: label || "Menu" }), /* @__PURE__ */ jsx(ModalCloseButton$1, { onClick: onCloseClick })] });
9083
9077
  //#endregion
9084
9078
  //#region src/components/MenuButton/MenuButton.tsx
9085
9079
  const MARGIN_BETWEEN_BUTTON_AND_MENU = 8;
@@ -9153,28 +9147,26 @@ const MenuButton = ({ label, menuAlignment = "right", menuItems, menuPosition =
9153
9147
  if (onMenuClick) onMenuClick(event);
9154
9148
  toggleMenuAndRenderItems();
9155
9149
  }, [onMenuClick, toggleMenuAndRenderItems]);
9156
- let MenuTriggerButton = () => /* @__PURE__ */ jsx(Button, {
9157
- ref: dropdownButton,
9158
- "aria-expanded": isMenuVisible,
9159
- disabled,
9160
- forceState: isMenuVisible ? "active" : void 0,
9161
- iconName: "caret-down",
9162
- iconPosition: "end",
9163
- label,
9164
- onClick: onClickButton,
9165
- size,
9166
- ...otherProps
9167
- });
9168
- if (isNotNil(iconButtonComponent)) MenuTriggerButton = () => cloneElement(iconButtonComponent, {
9169
- label,
9170
- onClick: onClickButton,
9171
- ref: dropdownButton,
9172
- disabled,
9173
- "aria-expanded": isMenuVisible,
9174
- ...otherProps
9175
- });
9176
9150
  return /* @__PURE__ */ jsxs(MenuButtonContainer, { children: [
9177
- /* @__PURE__ */ jsx(MenuTriggerButton, {}),
9151
+ isNotNil(iconButtonComponent) ? cloneElement(iconButtonComponent, {
9152
+ label,
9153
+ onClick: onClickButton,
9154
+ ref: dropdownButton,
9155
+ disabled,
9156
+ "aria-expanded": isMenuVisible,
9157
+ ...otherProps
9158
+ }) : /* @__PURE__ */ jsx(Button, {
9159
+ ref: dropdownButton,
9160
+ "aria-expanded": isMenuVisible,
9161
+ disabled,
9162
+ forceState: isMenuVisible ? "active" : void 0,
9163
+ iconName: "caret-down",
9164
+ iconPosition: "end",
9165
+ label,
9166
+ onClick: onClickButton,
9167
+ size,
9168
+ ...otherProps
9169
+ }),
9178
9170
  /* @__PURE__ */ jsx(MenuComponent, {
9179
9171
  $dropdownButtonHeight: dropdownButtonHeight,
9180
9172
  $isMenuVisible: isMenuVisible,
@@ -9257,20 +9249,22 @@ const isMutableRef = (ref) => {
9257
9249
  return isNotNil(ref) && hasKey(ref, "current") && isNotNil(ref.current);
9258
9250
  };
9259
9251
  const useFocusRestore = (ref) => {
9252
+ const timeoutRef = useRef(null);
9260
9253
  useEffect(() => {
9261
- const previousFocus = document.activeElement;
9254
+ const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
9262
9255
  if (isMutableRef(ref)) {
9263
9256
  const el = ref.current;
9264
9257
  if (isNotNil(el)) el.focus();
9265
9258
  }
9266
9259
  return () => {
9267
- if (previousFocus !== null) setTimeout(() => {
9260
+ if (isNotNil(timeoutRef.current)) clearTimeout(timeoutRef.current);
9261
+ if (previousFocus !== null) timeoutRef.current = setTimeout(() => {
9268
9262
  previousFocus.focus();
9269
9263
  }, 0);
9270
9264
  };
9271
9265
  }, [ref]);
9272
9266
  };
9273
- const ModalContent = forwardRef(({ alignHorizontal = "center", alignVertical = "center", allowModalToExceedViewportBounds = false, children, className, fullHeight = false, initialFocusRef, isOpen = false, shouldTrapFocus = true, onRequestClose, shouldCloseOnClickOutside = true, width, overflow = "auto", ...props }, ref) => {
9267
+ const ModalContent = forwardRef(({ alignHorizontal = "center", alignVertical = "center", allowModalToExceedViewportBounds = false, children, className, fullHeight = false, initialFocusRef, isOpen, shouldTrapFocus = true, onRequestClose, shouldCloseOnClickOutside = true, width, overflow = "auto", ...props }, ref) => {
9274
9268
  useFocusRestore(ref);
9275
9269
  const outerRef = useRef(null);
9276
9270
  const focusRef = useFocusTrap(shouldTrapFocus, { focusSelector: isNotUndefined(initialFocusRef) ? initialFocusRef : null });
@@ -9406,7 +9400,7 @@ const ProgressBarLabel = styled.div`
9406
9400
  text-align: right;
9407
9401
  width: 5ch;
9408
9402
  `;
9409
- const ProgressBar = ({ hasLabel = true, progress = 0, colorOverride = void 0, labelColorOverride = void 0, meterBgColorOverride = void 0, ...otherProps }) => {
9403
+ const ProgressBar = ({ hasLabel = true, progress = 0, colorOverride, labelColorOverride, meterBgColorOverride, ...otherProps }) => {
9410
9404
  const clampedProgress = Math.min(Math.max(progress, 0), 1);
9411
9405
  const currentProgress = Math.round(clampedProgress * 100);
9412
9406
  return /* @__PURE__ */ jsxs(ProgressBarContainer, {
@@ -9571,10 +9565,8 @@ const Calendar = ({ displayDate, earliestDate, latestDate, onDisplayDateChange,
9571
9565
  label: date.getFullYear()
9572
9566
  })).reduce((memo, entry) => {
9573
9567
  if (isNotNil(memo[entry.value])) return memo;
9574
- return {
9575
- ...memo,
9576
- [entry.value]: entry
9577
- };
9568
+ Object.assign(memo, { [entry.value]: entry });
9569
+ return memo;
9578
9570
  }, {}));
9579
9571
  const monthOptions = getMonthOptions();
9580
9572
  const yearOptions = getYearOptions();
@@ -9764,7 +9756,6 @@ const RangeSelectorCalendar = ({ range = {
9764
9756
  const internalRange = useRange(firstDate, secondDate);
9765
9757
  const priorInternalRange = usePreviousValue(internalRange);
9766
9758
  const tempRange = useRange(!isValidRange$1(internalRange) && firstDate, hoveredDate);
9767
- const onIsValidChangeDebounced = useMemo(() => debounce(100, onIsValidChange), [onIsValidChange]);
9768
9759
  const setDisplayDateDebounced = useMemo(() => debounce(0, setDisplayDate), []);
9769
9760
  useEffect(() => {
9770
9761
  setDisplayDateDebounced(range.end);
@@ -9782,8 +9773,12 @@ const RangeSelectorCalendar = ({ range = {
9782
9773
  setDisplayDateDebounced
9783
9774
  ]);
9784
9775
  useEffect(() => {
9776
+ const onIsValidChangeDebounced = debounce(100, onIsValidChange);
9785
9777
  onIsValidChangeDebounced(isValidRange$1(internalRange));
9786
- }, [internalRange, onIsValidChangeDebounced]);
9778
+ return () => {
9779
+ onIsValidChangeDebounced.cancel();
9780
+ };
9781
+ }, [internalRange, onIsValidChange]);
9787
9782
  useEffect(() => {
9788
9783
  if (isValidRange$1(range)) {
9789
9784
  let date = void 0;
@@ -9963,7 +9958,7 @@ const getValueParts = (value) => {
9963
9958
  year2: isNonEmptyString(year2Val) ? year2Val : ""
9964
9959
  };
9965
9960
  };
9966
- const dateOnlyStringNumeric = (date) => {
9961
+ const dateOnlyStringNumeric$1 = (date) => {
9967
9962
  if (!isValid(date)) return "";
9968
9963
  try {
9969
9964
  return new Intl.DateTimeFormat(["en-US"], {
@@ -9987,7 +9982,7 @@ const stringToRange = (value) => {
9987
9982
  start: startOfDay(new Date(Number(year1), Number(month1) - 1, Number(day1))),
9988
9983
  end: endOfDay(new Date(Number(year2), Number(month2) - 1, Number(day2)))
9989
9984
  };
9990
- } catch (error) {
9985
+ } catch {
9991
9986
  return;
9992
9987
  }
9993
9988
  };
@@ -10041,16 +10036,16 @@ const getMaxValue = (valueParts, part) => {
10041
10036
  }
10042
10037
  };
10043
10038
  const getErrors = ({ range, maxDate, minDate }) => {
10044
- const startString = dateOnlyStringNumeric(range.start);
10045
- const endString = dateOnlyStringNumeric(range.end);
10039
+ const startString = dateOnlyStringNumeric$1(range.start);
10040
+ const endString = dateOnlyStringNumeric$1(range.end);
10046
10041
  const errorMessages = [];
10047
10042
  if (isNotNil(maxDate)) {
10048
- const maxString = dateOnlyStringNumeric(maxDate);
10043
+ const maxString = dateOnlyStringNumeric$1(maxDate);
10049
10044
  if (isBefore(maxDate, range.start)) errorMessages.push(`${startString} is after maximum of ${maxString}`);
10050
10045
  if (isBefore(maxDate, range.end)) errorMessages.push(`${endString} is after maximum of ${maxString}`);
10051
10046
  }
10052
10047
  if (minDate) {
10053
- const minString = dateOnlyStringNumeric(minDate);
10048
+ const minString = dateOnlyStringNumeric$1(minDate);
10054
10049
  if (isBefore(range.start, minDate)) errorMessages.push(`${startString} is before minimum of ${minString}`);
10055
10050
  if (isBefore(range.end, minDate)) errorMessages.push(`${endString} is before minimum of ${minString}`);
10056
10051
  }
@@ -10653,10 +10648,10 @@ const Slider = ({ ariaLabel, ariaLabelledby, ariaValuetext, disabled = false, in
10653
10648
  "data-testid": dataTestId,
10654
10649
  disabled,
10655
10650
  children: /* @__PURE__ */ jsx(ReactSlider, {
10656
- ...isString(ariaLabel) || isNonEmptyArray(ariaLabel) ? { ariaLabel } : {},
10657
- ...isString(ariaLabelledby) || isNonEmptyArray(ariaLabelledby) ? { ariaLabelledby } : {},
10651
+ ...isString$1(ariaLabel) || isNonEmptyArray(ariaLabel) ? { ariaLabel } : {},
10652
+ ...isString$1(ariaLabelledby) || isNonEmptyArray(ariaLabelledby) ? { ariaLabelledby } : {},
10658
10653
  ...isFunction(ariaValuetext) && { ariaValuetext: (state) => ariaValuetext(state) },
10659
- ...isString(ariaValuetext) && { ariaValuetext },
10654
+ ...isString$1(ariaValuetext) && { ariaValuetext },
10660
10655
  ...isNumber(initialValue) || isNonEmptyArray(initialValue) ? { defaultValue: initialValue } : {},
10661
10656
  disabled,
10662
10657
  marks: step,
@@ -10815,6 +10810,7 @@ const Switch = ({ disabled = false, isChecked = false, onChange, colorOverride,
10815
10810
  "aria-label": ariaLabel,
10816
10811
  onClick: !disabled ? handleClick : void 0,
10817
10812
  role: "switch",
10813
+ tabIndex: 0,
10818
10814
  type: "button",
10819
10815
  ...otherProps,
10820
10816
  children: /* @__PURE__ */ jsx(SwitchKnob, { $hideText: hideText })
@@ -11016,7 +11012,7 @@ const WistiaLogoComponent = styled.svg`
11016
11012
  }
11017
11013
  }
11018
11014
  `;
11019
- const WistiaLogo = ({ description = void 0, height = 100, hoverColor = void 0, href = void 0, iconOnly = false, title = "Wistia Logo", variant = "standard", ...otherProps }) => {
11015
+ const WistiaLogo = ({ description, height = 100, hoverColor, href, iconOnly = false, title = "Wistia Logo", variant = "standard", ...otherProps }) => {
11020
11016
  const primaryColor = "#2949e5";
11021
11017
  const darkColor = "#000934";
11022
11018
  const lightColor = "#ffffff";
@@ -11057,6 +11053,6 @@ const WistiaLogo = ({ description = void 0, height = 100, hoverColor = void 0, h
11057
11053
  };
11058
11054
  WistiaLogo.displayName = "WistiaLogo_VHS";
11059
11055
  //#endregion
11060
- export { ActionModal, Avatar, Backdrop, BackgroundImage, Badge, Banner, Box, Button, ButtonGroup, ButtonLink, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickArea, CloseButton, CollapsibleGroup, Divider, Ellipsis, FileSelect, Form, FormButtons, FormField, FormFieldError, FormGlobalError, FullScreenModal, Icon, IconButton, Image, Input, KeyboardShortcut, Label, LabelDescription, Link, LinkButton, List, ListItem, Menu, MenuButton, MenuItem, MenuLabel, MenuRadioGroup, Modal, ModalBase, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, Paper, ProgressBar, Radio, RadioGroup, RadioMenuItem, RangeSelector, RichTextEditor, ScreenReaderOnly, Select, Slider, Stack, SubMenu, Switch, Text, Thumbnail, ThumbnailCollage, Toast, ToastProvider, Tooltip, Truncate, VHSProvider, WistiaLogo, copyToClipboard, datetimeHelpers, ellipsisFlexParentStyle, ellipsisStyle, getBackgroundGradient, getSemiRandomBackgroundGradient, iconSizeMap, mq, objectHelpers, rteDeserializeHTML, rteFormatTypes, rteSerializeToHTML, screenReaderOnlyStyle, stringHelpers, useBoolean, useClipboard, useElementObserver, useEvent, useFocusTrap, useForceUpdate, useFormikContext, useIsHovered, useKey, useKeyPress, useKeyPressOnce, useLocalStorage, useMergedRefs, useMq, useOnClickOutside, usePreventScroll, usePreviousValue, useTheme, useThemeColor, useToast, useWindowSize };
11056
+ export { ActionModal, Avatar, Backdrop, BackgroundImage, Badge, Banner, Box, Button, ButtonGroup, ButtonLink, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickArea, CloseButton, CollapsibleGroup, Divider, Ellipsis, FileSelect, Form, FormButtons, FormField, FormFieldError, FormGlobalError, FullScreenModal, Icon, IconButton, Image, Input, KeyboardShortcut, Label, LabelDescription, Link, LinkButton, List, ListItem, Menu, MenuButton, MenuItem, MenuLabel, MenuRadioGroup, Modal, ModalBase, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, Paper, ProgressBar, Radio, RadioGroup, RadioMenuItem, RangeSelector, RichTextEditor, ScreenReaderOnly, Select, Slider, Stack, SubMenu, Switch, Text, Thumbnail, ThumbnailCollage, Toast, ToastProvider, Tooltip, Truncate, VHSProvider, WistiaLogo, buildTimeDuration, camelCase, coerceToBoolean, coerceToString, copyToClipboard, dateOnlyISOString, dateOnlyString, dateOnlyStringForSentence, dateOnlyStringNumeric, dateTimeRounded, dateTimeString, dateTimeStringForSentence, dateTimeToDate, dateTimeToISO, dateToDateTime, dateUTCOffset, datetimeHelpers, dayOfWeekString, deepFreeze, ellipsisFlexParentStyle, ellipsisStyle, getBackgroundGradient, getSemiRandomBackgroundGradient, iconSizeMap, isDate, isHttpUrl, isObject, isString, isUrl, lowerFirst, mediaDurationString, merge, millisecondsToDurationISOString, monthDayStringNumeric, mq, objectHelpers, removeNewlines, rteDeserializeHTML, rteFormatTypes, rteSerializeToHTML, screenReaderOnlyStyle, selectKeys, sessionDurationString, stringHelpers, stripExtension, timeAgoString, timeOnlyString, truncate, upperFirst, useBoolean, useClipboard, useElementObserver, useEvent, useFocusTrap, useForceUpdate, useFormikContext, useIsHovered, useKey, useKeyPress, useKeyPressOnce, useLocalStorage, useMergedRefs, useMq, useOnClickOutside, usePreventScroll, usePreviousValue, useTheme, useThemeColor, useToast, useWindowSize };
11061
11057
 
11062
11058
  //# sourceMappingURL=index.js.map