sanity-plugin-mux-input 2.3.2 → 2.3.4

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/lib/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { useClient as useClient$1, createHookFromObservableFactory, useDocumentS
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, AddIcon, TranslateIcon, DocumentVideoIcon } from "@sanity/icons";
4
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, Radio, Autocomplete, rem } from "@sanity/ui";
5
- import React, { useState, useMemo, useEffect, useRef, useId, memo, isValidElement, useCallback, useReducer, createElement, forwardRef, Suspense } from "react";
5
+ import React, { useState, useMemo, useEffect, useRef, useId, memo, isValidElement, useCallback, useReducer, PureComponent, createElement, forwardRef, Suspense } from "react";
6
6
  import compact from "lodash/compact.js";
7
7
  import toLower from "lodash/toLower.js";
8
8
  import trim from "lodash/trim.js";
@@ -21,7 +21,6 @@ import isString from "lodash/isString.js";
21
21
  import { useMemoObservable } from "react-rx";
22
22
  import useSWR from "swr";
23
23
  import scrollIntoView from "scroll-into-view-if-needed";
24
- import { useErrorBoundary } from "use-error-boundary";
25
24
  import { UpChunk } from "@mux/upchunk";
26
25
  import { isValidElementType } from "react-is";
27
26
  import LanguagesList from "iso-639-1";
@@ -144,7 +143,7 @@ function accumulateIntermediateState(currentState, pageResult) {
144
143
  ...currentData,
145
144
  ...("data" in pageResult && pageResult.data || []).filter(
146
145
  // De-duplicate assets for safety
147
- (asset) => !currentData.some((a) => a.id === asset.id)
146
+ (asset) => !currentData.some((a2) => a2.id === asset.id)
148
147
  )
149
148
  ],
150
149
  error: "error" in pageResult ? pageResult.error : (
@@ -191,7 +190,7 @@ function useMuxAssets({ secrets, enabled }) {
191
190
  return () => subscription.unsubscribe();
192
191
  }, [enabled]), state;
193
192
  }
194
- const name$1 = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
193
+ const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
195
194
  const { error, isLoading, value } = useDocumentValues(
196
195
  muxSecretsDocumentId,
197
196
  path$1
@@ -218,7 +217,7 @@ function useImportMuxAssets() {
218
217
  }), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!((_a = secretDocumentValues.value.secrets) != null && _a.secretKey), [importError, setImportError] = useState(), [importState, setImportState] = useState("closed"), dialogOpen = importState !== "closed", muxAssets = useMuxAssets({
219
218
  secrets: secretDocumentValues.value.secrets,
220
219
  enabled: hasSecrets && dialogOpen
221
- }), missingAssets = useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((a) => !assetExistsInSanity(a, assetsInSanity)) : void 0, [assetsInSanity, muxAssets.data]), [selectedAssets, setSelectedAssets] = useState([]), closeDialog = () => {
220
+ }), missingAssets = useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((a2) => !assetExistsInSanity(a2, assetsInSanity)) : void 0, [assetsInSanity, muxAssets.data]), [selectedAssets, setSelectedAssets] = useState([]), closeDialog = () => {
222
221
  importState !== "importing" && setImportState("closed");
223
222
  }, openDialog = () => {
224
223
  importState === "closed" && setImportState("idle");
@@ -654,9 +653,9 @@ function ImportVideosDialog(props) {
654
653
  {
655
654
  asset,
656
655
  selectAsset: (selected) => {
657
- selected ? props.setSelectedAssets([...props.selectedAssets, asset]) : props.setSelectedAssets(props.selectedAssets.filter((a) => a.id !== asset.id));
656
+ selected ? props.setSelectedAssets([...props.selectedAssets, asset]) : props.setSelectedAssets(props.selectedAssets.filter((a2) => a2.id !== asset.id));
658
657
  },
659
- selected: props.selectedAssets.some((a) => a.id === asset.id)
658
+ selected: props.selectedAssets.some((a2) => a2.id === asset.id)
660
659
  },
661
660
  asset.id
662
661
  ))
@@ -683,17 +682,17 @@ function SelectSortOptions(props) {
683
682
  {
684
683
  button: /* @__PURE__ */ jsx(Button, { text: "Sort", icon: SortIcon, mode: "bleed", padding: 3, style: { cursor: "pointer" } }),
685
684
  id,
686
- menu: /* @__PURE__ */ jsx(Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([type2, { label }]) => /* @__PURE__ */ jsx(
685
+ menu: /* @__PURE__ */ jsx(Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([type, { label }]) => /* @__PURE__ */ jsx(
687
686
  MenuItem,
688
687
  {
689
688
  "data-as": "button",
690
- onClick: () => props.setSort(type2),
689
+ onClick: () => props.setSort(type),
691
690
  padding: 3,
692
691
  tone: "default",
693
692
  text: label,
694
- pressed: type2 === props.sort
693
+ pressed: type === props.sort
695
694
  },
696
- type2
695
+ type
697
696
  )) }),
698
697
  popover: CONTEXT_MENU_POPOVER_PROPS
699
698
  }
@@ -712,11 +711,11 @@ const SpinnerBox = () => /* @__PURE__ */ jsx(
712
711
  }
713
712
  );
714
713
  function FormField(props) {
715
- const { children, title, description: description2, inputId } = props;
714
+ const { children, title, description, inputId } = props;
716
715
  return /* @__PURE__ */ jsxs(Stack, { space: 1, children: [
717
716
  /* @__PURE__ */ jsx(Flex, { align: "flex-end", children: /* @__PURE__ */ jsx(Box, { flex: 1, paddingY: 2, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
718
717
  /* @__PURE__ */ jsx(Text, { as: "label", htmlFor: inputId, weight: "semibold", size: 1, children: title || /* @__PURE__ */ jsx("em", { children: "Untitled" }) }),
719
- description2 && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: description2 })
718
+ description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: description })
720
719
  ] }) }) }),
721
720
  /* @__PURE__ */ jsx("div", { children })
722
721
  ] });
@@ -769,132 +768,6 @@ function getVideoSrc({ asset, client }) {
769
768
  }
770
769
  return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
771
770
  }
772
- var name = "sanity-plugin-mux-input", version = "2.3.2", description = "An input component that integrates Sanity Studio with Mux video encoding/hosting service.", keywords = [
773
- "sanity",
774
- "video",
775
- "mux",
776
- "input",
777
- "plugin",
778
- "sanity-plugin",
779
- "media"
780
- ], homepage = "https://github.com/sanity-io/sanity-plugin-mux-input#readme", bugs = {
781
- url: "https://github.com/sanity-io/sanity-plugin-mux-input/issues"
782
- }, repository = {
783
- type: "git",
784
- url: "git@github.com:sanity-io/sanity-plugin-mux-input.git"
785
- }, license = "MIT", author = "Sanity.io <hello@sanity.io>", sideEffects = !1, type = "module", exports = {
786
- ".": {
787
- source: "./src/_exports/index.ts",
788
- import: "./lib/index.js",
789
- require: "./lib/index.cjs",
790
- default: "./lib/index.js"
791
- },
792
- "./package.json": "./package.json"
793
- }, main = "./lib/index.cjs", module = "./lib/index.esm.js", source = "./src/_exports/index.ts", types = "./lib/index.d.ts", files = [
794
- "src",
795
- "lib",
796
- "sanity.json",
797
- "v2-incompatible.js"
798
- ], scripts = {
799
- build: "run-s clean && pkg-utils build --strict && pkg-utils --strict",
800
- clean: "rimraf lib",
801
- dev: "plugin-kit link-watch",
802
- format: "prettier --write --cache --ignore-unknown .",
803
- "link-watch": "plugin-kit link-watch",
804
- lint: "eslint .",
805
- prepare: "husky install || true",
806
- prepublishOnly: "run-s build",
807
- test: "npm run lint && npm run type-check && npm run build",
808
- "type-check": "tsc --noEmit",
809
- watch: "pkg-utils watch --strict"
810
- }, dependencies = {
811
- "@mux/mux-player-react": "^2.4.1",
812
- "@mux/upchunk": "^3.3.2",
813
- "@sanity/icons": "^2.11.7",
814
- "@sanity/incompatible-plugin": "^1.0.4",
815
- "@sanity/ui": "^2.1.0",
816
- "@sanity/uuid": "^3.0.2",
817
- "iso-639-1": "^3.1.2",
818
- "jsonwebtoken-esm": "^1.0.5",
819
- lodash: "^4.17.21",
820
- "react-rx": "^2.1.3",
821
- rxjs: "^7.8.1",
822
- "scroll-into-view-if-needed": "^3.1.0",
823
- "suspend-react": "^0.1.3",
824
- swr: "^2.2.5",
825
- "type-fest": "^4.10.2",
826
- "use-error-boundary": "^2.0.6"
827
- }, devDependencies = {
828
- "@commitlint/cli": "^19.2.1",
829
- "@commitlint/config-conventional": "^19.1.0",
830
- "@sanity/client": "^6.15.11",
831
- "@sanity/pkg-utils": "^6.0.1",
832
- "@sanity/plugin-kit": "^3.1.10",
833
- "@sanity/semantic-release-preset": "^4.1.7",
834
- "@sanity/vision": "^3.36.4",
835
- "@types/lodash": "^4.17.0",
836
- "@types/react": "^18.2.74",
837
- "@types/react-is": "^18.2.4",
838
- "@typescript-eslint/eslint-plugin": "^7.6.0",
839
- "@typescript-eslint/parser": "^7.6.0",
840
- "cz-conventional-changelog": "^3.3.0",
841
- eslint: "^8.57.0",
842
- "eslint-config-prettier": "^9.1.0",
843
- "eslint-config-sanity": "^7.1.2",
844
- "eslint-plugin-import": "^2.29.1",
845
- "eslint-plugin-prettier": "^5.1.3",
846
- "eslint-plugin-react-hooks": "^4.6.0",
847
- "eslint-plugin-simple-import-sort": "^12.0.0",
848
- husky: "^9.0.11",
849
- "lint-staged": "^15.2.2",
850
- "npm-run-all2": "^5.0.0",
851
- prettier: "^3.2.5",
852
- "prettier-plugin-packagejson": "^2.4.14",
853
- react: "^18.2.0",
854
- "react-dom": "^18.2.0",
855
- "react-is": "^18.2.0",
856
- rimraf: "^5.0.5",
857
- sanity: "^3.36.4",
858
- "semantic-release": "^23.0.7",
859
- "styled-components": "^6.1.8",
860
- typescript: "5.4.2",
861
- yalc: "1.0.0-pre.53"
862
- }, peerDependencies = {
863
- react: "^18",
864
- "react-is": "^18",
865
- sanity: "^3",
866
- "styled-components": "^6"
867
- }, engines = {
868
- node: ">=14"
869
- }, publishConfig = {
870
- access: "public",
871
- provenance: !0
872
- }, sanityExchangeUrl = "https://www.sanity.io/plugins/sanity-plugin-mux-input", pluginPkg = {
873
- name,
874
- version,
875
- description,
876
- keywords,
877
- homepage,
878
- bugs,
879
- repository,
880
- license,
881
- author,
882
- sideEffects,
883
- type,
884
- exports,
885
- main,
886
- module,
887
- source,
888
- types,
889
- files,
890
- scripts,
891
- dependencies,
892
- devDependencies,
893
- peerDependencies,
894
- engines,
895
- publishConfig,
896
- sanityExchangeUrl
897
- };
898
771
  function VideoPlayer({
899
772
  asset,
900
773
  children,
@@ -928,7 +801,7 @@ function VideoPlayer({
928
801
  crossOrigin: "anonymous",
929
802
  metadata: {
930
803
  player_name: "Sanity Admin Dashboard",
931
- player_version: pluginPkg.version,
804
+ player_version: "2.3.4",
932
805
  page_type: "Preview Player"
933
806
  },
934
807
  style: {
@@ -1805,7 +1678,7 @@ function VideoInBrowser({
1805
1678
  }
1806
1679
  function VideosBrowser({ onSelect }) {
1807
1680
  const { assets, isLoading, searchQuery, setSearchQuery, setSort, sort } = useAssets(), [editedAsset, setEditedAsset] = useState(null), freshEditedAsset = useMemo(
1808
- () => assets.find((a) => a._id === (editedAsset == null ? void 0 : editedAsset._id)) || editedAsset,
1681
+ () => assets.find((a2) => a2._id === (editedAsset == null ? void 0 : editedAsset._id)) || editedAsset,
1809
1682
  [editedAsset, assets]
1810
1683
  ), placement = onSelect ? "input" : "tool";
1811
1684
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2057,7 +1930,7 @@ const useSecretsFormState = (secrets) => useReducer(reducer, secrets, init), ids
2057
1930
  "r"
2058
1931
  ];
2059
1932
  function MuxLogo({ height = 26 }) {
2060
- const id = useId(), [titleId, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = useMemo(
1933
+ const id = useId(), [titleId, a2, b, c2, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = useMemo(
2061
1934
  () => ids.map((field) => `${id}-${field}`),
2062
1935
  [id]
2063
1936
  );
@@ -2076,7 +1949,7 @@ function MuxLogo({ height = 26 }) {
2076
1949
  /* @__PURE__ */ jsxs(
2077
1950
  "linearGradient",
2078
1951
  {
2079
- id: c,
1952
+ id: c2,
2080
1953
  spreadMethod: "pad",
2081
1954
  gradientTransform: "matrix(528.38055 0 0 -528.38055 63.801 159.5)",
2082
1955
  gradientUnits: "userSpaceOnUse",
@@ -2458,7 +2331,7 @@ function MuxLogo({ height = 26 }) {
2458
2331
  ]
2459
2332
  }
2460
2333
  ),
2461
- /* @__PURE__ */ jsx("clipPath", { id: a, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
2334
+ /* @__PURE__ */ jsx("clipPath", { id: a2, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
2462
2335
  /* @__PURE__ */ jsx("clipPath", { id: b, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M423.64 242h164.999V77H423.64Z" }) }),
2463
2336
  /* @__PURE__ */ jsx("clipPath", { id: e, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
2464
2337
  /* @__PURE__ */ jsx("clipPath", { id: f, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M311.3 242h93.031V77H311.3Z" }) }),
@@ -2466,7 +2339,7 @@ function MuxLogo({ height = 26 }) {
2466
2339
  /* @__PURE__ */ jsx("clipPath", { id: n, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
2467
2340
  /* @__PURE__ */ jsx("clipPath", { id: o, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("path", { d: "M69.067 242H169.12V141.947H69.067Z" }) })
2468
2341
  ] }),
2469
- /* @__PURE__ */ jsx("g", { clipPath: `url(#${a})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: /* @__PURE__ */ jsx(
2342
+ /* @__PURE__ */ jsx("g", { clipPath: `url(#${a2})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: /* @__PURE__ */ jsx(
2470
2343
  "g",
2471
2344
  {
2472
2345
  style: {
@@ -2477,7 +2350,7 @@ function MuxLogo({ height = 26 }) {
2477
2350
  "path",
2478
2351
  {
2479
2352
  style: {
2480
- fill: `url(#${c})`,
2353
+ fill: `url(#${c2})`,
2481
2354
  stroke: "none"
2482
2355
  },
2483
2356
  d: "M558.674 82.142c6.855-6.855 17.969-6.855 24.824 0 6.854 6.855 6.854 17.969 0 24.823L453.605 236.858c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
@@ -2791,9 +2664,49 @@ function ConfigureApi({ secrets, setDialogState }) {
2791
2664
  }
2792
2665
  );
2793
2666
  }
2794
- var ConfigureApi$1 = memo(ConfigureApi);
2667
+ var ConfigureApi$1 = memo(ConfigureApi), c = function(r) {
2668
+ var t, e;
2669
+ function n(t2) {
2670
+ var e2;
2671
+ return (e2 = r.call(this, t2) || this).state = { hasError: !1, error: null }, e2;
2672
+ }
2673
+ e = r, (t = n).prototype = Object.create(e.prototype), t.prototype.constructor = t, t.__proto__ = e, n.getDerivedStateFromError = function(r2) {
2674
+ return { hasError: !0, error: r2 };
2675
+ };
2676
+ var o = n.prototype;
2677
+ return o.componentDidCatch = function(r2, t2) {
2678
+ return this.props.onDidCatch(r2, t2);
2679
+ }, o.render = function() {
2680
+ var r2 = this.state, t2 = this.props, e2 = t2.render, n2 = t2.children, o2 = t2.renderError;
2681
+ return r2.hasError ? o2 ? o2({ error: r2.error }) : null : e2 ? e2() : n2 || null;
2682
+ }, n;
2683
+ }(PureComponent), u = function(r, t) {
2684
+ switch (t.type) {
2685
+ case "catch":
2686
+ return { didCatch: !0, error: t.error };
2687
+ case "reset":
2688
+ return { didCatch: !1, error: null };
2689
+ default:
2690
+ return r;
2691
+ }
2692
+ };
2693
+ function a(t) {
2694
+ var a2 = useReducer(u, { didCatch: !1, error: null }), i = a2[0], d = a2[1], h = useRef(null);
2695
+ function l() {
2696
+ return e = function(r, e2) {
2697
+ d({ type: "catch", error: r }), t && t.onDidCatch && t.onDidCatch(r, e2);
2698
+ }, function(t2) {
2699
+ return React.createElement(c, { onDidCatch: e, children: t2.children, render: t2.render, renderError: t2.renderError });
2700
+ };
2701
+ var e;
2702
+ }
2703
+ var p, s = useCallback(function() {
2704
+ h.current = l(), d({ type: "reset" });
2705
+ }, []);
2706
+ return { ErrorBoundary: (p = h.current, p !== null ? p : (h.current = l(), h.current)), didCatch: i.didCatch, error: i.error, reset: s };
2707
+ }
2795
2708
  function ErrorBoundaryCard(props) {
2796
- const { children, schemaType } = props, { push: pushToast } = useToast(), errorRef = useRef(null), { ErrorBoundary, didCatch, error, reset } = useErrorBoundary({
2709
+ const { children, schemaType } = props, { push: pushToast } = useToast(), errorRef = useRef(null), { ErrorBoundary, didCatch, error, reset } = a({
2797
2710
  onDidCatch: (err, errorInfo) => {
2798
2711
  console.group(err.toString()), console.groupCollapsed("console.error"), console.error(err), console.groupEnd(), err.stack && (console.groupCollapsed("error.stack"), console.log(err.stack), console.groupEnd()), errorInfo != null && errorInfo.componentStack && (console.groupCollapsed("errorInfo.componentStack"), console.log(errorInfo.componentStack), console.groupEnd()), console.groupEnd(), pushToast({
2799
2712
  status: "error",
@@ -2821,12 +2734,12 @@ function ErrorBoundaryCard(props) {
2821
2734
  });
2822
2735
  }
2823
2736
  }), handleRetry = useCallback(() => {
2824
- clear([name$1]), reset();
2737
+ clear([name]), reset();
2825
2738
  }, [reset]);
2826
2739
  return didCatch ? /* @__PURE__ */ jsx(Card, { ref: errorRef, paddingX: [2, 3, 4, 4], height: "fill", shadow: 1, overflow: "auto", children: /* @__PURE__ */ jsx(Flex, { justify: "flex-start", align: "center", height: "fill", children: /* @__PURE__ */ jsxs(Grid, { columns: 1, gap: [2, 3, 4, 4], children: [
2827
2740
  /* @__PURE__ */ jsxs(Heading, { as: "h1", children: [
2828
2741
  "The ",
2829
- /* @__PURE__ */ jsx("code", { children: name$1 }),
2742
+ /* @__PURE__ */ jsx("code", { children: name }),
2830
2743
  " plugin crashed"
2831
2744
  ] }),
2832
2745
  (error == null ? void 0 : error.message) && /* @__PURE__ */ jsx(Card, { padding: 3, tone: "critical", shadow: 1, radius: 2, children: /* @__PURE__ */ jsx(Text, { children: error.message }) }),
@@ -2869,11 +2782,11 @@ function Onboard(props) {
2869
2782
  }
2870
2783
  ) }) });
2871
2784
  }
2872
- function createUpChunkObservable(uuid2, uploadUrl2, source2) {
2785
+ function createUpChunkObservable(uuid2, uploadUrl2, source) {
2873
2786
  return new Observable((subscriber) => {
2874
2787
  const upchunk = UpChunk.createUpload({
2875
2788
  endpoint: uploadUrl2,
2876
- file: source2,
2789
+ file: source,
2877
2790
  dynamicChunkSize: !0
2878
2791
  // changes the chunk size based on network speeds
2879
2792
  }), successHandler = () => {
@@ -3067,8 +2980,8 @@ function isValidUrl(url) {
3067
2980
  }
3068
2981
  }
3069
2982
  function extractDroppedFiles(dataTransfer) {
3070
- const files2 = Array.from(dataTransfer.files || []), items = Array.from(dataTransfer.items || []);
3071
- return files2 && files2.length > 0 ? Promise.resolve(files2) : normalizeItems(items).then((arr) => arr.flat());
2983
+ const files = Array.from(dataTransfer.files || []), items = Array.from(dataTransfer.items || []);
2984
+ return files && files.length > 0 ? Promise.resolve(files) : normalizeItems(items).then((arr) => arr.flat());
3072
2985
  }
3073
2986
  function normalizeItems(items) {
3074
2987
  return Promise.all(
@@ -3439,12 +3352,12 @@ function formatBytes(bytes, si = !1, dp = 1) {
3439
3352
  if (Math.abs(bytes) < thresh)
3440
3353
  return bytes + " B";
3441
3354
  const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
3442
- let u = -1;
3355
+ let u2 = -1;
3443
3356
  const r = 10 ** dp;
3444
3357
  do
3445
- bytes /= thresh, ++u;
3446
- while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
3447
- return bytes.toFixed(dp) + " " + units[u];
3358
+ bytes /= thresh, ++u2;
3359
+ while (Math.round(Math.abs(bytes) * r) / r >= thresh && u2 < units.length - 1);
3360
+ return bytes.toFixed(dp) + " " + units[u2];
3448
3361
  }
3449
3362
  const SUPPORTED_MUX_LANGUAGES = [
3450
3363
  { label: "English", code: "en", state: "Stable" },
@@ -3496,7 +3409,7 @@ function TrackEditor({
3496
3409
  track,
3497
3410
  dispatch
3498
3411
  }) {
3499
- const { _id: id, type: type2 } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
3412
+ const { _id: id, type } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
3500
3413
  ({ value }) => !(value === "autogenerated" && !canAutoGenerate)
3501
3414
  );
3502
3415
  return trackTypes.length === 0 ? null : /* @__PURE__ */ jsx(Card, { border: !0, padding: 3, radius: 2, style: { position: "relative" }, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
@@ -3506,7 +3419,7 @@ function TrackEditor({
3506
3419
  /* @__PURE__ */ jsx(
3507
3420
  Radio,
3508
3421
  {
3509
- checked: type2 === value,
3422
+ checked: type === value,
3510
3423
  name: "track-type",
3511
3424
  onChange: (e) => dispatchTrackAction({
3512
3425
  subAction: "update",
@@ -3631,7 +3544,7 @@ function UploadConfiguration({
3631
3544
  encoding_tier: action.value,
3632
3545
  mp4_support: "none",
3633
3546
  max_resolution_tier: "1080p",
3634
- text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type: type2 }) => type2 !== "autogenerated")
3547
+ text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type }) => type !== "autogenerated")
3635
3548
  }) : Object.assign({}, prev, {
3636
3549
  encoding_tier: action.value,
3637
3550
  mp4_support: pluginConfig.mp4_support,
@@ -4072,7 +3985,7 @@ function Uploader(props) {
4072
3985
  case "commitUpload":
4073
3986
  return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
4074
3987
  case "progressInfo": {
4075
- const { type: type2, action: _, ...payload } = action;
3988
+ const { type, action: _, ...payload } = action;
4076
3989
  return Object.assign({}, prev, {
4077
3990
  uploadStatus: {
4078
3991
  ...prev.uploadStatus,
@@ -4161,10 +4074,10 @@ function Uploader(props) {
4161
4074
  complete: () => dispatch({ action: "complete" }),
4162
4075
  error: (error) => dispatch({ action: "error", error })
4163
4076
  });
4164
- }, handleUpload = (files2) => {
4077
+ }, handleUpload = (files) => {
4165
4078
  dispatch({
4166
4079
  action: "stageUpload",
4167
- input: { type: "file", files: files2 }
4080
+ input: { type: "file", files }
4168
4081
  });
4169
4082
  }, handlePaste = (event) => {
4170
4083
  event.preventDefault(), event.stopPropagation();
@@ -4175,10 +4088,10 @@ function Uploader(props) {
4175
4088
  }
4176
4089
  dispatch({ action: "stageUpload", input: { type: "url", url } });
4177
4090
  }, handleDrop = (event) => {
4178
- setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((files2) => {
4091
+ setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((files) => {
4179
4092
  dispatch({
4180
4093
  action: "stageUpload",
4181
- input: { type: "file", files: files2 }
4094
+ input: { type: "file", files }
4182
4095
  });
4183
4096
  });
4184
4097
  }, handleDragOver = (event) => {
@@ -4186,8 +4099,8 @@ function Uploader(props) {
4186
4099
  }, handleDragEnter = (event) => {
4187
4100
  var _a2, _b;
4188
4101
  event.stopPropagation(), dragEnteredEls.current.push(event.target);
4189
- const type2 = (_b = (_a2 = event.dataTransfer.items) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type;
4190
- setDragState(type2 != null && type2.startsWith("video/") ? "valid" : "invalid");
4102
+ const type = (_b = (_a2 = event.dataTransfer.items) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type;
4103
+ setDragState(type != null && type.startsWith("video/") ? "valid" : "invalid");
4191
4104
  }, handleDragLeave = (event) => {
4192
4105
  event.stopPropagation();
4193
4106
  const idx = dragEnteredEls.current.indexOf(event.target);