@mottosports/motto-video-player 1.0.1-rc.5 → 1.0.1-rc.7

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.mjs CHANGED
@@ -27,11 +27,9 @@ styleInject('/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */\n
27
27
 
28
28
  // src/Player.tsx
29
29
  import { forwardRef, useEffect as useEffect5, useRef as useRef8, useImperativeHandle } from "react";
30
- import shaka2 from "shaka-player/dist/shaka-player.ui";
31
30
 
32
31
  // src/hooks/useShakePlayer.ts
33
32
  import { useRef, useCallback } from "react";
34
- import { Player as ShakaPlayer, polyfill } from "shaka-player/dist/shaka-player.ui";
35
33
  var useShakePlayer = ({
36
34
  src,
37
35
  shakaConfig,
@@ -42,6 +40,7 @@ var useShakePlayer = ({
42
40
  const playerRef = useRef(null);
43
41
  const initializePlayer = useCallback(async (video) => {
44
42
  try {
43
+ const { Player: ShakaPlayer, polyfill } = await import("shaka-player/dist/shaka-player.ui");
45
44
  polyfill.installAll();
46
45
  if (!ShakaPlayer.isBrowserSupported()) {
47
46
  throw new Error("Browser not supported by Shaka Player");
@@ -1240,10 +1239,11 @@ var Player = forwardRef(
1240
1239
  controls: uiRef.current,
1241
1240
  manualStreamStartDate: streamStartDate
1242
1241
  });
1243
- const initializeAds = () => {
1242
+ const initializeAds = async () => {
1244
1243
  if (!imaConfig || !playerRef.current || !videoRef.current) return;
1245
1244
  const adManager = playerRef.current.getAdManager();
1246
1245
  if (!adManager) return;
1246
+ const shaka2 = await import("shaka-player/dist/shaka-player.ui");
1247
1247
  adManager.addEventListener(shaka2.ads?.Utils?.AD_STARTED, () => {
1248
1248
  events?.onAdStart?.();
1249
1249
  });
@@ -1291,7 +1291,7 @@ var Player = forwardRef(
1291
1291
  configureQuality();
1292
1292
  await initializeUI();
1293
1293
  initializeMux();
1294
- initializeAds();
1294
+ await initializeAds();
1295
1295
  initializeChromecast();
1296
1296
  } catch (error) {
1297
1297
  console.error("Error during player initialization:", error);
@@ -1387,40 +1387,8 @@ var Player = forwardRef(
1387
1387
  );
1388
1388
  Player.displayName = "Player";
1389
1389
 
1390
- // src/ClientOnlyPlayer.tsx
1391
- import { forwardRef as forwardRef2, useEffect as useEffect6, useState as useState4 } from "react";
1392
- import { jsx as jsx6 } from "react/jsx-runtime";
1393
- var ClientOnlyPlayer = forwardRef2(
1394
- (props, ref) => {
1395
- const [isClient, setIsClient] = useState4(false);
1396
- useEffect6(() => {
1397
- setIsClient(true);
1398
- }, []);
1399
- if (!isClient) {
1400
- return /* @__PURE__ */ jsx6(
1401
- "div",
1402
- {
1403
- className: props.containerClassName,
1404
- style: {
1405
- width: props.width,
1406
- height: props.height,
1407
- aspectRatio: props.aspectRatio ? props.aspectRatio.toString() : "16/9",
1408
- backgroundColor: "#000",
1409
- display: "flex",
1410
- alignItems: "center",
1411
- justifyContent: "center"
1412
- },
1413
- children: /* @__PURE__ */ jsx6("div", { style: { color: "white" }, children: "Loading player..." })
1414
- }
1415
- );
1416
- }
1417
- return /* @__PURE__ */ jsx6(Player, { ...props, ref });
1418
- }
1419
- );
1420
- ClientOnlyPlayer.displayName = "ClientOnlyPlayer";
1421
-
1422
1390
  // src/Video.tsx
1423
- import { useEffect as useEffect8 } from "react";
1391
+ import { useEffect as useEffect7 } from "react";
1424
1392
  import { twMerge as twMerge3 } from "tailwind-merge";
1425
1393
  import { useQuery } from "@tanstack/react-query";
1426
1394
 
@@ -1571,7 +1539,7 @@ var getErrorType = (error, video) => {
1571
1539
  };
1572
1540
 
1573
1541
  // src/messages/useMessages.tsx
1574
- import { useState as useState5, useEffect as useEffect7 } from "react";
1542
+ import { useState as useState4, useEffect as useEffect6 } from "react";
1575
1543
 
1576
1544
  // src/messages/en.json
1577
1545
  var en_default = {
@@ -1880,9 +1848,9 @@ var getBrowserLanguage = () => {
1880
1848
  }
1881
1849
  };
1882
1850
  var useMessages = (locale) => {
1883
- const [language, setLanguage] = useState5("en");
1884
- const [translations, setTranslations] = useState5(availableLanguages.en);
1885
- useEffect7(() => {
1851
+ const [language, setLanguage] = useState4("en");
1852
+ const [translations, setTranslations] = useState4(availableLanguages.en);
1853
+ useEffect6(() => {
1886
1854
  const lang = !!availableLanguages?.[locale] ? locale : getBrowserLanguage();
1887
1855
  setLanguage(lang);
1888
1856
  setTranslations(availableLanguages[lang]);
@@ -1907,7 +1875,7 @@ var useMessages = (locale) => {
1907
1875
  var useMessages_default = useMessages;
1908
1876
 
1909
1877
  // src/Video.tsx
1910
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1878
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1911
1879
  var Video = ({
1912
1880
  videoId,
1913
1881
  publicKey,
@@ -1943,13 +1911,13 @@ var Video = ({
1943
1911
  const { t } = useMessages_default(locale);
1944
1912
  const activePlaylist = findHLSPlaylist(video);
1945
1913
  const hlsUrl = activePlaylist?.url;
1946
- useEffect8(() => {
1914
+ useEffect7(() => {
1947
1915
  if (events?.onVideoData && video) {
1948
1916
  events.onVideoData(video);
1949
1917
  }
1950
1918
  }, [video, events]);
1951
1919
  if (isLoading || !providedVideoData && !video) {
1952
- return /* @__PURE__ */ jsx7("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx7("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ jsx7(Loading, {}) }) });
1920
+ return /* @__PURE__ */ jsx6("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx6("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ jsx6(Loading, {}) }) });
1953
1921
  }
1954
1922
  if (!isLoading && video && !hlsUrl && events?.onEmptyPlaylists) {
1955
1923
  events.onEmptyPlaylists();
@@ -1962,8 +1930,8 @@ var Video = ({
1962
1930
  }
1963
1931
  const title = t(errorKey) || t("DEFAULT_ERROR");
1964
1932
  const description = t(`${errorKey}_DESCRIPTION`) || t("DEFAULT_ERROR_DESCRIPTION");
1965
- return /* @__PURE__ */ jsx7("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full", children: [
1966
- /* @__PURE__ */ jsx7(
1933
+ return /* @__PURE__ */ jsx6("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full", children: [
1934
+ /* @__PURE__ */ jsx6(
1967
1935
  ErrorScreen,
1968
1936
  {
1969
1937
  title,
@@ -1974,13 +1942,13 @@ var Video = ({
1974
1942
  ] }) });
1975
1943
  }
1976
1944
  if (!hlsUrl) {
1977
- return /* @__PURE__ */ jsx7("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full bg-[#151515]", children: [
1978
- /* @__PURE__ */ jsx7(Title, { title: video?.name || "" }),
1945
+ return /* @__PURE__ */ jsx6("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full bg-[#151515]", children: [
1946
+ /* @__PURE__ */ jsx6(Title, { title: video?.name || "" }),
1979
1947
  children
1980
1948
  ] }) });
1981
1949
  }
1982
1950
  console.log("hlsUrl", hlsUrl);
1983
- return /* @__PURE__ */ jsx7("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx7("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx7(
1951
+ return /* @__PURE__ */ jsx6("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx6("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx6(
1984
1952
  Player,
1985
1953
  {
1986
1954
  ...props,
@@ -1994,10 +1962,10 @@ var Video = ({
1994
1962
  };
1995
1963
 
1996
1964
  // src/Event.tsx
1997
- import { useCallback as useCallback7, useEffect as useEffect9, useState as useState6 } from "react";
1965
+ import { useCallback as useCallback7, useEffect as useEffect8, useState as useState5 } from "react";
1998
1966
  import { twMerge as twMerge4 } from "tailwind-merge";
1999
1967
  import { useQuery as useQuery2 } from "@tanstack/react-query";
2000
- import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1968
+ import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2001
1969
  var Event = ({
2002
1970
  publicKey,
2003
1971
  eventId,
@@ -2027,8 +1995,8 @@ var Event = ({
2027
1995
  retry: queryOptions.retry ?? 3,
2028
1996
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
2029
1997
  });
2030
- const [activePlaylist, setActivePlaylist] = useState6();
2031
- const [activeVideoId, setActiveVideoId] = useState6();
1998
+ const [activePlaylist, setActivePlaylist] = useState5();
1999
+ const [activeVideoId, setActiveVideoId] = useState5();
2032
2000
  const videoIds = eventData?.videoIds ?? [];
2033
2001
  const {
2034
2002
  data: videosData,
@@ -2044,8 +2012,8 @@ var Event = ({
2044
2012
  retry: queryOptions.retry ?? 3,
2045
2013
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
2046
2014
  });
2047
- const [loadingApisState, setLoadingApisState] = useState6(true);
2048
- useEffect9(() => {
2015
+ const [loadingApisState, setLoadingApisState] = useState5(true);
2016
+ useEffect8(() => {
2049
2017
  if (videosData !== void 0) {
2050
2018
  setLoadingApisState(false);
2051
2019
  const videosWithPlaylists = videosData.filter(
@@ -2077,12 +2045,12 @@ var Event = ({
2077
2045
  }
2078
2046
  }, [videosData, eventData]);
2079
2047
  const { t } = useMessages_default(locale);
2080
- useEffect9(() => {
2048
+ useEffect8(() => {
2081
2049
  if (events?.onEventData && eventData) {
2082
2050
  events.onEventData(eventData);
2083
2051
  }
2084
2052
  }, [eventData, events]);
2085
- useEffect9(() => {
2053
+ useEffect8(() => {
2086
2054
  if (events?.onVideoData && activeVideoId && videosData) {
2087
2055
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
2088
2056
  if (activeVideo) {
@@ -2090,10 +2058,10 @@ var Event = ({
2090
2058
  }
2091
2059
  }
2092
2060
  }, [activeVideoId, videosData, events]);
2093
- const [error, setError] = useState6(null);
2094
- const [loadingPlaylist, setLoadingPlaylist] = useState6(true);
2061
+ const [error, setError] = useState5(null);
2062
+ const [loadingPlaylist, setLoadingPlaylist] = useState5(true);
2095
2063
  const videosDataError = videosData?.some((video) => !!video.error);
2096
- useEffect9(() => {
2064
+ useEffect8(() => {
2097
2065
  if (eventError || videosError || videosDataError) {
2098
2066
  const errorObj = eventError || videosError || videosData?.find((video) => !!video.error)?.error && new Error(videosData?.find((video) => !!video.error)?.error) || new Error("default");
2099
2067
  setError(errorObj);
@@ -2104,7 +2072,7 @@ var Event = ({
2104
2072
  setError(null);
2105
2073
  }
2106
2074
  }, [eventError, videosError, videosDataError, videosData, events]);
2107
- useEffect9(() => {
2075
+ useEffect8(() => {
2108
2076
  const eventLoadedWithNoVideos = !isEventLoading && eventData && eventData.videoIds && (!eventData.videoIds || eventData?.videoIds?.length === 0) && !loadingApisState;
2109
2077
  const allApisLoadedWithPotentialVideos = !isEventLoading && !videosIsLoading && eventData && !loadingApisState;
2110
2078
  if (eventLoadedWithNoVideos || allApisLoadedWithPotentialVideos) {
@@ -2114,7 +2082,7 @@ var Event = ({
2114
2082
  if (error) {
2115
2083
  const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
2116
2084
  const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
2117
- return /* @__PURE__ */ jsx8("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx8(
2085
+ return /* @__PURE__ */ jsx7("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx7("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx7(
2118
2086
  ErrorScreen,
2119
2087
  {
2120
2088
  title,
@@ -2126,12 +2094,12 @@ var Event = ({
2126
2094
  events.onEmptyPlaylists();
2127
2095
  }
2128
2096
  if (loadingPlaylist) {
2129
- return /* @__PURE__ */ jsx8("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ jsx8(Loading, {}) }) });
2097
+ return /* @__PURE__ */ jsx7("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx7("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ jsx7(Loading, {}) }) });
2130
2098
  }
2131
2099
  if (activePlaylist && activeVideoId && videosData) {
2132
2100
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
2133
- return /* @__PURE__ */ jsx8("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs6("div", { className: "relative w-full h-full", children: [
2134
- /* @__PURE__ */ jsx8(
2101
+ return /* @__PURE__ */ jsx7("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs6("div", { className: "relative w-full h-full", children: [
2102
+ /* @__PURE__ */ jsx7(
2135
2103
  Player,
2136
2104
  {
2137
2105
  ...props,
@@ -2141,7 +2109,7 @@ var Event = ({
2141
2109
  containerClassName: "w-full h-full"
2142
2110
  }
2143
2111
  ),
2144
- !hideTitle && eventData && /* @__PURE__ */ jsx8(
2112
+ !hideTitle && eventData && /* @__PURE__ */ jsx7(
2145
2113
  TitleAndDescription,
2146
2114
  {
2147
2115
  title: eventData.title,
@@ -2153,7 +2121,7 @@ var Event = ({
2153
2121
  ] }) });
2154
2122
  }
2155
2123
  if (eventData) {
2156
- return /* @__PURE__ */ jsx8("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx8(
2124
+ return /* @__PURE__ */ jsx7("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx7("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx7(
2157
2125
  PreEvent,
2158
2126
  {
2159
2127
  event: eventData,
@@ -2175,12 +2143,12 @@ function PreEvent({
2175
2143
  }) {
2176
2144
  const date = new Date(event.startTime);
2177
2145
  const now = /* @__PURE__ */ new Date();
2178
- const [remainingTime, setRemainingTime] = useState6(
2146
+ const [remainingTime, setRemainingTime] = useState5(
2179
2147
  date.getTime() - now.getTime()
2180
2148
  );
2181
2149
  const shouldBeStarted = remainingTime < 0;
2182
2150
  const { t } = useMessages_default(locale);
2183
- useEffect9(() => {
2151
+ useEffect8(() => {
2184
2152
  const interval = setInterval(() => {
2185
2153
  if (remainingTime < 0) {
2186
2154
  clearInterval(interval);
@@ -2192,7 +2160,7 @@ function PreEvent({
2192
2160
  }, [date, remainingTime]);
2193
2161
  const renderCountdown = useCallback7(() => {
2194
2162
  if (shouldBeStarted) {
2195
- return /* @__PURE__ */ jsx8("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
2163
+ return /* @__PURE__ */ jsx7("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
2196
2164
  }
2197
2165
  const seconds = Math.floor(remainingTime / 1e3) % 60;
2198
2166
  const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
@@ -2200,7 +2168,7 @@ function PreEvent({
2200
2168
  const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
2201
2169
  return /* @__PURE__ */ jsxs6("div", { className: "grid grid-flow-col gap-5 text-center auto-cols-max", children: [
2202
2170
  /* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2203
- /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2171
+ /* @__PURE__ */ jsx7("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx7(
2204
2172
  "span",
2205
2173
  {
2206
2174
  style: { "--value": days },
@@ -2209,10 +2177,10 @@ function PreEvent({
2209
2177
  children: days?.toString()?.padStart(2, "0")
2210
2178
  }
2211
2179
  ) }),
2212
- /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("DAYS") })
2180
+ /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("DAYS") })
2213
2181
  ] }),
2214
2182
  /* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2215
- /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2183
+ /* @__PURE__ */ jsx7("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx7(
2216
2184
  "span",
2217
2185
  {
2218
2186
  style: { "--value": hours },
@@ -2221,10 +2189,10 @@ function PreEvent({
2221
2189
  children: hours?.toString()?.padStart(2, "0")
2222
2190
  }
2223
2191
  ) }),
2224
- /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("HOURS") })
2192
+ /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("HOURS") })
2225
2193
  ] }),
2226
2194
  /* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2227
- /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2195
+ /* @__PURE__ */ jsx7("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx7(
2228
2196
  "span",
2229
2197
  {
2230
2198
  style: { "--value": minutes },
@@ -2233,10 +2201,10 @@ function PreEvent({
2233
2201
  children: minutes?.toString()?.padStart(2, "0")
2234
2202
  }
2235
2203
  ) }),
2236
- /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("MINUTES") })
2204
+ /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("MINUTES") })
2237
2205
  ] }),
2238
2206
  /* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2239
- /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2207
+ /* @__PURE__ */ jsx7("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx7(
2240
2208
  "span",
2241
2209
  {
2242
2210
  style: { "--value": seconds },
@@ -2245,11 +2213,12 @@ function PreEvent({
2245
2213
  children: seconds?.toString()?.padStart(2, "0")
2246
2214
  }
2247
2215
  ) }),
2248
- /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("SECONDS") })
2216
+ /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("SECONDS") })
2249
2217
  ] })
2250
2218
  ] });
2251
2219
  }, [remainingTime, shouldBeStarted, t]);
2252
- return /* @__PURE__ */ jsx8(Fragment, { children: event?.posterUrl ? /* @__PURE__ */ jsxs6(Fragment, { children: [
2220
+ console.log("event", event);
2221
+ return /* @__PURE__ */ jsx7(Fragment, { children: event?.posterUrl ? /* @__PURE__ */ jsxs6(Fragment, { children: [
2253
2222
  /* @__PURE__ */ jsxs6(
2254
2223
  "div",
2255
2224
  {
@@ -2260,12 +2229,12 @@ function PreEvent({
2260
2229
  backgroundSize: "cover"
2261
2230
  },
2262
2231
  children: [
2263
- /* @__PURE__ */ jsx8("div", { className: "absolute inset-0 bg-base-200" }),
2264
- /* @__PURE__ */ jsx8("div", { className: "relative z-10", children: renderCountdown() })
2232
+ /* @__PURE__ */ jsx7("div", { className: "absolute inset-0 bg-base-200" }),
2233
+ /* @__PURE__ */ jsx7("div", { className: "relative z-10", children: renderCountdown() })
2265
2234
  ]
2266
2235
  }
2267
2236
  ),
2268
- !hideTitle && /* @__PURE__ */ jsx8(
2237
+ !hideTitle && /* @__PURE__ */ jsx7(
2269
2238
  TitleAndDescription,
2270
2239
  {
2271
2240
  title: event.title,
@@ -2275,20 +2244,17 @@ function PreEvent({
2275
2244
  }
2276
2245
  )
2277
2246
  ] }) : /* @__PURE__ */ jsxs6(Fragment, { children: [
2278
- /* @__PURE__ */ jsxs6(
2247
+ /* @__PURE__ */ jsx7(
2279
2248
  "div",
2280
2249
  {
2281
2250
  className: "relative overflow-hidden md:rounded-2xl bg-base-200 aspect-video text-base-content flex flex-col justify-center items-center w-full h-full bg-cover bg-center bg-no-repeat",
2282
2251
  style: {
2283
2252
  backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
2284
2253
  },
2285
- children: [
2286
- backgroundImageUrl && /* @__PURE__ */ jsx8("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
2287
- /* @__PURE__ */ jsx8("div", { className: "relative z-10", children: renderCountdown() })
2288
- ]
2254
+ children: /* @__PURE__ */ jsx7("div", { className: "relative z-10", children: renderCountdown() })
2289
2255
  }
2290
2256
  ),
2291
- !hideTitle && /* @__PURE__ */ jsx8(
2257
+ !hideTitle && /* @__PURE__ */ jsx7(
2292
2258
  TitleAndDescription,
2293
2259
  {
2294
2260
  title: event.title,
@@ -2307,7 +2273,7 @@ var TitleAndDescription = ({
2307
2273
  className
2308
2274
  }) => {
2309
2275
  return /* @__PURE__ */ jsxs6("div", { className: twMerge4("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
2310
- /* @__PURE__ */ jsx8("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
2276
+ /* @__PURE__ */ jsx7("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
2311
2277
  startTime ? /* @__PURE__ */ jsxs6("div", { className: "text-sm md:text-base text-base-content/70 m-event-start-time", children: [
2312
2278
  new Date(startTime || "").toLocaleDateString(locale || "default", {
2313
2279
  month: "long",
@@ -2321,15 +2287,15 @@ var TitleAndDescription = ({
2321
2287
  minute: "2-digit"
2322
2288
  })
2323
2289
  ] }) : null,
2324
- description && /* @__PURE__ */ jsx8("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
2290
+ description && /* @__PURE__ */ jsx7("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
2325
2291
  ] });
2326
2292
  };
2327
2293
 
2328
2294
  // src/CreativeWork.tsx
2329
- import { useEffect as useEffect10, useState as useState7 } from "react";
2295
+ import { useEffect as useEffect9, useState as useState6 } from "react";
2330
2296
  import { twMerge as twMerge5 } from "tailwind-merge";
2331
2297
  import { useQuery as useQuery3 } from "@tanstack/react-query";
2332
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2298
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2333
2299
  var CreativeWork = ({
2334
2300
  publicKey,
2335
2301
  creativeWorkId,
@@ -2359,9 +2325,9 @@ var CreativeWork = ({
2359
2325
  retry: queryOptions.retry ?? 3,
2360
2326
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
2361
2327
  });
2362
- const [activePlaylist, setActivePlaylist] = useState7();
2363
- const [activeVideoId, setActiveVideoId] = useState7();
2364
- const [showCountDown, setShowCountDown] = useState7(false);
2328
+ const [activePlaylist, setActivePlaylist] = useState6();
2329
+ const [activeVideoId, setActiveVideoId] = useState6();
2330
+ const [showCountDown, setShowCountDown] = useState6(false);
2365
2331
  const videoIds = creativeWorkData?.videoIds ?? [];
2366
2332
  const {
2367
2333
  data: videosData,
@@ -2377,8 +2343,8 @@ var CreativeWork = ({
2377
2343
  retry: queryOptions.retry ?? 3,
2378
2344
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
2379
2345
  });
2380
- const [loadingApisState, setLoadingApisState] = useState7(true);
2381
- useEffect10(() => {
2346
+ const [loadingApisState, setLoadingApisState] = useState6(true);
2347
+ useEffect9(() => {
2382
2348
  if (videosData !== void 0) {
2383
2349
  setLoadingApisState(false);
2384
2350
  const videosWithPlaylists = videosData.filter(
@@ -2410,7 +2376,7 @@ var CreativeWork = ({
2410
2376
  }
2411
2377
  }, [videosData, creativeWorkData]);
2412
2378
  const { t } = useMessages_default(locale);
2413
- useEffect10(() => {
2379
+ useEffect9(() => {
2414
2380
  if (events?.onCreativeWorkData && creativeWorkData) {
2415
2381
  events.onCreativeWorkData(creativeWorkData);
2416
2382
  }
@@ -2418,7 +2384,7 @@ var CreativeWork = ({
2418
2384
  setShowCountDown(true);
2419
2385
  }
2420
2386
  }, [creativeWorkData, events]);
2421
- useEffect10(() => {
2387
+ useEffect9(() => {
2422
2388
  if (events?.onVideoData && activeVideoId && videosData) {
2423
2389
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
2424
2390
  if (activeVideo) {
@@ -2426,9 +2392,9 @@ var CreativeWork = ({
2426
2392
  }
2427
2393
  }
2428
2394
  }, [activeVideoId, videosData, events]);
2429
- const [error, setError] = useState7(null);
2395
+ const [error, setError] = useState6(null);
2430
2396
  const videosDataError = videosData?.some((video) => !!video.error);
2431
- useEffect10(() => {
2397
+ useEffect9(() => {
2432
2398
  if (creativeWorkError || videosError || videosDataError) {
2433
2399
  const errorObj = creativeWorkError || videosError || videosData?.find((video) => !!video.error)?.error && new Error(videosData?.find((video) => !!video.error)?.error) || new Error("default");
2434
2400
  setError(errorObj);
@@ -2442,7 +2408,7 @@ var CreativeWork = ({
2442
2408
  if (error) {
2443
2409
  const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
2444
2410
  const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
2445
- return /* @__PURE__ */ jsx9("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx9(
2411
+ return /* @__PURE__ */ jsx8("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx8(
2446
2412
  ErrorScreen,
2447
2413
  {
2448
2414
  title,
@@ -2450,8 +2416,8 @@ var CreativeWork = ({
2450
2416
  }
2451
2417
  ) }) });
2452
2418
  }
2453
- const [loadingPlaylist, setLoadingPlaylist] = useState7(true);
2454
- useEffect10(() => {
2419
+ const [loadingPlaylist, setLoadingPlaylist] = useState6(true);
2420
+ useEffect9(() => {
2455
2421
  const creativeWorkLoadedWithNoVideos = !isCreativeWorkLoading && creativeWorkData && creativeWorkData.videoIds && creativeWorkData.videoIds.length === 0;
2456
2422
  const creativeWorkLoadedWithNoData = !isCreativeWorkLoading && creativeWorkData && !creativeWorkData.videoIds;
2457
2423
  const isEventsFinished = !videosIsLoading && videosData && videosData.length > 0 && videosData.every((video) => video.playlists && video.playlists.length === 0);
@@ -2472,10 +2438,10 @@ var CreativeWork = ({
2472
2438
  events
2473
2439
  ]);
2474
2440
  if (isCreativeWorkLoading || videosIsLoading || loadingApisState) {
2475
- return /* @__PURE__ */ jsx9("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx9(Loading, {}) }) });
2441
+ return /* @__PURE__ */ jsx8("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx8(Loading, {}) }) });
2476
2442
  }
2477
2443
  if (showCountDown && creativeWorkData) {
2478
- return /* @__PURE__ */ jsx9("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ jsx9(
2444
+ return /* @__PURE__ */ jsx8("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ jsx8(
2479
2445
  PreCreativeWork,
2480
2446
  {
2481
2447
  creativeWork: creativeWorkData,
@@ -2488,8 +2454,8 @@ var CreativeWork = ({
2488
2454
  }
2489
2455
  if (activeVideoId && activePlaylist && !loadingPlaylist) {
2490
2456
  const activeVideo = videosData?.find((video) => video.id === activeVideoId);
2491
- return /* @__PURE__ */ jsx9("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs7("div", { className: "relative w-full h-full", children: [
2492
- /* @__PURE__ */ jsx9(
2457
+ return /* @__PURE__ */ jsx8("div", { className: twMerge5("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs7("div", { className: "relative w-full h-full", children: [
2458
+ /* @__PURE__ */ jsx8(
2493
2459
  Player,
2494
2460
  {
2495
2461
  ...props,
@@ -2501,7 +2467,7 @@ var CreativeWork = ({
2501
2467
  containerClassName: "w-full h-full"
2502
2468
  }
2503
2469
  ),
2504
- !hideTitle && /* @__PURE__ */ jsx9(
2470
+ !hideTitle && /* @__PURE__ */ jsx8(
2505
2471
  TitleAndDescription2,
2506
2472
  {
2507
2473
  title: creativeWorkData?.title || "",
@@ -2514,7 +2480,7 @@ var CreativeWork = ({
2514
2480
  ] }) });
2515
2481
  }
2516
2482
  if (loadingPlaylist) {
2517
- return /* @__PURE__ */ jsx9(Loading, {});
2483
+ return /* @__PURE__ */ jsx8(Loading, {});
2518
2484
  }
2519
2485
  return null;
2520
2486
  };
@@ -2527,12 +2493,12 @@ function PreCreativeWork({
2527
2493
  }) {
2528
2494
  const date = new Date(creativeWork.releaseTime);
2529
2495
  const now = /* @__PURE__ */ new Date();
2530
- const [remainingTime, setRemainingTime] = useState7(
2496
+ const [remainingTime, setRemainingTime] = useState6(
2531
2497
  date.getTime() - now.getTime()
2532
2498
  );
2533
2499
  const shouldBeStarted = remainingTime < 0;
2534
2500
  const { t } = useMessages_default(locale);
2535
- useEffect10(() => {
2501
+ useEffect9(() => {
2536
2502
  const interval = setInterval(() => {
2537
2503
  if (remainingTime < 0) {
2538
2504
  clearInterval(interval);
@@ -2546,7 +2512,7 @@ function PreCreativeWork({
2546
2512
  }, [date, remainingTime]);
2547
2513
  const renderCountdown = () => {
2548
2514
  if (shouldBeStarted) {
2549
- return /* @__PURE__ */ jsx9("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
2515
+ return /* @__PURE__ */ jsx8("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
2550
2516
  }
2551
2517
  const seconds = Math.floor(remainingTime / 1e3) % 60;
2552
2518
  const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
@@ -2554,7 +2520,7 @@ function PreCreativeWork({
2554
2520
  const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
2555
2521
  return /* @__PURE__ */ jsxs7("div", { className: "grid grid-flow-col gap-5 text-center auto-cols-max", children: [
2556
2522
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2557
- /* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx9(
2523
+ /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2558
2524
  "span",
2559
2525
  {
2560
2526
  style: { "--value": days },
@@ -2563,10 +2529,10 @@ function PreCreativeWork({
2563
2529
  children: days?.toString()?.padStart(2, "0")
2564
2530
  }
2565
2531
  ) }),
2566
- /* @__PURE__ */ jsx9("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("DAYS") })
2532
+ /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("DAYS") })
2567
2533
  ] }),
2568
2534
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2569
- /* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx9(
2535
+ /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2570
2536
  "span",
2571
2537
  {
2572
2538
  style: { "--value": hours },
@@ -2575,10 +2541,10 @@ function PreCreativeWork({
2575
2541
  children: hours?.toString()?.padStart(2, "0")
2576
2542
  }
2577
2543
  ) }),
2578
- /* @__PURE__ */ jsx9("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("HOURS") })
2544
+ /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("HOURS") })
2579
2545
  ] }),
2580
2546
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2581
- /* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx9(
2547
+ /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2582
2548
  "span",
2583
2549
  {
2584
2550
  style: { "--value": minutes },
@@ -2587,10 +2553,10 @@ function PreCreativeWork({
2587
2553
  children: minutes?.toString()?.padStart(2, "0")
2588
2554
  }
2589
2555
  ) }),
2590
- /* @__PURE__ */ jsx9("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("MINUTES") })
2556
+ /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("MINUTES") })
2591
2557
  ] }),
2592
2558
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
2593
- /* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx9(
2559
+ /* @__PURE__ */ jsx8("span", { className: "countdown font-mono text-5xl", children: /* @__PURE__ */ jsx8(
2594
2560
  "span",
2595
2561
  {
2596
2562
  style: { "--value": seconds },
@@ -2599,7 +2565,7 @@ function PreCreativeWork({
2599
2565
  children: seconds?.toString()?.padStart(2, "0")
2600
2566
  }
2601
2567
  ) }),
2602
- /* @__PURE__ */ jsx9("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("SECONDS") })
2568
+ /* @__PURE__ */ jsx8("span", { className: "text-sm uppercase tracking-widest mt-1", children: t("SECONDS") })
2603
2569
  ] })
2604
2570
  ] });
2605
2571
  };
@@ -2612,12 +2578,12 @@ function PreCreativeWork({
2612
2578
  backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
2613
2579
  },
2614
2580
  children: [
2615
- backgroundImageUrl && /* @__PURE__ */ jsx9("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
2616
- /* @__PURE__ */ jsx9("div", { className: "relative z-10", children: renderCountdown() })
2581
+ backgroundImageUrl && /* @__PURE__ */ jsx8("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
2582
+ /* @__PURE__ */ jsx8("div", { className: "relative z-10", children: renderCountdown() })
2617
2583
  ]
2618
2584
  }
2619
2585
  ),
2620
- !hideTitle && /* @__PURE__ */ jsx9(
2586
+ !hideTitle && /* @__PURE__ */ jsx8(
2621
2587
  TitleAndDescription2,
2622
2588
  {
2623
2589
  title: creativeWork.title,
@@ -2636,7 +2602,7 @@ var TitleAndDescription2 = ({
2636
2602
  className
2637
2603
  }) => {
2638
2604
  return /* @__PURE__ */ jsxs7("div", { className: twMerge5("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
2639
- /* @__PURE__ */ jsx9("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
2605
+ /* @__PURE__ */ jsx8("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
2640
2606
  releaseTime ? /* @__PURE__ */ jsxs7("div", { className: "text-sm md:text-base text-base-content/70 m-event-start-time", children: [
2641
2607
  new Date(releaseTime || "").toLocaleDateString(locale || "default", {
2642
2608
  month: "long",
@@ -2650,27 +2616,13 @@ var TitleAndDescription2 = ({
2650
2616
  minute: "2-digit"
2651
2617
  })
2652
2618
  ] }) : null,
2653
- description && /* @__PURE__ */ jsx9("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
2619
+ description && /* @__PURE__ */ jsx8("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
2654
2620
  ] });
2655
2621
  };
2656
2622
 
2657
- // src/ClientSideEvent.tsx
2658
- import React6 from "react";
2659
- import { jsx as jsx10 } from "react/jsx-runtime";
2660
- var ClientSideEvent = (props) => {
2661
- const [isClient, setIsClient] = React6.useState(false);
2662
- React6.useEffect(() => {
2663
- setIsClient(true);
2664
- }, []);
2665
- if (!isClient) {
2666
- return /* @__PURE__ */ jsx10("div", { className: "md:rounded-2xl overflow-hidden aspect-video", children: /* @__PURE__ */ jsx10("div", { className: "relative w-full h-full bg-[#151515] flex items-center justify-center", children: /* @__PURE__ */ jsx10("div", { className: "text-white", children: "Loading..." }) }) });
2667
- }
2668
- return /* @__PURE__ */ jsx10(Event, { ...props });
2669
- };
2670
-
2671
2623
  // src/QueryProvider.tsx
2672
2624
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2673
- import { jsx as jsx11 } from "react/jsx-runtime";
2625
+ import { jsx as jsx9 } from "react/jsx-runtime";
2674
2626
  var queryClient = new QueryClient({
2675
2627
  defaultOptions: {
2676
2628
  queries: {
@@ -2684,14 +2636,12 @@ var queryClient = new QueryClient({
2684
2636
  }
2685
2637
  });
2686
2638
  var QueryProvider = ({ children }) => {
2687
- return /* @__PURE__ */ jsx11(QueryClientProvider, { client: queryClient, children });
2639
+ return /* @__PURE__ */ jsx9(QueryClientProvider, { client: queryClient, children });
2688
2640
  };
2689
2641
 
2690
2642
  // src/index.ts
2691
2643
  var index_default = { Player };
2692
2644
  export {
2693
- ClientOnlyPlayer,
2694
- ClientSideEvent,
2695
2645
  CreativeWork,
2696
2646
  CreativeWorksSortDirection,
2697
2647
  Event,