sanity-plugin-mux-input 2.3.6 → 2.4.1

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
@@ -1,8 +1,9 @@
1
- import { useClient as useClient$1, createHookFromObservableFactory, useDocumentStore, collate, useDocumentValues, truncateString, useFormattedDuration, SanityDefaultPreview, useTimeAgo, TextWithTone, isRecord, getPreviewStateObservable, getPreviewValueWithFallback, DocumentPreviewPresence, useDocumentPreviewStore, useSchema, useDocumentPresence, PreviewCard, isReference, useProjectId, useDataset, PatchEvent, unset, setIfMissing, set, LinearProgress, FormField as FormField$2, definePlugin } from "sanity";
1
+ import { useClient as useClient$1, useDocumentStore, collate, useDocumentValues, createHookFromObservableFactory, truncateString, useFormattedDuration, SanityDefaultPreview, useTimeAgo, TextWithTone, isRecord, getPreviewStateObservable, getPreviewValueWithFallback, DocumentPreviewPresence, useDocumentPreviewStore, useSchema, useDocumentPresence, PreviewCard, isReference, useProjectId, useDataset, PatchEvent, unset, setIfMissing, set, LinearProgress, FormField as FormField$2, definePlugin } from "sanity";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { ErrorOutlineIcon, RetrieveIcon, RetryIcon, CheckmarkCircleIcon, SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, CheckmarkIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, LockIcon, PlayIcon, PlugIcon, UploadIcon, ResetIcon, EllipsisHorizontalIcon, TranslateIcon, DocumentVideoIcon } from "@sanity/icons";
4
- import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, Tooltip, Inline, useToast, TabList, Tab, TabPanel, TextInput, Label as Label$1, Grid, useClickOutside, Popover, MenuDivider, Autocomplete, Radio, rem } from "@sanity/ui";
4
+ import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, Tooltip, Inline, useToast, TabList, Tab, TabPanel, TextInput, Label as Label$1, Grid, useClickOutsideEvent, Popover, MenuDivider, Autocomplete, Radio, rem } from "@sanity/ui";
5
5
  import React, { useState, useMemo, useEffect, useRef, useId, memo, isValidElement, useCallback, useReducer, PureComponent, createElement, forwardRef, Suspense } from "react";
6
+ import { useObservable } from "react-rx";
6
7
  import compact from "lodash/compact.js";
7
8
  import toLower from "lodash/toLower.js";
8
9
  import trim from "lodash/trim.js";
@@ -18,7 +19,6 @@ import { usePaneRouter } from "sanity/desk";
18
19
  import { IntentLink } from "sanity/router";
19
20
  import isNumber from "lodash/isNumber.js";
20
21
  import isString from "lodash/isString.js";
21
- import { useObservable } from "react-rx";
22
22
  import useSWR from "swr";
23
23
  import scrollIntoView from "scroll-into-view-if-needed";
24
24
  import { UpChunk } from "@mux/upchunk";
@@ -40,6 +40,14 @@ const ToolIcon = () => /* @__PURE__ */ jsx(
40
40
  function useClient() {
41
41
  return useClient$1({ apiVersion: SANITY_API_VERSION });
42
42
  }
43
+ var __defProp$j = Object.defineProperty, __getOwnPropSymbols$j = Object.getOwnPropertySymbols, __hasOwnProp$j = Object.prototype.hasOwnProperty, __propIsEnum$j = Object.prototype.propertyIsEnumerable, __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$j = (a2, b) => {
44
+ for (var prop in b || (b = {}))
45
+ __hasOwnProp$j.call(b, prop) && __defNormalProp$j(a2, prop, b[prop]);
46
+ if (__getOwnPropSymbols$j)
47
+ for (var prop of __getOwnPropSymbols$j(b))
48
+ __propIsEnum$j.call(b, prop) && __defNormalProp$j(a2, prop, b[prop]);
49
+ return a2;
50
+ };
43
51
  const SPECIAL_CHARS = /([^!@#$%^&*(),\\/?";:{}|[\]+<>\s-])+/g, STRIP_EDGE_CHARS = /(^[.]+)|([.]+$)/;
44
52
  function tokenize(string) {
45
53
  return (string.match(SPECIAL_CHARS) || []).map((token) => token.replace(STRIP_EDGE_CHARS, ""));
@@ -61,41 +69,53 @@ function createSearchFilter(query) {
61
69
  return {
62
70
  filter: createConstraints(terms, query.length >= 8),
63
71
  // if the search is big enough, include the assetId (mux id) in the results
64
- params: {
65
- ...toGroqParams(terms)
66
- }
72
+ params: __spreadValues$j({}, toGroqParams(terms))
67
73
  };
68
74
  }
75
+ var __defProp$i = Object.defineProperty, __defProps$c = Object.defineProperties, __getOwnPropDescs$c = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$i = Object.getOwnPropertySymbols, __hasOwnProp$i = Object.prototype.hasOwnProperty, __propIsEnum$i = Object.prototype.propertyIsEnumerable, __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$i = (a2, b) => {
76
+ for (var prop in b || (b = {}))
77
+ __hasOwnProp$i.call(b, prop) && __defNormalProp$i(a2, prop, b[prop]);
78
+ if (__getOwnPropSymbols$i)
79
+ for (var prop of __getOwnPropSymbols$i(b))
80
+ __propIsEnum$i.call(b, prop) && __defNormalProp$i(a2, prop, b[prop]);
81
+ return a2;
82
+ }, __spreadProps$c = (a2, b) => __defProps$c(a2, __getOwnPropDescs$c(b));
69
83
  const ASSET_SORT_OPTIONS = {
70
84
  createdDesc: { groq: "_createdAt desc", label: "Newest first" },
71
85
  createdAsc: { groq: "_createdAt asc", label: "First created (oldest)" },
72
86
  filenameAsc: { groq: "filename asc", label: "By filename (A-Z)" },
73
87
  filenameDesc: { groq: "filename desc", label: "By filename (Z-A)" }
74
- }, useAssetDocuments = createHookFromObservableFactory(({ documentStore, sort, searchQuery }) => {
75
- const search = createSearchFilter(searchQuery), filter = ['_type == "mux.videoAsset"', ...search.filter].filter(Boolean).join(" && "), sortFragment = ASSET_SORT_OPTIONS[sort].groq;
76
- return documentStore.listenQuery(
77
- /* groq */
78
- `*[${filter}] | order(${sortFragment})`,
79
- search.params,
80
- {
81
- apiVersion: SANITY_API_VERSION
82
- }
83
- );
84
- });
88
+ }, useAssetDocuments = ({
89
+ documentStore,
90
+ sort,
91
+ searchQuery
92
+ }) => {
93
+ const memoizedObservable = useMemo(() => {
94
+ const search = createSearchFilter(searchQuery), filter = ['_type == "mux.videoAsset"', ...search.filter].filter(Boolean).join(" && "), sortFragment = ASSET_SORT_OPTIONS[sort].groq;
95
+ return documentStore.listenQuery(
96
+ /* groq */
97
+ `*[${filter}] | order(${sortFragment})`,
98
+ search.params,
99
+ {
100
+ apiVersion: SANITY_API_VERSION
101
+ }
102
+ );
103
+ }, [documentStore, sort, searchQuery]);
104
+ return useObservable(memoizedObservable, void 0);
105
+ };
85
106
  function useAssets() {
86
- const documentStore = useDocumentStore(), [sort, setSort] = useState("createdDesc"), [searchQuery, setSearchQuery] = useState(""), [assetDocuments = [], isLoading] = useAssetDocuments({ documentStore, sort, searchQuery });
107
+ const documentStore = useDocumentStore(), [sort, setSort] = useState("createdDesc"), [searchQuery, setSearchQuery] = useState(""), assetDocumentsObservable = useAssetDocuments({ documentStore, sort, searchQuery }), isLoading = assetDocumentsObservable === void 0;
87
108
  return {
88
109
  assets: useMemo(
89
110
  () => (
90
111
  // Avoid displaying both drafts & published assets by collating them together and giving preference to drafts
91
- collate(assetDocuments).map(
92
- (collated) => ({
93
- ...collated.draft || collated.published || {},
112
+ collate(assetDocumentsObservable != null ? assetDocumentsObservable : []).map(
113
+ (collated) => __spreadProps$c(__spreadValues$i({}, collated.draft || collated.published || {}), {
94
114
  _id: collated.id
95
115
  })
96
116
  )
97
117
  ),
98
- [assetDocuments]
118
+ [assetDocumentsObservable]
99
119
  ),
100
120
  isLoading,
101
121
  sort,
@@ -107,6 +127,14 @@ function useAssets() {
107
127
  function parseMuxDate(date) {
108
128
  return new Date(Number(date) * 1e3);
109
129
  }
130
+ var __defProp$h = Object.defineProperty, __defProps$b = Object.defineProperties, __getOwnPropDescs$b = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$h = Object.getOwnPropertySymbols, __hasOwnProp$h = Object.prototype.hasOwnProperty, __propIsEnum$h = Object.prototype.propertyIsEnumerable, __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$h = (a2, b) => {
131
+ for (var prop in b || (b = {}))
132
+ __hasOwnProp$h.call(b, prop) && __defNormalProp$h(a2, prop, b[prop]);
133
+ if (__getOwnPropSymbols$h)
134
+ for (var prop of __getOwnPropSymbols$h(b))
135
+ __propIsEnum$h.call(b, prop) && __defNormalProp$h(a2, prop, b[prop]);
136
+ return a2;
137
+ }, __spreadProps$b = (a2, b) => __defProps$b(a2, __getOwnPropDescs$b(b));
110
138
  const FIRST_PAGE = 1, ASSETS_PER_PAGE = 100;
111
139
  async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
112
140
  try {
@@ -128,7 +156,7 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
128
156
  pageNum,
129
157
  data: json.data
130
158
  };
131
- } catch {
159
+ } catch (error) {
132
160
  return {
133
161
  pageNum,
134
162
  error: { _tag: "FetchError" }
@@ -137,8 +165,7 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
137
165
  }
138
166
  function accumulateIntermediateState(currentState, pageResult) {
139
167
  const currentData = "data" in currentState && currentState.data || [];
140
- return {
141
- ...currentState,
168
+ return __spreadProps$b(__spreadValues$h({}, currentState), {
142
169
  data: [
143
170
  ...currentData,
144
171
  ...("data" in pageResult && pageResult.data || []).filter(
@@ -152,7 +179,7 @@ function accumulateIntermediateState(currentState, pageResult) {
152
179
  ),
153
180
  pageNum: pageResult.pageNum,
154
181
  loading: !0
155
- };
182
+ });
156
183
  }
157
184
  function hasMorePages(pageResult) {
158
185
  return typeof pageResult == "object" && "data" in pageResult && Array.isArray(pageResult.data) && pageResult.data.length > 0;
@@ -180,8 +207,7 @@ function useMuxAssets({ secrets, enabled }) {
180
207
  ).subscribe({
181
208
  // Once done, let the user know we've stopped loading
182
209
  complete: () => {
183
- setState((prev) => ({
184
- ...prev,
210
+ setState((prev) => __spreadProps$b(__spreadValues$h({}, prev), {
185
211
  loading: !1
186
212
  }));
187
213
  }
@@ -345,7 +371,7 @@ function getPlaybackId(asset) {
345
371
  }
346
372
  function getPlaybackPolicy(asset) {
347
373
  var _a, _b, _c, _d;
348
- return (_d = (_c = (_b = (_a = asset.data) == null ? void 0 : _a.playback_ids) == null ? void 0 : _b[0]) == null ? void 0 : _c.policy) != null ? _d : "public";
374
+ return (_d = (_c = (_b = (_a = asset.data) == null ? void 0 : _a.playback_ids) == null ? void 0 : _b.find((playbackId) => asset.playbackId === playbackId.id)) == null ? void 0 : _c.policy) != null ? _d : "public";
349
375
  }
350
376
  function getAnimatedPosterSrc({
351
377
  asset,
@@ -385,11 +411,11 @@ function VideoThumbnail({
385
411
  const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = useState("loading"), client = useClient(), animatedSrc = useMemo(() => {
386
412
  try {
387
413
  return getAnimatedPosterSrc({ asset, client, width: posterWidth });
388
- } catch {
414
+ } catch (e) {
389
415
  status !== "error" && setStatus("error");
390
416
  return;
391
417
  }
392
- }, [asset, client, width, status, setStatus]);
418
+ }, [asset, client, posterWidth, status]);
393
419
  function handleLoad() {
394
420
  setStatus("loaded");
395
421
  }
@@ -457,6 +483,14 @@ function VideoThumbnail({
457
483
  }
458
484
  );
459
485
  }
486
+ var __defProp$g = Object.defineProperty, __getOwnPropSymbols$g = Object.getOwnPropertySymbols, __hasOwnProp$g = Object.prototype.hasOwnProperty, __propIsEnum$g = Object.prototype.propertyIsEnumerable, __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$g = (a2, b) => {
487
+ for (var prop in b || (b = {}))
488
+ __hasOwnProp$g.call(b, prop) && __defNormalProp$g(a2, prop, b[prop]);
489
+ if (__getOwnPropSymbols$g)
490
+ for (var prop of __getOwnPropSymbols$g(b))
491
+ __propIsEnum$g.call(b, prop) && __defNormalProp$g(a2, prop, b[prop]);
492
+ return a2;
493
+ };
460
494
  const MissingAssetCheckbox = styled(Checkbox)`
461
495
  position: static !important;
462
496
 
@@ -667,7 +701,7 @@ function ImportVideosDialog(props) {
667
701
  function ImportVideosFromMux() {
668
702
  const importAssets = useImportMuxAssets();
669
703
  if (importAssets.hasSecrets)
670
- return importAssets.dialogOpen ? /* @__PURE__ */ jsx(ImportVideosDialog, { ...importAssets }) : /* @__PURE__ */ jsx(Button, { mode: "bleed", text: "Import from Mux", onClick: importAssets.openDialog });
704
+ return importAssets.dialogOpen ? /* @__PURE__ */ jsx(ImportVideosDialog, __spreadValues$g({}, importAssets)) : /* @__PURE__ */ jsx(Button, { mode: "bleed", text: "Import from Mux", onClick: importAssets.openDialog });
671
705
  }
672
706
  const CONTEXT_MENU_POPOVER_PROPS = {
673
707
  constrainSize: !0,
@@ -728,24 +762,40 @@ const IconInfo = (props) => {
728
762
  /* @__PURE__ */ jsx(Text, { size: props.size || 1, muted: props.muted, children: props.text })
729
763
  ] });
730
764
  };
765
+ var __defProp$f = Object.defineProperty, __defProps$a = Object.defineProperties, __getOwnPropDescs$a = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$f = Object.getOwnPropertySymbols, __hasOwnProp$f = Object.prototype.hasOwnProperty, __propIsEnum$f = Object.prototype.propertyIsEnumerable, __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$f = (a2, b) => {
766
+ for (var prop in b || (b = {}))
767
+ __hasOwnProp$f.call(b, prop) && __defNormalProp$f(a2, prop, b[prop]);
768
+ if (__getOwnPropSymbols$f)
769
+ for (var prop of __getOwnPropSymbols$f(b))
770
+ __propIsEnum$f.call(b, prop) && __defNormalProp$f(a2, prop, b[prop]);
771
+ return a2;
772
+ }, __spreadProps$a = (a2, b) => __defProps$a(a2, __getOwnPropDescs$a(b));
731
773
  function ResolutionIcon(props) {
732
- return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsx(
774
+ return /* @__PURE__ */ jsx("svg", __spreadProps$a(__spreadValues$f({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, props), { children: /* @__PURE__ */ jsx(
733
775
  "path",
734
776
  {
735
777
  fill: "currentColor",
736
778
  d: "M20 9V6h-3V4h5v5h-2ZM2 9V4h5v2H4v3H2Zm15 11v-2h3v-3h2v5h-5ZM2 20v-5h2v3h3v2H2Zm4-4V8h12v8H6Zm2-2h8v-4H8v4Zm0 0v-4v4Z"
737
779
  }
738
- ) });
780
+ ) }));
739
781
  }
782
+ var __defProp$e = Object.defineProperty, __defProps$9 = Object.defineProperties, __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$e = (a2, b) => {
783
+ for (var prop in b || (b = {}))
784
+ __hasOwnProp$e.call(b, prop) && __defNormalProp$e(a2, prop, b[prop]);
785
+ if (__getOwnPropSymbols$e)
786
+ for (var prop of __getOwnPropSymbols$e(b))
787
+ __propIsEnum$e.call(b, prop) && __defNormalProp$e(a2, prop, b[prop]);
788
+ return a2;
789
+ }, __spreadProps$9 = (a2, b) => __defProps$9(a2, __getOwnPropDescs$9(b));
740
790
  function StopWatchIcon(props) {
741
791
  return /* @__PURE__ */ jsxs(
742
792
  "svg",
743
- {
793
+ __spreadProps$9(__spreadValues$e({
744
794
  xmlns: "http://www.w3.org/2000/svg",
745
795
  width: "1em",
746
796
  height: "1em",
747
- viewBox: "0 0 512 512",
748
- ...props,
797
+ viewBox: "0 0 512 512"
798
+ }, props), {
749
799
  children: [
750
800
  /* @__PURE__ */ jsx("path", { d: "M232 306.667h48V176h-48v130.667z", fill: "currentColor" }),
751
801
  /* @__PURE__ */ jsx(
@@ -757,7 +807,7 @@ function StopWatchIcon(props) {
757
807
  ),
758
808
  /* @__PURE__ */ jsx("path", { d: "M192 32h128v48H192z", fill: "currentColor" })
759
809
  ]
760
- }
810
+ })
761
811
  );
762
812
  }
763
813
  function getVideoSrc({ asset, client }) {
@@ -768,12 +818,30 @@ function getVideoSrc({ asset, client }) {
768
818
  }
769
819
  return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
770
820
  }
771
- function VideoPlayer({
772
- asset,
773
- children,
774
- ...props
775
- }) {
776
- var _a, _b;
821
+ var __defProp$d = Object.defineProperty, __defProps$8 = Object.defineProperties, __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$d = Object.getOwnPropertySymbols, __hasOwnProp$d = Object.prototype.hasOwnProperty, __propIsEnum$d = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$d = (a2, b) => {
822
+ for (var prop in b || (b = {}))
823
+ __hasOwnProp$d.call(b, prop) && __defNormalProp$d(a2, prop, b[prop]);
824
+ if (__getOwnPropSymbols$d)
825
+ for (var prop of __getOwnPropSymbols$d(b))
826
+ __propIsEnum$d.call(b, prop) && __defNormalProp$d(a2, prop, b[prop]);
827
+ return a2;
828
+ }, __spreadProps$8 = (a2, b) => __defProps$8(a2, __getOwnPropDescs$8(b)), __objRest$3 = (source, exclude) => {
829
+ var target = {};
830
+ for (var prop in source)
831
+ __hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
832
+ if (source != null && __getOwnPropSymbols$d)
833
+ for (var prop of __getOwnPropSymbols$d(source))
834
+ exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop) && (target[prop] = source[prop]);
835
+ return target;
836
+ };
837
+ function VideoPlayer(_a) {
838
+ var _b = _a, {
839
+ asset,
840
+ children
841
+ } = _b, props = __objRest$3(_b, [
842
+ "asset",
843
+ "children"
844
+ ]), _a2, _b2;
777
845
  const client = useClient(), isAudio = assetIsAudio(asset), { src: videoSrc, error } = useMemo(() => {
778
846
  try {
779
847
  const src = (asset == null ? void 0 : asset.playbackId) && getVideoSrc({ client, asset });
@@ -784,10 +852,10 @@ function VideoPlayer({
784
852
  }, [asset, client]), signedToken = useMemo(() => {
785
853
  try {
786
854
  return new URL(videoSrc).searchParams.get("token");
787
- } catch {
855
+ } catch (e) {
788
856
  return !1;
789
857
  }
790
- }, [videoSrc]), [width, height] = ((_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.aspect_ratio) != null ? _b : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
858
+ }, [videoSrc]), [width, height] = ((_b2 = (_a2 = asset == null ? void 0 : asset.data) == null ? void 0 : _a2.aspect_ratio) != null ? _b2 : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
791
859
  let aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
792
860
  return isAudio && (aspectRatio = props.forceAspectRatio ? (
793
861
  // Make it wider when forcing aspect ratio to balance with videos' rendering height (audio players overflow a bit)
@@ -796,8 +864,7 @@ function VideoPlayer({
796
864
  videoSrc && /* @__PURE__ */ jsxs(Fragment, { children: [
797
865
  /* @__PURE__ */ jsx(
798
866
  MuxPlayer,
799
- {
800
- ...props,
867
+ __spreadProps$8(__spreadValues$d({}, props), {
801
868
  playsInline: !0,
802
869
  playbackId: asset.playbackId,
803
870
  tokens: signedToken ? { playback: signedToken, thumbnail: signedToken, storyboard: signedToken } : void 0,
@@ -805,7 +872,7 @@ function VideoPlayer({
805
872
  crossOrigin: "anonymous",
806
873
  metadata: {
807
874
  player_name: "Sanity Admin Dashboard",
808
- player_version: "2.3.6",
875
+ player_version: "2.4.1",
809
876
  page_type: "Preview Player"
810
877
  },
811
878
  audio: isAudio,
@@ -815,7 +882,7 @@ function VideoPlayer({
815
882
  display: "block",
816
883
  objectFit: "contain"
817
884
  }
818
- }
885
+ })
819
886
  ),
820
887
  children
821
888
  ] }),
@@ -857,13 +924,13 @@ async function deleteAsset({
857
924
  if (!(asset != null && asset._id)) return !0;
858
925
  try {
859
926
  await client.delete(asset._id);
860
- } catch {
927
+ } catch (error) {
861
928
  return "failed-sanity";
862
929
  }
863
930
  if (deleteOnMux && asset != null && asset.assetId)
864
931
  try {
865
932
  await deleteAssetOnMux(client, asset.assetId);
866
- } catch {
933
+ } catch (error) {
867
934
  return "failed-mux";
868
935
  }
869
936
  return !0;
@@ -876,6 +943,14 @@ function getAsset(client, assetId) {
876
943
  method: "GET"
877
944
  });
878
945
  }
946
+ var __defProp$c = Object.defineProperty, __defProps$7 = Object.defineProperties, __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$c = Object.getOwnPropertySymbols, __hasOwnProp$c = Object.prototype.hasOwnProperty, __propIsEnum$c = Object.prototype.propertyIsEnumerable, __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$c = (a2, b) => {
947
+ for (var prop in b || (b = {}))
948
+ __hasOwnProp$c.call(b, prop) && __defNormalProp$c(a2, prop, b[prop]);
949
+ if (__getOwnPropSymbols$c)
950
+ for (var prop of __getOwnPropSymbols$c(b))
951
+ __propIsEnum$c.call(b, prop) && __defNormalProp$c(a2, prop, b[prop]);
952
+ return a2;
953
+ }, __spreadProps$7 = (a2, b) => __defProps$7(a2, __getOwnPropDescs$7(b));
879
954
  const getUnknownTypeFallback = (id, typeName) => ({
880
955
  title: /* @__PURE__ */ jsxs("em", { children: [
881
956
  "No schema found for type ",
@@ -889,7 +964,7 @@ const getUnknownTypeFallback = (id, typeName) => ({
889
964
  });
890
965
  function MissingSchemaType(props) {
891
966
  const { layout, value } = props;
892
- return /* @__PURE__ */ jsx(SanityDefaultPreview, { ...getUnknownTypeFallback(value._id, value._type), layout });
967
+ return /* @__PURE__ */ jsx(SanityDefaultPreview, __spreadProps$7(__spreadValues$c({}, getUnknownTypeFallback(value._id, value._type)), { layout }));
893
968
  }
894
969
  function TimeAgo({ time }) {
895
970
  const timeAgo = useTimeAgo(time);
@@ -928,6 +1003,14 @@ function PublishedStatus(props) {
928
1003
  }
929
1004
  );
930
1005
  }
1006
+ var __defProp$b = Object.defineProperty, __defProps$6 = Object.defineProperties, __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$b = Object.getOwnPropertySymbols, __hasOwnProp$b = Object.prototype.hasOwnProperty, __propIsEnum$b = Object.prototype.propertyIsEnumerable, __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$b = (a2, b) => {
1007
+ for (var prop in b || (b = {}))
1008
+ __hasOwnProp$b.call(b, prop) && __defNormalProp$b(a2, prop, b[prop]);
1009
+ if (__getOwnPropSymbols$b)
1010
+ for (var prop of __getOwnPropSymbols$b(b))
1011
+ __propIsEnum$b.call(b, prop) && __defNormalProp$b(a2, prop, b[prop]);
1012
+ return a2;
1013
+ }, __spreadProps$6 = (a2, b) => __defProps$6(a2, __getOwnPropDescs$6(b));
931
1014
  function PaneItemPreview(props) {
932
1015
  const { icon, layout, presence, schemaType, value } = props, title = isRecord(value.title) && isValidElement(value.title) || isString(value.title) || isNumber(value.title) ? value.title : null, observable = useMemo(
933
1016
  () => getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id, title),
@@ -943,13 +1026,12 @@ function PaneItemPreview(props) {
943
1026
  ] });
944
1027
  return /* @__PURE__ */ jsx(
945
1028
  SanityDefaultPreview,
946
- {
947
- ...getPreviewValueWithFallback({ value, draft, published }),
1029
+ __spreadProps$6(__spreadValues$b({}, getPreviewValueWithFallback({ value, draft, published })), {
948
1030
  isPlaceholder: isLoading,
949
1031
  icon,
950
1032
  layout,
951
1033
  status
952
- }
1034
+ })
953
1035
  );
954
1036
  }
955
1037
  function getIconWithFallback(icon, schemaType, defaultIcon) {
@@ -1172,6 +1254,7 @@ function getVideoMetadata(doc) {
1172
1254
  return {
1173
1255
  title: doc.filename || id.slice(0, 12),
1174
1256
  id,
1257
+ playbackId: doc.playbackId,
1175
1258
  createdAt: date,
1176
1259
  duration: (_b = doc.data) != null && _b.duration ? formatSeconds((_c = doc.data) == null ? void 0 : _c.duration) : void 0,
1177
1260
  aspect_ratio: (_d = doc.data) == null ? void 0 : _d.aspect_ratio,
@@ -1179,11 +1262,19 @@ function getVideoMetadata(doc) {
1179
1262
  max_stored_frame_rate: (_f = doc.data) == null ? void 0 : _f.max_stored_frame_rate
1180
1263
  };
1181
1264
  }
1265
+ var __defProp$a = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$a = Object.getOwnPropertySymbols, __hasOwnProp$a = Object.prototype.hasOwnProperty, __propIsEnum$a = Object.prototype.propertyIsEnumerable, __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$a = (a2, b) => {
1266
+ for (var prop in b || (b = {}))
1267
+ __hasOwnProp$a.call(b, prop) && __defNormalProp$a(a2, prop, b[prop]);
1268
+ if (__getOwnPropSymbols$a)
1269
+ for (var prop of __getOwnPropSymbols$a(b))
1270
+ __propIsEnum$a.call(b, prop) && __defNormalProp$a(a2, prop, b[prop]);
1271
+ return a2;
1272
+ }, __spreadProps$5 = (a2, b) => __defProps$5(a2, __getOwnPropDescs$5(b));
1182
1273
  function useVideoDetails(props) {
1183
1274
  const documentStore = useDocumentStore(), toast = useToast(), client = useClient(), [references, referencesLoading] = useDocReferences({
1184
1275
  documentStore,
1185
1276
  id: props.asset._id
1186
- }), [originalAsset, setOriginalAsset] = useState(() => props.asset), [filename, setFilename] = useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata({ ...props.asset, filename }), [state, setState] = useState("idle");
1277
+ }), [originalAsset, setOriginalAsset] = useState(() => props.asset), [filename, setFilename] = useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata(__spreadProps$5(__spreadValues$a({}, props.asset), { filename })), [state, setState] = useState("idle");
1187
1278
  function handleClose() {
1188
1279
  if (state === "idle") {
1189
1280
  if (modified) {
@@ -1200,7 +1291,7 @@ function useVideoDetails(props) {
1200
1291
  if (state === "idle") {
1201
1292
  setState("saving");
1202
1293
  try {
1203
- await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) => ({ ...prev, filename })), toast.push({
1294
+ await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) => __spreadProps$5(__spreadValues$a({}, prev), { filename })), toast.push({
1204
1295
  title: "Video title updated",
1205
1296
  description: `New title: ${filename}`,
1206
1297
  status: "success"
@@ -1463,7 +1554,15 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
1463
1554
  }
1464
1555
  ),
1465
1556
  /* @__PURE__ */ jsx(IconInfo, { text: `Mux ID:
1466
- ${displayInfo.id}`, icon: TagIcon, size: 2 })
1557
+ ${displayInfo.id}`, icon: TagIcon, size: 2 }),
1558
+ (displayInfo == null ? void 0 : displayInfo.playbackId) && /* @__PURE__ */ jsx(
1559
+ IconInfo,
1560
+ {
1561
+ text: `Playback ID: ${displayInfo.playbackId}`,
1562
+ icon: TagIcon,
1563
+ size: 2
1564
+ }
1565
+ )
1467
1566
  ] })
1468
1567
  ] })
1469
1568
  }
@@ -1767,6 +1866,14 @@ function VideosBrowser({ onSelect }) {
1767
1866
  )
1768
1867
  ] });
1769
1868
  }
1869
+ var __defProp$9 = Object.defineProperty, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b) => {
1870
+ for (var prop in b || (b = {}))
1871
+ __hasOwnProp$9.call(b, prop) && __defNormalProp$9(a2, prop, b[prop]);
1872
+ if (__getOwnPropSymbols$9)
1873
+ for (var prop of __getOwnPropSymbols$9(b))
1874
+ __propIsEnum$9.call(b, prop) && __defNormalProp$9(a2, prop, b[prop]);
1875
+ return a2;
1876
+ };
1770
1877
  const StudioTool = () => /* @__PURE__ */ jsx(VideosBrowser, {}), DEFAULT_TOOL_CONFIG = {
1771
1878
  icon: ToolIcon,
1772
1879
  title: "Videos"
@@ -1777,7 +1884,7 @@ function createStudioTool(config) {
1777
1884
  name: "mux",
1778
1885
  icon: toolConfig.icon || DEFAULT_TOOL_CONFIG.icon,
1779
1886
  title: toolConfig.title || DEFAULT_TOOL_CONFIG.title,
1780
- component: (props) => /* @__PURE__ */ jsx(StudioTool, { ...config, ...props })
1887
+ component: (props) => /* @__PURE__ */ jsx(StudioTool, __spreadValues$9(__spreadValues$9({}, config), props))
1781
1888
  };
1782
1889
  }
1783
1890
  const path = ["assetId", "data", "playbackId", "status", "thumbTime", "filename"], useAssetDocumentValues = (asset) => useDocumentValues(
@@ -1848,7 +1955,7 @@ async function haveValidSigningKeys(client, signingKeyId, signingKeyPrivate) {
1848
1955
  method: "GET"
1849
1956
  });
1850
1957
  return !!(res.data && res.data.id);
1851
- } catch {
1958
+ } catch (e) {
1852
1959
  return console.error("Error fetching signingKeyId", signingKeyId, "assuming it is not valid"), !1;
1853
1960
  }
1854
1961
  }
@@ -1912,6 +2019,14 @@ const useSaveSecrets = (client, secrets) => useCallback(
1912
2019
  },
1913
2020
  [client, secrets]
1914
2021
  );
2022
+ var __defProp$8 = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b) => {
2023
+ for (var prop in b || (b = {}))
2024
+ __hasOwnProp$8.call(b, prop) && __defNormalProp$8(a2, prop, b[prop]);
2025
+ if (__getOwnPropSymbols$8)
2026
+ for (var prop of __getOwnPropSymbols$8(b))
2027
+ __propIsEnum$8.call(b, prop) && __defNormalProp$8(a2, prop, b[prop]);
2028
+ return a2;
2029
+ }, __spreadProps$4 = (a2, b) => __defProps$4(a2, __getOwnPropDescs$4(b));
1915
2030
  function init({ token, secretKey, enableSignedUrls }) {
1916
2031
  return {
1917
2032
  submitting: !1,
@@ -1926,13 +2041,13 @@ function init({ token, secretKey, enableSignedUrls }) {
1926
2041
  function reducer(state, action) {
1927
2042
  switch (action == null ? void 0 : action.type) {
1928
2043
  case "submit":
1929
- return { ...state, submitting: !0, error: null };
2044
+ return __spreadProps$4(__spreadValues$8({}, state), { submitting: !0, error: null });
1930
2045
  case "error":
1931
- return { ...state, submitting: !1, error: action.payload };
2046
+ return __spreadProps$4(__spreadValues$8({}, state), { submitting: !1, error: action.payload });
1932
2047
  case "reset":
1933
2048
  return init(action.payload);
1934
2049
  case "change":
1935
- return { ...state, [action.payload.name]: action.payload.value };
2050
+ return __spreadProps$4(__spreadValues$8({}, state), { [action.payload.name]: action.payload.value });
1936
2051
  default:
1937
2052
  throw new Error(`Unknown action type: ${action == null ? void 0 : action.type}`);
1938
2053
  }
@@ -2837,6 +2952,14 @@ function createUpChunkObservable(uuid2, uploadUrl2, source) {
2837
2952
  return upchunk.on("success", successHandler), upchunk.on("error", errorHandler), upchunk.on("progress", progressHandler), upchunk.on("offline", offlineHandler), upchunk.on("online", onlineHandler), () => upchunk.abort();
2838
2953
  });
2839
2954
  }
2955
+ var __defProp$7 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$7 = Object.getOwnPropertySymbols, __hasOwnProp$7 = Object.prototype.hasOwnProperty, __propIsEnum$7 = Object.prototype.propertyIsEnumerable, __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$7 = (a2, b) => {
2956
+ for (var prop in b || (b = {}))
2957
+ __hasOwnProp$7.call(b, prop) && __defNormalProp$7(a2, prop, b[prop]);
2958
+ if (__getOwnPropSymbols$7)
2959
+ for (var prop of __getOwnPropSymbols$7(b))
2960
+ __propIsEnum$7.call(b, prop) && __defNormalProp$7(a2, prop, b[prop]);
2961
+ return a2;
2962
+ }, __spreadProps$3 = (a2, b) => __defProps$3(a2, __getOwnPropDescs$3(b));
2840
2963
  function cancelUpload(client, uuid2) {
2841
2964
  return client.observable.request({
2842
2965
  url: `/addons/mux/uploads/${client.config().dataset}/${uuid2}`,
@@ -2917,7 +3040,7 @@ function uploadFile({
2917
3040
  // eslint-disable-next-line max-nested-callbacks
2918
3041
  mergeMap((event) => event.type !== "success" ? of(event) : from(updateAssetDocumentFromUpload(client, uuid$1)).pipe(
2919
3042
  // eslint-disable-next-line max-nested-callbacks
2920
- mergeMap((doc) => of({ ...event, asset: doc }))
3043
+ mergeMap((doc) => of(__spreadProps$3(__spreadValues$7({}, event), { asset: doc })))
2921
3044
  )),
2922
3045
  // eslint-disable-next-line max-nested-callbacks
2923
3046
  catchError((err) => cancelUpload(client, uuid$1).pipe(mergeMapTo(throwError(err))))
@@ -2988,7 +3111,7 @@ function testUrl(url) {
2988
3111
  let parsed;
2989
3112
  try {
2990
3113
  parsed = new URL(url);
2991
- } catch {
3114
+ } catch (err) {
2992
3115
  return throwError(error);
2993
3116
  }
2994
3117
  return parsed && !parsed.protocol.match(/http:|https:/) ? throwError(error) : of(url);
@@ -3004,7 +3127,7 @@ function isValidUrl(url) {
3004
3127
  try {
3005
3128
  const parsed = new URL(url);
3006
3129
  return parsed && !!parsed.protocol.match(/http:|https:/);
3007
- } catch {
3130
+ } catch (e) {
3008
3131
  return !1;
3009
3132
  }
3010
3133
  }
@@ -3019,7 +3142,7 @@ function normalizeItems(items) {
3019
3142
  let entry;
3020
3143
  try {
3021
3144
  entry = item.webkitGetAsEntry();
3022
- } catch {
3145
+ } catch (err) {
3023
3146
  return [item.getAsFile()];
3024
3147
  }
3025
3148
  return entry ? entry.isDirectory ? walk(entry) : [item.getAsFile()] : [];
@@ -3240,8 +3363,25 @@ const FileButton = styled(MenuItem)(({ theme }) => {
3240
3363
  opacity: 0;
3241
3364
  }
3242
3365
  `;
3243
- }), FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
3244
- const {
3366
+ });
3367
+ var __defProp$6 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$6 = Object.getOwnPropertySymbols, __hasOwnProp$6 = Object.prototype.hasOwnProperty, __propIsEnum$6 = Object.prototype.propertyIsEnumerable, __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$6 = (a2, b) => {
3368
+ for (var prop in b || (b = {}))
3369
+ __hasOwnProp$6.call(b, prop) && __defNormalProp$6(a2, prop, b[prop]);
3370
+ if (__getOwnPropSymbols$6)
3371
+ for (var prop of __getOwnPropSymbols$6(b))
3372
+ __propIsEnum$6.call(b, prop) && __defNormalProp$6(a2, prop, b[prop]);
3373
+ return a2;
3374
+ }, __spreadProps$2 = (a2, b) => __defProps$2(a2, __getOwnPropDescs$2(b)), __objRest$2 = (source, exclude) => {
3375
+ var target = {};
3376
+ for (var prop in source)
3377
+ __hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
3378
+ if (source != null && __getOwnPropSymbols$6)
3379
+ for (var prop of __getOwnPropSymbols$6(source))
3380
+ exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop) && (target[prop] = source[prop]);
3381
+ return target;
3382
+ };
3383
+ const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
3384
+ const _a = props, {
3245
3385
  icon,
3246
3386
  id: idProp,
3247
3387
  accept,
@@ -3252,9 +3392,20 @@ const FileButton = styled(MenuItem)(({ theme }) => {
3252
3392
  space = 3,
3253
3393
  textAlign,
3254
3394
  text,
3255
- disabled,
3256
- ...rest
3257
- } = props, idHook = useId(), id = idProp || idHook, handleChange = React.useCallback(
3395
+ disabled
3396
+ } = _a, rest = __objRest$2(_a, [
3397
+ "icon",
3398
+ "id",
3399
+ "accept",
3400
+ "capture",
3401
+ "fontSize",
3402
+ "multiple",
3403
+ "onSelect",
3404
+ "space",
3405
+ "textAlign",
3406
+ "text",
3407
+ "disabled"
3408
+ ]), idHook = useId(), id = idProp || idHook, handleChange = React.useCallback(
3258
3409
  (event) => {
3259
3410
  onSelect && event.target.files && onSelect(Array.from(event.target.files));
3260
3411
  },
@@ -3266,7 +3417,7 @@ const FileButton = styled(MenuItem)(({ theme }) => {
3266
3417
  ] }) }),
3267
3418
  text && /* @__PURE__ */ jsx(Text, { align: textAlign, size: fontSize, textOverflow: "ellipsis", children: text })
3268
3419
  ] });
3269
- return /* @__PURE__ */ jsxs(FileButton, { ...rest, htmlFor: id, disabled, ref: forwardedRef, children: [
3420
+ return /* @__PURE__ */ jsxs(FileButton, __spreadProps$2(__spreadValues$6({}, rest), { htmlFor: id, disabled, ref: forwardedRef, children: [
3270
3421
  content,
3271
3422
  /* @__PURE__ */ jsx(
3272
3423
  "input",
@@ -3282,7 +3433,7 @@ const FileButton = styled(MenuItem)(({ theme }) => {
3282
3433
  disabled
3283
3434
  }
3284
3435
  )
3285
- ] });
3436
+ ] }));
3286
3437
  }), LockCard = styled(Card)`
3287
3438
  position: absolute;
3288
3439
  top: 0;
@@ -3298,9 +3449,9 @@ function PlayerActionsMenu(props) {
3298
3449
  const { asset, readOnly, dialogState, setDialogState, onChange, onSelect } = props, [open, setOpen] = useState(!1), [menuElement, setMenuRef] = useState(null), isSigned = useMemo(() => getPlaybackPolicy(asset) === "signed", [asset]), onReset = useCallback(() => onChange(PatchEvent.from(unset([]))), [onChange]);
3299
3450
  return useEffect(() => {
3300
3451
  open && dialogState && setOpen(!1);
3301
- }, [dialogState, open]), useClickOutside(
3302
- useCallback(() => setOpen(!1), []),
3303
- [menuElement]
3452
+ }, [dialogState, open]), useClickOutsideEvent(
3453
+ () => setOpen(!1),
3454
+ () => [menuElement]
3304
3455
  ), /* @__PURE__ */ jsxs(Inline, { space: 1, padding: 2, children: [
3305
3456
  isSigned && /* @__PURE__ */ jsx(
3306
3457
  Tooltip,
@@ -3492,6 +3643,14 @@ function TextTracksEditor({
3492
3643
  )
3493
3644
  ] }) });
3494
3645
  }
3646
+ var __defProp$5 = Object.defineProperty, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b) => {
3647
+ for (var prop in b || (b = {}))
3648
+ __hasOwnProp$5.call(b, prop) && __defNormalProp$5(a2, prop, b[prop]);
3649
+ if (__getOwnPropSymbols$5)
3650
+ for (var prop of __getOwnPropSymbols$5(b))
3651
+ __propIsEnum$5.call(b, prop) && __defNormalProp$5(a2, prop, b[prop]);
3652
+ return a2;
3653
+ };
3495
3654
  const ENCODING_OPTIONS = [
3496
3655
  { value: "smart", label: "Smart" },
3497
3656
  { value: "baseline", label: "Baseline" }
@@ -3537,22 +3696,19 @@ function UploadConfiguration({
3537
3696
  case "normalize_audio":
3538
3697
  case "signed":
3539
3698
  return Object.assign({}, prev, { [action.action]: action.value });
3699
+ // Updating individual tracks
3540
3700
  case "track": {
3541
3701
  const text_tracks = [...prev.text_tracks], target_track_i = text_tracks.findIndex(({ _id: _id2 }) => _id2 === action.id);
3542
3702
  switch (action.subAction) {
3543
3703
  case "add":
3544
3704
  if (target_track_i !== -1) break;
3545
- text_tracks.push({
3546
- _id: action.id,
3547
- ...action.value
3548
- });
3705
+ text_tracks.push(__spreadValues$5({
3706
+ _id: action.id
3707
+ }, action.value));
3549
3708
  break;
3550
3709
  case "update":
3551
3710
  if (target_track_i === -1) break;
3552
- text_tracks[target_track_i] = {
3553
- ...text_tracks[target_track_i],
3554
- ...action.value
3555
- };
3711
+ text_tracks[target_track_i] = __spreadValues$5(__spreadValues$5({}, text_tracks[target_track_i]), action.value);
3556
3712
  break;
3557
3713
  case "delete":
3558
3714
  if (target_track_i === -1) break;
@@ -3838,7 +3994,24 @@ const ctrlKey = 17, cmdKey = 91, UploadCardWithFocusRing = withFocusRing(Card),
3838
3994
  &:focus {
3839
3995
  outline: none;
3840
3996
  }
3841
- `, HiddenInput = styled.input`
3997
+ `;
3998
+ var __defProp$4 = Object.defineProperty, __getOwnPropSymbols$4 = Object.getOwnPropertySymbols, __hasOwnProp$4 = Object.prototype.hasOwnProperty, __propIsEnum$4 = Object.prototype.propertyIsEnumerable, __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$4 = (a2, b) => {
3999
+ for (var prop in b || (b = {}))
4000
+ __hasOwnProp$4.call(b, prop) && __defNormalProp$4(a2, prop, b[prop]);
4001
+ if (__getOwnPropSymbols$4)
4002
+ for (var prop of __getOwnPropSymbols$4(b))
4003
+ __propIsEnum$4.call(b, prop) && __defNormalProp$4(a2, prop, b[prop]);
4004
+ return a2;
4005
+ }, __objRest$1 = (source, exclude) => {
4006
+ var target = {};
4007
+ for (var prop in source)
4008
+ __hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
4009
+ if (source != null && __getOwnPropSymbols$4)
4010
+ for (var prop of __getOwnPropSymbols$4(source))
4011
+ exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop) && (target[prop] = source[prop]);
4012
+ return target;
4013
+ };
4014
+ const HiddenInput = styled.input`
3842
4015
  overflow: hidden;
3843
4016
  width: 0.1px;
3844
4017
  height: 0.1px;
@@ -3847,15 +4020,16 @@ const ctrlKey = 17, cmdKey = 91, UploadCardWithFocusRing = withFocusRing(Card),
3847
4020
  z-index: -1;
3848
4021
  `, Label = styled.label`
3849
4022
  position: relative;
3850
- `, FileInputButton = ({ onSelect, accept, ...props }) => {
4023
+ `, FileInputButton = (_a) => {
4024
+ var _b = _a, { onSelect, accept } = _b, props = __objRest$1(_b, ["onSelect", "accept"]);
3851
4025
  const inputId = `FileSelect${useId()}`, inputRef = useRef(null), handleSelect = useCallback(
3852
4026
  (event) => {
3853
4027
  onSelect && onSelect(event.target.files);
3854
4028
  },
3855
4029
  [onSelect]
3856
4030
  ), handleButtonClick = useCallback(() => {
3857
- var _a;
3858
- return (_a = inputRef.current) == null ? void 0 : _a.click();
4031
+ var _a2;
4032
+ return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
3859
4033
  }, []);
3860
4034
  return /* @__PURE__ */ jsxs(Label, { htmlFor: inputId, children: [
3861
4035
  /* @__PURE__ */ jsx(
@@ -3872,13 +4046,12 @@ const ctrlKey = 17, cmdKey = 91, UploadCardWithFocusRing = withFocusRing(Card),
3872
4046
  ),
3873
4047
  /* @__PURE__ */ jsx(
3874
4048
  Button,
3875
- {
4049
+ __spreadValues$4({
3876
4050
  onClick: handleButtonClick,
3877
4051
  mode: "default",
3878
4052
  tone: "primary",
3879
- style: { width: "100%" },
3880
- ...props
3881
- }
4053
+ style: { width: "100%" }
4054
+ }, props)
3882
4055
  )
3883
4056
  ] });
3884
4057
  };
@@ -3939,6 +4112,22 @@ function UploadPlaceholder(props) {
3939
4112
  }
3940
4113
  );
3941
4114
  }
4115
+ var __defProp$3 = Object.defineProperty, __defProps$1 = Object.defineProperties, __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$3 = Object.getOwnPropertySymbols, __hasOwnProp$3 = Object.prototype.hasOwnProperty, __propIsEnum$3 = Object.prototype.propertyIsEnumerable, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$3 = (a2, b) => {
4116
+ for (var prop in b || (b = {}))
4117
+ __hasOwnProp$3.call(b, prop) && __defNormalProp$3(a2, prop, b[prop]);
4118
+ if (__getOwnPropSymbols$3)
4119
+ for (var prop of __getOwnPropSymbols$3(b))
4120
+ __propIsEnum$3.call(b, prop) && __defNormalProp$3(a2, prop, b[prop]);
4121
+ return a2;
4122
+ }, __spreadProps$1 = (a2, b) => __defProps$1(a2, __getOwnPropDescs$1(b)), __objRest = (source, exclude) => {
4123
+ var target = {};
4124
+ for (var prop in source)
4125
+ __hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
4126
+ if (source != null && __getOwnPropSymbols$3)
4127
+ for (var prop of __getOwnPropSymbols$3(source))
4128
+ exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop) && (target[prop] = source[prop]);
4129
+ return target;
4130
+ };
3942
4131
  const INITIAL_STATE = {
3943
4132
  stagedUpload: null,
3944
4133
  uploadStatus: null,
@@ -3956,34 +4145,31 @@ function Uploader(props) {
3956
4145
  })()
3957
4146
  ).current, uploadRef = useRef(null), [state, dispatch] = useReducer(
3958
4147
  (prev, action) => {
3959
- var _a2, _b;
4148
+ var _b, _c;
3960
4149
  switch (action.action) {
3961
4150
  case "stageUpload":
3962
4151
  return Object.assign({}, INITIAL_STATE, { stagedUpload: action.input });
3963
4152
  case "commitUpload":
3964
4153
  return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
3965
4154
  case "progressInfo": {
3966
- const { type, action: _, ...payload } = action;
4155
+ const _a2 = action, payload = __objRest(_a2, ["type", "action"]);
3967
4156
  return Object.assign({}, prev, {
3968
- uploadStatus: {
3969
- ...prev.uploadStatus,
3970
- progress: prev.uploadStatus.progress,
3971
- ...payload
3972
- }
4157
+ uploadStatus: __spreadValues$3(__spreadProps$1(__spreadValues$3({}, prev.uploadStatus), {
4158
+ progress: prev.uploadStatus.progress
4159
+ }), payload)
3973
4160
  });
3974
4161
  }
3975
4162
  case "progress":
3976
4163
  return Object.assign({}, prev, {
3977
- uploadStatus: {
3978
- ...prev.uploadStatus,
4164
+ uploadStatus: __spreadProps$1(__spreadValues$3({}, prev.uploadStatus), {
3979
4165
  progress: action.percent
3980
- }
4166
+ })
3981
4167
  });
3982
4168
  case "reset":
3983
4169
  case "complete":
3984
- return (_a2 = uploadRef.current) == null || _a2.unsubscribe(), uploadRef.current = null, INITIAL_STATE;
4170
+ return (_b = uploadRef.current) == null || _b.unsubscribe(), uploadRef.current = null, INITIAL_STATE;
3985
4171
  case "error":
3986
- return (_b = uploadRef.current) == null || _b.unsubscribe(), uploadRef.current = null, Object.assign({}, INITIAL_STATE, { error: action.error });
4172
+ return (_c = uploadRef.current) == null || _c.unsubscribe(), uploadRef.current = null, Object.assign({}, INITIAL_STATE, { error: action.error });
3987
4173
  default:
3988
4174
  return prev;
3989
4175
  }
@@ -4033,7 +4219,7 @@ function Uploader(props) {
4033
4219
  case "uuid":
4034
4220
  case "file":
4035
4221
  case "url":
4036
- dispatch({ action: "progressInfo", ...event });
4222
+ dispatch(__spreadValues$3({ action: "progressInfo" }, event));
4037
4223
  break;
4038
4224
  case "progress":
4039
4225
  dispatch({ action: "progress", percent: event.percent });
@@ -4166,6 +4352,14 @@ function Uploader(props) {
4166
4352
  )
4167
4353
  ] });
4168
4354
  }
4355
+ var __defProp$2 = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2 = Object.getOwnPropertySymbols, __hasOwnProp$2 = Object.prototype.hasOwnProperty, __propIsEnum$2 = Object.prototype.propertyIsEnumerable, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$2 = (a2, b) => {
4356
+ for (var prop in b || (b = {}))
4357
+ __hasOwnProp$2.call(b, prop) && __defNormalProp$2(a2, prop, b[prop]);
4358
+ if (__getOwnPropSymbols$2)
4359
+ for (var prop of __getOwnPropSymbols$2(b))
4360
+ __propIsEnum$2.call(b, prop) && __defNormalProp$2(a2, prop, b[prop]);
4361
+ return a2;
4362
+ }, __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
4169
4363
  const Input = (props) => {
4170
4364
  var _a;
4171
4365
  const client = useClient(), secretDocumentValues = useSecretsDocumentValues(), assetDocumentValues = useAssetDocumentValues((_a = props.value) == null ? void 0 : _a.asset), poll = useMuxPolling(props.readOnly ? void 0 : (assetDocumentValues == null ? void 0 : assetDocumentValues.value) || void 0), [dialogState, setDialogState] = useDialogState(), error = secretDocumentValues.error || assetDocumentValues.error || poll.error;
@@ -4175,8 +4369,7 @@ const Input = (props) => {
4175
4369
  return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(ErrorBoundaryCard$1, { schemaType: props.schemaType, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(InputFallback, {}), children: isLoading ? /* @__PURE__ */ jsx(InputFallback, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
4176
4370
  secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /* @__PURE__ */ jsx(Onboard, { setDialogState }) : /* @__PURE__ */ jsx(
4177
4371
  Uploader,
4178
- {
4179
- ...props,
4372
+ __spreadProps(__spreadValues$2({}, props), {
4180
4373
  config: props.config,
4181
4374
  onChange: props.onChange,
4182
4375
  client,
@@ -4185,7 +4378,7 @@ const Input = (props) => {
4185
4378
  dialogState,
4186
4379
  setDialogState,
4187
4380
  needsSetup: secretDocumentValues.value.needsSetup
4188
- }
4381
+ })
4189
4382
  ),
4190
4383
  dialogState === "secrets" && /* @__PURE__ */ jsx(
4191
4384
  ConfigureApi$1,
@@ -4196,11 +4389,18 @@ const Input = (props) => {
4196
4389
  )
4197
4390
  ] }) }) }) });
4198
4391
  };
4199
- var Input$1 = memo(Input);
4392
+ var Input$1 = memo(Input), __defProp$1 = Object.defineProperty, __getOwnPropSymbols$1 = Object.getOwnPropertySymbols, __hasOwnProp$1 = Object.prototype.hasOwnProperty, __propIsEnum$1 = Object.prototype.propertyIsEnumerable, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$1 = (a2, b) => {
4393
+ for (var prop in b || (b = {}))
4394
+ __hasOwnProp$1.call(b, prop) && __defNormalProp$1(a2, prop, b[prop]);
4395
+ if (__getOwnPropSymbols$1)
4396
+ for (var prop of __getOwnPropSymbols$1(b))
4397
+ __propIsEnum$1.call(b, prop) && __defNormalProp$1(a2, prop, b[prop]);
4398
+ return a2;
4399
+ };
4200
4400
  function muxVideoCustomRendering(config) {
4201
4401
  return {
4202
4402
  components: {
4203
- input: (props) => /* @__PURE__ */ jsx(Input$1, { config: { ...config, ...props.schemaType.options }, ...props })
4403
+ input: (props) => /* @__PURE__ */ jsx(Input$1, __spreadValues$1({ config: __spreadValues$1(__spreadValues$1({}, config), props.schemaType.options) }, props))
4204
4404
  },
4205
4405
  preview: {
4206
4406
  select: {
@@ -4388,7 +4588,16 @@ const muxVideoSchema = {
4388
4588
  muxStaticRenditions,
4389
4589
  muxAssetData,
4390
4590
  muxVideoAsset
4391
- ], defaultConfig = {
4591
+ ];
4592
+ var __defProp = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a2, b) => {
4593
+ for (var prop in b || (b = {}))
4594
+ __hasOwnProp.call(b, prop) && __defNormalProp(a2, prop, b[prop]);
4595
+ if (__getOwnPropSymbols)
4596
+ for (var prop of __getOwnPropSymbols(b))
4597
+ __propIsEnum.call(b, prop) && __defNormalProp(a2, prop, b[prop]);
4598
+ return a2;
4599
+ };
4600
+ const defaultConfig = {
4392
4601
  mp4_support: "none",
4393
4602
  encoding_tier: "smart",
4394
4603
  max_resolution_tier: "1080p",
@@ -4396,16 +4605,13 @@ const muxVideoSchema = {
4396
4605
  defaultSigned: !1,
4397
4606
  tool: DEFAULT_TOOL_CONFIG
4398
4607
  }, muxInput = definePlugin((userConfig) => {
4399
- const config = { ...defaultConfig, ...userConfig || {} };
4608
+ const config = __spreadValues(__spreadValues({}, defaultConfig), userConfig || {});
4400
4609
  return {
4401
4610
  name: "mux-input",
4402
4611
  schema: {
4403
4612
  types: [
4404
4613
  ...schemaTypes,
4405
- {
4406
- ...muxVideoSchema,
4407
- ...muxVideoCustomRendering(config)
4408
- }
4614
+ __spreadValues(__spreadValues({}, muxVideoSchema), muxVideoCustomRendering(config))
4409
4615
  ]
4410
4616
  },
4411
4617
  tools: config.tool === !1 ? void 0 : [createStudioTool(config)]