sanity-plugin-mux-input 2.4.1 → 2.6.0
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/README.md +59 -55
- package/dist/index.js +511 -1079
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +515 -1083
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -19
- package/src/actions/secrets.ts +19 -9
- package/src/components/ConfigureApi.tsx +2 -0
- package/src/components/EditThumbnailDialog.tsx +122 -0
- package/src/components/MuxLogo.tsx +26 -447
- package/src/components/PlayerActionsMenu.tsx +13 -0
- package/src/components/UploadConfiguration.tsx +29 -26
- package/src/components/Uploader.tsx +21 -15
- package/src/components/VideoDetails/useVideoDetails.ts +5 -5
- package/src/components/VideoPlayer.tsx +66 -49
- package/src/components/VideoThumbnail.tsx +15 -8
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +44 -0
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +60 -0
- package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +29 -0
- package/src/context/DialogStateContext.tsx +36 -0
- package/src/hooks/useAssets.ts +26 -29
- package/src/util/createUrlParamsObject.ts +25 -0
- package/src/util/formatSeconds.ts +28 -1
- package/src/util/getAnimatedPosterSrc.ts +5 -13
- package/src/util/getPosterSrc.ts +10 -15
- package/src/util/getVideoMetadata.ts +1 -1
- package/src/util/types.ts +7 -2
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
mod
|
|
20
20
|
));
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
22
|
-
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"),
|
|
22
|
+
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), rxjs = require("rxjs"), operators = require("rxjs/operators"), suspendReact = require("suspend-react"), MuxPlayer = require("@mux/mux-player-react"), desk = require("sanity/desk"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is"), LanguagesList = require("iso-639-1");
|
|
23
23
|
function _interopDefaultCompat(e) {
|
|
24
24
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
25
25
|
}
|
|
@@ -40,14 +40,6 @@ const ToolIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
40
40
|
function useClient() {
|
|
41
41
|
return sanity.useClient({ 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
|
-
};
|
|
51
43
|
const SPECIAL_CHARS = /([^!@#$%^&*(),\\/?";:{}|[\]+<>\s-])+/g, STRIP_EDGE_CHARS = /(^[.]+)|([.]+$)/;
|
|
52
44
|
function tokenize(string) {
|
|
53
45
|
return (string.match(SPECIAL_CHARS) || []).map((token) => token.replace(STRIP_EDGE_CHARS, ""));
|
|
@@ -69,53 +61,43 @@ function createSearchFilter(query) {
|
|
|
69
61
|
return {
|
|
70
62
|
filter: createConstraints(terms, query.length >= 8),
|
|
71
63
|
// if the search is big enough, include the assetId (mux id) in the results
|
|
72
|
-
params:
|
|
64
|
+
params: {
|
|
65
|
+
...toGroqParams(terms)
|
|
66
|
+
}
|
|
73
67
|
};
|
|
74
68
|
}
|
|
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));
|
|
83
69
|
const ASSET_SORT_OPTIONS = {
|
|
84
70
|
createdDesc: { groq: "_createdAt desc", label: "Newest first" },
|
|
85
71
|
createdAsc: { groq: "_createdAt asc", label: "First created (oldest)" },
|
|
86
72
|
filenameAsc: { groq: "filename asc", label: "By filename (A-Z)" },
|
|
87
73
|
filenameDesc: { groq: "filename desc", label: "By filename (Z-A)" }
|
|
88
|
-
}, useAssetDocuments = ({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
apiVersion: SANITY_API_VERSION
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}, [documentStore, sort, searchQuery]);
|
|
104
|
-
return reactRx.useObservable(memoizedObservable, void 0);
|
|
105
|
-
};
|
|
74
|
+
}, useAssetDocuments = sanity.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
|
+
});
|
|
106
85
|
function useAssets() {
|
|
107
|
-
const documentStore = sanity.useDocumentStore(), [sort, setSort] = React.useState("createdDesc"), [searchQuery, setSearchQuery] = React.useState(""),
|
|
86
|
+
const documentStore = sanity.useDocumentStore(), [sort, setSort] = React.useState("createdDesc"), [searchQuery, setSearchQuery] = React.useState(""), [assetDocuments = [], isLoading] = useAssetDocuments(
|
|
87
|
+
React.useMemo(() => ({ documentStore, sort, searchQuery }), [documentStore, sort, searchQuery])
|
|
88
|
+
);
|
|
108
89
|
return {
|
|
109
90
|
assets: React.useMemo(
|
|
110
91
|
() => (
|
|
111
92
|
// Avoid displaying both drafts & published assets by collating them together and giving preference to drafts
|
|
112
|
-
sanity.collate(
|
|
113
|
-
(collated) =>
|
|
93
|
+
sanity.collate(assetDocuments).map(
|
|
94
|
+
(collated) => ({
|
|
95
|
+
...collated.draft || collated.published || {},
|
|
114
96
|
_id: collated.id
|
|
115
97
|
})
|
|
116
98
|
)
|
|
117
99
|
),
|
|
118
|
-
[
|
|
100
|
+
[assetDocuments]
|
|
119
101
|
),
|
|
120
102
|
isLoading,
|
|
121
103
|
sort,
|
|
@@ -127,14 +109,6 @@ function useAssets() {
|
|
|
127
109
|
function parseMuxDate(date) {
|
|
128
110
|
return new Date(Number(date) * 1e3);
|
|
129
111
|
}
|
|
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));
|
|
138
112
|
const FIRST_PAGE = 1, ASSETS_PER_PAGE = 100;
|
|
139
113
|
async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
140
114
|
try {
|
|
@@ -156,7 +130,7 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
|
156
130
|
pageNum,
|
|
157
131
|
data: json.data
|
|
158
132
|
};
|
|
159
|
-
} catch
|
|
133
|
+
} catch {
|
|
160
134
|
return {
|
|
161
135
|
pageNum,
|
|
162
136
|
error: { _tag: "FetchError" }
|
|
@@ -165,7 +139,8 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
|
165
139
|
}
|
|
166
140
|
function accumulateIntermediateState(currentState, pageResult) {
|
|
167
141
|
const currentData = "data" in currentState && currentState.data || [];
|
|
168
|
-
return
|
|
142
|
+
return {
|
|
143
|
+
...currentState,
|
|
169
144
|
data: [
|
|
170
145
|
...currentData,
|
|
171
146
|
...("data" in pageResult && pageResult.data || []).filter(
|
|
@@ -179,7 +154,7 @@ function accumulateIntermediateState(currentState, pageResult) {
|
|
|
179
154
|
),
|
|
180
155
|
pageNum: pageResult.pageNum,
|
|
181
156
|
loading: !0
|
|
182
|
-
}
|
|
157
|
+
};
|
|
183
158
|
}
|
|
184
159
|
function hasMorePages(pageResult) {
|
|
185
160
|
return typeof pageResult == "object" && "data" in pageResult && Array.isArray(pageResult.data) && pageResult.data.length > 0;
|
|
@@ -207,7 +182,8 @@ function useMuxAssets({ secrets, enabled }) {
|
|
|
207
182
|
).subscribe({
|
|
208
183
|
// Once done, let the user know we've stopped loading
|
|
209
184
|
complete: () => {
|
|
210
|
-
setState((prev) =>
|
|
185
|
+
setState((prev) => ({
|
|
186
|
+
...prev,
|
|
211
187
|
loading: !1
|
|
212
188
|
}));
|
|
213
189
|
}
|
|
@@ -221,25 +197,24 @@ const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumen
|
|
|
221
197
|
path$1
|
|
222
198
|
), cache = React.useMemo(() => {
|
|
223
199
|
const exists = !!value, secrets = {
|
|
224
|
-
token:
|
|
225
|
-
secretKey:
|
|
226
|
-
enableSignedUrls:
|
|
227
|
-
signingKeyId:
|
|
228
|
-
signingKeyPrivate:
|
|
200
|
+
token: value?.token || null,
|
|
201
|
+
secretKey: value?.secretKey || null,
|
|
202
|
+
enableSignedUrls: value?.enableSignedUrls || !1,
|
|
203
|
+
signingKeyId: value?.signingKeyId || null,
|
|
204
|
+
signingKeyPrivate: value?.signingKeyPrivate || null
|
|
229
205
|
};
|
|
230
206
|
return {
|
|
231
207
|
isInitialSetup: !exists,
|
|
232
|
-
needsSetup: !
|
|
208
|
+
needsSetup: !secrets?.token || !secrets?.secretKey,
|
|
233
209
|
secrets
|
|
234
210
|
};
|
|
235
211
|
}, [value]);
|
|
236
212
|
return { error, isLoading, value: cache };
|
|
237
213
|
};
|
|
238
214
|
function useImportMuxAssets() {
|
|
239
|
-
var _a;
|
|
240
215
|
const documentStore = sanity.useDocumentStore(), client = sanity.useClient({
|
|
241
216
|
apiVersion: SANITY_API_VERSION
|
|
242
|
-
}), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!
|
|
217
|
+
}), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!secretDocumentValues.value.secrets?.secretKey, [importError, setImportError] = React.useState(), [importState, setImportState] = React.useState("closed"), dialogOpen = importState !== "closed", muxAssets = useMuxAssets({
|
|
243
218
|
secrets: secretDocumentValues.value.secrets,
|
|
244
219
|
enabled: hasSecrets && dialogOpen
|
|
245
220
|
}), missingAssets = React.useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((a2) => !assetExistsInSanity(a2, assetsInSanity)) : void 0, [assetsInSanity, muxAssets.data]), [selectedAssets, setSelectedAssets] = React.useState([]), closeDialog = () => {
|
|
@@ -273,8 +248,7 @@ function useImportMuxAssets() {
|
|
|
273
248
|
};
|
|
274
249
|
}
|
|
275
250
|
function muxAssetToSanityDocument(asset) {
|
|
276
|
-
|
|
277
|
-
const playbackId = (_a = (asset.playback_ids || []).find((p) => p.id)) == null ? void 0 : _a.id;
|
|
251
|
+
const playbackId = (asset.playback_ids || []).find((p) => p.id)?.id;
|
|
278
252
|
if (playbackId)
|
|
279
253
|
return {
|
|
280
254
|
_id: uuid.uuid(),
|
|
@@ -311,9 +285,8 @@ function useInView(options = {}) {
|
|
|
311
285
|
return React.useEffect(() => {
|
|
312
286
|
if (!ref.current) return;
|
|
313
287
|
const observer = new IntersectionObserver(([entry], obs) => {
|
|
314
|
-
var _a;
|
|
315
288
|
const nowInView = entry.isIntersecting && obs.thresholds.some((threshold) => entry.intersectionRatio >= threshold);
|
|
316
|
-
setInView(nowInView),
|
|
289
|
+
setInView(nowInView), options?.onChange?.(nowInView);
|
|
317
290
|
}, options), toObserve = ref.current;
|
|
318
291
|
return observer.observe(toObserve), () => {
|
|
319
292
|
toObserve && observer.unobserve(toObserve);
|
|
@@ -336,11 +309,11 @@ function readSecrets(client) {
|
|
|
336
309
|
{ _id }
|
|
337
310
|
);
|
|
338
311
|
return {
|
|
339
|
-
token:
|
|
340
|
-
secretKey:
|
|
341
|
-
enableSignedUrls: !!
|
|
342
|
-
signingKeyId:
|
|
343
|
-
signingKeyPrivate:
|
|
312
|
+
token: data?.token || null,
|
|
313
|
+
secretKey: data?.secretKey || null,
|
|
314
|
+
enableSignedUrls: !!data?.enableSignedUrls || !1,
|
|
315
|
+
signingKeyId: data?.signingKeyId || null,
|
|
316
|
+
signingKeyPrivate: data?.signingKeyPrivate || null
|
|
344
317
|
};
|
|
345
318
|
}, [cacheNs, _id, projectId, dataset]);
|
|
346
319
|
}
|
|
@@ -352,7 +325,7 @@ function generateJwt(client, playbackId, aud, payload) {
|
|
|
352
325
|
throw new TypeError("Missing `signingKeyPrivate`.\n Check your plugin's configuration");
|
|
353
326
|
const { default: sign } = suspendReact.suspend(() => import("jsonwebtoken-esm/sign"), ["jsonwebtoken-esm/sign"]);
|
|
354
327
|
return sign(
|
|
355
|
-
payload ? JSON.parse(JSON.stringify(payload, (_, v) => v
|
|
328
|
+
payload ? JSON.parse(JSON.stringify(payload, (_, v) => v ?? void 0)) : {},
|
|
356
329
|
atob(signingKeyPrivate),
|
|
357
330
|
{
|
|
358
331
|
algorithm: "RS256",
|
|
@@ -365,13 +338,23 @@ function generateJwt(client, playbackId, aud, payload) {
|
|
|
365
338
|
);
|
|
366
339
|
}
|
|
367
340
|
function getPlaybackId(asset) {
|
|
368
|
-
if (!
|
|
341
|
+
if (!asset?.playbackId)
|
|
369
342
|
throw console.error("Asset is missing a playbackId", { asset }), new TypeError("Missing playbackId");
|
|
370
343
|
return asset.playbackId;
|
|
371
344
|
}
|
|
372
345
|
function getPlaybackPolicy(asset) {
|
|
373
|
-
|
|
374
|
-
|
|
346
|
+
return asset.data?.playback_ids?.find((playbackId) => asset.playbackId === playbackId.id)?.policy ?? "public";
|
|
347
|
+
}
|
|
348
|
+
function createUrlParamsObject(client, asset, params, audience) {
|
|
349
|
+
const playbackId = getPlaybackId(asset);
|
|
350
|
+
let searchParams = new URLSearchParams(
|
|
351
|
+
JSON.parse(JSON.stringify(params, (_, v) => v ?? void 0))
|
|
352
|
+
);
|
|
353
|
+
if (getPlaybackPolicy(asset) === "signed") {
|
|
354
|
+
const token = generateJwt(client, playbackId, audience, params);
|
|
355
|
+
searchParams = new URLSearchParams({ token });
|
|
356
|
+
}
|
|
357
|
+
return { playbackId, searchParams };
|
|
375
358
|
}
|
|
376
359
|
function getAnimatedPosterSrc({
|
|
377
360
|
asset,
|
|
@@ -382,16 +365,22 @@ function getAnimatedPosterSrc({
|
|
|
382
365
|
end = start + 5,
|
|
383
366
|
fps = 15
|
|
384
367
|
}) {
|
|
385
|
-
const params = { height, width, start, end, fps }, playbackId =
|
|
386
|
-
let searchParams = new URLSearchParams(
|
|
387
|
-
JSON.parse(JSON.stringify(params, (_, v) => v != null ? v : void 0))
|
|
388
|
-
);
|
|
389
|
-
if (getPlaybackPolicy(asset) === "signed") {
|
|
390
|
-
const token = generateJwt(client, playbackId, "g", params);
|
|
391
|
-
searchParams = new URLSearchParams({ token });
|
|
392
|
-
}
|
|
368
|
+
const params = { height, width, start, end, fps }, { playbackId, searchParams } = createUrlParamsObject(client, asset, params, "g");
|
|
393
369
|
return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`;
|
|
394
370
|
}
|
|
371
|
+
function getPosterSrc({
|
|
372
|
+
asset,
|
|
373
|
+
client,
|
|
374
|
+
fit_mode,
|
|
375
|
+
height,
|
|
376
|
+
time = asset.thumbTime ?? void 0,
|
|
377
|
+
width
|
|
378
|
+
}) {
|
|
379
|
+
const params = { fit_mode, height, width };
|
|
380
|
+
time && (params.time = time);
|
|
381
|
+
const { playbackId, searchParams } = createUrlParamsObject(client, asset, params, "t");
|
|
382
|
+
return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`;
|
|
383
|
+
}
|
|
395
384
|
const Image = styledComponents.styled.img`
|
|
396
385
|
transition: opacity 0.175s ease-out 0s;
|
|
397
386
|
display: block;
|
|
@@ -406,16 +395,18 @@ const Image = styledComponents.styled.img`
|
|
|
406
395
|
};
|
|
407
396
|
function VideoThumbnail({
|
|
408
397
|
asset,
|
|
409
|
-
width
|
|
398
|
+
width,
|
|
399
|
+
staticImage = !1
|
|
410
400
|
}) {
|
|
411
|
-
const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = React.useState("loading"), client = useClient(),
|
|
401
|
+
const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = React.useState("loading"), client = useClient(), src = React.useMemo(() => {
|
|
412
402
|
try {
|
|
413
|
-
|
|
414
|
-
|
|
403
|
+
let thumbnail;
|
|
404
|
+
return staticImage ? thumbnail = getPosterSrc({ asset, client, width: posterWidth }) : thumbnail = getAnimatedPosterSrc({ asset, client, width: posterWidth }), thumbnail;
|
|
405
|
+
} catch {
|
|
415
406
|
status !== "error" && setStatus("error");
|
|
416
407
|
return;
|
|
417
408
|
}
|
|
418
|
-
}, [asset, client, posterWidth, status]);
|
|
409
|
+
}, [asset, client, posterWidth, status, staticImage]);
|
|
419
410
|
function handleLoad() {
|
|
420
411
|
setStatus("loaded");
|
|
421
412
|
}
|
|
@@ -470,8 +461,8 @@ function VideoThumbnail({
|
|
|
470
461
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
471
462
|
Image,
|
|
472
463
|
{
|
|
473
|
-
src
|
|
474
|
-
alt: `Preview for video ${asset.filename || asset.assetId}`,
|
|
464
|
+
src,
|
|
465
|
+
alt: `Preview for ${staticImage ? "image" : "video"} ${asset.filename || asset.assetId}`,
|
|
475
466
|
onLoad: handleLoad,
|
|
476
467
|
onError: handleError,
|
|
477
468
|
style: {
|
|
@@ -483,14 +474,6 @@ function VideoThumbnail({
|
|
|
483
474
|
}
|
|
484
475
|
);
|
|
485
476
|
}
|
|
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
|
-
};
|
|
494
477
|
const MissingAssetCheckbox = styledComponents.styled(ui.Checkbox)`
|
|
495
478
|
position: static !important;
|
|
496
479
|
|
|
@@ -508,7 +491,6 @@ function MissingAsset({
|
|
|
508
491
|
selectAsset,
|
|
509
492
|
selected
|
|
510
493
|
}) {
|
|
511
|
-
var _a;
|
|
512
494
|
const duration = sanity.useFormattedDuration(asset.duration * 1e3);
|
|
513
495
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
514
496
|
ui.Card,
|
|
@@ -537,7 +519,7 @@ function MissingAsset({
|
|
|
537
519
|
assetId: asset.id,
|
|
538
520
|
data: asset,
|
|
539
521
|
filename: asset.id,
|
|
540
|
-
playbackId:
|
|
522
|
+
playbackId: asset.playback_ids.find((p) => p.id)?.id
|
|
541
523
|
},
|
|
542
524
|
width: 150
|
|
543
525
|
}
|
|
@@ -568,8 +550,7 @@ function MissingAsset({
|
|
|
568
550
|
);
|
|
569
551
|
}
|
|
570
552
|
function ImportVideosDialog(props) {
|
|
571
|
-
|
|
572
|
-
const { importState } = props, canTriggerImport = (importState === "idle" || importState === "error") && props.selectedAssets.length > 0, isImporting = importState === "importing", noAssetsToImport = ((_a = props.missingAssets) == null ? void 0 : _a.length) === 0 && !props.muxAssets.loading && !props.assetsInSanityLoading;
|
|
553
|
+
const { importState } = props, canTriggerImport = (importState === "idle" || importState === "error") && props.selectedAssets.length > 0, isImporting = importState === "importing", noAssetsToImport = props.missingAssets?.length === 0 && !props.muxAssets.loading && !props.assetsInSanityLoading;
|
|
573
554
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
574
555
|
ui.Dialog,
|
|
575
556
|
{
|
|
@@ -601,7 +582,7 @@ function ImportVideosDialog(props) {
|
|
|
601
582
|
fontSize: 2,
|
|
602
583
|
padding: 3,
|
|
603
584
|
mode: "ghost",
|
|
604
|
-
text:
|
|
585
|
+
text: props.selectedAssets?.length > 0 ? `Import ${props.selectedAssets.length} video(s)` : "No video(s) selected",
|
|
605
586
|
tone: "positive",
|
|
606
587
|
onClick: props.importAssets,
|
|
607
588
|
iconRight: isImporting && ui.Spinner,
|
|
@@ -701,7 +682,7 @@ function ImportVideosDialog(props) {
|
|
|
701
682
|
function ImportVideosFromMux() {
|
|
702
683
|
const importAssets = useImportMuxAssets();
|
|
703
684
|
if (importAssets.hasSecrets)
|
|
704
|
-
return importAssets.dialogOpen ? /* @__PURE__ */ jsxRuntime.jsx(ImportVideosDialog,
|
|
685
|
+
return importAssets.dialogOpen ? /* @__PURE__ */ jsxRuntime.jsx(ImportVideosDialog, { ...importAssets }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "bleed", text: "Import from Mux", onClick: importAssets.openDialog });
|
|
705
686
|
}
|
|
706
687
|
const CONTEXT_MENU_POPOVER_PROPS = {
|
|
707
688
|
constrainSize: !0,
|
|
@@ -762,40 +743,24 @@ const IconInfo = (props) => {
|
|
|
762
743
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: props.size || 1, muted: props.muted, children: props.text })
|
|
763
744
|
] });
|
|
764
745
|
};
|
|
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));
|
|
773
746
|
function ResolutionIcon(props) {
|
|
774
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg",
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
775
748
|
"path",
|
|
776
749
|
{
|
|
777
750
|
fill: "currentColor",
|
|
778
751
|
d: "M20 9V6h-3V4h5v5h-2ZM2 9V4h5v2H4v3H2Zm15 11v-2h3v-3h2v5h-5ZM2 20v-5h2v3h3v2H2Zm4-4V8h12v8H6Zm2-2h8v-4H8v4Zm0 0v-4v4Z"
|
|
779
752
|
}
|
|
780
|
-
) })
|
|
753
|
+
) });
|
|
781
754
|
}
|
|
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));
|
|
790
755
|
function StopWatchIcon(props) {
|
|
791
756
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
792
757
|
"svg",
|
|
793
|
-
|
|
758
|
+
{
|
|
794
759
|
xmlns: "http://www.w3.org/2000/svg",
|
|
795
760
|
width: "1em",
|
|
796
761
|
height: "1em",
|
|
797
|
-
viewBox: "0 0 512 512"
|
|
798
|
-
|
|
762
|
+
viewBox: "0 0 512 512",
|
|
763
|
+
...props,
|
|
799
764
|
children: [
|
|
800
765
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M232 306.667h48V176h-48v130.667z", fill: "currentColor" }),
|
|
801
766
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -807,9 +772,17 @@ function StopWatchIcon(props) {
|
|
|
807
772
|
),
|
|
808
773
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M192 32h128v48H192z", fill: "currentColor" })
|
|
809
774
|
]
|
|
810
|
-
}
|
|
775
|
+
}
|
|
811
776
|
);
|
|
812
777
|
}
|
|
778
|
+
const DialogStateContext = React.createContext({
|
|
779
|
+
dialogState: !1,
|
|
780
|
+
setDialogState: () => null
|
|
781
|
+
}), DialogStateProvider = ({
|
|
782
|
+
dialogState,
|
|
783
|
+
setDialogState,
|
|
784
|
+
children
|
|
785
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(DialogStateContext.Provider, { value: { dialogState, setDialogState }, children }), useDialogStateContext = () => React.useContext(DialogStateContext);
|
|
813
786
|
function getVideoSrc({ asset, client }) {
|
|
814
787
|
const playbackId = getPlaybackId(asset), searchParams = new URLSearchParams();
|
|
815
788
|
if (getPlaybackPolicy(asset) === "signed") {
|
|
@@ -818,33 +791,102 @@ function getVideoSrc({ asset, client }) {
|
|
|
818
791
|
}
|
|
819
792
|
return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
|
|
820
793
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
return
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
794
|
+
function getDevicePixelRatio(options) {
|
|
795
|
+
const {
|
|
796
|
+
defaultDpr = 1,
|
|
797
|
+
maxDpr = 3,
|
|
798
|
+
round = !0
|
|
799
|
+
} = options || {}, dpr = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : defaultDpr;
|
|
800
|
+
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
801
|
+
}
|
|
802
|
+
function formatSeconds(seconds) {
|
|
803
|
+
if (typeof seconds != "number" || Number.isNaN(seconds))
|
|
804
|
+
return "";
|
|
805
|
+
const hrs = ~~(seconds / 3600), mins = ~~(seconds % 3600 / 60), secs = ~~seconds % 60;
|
|
806
|
+
let ret = "";
|
|
807
|
+
return hrs > 0 && (ret += "" + hrs + ":" + (mins < 10 ? "0" : "")), ret += "" + mins + ":" + (secs < 10 ? "0" : ""), ret += "" + secs, ret;
|
|
808
|
+
}
|
|
809
|
+
function formatSecondsToHHMMSS(seconds) {
|
|
810
|
+
const hrs = Math.floor(seconds / 3600).toString().padStart(2, "0"), mins = Math.floor(seconds % 3600 / 60).toString().padStart(2, "0"), secs = Math.floor(seconds % 60).toString().padStart(2, "0");
|
|
811
|
+
return `${hrs}:${mins}:${secs}`;
|
|
812
|
+
}
|
|
813
|
+
function isValidTimeFormat(time) {
|
|
814
|
+
return /^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$/.test(time) || time === "";
|
|
815
|
+
}
|
|
816
|
+
function getSecondsFromTimeFormat(time) {
|
|
817
|
+
const [hh = 0, mm = 0, ss = 0] = time.split(":").map(Number);
|
|
818
|
+
return hh * 3600 + mm * 60 + ss;
|
|
819
|
+
}
|
|
820
|
+
function EditThumbnailDialog({ asset, currentTime = 0 }) {
|
|
821
|
+
const client = useClient(), { setDialogState } = useDialogStateContext(), dialogId = `EditThumbnailDialog${React.useId()}`, [timeFormatted, setTimeFormatted] = React.useState(
|
|
822
|
+
() => formatSecondsToHHMMSS(currentTime)
|
|
823
|
+
), [nextTime, setNextTime] = React.useState(currentTime), [inputError, setInputError] = React.useState(""), assetWithNewThumbnail = React.useMemo(() => ({ ...asset, thumbTime: nextTime }), [asset, nextTime]), [saving, setSaving] = React.useState(!1), [saveThumbnailError, setSaveThumbnailError] = React.useState(null), handleSave = () => {
|
|
824
|
+
setSaving(!0), client.patch(asset._id).set({ thumbTime: nextTime }).commit({ returnDocuments: !1 }).then(() => void setDialogState(!1)).catch(setSaveThumbnailError).finally(() => void setSaving(!1));
|
|
825
|
+
}, width = 300 * getDevicePixelRatio({ maxDpr: 2 });
|
|
826
|
+
if (saveThumbnailError)
|
|
827
|
+
throw saveThumbnailError;
|
|
828
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
|
+
ui.Dialog,
|
|
830
|
+
{
|
|
831
|
+
id: dialogId,
|
|
832
|
+
header: "Edit thumbnail",
|
|
833
|
+
onClose: () => setDialogState(!1),
|
|
834
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
|
+
ui.Button,
|
|
836
|
+
{
|
|
837
|
+
disabled: inputError !== "",
|
|
838
|
+
mode: "ghost",
|
|
839
|
+
tone: "primary",
|
|
840
|
+
loading: saving,
|
|
841
|
+
onClick: handleSave,
|
|
842
|
+
text: "Set new thumbnail"
|
|
843
|
+
},
|
|
844
|
+
"thumbnail"
|
|
845
|
+
) }),
|
|
846
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, padding: 3, children: [
|
|
847
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
848
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: "Current:" }),
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx(VideoThumbnail, { asset, width, staticImage: !0 })
|
|
850
|
+
] }),
|
|
851
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
852
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: "New:" }),
|
|
853
|
+
/* @__PURE__ */ jsxRuntime.jsx(VideoThumbnail, { asset: assetWithNewThumbnail, width, staticImage: !0 })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 5, weight: "semibold", children: "Or" }) }) }),
|
|
856
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: "Selected time for thumbnail (hh:mm:ss):" }),
|
|
858
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
859
|
+
ui.TextInput,
|
|
860
|
+
{
|
|
861
|
+
size: 1,
|
|
862
|
+
value: timeFormatted,
|
|
863
|
+
placeholder: "hh:mm:ss",
|
|
864
|
+
onChange: (event) => {
|
|
865
|
+
const value = event.currentTarget.value;
|
|
866
|
+
if (setTimeFormatted(value), isValidTimeFormat(value)) {
|
|
867
|
+
setInputError("");
|
|
868
|
+
const totalSeconds = getSecondsFromTimeFormat(value);
|
|
869
|
+
setNextTime(totalSeconds);
|
|
870
|
+
} else
|
|
871
|
+
setInputError("Invalid time format");
|
|
872
|
+
},
|
|
873
|
+
customValidity: inputError
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
] })
|
|
877
|
+
] })
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
function VideoPlayer({
|
|
882
|
+
asset,
|
|
883
|
+
thumbnailWidth = 250,
|
|
884
|
+
children,
|
|
885
|
+
...props
|
|
886
|
+
}) {
|
|
887
|
+
const client = useClient(), { dialogState } = useDialogStateContext(), isAudio = assetIsAudio(asset), muxPlayer = React.useRef(null), thumbnail = getPosterSrc({ asset, client, width: thumbnailWidth }), { src: videoSrc, error } = React.useMemo(() => {
|
|
846
888
|
try {
|
|
847
|
-
const src =
|
|
889
|
+
const src = asset?.playbackId && getVideoSrc({ client, asset });
|
|
848
890
|
return src ? { src } : { error: new TypeError("Asset has no playback ID") };
|
|
849
891
|
} catch (error2) {
|
|
850
892
|
return { error: error2 };
|
|
@@ -852,61 +894,66 @@ function VideoPlayer(_a) {
|
|
|
852
894
|
}, [asset, client]), signedToken = React.useMemo(() => {
|
|
853
895
|
try {
|
|
854
896
|
return new URL(videoSrc).searchParams.get("token");
|
|
855
|
-
} catch
|
|
897
|
+
} catch {
|
|
856
898
|
return !1;
|
|
857
899
|
}
|
|
858
|
-
}, [videoSrc]), [width, height] = (
|
|
900
|
+
}, [videoSrc]), [width, height] = (asset?.data?.aspect_ratio ?? "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
|
|
859
901
|
let aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
|
|
860
902
|
return isAudio && (aspectRatio = props.forceAspectRatio ? (
|
|
861
903
|
// Make it wider when forcing aspect ratio to balance with videos' rendering height (audio players overflow a bit)
|
|
862
904
|
props.forceAspectRatio * 1.2
|
|
863
|
-
) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxRuntime.jsxs(
|
|
864
|
-
|
|
865
|
-
/* @__PURE__ */ jsxRuntime.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
905
|
+
) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
906
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
|
|
907
|
+
videoSrc && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
909
|
+
MuxPlayer__default.default,
|
|
910
|
+
{
|
|
911
|
+
poster: thumbnail,
|
|
912
|
+
ref: muxPlayer,
|
|
913
|
+
...props,
|
|
914
|
+
playsInline: !0,
|
|
915
|
+
playbackId: asset.playbackId,
|
|
916
|
+
tokens: signedToken ? { playback: signedToken, thumbnail: signedToken, storyboard: signedToken } : void 0,
|
|
917
|
+
preload: "metadata",
|
|
918
|
+
crossOrigin: "anonymous",
|
|
919
|
+
metadata: {
|
|
920
|
+
player_name: "Sanity Admin Dashboard",
|
|
921
|
+
player_version: "2.6.0",
|
|
922
|
+
page_type: "Preview Player"
|
|
923
|
+
},
|
|
924
|
+
audio: isAudio,
|
|
925
|
+
style: {
|
|
926
|
+
height: "100%",
|
|
927
|
+
width: "100%",
|
|
928
|
+
display: "block",
|
|
929
|
+
objectFit: "contain"
|
|
930
|
+
}
|
|
884
931
|
}
|
|
885
|
-
|
|
886
|
-
|
|
932
|
+
),
|
|
933
|
+
children
|
|
934
|
+
] }),
|
|
935
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
936
|
+
"div",
|
|
937
|
+
{
|
|
938
|
+
style: {
|
|
939
|
+
position: "absolute",
|
|
940
|
+
top: "50%",
|
|
941
|
+
left: "50%",
|
|
942
|
+
transform: "translate(-50%, -50%)"
|
|
943
|
+
},
|
|
944
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, children: [
|
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ErrorOutlineIcon, { style: { marginRight: "0.15em" } }),
|
|
946
|
+
typeof error == "object" && "message" in error && typeof error.message == "string" ? error.message : "Error loading video"
|
|
947
|
+
] })
|
|
948
|
+
}
|
|
949
|
+
) : null,
|
|
887
950
|
children
|
|
888
951
|
] }),
|
|
889
|
-
|
|
890
|
-
"div",
|
|
891
|
-
{
|
|
892
|
-
style: {
|
|
893
|
-
position: "absolute",
|
|
894
|
-
top: "50%",
|
|
895
|
-
left: "50%",
|
|
896
|
-
transform: "translate(-50%, -50%)"
|
|
897
|
-
},
|
|
898
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, children: [
|
|
899
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ErrorOutlineIcon, { style: { marginRight: "0.15em" } }),
|
|
900
|
-
typeof error == "object" && "message" in error && typeof error.message == "string" ? error.message : "Error loading video"
|
|
901
|
-
] })
|
|
902
|
-
}
|
|
903
|
-
) : null,
|
|
904
|
-
children
|
|
952
|
+
dialogState === "edit-thumbnail" && /* @__PURE__ */ jsxRuntime.jsx(EditThumbnailDialog, { asset, currentTime: muxPlayer?.current?.currentTime })
|
|
905
953
|
] });
|
|
906
954
|
}
|
|
907
955
|
function assetIsAudio(asset) {
|
|
908
|
-
|
|
909
|
-
return ((_a = asset.data) == null ? void 0 : _a.max_stored_resolution) === "Audio only";
|
|
956
|
+
return asset.data?.max_stored_resolution === "Audio only";
|
|
910
957
|
}
|
|
911
958
|
function deleteAssetOnMux(client, assetId) {
|
|
912
959
|
const { dataset } = client.config();
|
|
@@ -921,16 +968,16 @@ async function deleteAsset({
|
|
|
921
968
|
asset,
|
|
922
969
|
deleteOnMux
|
|
923
970
|
}) {
|
|
924
|
-
if (!
|
|
971
|
+
if (!asset?._id) return !0;
|
|
925
972
|
try {
|
|
926
973
|
await client.delete(asset._id);
|
|
927
|
-
} catch
|
|
974
|
+
} catch {
|
|
928
975
|
return "failed-sanity";
|
|
929
976
|
}
|
|
930
|
-
if (deleteOnMux && asset
|
|
977
|
+
if (deleteOnMux && asset?.assetId)
|
|
931
978
|
try {
|
|
932
979
|
await deleteAssetOnMux(client, asset.assetId);
|
|
933
|
-
} catch
|
|
980
|
+
} catch {
|
|
934
981
|
return "failed-mux";
|
|
935
982
|
}
|
|
936
983
|
return !0;
|
|
@@ -943,14 +990,6 @@ function getAsset(client, assetId) {
|
|
|
943
990
|
method: "GET"
|
|
944
991
|
});
|
|
945
992
|
}
|
|
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));
|
|
954
993
|
const getUnknownTypeFallback = (id, typeName) => ({
|
|
955
994
|
title: /* @__PURE__ */ jsxRuntime.jsxs("em", { children: [
|
|
956
995
|
"No schema found for type ",
|
|
@@ -964,7 +1003,7 @@ const getUnknownTypeFallback = (id, typeName) => ({
|
|
|
964
1003
|
});
|
|
965
1004
|
function MissingSchemaType(props) {
|
|
966
1005
|
const { layout, value } = props;
|
|
967
|
-
return /* @__PURE__ */ jsxRuntime.jsx(sanity.SanityDefaultPreview,
|
|
1006
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sanity.SanityDefaultPreview, { ...getUnknownTypeFallback(value._id, value._type), layout });
|
|
968
1007
|
}
|
|
969
1008
|
function TimeAgo({ time }) {
|
|
970
1009
|
const timeAgo = sanity.useTimeAgo(time);
|
|
@@ -1003,14 +1042,6 @@ function PublishedStatus(props) {
|
|
|
1003
1042
|
}
|
|
1004
1043
|
);
|
|
1005
1044
|
}
|
|
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));
|
|
1014
1045
|
function PaneItemPreview(props) {
|
|
1015
1046
|
const { icon, layout, presence, schemaType, value } = props, title = sanity.isRecord(value.title) && React.isValidElement(value.title) || isString__default.default(value.title) || isNumber__default.default(value.title) ? value.title : null, observable = React.useMemo(
|
|
1016
1047
|
() => sanity.getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id, title),
|
|
@@ -1026,12 +1057,13 @@ function PaneItemPreview(props) {
|
|
|
1026
1057
|
] });
|
|
1027
1058
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1028
1059
|
sanity.SanityDefaultPreview,
|
|
1029
|
-
|
|
1060
|
+
{
|
|
1061
|
+
...sanity.getPreviewValueWithFallback({ value, draft, published }),
|
|
1030
1062
|
isPlaceholder: isLoading,
|
|
1031
1063
|
icon,
|
|
1032
1064
|
layout,
|
|
1033
1065
|
status
|
|
1034
|
-
}
|
|
1066
|
+
}
|
|
1035
1067
|
);
|
|
1036
1068
|
}
|
|
1037
1069
|
function getIconWithFallback(icon, schemaType, defaultIcon) {
|
|
@@ -1052,7 +1084,7 @@ function DocumentPreviewInRool(props) {
|
|
|
1052
1084
|
return (linkProps) => /* @__PURE__ */ jsxRuntime.jsx(router.IntentLink, { intent: "edit", params: { id: props.documentPair.id }, children: linkProps.children });
|
|
1053
1085
|
}
|
|
1054
1086
|
function DocumentPreview(props) {
|
|
1055
|
-
const { schemaType, documentPair } = props, doc =
|
|
1087
|
+
const { schemaType, documentPair } = props, doc = documentPair?.draft || documentPair?.published, id = documentPair.id || "", documentPreviewStore = sanity.useDocumentPreviewStore(), schema = sanity.useSchema(), documentPresence = sanity.useDocumentPresence(id), hasSchemaType = !!(schemaType && schemaType.name && schema.get(schemaType.name)), PreviewComponent = React.useMemo(() => doc ? !schemaType || !hasSchemaType ? /* @__PURE__ */ jsxRuntime.jsx(MissingSchemaType, { value: doc }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
1088
|
PaneItemPreview,
|
|
1057
1089
|
{
|
|
1058
1090
|
documentPreviewStore,
|
|
@@ -1088,14 +1120,13 @@ const Container = styledComponents.styled(ui.Box)`
|
|
|
1088
1120
|
font-size: ${(props) => props.theme.sanity.fonts.text.sizes[1]};
|
|
1089
1121
|
}
|
|
1090
1122
|
`, VideoReferences = (props) => {
|
|
1091
|
-
var _a;
|
|
1092
1123
|
const schema = sanity.useSchema();
|
|
1093
1124
|
if (!props.isLoaded)
|
|
1094
1125
|
return /* @__PURE__ */ jsxRuntime.jsx(SpinnerBox, {});
|
|
1095
|
-
if (!
|
|
1126
|
+
if (!props.references?.length)
|
|
1096
1127
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { border: !0, radius: 3, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: "No documents are using this video" }) });
|
|
1097
1128
|
const documentPairs = sanity.collate(props.references || []);
|
|
1098
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: documentPairs
|
|
1129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: documentPairs?.map((documentPair) => {
|
|
1099
1130
|
const schemaType = schema.get(documentPair.type);
|
|
1100
1131
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1101
1132
|
ui.Card,
|
|
@@ -1128,7 +1159,7 @@ function DeleteDialog({
|
|
|
1128
1159
|
}) {
|
|
1129
1160
|
const client = useClient(), [state, setState] = React.useState("checkingReferences"), [deleteOnMux, setDeleteOnMux] = React.useState(!0), toast = ui.useToast();
|
|
1130
1161
|
React.useEffect(() => {
|
|
1131
|
-
state !== "checkingReferences" || referencesLoading || setState(references
|
|
1162
|
+
state !== "checkingReferences" || referencesLoading || setState(references?.length ? "cantDelete" : "confirm");
|
|
1132
1163
|
}, [state, references, referencesLoading]);
|
|
1133
1164
|
async function confirmDelete() {
|
|
1134
1165
|
if (state !== "confirm") return;
|
|
@@ -1170,7 +1201,7 @@ function DeleteDialog({
|
|
|
1170
1201
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { size: 2, children: "Video can't be deleted" }),
|
|
1171
1202
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 2, style: { marginBottom: "2rem" }, children: [
|
|
1172
1203
|
"There are ",
|
|
1173
|
-
references
|
|
1204
|
+
references?.length,
|
|
1174
1205
|
" document",
|
|
1175
1206
|
references && references.length > 0 && "s",
|
|
1176
1207
|
" ",
|
|
@@ -1241,40 +1272,23 @@ const useDocReferences = sanity.createHookFromObservableFactory(({ documentStore
|
|
|
1241
1272
|
apiVersion: SANITY_API_VERSION
|
|
1242
1273
|
}
|
|
1243
1274
|
));
|
|
1244
|
-
function formatSeconds(seconds) {
|
|
1245
|
-
if (typeof seconds != "number" || Number.isNaN(seconds))
|
|
1246
|
-
return "";
|
|
1247
|
-
const hrs = ~~(seconds / 3600), mins = ~~(seconds % 3600 / 60), secs = ~~seconds % 60;
|
|
1248
|
-
let ret = "";
|
|
1249
|
-
return hrs > 0 && (ret += "" + hrs + ":" + (mins < 10 ? "0" : "")), ret += "" + mins + ":" + (secs < 10 ? "0" : ""), ret += "" + secs, ret;
|
|
1250
|
-
}
|
|
1251
1275
|
function getVideoMetadata(doc) {
|
|
1252
|
-
|
|
1253
|
-
const id = doc.assetId || doc._id || "", date = (_a = doc.data) != null && _a.created_at ? new Date(Number(doc.data.created_at) * 1e3) : new Date(doc._createdAt || doc._updatedAt || Date.now());
|
|
1276
|
+
const id = doc.assetId || doc._id || "", date = doc.data?.created_at ? new Date(Number(doc.data.created_at) * 1e3) : new Date(doc._createdAt || doc._updatedAt || Date.now());
|
|
1254
1277
|
return {
|
|
1255
1278
|
title: doc.filename || id.slice(0, 12),
|
|
1256
1279
|
id,
|
|
1257
1280
|
playbackId: doc.playbackId,
|
|
1258
1281
|
createdAt: date,
|
|
1259
|
-
duration:
|
|
1260
|
-
aspect_ratio:
|
|
1261
|
-
max_stored_resolution:
|
|
1262
|
-
max_stored_frame_rate:
|
|
1282
|
+
duration: doc.data?.duration ? formatSeconds(doc.data?.duration) : void 0,
|
|
1283
|
+
aspect_ratio: doc.data?.aspect_ratio,
|
|
1284
|
+
max_stored_resolution: doc.data?.max_stored_resolution,
|
|
1285
|
+
max_stored_frame_rate: doc.data?.max_stored_frame_rate
|
|
1263
1286
|
};
|
|
1264
1287
|
}
|
|
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));
|
|
1273
1288
|
function useVideoDetails(props) {
|
|
1274
|
-
const documentStore = sanity.useDocumentStore(), toast = ui.useToast(), client = useClient(), [references, referencesLoading] = useDocReferences(
|
|
1275
|
-
documentStore,
|
|
1276
|
-
|
|
1277
|
-
}), [originalAsset, setOriginalAsset] = React.useState(() => props.asset), [filename, setFilename] = React.useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata(__spreadProps$5(__spreadValues$a({}, props.asset), { filename })), [state, setState] = React.useState("idle");
|
|
1289
|
+
const documentStore = sanity.useDocumentStore(), toast = ui.useToast(), client = useClient(), [references, referencesLoading] = useDocReferences(
|
|
1290
|
+
React.useMemo(() => ({ documentStore, id: props.asset._id }), [documentStore, props.asset._id])
|
|
1291
|
+
), [originalAsset, setOriginalAsset] = React.useState(() => props.asset), [filename, setFilename] = React.useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata({ ...props.asset, filename }), [state, setState] = React.useState("idle");
|
|
1278
1292
|
function handleClose() {
|
|
1279
1293
|
if (state === "idle") {
|
|
1280
1294
|
if (modified) {
|
|
@@ -1291,7 +1305,7 @@ function useVideoDetails(props) {
|
|
|
1291
1305
|
if (state === "idle") {
|
|
1292
1306
|
setState("saving");
|
|
1293
1307
|
try {
|
|
1294
|
-
await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) =>
|
|
1308
|
+
await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) => ({ ...prev, filename })), toast.push({
|
|
1295
1309
|
title: "Video title updated",
|
|
1296
1310
|
description: `New title: ${filename}`,
|
|
1297
1311
|
status: "success"
|
|
@@ -1506,7 +1520,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField$1, { titl
|
|
|
1506
1520
|
}
|
|
1507
1521
|
),
|
|
1508
1522
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
1509
|
-
|
|
1523
|
+
displayInfo?.duration && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1510
1524
|
IconInfo,
|
|
1511
1525
|
{
|
|
1512
1526
|
text: `Duration: ${displayInfo.duration}`,
|
|
@@ -1514,7 +1528,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField$1, { titl
|
|
|
1514
1528
|
size: 2
|
|
1515
1529
|
}
|
|
1516
1530
|
),
|
|
1517
|
-
|
|
1531
|
+
displayInfo?.max_stored_resolution && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1518
1532
|
IconInfo,
|
|
1519
1533
|
{
|
|
1520
1534
|
text: `Max Resolution: ${displayInfo.max_stored_resolution}`,
|
|
@@ -1522,7 +1536,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField$1, { titl
|
|
|
1522
1536
|
size: 2
|
|
1523
1537
|
}
|
|
1524
1538
|
),
|
|
1525
|
-
|
|
1539
|
+
displayInfo?.max_stored_frame_rate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1526
1540
|
IconInfo,
|
|
1527
1541
|
{
|
|
1528
1542
|
text: `Frame rate: ${displayInfo.max_stored_frame_rate}`,
|
|
@@ -1530,7 +1544,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField$1, { titl
|
|
|
1530
1544
|
size: 2
|
|
1531
1545
|
}
|
|
1532
1546
|
),
|
|
1533
|
-
|
|
1547
|
+
displayInfo?.aspect_ratio && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1534
1548
|
IconInfo,
|
|
1535
1549
|
{
|
|
1536
1550
|
text: `Aspect Ratio: ${displayInfo.aspect_ratio}`,
|
|
@@ -1555,7 +1569,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField$1, { titl
|
|
|
1555
1569
|
),
|
|
1556
1570
|
/* @__PURE__ */ jsxRuntime.jsx(IconInfo, { text: `Mux ID:
|
|
1557
1571
|
${displayInfo.id}`, icon: icons.TagIcon, size: 2 }),
|
|
1558
|
-
|
|
1572
|
+
displayInfo?.playbackId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1559
1573
|
IconInfo,
|
|
1560
1574
|
{
|
|
1561
1575
|
text: `Playback ID: ${displayInfo.playbackId}`,
|
|
@@ -1609,7 +1623,7 @@ ${displayInfo.id}`, icon: icons.TagIcon, size: 2 }),
|
|
|
1609
1623
|
}
|
|
1610
1624
|
),
|
|
1611
1625
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 3, children: [
|
|
1612
|
-
|
|
1626
|
+
displayInfo?.duration && /* @__PURE__ */ jsxRuntime.jsx(IconInfo, { text: displayInfo.duration, icon: icons.ClockIcon, size: 1, muted: !0 }),
|
|
1613
1627
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1614
1628
|
IconInfo,
|
|
1615
1629
|
{
|
|
@@ -1685,7 +1699,7 @@ function VideoInBrowser({
|
|
|
1685
1699
|
onEdit,
|
|
1686
1700
|
asset
|
|
1687
1701
|
}) {
|
|
1688
|
-
const [renderVideo, setRenderVideo] = React.useState(!1), select = React__default.default.useCallback(() => onSelect
|
|
1702
|
+
const [renderVideo, setRenderVideo] = React.useState(!1), select = React__default.default.useCallback(() => onSelect?.(asset), [onSelect, asset]), edit = React__default.default.useCallback(() => onEdit?.(asset), [onEdit, asset]);
|
|
1689
1703
|
if (!asset)
|
|
1690
1704
|
return null;
|
|
1691
1705
|
const playbackPolicy = getPlaybackPolicy(asset);
|
|
@@ -1806,7 +1820,7 @@ function VideoInBrowser({
|
|
|
1806
1820
|
}
|
|
1807
1821
|
function VideosBrowser({ onSelect }) {
|
|
1808
1822
|
const { assets, isLoading, searchQuery, setSearchQuery, setSort, sort } = useAssets(), [editedAsset, setEditedAsset] = React.useState(null), freshEditedAsset = React.useMemo(
|
|
1809
|
-
() => assets.find((a2) => a2._id ===
|
|
1823
|
+
() => assets.find((a2) => a2._id === editedAsset?._id) || editedAsset,
|
|
1810
1824
|
[editedAsset, assets]
|
|
1811
1825
|
), placement = onSelect ? "input" : "tool";
|
|
1812
1826
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1827,7 +1841,7 @@ function VideosBrowser({ onSelect }) {
|
|
|
1827
1841
|
placement === "tool" && /* @__PURE__ */ jsxRuntime.jsx(ImportVideosFromMux, {})
|
|
1828
1842
|
] }),
|
|
1829
1843
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
1830
|
-
|
|
1844
|
+
assets?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Label, { muted: !0, children: [
|
|
1831
1845
|
assets.length,
|
|
1832
1846
|
" video",
|
|
1833
1847
|
assets.length > 1 ? "s" : null,
|
|
@@ -1866,14 +1880,6 @@ function VideosBrowser({ onSelect }) {
|
|
|
1866
1880
|
)
|
|
1867
1881
|
] });
|
|
1868
1882
|
}
|
|
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
|
-
};
|
|
1877
1883
|
const StudioTool = () => /* @__PURE__ */ jsxRuntime.jsx(VideosBrowser, {}), DEFAULT_TOOL_CONFIG = {
|
|
1878
1884
|
icon: ToolIcon,
|
|
1879
1885
|
title: "Videos"
|
|
@@ -1884,7 +1890,7 @@ function createStudioTool(config) {
|
|
|
1884
1890
|
name: "mux",
|
|
1885
1891
|
icon: toolConfig.icon || DEFAULT_TOOL_CONFIG.icon,
|
|
1886
1892
|
title: toolConfig.title || DEFAULT_TOOL_CONFIG.title,
|
|
1887
|
-
component: (props) => /* @__PURE__ */ jsxRuntime.jsx(StudioTool,
|
|
1893
|
+
component: (props) => /* @__PURE__ */ jsxRuntime.jsx(StudioTool, { ...config, ...props })
|
|
1888
1894
|
};
|
|
1889
1895
|
}
|
|
1890
1896
|
const path = ["assetId", "data", "playbackId", "status", "thumbTime", "filename"], useAssetDocumentValues = (asset) => sanity.useDocumentValues(
|
|
@@ -1895,16 +1901,12 @@ function useDialogState() {
|
|
|
1895
1901
|
return React.useState(!1);
|
|
1896
1902
|
}
|
|
1897
1903
|
const useMuxPolling = (asset) => {
|
|
1898
|
-
var _a, _b;
|
|
1899
1904
|
const client = useClient(), projectId = sanity.useProjectId(), dataset = sanity.useDataset(), shouldFetch = React.useMemo(
|
|
1900
|
-
() =>
|
|
1901
|
-
|
|
1902
|
-
return !!(asset != null && asset.assetId) && ((asset == null ? void 0 : asset.status) === "preparing" || ((_b2 = (_a2 = asset == null ? void 0 : asset.data) == null ? void 0 : _a2.static_renditions) == null ? void 0 : _b2.status) === "preparing");
|
|
1903
|
-
},
|
|
1904
|
-
[asset == null ? void 0 : asset.assetId, (_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.static_renditions) == null ? void 0 : _b.status, asset == null ? void 0 : asset.status]
|
|
1905
|
+
() => !!asset?.assetId && (asset?.status === "preparing" || asset?.data?.static_renditions?.status === "preparing"),
|
|
1906
|
+
[asset?.assetId, asset?.data?.static_renditions?.status, asset?.status]
|
|
1905
1907
|
);
|
|
1906
1908
|
return useSWR__default.default(
|
|
1907
|
-
shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset
|
|
1909
|
+
shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset?.assetId}` : null,
|
|
1908
1910
|
async () => {
|
|
1909
1911
|
const { data } = await client.request({
|
|
1910
1912
|
url: `/addons/mux/assets/${dataset}/data/${asset.assetId}`,
|
|
@@ -1928,13 +1930,19 @@ function saveSecrets(client, token, secretKey, enableSignedUrls, signingKeyId, s
|
|
|
1928
1930
|
};
|
|
1929
1931
|
return client.createOrReplace(doc);
|
|
1930
1932
|
}
|
|
1931
|
-
function createSigningKeys(client) {
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1933
|
+
async function createSigningKeys(client) {
|
|
1934
|
+
try {
|
|
1935
|
+
const { dataset } = client.config();
|
|
1936
|
+
return await client.request({
|
|
1937
|
+
url: `/addons/mux/signing-keys/${dataset}`,
|
|
1938
|
+
withCredentials: !0,
|
|
1939
|
+
method: "POST"
|
|
1940
|
+
});
|
|
1941
|
+
} catch (error) {
|
|
1942
|
+
console.error("Error creating signing keys", error);
|
|
1943
|
+
const message = error.response?.statusCode === 401 ? 'Unauthorized - Failed to create the Signing Key. Please ensure that the token has "System" permissions' : error.message;
|
|
1944
|
+
throw new Error(message);
|
|
1945
|
+
}
|
|
1938
1946
|
}
|
|
1939
1947
|
function testSecrets(client) {
|
|
1940
1948
|
const { dataset } = client.config();
|
|
@@ -1955,7 +1963,7 @@ async function haveValidSigningKeys(client, signingKeyId, signingKeyPrivate) {
|
|
|
1955
1963
|
method: "GET"
|
|
1956
1964
|
});
|
|
1957
1965
|
return !!(res.data && res.data.id);
|
|
1958
|
-
} catch
|
|
1966
|
+
} catch {
|
|
1959
1967
|
return console.error("Error fetching signingKeyId", signingKeyId, "assuming it is not valid"), !1;
|
|
1960
1968
|
}
|
|
1961
1969
|
}
|
|
@@ -1977,16 +1985,14 @@ const useSaveSecrets = (client, secrets) => React.useCallback(
|
|
|
1977
1985
|
}) => {
|
|
1978
1986
|
let { signingKeyId, signingKeyPrivate } = secrets;
|
|
1979
1987
|
try {
|
|
1980
|
-
await saveSecrets(
|
|
1988
|
+
if (await saveSecrets(
|
|
1981
1989
|
client,
|
|
1982
1990
|
token,
|
|
1983
1991
|
secretKey,
|
|
1984
1992
|
enableSignedUrls,
|
|
1985
1993
|
signingKeyId,
|
|
1986
1994
|
signingKeyPrivate
|
|
1987
|
-
)
|
|
1988
|
-
const valid = await testSecrets(client);
|
|
1989
|
-
if (!(valid != null && valid.status) && token && secretKey)
|
|
1995
|
+
), !(await testSecrets(client))?.status && token && secretKey)
|
|
1990
1996
|
throw new Error("Invalid secrets");
|
|
1991
1997
|
} catch (err) {
|
|
1992
1998
|
throw console.error("Error while trying to save secrets:", err), err;
|
|
@@ -2007,7 +2013,7 @@ const useSaveSecrets = (client, secrets) => React.useCallback(
|
|
|
2007
2013
|
signingKeyPrivate
|
|
2008
2014
|
);
|
|
2009
2015
|
} catch (err) {
|
|
2010
|
-
throw console.log("Error while creating and saving signing key:", err
|
|
2016
|
+
throw console.log("Error while creating and saving signing key:", err?.message), err;
|
|
2011
2017
|
}
|
|
2012
2018
|
return {
|
|
2013
2019
|
token,
|
|
@@ -2019,626 +2025,68 @@ const useSaveSecrets = (client, secrets) => React.useCallback(
|
|
|
2019
2025
|
},
|
|
2020
2026
|
[client, secrets]
|
|
2021
2027
|
);
|
|
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));
|
|
2030
2028
|
function init({ token, secretKey, enableSignedUrls }) {
|
|
2031
2029
|
return {
|
|
2032
2030
|
submitting: !1,
|
|
2033
2031
|
error: null,
|
|
2034
2032
|
// Form inputs don't set the state back to null when clearing a field, but uses empty strings
|
|
2035
2033
|
// This ensures the `dirty` check works correctly
|
|
2036
|
-
token: token
|
|
2037
|
-
secretKey: secretKey
|
|
2038
|
-
enableSignedUrls: enableSignedUrls
|
|
2034
|
+
token: token ?? "",
|
|
2035
|
+
secretKey: secretKey ?? "",
|
|
2036
|
+
enableSignedUrls: enableSignedUrls ?? !1
|
|
2039
2037
|
};
|
|
2040
2038
|
}
|
|
2041
2039
|
function reducer(state, action) {
|
|
2042
|
-
switch (action
|
|
2040
|
+
switch (action?.type) {
|
|
2043
2041
|
case "submit":
|
|
2044
|
-
return
|
|
2042
|
+
return { ...state, submitting: !0, error: null };
|
|
2045
2043
|
case "error":
|
|
2046
|
-
return
|
|
2044
|
+
return { ...state, submitting: !1, error: action.payload };
|
|
2047
2045
|
case "reset":
|
|
2048
2046
|
return init(action.payload);
|
|
2049
2047
|
case "change":
|
|
2050
|
-
return
|
|
2048
|
+
return { ...state, [action.payload.name]: action.payload.value };
|
|
2051
2049
|
default:
|
|
2052
|
-
throw new Error(`Unknown action type: ${action
|
|
2050
|
+
throw new Error(`Unknown action type: ${action?.type}`);
|
|
2053
2051
|
}
|
|
2054
2052
|
}
|
|
2055
|
-
const useSecretsFormState = (secrets) => React.useReducer(reducer, secrets, init)
|
|
2056
|
-
"title",
|
|
2057
|
-
"a",
|
|
2058
|
-
"b",
|
|
2059
|
-
"c",
|
|
2060
|
-
"d",
|
|
2061
|
-
"e",
|
|
2062
|
-
"f",
|
|
2063
|
-
"g",
|
|
2064
|
-
"h",
|
|
2065
|
-
"i",
|
|
2066
|
-
"j",
|
|
2067
|
-
"k",
|
|
2068
|
-
"l",
|
|
2069
|
-
"m",
|
|
2070
|
-
"n",
|
|
2071
|
-
"o",
|
|
2072
|
-
"p",
|
|
2073
|
-
"q",
|
|
2074
|
-
"r"
|
|
2075
|
-
];
|
|
2053
|
+
const useSecretsFormState = (secrets) => React.useReducer(reducer, secrets, init);
|
|
2076
2054
|
function MuxLogo({ height = 26 }) {
|
|
2077
|
-
const id = React.useId(),
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2055
|
+
const id = React.useId(), fillColor = ui.useTheme_v2().color._dark ? "white" : "black", titleId = React.useMemo(() => `${id}-title`, [id]), pathStyle = {
|
|
2056
|
+
fillRule: "nonzero"
|
|
2057
|
+
};
|
|
2058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2082
2059
|
"svg",
|
|
2083
2060
|
{
|
|
2084
2061
|
"aria-labelledby": titleId,
|
|
2085
|
-
|
|
2062
|
+
style: { height: `${height}px` },
|
|
2063
|
+
viewBox: "0 0 1600 500",
|
|
2064
|
+
version: "1.1",
|
|
2086
2065
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2087
2066
|
xmlSpace: "preserve",
|
|
2088
|
-
|
|
2089
|
-
style: { height: `${height}px` },
|
|
2090
|
-
children: [
|
|
2091
|
-
/* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: "Mux Logo" }),
|
|
2092
|
-
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
2093
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2094
|
-
"linearGradient",
|
|
2095
|
-
{
|
|
2096
|
-
id: c2,
|
|
2097
|
-
spreadMethod: "pad",
|
|
2098
|
-
gradientTransform: "matrix(528.38055 0 0 -528.38055 63.801 159.5)",
|
|
2099
|
-
gradientUnits: "userSpaceOnUse",
|
|
2100
|
-
y2: 0,
|
|
2101
|
-
x2: 1,
|
|
2102
|
-
y1: 0,
|
|
2103
|
-
x1: 0,
|
|
2104
|
-
children: [
|
|
2105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2106
|
-
"stop",
|
|
2107
|
-
{
|
|
2108
|
-
offset: 0,
|
|
2109
|
-
style: {
|
|
2110
|
-
stopOpacity: 1,
|
|
2111
|
-
stopColor: "#ff4e00"
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
),
|
|
2115
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2116
|
-
"stop",
|
|
2117
|
-
{
|
|
2118
|
-
offset: 1,
|
|
2119
|
-
style: {
|
|
2120
|
-
stopOpacity: 1,
|
|
2121
|
-
stopColor: "#ff1791"
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
)
|
|
2125
|
-
]
|
|
2126
|
-
}
|
|
2127
|
-
),
|
|
2128
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2129
|
-
"linearGradient",
|
|
2130
|
-
{
|
|
2131
|
-
id: d,
|
|
2132
|
-
spreadMethod: "pad",
|
|
2133
|
-
gradientTransform: "matrix(523.66766 0 0 -523.66766 67.897 159.5)",
|
|
2134
|
-
gradientUnits: "userSpaceOnUse",
|
|
2135
|
-
y2: 0,
|
|
2136
|
-
x2: 1,
|
|
2137
|
-
y1: 0,
|
|
2138
|
-
x1: 0,
|
|
2139
|
-
children: [
|
|
2140
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2141
|
-
"stop",
|
|
2142
|
-
{
|
|
2143
|
-
offset: 0,
|
|
2144
|
-
style: {
|
|
2145
|
-
stopOpacity: 1,
|
|
2146
|
-
stopColor: "#ff4e00"
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
),
|
|
2150
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2151
|
-
"stop",
|
|
2152
|
-
{
|
|
2153
|
-
offset: 1,
|
|
2154
|
-
style: {
|
|
2155
|
-
stopOpacity: 1,
|
|
2156
|
-
stopColor: "#ff1791"
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
)
|
|
2160
|
-
]
|
|
2161
|
-
}
|
|
2162
|
-
),
|
|
2163
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2164
|
-
"linearGradient",
|
|
2165
|
-
{
|
|
2166
|
-
id: g,
|
|
2167
|
-
spreadMethod: "pad",
|
|
2168
|
-
gradientTransform: "rotate(180 296.075 79.75) scale(524.84045)",
|
|
2169
|
-
gradientUnits: "userSpaceOnUse",
|
|
2170
|
-
y2: 0,
|
|
2171
|
-
x2: 1,
|
|
2172
|
-
y1: 0,
|
|
2173
|
-
x1: 0,
|
|
2174
|
-
children: [
|
|
2175
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2176
|
-
"stop",
|
|
2177
|
-
{
|
|
2178
|
-
offset: 0,
|
|
2179
|
-
style: {
|
|
2180
|
-
stopOpacity: 1,
|
|
2181
|
-
stopColor: "#ff4e00"
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
),
|
|
2185
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2186
|
-
"stop",
|
|
2187
|
-
{
|
|
2188
|
-
offset: 1,
|
|
2189
|
-
style: {
|
|
2190
|
-
stopOpacity: 1,
|
|
2191
|
-
stopColor: "#ff1791"
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
)
|
|
2195
|
-
]
|
|
2196
|
-
}
|
|
2197
|
-
),
|
|
2198
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2199
|
-
"linearGradient",
|
|
2200
|
-
{
|
|
2201
|
-
id: i,
|
|
2202
|
-
spreadMethod: "pad",
|
|
2203
|
-
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
2204
|
-
gradientUnits: "userSpaceOnUse",
|
|
2205
|
-
y2: 0,
|
|
2206
|
-
x2: 1,
|
|
2207
|
-
y1: 0,
|
|
2208
|
-
x1: 0,
|
|
2209
|
-
children: [
|
|
2210
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2211
|
-
"stop",
|
|
2212
|
-
{
|
|
2213
|
-
offset: 0,
|
|
2214
|
-
style: {
|
|
2215
|
-
stopOpacity: 1,
|
|
2216
|
-
stopColor: "#ff4e00"
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
),
|
|
2220
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2221
|
-
"stop",
|
|
2222
|
-
{
|
|
2223
|
-
offset: 1,
|
|
2224
|
-
style: {
|
|
2225
|
-
stopOpacity: 1,
|
|
2226
|
-
stopColor: "#ff1791"
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
)
|
|
2230
|
-
]
|
|
2231
|
-
}
|
|
2232
|
-
),
|
|
2233
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2234
|
-
"linearGradient",
|
|
2235
|
-
{
|
|
2236
|
-
id: j,
|
|
2237
|
-
spreadMethod: "pad",
|
|
2238
|
-
gradientTransform: "matrix(523.08514 0 0 -523.08514 67.897 224.446)",
|
|
2239
|
-
gradientUnits: "userSpaceOnUse",
|
|
2240
|
-
y2: 0,
|
|
2241
|
-
x2: 1,
|
|
2242
|
-
y1: 0,
|
|
2243
|
-
x1: 0,
|
|
2244
|
-
children: [
|
|
2245
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2246
|
-
"stop",
|
|
2247
|
-
{
|
|
2248
|
-
offset: 0,
|
|
2249
|
-
style: {
|
|
2250
|
-
stopOpacity: 1,
|
|
2251
|
-
stopColor: "#ff4e00"
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
),
|
|
2255
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2256
|
-
"stop",
|
|
2257
|
-
{
|
|
2258
|
-
offset: 1,
|
|
2259
|
-
style: {
|
|
2260
|
-
stopOpacity: 1,
|
|
2261
|
-
stopColor: "#ff1791"
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
)
|
|
2265
|
-
]
|
|
2266
|
-
}
|
|
2267
|
-
),
|
|
2268
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2269
|
-
"linearGradient",
|
|
2270
|
-
{
|
|
2271
|
-
id: k,
|
|
2272
|
-
spreadMethod: "pad",
|
|
2273
|
-
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.553)",
|
|
2274
|
-
gradientUnits: "userSpaceOnUse",
|
|
2275
|
-
y2: 0,
|
|
2276
|
-
x2: 1,
|
|
2277
|
-
y1: 0,
|
|
2278
|
-
x1: 0,
|
|
2279
|
-
children: [
|
|
2280
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
|
-
"stop",
|
|
2282
|
-
{
|
|
2283
|
-
offset: 0,
|
|
2284
|
-
style: {
|
|
2285
|
-
stopOpacity: 1,
|
|
2286
|
-
stopColor: "#ff4e00"
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
),
|
|
2290
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2291
|
-
"stop",
|
|
2292
|
-
{
|
|
2293
|
-
offset: 1,
|
|
2294
|
-
style: {
|
|
2295
|
-
stopOpacity: 1,
|
|
2296
|
-
stopColor: "#ff1791"
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
)
|
|
2300
|
-
]
|
|
2301
|
-
}
|
|
2302
|
-
),
|
|
2303
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2304
|
-
"linearGradient",
|
|
2305
|
-
{
|
|
2306
|
-
id: l,
|
|
2307
|
-
spreadMethod: "pad",
|
|
2308
|
-
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
2309
|
-
gradientUnits: "userSpaceOnUse",
|
|
2310
|
-
y2: 0,
|
|
2311
|
-
x2: 1,
|
|
2312
|
-
y1: 0,
|
|
2313
|
-
x1: 0,
|
|
2314
|
-
children: [
|
|
2315
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2316
|
-
"stop",
|
|
2317
|
-
{
|
|
2318
|
-
offset: 0,
|
|
2319
|
-
style: {
|
|
2320
|
-
stopOpacity: 1,
|
|
2321
|
-
stopColor: "#ff4e00"
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
),
|
|
2325
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2326
|
-
"stop",
|
|
2327
|
-
{
|
|
2328
|
-
offset: 1,
|
|
2329
|
-
style: {
|
|
2330
|
-
stopOpacity: 1,
|
|
2331
|
-
stopColor: "#ff1791"
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
)
|
|
2335
|
-
]
|
|
2336
|
-
}
|
|
2337
|
-
),
|
|
2338
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2339
|
-
"linearGradient",
|
|
2340
|
-
{
|
|
2341
|
-
id: m,
|
|
2342
|
-
spreadMethod: "pad",
|
|
2343
|
-
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.554)",
|
|
2344
|
-
gradientUnits: "userSpaceOnUse",
|
|
2345
|
-
y2: 0,
|
|
2346
|
-
x2: 1,
|
|
2347
|
-
y1: 0,
|
|
2348
|
-
x1: 0,
|
|
2349
|
-
children: [
|
|
2350
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2351
|
-
"stop",
|
|
2352
|
-
{
|
|
2353
|
-
offset: 0,
|
|
2354
|
-
style: {
|
|
2355
|
-
stopOpacity: 1,
|
|
2356
|
-
stopColor: "#ff4e00"
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
),
|
|
2360
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2361
|
-
"stop",
|
|
2362
|
-
{
|
|
2363
|
-
offset: 1,
|
|
2364
|
-
style: {
|
|
2365
|
-
stopOpacity: 1,
|
|
2366
|
-
stopColor: "#ff1791"
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
)
|
|
2370
|
-
]
|
|
2371
|
-
}
|
|
2372
|
-
),
|
|
2373
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2374
|
-
"linearGradient",
|
|
2375
|
-
{
|
|
2376
|
-
id: p,
|
|
2377
|
-
spreadMethod: "pad",
|
|
2378
|
-
gradientTransform: "matrix(521.97632 0 0 -521.97632 69.067 191.973)",
|
|
2379
|
-
gradientUnits: "userSpaceOnUse",
|
|
2380
|
-
y2: 0,
|
|
2381
|
-
x2: 1,
|
|
2382
|
-
y1: 0,
|
|
2383
|
-
x1: 0,
|
|
2384
|
-
children: [
|
|
2385
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2386
|
-
"stop",
|
|
2387
|
-
{
|
|
2388
|
-
offset: 0,
|
|
2389
|
-
style: {
|
|
2390
|
-
stopOpacity: 1,
|
|
2391
|
-
stopColor: "#ff4e00"
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
),
|
|
2395
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2396
|
-
"stop",
|
|
2397
|
-
{
|
|
2398
|
-
offset: 1,
|
|
2399
|
-
style: {
|
|
2400
|
-
stopOpacity: 1,
|
|
2401
|
-
stopColor: "#ff1791"
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
)
|
|
2405
|
-
]
|
|
2406
|
-
}
|
|
2407
|
-
),
|
|
2408
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2409
|
-
"linearGradient",
|
|
2410
|
-
{
|
|
2411
|
-
id: q,
|
|
2412
|
-
spreadMethod: "pad",
|
|
2413
|
-
gradientTransform: "matrix(523.09039 0 0 -523.09039 67.312 191.973)",
|
|
2414
|
-
gradientUnits: "userSpaceOnUse",
|
|
2415
|
-
y2: 0,
|
|
2416
|
-
x2: 1,
|
|
2417
|
-
y1: 0,
|
|
2418
|
-
x1: 0,
|
|
2419
|
-
children: [
|
|
2420
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2421
|
-
"stop",
|
|
2422
|
-
{
|
|
2423
|
-
offset: 0,
|
|
2424
|
-
style: {
|
|
2425
|
-
stopOpacity: 1,
|
|
2426
|
-
stopColor: "#ff4e00"
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
),
|
|
2430
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2431
|
-
"stop",
|
|
2432
|
-
{
|
|
2433
|
-
offset: 1,
|
|
2434
|
-
style: {
|
|
2435
|
-
stopOpacity: 1,
|
|
2436
|
-
stopColor: "#ff1791"
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
)
|
|
2440
|
-
]
|
|
2441
|
-
}
|
|
2442
|
-
),
|
|
2443
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2444
|
-
"linearGradient",
|
|
2445
|
-
{
|
|
2446
|
-
id: r,
|
|
2447
|
-
spreadMethod: "pad",
|
|
2448
|
-
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
2449
|
-
gradientUnits: "userSpaceOnUse",
|
|
2450
|
-
y2: 0,
|
|
2451
|
-
x2: 1,
|
|
2452
|
-
y1: 0,
|
|
2453
|
-
x1: 0,
|
|
2454
|
-
children: [
|
|
2455
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2456
|
-
"stop",
|
|
2457
|
-
{
|
|
2458
|
-
offset: 0,
|
|
2459
|
-
style: {
|
|
2460
|
-
stopOpacity: 1,
|
|
2461
|
-
stopColor: "#ff4e00"
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
),
|
|
2465
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2466
|
-
"stop",
|
|
2467
|
-
{
|
|
2468
|
-
offset: 1,
|
|
2469
|
-
style: {
|
|
2470
|
-
stopOpacity: 1,
|
|
2471
|
-
stopColor: "#ff1791"
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
)
|
|
2475
|
-
]
|
|
2476
|
-
}
|
|
2477
|
-
),
|
|
2478
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: a2, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2479
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: b, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M423.64 242h164.999V77H423.64Z" }) }),
|
|
2480
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: e, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2481
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: f, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M311.3 242h93.031V77H311.3Z" }) }),
|
|
2482
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: h, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M198.96 242h35.106V77H198.96Z" }) }),
|
|
2483
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: n, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2484
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: o, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M69.067 242H169.12V141.947H69.067Z" }) })
|
|
2485
|
-
] }),
|
|
2486
|
-
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${a2})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2487
|
-
"g",
|
|
2488
|
-
{
|
|
2489
|
-
style: {
|
|
2490
|
-
opacity: 0.69999701
|
|
2491
|
-
},
|
|
2492
|
-
clipPath: `url(#${b})`,
|
|
2493
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2494
|
-
"path",
|
|
2495
|
-
{
|
|
2496
|
-
style: {
|
|
2497
|
-
fill: `url(#${c2})`,
|
|
2498
|
-
stroke: "none"
|
|
2499
|
-
},
|
|
2500
|
-
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"
|
|
2501
|
-
}
|
|
2502
|
-
)
|
|
2503
|
-
}
|
|
2504
|
-
) }),
|
|
2067
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("g", { id: "Layer-1", fill: fillColor, children: [
|
|
2505
2068
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2506
2069
|
"path",
|
|
2507
2070
|
{
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
stroke: "none"
|
|
2511
|
-
},
|
|
2512
|
-
d: "M558.674 236.858 428.781 106.966c-6.855-6.855-6.855-17.969 0-24.825 6.855-6.854 17.969-6.854 24.823 0l129.894 129.894c6.854 6.855 6.854 17.968 0 24.823A17.498 17.498 0 0 1 571.086 242a17.495 17.495 0 0 1-12.412-5.142",
|
|
2513
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2071
|
+
d: "M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486",
|
|
2072
|
+
style: pathStyle
|
|
2514
2073
|
}
|
|
2515
2074
|
),
|
|
2516
|
-
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: `url(#${e})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: [
|
|
2517
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2518
|
-
"g",
|
|
2519
|
-
{
|
|
2520
|
-
style: {
|
|
2521
|
-
opacity: 0.69999701
|
|
2522
|
-
},
|
|
2523
|
-
clipPath: `url(#${f})`,
|
|
2524
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2525
|
-
"path",
|
|
2526
|
-
{
|
|
2527
|
-
style: {
|
|
2528
|
-
fill: `url(#${g})`,
|
|
2529
|
-
stroke: "none"
|
|
2530
|
-
},
|
|
2531
|
-
d: "M328.853 112.107c22.297 0 40.372 18.075 40.372 40.372v71.315c0 10.054 7.505 18.206 17.554 18.206 10.048 0 17.552-8.152 17.552-18.206v-71.315c0-41.686-33.793-75.479-75.478-75.479-9.694 0-17.553 7.859-17.553 17.554 0 9.694 7.859 17.553 17.553 17.553"
|
|
2532
|
-
}
|
|
2533
|
-
)
|
|
2534
|
-
}
|
|
2535
|
-
),
|
|
2536
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2537
|
-
"g",
|
|
2538
|
-
{
|
|
2539
|
-
style: {
|
|
2540
|
-
opacity: 0.69999701
|
|
2541
|
-
},
|
|
2542
|
-
clipPath: `url(#${h})`,
|
|
2543
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2544
|
-
"path",
|
|
2545
|
-
{
|
|
2546
|
-
style: {
|
|
2547
|
-
fill: `url(#${i})`,
|
|
2548
|
-
stroke: "none"
|
|
2549
|
-
},
|
|
2550
|
-
d: "M216.513 242c-10.049 0-17.553-8.152-17.553-18.206V95.206c0-10.054 7.504-18.206 17.553-18.206 10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.054-7.505 18.206-17.553 18.206"
|
|
2551
|
-
}
|
|
2552
|
-
)
|
|
2553
|
-
}
|
|
2554
|
-
)
|
|
2555
|
-
] }),
|
|
2556
2075
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2557
2076
|
"path",
|
|
2558
2077
|
{
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
stroke: "none"
|
|
2562
|
-
},
|
|
2563
|
-
d: "M369.225 224.447c0-9.694 7.859-17.553 17.553-17.553 9.695 0 17.553 7.859 17.553 17.553s-7.858 17.552-17.553 17.552c-9.694 0-17.553-7.858-17.553-17.552",
|
|
2564
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2565
|
-
}
|
|
2566
|
-
),
|
|
2567
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2568
|
-
"path",
|
|
2569
|
-
{
|
|
2570
|
-
style: {
|
|
2571
|
-
fill: `url(#${k})`,
|
|
2572
|
-
stroke: "none"
|
|
2573
|
-
},
|
|
2574
|
-
d: "M553.532 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.552-17.554 17.552-9.694 0-17.553-7.858-17.553-17.552",
|
|
2575
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2576
|
-
}
|
|
2577
|
-
),
|
|
2578
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2579
|
-
"path",
|
|
2580
|
-
{
|
|
2581
|
-
style: {
|
|
2582
|
-
fill: `url(#${l})`,
|
|
2583
|
-
stroke: "none"
|
|
2584
|
-
},
|
|
2585
|
-
d: "M69.067 223.794V95.206C69.067 85.152 76.571 77 86.62 77c10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.055-7.505 18.205-17.553 18.205-10.049 0-17.553-8.15-17.553-18.205",
|
|
2586
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2078
|
+
d: "M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z",
|
|
2079
|
+
style: pathStyle
|
|
2587
2080
|
}
|
|
2588
2081
|
),
|
|
2589
2082
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2590
2083
|
"path",
|
|
2591
2084
|
{
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
stroke: "none"
|
|
2595
|
-
},
|
|
2596
|
-
d: "M198.96 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.553-17.554 17.553-9.694 0-17.553-7.859-17.553-17.553",
|
|
2597
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2598
|
-
}
|
|
2599
|
-
),
|
|
2600
|
-
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${n})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2601
|
-
"g",
|
|
2602
|
-
{
|
|
2603
|
-
style: {
|
|
2604
|
-
opacity: 0.69999701
|
|
2605
|
-
},
|
|
2606
|
-
clipPath: `url(#${o})`,
|
|
2607
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2608
|
-
"path",
|
|
2609
|
-
{
|
|
2610
|
-
style: {
|
|
2611
|
-
fill: `url(#${p})`,
|
|
2612
|
-
stroke: "none"
|
|
2613
|
-
},
|
|
2614
|
-
d: "M139.155 147.088c6.855-6.855 17.969-6.855 24.824 0s6.855 17.969 0 24.824l-64.947 64.946c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
|
|
2615
|
-
}
|
|
2616
|
-
)
|
|
2617
|
-
}
|
|
2618
|
-
) }),
|
|
2619
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2620
|
-
"path",
|
|
2621
|
-
{
|
|
2622
|
-
style: {
|
|
2623
|
-
fill: `url(#${q})`,
|
|
2624
|
-
stroke: "none"
|
|
2625
|
-
},
|
|
2626
|
-
d: "m204.101 236.858-64.947-64.946c-6.854-6.855-6.854-17.969 0-24.824 6.856-6.855 17.97-6.855 24.824 0l64.947 64.947c6.855 6.855 6.855 17.968 0 24.823A17.495 17.495 0 0 1 216.513 242a17.498 17.498 0 0 1-12.412-5.142",
|
|
2627
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2628
|
-
}
|
|
2629
|
-
),
|
|
2630
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2631
|
-
"path",
|
|
2632
|
-
{
|
|
2633
|
-
style: {
|
|
2634
|
-
fill: `url(#${r})`,
|
|
2635
|
-
stroke: "none"
|
|
2636
|
-
},
|
|
2637
|
-
d: "M253.374 223.794v-71.315c0-41.685 33.793-75.479 75.479-75.479 9.695 0 17.553 7.859 17.553 17.554 0 9.694-7.858 17.553-17.553 17.553-22.297 0-40.372 18.075-40.372 40.372v71.315c0 10.055-7.505 18.205-17.554 18.205s-17.553-8.15-17.553-18.205",
|
|
2638
|
-
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
2085
|
+
d: "M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729",
|
|
2086
|
+
style: pathStyle
|
|
2639
2087
|
}
|
|
2640
2088
|
)
|
|
2641
|
-
]
|
|
2089
|
+
] })
|
|
2642
2090
|
}
|
|
2643
2091
|
);
|
|
2644
2092
|
}
|
|
@@ -2652,7 +2100,6 @@ const Logo = styledComponents.styled.span`
|
|
|
2652
2100
|
"API Credentials"
|
|
2653
2101
|
] }), fieldNames = ["token", "secretKey", "enableSignedUrls"];
|
|
2654
2102
|
function ConfigureApi({ secrets, setDialogState }) {
|
|
2655
|
-
var _a, _b;
|
|
2656
2103
|
const client = useClient(), [state, dispatch] = useSecretsFormState(secrets), hasSecretsInitially = React.useMemo(() => secrets.token && secrets.secretKey, [secrets]), handleClose = React.useCallback(() => setDialogState(!1), [setDialogState]), dirty = React.useMemo(
|
|
2657
2104
|
() => secrets.token !== state.token || secrets.secretKey !== state.secretKey || secrets.enableSignedUrls !== state.enableSignedUrls,
|
|
2658
2105
|
[secrets, state]
|
|
@@ -2734,6 +2181,8 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2734
2181
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Mux Data" }),
|
|
2735
2182
|
" (Read)",
|
|
2736
2183
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
2184
|
+
"To use Signed URLs, the token must also have System permissions.",
|
|
2185
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
2737
2186
|
"The credentials will be stored safely in a hidden document only available to editors."
|
|
2738
2187
|
] })
|
|
2739
2188
|
] }) }),
|
|
@@ -2744,7 +2193,7 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2744
2193
|
ref: firstField,
|
|
2745
2194
|
onChange: handleChangeToken,
|
|
2746
2195
|
type: "text",
|
|
2747
|
-
value:
|
|
2196
|
+
value: state.token ?? "",
|
|
2748
2197
|
required: !!state.secretKey || state.enableSignedUrls
|
|
2749
2198
|
}
|
|
2750
2199
|
) }),
|
|
@@ -2754,7 +2203,7 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2754
2203
|
id: secretKeyId,
|
|
2755
2204
|
onChange: handleChangeSecretKey,
|
|
2756
2205
|
type: "text",
|
|
2757
|
-
value:
|
|
2206
|
+
value: state.secretKey ?? "",
|
|
2758
2207
|
required: !!state.token || state.enableSignedUrls
|
|
2759
2208
|
}
|
|
2760
2209
|
) }),
|
|
@@ -2852,7 +2301,7 @@ function a(t) {
|
|
|
2852
2301
|
function ErrorBoundaryCard(props) {
|
|
2853
2302
|
const { children, schemaType } = props, { push: pushToast } = ui.useToast(), errorRef = React.useRef(null), { ErrorBoundary, didCatch, error, reset } = a({
|
|
2854
2303
|
onDidCatch: (err, errorInfo) => {
|
|
2855
|
-
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
|
|
2304
|
+
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?.componentStack && (console.groupCollapsed("errorInfo.componentStack"), console.log(errorInfo.componentStack), console.groupEnd()), console.groupEnd(), pushToast({
|
|
2856
2305
|
status: "error",
|
|
2857
2306
|
title: "Plugin crashed",
|
|
2858
2307
|
description: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 1, children: [
|
|
@@ -2886,7 +2335,7 @@ function ErrorBoundaryCard(props) {
|
|
|
2886
2335
|
/* @__PURE__ */ jsxRuntime.jsx("code", { children: name }),
|
|
2887
2336
|
" plugin crashed"
|
|
2888
2337
|
] }),
|
|
2889
|
-
|
|
2338
|
+
error?.message && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 3, tone: "critical", shadow: 1, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: error.message }) }),
|
|
2890
2339
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Inline, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: handleRetry, text: "Retry" }) })
|
|
2891
2340
|
] }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children });
|
|
2892
2341
|
}
|
|
@@ -2952,14 +2401,6 @@ function createUpChunkObservable(uuid2, uploadUrl2, source) {
|
|
|
2952
2401
|
return upchunk$1.on("success", successHandler), upchunk$1.on("error", errorHandler), upchunk$1.on("progress", progressHandler), upchunk$1.on("offline", offlineHandler), upchunk$1.on("online", onlineHandler), () => upchunk$1.abort();
|
|
2953
2402
|
});
|
|
2954
2403
|
}
|
|
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));
|
|
2963
2404
|
function cancelUpload(client, uuid2) {
|
|
2964
2405
|
return client.observable.request({
|
|
2965
2406
|
url: `/addons/mux/uploads/${client.config().dataset}/${uuid2}`,
|
|
@@ -3040,7 +2481,7 @@ function uploadFile({
|
|
|
3040
2481
|
// eslint-disable-next-line max-nested-callbacks
|
|
3041
2482
|
operators.mergeMap((event) => event.type !== "success" ? rxjs.of(event) : rxjs.from(updateAssetDocumentFromUpload(client, uuid$1)).pipe(
|
|
3042
2483
|
// eslint-disable-next-line max-nested-callbacks
|
|
3043
|
-
operators.mergeMap((doc) => rxjs.of(
|
|
2484
|
+
operators.mergeMap((doc) => rxjs.of({ ...event, asset: doc }))
|
|
3044
2485
|
)),
|
|
3045
2486
|
// eslint-disable-next-line max-nested-callbacks
|
|
3046
2487
|
operators.catchError((err) => cancelUpload(client, uuid$1).pipe(operators.mergeMapTo(rxjs.throwError(err))))
|
|
@@ -3111,7 +2552,7 @@ function testUrl(url) {
|
|
|
3111
2552
|
let parsed;
|
|
3112
2553
|
try {
|
|
3113
2554
|
parsed = new URL(url);
|
|
3114
|
-
} catch
|
|
2555
|
+
} catch {
|
|
3115
2556
|
return rxjs.throwError(error);
|
|
3116
2557
|
}
|
|
3117
2558
|
return parsed && !parsed.protocol.match(/http:|https:/) ? rxjs.throwError(error) : rxjs.of(url);
|
|
@@ -3127,7 +2568,7 @@ function isValidUrl(url) {
|
|
|
3127
2568
|
try {
|
|
3128
2569
|
const parsed = new URL(url);
|
|
3129
2570
|
return parsed && !!parsed.protocol.match(/http:|https:/);
|
|
3130
|
-
} catch
|
|
2571
|
+
} catch {
|
|
3131
2572
|
return !1;
|
|
3132
2573
|
}
|
|
3133
2574
|
}
|
|
@@ -3142,7 +2583,7 @@ function normalizeItems(items) {
|
|
|
3142
2583
|
let entry;
|
|
3143
2584
|
try {
|
|
3144
2585
|
entry = item.webkitGetAsEntry();
|
|
3145
|
-
} catch
|
|
2586
|
+
} catch {
|
|
3146
2587
|
return [item.getAsFile()];
|
|
3147
2588
|
}
|
|
3148
2589
|
return entry ? entry.isDirectory ? walk(entry) : [item.getAsFile()] : [];
|
|
@@ -3175,7 +2616,7 @@ function walk(entry) {
|
|
|
3175
2616
|
function SelectAssets({ asset: selectedAsset, onChange, setDialogState }) {
|
|
3176
2617
|
const handleSelect = React.useCallback(
|
|
3177
2618
|
(chosenAsset) => {
|
|
3178
|
-
chosenAsset
|
|
2619
|
+
chosenAsset?._id || onChange(sanity.PatchEvent.from([sanity.unset(["asset"])])), chosenAsset._id !== selectedAsset?._id && onChange(
|
|
3179
2620
|
sanity.PatchEvent.from([
|
|
3180
2621
|
sanity.setIfMissing({ asset: {}, _type: "mux.video" }),
|
|
3181
2622
|
sanity.set({ _type: "reference", _weak: !0, _ref: chosenAsset._id }, ["asset"])
|
|
@@ -3285,24 +2726,18 @@ const TopControls = styledComponents.styled.div`
|
|
|
3285
2726
|
}
|
|
3286
2727
|
) : null
|
|
3287
2728
|
] }) }), Player = ({ asset, buttons, readOnly, onChange }) => {
|
|
3288
|
-
|
|
3289
|
-
const isLoading = React.useMemo(() => (asset == null ? void 0 : asset.status) === "preparing" ? "Preparing the video" : (asset == null ? void 0 : asset.status) === "waiting_for_upload" ? "Waiting for upload to start" : (asset == null ? void 0 : asset.status) === "waiting" ? "Processing upload" : !((asset == null ? void 0 : asset.status) === "ready" || typeof (asset == null ? void 0 : asset.status) > "u"), [asset]), isPreparingStaticRenditions = React.useMemo(() => {
|
|
3290
|
-
var _a2, _b2;
|
|
3291
|
-
return ((_b2 = (_a2 = asset == null ? void 0 : asset.data) == null ? void 0 : _a2.static_renditions) == null ? void 0 : _b2.status) === "preparing";
|
|
3292
|
-
}, [(_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.static_renditions) == null ? void 0 : _b.status]), playRef = React.useRef(null), muteRef = React.useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
|
|
2729
|
+
const isLoading = React.useMemo(() => asset?.status === "preparing" ? "Preparing the video" : asset?.status === "waiting_for_upload" ? "Waiting for upload to start" : asset?.status === "waiting" ? "Processing upload" : !(asset?.status === "ready" || typeof asset?.status > "u"), [asset]), isPreparingStaticRenditions = React.useMemo(() => asset?.data?.static_renditions?.status === "preparing", [asset?.data?.static_renditions?.status]), playRef = React.useRef(null), muteRef = React.useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
|
|
3293
2730
|
return React.useEffect(() => {
|
|
3294
|
-
var _a2, _b2;
|
|
3295
2731
|
const style = document.createElement("style");
|
|
3296
|
-
style.innerHTML = "button svg { vertical-align: middle; }",
|
|
2732
|
+
style.innerHTML = "button svg { vertical-align: middle; }", playRef.current?.shadowRoot && playRef.current.shadowRoot.appendChild(style), muteRef?.current?.shadowRoot && muteRef.current.shadowRoot.appendChild(style.cloneNode(!0));
|
|
3297
2733
|
}, []), React.useEffect(() => {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
}, [(_d = (_c = asset.data) == null ? void 0 : _c.errors) == null ? void 0 : _d.messages, asset == null ? void 0 : asset.status, handleCancelUpload]), !asset || !asset.status ? null : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2734
|
+
if (asset?.status === "errored")
|
|
2735
|
+
throw handleCancelUpload(), new Error(asset.data?.errors?.messages?.join(" "));
|
|
2736
|
+
}, [asset.data?.errors?.messages, asset?.status, handleCancelUpload]), !asset || !asset.status ? null : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3302
2737
|
UploadProgress,
|
|
3303
2738
|
{
|
|
3304
2739
|
progress: 100,
|
|
3305
|
-
filename: asset
|
|
2740
|
+
filename: asset?.filename,
|
|
3306
2741
|
text: isLoading !== !0 && isLoading || "Waiting for Mux to complete the upload",
|
|
3307
2742
|
onCancel: readOnly ? void 0 : () => handleCancelUpload()
|
|
3308
2743
|
}
|
|
@@ -3363,25 +2798,8 @@ const FileButton = styledComponents.styled(ui.MenuItem)(({ theme }) => {
|
|
|
3363
2798
|
opacity: 0;
|
|
3364
2799
|
}
|
|
3365
2800
|
`;
|
|
3366
|
-
})
|
|
3367
|
-
|
|
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__default.default.forwardRef(function(props, forwardedRef) {
|
|
3384
|
-
const _a = props, {
|
|
2801
|
+
}), FileInputMenuItem = React__default.default.forwardRef(function(props, forwardedRef) {
|
|
2802
|
+
const {
|
|
3385
2803
|
icon,
|
|
3386
2804
|
id: idProp,
|
|
3387
2805
|
accept,
|
|
@@ -3392,20 +2810,9 @@ const FileInputMenuItem = React__default.default.forwardRef(function(props, forw
|
|
|
3392
2810
|
space = 3,
|
|
3393
2811
|
textAlign,
|
|
3394
2812
|
text,
|
|
3395
|
-
disabled
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
"id",
|
|
3399
|
-
"accept",
|
|
3400
|
-
"capture",
|
|
3401
|
-
"fontSize",
|
|
3402
|
-
"multiple",
|
|
3403
|
-
"onSelect",
|
|
3404
|
-
"space",
|
|
3405
|
-
"textAlign",
|
|
3406
|
-
"text",
|
|
3407
|
-
"disabled"
|
|
3408
|
-
]), idHook = React.useId(), id = idProp || idHook, handleChange = React__default.default.useCallback(
|
|
2813
|
+
disabled,
|
|
2814
|
+
...rest
|
|
2815
|
+
} = props, idHook = React.useId(), id = idProp || idHook, handleChange = React__default.default.useCallback(
|
|
3409
2816
|
(event) => {
|
|
3410
2817
|
onSelect && event.target.files && onSelect(Array.from(event.target.files));
|
|
3411
2818
|
},
|
|
@@ -3417,7 +2824,7 @@ const FileInputMenuItem = React__default.default.forwardRef(function(props, forw
|
|
|
3417
2824
|
] }) }),
|
|
3418
2825
|
text && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { align: textAlign, size: fontSize, textOverflow: "ellipsis", children: text })
|
|
3419
2826
|
] });
|
|
3420
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(FileButton,
|
|
2827
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FileButton, { ...rest, htmlFor: id, disabled, ref: forwardedRef, children: [
|
|
3421
2828
|
content,
|
|
3422
2829
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3423
2830
|
"input",
|
|
@@ -3433,7 +2840,7 @@ const FileInputMenuItem = React__default.default.forwardRef(function(props, forw
|
|
|
3433
2840
|
disabled
|
|
3434
2841
|
}
|
|
3435
2842
|
)
|
|
3436
|
-
] })
|
|
2843
|
+
] });
|
|
3437
2844
|
}), LockCard = styledComponents.styled(ui.Card)`
|
|
3438
2845
|
position: absolute;
|
|
3439
2846
|
top: 0;
|
|
@@ -3444,7 +2851,7 @@ const FileInputMenuItem = React__default.default.forwardRef(function(props, forw
|
|
|
3444
2851
|
`, LockButton = styledComponents.styled(ui.Button)`
|
|
3445
2852
|
background: transparent;
|
|
3446
2853
|
color: white;
|
|
3447
|
-
|
|
2854
|
+
`, isVideoAsset = (asset) => asset._type === "mux.videoAsset";
|
|
3448
2855
|
function PlayerActionsMenu(props) {
|
|
3449
2856
|
const { asset, readOnly, dialogState, setDialogState, onChange, onSelect } = props, [open, setOpen] = React.useState(!1), [menuElement, setMenuRef] = React.useState(null), isSigned = React.useMemo(() => getPlaybackPolicy(asset) === "signed", [asset]), onReset = React.useCallback(() => onChange(sanity.PatchEvent.from(sanity.unset([]))), [onChange]);
|
|
3450
2857
|
return React.useEffect(() => {
|
|
@@ -3488,6 +2895,14 @@ function PlayerActionsMenu(props) {
|
|
|
3488
2895
|
onClick: () => setDialogState("select-video")
|
|
3489
2896
|
}
|
|
3490
2897
|
),
|
|
2898
|
+
isVideoAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2899
|
+
ui.MenuItem,
|
|
2900
|
+
{
|
|
2901
|
+
icon: icons.ImageIcon,
|
|
2902
|
+
text: "Thumbnail",
|
|
2903
|
+
onClick: () => setDialogState("edit-thumbnail")
|
|
2904
|
+
}
|
|
2905
|
+
),
|
|
3491
2906
|
/* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}),
|
|
3492
2907
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3493
2908
|
ui.MenuItem,
|
|
@@ -3593,7 +3008,7 @@ function TextTracksEditor({
|
|
|
3593
3008
|
{
|
|
3594
3009
|
id: "include-autogenerated-track",
|
|
3595
3010
|
style: { display: "block" },
|
|
3596
|
-
checked: !!
|
|
3011
|
+
checked: !!track?.language_code,
|
|
3597
3012
|
onChange: () => {
|
|
3598
3013
|
dispatch(track ? { action: "track", id: track._id, subAction: "delete" } : {
|
|
3599
3014
|
action: "track",
|
|
@@ -3629,10 +3044,7 @@ function TextTracksEditor({
|
|
|
3629
3044
|
placeholder: "Select language",
|
|
3630
3045
|
filterOption: (query, option) => option.label.toLowerCase().indexOf(query.toLowerCase()) > -1 || option.value.toLowerCase().indexOf(query.toLowerCase()) > -1,
|
|
3631
3046
|
openButton: !0,
|
|
3632
|
-
renderValue: (value) =>
|
|
3633
|
-
var _a;
|
|
3634
|
-
return ((_a = SUBTITLE_LANGUAGES[track.type].find((l) => l.value === value)) == null ? void 0 : _a.label) || value;
|
|
3635
|
-
},
|
|
3047
|
+
renderValue: (value) => SUBTITLE_LANGUAGES[track.type].find((l) => l.value === value)?.label || value,
|
|
3636
3048
|
renderOption: (option) => /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { "data-as": "button", padding: 3, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 2, textOverflow: "ellipsis", children: [
|
|
3637
3049
|
option.label,
|
|
3638
3050
|
" (",
|
|
@@ -3643,14 +3055,88 @@ function TextTracksEditor({
|
|
|
3643
3055
|
)
|
|
3644
3056
|
] }) });
|
|
3645
3057
|
}
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
}
|
|
3058
|
+
function PlaybackPolicyOption({
|
|
3059
|
+
id,
|
|
3060
|
+
checked,
|
|
3061
|
+
optionName,
|
|
3062
|
+
description,
|
|
3063
|
+
dispatch,
|
|
3064
|
+
action
|
|
3065
|
+
}) {
|
|
3066
|
+
const [scale, setScale] = React.useState(1), boxStyle = {
|
|
3067
|
+
outline: "0.01rem solid grey",
|
|
3068
|
+
transform: `scale(${scale})`,
|
|
3069
|
+
transition: "transform 0.1s ease-in-out",
|
|
3070
|
+
cursor: "pointer",
|
|
3071
|
+
borderRadius: "0.25rem"
|
|
3072
|
+
}, triggerAnimation = () => {
|
|
3073
|
+
setScale(0.98), setTimeout(() => {
|
|
3074
|
+
setScale(1);
|
|
3075
|
+
}, 100);
|
|
3076
|
+
};
|
|
3077
|
+
return /* @__PURE__ */ jsxRuntime.jsx("label", { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, padding: 3, style: boxStyle, children: [
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { id, required: !0, checked, onChange: () => {
|
|
3079
|
+
triggerAnimation(), dispatch({
|
|
3080
|
+
action,
|
|
3081
|
+
value: !checked
|
|
3082
|
+
});
|
|
3083
|
+
} }),
|
|
3084
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { gap: 3, children: [
|
|
3085
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 3, weight: "bold", children: optionName }),
|
|
3086
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, muted: !0, children: description })
|
|
3087
|
+
] })
|
|
3088
|
+
] }) });
|
|
3089
|
+
}
|
|
3090
|
+
function PlaybackPolicyWarning() {
|
|
3091
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, style: {
|
|
3092
|
+
outline: "0.01rem solid grey",
|
|
3093
|
+
backgroundColor: "#979cb0",
|
|
3094
|
+
borderRadius: "0.5rem",
|
|
3095
|
+
width: "max-content",
|
|
3096
|
+
color: "#13141A"
|
|
3097
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
|
|
3098
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningFilledIcon, {}),
|
|
3099
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: {
|
|
3100
|
+
color: "#13141A",
|
|
3101
|
+
fontWeight: 500
|
|
3102
|
+
}, children: "Please select at least one Playback Policy" })
|
|
3103
|
+
] }) });
|
|
3104
|
+
}
|
|
3105
|
+
function PlaybackPolicy({
|
|
3106
|
+
id,
|
|
3107
|
+
config,
|
|
3108
|
+
secrets,
|
|
3109
|
+
dispatch
|
|
3110
|
+
}) {
|
|
3111
|
+
const noPolicySelected = !(config.public_policy || config.signed_policy);
|
|
3112
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { gap: 3, children: [
|
|
3113
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "bold", children: "Advanced Playback Policies" }),
|
|
3114
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3115
|
+
PlaybackPolicyOption,
|
|
3116
|
+
{
|
|
3117
|
+
id: `${id}--public`,
|
|
3118
|
+
checked: config.public_policy,
|
|
3119
|
+
optionName: "Public",
|
|
3120
|
+
description: "Playback IDs are accessible by constructing an HLS URL like https://stream.mux.com/{PLAYBACK_ID}",
|
|
3121
|
+
dispatch,
|
|
3122
|
+
action: "public_policy"
|
|
3123
|
+
}
|
|
3124
|
+
),
|
|
3125
|
+
secrets.enableSignedUrls && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3126
|
+
PlaybackPolicyOption,
|
|
3127
|
+
{
|
|
3128
|
+
id: `${id}--signed`,
|
|
3129
|
+
checked: config.signed_policy,
|
|
3130
|
+
optionName: "Signed",
|
|
3131
|
+
description: `Playback IDs should be used with tokens https://stream.mux.com/{PLAYBACK_ID}?token={TOKEN}.
|
|
3132
|
+
// See Secure video playback for details about creating tokens.`,
|
|
3133
|
+
dispatch,
|
|
3134
|
+
action: "signed_policy"
|
|
3135
|
+
}
|
|
3136
|
+
),
|
|
3137
|
+
noPolicySelected && /* @__PURE__ */ jsxRuntime.jsx(PlaybackPolicyWarning, {})
|
|
3138
|
+
] });
|
|
3139
|
+
}
|
|
3654
3140
|
const ENCODING_OPTIONS = [
|
|
3655
3141
|
{ value: "smart", label: "Smart" },
|
|
3656
3142
|
{ value: "baseline", label: "Baseline" }
|
|
@@ -3677,14 +3163,15 @@ function UploadConfiguration({
|
|
|
3677
3163
|
] : []
|
|
3678
3164
|
).current, [config, dispatch] = React.useReducer(
|
|
3679
3165
|
(prev, action) => {
|
|
3680
|
-
var _a;
|
|
3681
3166
|
switch (action.action) {
|
|
3682
3167
|
case "encoding_tier":
|
|
3683
3168
|
return action.value === "baseline" ? Object.assign({}, prev, {
|
|
3684
3169
|
encoding_tier: action.value,
|
|
3685
3170
|
mp4_support: "none",
|
|
3686
3171
|
max_resolution_tier: "1080p",
|
|
3687
|
-
text_tracks:
|
|
3172
|
+
text_tracks: prev.text_tracks?.filter(({ type }) => type !== "autogenerated"),
|
|
3173
|
+
public_policy: !0,
|
|
3174
|
+
signed_policy: !1
|
|
3688
3175
|
}) : Object.assign({}, prev, {
|
|
3689
3176
|
encoding_tier: action.value,
|
|
3690
3177
|
mp4_support: pluginConfig.mp4_support,
|
|
@@ -3694,7 +3181,9 @@ function UploadConfiguration({
|
|
|
3694
3181
|
case "mp4_support":
|
|
3695
3182
|
case "max_resolution_tier":
|
|
3696
3183
|
case "normalize_audio":
|
|
3697
|
-
case "
|
|
3184
|
+
case "signed_policy":
|
|
3185
|
+
return Object.assign({}, prev, { [action.action]: action.value });
|
|
3186
|
+
case "public_policy":
|
|
3698
3187
|
return Object.assign({}, prev, { [action.action]: action.value });
|
|
3699
3188
|
// Updating individual tracks
|
|
3700
3189
|
case "track": {
|
|
@@ -3702,13 +3191,17 @@ function UploadConfiguration({
|
|
|
3702
3191
|
switch (action.subAction) {
|
|
3703
3192
|
case "add":
|
|
3704
3193
|
if (target_track_i !== -1) break;
|
|
3705
|
-
text_tracks.push(
|
|
3706
|
-
_id: action.id
|
|
3707
|
-
|
|
3194
|
+
text_tracks.push({
|
|
3195
|
+
_id: action.id,
|
|
3196
|
+
...action.value
|
|
3197
|
+
});
|
|
3708
3198
|
break;
|
|
3709
3199
|
case "update":
|
|
3710
3200
|
if (target_track_i === -1) break;
|
|
3711
|
-
text_tracks[target_track_i] =
|
|
3201
|
+
text_tracks[target_track_i] = {
|
|
3202
|
+
...text_tracks[target_track_i],
|
|
3203
|
+
...action.value
|
|
3204
|
+
};
|
|
3712
3205
|
break;
|
|
3713
3206
|
case "delete":
|
|
3714
3207
|
if (target_track_i === -1) break;
|
|
@@ -3725,7 +3218,8 @@ function UploadConfiguration({
|
|
|
3725
3218
|
encoding_tier: pluginConfig.encoding_tier,
|
|
3726
3219
|
max_resolution_tier: pluginConfig.max_resolution_tier,
|
|
3727
3220
|
mp4_support: pluginConfig.mp4_support,
|
|
3728
|
-
|
|
3221
|
+
signed_policy: secrets.enableSignedUrls && pluginConfig.defaultSigned,
|
|
3222
|
+
public_policy: !0,
|
|
3729
3223
|
normalize_audio: pluginConfig.normalize_audio,
|
|
3730
3224
|
text_tracks: autoTextTracks
|
|
3731
3225
|
}
|
|
@@ -3844,25 +3338,9 @@ function UploadConfiguration({
|
|
|
3844
3338
|
}) })
|
|
3845
3339
|
}
|
|
3846
3340
|
),
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
ui.Checkbox,
|
|
3851
|
-
{
|
|
3852
|
-
id: `${id}--signed`,
|
|
3853
|
-
style: { display: "block" },
|
|
3854
|
-
name: "signed",
|
|
3855
|
-
required: !0,
|
|
3856
|
-
checked: config.signed,
|
|
3857
|
-
onChange: (e) => dispatch({
|
|
3858
|
-
action: "signed",
|
|
3859
|
-
value: e.currentTarget.checked
|
|
3860
|
-
})
|
|
3861
|
-
}
|
|
3862
|
-
),
|
|
3863
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: `${id}--signed`, children: "Signed playback URL" }) })
|
|
3864
|
-
] }),
|
|
3865
|
-
config.encoding_tier === "smart" && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
|
|
3341
|
+
config.encoding_tier === "smart" && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormField, { title: "Additional Configuration", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
3342
|
+
/* @__PURE__ */ jsxRuntime.jsx(PlaybackPolicy, { id, config, secrets, dispatch }),
|
|
3343
|
+
config.encoding_tier === "smart" && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, padding: [0, 2], children: [
|
|
3866
3344
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3867
3345
|
ui.Checkbox,
|
|
3868
3346
|
{
|
|
@@ -3892,6 +3370,7 @@ function UploadConfiguration({
|
|
|
3892
3370
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3893
3371
|
ui.Button,
|
|
3894
3372
|
{
|
|
3373
|
+
disabled: config.encoding_tier === "smart" && !config.public_policy && !config.signed_policy,
|
|
3895
3374
|
icon: icons.UploadIcon,
|
|
3896
3375
|
text: "Upload",
|
|
3897
3376
|
tone: "positive",
|
|
@@ -3902,6 +3381,10 @@ function UploadConfiguration({
|
|
|
3902
3381
|
}
|
|
3903
3382
|
);
|
|
3904
3383
|
}
|
|
3384
|
+
function setPlaybackPolicy(config) {
|
|
3385
|
+
const playback_policy = [];
|
|
3386
|
+
return config.public_policy && playback_policy.push("public"), config.signed_policy && playback_policy.push("signed"), playback_policy;
|
|
3387
|
+
}
|
|
3905
3388
|
function formatUploadConfig(config) {
|
|
3906
3389
|
const generated_subtitles = config.text_tracks.filter(isAutogeneratedTrack).map((track) => ({
|
|
3907
3390
|
name: track.name,
|
|
@@ -3926,7 +3409,7 @@ function formatUploadConfig(config) {
|
|
|
3926
3409
|
)
|
|
3927
3410
|
],
|
|
3928
3411
|
mp4_support: config.mp4_support,
|
|
3929
|
-
playback_policy: config
|
|
3412
|
+
playback_policy: setPlaybackPolicy(config),
|
|
3930
3413
|
max_resolution_tier: config.max_resolution_tier,
|
|
3931
3414
|
encoding_tier: config.encoding_tier,
|
|
3932
3415
|
normalize_audio: config.normalize_audio
|
|
@@ -3994,24 +3477,7 @@ const ctrlKey = 17, cmdKey = 91, UploadCardWithFocusRing = withFocusRing(ui.Card
|
|
|
3994
3477
|
&:focus {
|
|
3995
3478
|
outline: none;
|
|
3996
3479
|
}
|
|
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 = styledComponents.styled.input`
|
|
3480
|
+
`, HiddenInput = styledComponents.styled.input`
|
|
4015
3481
|
overflow: hidden;
|
|
4016
3482
|
width: 0.1px;
|
|
4017
3483
|
height: 0.1px;
|
|
@@ -4020,17 +3486,13 @@ const HiddenInput = styledComponents.styled.input`
|
|
|
4020
3486
|
z-index: -1;
|
|
4021
3487
|
`, Label = styledComponents.styled.label`
|
|
4022
3488
|
position: relative;
|
|
4023
|
-
`, FileInputButton = (
|
|
4024
|
-
var _b = _a, { onSelect, accept } = _b, props = __objRest$1(_b, ["onSelect", "accept"]);
|
|
3489
|
+
`, FileInputButton = ({ onSelect, accept, ...props }) => {
|
|
4025
3490
|
const inputId = `FileSelect${React.useId()}`, inputRef = React.useRef(null), handleSelect = React.useCallback(
|
|
4026
3491
|
(event) => {
|
|
4027
3492
|
onSelect && onSelect(event.target.files);
|
|
4028
3493
|
},
|
|
4029
3494
|
[onSelect]
|
|
4030
|
-
), handleButtonClick = React.useCallback(() =>
|
|
4031
|
-
var _a2;
|
|
4032
|
-
return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
4033
|
-
}, []);
|
|
3495
|
+
), handleButtonClick = React.useCallback(() => inputRef.current?.click(), []);
|
|
4034
3496
|
return /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: inputId, children: [
|
|
4035
3497
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4036
3498
|
HiddenInput,
|
|
@@ -4046,12 +3508,13 @@ const HiddenInput = styledComponents.styled.input`
|
|
|
4046
3508
|
),
|
|
4047
3509
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4048
3510
|
ui.Button,
|
|
4049
|
-
|
|
3511
|
+
{
|
|
4050
3512
|
onClick: handleButtonClick,
|
|
4051
3513
|
mode: "default",
|
|
4052
3514
|
tone: "primary",
|
|
4053
|
-
style: { width: "100%" }
|
|
4054
|
-
|
|
3515
|
+
style: { width: "100%" },
|
|
3516
|
+
...props
|
|
3517
|
+
}
|
|
4055
3518
|
)
|
|
4056
3519
|
] });
|
|
4057
3520
|
};
|
|
@@ -4112,29 +3575,12 @@ function UploadPlaceholder(props) {
|
|
|
4112
3575
|
}
|
|
4113
3576
|
);
|
|
4114
3577
|
}
|
|
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
|
-
};
|
|
4131
3578
|
const INITIAL_STATE = {
|
|
4132
3579
|
stagedUpload: null,
|
|
4133
3580
|
uploadStatus: null,
|
|
4134
3581
|
error: null
|
|
4135
3582
|
};
|
|
4136
3583
|
function Uploader(props) {
|
|
4137
|
-
var _a;
|
|
4138
3584
|
const toast = ui.useToast(), containerRef = React.useRef(null), dragEnteredEls = React.useRef([]), [dragState, setDragState] = React.useState(null), cancelUploadButton = React.useRef(
|
|
4139
3585
|
(() => {
|
|
4140
3586
|
const events$ = new rxjs.Subject();
|
|
@@ -4145,31 +3591,33 @@ function Uploader(props) {
|
|
|
4145
3591
|
})()
|
|
4146
3592
|
).current, uploadRef = React.useRef(null), [state, dispatch] = React.useReducer(
|
|
4147
3593
|
(prev, action) => {
|
|
4148
|
-
var _b, _c;
|
|
4149
3594
|
switch (action.action) {
|
|
4150
3595
|
case "stageUpload":
|
|
4151
3596
|
return Object.assign({}, INITIAL_STATE, { stagedUpload: action.input });
|
|
4152
3597
|
case "commitUpload":
|
|
4153
3598
|
return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
|
|
4154
3599
|
case "progressInfo": {
|
|
4155
|
-
const
|
|
3600
|
+
const { ...payload } = action;
|
|
4156
3601
|
return Object.assign({}, prev, {
|
|
4157
|
-
uploadStatus:
|
|
4158
|
-
|
|
4159
|
-
|
|
3602
|
+
uploadStatus: {
|
|
3603
|
+
...prev.uploadStatus,
|
|
3604
|
+
progress: prev.uploadStatus.progress,
|
|
3605
|
+
...payload
|
|
3606
|
+
}
|
|
4160
3607
|
});
|
|
4161
3608
|
}
|
|
4162
3609
|
case "progress":
|
|
4163
3610
|
return Object.assign({}, prev, {
|
|
4164
|
-
uploadStatus:
|
|
3611
|
+
uploadStatus: {
|
|
3612
|
+
...prev.uploadStatus,
|
|
4165
3613
|
progress: action.percent
|
|
4166
|
-
}
|
|
3614
|
+
}
|
|
4167
3615
|
});
|
|
4168
3616
|
case "reset":
|
|
4169
3617
|
case "complete":
|
|
4170
|
-
return
|
|
3618
|
+
return uploadRef.current?.unsubscribe(), uploadRef.current = null, INITIAL_STATE;
|
|
4171
3619
|
case "error":
|
|
4172
|
-
return
|
|
3620
|
+
return uploadRef.current?.unsubscribe(), uploadRef.current = null, Object.assign({}, INITIAL_STATE, { error: action.error });
|
|
4173
3621
|
default:
|
|
4174
3622
|
return prev;
|
|
4175
3623
|
}
|
|
@@ -4205,8 +3653,7 @@ function Uploader(props) {
|
|
|
4205
3653
|
operators.takeUntil(
|
|
4206
3654
|
cancelUploadButton.observable.pipe(
|
|
4207
3655
|
operators.tap(() => {
|
|
4208
|
-
|
|
4209
|
-
(_a2 = state.uploadStatus) != null && _a2.uuid && props.client.delete(state.uploadStatus.uuid);
|
|
3656
|
+
state.uploadStatus?.uuid && props.client.delete(state.uploadStatus.uuid);
|
|
4210
3657
|
})
|
|
4211
3658
|
)
|
|
4212
3659
|
)
|
|
@@ -4219,7 +3666,7 @@ function Uploader(props) {
|
|
|
4219
3666
|
case "uuid":
|
|
4220
3667
|
case "file":
|
|
4221
3668
|
case "url":
|
|
4222
|
-
dispatch(
|
|
3669
|
+
dispatch({ action: "progressInfo", ...event });
|
|
4223
3670
|
break;
|
|
4224
3671
|
case "progress":
|
|
4225
3672
|
dispatch({ action: "progress", percent: event.percent });
|
|
@@ -4260,17 +3707,16 @@ function Uploader(props) {
|
|
|
4260
3707
|
}, handleDragOver = (event) => {
|
|
4261
3708
|
event.preventDefault(), event.stopPropagation();
|
|
4262
3709
|
}, handleDragEnter = (event) => {
|
|
4263
|
-
var _a2, _b;
|
|
4264
3710
|
event.stopPropagation(), dragEnteredEls.current.push(event.target);
|
|
4265
|
-
const type =
|
|
4266
|
-
setDragState(type
|
|
3711
|
+
const type = event.dataTransfer.items?.[0]?.type;
|
|
3712
|
+
setDragState(type?.startsWith("video/") ? "valid" : "invalid");
|
|
4267
3713
|
}, handleDragLeave = (event) => {
|
|
4268
3714
|
event.stopPropagation();
|
|
4269
3715
|
const idx = dragEnteredEls.current.indexOf(event.target);
|
|
4270
3716
|
idx > -1 && dragEnteredEls.current.splice(idx, 1), dragEnteredEls.current.length === 0 && setDragState(null);
|
|
4271
3717
|
};
|
|
4272
3718
|
if (state.error !== null) {
|
|
4273
|
-
const error = {
|
|
3719
|
+
const error = {};
|
|
4274
3720
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, direction: "column", justify: "center", align: "center", children: [
|
|
4275
3721
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 5, muted: !0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ErrorOutlineIcon, {}) }),
|
|
4276
3722
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Something went wrong" }),
|
|
@@ -4285,7 +3731,7 @@ function Uploader(props) {
|
|
|
4285
3731
|
{
|
|
4286
3732
|
onCancel: cancelUploadButton.handleClick,
|
|
4287
3733
|
progress: uploadStatus.progress,
|
|
4288
|
-
filename:
|
|
3734
|
+
filename: uploadStatus.file?.name || uploadStatus.url
|
|
4289
3735
|
}
|
|
4290
3736
|
);
|
|
4291
3737
|
}
|
|
@@ -4313,20 +3759,27 @@ function Uploader(props) {
|
|
|
4313
3759
|
onPaste: handlePaste,
|
|
4314
3760
|
ref: containerRef,
|
|
4315
3761
|
children: props.asset ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4316
|
-
|
|
3762
|
+
DialogStateProvider,
|
|
4317
3763
|
{
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
PlayerActionsMenu$1,
|
|
3764
|
+
dialogState: props.dialogState,
|
|
3765
|
+
setDialogState: props.setDialogState,
|
|
3766
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3767
|
+
Player,
|
|
4323
3768
|
{
|
|
3769
|
+
readOnly: props.readOnly,
|
|
4324
3770
|
asset: props.asset,
|
|
4325
|
-
dialogState: props.dialogState,
|
|
4326
|
-
setDialogState: props.setDialogState,
|
|
4327
3771
|
onChange: props.onChange,
|
|
4328
|
-
|
|
4329
|
-
|
|
3772
|
+
buttons: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3773
|
+
PlayerActionsMenu$1,
|
|
3774
|
+
{
|
|
3775
|
+
asset: props.asset,
|
|
3776
|
+
dialogState: props.dialogState,
|
|
3777
|
+
setDialogState: props.setDialogState,
|
|
3778
|
+
onChange: props.onChange,
|
|
3779
|
+
onSelect: handleUpload,
|
|
3780
|
+
readOnly: props.readOnly
|
|
3781
|
+
}
|
|
3782
|
+
)
|
|
4330
3783
|
}
|
|
4331
3784
|
)
|
|
4332
3785
|
}
|
|
@@ -4352,24 +3805,16 @@ function Uploader(props) {
|
|
|
4352
3805
|
)
|
|
4353
3806
|
] });
|
|
4354
3807
|
}
|
|
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));
|
|
4363
3808
|
const Input = (props) => {
|
|
4364
|
-
|
|
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;
|
|
3809
|
+
const client = useClient(), secretDocumentValues = useSecretsDocumentValues(), assetDocumentValues = useAssetDocumentValues(props.value?.asset), poll = useMuxPolling(props.readOnly ? void 0 : assetDocumentValues?.value || void 0), [dialogState, setDialogState] = useDialogState(), error = secretDocumentValues.error || assetDocumentValues.error || poll.error;
|
|
4366
3810
|
if (error)
|
|
4367
3811
|
throw error;
|
|
4368
3812
|
const isLoading = secretDocumentValues.isLoading || assetDocumentValues.isLoading;
|
|
4369
3813
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundaryCard$1, { schemaType: props.schemaType, children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(InputFallback, {}), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(InputFallback, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4370
3814
|
secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /* @__PURE__ */ jsxRuntime.jsx(Onboard, { setDialogState }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4371
3815
|
Uploader,
|
|
4372
|
-
|
|
3816
|
+
{
|
|
3817
|
+
...props,
|
|
4373
3818
|
config: props.config,
|
|
4374
3819
|
onChange: props.onChange,
|
|
4375
3820
|
client,
|
|
@@ -4378,7 +3823,7 @@ const Input = (props) => {
|
|
|
4378
3823
|
dialogState,
|
|
4379
3824
|
setDialogState,
|
|
4380
3825
|
needsSetup: secretDocumentValues.value.needsSetup
|
|
4381
|
-
}
|
|
3826
|
+
}
|
|
4382
3827
|
),
|
|
4383
3828
|
dialogState === "secrets" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4384
3829
|
ConfigureApi$1,
|
|
@@ -4389,18 +3834,11 @@ const Input = (props) => {
|
|
|
4389
3834
|
)
|
|
4390
3835
|
] }) }) }) });
|
|
4391
3836
|
};
|
|
4392
|
-
var Input$1 = React.memo(Input)
|
|
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
|
-
};
|
|
3837
|
+
var Input$1 = React.memo(Input);
|
|
4400
3838
|
function muxVideoCustomRendering(config) {
|
|
4401
3839
|
return {
|
|
4402
3840
|
components: {
|
|
4403
|
-
input: (props) => /* @__PURE__ */ jsxRuntime.jsx(Input$1,
|
|
3841
|
+
input: (props) => /* @__PURE__ */ jsxRuntime.jsx(Input$1, { config: { ...config, ...props.schemaType.options }, ...props })
|
|
4404
3842
|
},
|
|
4405
3843
|
preview: {
|
|
4406
3844
|
select: {
|
|
@@ -4588,16 +4026,7 @@ const muxVideoSchema = {
|
|
|
4588
4026
|
muxStaticRenditions,
|
|
4589
4027
|
muxAssetData,
|
|
4590
4028
|
muxVideoAsset
|
|
4591
|
-
]
|
|
4592
|
-
var __defProp2 = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp2 = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a2, b) => {
|
|
4593
|
-
for (var prop in b || (b = {}))
|
|
4594
|
-
__hasOwnProp2.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 = {
|
|
4029
|
+
], defaultConfig = {
|
|
4601
4030
|
mp4_support: "none",
|
|
4602
4031
|
encoding_tier: "smart",
|
|
4603
4032
|
max_resolution_tier: "1080p",
|
|
@@ -4605,13 +4034,16 @@ const defaultConfig = {
|
|
|
4605
4034
|
defaultSigned: !1,
|
|
4606
4035
|
tool: DEFAULT_TOOL_CONFIG
|
|
4607
4036
|
}, muxInput = sanity.definePlugin((userConfig) => {
|
|
4608
|
-
const config =
|
|
4037
|
+
const config = { ...defaultConfig, ...userConfig || {} };
|
|
4609
4038
|
return {
|
|
4610
4039
|
name: "mux-input",
|
|
4611
4040
|
schema: {
|
|
4612
4041
|
types: [
|
|
4613
4042
|
...schemaTypes,
|
|
4614
|
-
|
|
4043
|
+
{
|
|
4044
|
+
...muxVideoSchema,
|
|
4045
|
+
...muxVideoCustomRendering(config)
|
|
4046
|
+
}
|
|
4615
4047
|
]
|
|
4616
4048
|
},
|
|
4617
4049
|
tools: config.tool === !1 ? void 0 : [createStudioTool(config)]
|