sanity-plugin-mux-input 1.2.0-main.2 → 1.2.0-main.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,86 +1,3751 @@
1
- var $dyHF6$reactjsxruntime = require("react/jsx-runtime");
2
- var $dyHF6$sanityui = require("@sanity/ui");
3
- var $dyHF6$react = require("react");
4
- var $dyHF6$styledcomponents = require("styled-components");
5
- var $dyHF6$sanity = require("sanity");
6
- var $dyHF6$scrollintoviewifneeded = require("scroll-into-view-if-needed");
7
- var $dyHF6$suspendreact = require("suspend-react");
8
- var $dyHF6$useerrorboundary = require("use-error-boundary");
1
+ var $ayBmS$swchelperslib_object_spreadjs = require("@swc/helpers/lib/_object_spread.js");
2
+ var $ayBmS$reactjsxruntime = require("react/jsx-runtime");
3
+ var $ayBmS$react = require("react");
4
+ var $ayBmS$sanity = require("sanity");
5
+ var $ayBmS$sanityui = require("@sanity/ui");
6
+ var $ayBmS$scrollintoviewifneeded = require("scroll-into-view-if-needed");
7
+ var $ayBmS$suspendreact = require("suspend-react");
8
+ var $ayBmS$useerrorboundary = require("use-error-boundary");
9
+ var $ayBmS$swchelperslib_object_spread_propsjs = require("@swc/helpers/lib/_object_spread_props.js");
10
+ var $ayBmS$sanity_unstable = require("sanity/_unstable");
11
+ var $ayBmS$swr = require("swr");
12
+ var $ayBmS$swchelperslib_define_propertyjs = require("@swc/helpers/lib/_define_property.js");
13
+ var $ayBmS$rxjs = require("rxjs");
14
+ var $ayBmS$rxjsoperators = require("rxjs/operators");
15
+ var $ayBmS$sanityform = require("sanity/form");
16
+ var $ayBmS$sanityuuid = require("@sanity/uuid");
17
+ var $ayBmS$muxupchunk = require("@mux/upchunk");
18
+ var $ayBmS$reachautoid = require("@reach/auto-id");
19
+ var $ayBmS$sanityicons = require("@sanity/icons");
20
+ var $ayBmS$motion = require("motion");
21
+ var $ayBmS$styledcomponents = require("styled-components");
22
+ var $ayBmS$usedevicepixelratio = require("use-device-pixel-ratio");
23
+ var $ayBmS$jsonwebtokenesm = require("jsonwebtoken-esm");
24
+ var $ayBmS$muxplaybackcore = require("@mux/playback-core");
25
+ var $ayBmS$mediachromedistreact = require("media-chrome/dist/react");
26
+ var $ayBmS$swchelperslib_object_without_propertiesjs = require("@swc/helpers/lib/_object_without_properties.js");
27
+ var $ayBmS$reactis = require("react-is");
9
28
 
29
+ function $parcel$interopDefault(a) {
30
+ return a && a.__esModule ? a.default : a;
31
+ }
10
32
  function $parcel$export(e, n, v, s) {
11
33
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
34
  }
13
- function $parcel$interopDefault(a) {
14
- return a && a.__esModule ? a.default : a;
35
+
36
+ $parcel$export(module.exports, "defaultConfig", function () { return $35eb69de8ff825b5$export$f84bd70098573c5c; });
37
+ $parcel$export(module.exports, "muxInput", function () { return $35eb69de8ff825b5$export$4d2e76c338bb9fbd; });
38
+ $parcel$export(module.exports, "Input", function () { return $7988e690e4a01972$export$2e2bcd8739ae039; });
39
+ $parcel$export(module.exports, "Preview", function () { return $a1523ee7ee9b753a$export$2e2bcd8739ae039; });
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+ const $764163079c542eaf$export$a8ff84c12d48cfa6 = "mux-input";
51
+ const $764163079c542eaf$export$13cdb654d47e0703 = "sanity-plugin-mux-input";
52
+ const $764163079c542eaf$export$64952397958089dd = "secrets.mux";
53
+
54
+
55
+ function $23a5e4ef1c8a3996$var$ErrorBoundaryCard(props) {
56
+ const { children: children , schemaType: schemaType } = props;
57
+ const { push: pushToast } = (0, $ayBmS$sanityui.useToast)();
58
+ const errorRef = (0, $ayBmS$react.useRef)(null);
59
+ const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error , reset: reset } = (0, $ayBmS$useerrorboundary.useErrorBoundary)({
60
+ onDidCatch: (err, errorInfo)=>{
61
+ console.group(err.toString());
62
+ console.groupCollapsed("console.error");
63
+ console.error(err);
64
+ console.groupEnd();
65
+ if (err.stack) {
66
+ console.groupCollapsed("error.stack");
67
+ console.log(err.stack);
68
+ console.groupEnd();
69
+ }
70
+ if (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack) {
71
+ console.groupCollapsed("errorInfo.componentStack");
72
+ console.log(errorInfo.componentStack);
73
+ console.groupEnd();
74
+ }
75
+ console.groupEnd();
76
+ pushToast({
77
+ status: "error",
78
+ title: "Plugin crashed",
79
+ description: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
80
+ align: "center",
81
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
82
+ space: 1,
83
+ children: [
84
+ "An error happened while rendering",
85
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
86
+ padding: 1,
87
+ fontSize: 1,
88
+ style: {
89
+ transform: "translateY(1px)"
90
+ },
91
+ mode: "ghost",
92
+ text: schemaType.title,
93
+ onClick: ()=>{
94
+ if (errorRef.current) (0, ($parcel$interopDefault($ayBmS$scrollintoviewifneeded)))(errorRef.current, {
95
+ behavior: "smooth",
96
+ scrollMode: "if-needed",
97
+ block: "center"
98
+ });
99
+ }
100
+ })
101
+ ]
102
+ })
103
+ })
104
+ });
105
+ }
106
+ });
107
+ const handleRetry = (0, $ayBmS$react.useCallback)(()=>{
108
+ // Purge request cache before retrying, otherwise the cached errors will rethrow
109
+ (0, $ayBmS$suspendreact.clear)([
110
+ (0, $764163079c542eaf$export$a8ff84c12d48cfa6)
111
+ ]);
112
+ reset();
113
+ }, [
114
+ reset
115
+ ]);
116
+ if (didCatch) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
117
+ ref: errorRef,
118
+ paddingX: [
119
+ 2,
120
+ 3,
121
+ 4,
122
+ 4
123
+ ],
124
+ height: "fill",
125
+ shadow: 1,
126
+ overflow: "auto",
127
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
128
+ justify: "flex-start",
129
+ align: "center",
130
+ height: "fill",
131
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Grid), {
132
+ columns: 1,
133
+ gap: [
134
+ 2,
135
+ 3,
136
+ 4,
137
+ 4
138
+ ],
139
+ children: [
140
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Heading), {
141
+ as: "h1",
142
+ children: [
143
+ "The ",
144
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("code", {
145
+ children: (0, $764163079c542eaf$export$a8ff84c12d48cfa6)
146
+ }),
147
+ " plugin crashed"
148
+ ]
149
+ }),
150
+ (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
151
+ padding: 3,
152
+ tone: "critical",
153
+ shadow: 1,
154
+ radius: 2,
155
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
156
+ children: error.message
157
+ })
158
+ }),
159
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Inline), {
160
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
161
+ onClick: handleRetry,
162
+ text: "Retry"
163
+ })
164
+ })
165
+ ]
166
+ })
167
+ })
168
+ });
169
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)(ErrorBoundary, {
170
+ children: children
171
+ });
172
+ }
173
+ var $23a5e4ef1c8a3996$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $ayBmS$react.memo)($23a5e4ef1c8a3996$var$ErrorBoundaryCard);
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ const $91e90464b4ca45aa$var$path = [
184
+ "assetId",
185
+ "data",
186
+ "playbackId",
187
+ "status",
188
+ "thumbTime",
189
+ "filename"
190
+ ];
191
+ const $91e90464b4ca45aa$export$e11a382d55e07f75 = (asset)=>(0, $ayBmS$sanity_unstable.useDocumentValues)((0, $ayBmS$sanity.isReference)(asset) ? asset._ref : "", $91e90464b4ca45aa$var$path);
192
+
193
+
194
+
195
+ function $8ea54a6e4798432c$export$573903f1c655c034() {
196
+ return (0, $ayBmS$react.useState)(false);
197
+ }
198
+
199
+
200
+
201
+
202
+
203
+ const $b098b0d885e904ff$export$fd270df25d7dbb88 = (asset)=>{
204
+ var ref3, ref1;
205
+ const client = (0, $ayBmS$sanity.useClient)();
206
+ const projectId = (0, $ayBmS$sanity.useProjectId)();
207
+ const dataset = (0, $ayBmS$sanity.useDataset)();
208
+ const shouldFetch = (0, $ayBmS$react.useMemo)(()=>{
209
+ var ref, ref2;
210
+ return !!(asset === null || asset === void 0 ? void 0 : asset.assetId) && ((asset === null || asset === void 0 ? void 0 : asset.status) === "preparing" || (asset === null || asset === void 0 ? void 0 : (ref = asset.data) === null || ref === void 0 ? void 0 : (ref2 = ref.static_renditions) === null || ref2 === void 0 ? void 0 : ref2.status) === "preparing");
211
+ }, [
212
+ asset === null || asset === void 0 ? void 0 : asset.assetId,
213
+ asset === null || asset === void 0 ? void 0 : (ref3 = asset.data) === null || ref3 === void 0 ? void 0 : (ref1 = ref3.static_renditions) === null || ref1 === void 0 ? void 0 : ref1.status,
214
+ asset === null || asset === void 0 ? void 0 : asset.status
215
+ ]);
216
+ return (0, ($parcel$interopDefault($ayBmS$swr)))(shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset === null || asset === void 0 ? void 0 : asset.assetId}` : null, async ()=>{
217
+ const { data: data } = await client.request({
218
+ url: `/addons/mux/assets/${dataset}/data/${asset.assetId}`,
219
+ withCredentials: true,
220
+ method: "GET"
221
+ });
222
+ client.patch(asset._id).set({
223
+ status: data.status,
224
+ data: data
225
+ }).commit({
226
+ returnDocuments: false
227
+ });
228
+ }, {
229
+ refreshInterval: 2000,
230
+ refreshWhenHidden: true,
231
+ dedupingInterval: 1000
232
+ });
233
+ };
234
+
235
+
236
+
237
+
238
+
239
+ const $e0562e9a5cd26710$var$path = [
240
+ "token",
241
+ "secretKey",
242
+ "enableSignedUrls",
243
+ "signingKeyId",
244
+ "signingKeyPrivate"
245
+ ];
246
+ const $e0562e9a5cd26710$export$4c2801830a129eb = ()=>{
247
+ const { error: error , isLoading: isLoading , value: value } = (0, $ayBmS$sanity_unstable.useDocumentValues)((0, $764163079c542eaf$export$64952397958089dd), $e0562e9a5cd26710$var$path);
248
+ const cache = (0, $ayBmS$react.useMemo)(()=>{
249
+ const exists = Boolean(value);
250
+ const secrets = {
251
+ token: (value === null || value === void 0 ? void 0 : value.token) || null,
252
+ secretKey: (value === null || value === void 0 ? void 0 : value.secretKey) || null,
253
+ enableSignedUrls: (value === null || value === void 0 ? void 0 : value.enableSignedUrls) || false,
254
+ signingKeyId: (value === null || value === void 0 ? void 0 : value.signingKeyId) || null,
255
+ signingKeyPrivate: (value === null || value === void 0 ? void 0 : value.signingKeyPrivate) || null
256
+ };
257
+ return {
258
+ isInitialSetup: !exists,
259
+ needsSetup: !(secrets === null || secrets === void 0 ? void 0 : secrets.token) || !(secrets === null || secrets === void 0 ? void 0 : secrets.secretKey),
260
+ secrets: secrets
261
+ };
262
+ }, [
263
+ value
264
+ ]);
265
+ return {
266
+ error: error,
267
+ isLoading: isLoading,
268
+ value: cache
269
+ };
270
+ };
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+ function $769e09a03b9726c9$export$ad6eab20b4b3876f(uuid, uploadUrl, source) {
287
+ return new (0, $ayBmS$rxjs.Observable)((subscriber)=>{
288
+ const upchunk = $ayBmS$muxupchunk.createUpload({
289
+ endpoint: uploadUrl,
290
+ file: source,
291
+ chunkSize: 30720
292
+ });
293
+ const successHandler = ()=>{
294
+ subscriber.next({
295
+ type: "success",
296
+ id: uuid
297
+ });
298
+ subscriber.complete();
299
+ };
300
+ const errorHandler = (data)=>subscriber.error(new Error(data.detail.message));
301
+ const progressHandler = (data)=>{
302
+ return subscriber.next({
303
+ type: "progress",
304
+ percent: data.detail
305
+ });
306
+ };
307
+ const offlineHandler = ()=>{
308
+ upchunk.pause();
309
+ subscriber.next({
310
+ type: "pause",
311
+ id: uuid
312
+ });
313
+ };
314
+ const onlineHandler = ()=>{
315
+ upchunk.resume();
316
+ subscriber.next({
317
+ type: "resume",
318
+ id: uuid
319
+ });
320
+ };
321
+ upchunk.on("success", successHandler);
322
+ upchunk.on("error", errorHandler);
323
+ upchunk.on("progress", progressHandler);
324
+ upchunk.on("offline", offlineHandler);
325
+ upchunk.on("online", onlineHandler);
326
+ return ()=>upchunk.abort();
327
+ });
328
+ }
329
+
330
+
331
+ function $85b2a8cdf745d7d3$export$df987b50509121ea(client, assetId) {
332
+ const { dataset: dataset } = client.config();
333
+ return client.request({
334
+ url: `/addons/mux/assets/${dataset}/${assetId}`,
335
+ withCredentials: true,
336
+ method: "DELETE"
337
+ });
338
+ }
339
+ function $85b2a8cdf745d7d3$export$da446a5ee2572b7(client, assetId) {
340
+ const { dataset: dataset } = client.config();
341
+ return client.request({
342
+ url: `/addons/mux/assets/${dataset}/data/${assetId}`,
343
+ withCredentials: true,
344
+ method: "GET"
345
+ });
346
+ }
347
+
348
+
349
+
350
+ function $4d6664636d7d58e3$export$f16c6d66b9790f06(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate) {
351
+ const doc = {
352
+ _id: "secrets.mux",
353
+ _type: "mux.apiKey",
354
+ token: token,
355
+ secretKey: secretKey,
356
+ enableSignedUrls: enableSignedUrls,
357
+ signingKeyId: signingKeyId,
358
+ signingKeyPrivate: signingKeyPrivate
359
+ };
360
+ return client.createOrReplace(doc);
361
+ }
362
+ function $4d6664636d7d58e3$export$21cc0cab779cfac1(client) {
363
+ const { dataset: dataset } = client.config();
364
+ return client.request({
365
+ url: `/addons/mux/signing-keys/${dataset}`,
366
+ withCredentials: true,
367
+ method: "POST"
368
+ });
369
+ }
370
+ function $4d6664636d7d58e3$export$3a1df1322191b3ef(client) {
371
+ const { dataset: dataset } = client.config();
372
+ return client.request({
373
+ url: `/addons/mux/secrets/${dataset}/test`,
374
+ withCredentials: true,
375
+ method: "GET"
376
+ });
377
+ }
378
+ async function $4d6664636d7d58e3$export$f5836111430d17bc(client, signingKeyId, signingKeyPrivate) {
379
+ if (!(signingKeyId && signingKeyPrivate)) return false;
380
+ const { dataset: dataset } = client.config();
381
+ try {
382
+ const res = await client.request({
383
+ url: `/addons/mux/signing-keys/${dataset}/${signingKeyId}`,
384
+ withCredentials: true,
385
+ method: "GET"
386
+ });
387
+ //
388
+ // if this signing key is valid it will return { data: { id: 'xxxx' } }
389
+ //
390
+ return !!(res.data && res.data.id);
391
+ } catch (e) {
392
+ console.error("Error fetching signingKeyId", signingKeyId, "assuming it is not valid");
393
+ return false;
394
+ }
395
+ }
396
+ function $4d6664636d7d58e3$export$7d1f83854429bc73(client) {
397
+ const { dataset: dataset } = client.config();
398
+ return (0, $ayBmS$rxjs.defer)(()=>client.observable.request({
399
+ url: `/addons/mux/secrets/${dataset}/test`,
400
+ withCredentials: true,
401
+ method: "GET"
402
+ }));
403
+ }
404
+
405
+
406
+ function $12591da830e5242f$export$5130fb4c263997a4(client, uuid) {
407
+ return client.observable.request({
408
+ url: `/addons/mux/uploads/${client.clientConfig.dataset}/${uuid}`,
409
+ withCredentials: true,
410
+ method: "DELETE"
411
+ });
412
+ }
413
+ function $12591da830e5242f$export$f35af194eb27b25f(config, client, url, options = {}) {
414
+ return $12591da830e5242f$var$testUrl(url).pipe((0, $ayBmS$rxjsoperators.switchMap)((validUrl)=>{
415
+ return (0, $ayBmS$rxjs.concat)((0, $ayBmS$rxjs.of)({
416
+ type: "url",
417
+ url: validUrl
418
+ }), (0, $4d6664636d7d58e3$export$7d1f83854429bc73)(client).pipe((0, $ayBmS$rxjsoperators.switchMap)((json)=>{
419
+ if (!json || !json.status) return (0, $ayBmS$rxjs.throwError)(new Error("Invalid credentials"));
420
+ const uuid = (0, $ayBmS$sanityuuid.uuid)();
421
+ const { enableSignedUrls: enableSignedUrls } = options;
422
+ const muxBody = {
423
+ input: validUrl,
424
+ playback_policy: [
425
+ enableSignedUrls ? "signed" : "public"
426
+ ],
427
+ mp4_support: config.mp4_support
428
+ };
429
+ const query = {
430
+ muxBody: JSON.stringify(muxBody),
431
+ filename: validUrl.split("/").slice(-1)[0]
432
+ };
433
+ const dataset = client.clientConfig.dataset;
434
+ return (0, $ayBmS$rxjs.defer)(()=>client.observable.request({
435
+ url: `/addons/mux/assets/${dataset}`,
436
+ withCredentials: true,
437
+ method: "POST",
438
+ headers: {
439
+ "MUX-Proxy-UUID": uuid,
440
+ "Content-Type": "application/json"
441
+ },
442
+ query: query
443
+ })).pipe((0, $ayBmS$rxjsoperators.mergeMap)((result)=>{
444
+ const asset = result && result.results && result.results[0] && result.results[0].document || null;
445
+ if (!asset) return (0, $ayBmS$rxjs.throwError)(new Error("No asset document returned"));
446
+ return (0, $ayBmS$rxjs.of)({
447
+ type: "success",
448
+ id: uuid,
449
+ asset: asset
450
+ });
451
+ }));
452
+ })));
453
+ }));
454
+ }
455
+ function $12591da830e5242f$export$a5575dbeeffdad98(config, client, file, options = {}) {
456
+ return $12591da830e5242f$var$testFile(file).pipe((0, $ayBmS$rxjsoperators.switchMap)((fileOptions)=>{
457
+ return (0, $ayBmS$rxjs.concat)((0, $ayBmS$rxjs.of)({
458
+ type: "file",
459
+ file: fileOptions
460
+ }), (0, $4d6664636d7d58e3$export$7d1f83854429bc73)(client).pipe((0, $ayBmS$rxjsoperators.switchMap)((json)=>{
461
+ if (!json || !json.status) return (0, $ayBmS$rxjs.throwError)(new Error("Invalid credentials"));
462
+ const uuid = (0, $ayBmS$sanityuuid.uuid)();
463
+ const { enableSignedUrls: enableSignedUrls } = options;
464
+ const body = {
465
+ mp4_support: config.mp4_support,
466
+ playback_policy: [
467
+ enableSignedUrls ? "signed" : "public"
468
+ ]
469
+ };
470
+ return (0, $ayBmS$rxjs.concat)((0, $ayBmS$rxjs.of)({
471
+ type: "uuid",
472
+ uuid: uuid
473
+ }), (0, $ayBmS$rxjs.defer)(()=>client.observable.request({
474
+ url: `/addons/mux/uploads/${client.clientConfig.dataset}`,
475
+ withCredentials: true,
476
+ method: "POST",
477
+ headers: {
478
+ "MUX-Proxy-UUID": uuid,
479
+ "Content-Type": "application/json"
480
+ },
481
+ body: body
482
+ })).pipe((0, $ayBmS$rxjsoperators.mergeMap)((result)=>{
483
+ return (0, $769e09a03b9726c9$export$ad6eab20b4b3876f)(uuid, result.upload.url, file).pipe(// eslint-disable-next-line no-warning-comments
484
+ // @TODO type the observable events
485
+ // eslint-disable-next-line max-nested-callbacks
486
+ (0, $ayBmS$rxjsoperators.mergeMap)((event)=>{
487
+ if (event.type !== "success") return (0, $ayBmS$rxjs.of)(event);
488
+ return (0, $ayBmS$rxjs.from)($12591da830e5242f$var$updateAssetDocumentFromUpload(client, uuid)).pipe(// eslint-disable-next-line max-nested-callbacks
489
+ (0, $ayBmS$rxjsoperators.mergeMap)((doc)=>(0, $ayBmS$rxjs.of)((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, event), {
490
+ asset: doc
491
+ }))));
492
+ }), // eslint-disable-next-line max-nested-callbacks
493
+ (0, $ayBmS$rxjsoperators.catchError)((err)=>{
494
+ // Delete asset document
495
+ return $12591da830e5242f$export$5130fb4c263997a4(client, uuid).pipe((0, $ayBmS$rxjsoperators.mergeMapTo)((0, $ayBmS$rxjs.throwError)(err)));
496
+ }));
497
+ })));
498
+ })));
499
+ }));
500
+ }
501
+ function $12591da830e5242f$export$38276c014c550f86(client, assetId) {
502
+ const { dataset: dataset } = client.config();
503
+ return client.request({
504
+ url: `/addons/mux/uploads/${dataset}/${assetId}`,
505
+ withCredentials: true,
506
+ method: "GET"
507
+ });
508
+ }
509
+ function $12591da830e5242f$var$pollUpload(client, uuid) {
510
+ const maxTries = 10;
511
+ let pollInterval;
512
+ let tries = 0;
513
+ let assetId;
514
+ let upload;
515
+ return new Promise((resolve, reject)=>{
516
+ pollInterval = setInterval(async ()=>{
517
+ try {
518
+ upload = await $12591da830e5242f$export$38276c014c550f86(client, uuid);
519
+ } catch (err) {
520
+ reject(err);
521
+ return;
522
+ }
523
+ assetId = upload && upload.data && upload.data.asset_id;
524
+ if (assetId) {
525
+ clearInterval(pollInterval);
526
+ resolve(upload);
527
+ }
528
+ if (tries > maxTries) {
529
+ clearInterval(pollInterval);
530
+ reject(new Error("Upload did not finish"));
531
+ }
532
+ tries++;
533
+ }, 2000);
534
+ });
535
+ }
536
+ async function $12591da830e5242f$var$updateAssetDocumentFromUpload(client, uuid) {
537
+ let upload;
538
+ let asset;
539
+ try {
540
+ upload = await $12591da830e5242f$var$pollUpload(client, uuid);
541
+ } catch (err) {
542
+ return Promise.reject(err);
543
+ }
544
+ try {
545
+ asset = await (0, $85b2a8cdf745d7d3$export$da446a5ee2572b7)(client, upload.data.asset_id);
546
+ } catch (err1) {
547
+ return Promise.reject(err1);
548
+ }
549
+ const doc = {
550
+ _id: uuid,
551
+ _type: "mux.videoAsset",
552
+ status: asset.data.status,
553
+ data: asset.data,
554
+ assetId: asset.data.id,
555
+ playbackId: asset.data.playback_ids[0].id,
556
+ uploadId: upload.data.id
557
+ };
558
+ return client.createOrReplace(doc).then(()=>{
559
+ return doc;
560
+ });
561
+ }
562
+ function $12591da830e5242f$var$testFile(file) {
563
+ if (typeof window !== "undefined" && file instanceof window.File) {
564
+ const fileOptions = $12591da830e5242f$var$optionsFromFile({}, file);
565
+ return (0, $ayBmS$rxjs.of)(fileOptions);
566
+ }
567
+ return (0, $ayBmS$rxjs.throwError)(new Error("Invalid file"));
568
+ }
569
+ function $12591da830e5242f$var$testUrl(url) {
570
+ const error = new Error("Invalid URL");
571
+ if (typeof url !== "string") return (0, $ayBmS$rxjs.throwError)(error);
572
+ let parsed;
573
+ try {
574
+ parsed = new URL(url);
575
+ } catch (err) {
576
+ return (0, $ayBmS$rxjs.throwError)(error);
577
+ }
578
+ if (parsed && !parsed.protocol.match(/http:|https:/)) return (0, $ayBmS$rxjs.throwError)(error);
579
+ return (0, $ayBmS$rxjs.of)(url);
580
+ }
581
+ function $12591da830e5242f$var$optionsFromFile(opts, file) {
582
+ if (typeof window === "undefined" || !(file instanceof window.File)) return opts;
583
+ return {
584
+ name: opts.preserveFilename === false ? undefined : file.name,
585
+ type: file.type
586
+ };
587
+ }
588
+
589
+
590
+ function $f981bc359ea69985$export$73f6d6d8d794f645(dataTransfer) {
591
+ const files = Array.from(dataTransfer.files || []);
592
+ const items = Array.from(dataTransfer.items || []);
593
+ if (files && files.length > 0) return Promise.resolve(files);
594
+ return $f981bc359ea69985$var$normalizeItems(items).then((arr)=>arr.flat());
595
+ }
596
+ function $f981bc359ea69985$var$normalizeItems(items) {
597
+ return Promise.all(items.map((item)=>{
598
+ // directory
599
+ if (item.kind === "file" && item.webkitGetAsEntry) {
600
+ let entry;
601
+ // Edge throws
602
+ try {
603
+ entry = item.webkitGetAsEntry();
604
+ } catch (err) {
605
+ return [
606
+ item.getAsFile()
607
+ ];
608
+ }
609
+ if (!entry) return [];
610
+ return entry.isDirectory ? $f981bc359ea69985$var$walk(entry) : [
611
+ item.getAsFile()
612
+ ];
613
+ }
614
+ // file
615
+ if (item.kind === "file") {
616
+ const file = item.getAsFile();
617
+ return Promise.resolve(file ? [
618
+ file
619
+ ] : []);
620
+ }
621
+ // others
622
+ return new Promise((resolve)=>item.getAsString(resolve)).then((str)=>str ? [
623
+ new File([
624
+ str
625
+ ], "unknown.txt", {
626
+ type: item.type
627
+ })
628
+ ] : []);
629
+ }));
630
+ }
631
+ function $f981bc359ea69985$var$isFile(entry) {
632
+ return entry.isFile;
633
+ }
634
+ function $f981bc359ea69985$var$isDirectory(entry) {
635
+ return entry.isDirectory;
636
+ }
637
+ function $f981bc359ea69985$var$walk(entry) {
638
+ if ($f981bc359ea69985$var$isFile(entry)) return new Promise((resolve)=>entry.file(resolve)).then((file)=>[
639
+ file
640
+ ]);
641
+ if ($f981bc359ea69985$var$isDirectory(entry)) {
642
+ const dir = entry.createReader();
643
+ return new Promise((resolve)=>dir.readEntries(resolve)).then((entries)=>entries.filter((entr)=>!entr.name.startsWith("."))).then((entries)=>Promise.all(entries.map($f981bc359ea69985$var$walk)).then((arr)=>arr.flat()));
644
+ }
645
+ return Promise.resolve([]);
646
+ }
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+ const $ca60bbd6b265fe38$export$9c7ae676ac45430a = "secrets.mux";
681
+ function $ca60bbd6b265fe38$export$e6f48a1ef9de02f7(client) {
682
+ const { projectId: projectId , dataset: dataset } = client.config();
683
+ return (0, $ayBmS$suspendreact.suspend)(async ()=>{
684
+ const data = await client.fetch(/* groq */ `*[_id == $_id][0]{
685
+ token,
686
+ secretKey,
687
+ enableSignedUrls,
688
+ signingKeyId,
689
+ signingKeyPrivate
690
+ }`, {
691
+ _id: $ca60bbd6b265fe38$export$9c7ae676ac45430a
692
+ });
693
+ return {
694
+ token: (data === null || data === void 0 ? void 0 : data.token) || null,
695
+ secretKey: (data === null || data === void 0 ? void 0 : data.secretKey) || null,
696
+ enableSignedUrls: Boolean(data === null || data === void 0 ? void 0 : data.enableSignedUrls) || false,
697
+ signingKeyId: (data === null || data === void 0 ? void 0 : data.signingKeyId) || null,
698
+ signingKeyPrivate: (data === null || data === void 0 ? void 0 : data.signingKeyPrivate) || null
699
+ };
700
+ }, [
701
+ (0, $764163079c542eaf$export$13cdb654d47e0703),
702
+ $ca60bbd6b265fe38$export$9c7ae676ac45430a,
703
+ projectId,
704
+ dataset
705
+ ]);
706
+ }
707
+
708
+
709
+ function $66cd6455bd010559$export$87b96baf1080652a(client, playbackId, aud, payload) {
710
+ const { signingKeyId: signingKeyId , signingKeyPrivate: signingKeyPrivate } = (0, $ca60bbd6b265fe38$export$e6f48a1ef9de02f7)(client);
711
+ if (!signingKeyId) throw new TypeError("Missing signingKeyId");
712
+ if (!signingKeyPrivate) throw new TypeError("Missing signingKeyPrivate");
713
+ /*
714
+ const {sign}: {sign: typeof import('jsonwebtoken-esm/sign')['default']} = suspend(async () => {
715
+ // eslint-disable-next-line @typescript-eslint/no-shadow
716
+ const {default: sign} = await import('jsonwebtoken-esm/sign')
717
+ // eslint-disable-next-line @typescript-eslint/no-shadow
718
+ return {sign: (payload: any, secret: any, options: any) => sign(payload, secret, options)}
719
+ }, ['sanity-plugin-mux-input', 'jsonwebtoken-esm/sign'])
720
+ // */ return (0, $ayBmS$jsonwebtokenesm.sign)(payload ? JSON.parse(JSON.stringify(payload, (_, v)=>v !== null && v !== void 0 ? v : undefined)) : {}, atob(signingKeyPrivate), {
721
+ algorithm: "RS256",
722
+ keyid: signingKeyId,
723
+ audience: aud,
724
+ subject: playbackId,
725
+ noTimestamp: true,
726
+ expiresIn: "12h"
727
+ });
728
+ }
729
+
730
+
731
+ function $95c7e77a8fa5d84c$export$bdfa34d24bb44333(asset) {
732
+ if (!(asset === null || asset === void 0 ? void 0 : asset.playbackId)) {
733
+ console.error("Asset is missing a playbackId", {
734
+ asset: asset
735
+ });
736
+ throw new TypeError(`Missing playbackId`);
737
+ }
738
+ return asset.playbackId;
739
+ }
740
+
741
+
742
+ function $b22c582d9b0c45c1$export$f7d2546fac75bbd(asset) {
743
+ var ref, ref1, ref2;
744
+ var ref3;
745
+ return (ref3 = (ref = asset.data) === null || ref === void 0 ? void 0 : (ref1 = ref.playback_ids) === null || ref1 === void 0 ? void 0 : (ref2 = ref1[0]) === null || ref2 === void 0 ? void 0 : ref2.policy) !== null && ref3 !== void 0 ? ref3 : "public";
746
+ }
747
+
748
+
749
+ function $7c5f49510d59d596$export$6adb108e2a577699({ asset: asset , client: client , height: height , width: width , start: start = asset.thumbTime ? Math.max(0, asset.thumbTime - 2.5) : 0 , end: end = start + 5 , fps: fps = 15 }) {
750
+ const params = {
751
+ height: height,
752
+ width: width,
753
+ start: start,
754
+ end: end,
755
+ fps: fps
756
+ };
757
+ const playbackId = (0, $95c7e77a8fa5d84c$export$bdfa34d24bb44333)(asset);
758
+ let searchParams = new URLSearchParams(JSON.parse(JSON.stringify(params, (_, v)=>v !== null && v !== void 0 ? v : undefined)));
759
+ if ((0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed") {
760
+ const token = (0, $66cd6455bd010559$export$87b96baf1080652a)(client, playbackId, "g", params);
761
+ searchParams = new URLSearchParams({
762
+ token: token
763
+ });
764
+ }
765
+ return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`;
766
+ }
767
+
768
+
769
+
770
+
771
+
772
+
773
+ function $f2ccfb00ca22d3aa$export$8081e7a11b9f1345({ asset: asset , client: client , fit_mode: fit_mode , height: height , time: time = asset.thumbTime , width: width }) {
774
+ const params = {
775
+ fit_mode: fit_mode,
776
+ height: height,
777
+ time: time,
778
+ width: width
779
+ };
780
+ const playbackId = (0, $95c7e77a8fa5d84c$export$bdfa34d24bb44333)(asset);
781
+ let searchParams = new URLSearchParams(JSON.parse(JSON.stringify(params, (_, v)=>v !== null && v !== void 0 ? v : undefined)));
782
+ if ((0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed") {
783
+ const token = (0, $66cd6455bd010559$export$87b96baf1080652a)(client, playbackId, "t", params);
784
+ searchParams = new URLSearchParams({
785
+ token: token
786
+ });
787
+ }
788
+ return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`;
789
+ }
790
+
791
+
792
+ let $b4359f9e5317addd$var$_ = (t5)=>t5, $b4359f9e5317addd$var$t, $b4359f9e5317addd$var$t1, $b4359f9e5317addd$var$t2, $b4359f9e5317addd$var$t3, $b4359f9e5317addd$var$t4;
793
+ const $b4359f9e5317addd$var$mediaDimensions = {
794
+ aspect: 16 / 9
795
+ };
796
+ const $b4359f9e5317addd$var$ImageLoader = /*#__PURE__*/ (0, $ayBmS$react.memo)(function ImageLoader({ alt: alt , src: src , height: height , width: width , aspectRatio: aspectRatio }) {
797
+ (0, $ayBmS$suspendreact.suspend)(async ()=>{
798
+ const img = new Image(width, height);
799
+ img.decoding = "async";
800
+ img.src = src;
801
+ await img.decode();
802
+ }, [
803
+ "sanity-plugin-mux-input",
804
+ "image",
805
+ src
806
+ ]);
807
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("img", {
808
+ alt: alt,
809
+ src: src,
810
+ height: height,
811
+ width: width,
812
+ style: {
813
+ aspectRatio: aspectRatio
814
+ }
815
+ });
816
+ });
817
+ const $b4359f9e5317addd$var$VideoMediaPreview = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanity_unstable.MediaPreview))($b4359f9e5317addd$var$t || ($b4359f9e5317addd$var$t = $b4359f9e5317addd$var$_`
818
+ img {
819
+ object-fit: cover;
820
+ }
821
+ `));
822
+ const $b4359f9e5317addd$var$VideoMediaPreviewSignedSubtitle = ({ solo: solo })=>{
823
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
824
+ space: 1,
825
+ style: {
826
+ marginTop: solo ? "-1.35em" : undefined,
827
+ marginBottom: solo ? undefined : "0.35rem"
828
+ },
829
+ children: [
830
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityicons.LockIcon), {}),
831
+ "Signed playback policy"
832
+ ]
833
+ });
834
+ };
835
+ const $b4359f9e5317addd$var$PosterImage = ({ asset: asset , height: height , width: width , showTip: showTip })=>{
836
+ const client = (0, $ayBmS$sanity.useClient)();
837
+ const src = (0, $f2ccfb00ca22d3aa$export$8081e7a11b9f1345)({
838
+ asset: asset,
839
+ client: client,
840
+ height: height,
841
+ width: width,
842
+ fit_mode: "smartcrop"
843
+ });
844
+ const subtitle = (0, $ayBmS$react.useMemo)(()=>showTip && (0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed" ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreviewSignedSubtitle, {
845
+ solo: true
846
+ }) : undefined, [
847
+ asset,
848
+ showTip
849
+ ]);
850
+ // eslint-disable-next-line no-warning-comments
851
+ // @TODO support setting the alt text in the schema, like how we deal with images
852
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreview, {
853
+ mediaDimensions: $b4359f9e5317addd$var$mediaDimensions,
854
+ subtitle: subtitle,
855
+ title: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$reactjsxruntime.Fragment), {
856
+ children: null
857
+ }),
858
+ media: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$ImageLoader, {
859
+ alt: "",
860
+ src: src,
861
+ height: height,
862
+ width: width
863
+ })
864
+ });
865
+ };
866
+ const $b4359f9e5317addd$export$bd4b73f15688a160 = /*#__PURE__*/ (0, $ayBmS$react.memo)(function VideoThumbnail({ asset: asset , width: width , showTip: showTip }) {
867
+ const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error } = (0, $ayBmS$useerrorboundary.useErrorBoundary)();
868
+ const height = Math.round(width * 9 / 16);
869
+ const subtitle = (0, $ayBmS$react.useMemo)(()=>showTip && (0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed" ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreviewSignedSubtitle, {}) : undefined, [
870
+ showTip,
871
+ asset
872
+ ]);
873
+ if (didCatch) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreview, {
874
+ subtitle: error.message,
875
+ mediaDimensions: $b4359f9e5317addd$var$mediaDimensions,
876
+ title: "Error when loading thumbnail",
877
+ media: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
878
+ radius: 2,
879
+ height: "fill",
880
+ style: {
881
+ position: "relative",
882
+ width: "100%"
883
+ },
884
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
885
+ style: {
886
+ display: "flex",
887
+ justifyContent: "center",
888
+ alignItems: "center",
889
+ position: "absolute",
890
+ top: 0,
891
+ left: 0,
892
+ right: 0,
893
+ bottom: 0
894
+ },
895
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityicons.UnknownIcon), {})
896
+ })
897
+ })
898
+ });
899
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)(ErrorBoundary, {
900
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$react.Suspense), {
901
+ fallback: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreview, {
902
+ isPlaceholder: true,
903
+ title: "Loading thumbnail...",
904
+ subtitle: subtitle,
905
+ mediaDimensions: $b4359f9e5317addd$var$mediaDimensions
906
+ }),
907
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$PosterImage, {
908
+ showTip: showTip,
909
+ asset: asset,
910
+ height: height,
911
+ width: width
912
+ })
913
+ })
914
+ });
915
+ });
916
+ const $b4359f9e5317addd$var$AnimatedVideoMediaPreview = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanity_unstable.MediaPreview))($b4359f9e5317addd$var$t1 || ($b4359f9e5317addd$var$t1 = $b4359f9e5317addd$var$_`
917
+ img {
918
+ object-fit: contain;
919
+ }
920
+ `));
921
+ const $b4359f9e5317addd$var$AnimatedPosterImage = ({ asset: asset , width: width })=>{
922
+ const client = (0, $ayBmS$sanity.useClient)();
923
+ const src = (0, $7c5f49510d59d596$export$6adb108e2a577699)({
924
+ asset: asset,
925
+ client: client,
926
+ width: width
927
+ });
928
+ // eslint-disable-next-line no-warning-comments
929
+ // @TODO support setting the alt text in the schema, like how we deal with images
930
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$AnimatedVideoMediaPreview, {
931
+ withBorder: false,
932
+ mediaDimensions: $b4359f9e5317addd$var$mediaDimensions,
933
+ media: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$ImageLoader, {
934
+ alt: "",
935
+ src: src,
936
+ width: width,
937
+ aspectRatio: "16:9"
938
+ })
939
+ });
940
+ };
941
+ const $b4359f9e5317addd$export$357b57aa2db6117e = /*#__PURE__*/ (0, $ayBmS$react.memo)(function AnimatedVideoThumbnail({ asset: asset , width: width }) {
942
+ const { ErrorBoundary: ErrorBoundary , didCatch: didCatch } = (0, $ayBmS$useerrorboundary.useErrorBoundary)();
943
+ if (didCatch) return null;
944
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)(ErrorBoundary, {
945
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$react.Suspense), {
946
+ fallback: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$FancyBackdrop, {
947
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$VideoMediaPreview, {
948
+ mediaDimensions: $b4359f9e5317addd$var$mediaDimensions,
949
+ withBorder: false,
950
+ media: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Spinner), {
951
+ muted: true
952
+ })
953
+ })
954
+ }),
955
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
956
+ height: "fill",
957
+ tone: "transparent",
958
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($b4359f9e5317addd$var$AnimatedPosterImage, {
959
+ asset: asset,
960
+ width: width
961
+ })
962
+ })
963
+ })
964
+ });
965
+ });
966
+ const $b4359f9e5317addd$var$FancyBackdrop = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Box))($b4359f9e5317addd$var$t2 || ($b4359f9e5317addd$var$t2 = $b4359f9e5317addd$var$_`
967
+ backdrop-filter: blur(8px) brightness(0.5) saturate(2);
968
+ mix-blend-mode: color-dodge;
969
+ `));
970
+ const $b4359f9e5317addd$export$e20c438ffc62921 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Grid))($b4359f9e5317addd$var$t3 || ($b4359f9e5317addd$var$t3 = $b4359f9e5317addd$var$_`
971
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
972
+ `));
973
+ const $b4359f9e5317addd$export$7431cee690d58bc9 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($b4359f9e5317addd$var$t4 || ($b4359f9e5317addd$var$t4 = $b4359f9e5317addd$var$_`
974
+ border-top: 1px solid var(--card-border-color);
975
+ position: sticky;
976
+ bottom: 0;
977
+ z-index: 200;
978
+ `));
979
+
980
+
981
+ let $7a82b2aa05cc8aca$var$_ = (t2)=>t2, $7a82b2aa05cc8aca$var$t, $7a82b2aa05cc8aca$var$t1;
982
+ function $7a82b2aa05cc8aca$var$AssetActionsMenu(props) {
983
+ const { asset: asset } = props;
984
+ const id = (0, $ayBmS$reachautoid.useId)();
985
+ const [dialogState, setDialogState] = (0, $ayBmS$react.useState)();
986
+ const [open, setOpen] = (0, $ayBmS$react.useState)(false);
987
+ const [menuElement, setMenuRef] = (0, $ayBmS$react.useState)(null);
988
+ const handleDelete = (0, $ayBmS$react.useCallback)(()=>setDialogState("confirm-delete"), []);
989
+ const handleClick = (0, $ayBmS$react.useCallback)(()=>{
990
+ setDialogState(false);
991
+ setOpen(true);
992
+ }, [
993
+ setDialogState
994
+ ]);
995
+ const handleClose = (0, $ayBmS$react.useCallback)(()=>{
996
+ setDialogState(false);
997
+ setOpen(false);
998
+ }, [
999
+ setDialogState
1000
+ ]);
1001
+ (0, $ayBmS$react.useEffect)(()=>{
1002
+ if (open && dialogState) setOpen(false);
1003
+ }, [
1004
+ dialogState,
1005
+ open
1006
+ ]);
1007
+ (0, $ayBmS$sanityui.useClickOutside)((0, $ayBmS$react.useCallback)(()=>setOpen(false), []), [
1008
+ menuElement
1009
+ ]);
1010
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
1011
+ children: [
1012
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuButton), {
1013
+ id: `${id}-asset-menu`,
1014
+ button: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1015
+ icon: (0, $ayBmS$sanityicons.EllipsisVerticalIcon),
1016
+ mode: "ghost",
1017
+ onClick: handleClick,
1018
+ padding: 2
1019
+ }),
1020
+ menu: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Menu), {
1021
+ ref: setMenuRef,
1022
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuItem), {
1023
+ tone: "critical",
1024
+ icon: (0, $ayBmS$sanityicons.TrashIcon),
1025
+ text: "Delete",
1026
+ onClick: handleDelete
1027
+ })
1028
+ }),
1029
+ portal: true,
1030
+ placement: "right"
1031
+ }),
1032
+ dialogState === "confirm-delete" && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7a82b2aa05cc8aca$var$DeleteDialog, {
1033
+ asset: asset,
1034
+ onClose: handleClose
1035
+ })
1036
+ ]
1037
+ });
1038
+ }
1039
+ function $7a82b2aa05cc8aca$var$DeleteDialog(props) {
1040
+ const { asset: asset , onClose: onClose } = props;
1041
+ const client = (0, $ayBmS$sanity.useClient)();
1042
+ const { push: pushToast } = (0, $ayBmS$sanityui.useToast)();
1043
+ const [deleting, setDeleting] = (0, $ayBmS$react.useState)(false);
1044
+ const [deleteOnMux, setDeleteOnMux] = (0, $ayBmS$react.useState)(false);
1045
+ const id = (0, $ayBmS$reachautoid.useId)();
1046
+ const noPaddingOnStack = true;
1047
+ const width = 200 * (0, $ayBmS$usedevicepixelratio.getDevicePixelRatio)({
1048
+ maxDpr: 2
1049
+ });
1050
+ const handleDelete = (0, $ayBmS$react.useCallback)(async ()=>{
1051
+ setDeleting(true);
1052
+ try {
1053
+ var ref, ref1, ref2;
1054
+ if (asset === null || asset === void 0 ? void 0 : asset._id) await client.delete(asset._id);
1055
+ if (deleteOnMux && (asset === null || asset === void 0 ? void 0 : asset.assetId)) await (0, $85b2a8cdf745d7d3$export$df987b50509121ea)(client, asset.assetId);
1056
+ (ref = document.querySelector(`[data-id="${asset._id}"]`)) === null || ref === void 0 ? void 0 : (ref1 = ref.parentElement) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.setAttribute) === null || ref2 === void 0 ? void 0 : ref2.call(ref1, "hidden", "true");
1057
+ } catch (err) {
1058
+ console.error("Failed during delete", err);
1059
+ pushToast({
1060
+ closable: true,
1061
+ description: err.message,
1062
+ duration: 5000,
1063
+ title: "Uncaught error",
1064
+ status: "error"
1065
+ });
1066
+ } finally{
1067
+ setDeleting(false);
1068
+ onClose();
1069
+ }
1070
+ }, [
1071
+ asset._id,
1072
+ asset.assetId,
1073
+ client,
1074
+ deleteOnMux,
1075
+ onClose,
1076
+ pushToast
1077
+ ]);
1078
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Dialog), {
1079
+ onClose: onClose,
1080
+ id: `${id}-confirm-delete`,
1081
+ header: "Delete video",
1082
+ footer: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Grid), {
1083
+ padding: 2,
1084
+ gap: 2,
1085
+ columns: 2,
1086
+ children: [
1087
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1088
+ mode: "bleed",
1089
+ text: "Cancel",
1090
+ onClick: onClose
1091
+ }),
1092
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1093
+ text: "Delete",
1094
+ tone: "critical",
1095
+ icon: (0, $ayBmS$sanityicons.TrashIcon),
1096
+ onClick: handleDelete,
1097
+ loading: deleting
1098
+ })
1099
+ ]
1100
+ }),
1101
+ // __unstable_autoFocus
1102
+ width: 1,
1103
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Stack), {
1104
+ paddingX: noPaddingOnStack ? 0 : [
1105
+ 2,
1106
+ 3,
1107
+ 4
1108
+ ],
1109
+ paddingY: noPaddingOnStack ? 0 : [
1110
+ 3,
1111
+ 3,
1112
+ 3,
1113
+ 4
1114
+ ],
1115
+ space: 1,
1116
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
1117
+ paddingX: [
1118
+ 2,
1119
+ 3,
1120
+ 4
1121
+ ],
1122
+ paddingY: [
1123
+ 3,
1124
+ 3,
1125
+ 3,
1126
+ 4
1127
+ ],
1128
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Grid), {
1129
+ columns: 3,
1130
+ gap: 3,
1131
+ children: [
1132
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
1133
+ style: {
1134
+ gridColumn: "span 2"
1135
+ },
1136
+ align: "center",
1137
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
1138
+ padding: 4,
1139
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
1140
+ space: 4,
1141
+ children: [
1142
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
1143
+ align: "center",
1144
+ as: "label",
1145
+ children: [
1146
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Checkbox), {
1147
+ checked: deleteOnMux,
1148
+ onChange: ()=>setDeleteOnMux((prev)=>!prev)
1149
+ }),
1150
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1151
+ style: {
1152
+ margin: "0 10px"
1153
+ },
1154
+ children: "Delete asset on Mux"
1155
+ })
1156
+ ]
1157
+ }),
1158
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
1159
+ align: "center",
1160
+ as: "label",
1161
+ children: [
1162
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Checkbox), {
1163
+ disabled: true,
1164
+ checked: true
1165
+ }),
1166
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1167
+ style: {
1168
+ margin: "0 10px"
1169
+ },
1170
+ children: "Delete video from dataset"
1171
+ })
1172
+ ]
1173
+ })
1174
+ ]
1175
+ })
1176
+ })
1177
+ }),
1178
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$bd4b73f15688a160), {
1179
+ asset: asset,
1180
+ width: width,
1181
+ showTip: true
1182
+ })
1183
+ ]
1184
+ })
1185
+ })
1186
+ })
1187
+ });
1188
+ }
1189
+ function $7a82b2aa05cc8aca$export$2e2bcd8739ae039({ assets: assets , isLoading: isLoading , isLastPage: isLastPage , onSelect: onSelect , onLoadMore: onLoadMore }) {
1190
+ const handleClick = (0, $ayBmS$react.useCallback)((event)=>onSelect(event.currentTarget.dataset.id), [
1191
+ onSelect
1192
+ ]);
1193
+ const handleKeyPress = (0, $ayBmS$react.useCallback)((event)=>{
1194
+ if (event.key === "Enter") onSelect(event.currentTarget.dataset.id);
1195
+ }, [
1196
+ onSelect
1197
+ ]);
1198
+ const width = 200 * (0, $ayBmS$usedevicepixelratio.getDevicePixelRatio)({
1199
+ maxDpr: 2
1200
+ });
1201
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
1202
+ children: [
1203
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Box), {
1204
+ padding: 4,
1205
+ children: [
1206
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$e20c438ffc62921), {
1207
+ gap: 2,
1208
+ children: assets.map((asset)=>/*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7a82b2aa05cc8aca$var$VideoSourceItem, {
1209
+ asset: asset,
1210
+ onClick: handleClick,
1211
+ onKeyPress: handleKeyPress,
1212
+ width: width
1213
+ }, asset._id))
1214
+ }),
1215
+ isLoading && assets.length === 0 && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
1216
+ justify: "center",
1217
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Spinner), {
1218
+ muted: true
1219
+ })
1220
+ }),
1221
+ !isLoading && assets.length === 0 && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1222
+ align: "center",
1223
+ muted: true,
1224
+ children: "No videos"
1225
+ })
1226
+ ]
1227
+ }),
1228
+ assets.length > 0 && !isLastPage && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$7431cee690d58bc9), {
1229
+ tone: "default",
1230
+ padding: 4,
1231
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
1232
+ direction: "column",
1233
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1234
+ type: "button",
1235
+ icon: (0, $ayBmS$sanityicons.DownloadIcon),
1236
+ loading: isLoading,
1237
+ onClick: onLoadMore,
1238
+ text: "Load more",
1239
+ tone: "primary"
1240
+ })
1241
+ })
1242
+ })
1243
+ ]
1244
+ });
1245
+ }
1246
+ const $7a82b2aa05cc8aca$var$_VideoSourceItem = ({ asset: asset , onClick: onClick , onKeyPress: onKeyPress , width: width })=>{
1247
+ const [hover, setHover] = (0, $ayBmS$react.useState)(null);
1248
+ const ref = (0, $ayBmS$react.useRef)(null);
1249
+ (0, $ayBmS$react.useLayoutEffect)(()=>{
1250
+ if (!ref.current || hover === null) return;
1251
+ if (hover) (0, $ayBmS$motion.animate)(ref.current, {
1252
+ opacity: 1
1253
+ });
1254
+ else (0, $ayBmS$motion.animate)(ref.current, {
1255
+ opacity: 0
1256
+ });
1257
+ }, [
1258
+ hover
1259
+ ]);
1260
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Box), {
1261
+ height: "fill",
1262
+ style: {
1263
+ position: "relative"
1264
+ },
1265
+ children: [
1266
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Card), {
1267
+ as: "button",
1268
+ "data-id": asset._id,
1269
+ onClick: onClick,
1270
+ onKeyPress: onKeyPress,
1271
+ tabIndex: 0,
1272
+ radius: 2,
1273
+ padding: 1,
1274
+ style: {
1275
+ lineHeight: 0,
1276
+ position: "relative"
1277
+ },
1278
+ __unstable_focusRing: true,
1279
+ onMouseEnter: ()=>setHover(true),
1280
+ onMouseLeave: ()=>setHover(false),
1281
+ children: [
1282
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$bd4b73f15688a160), {
1283
+ asset: asset,
1284
+ width: width,
1285
+ showTip: true
1286
+ }),
1287
+ (asset === null || asset === void 0 ? void 0 : asset.playbackId) && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7a82b2aa05cc8aca$var$AnimateWrapper, {
1288
+ tone: "transparent",
1289
+ ref: ref,
1290
+ margin: 1,
1291
+ radius: 1,
1292
+ children: hover !== null && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$357b57aa2db6117e), {
1293
+ asset: asset,
1294
+ width: width
1295
+ })
1296
+ })
1297
+ ]
1298
+ }),
1299
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7a82b2aa05cc8aca$var$ActionsAssetsContainer, {
1300
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7a82b2aa05cc8aca$var$AssetActionsMenu, {
1301
+ asset: asset
1302
+ })
1303
+ })
1304
+ ]
1305
+ });
1306
+ };
1307
+ const $7a82b2aa05cc8aca$var$VideoSourceItem = /*#__PURE__*/ (0, $ayBmS$react.memo)($7a82b2aa05cc8aca$var$_VideoSourceItem);
1308
+ const $7a82b2aa05cc8aca$var$AnimateWrapper = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($7a82b2aa05cc8aca$var$t || ($7a82b2aa05cc8aca$var$t = $7a82b2aa05cc8aca$var$_`
1309
+ position: absolute;
1310
+ top: 0;
1311
+ left: 0;
1312
+ right: 0;
1313
+ bottom: 0;
1314
+ will-change: opacity;
1315
+ background: transparent;
1316
+ opacity: 0;
1317
+ pointer-events: none;
1318
+ `));
1319
+ const $7a82b2aa05cc8aca$var$ActionsAssetsContainer = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).div($7a82b2aa05cc8aca$var$t1 || ($7a82b2aa05cc8aca$var$t1 = $7a82b2aa05cc8aca$var$_`
1320
+ box-sizing: border-box;
1321
+ position: absolute;
1322
+ z-index: 300;
1323
+ opacity: 0;
1324
+ top: 7px;
1325
+ right: 7px;
1326
+
1327
+ button:hover + &,
1328
+ button:focus-visible + &,
1329
+ &:hover,
1330
+ &:focus-visible {
1331
+ opacity: 1;
1332
+ }
1333
+ `));
1334
+
1335
+
1336
+ const $7011b51a60f6091d$var$PER_PAGE = 20;
1337
+ function $7011b51a60f6091d$var$createQuery(start = 0, end = $7011b51a60f6091d$var$PER_PAGE) {
1338
+ return /* groq */ `*[_type == "mux.videoAsset"] | order(_updatedAt desc) [${start}...${end}]`;
1339
+ }
1340
+ function $7011b51a60f6091d$export$2e2bcd8739ae039({ asset: asset , onChange: onChange , setDialogState: setDialogState }) {
1341
+ const client = (0, $ayBmS$sanity.useClient)();
1342
+ const pageNoRef = (0, $ayBmS$react.useRef)(0);
1343
+ const [isLastPage, setLastPage] = (0, $ayBmS$react.useState)(false);
1344
+ const [isLoading, setLoading] = (0, $ayBmS$react.useState)(false);
1345
+ const [assets, setAssets] = (0, $ayBmS$react.useState)([]);
1346
+ const fetchPage = (0, $ayBmS$react.useCallback)((pageNo)=>{
1347
+ const start = pageNo * $7011b51a60f6091d$var$PER_PAGE;
1348
+ const end = start + $7011b51a60f6091d$var$PER_PAGE;
1349
+ setLoading(true);
1350
+ return client.fetch($7011b51a60f6091d$var$createQuery(start, end)).then((result)=>{
1351
+ setLastPage(result.length < $7011b51a60f6091d$var$PER_PAGE);
1352
+ setAssets((prev)=>prev.concat(result));
1353
+ }).finally(()=>setLoading(false));
1354
+ }, [
1355
+ client
1356
+ ]);
1357
+ const handleSelect = (0, $ayBmS$react.useCallback)((id)=>{
1358
+ const selected = assets.find((doc)=>doc._id === id);
1359
+ if (!selected) throw new TypeError(`Failed to find video asset with id: ${id}`);
1360
+ onChange((0, $ayBmS$sanityform.PatchEvent).from([
1361
+ (0, $ayBmS$sanityform.setIfMissing)({
1362
+ asset: {}
1363
+ }),
1364
+ (0, $ayBmS$sanityform.set)({
1365
+ _type: "reference",
1366
+ _weak: true,
1367
+ _ref: selected._id
1368
+ }, [
1369
+ "asset"
1370
+ ]),
1371
+ ]));
1372
+ setDialogState(false);
1373
+ }, [
1374
+ assets,
1375
+ onChange,
1376
+ setDialogState
1377
+ ]);
1378
+ const handleLoadMore = (0, $ayBmS$react.useCallback)(()=>{
1379
+ fetchPage(++pageNoRef.current);
1380
+ }, [
1381
+ fetchPage
1382
+ ]);
1383
+ (0, $ayBmS$react.useEffect)(()=>void fetchPage(pageNoRef.current), [
1384
+ fetchPage
1385
+ ]);
1386
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $7a82b2aa05cc8aca$export$2e2bcd8739ae039), {
1387
+ onSelect: handleSelect,
1388
+ assets: assets,
1389
+ isLastPage: isLastPage,
1390
+ isLoading: isLoading,
1391
+ onLoadMore: handleLoadMore
1392
+ });
1393
+ }
1394
+
1395
+
1396
+ function $5f35306d1d1944f9$export$2e2bcd8739ae039({ setDialogState: setDialogState , asset: asset , onChange: onChange }) {
1397
+ const id = `InputBrowser${(0, $ayBmS$reachautoid.useId)()}`;
1398
+ const handleClose = (0, $ayBmS$react.useCallback)(()=>setDialogState(false), [
1399
+ setDialogState
1400
+ ]);
1401
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Dialog), {
1402
+ scheme: "dark",
1403
+ __unstable_autoFocus: true,
1404
+ header: "Select video",
1405
+ id: id,
1406
+ onClose: handleClose,
1407
+ width: 2,
1408
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $7011b51a60f6091d$export$2e2bcd8739ae039), {
1409
+ asset: asset,
1410
+ onChange: onChange,
1411
+ setDialogState: setDialogState
1412
+ })
1413
+ });
1414
+ }
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+
1427
+ const $df118f8f4f291a25$export$b07ce35d92a46f4b = (asset, onChange)=>{
1428
+ const client = (0, $ayBmS$sanity.useClient)();
1429
+ return (0, $ayBmS$react.useCallback)(()=>{
1430
+ if (!asset) return;
1431
+ onChange((0, $ayBmS$sanityform.PatchEvent).from((0, $ayBmS$sanityform.unset)()));
1432
+ if (asset.assetId) (0, $85b2a8cdf745d7d3$export$df987b50509121ea)(client, asset.assetId);
1433
+ if (asset._id) client.delete(asset._id);
1434
+ }, [
1435
+ asset,
1436
+ client,
1437
+ onChange
1438
+ ]);
1439
+ };
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+ function $7d093cbbd5ecccea$export$b704b622b4125987({ asset: asset , client: client }) {
1446
+ const playbackId = (0, $95c7e77a8fa5d84c$export$bdfa34d24bb44333)(asset);
1447
+ const searchParams = new URLSearchParams();
1448
+ if ((0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed") {
1449
+ const token = (0, $66cd6455bd010559$export$87b96baf1080652a)(client, playbackId, "v");
1450
+ searchParams.set("token", token);
1451
+ }
1452
+ return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
1453
+ }
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+
1465
+ function $8bba2dccded136a6$export$2e2bcd8739ae039({ asset: asset , getCurrentTime: getCurrentTime , setDialogState: setDialogState }) {
1466
+ const client = (0, $ayBmS$sanity.useClient)();
1467
+ const dialogId = `EditThumbnailDialog${(0, $ayBmS$reachautoid.useId)()}`;
1468
+ const nextTime = (0, $ayBmS$react.useMemo)(()=>getCurrentTime(), [
1469
+ getCurrentTime
1470
+ ]);
1471
+ const assetWithNewThumbnail = (0, $ayBmS$react.useMemo)(()=>(0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, asset), {
1472
+ thumbTime: nextTime
1473
+ }), [
1474
+ asset,
1475
+ nextTime
1476
+ ]);
1477
+ const [saving, setSaving] = (0, $ayBmS$react.useState)(false);
1478
+ const [error, setError] = (0, $ayBmS$react.useState)(null);
1479
+ const handleSave = (0, $ayBmS$react.useCallback)(()=>{
1480
+ setSaving(true);
1481
+ client.patch(asset._id).set({
1482
+ thumbTime: nextTime
1483
+ }).commit({
1484
+ returnDocuments: false
1485
+ }).then(()=>void setDialogState(false)).catch(setError).finally(()=>void setSaving(false));
1486
+ }, [
1487
+ client,
1488
+ asset._id,
1489
+ nextTime,
1490
+ setDialogState
1491
+ ]);
1492
+ const width = 300 * (0, $ayBmS$usedevicepixelratio.getDevicePixelRatio)({
1493
+ maxDpr: 2
1494
+ });
1495
+ if (error) // eslint-disable-next-line no-warning-comments
1496
+ // @TODO handle errors more gracefully
1497
+ throw error;
1498
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Dialog), {
1499
+ id: dialogId,
1500
+ header: "Edit thumbnail",
1501
+ onClose: ()=>setDialogState(false),
1502
+ footer: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Stack), {
1503
+ padding: 3,
1504
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1505
+ mode: "ghost",
1506
+ tone: "primary",
1507
+ loading: saving,
1508
+ onClick: handleSave,
1509
+ text: "Set new thumbnail"
1510
+ }, "thumbnail")
1511
+ }),
1512
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
1513
+ space: 3,
1514
+ padding: 3,
1515
+ children: [
1516
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
1517
+ space: 2,
1518
+ children: [
1519
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1520
+ size: 1,
1521
+ weight: "semibold",
1522
+ children: "Current:"
1523
+ }),
1524
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$bd4b73f15688a160), {
1525
+ asset: asset,
1526
+ width: width
1527
+ })
1528
+ ]
1529
+ }),
1530
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
1531
+ space: 2,
1532
+ children: [
1533
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1534
+ size: 1,
1535
+ weight: "semibold",
1536
+ children: "New:"
1537
+ }),
1538
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$bd4b73f15688a160), {
1539
+ asset: assetWithNewThumbnail,
1540
+ width: width
1541
+ })
1542
+ ]
1543
+ })
1544
+ ]
1545
+ })
1546
+ });
1547
+ }
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+ function $903f6e8094d64e93$export$445f1a1fda135dc9({ asset: asset , client: client }) {
1561
+ const playbackId = (0, $95c7e77a8fa5d84c$export$bdfa34d24bb44333)(asset);
1562
+ const searchParams = new URLSearchParams();
1563
+ if ((0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed") {
1564
+ const token = (0, $66cd6455bd010559$export$87b96baf1080652a)(client, playbackId, "s");
1565
+ searchParams.set("token", token);
1566
+ }
1567
+ return `https://image.mux.com/${playbackId}/storyboard.vtt?${searchParams}`;
1568
+ }
1569
+
1570
+
1571
+ let $f42279f82eb87901$var$_ = (t3)=>t3, $f42279f82eb87901$var$t, $f42279f82eb87901$var$t1, $f42279f82eb87901$var$t2;
1572
+ const $f42279f82eb87901$export$b302ef9d8310f71 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($f42279f82eb87901$var$t || ($f42279f82eb87901$var$t = $f42279f82eb87901$var$_`
1573
+ position: relative;
1574
+ min-height: 150px;
1575
+ aspect-ratio: 16 / 9;
1576
+ overflow: hidden;
1577
+ border-radius: 1px;
1578
+ media-airplay-button[media-airplay-unavailable] {
1579
+ display: none;
1580
+ }
1581
+ media-volume-range[media-volume-unavailable] {
1582
+ display: none;
1583
+ }
1584
+ media-pip-button[media-pip-unavailable] {
1585
+ display: none;
1586
+ }
1587
+ media-controller {
1588
+ --media-control-background: transparent;
1589
+ --media-control-hover-background: transparent;
1590
+ --media-range-track-background-color: rgba(255, 255, 255, 0.5);
1591
+ --media-range-track-border-radius: 3px;
1592
+ width: 100%;
1593
+ height: 100%;
1594
+ background-color: transparent;
1595
+ }
1596
+ media-control-bar {
1597
+ --media-button-icon-width: 18px;
1598
+ --media-preview-time-margin: 0px;
1599
+ }
1600
+ media-control-bar:not([slot]) :is([role='button'], [role='switch'], button) {
1601
+ height: 44px;
1602
+ }
1603
+ .size-extra-small media-control-bar [role='button'],
1604
+ .size-extra-small media-control-bar [role='switch'] {
1605
+ height: auto;
1606
+ padding: 4.4% 3.2%;
1607
+ }
1608
+ .mxp-spacer {
1609
+ flex-grow: 1;
1610
+ height: 100%;
1611
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
1612
+ }
1613
+ media-controller::part(vertical-layer) {
1614
+ transition: background-color 1s;
1615
+ }
1616
+ media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
1617
+ background-color: rgba(0, 0, 0, 0.6);
1618
+ transition: background-color 0.25s;
1619
+ }
1620
+ .mxp-center-controls {
1621
+ --media-background-color: transparent;
1622
+ --media-button-icon-width: 100%;
1623
+ --media-button-icon-height: auto;
1624
+ pointer-events: none;
1625
+ width: 100%;
1626
+ display: flex;
1627
+ flex-flow: row;
1628
+ align-items: center;
1629
+ justify-content: center;
1630
+ }
1631
+ .mxp-center-controls media-play-button {
1632
+ --media-control-background: transparent;
1633
+ --media-control-hover-background: transparent;
1634
+ padding: 0;
1635
+ width: max(27px, min(9%, 90px));
1636
+ }
1637
+ .mxp-center-controls media-seek-backward-button,
1638
+ .mxp-center-controls media-seek-forward-button {
1639
+ --media-control-background: transparent;
1640
+ --media-control-hover-background: transparent;
1641
+ padding: 0;
1642
+ margin: 0 10%;
1643
+ width: min(7%, 70px);
1644
+ }
1645
+ media-loading-indicator {
1646
+ --media-loading-icon-width: 100%;
1647
+ --media-button-icon-height: auto;
1648
+ pointer-events: none;
1649
+ position: absolute;
1650
+ width: min(15%, 150px);
1651
+ display: flex;
1652
+ flex-flow: row;
1653
+ align-items: center;
1654
+ justify-content: center;
1655
+ }
1656
+ /* Intentionally don't target the div for transition but the children
1657
+ of the div. Prevents messing with media-chrome's autohide feature. */
1658
+ media-loading-indicator + div * {
1659
+ transition: opacity 0.15s;
1660
+ opacity: 1;
1661
+ }
1662
+ media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
1663
+ opacity: 0;
1664
+ transition-delay: 400ms;
1665
+ }
1666
+ media-volume-range {
1667
+ width: min(100%, 100px);
1668
+ }
1669
+ media-time-display {
1670
+ white-space: nowrap;
1671
+ }
1672
+ :is(media-time-display, media-text-display, media-playback-rate-button) {
1673
+ color: inherit;
1674
+ }
1675
+ media-controller:fullscreen media-control-bar[slot='top-chrome'] {
1676
+ /* Hide menus and buttons that trigger modals when in full-screen */
1677
+ display: none;
1678
+ }
1679
+ video {
1680
+ background: transparent;
1681
+ }
1682
+ media-controller:not(:fullscreen) video {
1683
+ aspect-ratio: 16 / 9;
1684
+ }
1685
+ media-controller:not(:-webkit-full-screen) video {
1686
+ aspect-ratio: 16 / 9;
1687
+ }
1688
+ `));
1689
+ const $f42279f82eb87901$export$ec21f2fe322b745c = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).div($f42279f82eb87901$var$t1 || ($f42279f82eb87901$var$t1 = $f42279f82eb87901$var$_`
1690
+ && {
1691
+ --media-background-color: transparent;
1692
+ --media-button-icon-width: 100%;
1693
+ --media-button-icon-height: auto;
1694
+ pointer-events: none;
1695
+ width: 100%;
1696
+ display: flex;
1697
+ flex-flow: row;
1698
+ align-items: center;
1699
+ justify-content: center;
1700
+ media-play-button {
1701
+ --media-control-background: transparent;
1702
+ --media-control-hover-background: transparent;
1703
+ padding: 0;
1704
+ width: max(27px, min(9%, 90px));
1705
+ }
1706
+ }
1707
+ `));
1708
+ const $f42279f82eb87901$export$fa0cb91fe5adf3c5 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$mediachromedistreact.MediaControlBar))($f42279f82eb87901$var$t2 || ($f42279f82eb87901$var$t2 = $f42279f82eb87901$var$_`
1709
+ justify-content: flex-end;
1710
+ button {
1711
+ height: auto;
1712
+ }
1713
+ `));
1714
+ function $f42279f82eb87901$export$5ebdf79245c1c64a({ asset: asset }) {
1715
+ const client = (0, $ayBmS$sanity.useClient)();
1716
+ const ref = (0, $ayBmS$react.useRef)(null);
1717
+ const src = (0, $ayBmS$react.useMemo)(()=>(0, $f2ccfb00ca22d3aa$export$8081e7a11b9f1345)({
1718
+ client: client,
1719
+ asset: asset,
1720
+ width: 1920,
1721
+ height: 1080
1722
+ }), [
1723
+ client,
1724
+ asset
1725
+ ]);
1726
+ (0, $ayBmS$react.useEffect)(()=>{
1727
+ if (ref.current) {
1728
+ var ref1;
1729
+ const style = document.createElement("style");
1730
+ style.innerHTML = "img { object-fit: contain; }";
1731
+ if ((ref1 = ref.current) === null || ref1 === void 0 ? void 0 : ref1.shadowRoot) ref.current.shadowRoot.appendChild(style);
1732
+ }
1733
+ }, []);
1734
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaPosterImage), {
1735
+ ref: ref,
1736
+ slot: "poster",
1737
+ src: src
1738
+ });
1739
+ }
1740
+ function $f42279f82eb87901$export$95073c0c4bf2add1({ asset: asset }) {
1741
+ const client = (0, $ayBmS$sanity.useClient)();
1742
+ // Why useState instead of useMemo? Because we really really only want to run it exactly once and useMemo doesn't make that guarantee
1743
+ const [src] = (0, $ayBmS$react.useState)(()=>(0, $903f6e8094d64e93$export$445f1a1fda135dc9)({
1744
+ asset: asset,
1745
+ client: client
1746
+ }));
1747
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("track", {
1748
+ label: "thumbnails",
1749
+ default: true,
1750
+ kind: "metadata",
1751
+ src: src
1752
+ });
1753
+ }
1754
+
1755
+
1756
+
1757
+
1758
+
1759
+
1760
+
1761
+ let $e3b6eafb04e90e95$var$_ = (t4)=>t4, $e3b6eafb04e90e95$var$t, $e3b6eafb04e90e95$var$t1, $e3b6eafb04e90e95$var$t2, $e3b6eafb04e90e95$var$t3;
1762
+ const $e3b6eafb04e90e95$export$6aa22a823032b784 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($e3b6eafb04e90e95$var$t || ($e3b6eafb04e90e95$var$t = $e3b6eafb04e90e95$var$_`
1763
+ min-height: 82px;
1764
+ box-sizing: border-box;
1765
+ `));
1766
+ const $e3b6eafb04e90e95$export$245cfede9308c835 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Flex))($e3b6eafb04e90e95$var$t1 || ($e3b6eafb04e90e95$var$t1 = $e3b6eafb04e90e95$var$_`
1767
+ text-overflow: ellipsis;
1768
+ overflow: hidden;
1769
+ `));
1770
+ const $e3b6eafb04e90e95$export$e3b4754a92ccf466 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Stack))($e3b6eafb04e90e95$var$t2 || ($e3b6eafb04e90e95$var$t2 = $e3b6eafb04e90e95$var$_`
1771
+ position: relative;
1772
+ width: 60%;
1773
+ `));
1774
+ const $e3b6eafb04e90e95$export$bedb6b8ab184f038 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Code))($e3b6eafb04e90e95$var$t3 || ($e3b6eafb04e90e95$var$t3 = $e3b6eafb04e90e95$var$_`
1775
+ position: relative;
1776
+ width: 100%;
1777
+
1778
+ code {
1779
+ overflow: hidden;
1780
+ text-overflow: ellipsis;
1781
+ position: relative;
1782
+ max-width: 200px;
1783
+ }
1784
+ `));
1785
+ const $e3b6eafb04e90e95$export$98a3886347b629fb = ({ progress: progress = 100 , onCancel: onCancel , filename: filename , text: text = "Uploading" })=>{
1786
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($e3b6eafb04e90e95$export$6aa22a823032b784, {
1787
+ tone: "primary",
1788
+ padding: 4,
1789
+ border: true,
1790
+ height: "fill",
1791
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)($e3b6eafb04e90e95$export$245cfede9308c835, {
1792
+ align: "center",
1793
+ justify: "space-between",
1794
+ height: "fill",
1795
+ direction: "row",
1796
+ gap: 2,
1797
+ children: [
1798
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)($e3b6eafb04e90e95$export$e3b4754a92ccf466, {
1799
+ children: [
1800
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
1801
+ justify: "center",
1802
+ gap: [
1803
+ 3,
1804
+ 3,
1805
+ 2,
1806
+ 2
1807
+ ],
1808
+ direction: [
1809
+ "column",
1810
+ "column",
1811
+ "row"
1812
+ ],
1813
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1814
+ size: 1,
1815
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
1816
+ space: 2,
1817
+ children: [
1818
+ text,
1819
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($e3b6eafb04e90e95$export$bedb6b8ab184f038, {
1820
+ size: 1,
1821
+ children: filename ? filename : "..."
1822
+ })
1823
+ ]
1824
+ })
1825
+ })
1826
+ }),
1827
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
1828
+ marginTop: 3,
1829
+ radius: 5,
1830
+ shadow: 1,
1831
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanity_unstable.LinearProgress), {
1832
+ value: progress
1833
+ })
1834
+ })
1835
+ ]
1836
+ }),
1837
+ onCancel ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
1838
+ fontSize: 2,
1839
+ text: "Cancel upload",
1840
+ mode: "ghost",
1841
+ tone: "critical",
1842
+ onClick: onCancel
1843
+ }) : null
1844
+ ]
1845
+ })
1846
+ });
1847
+ };
1848
+
1849
+
1850
+ const $ab86d4653880d8ea$var$MuxVideo = ({ asset: asset , buttons: buttons , readOnly: readOnly , onChange: onChange , dialogState: dialogState , setDialogState: setDialogState })=>{
1851
+ var ref8, ref1, ref2, ref3;
1852
+ const client = (0, $ayBmS$sanity.useClient)();
1853
+ const isLoading = (0, $ayBmS$react.useMemo)(()=>{
1854
+ if ((asset === null || asset === void 0 ? void 0 : asset.status) === "preparing") return "Preparing the video";
1855
+ if ((asset === null || asset === void 0 ? void 0 : asset.status) === "waiting_for_upload") return "Waiting for upload to start";
1856
+ if ((asset === null || asset === void 0 ? void 0 : asset.status) === "waiting") return "Processing upload";
1857
+ if ((asset === null || asset === void 0 ? void 0 : asset.status) === "ready") return false;
1858
+ if (typeof (asset === null || asset === void 0 ? void 0 : asset.status) === "undefined") return false;
1859
+ return true;
1860
+ }, [
1861
+ asset
1862
+ ]);
1863
+ const isPreparingStaticRenditions = (0, $ayBmS$react.useMemo)(()=>{
1864
+ var ref, ref5, ref6, ref7;
1865
+ if ((asset === null || asset === void 0 ? void 0 : (ref = asset.data) === null || ref === void 0 ? void 0 : (ref5 = ref.static_renditions) === null || ref5 === void 0 ? void 0 : ref5.status) === "preparing") return true;
1866
+ if ((asset === null || asset === void 0 ? void 0 : (ref6 = asset.data) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.static_renditions) === null || ref7 === void 0 ? void 0 : ref7.status) === "ready") return false;
1867
+ return false;
1868
+ }, [
1869
+ asset === null || asset === void 0 ? void 0 : (ref8 = asset.data) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.static_renditions) === null || ref1 === void 0 ? void 0 : ref1.status
1870
+ ]);
1871
+ const videoSrc = (0, $ayBmS$react.useMemo)(()=>asset.playbackId && (0, $7d093cbbd5ecccea$export$b704b622b4125987)({
1872
+ client: client,
1873
+ asset: asset
1874
+ }), [
1875
+ asset,
1876
+ client
1877
+ ]);
1878
+ const [error, setError] = (0, $ayBmS$react.useState)(null);
1879
+ const handleError = (0, $ayBmS$react.useCallback)((event)=>setError(event.currentTarget.error), []);
1880
+ const playRef = (0, $ayBmS$react.useRef)(null);
1881
+ const muteRef = (0, $ayBmS$react.useRef)(null);
1882
+ const video = (0, $ayBmS$react.useRef)(null);
1883
+ var ref4;
1884
+ const getCurrentTime = (0, $ayBmS$react.useCallback)(()=>{
1885
+ var ref;
1886
+ return (ref4 = (ref = video.current) === null || ref === void 0 ? void 0 : ref.currentTime) !== null && ref4 !== void 0 ? ref4 : 0;
1887
+ }, [
1888
+ video
1889
+ ]);
1890
+ const handleCancelUpload = (0, $df118f8f4f291a25$export$b07ce35d92a46f4b)(asset, onChange);
1891
+ (0, $ayBmS$react.useEffect)(()=>{
1892
+ var ref, ref9;
1893
+ const style = document.createElement("style");
1894
+ style.innerHTML = "button svg { vertical-align: middle; }";
1895
+ if ((ref = playRef.current) === null || ref === void 0 ? void 0 : ref.shadowRoot) playRef.current.shadowRoot.appendChild(style);
1896
+ if (muteRef === null || muteRef === void 0 ? void 0 : (ref9 = muteRef.current) === null || ref9 === void 0 ? void 0 : ref9.shadowRoot) muteRef.current.shadowRoot.appendChild(style.cloneNode(true));
1897
+ }, []);
1898
+ const [playerInitTime] = (0, $ayBmS$react.useState)(()=>(0, $ayBmS$muxplaybackcore.generatePlayerInitTime)());
1899
+ const playbackEngineRef = (0, $ayBmS$react.useRef)(undefined);
1900
+ (0, $ayBmS$react.useEffect)(()=>{
1901
+ if (isLoading || !videoSrc) return;
1902
+ const nextPlaybackEngineRef = (0, $ayBmS$muxplaybackcore.initialize)({
1903
+ src: videoSrc,
1904
+ playerInitTime: playerInitTime,
1905
+ playerSoftwareName: "sanity-plugin-mux-input",
1906
+ playerSoftwareVersion: "dev-preview"
1907
+ }, video.current, playbackEngineRef.current);
1908
+ playbackEngineRef.current = nextPlaybackEngineRef;
1909
+ }, [
1910
+ videoSrc,
1911
+ isLoading,
1912
+ playerInitTime
1913
+ ]);
1914
+ (0, $ayBmS$react.useEffect)(()=>{
1915
+ if ((asset === null || asset === void 0 ? void 0 : asset.status) === "errored") {
1916
+ var ref, ref10, ref11;
1917
+ handleCancelUpload();
1918
+ // eslint-disable-next-line no-warning-comments
1919
+ // @TODO use better error handling
1920
+ throw new Error((ref = asset.data) === null || ref === void 0 ? void 0 : (ref10 = ref.errors) === null || ref10 === void 0 ? void 0 : (ref11 = ref10.messages) === null || ref11 === void 0 ? void 0 : ref11.join(" "));
1921
+ }
1922
+ }, [
1923
+ (ref2 = asset.data) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.errors) === null || ref3 === void 0 ? void 0 : ref3.messages,
1924
+ asset === null || asset === void 0 ? void 0 : asset.status,
1925
+ handleCancelUpload
1926
+ ]);
1927
+ if (error) // @TODO better error handling
1928
+ throw error;
1929
+ if (!asset || !asset.status) return null;
1930
+ if (isLoading) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $e3b6eafb04e90e95$export$98a3886347b629fb), {
1931
+ progress: 100,
1932
+ filename: asset === null || asset === void 0 ? void 0 : asset.filename,
1933
+ text: isLoading !== true && isLoading || "Waiting for Mux to complete the file",
1934
+ onCancel: readOnly ? undefined : ()=>handleCancelUpload()
1935
+ });
1936
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
1937
+ children: [
1938
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $f42279f82eb87901$export$b302ef9d8310f71), {
1939
+ shadow: 1,
1940
+ tone: "transparent",
1941
+ scheme: "dark",
1942
+ children: [
1943
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$mediachromedistreact.MediaController), {
1944
+ children: [
1945
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("video", {
1946
+ playsInline: true,
1947
+ ref: video,
1948
+ onError: handleError,
1949
+ slot: "media",
1950
+ preload: "metadata",
1951
+ crossOrigin: "anonomous",
1952
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $f42279f82eb87901$export$95073c0c4bf2add1), {
1953
+ asset: asset
1954
+ })
1955
+ }),
1956
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $f42279f82eb87901$export$5ebdf79245c1c64a), {
1957
+ asset: asset
1958
+ }),
1959
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaLoadingIndicator), {
1960
+ slot: "centered-chrome",
1961
+ noAutoHide: true
1962
+ }),
1963
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $f42279f82eb87901$export$ec21f2fe322b745c), {
1964
+ slot: "centered-chrome",
1965
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaPlayButton), {})
1966
+ }),
1967
+ buttons && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $f42279f82eb87901$export$fa0cb91fe5adf3c5), {
1968
+ slot: "top-chrome",
1969
+ children: buttons
1970
+ }),
1971
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$mediachromedistreact.MediaControlBar), {
1972
+ children: [
1973
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaMuteButton), {}),
1974
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaTimeDisplay), {}),
1975
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaTimeRange), {}),
1976
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaDurationDisplay), {}),
1977
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$mediachromedistreact.MediaFullscreenButton), {})
1978
+ ]
1979
+ })
1980
+ ]
1981
+ }),
1982
+ isPreparingStaticRenditions && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
1983
+ padding: 2,
1984
+ radius: 1,
1985
+ style: {
1986
+ background: "var(--card-fg-color)",
1987
+ position: "absolute",
1988
+ top: "0.5em",
1989
+ left: "0.5em"
1990
+ },
1991
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
1992
+ size: 1,
1993
+ style: {
1994
+ color: "var(--card-bg-color)"
1995
+ },
1996
+ children: "MUX is preparing static renditions, please stand by"
1997
+ })
1998
+ })
1999
+ ]
2000
+ }),
2001
+ dialogState === "edit-thumbnail" && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $8bba2dccded136a6$export$2e2bcd8739ae039), {
2002
+ asset: asset,
2003
+ getCurrentTime: getCurrentTime,
2004
+ setDialogState: setDialogState
2005
+ })
2006
+ ]
2007
+ });
2008
+ };
2009
+ var $ab86d4653880d8ea$export$2e2bcd8739ae039 = $ab86d4653880d8ea$var$MuxVideo;
2010
+
2011
+
2012
+
2013
+
2014
+
2015
+
2016
+
2017
+
2018
+
2019
+
2020
+
2021
+
2022
+
2023
+
2024
+
2025
+
2026
+
2027
+
2028
+
2029
+ function $d5b4dfea215935be$export$a79bcc1dc439e294(border) {
2030
+ return `inset 0 0 0 ${border.width}px ${border.color}`;
2031
+ }
2032
+ function $d5b4dfea215935be$export$c339ddc20364daad(opts) {
2033
+ const { base: base , border: border , focusRing: focusRing } = opts;
2034
+ const focusRingOutsetWidth = focusRing.offset + focusRing.width;
2035
+ const focusRingInsetWidth = 0 - focusRing.offset;
2036
+ const bgColor = base ? base.bg : "var(--card-bg-color)";
2037
+ return [
2038
+ focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
2039
+ border && $d5b4dfea215935be$export$a79bcc1dc439e294(border),
2040
+ focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
2041
+ focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`,
2042
+ ].filter(Boolean).join(",");
2043
+ }
2044
+
2045
+
2046
+ let $3e9b63b1a24e1c3d$var$_ = (t1)=>t1, $3e9b63b1a24e1c3d$var$t;
2047
+ const $3e9b63b1a24e1c3d$export$de1df6cdafc19206 = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.MenuItem))(({ theme: theme })=>{
2048
+ const { focusRing: focusRing } = theme.sanity;
2049
+ const base = theme.sanity.color.base;
2050
+ const border = {
2051
+ width: 1,
2052
+ color: "var(--card-border-color)"
2053
+ };
2054
+ return (0, $ayBmS$styledcomponents.css)($3e9b63b1a24e1c3d$var$t || ($3e9b63b1a24e1c3d$var$t = $3e9b63b1a24e1c3d$var$_`
2055
+ position: relative;
2056
+
2057
+ &:not([data-disabled='true']) {
2058
+ &:focus-within {
2059
+ box-shadow: ${0};
2060
+ }
2061
+ }
2062
+
2063
+ & input {
2064
+ overflow: hidden;
2065
+ top: 0;
2066
+ left: 0;
2067
+ width: 100%;
2068
+ height: 100%;
2069
+ position: absolute;
2070
+ min-width: 0;
2071
+ display: block;
2072
+ appearance: none;
2073
+ padding: 0;
2074
+ margin: 0;
2075
+ border: 0;
2076
+ opacity: 0;
2077
+ }
2078
+ `), (0, $d5b4dfea215935be$export$c339ddc20364daad)({
2079
+ base: base,
2080
+ border: border,
2081
+ focusRing: focusRing
2082
+ }));
2083
+ });
2084
+
2085
+
2086
+ var $50a0d51ee493b3cc$export$c1c647ae58701638 = /*#__PURE__*/ (0, ($parcel$interopDefault($ayBmS$react))).forwardRef(function FileInputMenuItem(props, forwardedRef) {
2087
+ const { icon: icon , id: idProp , accept: accept , capture: capture , fontSize: fontSize , multiple: multiple , onSelect: onSelect , padding: padding = 3 , space: space = 3 , textAlign: textAlign , text: text , disabled: disabled } = props, rest = (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_without_propertiesjs)))(props, [
2088
+ "icon",
2089
+ "id",
2090
+ "accept",
2091
+ "capture",
2092
+ "fontSize",
2093
+ "multiple",
2094
+ "onSelect",
2095
+ "padding",
2096
+ "space",
2097
+ "textAlign",
2098
+ "text",
2099
+ "disabled"
2100
+ ]);
2101
+ const id = (0, $ayBmS$reachautoid.useId)(idProp);
2102
+ const handleChange = (0, ($parcel$interopDefault($ayBmS$react))).useCallback((event)=>{
2103
+ if (onSelect && event.target.files) onSelect(Array.from(event.target.files));
2104
+ }, [
2105
+ onSelect
2106
+ ]);
2107
+ const content = /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
2108
+ align: "center",
2109
+ justify: "flex-start",
2110
+ padding: padding,
2111
+ children: [
2112
+ icon && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
2113
+ marginRight: text ? space : undefined,
2114
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Text), {
2115
+ size: fontSize,
2116
+ children: [
2117
+ /*#__PURE__*/ (0, $ayBmS$react.isValidElement)(icon) && icon,
2118
+ (0, $ayBmS$reactis.isValidElementType)(icon) && /*#__PURE__*/ (0, $ayBmS$react.createElement)(icon)
2119
+ ]
2120
+ })
2121
+ }),
2122
+ text && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
2123
+ align: textAlign,
2124
+ size: fontSize,
2125
+ textOverflow: "ellipsis",
2126
+ children: text
2127
+ })
2128
+ ]
2129
+ });
2130
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $3e9b63b1a24e1c3d$export$de1df6cdafc19206), (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, rest), {
2131
+ htmlFor: id,
2132
+ padding: 0,
2133
+ fontSize: 2,
2134
+ disabled: disabled,
2135
+ ref: forwardedRef,
2136
+ children: [
2137
+ content,
2138
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("input", {
2139
+ "data-testid": "file-button-input",
2140
+ accept: accept,
2141
+ capture: capture,
2142
+ id: id,
2143
+ multiple: multiple,
2144
+ onChange: handleChange,
2145
+ type: "file",
2146
+ value: "",
2147
+ disabled: disabled
2148
+ })
2149
+ ]
2150
+ }));
2151
+ });
2152
+
2153
+
2154
+ let $c5963d9d2157fdda$var$_ = (t2)=>t2, $c5963d9d2157fdda$var$t, $c5963d9d2157fdda$var$t1;
2155
+ const $c5963d9d2157fdda$var$LockCard = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($c5963d9d2157fdda$var$t || ($c5963d9d2157fdda$var$t = $c5963d9d2157fdda$var$_`
2156
+ position: absolute;
2157
+ top: 0;
2158
+ left: 0;
2159
+ opacity: 0.6;
2160
+ mix-blend-mode: screen;
2161
+ background: transparent;
2162
+ `));
2163
+ const $c5963d9d2157fdda$var$LockButton = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Button))($c5963d9d2157fdda$var$t1 || ($c5963d9d2157fdda$var$t1 = $c5963d9d2157fdda$var$_`
2164
+ background: transparent;
2165
+ color: white;
2166
+ `));
2167
+ function $c5963d9d2157fdda$var$PlayerActionsMenu(props) {
2168
+ const { asset: asset , readOnly: readOnly , dialogState: dialogState , setDialogState: setDialogState , onChange: onChange , onUpload: onUpload } = props;
2169
+ const [open, setOpen] = (0, $ayBmS$react.useState)(false);
2170
+ const [menuElement, setMenuRef] = (0, $ayBmS$react.useState)(null);
2171
+ const isSigned = (0, $ayBmS$react.useMemo)(()=>(0, $b22c582d9b0c45c1$export$f7d2546fac75bbd)(asset) === "signed", [
2172
+ asset
2173
+ ]);
2174
+ const onReset = (0, $ayBmS$react.useCallback)(()=>onChange((0, $ayBmS$sanityform.PatchEvent).from((0, $ayBmS$sanityform.unset)([]))), [
2175
+ onChange
2176
+ ]);
2177
+ (0, $ayBmS$react.useEffect)(()=>{
2178
+ if (open && dialogState) setOpen(false);
2179
+ }, [
2180
+ dialogState,
2181
+ open
2182
+ ]);
2183
+ (0, $ayBmS$sanityui.useClickOutside)((0, $ayBmS$react.useCallback)(()=>setOpen(false), []), [
2184
+ menuElement
2185
+ ]);
2186
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
2187
+ space: 1,
2188
+ padding: 2,
2189
+ children: [
2190
+ isSigned && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Tooltip), {
2191
+ content: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
2192
+ padding: 2,
2193
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
2194
+ muted: true,
2195
+ size: 1,
2196
+ children: "Signed playback policy"
2197
+ })
2198
+ }),
2199
+ placement: "right",
2200
+ portal: true,
2201
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($c5963d9d2157fdda$var$LockCard, {
2202
+ radius: 2,
2203
+ margin: 2,
2204
+ scheme: "dark",
2205
+ tone: "positive",
2206
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($c5963d9d2157fdda$var$LockButton, {
2207
+ icon: (0, $ayBmS$sanityicons.LockIcon),
2208
+ mode: "bleed",
2209
+ tone: "positive"
2210
+ })
2211
+ })
2212
+ }),
2213
+ !readOnly && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
2214
+ icon: (0, $ayBmS$sanityicons.EditIcon),
2215
+ mode: "ghost",
2216
+ onClick: ()=>setDialogState("edit-thumbnail")
2217
+ }),
2218
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Popover), {
2219
+ content: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Menu), {
2220
+ ref: setMenuRef,
2221
+ children: [
2222
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
2223
+ padding: 2,
2224
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Label), {
2225
+ muted: true,
2226
+ size: 1,
2227
+ children: "Replace"
2228
+ })
2229
+ }),
2230
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $50a0d51ee493b3cc$export$c1c647ae58701638), {
2231
+ accept: "video/*",
2232
+ icon: (0, $ayBmS$sanityicons.UploadIcon),
2233
+ mode: "bleed",
2234
+ onSelect: onUpload,
2235
+ text: "Upload",
2236
+ disabled: readOnly,
2237
+ fontSize: 2
2238
+ }),
2239
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuItem), {
2240
+ icon: (0, $ayBmS$sanityicons.SearchIcon),
2241
+ text: "Browse",
2242
+ onClick: ()=>setDialogState("select-video")
2243
+ }),
2244
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuDivider), {}),
2245
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuItem), {
2246
+ icon: (0, $ayBmS$sanityicons.PlugIcon),
2247
+ text: "Configure API",
2248
+ onClick: ()=>setDialogState("secrets")
2249
+ }),
2250
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuDivider), {}),
2251
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.MenuItem), {
2252
+ tone: "critical",
2253
+ icon: (0, $ayBmS$sanityicons.ResetIcon),
2254
+ text: "Clear field",
2255
+ onClick: onReset,
2256
+ disabled: readOnly
2257
+ })
2258
+ ]
2259
+ }),
2260
+ portal: true,
2261
+ open: open,
2262
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
2263
+ icon: (0, $ayBmS$sanityicons.EllipsisVerticalIcon),
2264
+ mode: "ghost",
2265
+ onClick: ()=>{
2266
+ setDialogState(false);
2267
+ setOpen(true);
2268
+ }
2269
+ })
2270
+ })
2271
+ ]
2272
+ });
2273
+ }
2274
+ var $c5963d9d2157fdda$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $ayBmS$react.memo)($c5963d9d2157fdda$var$PlayerActionsMenu);
2275
+
2276
+
2277
+
2278
+
2279
+
2280
+
2281
+
2282
+
2283
+
2284
+ let $ecb87a73d452358c$var$_ = (t1)=>t1, $ecb87a73d452358c$var$t;
2285
+ function $ecb87a73d452358c$export$ed320981107bc6bd(component) {
2286
+ return (0, ($parcel$interopDefault($ayBmS$styledcomponents)))(component)((props)=>{
2287
+ const border = {
2288
+ width: props.$border ? 1 : 0,
2289
+ color: "var(--card-border-color)"
2290
+ };
2291
+ return (0, $ayBmS$styledcomponents.css)($ecb87a73d452358c$var$t || ($ecb87a73d452358c$var$t = $ecb87a73d452358c$var$_`
2292
+ --card-focus-box-shadow: ${0};
2293
+
2294
+ border-radius: ${0};
2295
+ outline: none;
2296
+ box-shadow: var(--card-focus-box-shadow);
2297
+
2298
+ &:focus {
2299
+ --card-focus-box-shadow: ${0};
2300
+ }
2301
+ `), (0, $d5b4dfea215935be$export$a79bcc1dc439e294)(border), (0, $ayBmS$sanityui.rem)(props.theme.sanity.radius[1]), (0, $d5b4dfea215935be$export$c339ddc20364daad)({
2302
+ base: props.theme.sanity.color.base,
2303
+ border: border,
2304
+ focusRing: props.theme.sanity.focusRing
2305
+ }));
2306
+ });
2307
+ }
2308
+
2309
+
2310
+
2311
+
2312
+ let $acf777e43722fa61$var$_ = (t1)=>t1, $acf777e43722fa61$var$t;
2313
+ const $acf777e43722fa61$var$ctrlKey = 17;
2314
+ const $acf777e43722fa61$var$cmdKey = 91;
2315
+ const $acf777e43722fa61$var$UploadCardWithFocusRing = (0, $ecb87a73d452358c$export$ed320981107bc6bd)((0, $ayBmS$sanityui.Card));
2316
+ const $acf777e43722fa61$export$88f8ee83ae881d58 = /*#__PURE__*/ (0, $ayBmS$react.forwardRef)(({ children: children , tone: tone , onPaste: onPaste , onFocus: onFocus , onBlur: onBlur , onDrop: onDrop , onDragEnter: onDragEnter , onDragLeave: onDragLeave , onDragOver: onDragOver }, forwardedRef)=>{
2317
+ const ctrlDown = (0, $ayBmS$react.useRef)(false);
2318
+ const inputRef = (0, $ayBmS$react.useRef)(null);
2319
+ const handleKeyDown = (0, $ayBmS$react.useCallback)((event)=>{
2320
+ if (event.keyCode == $acf777e43722fa61$var$ctrlKey || event.keyCode == $acf777e43722fa61$var$cmdKey) ctrlDown.current = true;
2321
+ const vKey = 86;
2322
+ if (ctrlDown.current && event.keyCode == vKey) inputRef.current.focus();
2323
+ }, []);
2324
+ const handleKeyUp = (0, $ayBmS$react.useCallback)((event)=>{
2325
+ if (event.keyCode == $acf777e43722fa61$var$ctrlKey || event.keyCode == $acf777e43722fa61$var$cmdKey) ctrlDown.current = false;
2326
+ }, []);
2327
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)($acf777e43722fa61$var$UploadCardWithFocusRing, {
2328
+ tone: tone,
2329
+ height: "fill",
2330
+ ref: forwardedRef,
2331
+ padding: 0,
2332
+ radius: 2,
2333
+ shadow: 0,
2334
+ tabIndex: 0,
2335
+ onKeyDown: handleKeyDown,
2336
+ onKeyUp: handleKeyUp,
2337
+ onPaste: onPaste,
2338
+ onFocus: onFocus,
2339
+ onBlur: onBlur,
2340
+ onDrop: onDrop,
2341
+ onDragEnter: onDragEnter,
2342
+ onDragLeave: onDragLeave,
2343
+ onDragOver: onDragOver,
2344
+ children: [
2345
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($acf777e43722fa61$var$HiddenInput, {
2346
+ ref: inputRef,
2347
+ onPaste: onPaste
2348
+ }),
2349
+ children
2350
+ ]
2351
+ });
2352
+ });
2353
+ const $acf777e43722fa61$var$HiddenInput = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).input.attrs({
2354
+ type: "text"
2355
+ })($acf777e43722fa61$var$t || ($acf777e43722fa61$var$t = $acf777e43722fa61$var$_`
2356
+ position: absolute;
2357
+ border: 0;
2358
+ color: white;
2359
+ opacity: 0;
2360
+
2361
+ &:focus {
2362
+ outline: none;
2363
+ }
2364
+ `));
2365
+
2366
+
2367
+
2368
+
2369
+
2370
+
2371
+
2372
+
2373
+
2374
+
2375
+
2376
+
2377
+
2378
+
2379
+
2380
+ let $7cd23a424037c874$var$_ = (t2)=>t2, $7cd23a424037c874$var$t, $7cd23a424037c874$var$t1;
2381
+ const $7cd23a424037c874$var$HiddenInput = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).input($7cd23a424037c874$var$t || ($7cd23a424037c874$var$t = $7cd23a424037c874$var$_`
2382
+ overflow: hidden;
2383
+ width: 0.1px;
2384
+ height: 0.1px;
2385
+ opacity: 0;
2386
+ position: absolute;
2387
+ z-index: -1;
2388
+ `));
2389
+ const $7cd23a424037c874$var$Label = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).label($7cd23a424037c874$var$t1 || ($7cd23a424037c874$var$t1 = $7cd23a424037c874$var$_`
2390
+ position: relative;
2391
+ `));
2392
+ var $7cd23a424037c874$export$c6c4e824471beee6 = (_param)=>{
2393
+ var { onSelect: onSelect } = _param, props = (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_without_propertiesjs)))(_param, [
2394
+ "onSelect"
2395
+ ]);
2396
+ const inputId = `FileSelect${(0, $ayBmS$reachautoid.useId)()}`;
2397
+ const inputRef = (0, $ayBmS$react.useRef)(null);
2398
+ const handleSelect = (0, $ayBmS$react.useCallback)((event)=>{
2399
+ if (onSelect) onSelect(event.target.files);
2400
+ }, [
2401
+ onSelect
2402
+ ]);
2403
+ const handleButtonClick = (0, $ayBmS$react.useCallback)(()=>{
2404
+ var ref;
2405
+ return (ref = inputRef.current) === null || ref === void 0 ? void 0 : ref.click();
2406
+ }, []);
2407
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)($7cd23a424037c874$var$Label, {
2408
+ htmlFor: inputId,
2409
+ children: [
2410
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7cd23a424037c874$var$HiddenInput, {
2411
+ accept: "video/*",
2412
+ ref: inputRef,
2413
+ tabIndex: 0,
2414
+ type: "file",
2415
+ id: inputId,
2416
+ onChange: handleSelect,
2417
+ value: ""
2418
+ }),
2419
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({
2420
+ onClick: handleButtonClick,
2421
+ mode: "default",
2422
+ tone: "primary",
2423
+ style: {
2424
+ width: "100%"
2425
+ }
2426
+ }, props))
2427
+ ]
2428
+ });
2429
+ };
2430
+
2431
+
2432
+ let $7570d589af81e056$var$_ = (t2)=>t2, $7570d589af81e056$var$t, $7570d589af81e056$var$t1;
2433
+ const $7570d589af81e056$var$UploadCard = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($7570d589af81e056$var$t || ($7570d589af81e056$var$t = $7570d589af81e056$var$_`
2434
+ && {
2435
+ border-style: dashed;
2436
+ }
2437
+ `));
2438
+ const $7570d589af81e056$var$ConfigureApiBox = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Box))($7570d589af81e056$var$t1 || ($7570d589af81e056$var$t1 = $7570d589af81e056$var$_`
2439
+ position: absolute;
2440
+ top: 0;
2441
+ right: 0;
2442
+ `));
2443
+ function $7570d589af81e056$export$2e2bcd8739ae039(props) {
2444
+ const { setDialogState: setDialogState , readOnly: readOnly , onSelect: onSelect , hovering: hovering , needsSetup: needsSetup } = props;
2445
+ const handleBrowse = (0, $ayBmS$react.useCallback)(()=>setDialogState("select-video"), [
2446
+ setDialogState
2447
+ ]);
2448
+ const handleConfigureApi = (0, $ayBmS$react.useCallback)(()=>setDialogState("secrets"), [
2449
+ setDialogState
2450
+ ]);
2451
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
2452
+ style: {
2453
+ padding: 1,
2454
+ position: "relative"
2455
+ },
2456
+ height: "stretch",
2457
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)($7570d589af81e056$var$UploadCard, {
2458
+ sizing: "border",
2459
+ height: "fill",
2460
+ tone: readOnly ? "transparent" : "inherit",
2461
+ border: true,
2462
+ padding: 3,
2463
+ style: hovering ? {
2464
+ borderColor: "transparent"
2465
+ } : undefined,
2466
+ children: [
2467
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($7570d589af81e056$var$ConfigureApiBox, {
2468
+ padding: 3,
2469
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
2470
+ padding: 3,
2471
+ radius: 3,
2472
+ tone: needsSetup ? "critical" : undefined,
2473
+ onClick: handleConfigureApi,
2474
+ icon: (0, $ayBmS$sanityicons.PlugIcon),
2475
+ mode: "bleed"
2476
+ })
2477
+ }),
2478
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
2479
+ align: "center",
2480
+ justify: "space-between",
2481
+ gap: 4,
2482
+ direction: [
2483
+ "column",
2484
+ "column",
2485
+ "row"
2486
+ ],
2487
+ paddingY: [
2488
+ 2,
2489
+ 2,
2490
+ 0
2491
+ ],
2492
+ sizing: "border",
2493
+ height: "fill",
2494
+ children: [
2495
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
2496
+ align: "center",
2497
+ justify: "center",
2498
+ gap: 2,
2499
+ flex: 1,
2500
+ children: [
2501
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
2502
+ justify: "center",
2503
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
2504
+ muted: true,
2505
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityicons.DocumentVideoIcon), {})
2506
+ })
2507
+ }),
2508
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
2509
+ justify: "center",
2510
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
2511
+ size: 1,
2512
+ muted: true,
2513
+ children: "Drag video or paste URL here"
2514
+ })
2515
+ })
2516
+ ]
2517
+ }),
2518
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
2519
+ space: 2,
2520
+ children: [
2521
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $7cd23a424037c874$export$c6c4e824471beee6), {
2522
+ mode: "ghost",
2523
+ tone: "default",
2524
+ icon: (0, $ayBmS$sanityicons.UploadIcon),
2525
+ text: "Upload",
2526
+ onSelect: onSelect
2527
+ }),
2528
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
2529
+ mode: "ghost",
2530
+ icon: (0, $ayBmS$sanityicons.SearchIcon),
2531
+ text: "Select",
2532
+ onClick: handleBrowse
2533
+ })
2534
+ ]
2535
+ })
2536
+ ]
2537
+ })
2538
+ ]
2539
+ })
2540
+ });
2541
+ }
2542
+
2543
+
2544
+
2545
+ class $e43e21f1b2fe430e$var$MuxVideoInputUploader extends (0, $ayBmS$react.Component) {
2546
+ componentWillUnmount() {
2547
+ this.unSubscribeToUpload();
2548
+ }
2549
+ componentDidMount() {
2550
+ const events$ = new (0, $ayBmS$rxjs.Subject)();
2551
+ this.onCancelUploadButtonClick$ = events$.asObservable();
2552
+ this.handleCancelUploadButtonClick = (event)=>events$.next(event);
2553
+ }
2554
+ unSubscribeToUpload() {
2555
+ if (this.upload && !this.upload.closed) this.upload.unsubscribe();
2556
+ }
2557
+ render() {
2558
+ var ref;
2559
+ if (this.state.uploadProgress !== null) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $e3b6eafb04e90e95$export$98a3886347b629fb), {
2560
+ onCancel: this.handleCancelUploadButtonClick,
2561
+ progress: this.state.uploadProgress,
2562
+ filename: ((ref = this.state.fileInfo) === null || ref === void 0 ? void 0 : ref.name) || this.state.url
2563
+ });
2564
+ if (this.state.error) // @TODO better error handling
2565
+ throw this.state.error;
2566
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
2567
+ children: [
2568
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $acf777e43722fa61$export$88f8ee83ae881d58), {
2569
+ tone: this.state.isDraggingOver && (this.state.invalidPaste || this.state.invalidFile) ? "critical" : this.state.isDraggingOver ? "positive" : undefined,
2570
+ onBlur: this.props.onBlur,
2571
+ onFocus: this.props.onFocus,
2572
+ onDrop: this.handleDrop,
2573
+ onDragOver: this.handleDragOver,
2574
+ onDragLeave: this.handleDragLeave,
2575
+ onDragEnter: this.handleDragEnter,
2576
+ onPaste: this.handlePaste,
2577
+ ref: this.container,
2578
+ children: this.props.asset ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ab86d4653880d8ea$export$2e2bcd8739ae039), {
2579
+ readOnly: this.props.readOnly,
2580
+ asset: this.props.asset,
2581
+ onChange: this.props.onChange,
2582
+ dialogState: this.props.dialogState,
2583
+ setDialogState: this.props.setDialogState,
2584
+ buttons: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $c5963d9d2157fdda$export$2e2bcd8739ae039), {
2585
+ asset: this.props.asset,
2586
+ dialogState: this.props.dialogState,
2587
+ setDialogState: this.props.setDialogState,
2588
+ onChange: this.props.onChange,
2589
+ onUpload: this.onUpload,
2590
+ readOnly: this.props.readOnly
2591
+ })
2592
+ }) : /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $7570d589af81e056$export$2e2bcd8739ae039), {
2593
+ hovering: this.state.isDraggingOver,
2594
+ onSelect: this.onUpload,
2595
+ readOnly: this.props.readOnly,
2596
+ setDialogState: this.props.setDialogState,
2597
+ needsSetup: this.props.needsSetup
2598
+ })
2599
+ }),
2600
+ this.props.dialogState === "select-video" && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $5f35306d1d1944f9$export$2e2bcd8739ae039), {
2601
+ asset: this.props.asset,
2602
+ onChange: this.props.onChange,
2603
+ setDialogState: this.props.setDialogState
2604
+ })
2605
+ ]
2606
+ });
2607
+ }
2608
+ constructor(...args){
2609
+ super(...args);
2610
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "state", {
2611
+ isDraggingOver: false,
2612
+ invalidPaste: false,
2613
+ invalidFile: false,
2614
+ uploadProgress: null,
2615
+ fileInfo: null,
2616
+ uuid: null,
2617
+ error: null,
2618
+ url: null
2619
+ });
2620
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "dragEnteredEls", []);
2621
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "ctrlDown", false);
2622
+ // eslint-disable-next-line no-warning-comments
2623
+ // @TODO add proper typings for the return values of uploadFile and uploadUrl
2624
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "upload", null);
2625
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "container", /*#__PURE__*/ (0, ($parcel$interopDefault($ayBmS$react))).createRef());
2626
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleProgress", (evt)=>{
2627
+ this.setState({
2628
+ uploadProgress: evt.percent
2629
+ });
2630
+ });
2631
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "onUpload", (files)=>{
2632
+ this.setState({
2633
+ uploadProgress: 0,
2634
+ fileInfo: null,
2635
+ uuid: null
2636
+ });
2637
+ this.upload = (0, $12591da830e5242f$export$a5575dbeeffdad98)(this.props.config, this.props.client, files[0], {
2638
+ enableSignedUrls: this.props.secrets.enableSignedUrls
2639
+ }).pipe((0, $ayBmS$rxjsoperators.takeUntil)(this.onCancelUploadButtonClick$.pipe((0, $ayBmS$rxjsoperators.tap)(()=>{
2640
+ if (this.state.uuid) this.props.client.delete(this.state.uuid);
2641
+ })))).subscribe({
2642
+ complete: ()=>{
2643
+ this.setState({
2644
+ error: null,
2645
+ uploadProgress: null,
2646
+ uuid: null
2647
+ });
2648
+ },
2649
+ next: (event)=>{
2650
+ this.handleUploadEvent(event);
2651
+ },
2652
+ error: (err)=>{
2653
+ this.setState({
2654
+ error: err,
2655
+ uploadProgress: null,
2656
+ uuid: null
2657
+ });
2658
+ }
2659
+ });
2660
+ });
2661
+ // eslint-disable-next-line no-warning-comments
2662
+ // @TODO add proper typings for the Observable events
2663
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleUploadEvent", (event)=>{
2664
+ switch(event.type){
2665
+ case "success":
2666
+ return this.handleUploadSuccess(event.asset);
2667
+ case "progress":
2668
+ return this.handleProgress(event);
2669
+ case "file":
2670
+ return this.setState({
2671
+ fileInfo: event.file
2672
+ });
2673
+ case "uuid":
2674
+ // Means we created a mux.videoAsset document with an uuid
2675
+ return this.setState({
2676
+ uuid: event.uuid
2677
+ });
2678
+ case "url":
2679
+ return this.setState({
2680
+ url: event.url,
2681
+ uploadProgress: 100
2682
+ });
2683
+ default:
2684
+ return null;
2685
+ }
2686
+ });
2687
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleUploadSuccess", (asset)=>{
2688
+ this.setState({
2689
+ uploadProgress: 100
2690
+ });
2691
+ this.props.onChange((0, $ayBmS$sanityform.PatchEvent).from([
2692
+ (0, $ayBmS$sanityform.setIfMissing)({
2693
+ asset: {}
2694
+ }),
2695
+ (0, $ayBmS$sanityform.set)({
2696
+ _type: "reference",
2697
+ _weak: true,
2698
+ _ref: asset._id
2699
+ }, [
2700
+ "asset"
2701
+ ]),
2702
+ ]));
2703
+ });
2704
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handlePaste", (event)=>{
2705
+ const clipboardData = event.clipboardData || window.clipboardData;
2706
+ const url = clipboardData.getData("text");
2707
+ const options = {
2708
+ enableSignedUrls: this.props.secrets.enableSignedUrls
2709
+ };
2710
+ this.upload = (0, $12591da830e5242f$export$f35af194eb27b25f)(this.props.config, this.props.client, url, options).subscribe({
2711
+ complete: ()=>{
2712
+ this.setState({
2713
+ error: null,
2714
+ uploadProgress: null,
2715
+ url: null
2716
+ });
2717
+ },
2718
+ next: (sEvent)=>{
2719
+ this.handleUploadEvent(sEvent);
2720
+ },
2721
+ error: (err)=>{
2722
+ let error;
2723
+ // Don't output error dialog when just invalid url
2724
+ if (!err.message.toLowerCase().match("invalid url")) error = err;
2725
+ this.setState({
2726
+ invalidPaste: true,
2727
+ error: error
2728
+ }, ()=>{
2729
+ setTimeout(()=>{
2730
+ this.setState({
2731
+ invalidPaste: false,
2732
+ uploadProgress: null
2733
+ });
2734
+ }, 2000);
2735
+ });
2736
+ }
2737
+ });
2738
+ });
2739
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleDrop", (event)=>{
2740
+ this.setState({
2741
+ isDraggingOver: false
2742
+ });
2743
+ event.preventDefault();
2744
+ event.stopPropagation();
2745
+ (0, $f981bc359ea69985$export$73f6d6d8d794f645)(event.nativeEvent.dataTransfer).then((files)=>{
2746
+ if (files) // eslint-disable-next-line no-warning-comments
2747
+ // @TODO fix the typing on files
2748
+ this.onUpload(files);
2749
+ });
2750
+ });
2751
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleDragOver", (event)=>{
2752
+ event.preventDefault();
2753
+ event.stopPropagation();
2754
+ });
2755
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleDragEnter", (event)=>{
2756
+ var ref, ref1;
2757
+ event.stopPropagation();
2758
+ this.dragEnteredEls.push(event.target);
2759
+ this.setState({
2760
+ isDraggingOver: true
2761
+ });
2762
+ const type = (ref = event.dataTransfer.items) === null || ref === void 0 ? void 0 : (ref1 = ref[0]) === null || ref1 === void 0 ? void 0 : ref1.type;
2763
+ this.setState({
2764
+ invalidFile: !type.startsWith("video/")
2765
+ });
2766
+ });
2767
+ (0, ($parcel$interopDefault($ayBmS$swchelperslib_define_propertyjs)))(this, "handleDragLeave", (event)=>{
2768
+ event.stopPropagation();
2769
+ const idx = this.dragEnteredEls.indexOf(event.target);
2770
+ if (idx > -1) this.dragEnteredEls.splice(idx, 1);
2771
+ if (this.dragEnteredEls.length === 0) this.setState({
2772
+ isDraggingOver: false
2773
+ });
2774
+ });
2775
+ }
2776
+ }
2777
+ var $e43e21f1b2fe430e$export$2e2bcd8739ae039 = $e43e21f1b2fe430e$var$MuxVideoInputUploader;
2778
+
2779
+
2780
+
2781
+
2782
+
2783
+
2784
+
2785
+
2786
+
2787
+
2788
+ const $efecc0530b43438c$export$e1d4ef4fde5dbdf2 = (client, secrets)=>{
2789
+ return (0, $ayBmS$react.useCallback)(async ({ token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls })=>{
2790
+ let { signingKeyId: signingKeyId , signingKeyPrivate: signingKeyPrivate } = secrets;
2791
+ try {
2792
+ await (0, $4d6664636d7d58e3$export$f16c6d66b9790f06)(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate);
2793
+ const valid = await (0, $4d6664636d7d58e3$export$3a1df1322191b3ef)(client);
2794
+ if (!(valid === null || valid === void 0 ? void 0 : valid.status) && token && secretKey) throw new Error("Invalid secrets");
2795
+ } catch (err) {
2796
+ console.error("Error while trying to save secrets:", err);
2797
+ throw err;
2798
+ }
2799
+ if (enableSignedUrls) {
2800
+ const hasValidSigningKeys = await (0, $4d6664636d7d58e3$export$f5836111430d17bc)(client, signingKeyId, signingKeyPrivate);
2801
+ if (!hasValidSigningKeys) try {
2802
+ const { data: data } = await (0, $4d6664636d7d58e3$export$21cc0cab779cfac1)(client);
2803
+ signingKeyId = data.id;
2804
+ signingKeyPrivate = data.private_key;
2805
+ await (0, $4d6664636d7d58e3$export$f16c6d66b9790f06)(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate);
2806
+ } catch (err) {
2807
+ // eslint-disable-next-line no-console
2808
+ console.log("Error while creating and saving signing key:", err.message);
2809
+ throw err;
2810
+ }
2811
+ }
2812
+ return {
2813
+ token: token,
2814
+ secretKey: secretKey,
2815
+ enableSignedUrls: enableSignedUrls,
2816
+ signingKeyId: signingKeyId,
2817
+ signingKeyPrivate: signingKeyPrivate
2818
+ };
2819
+ }, [
2820
+ client,
2821
+ secrets
2822
+ ]);
2823
+ };
2824
+
2825
+
2826
+
2827
+
2828
+
2829
+ function $f23684a2b0635ab0$var$init({ token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls }) {
2830
+ return {
2831
+ submitting: false,
2832
+ error: null,
2833
+ // Form inputs don't set the state back to null when clearing a field, but uses empty strings
2834
+ // This ensures the `dirty` check works correctly
2835
+ token: token !== null && token !== void 0 ? token : "",
2836
+ secretKey: secretKey !== null && secretKey !== void 0 ? secretKey : "",
2837
+ enableSignedUrls: enableSignedUrls !== null && enableSignedUrls !== void 0 ? enableSignedUrls : false
2838
+ };
2839
+ }
2840
+ function $f23684a2b0635ab0$var$reducer(state, action) {
2841
+ switch(action === null || action === void 0 ? void 0 : action.type){
2842
+ case "submit":
2843
+ return (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, state), {
2844
+ submitting: true,
2845
+ error: null
2846
+ });
2847
+ case "error":
2848
+ return (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, state), {
2849
+ submitting: false,
2850
+ error: action.payload
2851
+ });
2852
+ case "reset":
2853
+ return $f23684a2b0635ab0$var$init(action.payload);
2854
+ case "change":
2855
+ return (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, state), {
2856
+ [action.payload.name]: action.payload.value
2857
+ });
2858
+ default:
2859
+ throw new Error(`Unknown action type: ${action === null || action === void 0 ? void 0 : action.type}`);
2860
+ }
2861
+ }
2862
+ const $f23684a2b0635ab0$export$e24a74f4fce2446c = (secrets)=>(0, $ayBmS$react.useReducer)($f23684a2b0635ab0$var$reducer, secrets, $f23684a2b0635ab0$var$init);
2863
+
2864
+
2865
+
2866
+
2867
+
2868
+
2869
+
2870
+
2871
+
2872
+
2873
+ // Mapping ids to ensure filter refs are unique, otherwise all Logo instances are hidden if the first SVG is hidden, due to how SVGs deal with relative links and ids
2874
+ const $e3a8039a3d28e592$var$ids = [
2875
+ "title",
2876
+ "a",
2877
+ "b",
2878
+ "c",
2879
+ "d",
2880
+ "e",
2881
+ "f",
2882
+ "g",
2883
+ "h",
2884
+ "i",
2885
+ "j",
2886
+ "k",
2887
+ "l",
2888
+ "m",
2889
+ "n",
2890
+ "o",
2891
+ "p",
2892
+ "q",
2893
+ "r",
2894
+ ];
2895
+ function $e3a8039a3d28e592$export$2e2bcd8739ae039({ height: height = 26 }) {
2896
+ const id = (0, $ayBmS$reachautoid.useId)();
2897
+ const [titleId, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = (0, $ayBmS$react.useMemo)(()=>$e3a8039a3d28e592$var$ids.map((field)=>`${id}-${field}`), [
2898
+ id
2899
+ ]);
2900
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("svg", {
2901
+ "aria-labelledby": titleId,
2902
+ role: "img",
2903
+ xmlns: "http://www.w3.org/2000/svg",
2904
+ xmlSpace: "preserve",
2905
+ viewBox: "92.08878326416016 102.66712188720703 692.76123046875 219.99948120117188",
2906
+ style: {
2907
+ height: `${height}px`
2908
+ },
2909
+ children: [
2910
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("title", {
2911
+ id: titleId,
2912
+ children: "Mux Logo"
2913
+ }),
2914
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("defs", {
2915
+ children: [
2916
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
2917
+ id: c,
2918
+ spreadMethod: "pad",
2919
+ gradientTransform: "matrix(528.38055 0 0 -528.38055 63.801 159.5)",
2920
+ gradientUnits: "userSpaceOnUse",
2921
+ y2: 0,
2922
+ x2: 1,
2923
+ y1: 0,
2924
+ x1: 0,
2925
+ children: [
2926
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2927
+ offset: 0,
2928
+ style: {
2929
+ stopOpacity: 1,
2930
+ stopColor: "#ff4e00"
2931
+ }
2932
+ }),
2933
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2934
+ offset: 1,
2935
+ style: {
2936
+ stopOpacity: 1,
2937
+ stopColor: "#ff1791"
2938
+ }
2939
+ })
2940
+ ]
2941
+ }),
2942
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
2943
+ id: d,
2944
+ spreadMethod: "pad",
2945
+ gradientTransform: "matrix(523.66766 0 0 -523.66766 67.897 159.5)",
2946
+ gradientUnits: "userSpaceOnUse",
2947
+ y2: 0,
2948
+ x2: 1,
2949
+ y1: 0,
2950
+ x1: 0,
2951
+ children: [
2952
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2953
+ offset: 0,
2954
+ style: {
2955
+ stopOpacity: 1,
2956
+ stopColor: "#ff4e00"
2957
+ }
2958
+ }),
2959
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2960
+ offset: 1,
2961
+ style: {
2962
+ stopOpacity: 1,
2963
+ stopColor: "#ff1791"
2964
+ }
2965
+ })
2966
+ ]
2967
+ }),
2968
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
2969
+ id: g,
2970
+ spreadMethod: "pad",
2971
+ gradientTransform: "rotate(180 296.075 79.75) scale(524.84045)",
2972
+ gradientUnits: "userSpaceOnUse",
2973
+ y2: 0,
2974
+ x2: 1,
2975
+ y1: 0,
2976
+ x1: 0,
2977
+ children: [
2978
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2979
+ offset: 0,
2980
+ style: {
2981
+ stopOpacity: 1,
2982
+ stopColor: "#ff4e00"
2983
+ }
2984
+ }),
2985
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
2986
+ offset: 1,
2987
+ style: {
2988
+ stopOpacity: 1,
2989
+ stopColor: "#ff1791"
2990
+ }
2991
+ })
2992
+ ]
2993
+ }),
2994
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
2995
+ id: i,
2996
+ spreadMethod: "pad",
2997
+ gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
2998
+ gradientUnits: "userSpaceOnUse",
2999
+ y2: 0,
3000
+ x2: 1,
3001
+ y1: 0,
3002
+ x1: 0,
3003
+ children: [
3004
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3005
+ offset: 0,
3006
+ style: {
3007
+ stopOpacity: 1,
3008
+ stopColor: "#ff4e00"
3009
+ }
3010
+ }),
3011
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3012
+ offset: 1,
3013
+ style: {
3014
+ stopOpacity: 1,
3015
+ stopColor: "#ff1791"
3016
+ }
3017
+ })
3018
+ ]
3019
+ }),
3020
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3021
+ id: j,
3022
+ spreadMethod: "pad",
3023
+ gradientTransform: "matrix(523.08514 0 0 -523.08514 67.897 224.446)",
3024
+ gradientUnits: "userSpaceOnUse",
3025
+ y2: 0,
3026
+ x2: 1,
3027
+ y1: 0,
3028
+ x1: 0,
3029
+ children: [
3030
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3031
+ offset: 0,
3032
+ style: {
3033
+ stopOpacity: 1,
3034
+ stopColor: "#ff4e00"
3035
+ }
3036
+ }),
3037
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3038
+ offset: 1,
3039
+ style: {
3040
+ stopOpacity: 1,
3041
+ stopColor: "#ff1791"
3042
+ }
3043
+ })
3044
+ ]
3045
+ }),
3046
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3047
+ id: k,
3048
+ spreadMethod: "pad",
3049
+ gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.553)",
3050
+ gradientUnits: "userSpaceOnUse",
3051
+ y2: 0,
3052
+ x2: 1,
3053
+ y1: 0,
3054
+ x1: 0,
3055
+ children: [
3056
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3057
+ offset: 0,
3058
+ style: {
3059
+ stopOpacity: 1,
3060
+ stopColor: "#ff4e00"
3061
+ }
3062
+ }),
3063
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3064
+ offset: 1,
3065
+ style: {
3066
+ stopOpacity: 1,
3067
+ stopColor: "#ff1791"
3068
+ }
3069
+ })
3070
+ ]
3071
+ }),
3072
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3073
+ id: l,
3074
+ spreadMethod: "pad",
3075
+ gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
3076
+ gradientUnits: "userSpaceOnUse",
3077
+ y2: 0,
3078
+ x2: 1,
3079
+ y1: 0,
3080
+ x1: 0,
3081
+ children: [
3082
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3083
+ offset: 0,
3084
+ style: {
3085
+ stopOpacity: 1,
3086
+ stopColor: "#ff4e00"
3087
+ }
3088
+ }),
3089
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3090
+ offset: 1,
3091
+ style: {
3092
+ stopOpacity: 1,
3093
+ stopColor: "#ff1791"
3094
+ }
3095
+ })
3096
+ ]
3097
+ }),
3098
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3099
+ id: m,
3100
+ spreadMethod: "pad",
3101
+ gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.554)",
3102
+ gradientUnits: "userSpaceOnUse",
3103
+ y2: 0,
3104
+ x2: 1,
3105
+ y1: 0,
3106
+ x1: 0,
3107
+ children: [
3108
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3109
+ offset: 0,
3110
+ style: {
3111
+ stopOpacity: 1,
3112
+ stopColor: "#ff4e00"
3113
+ }
3114
+ }),
3115
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3116
+ offset: 1,
3117
+ style: {
3118
+ stopOpacity: 1,
3119
+ stopColor: "#ff1791"
3120
+ }
3121
+ })
3122
+ ]
3123
+ }),
3124
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3125
+ id: p,
3126
+ spreadMethod: "pad",
3127
+ gradientTransform: "matrix(521.97632 0 0 -521.97632 69.067 191.973)",
3128
+ gradientUnits: "userSpaceOnUse",
3129
+ y2: 0,
3130
+ x2: 1,
3131
+ y1: 0,
3132
+ x1: 0,
3133
+ children: [
3134
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3135
+ offset: 0,
3136
+ style: {
3137
+ stopOpacity: 1,
3138
+ stopColor: "#ff4e00"
3139
+ }
3140
+ }),
3141
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3142
+ offset: 1,
3143
+ style: {
3144
+ stopOpacity: 1,
3145
+ stopColor: "#ff1791"
3146
+ }
3147
+ })
3148
+ ]
3149
+ }),
3150
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3151
+ id: q,
3152
+ spreadMethod: "pad",
3153
+ gradientTransform: "matrix(523.09039 0 0 -523.09039 67.312 191.973)",
3154
+ gradientUnits: "userSpaceOnUse",
3155
+ y2: 0,
3156
+ x2: 1,
3157
+ y1: 0,
3158
+ x1: 0,
3159
+ children: [
3160
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3161
+ offset: 0,
3162
+ style: {
3163
+ stopOpacity: 1,
3164
+ stopColor: "#ff4e00"
3165
+ }
3166
+ }),
3167
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3168
+ offset: 1,
3169
+ style: {
3170
+ stopOpacity: 1,
3171
+ stopColor: "#ff1791"
3172
+ }
3173
+ })
3174
+ ]
3175
+ }),
3176
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("linearGradient", {
3177
+ id: r,
3178
+ spreadMethod: "pad",
3179
+ gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
3180
+ gradientUnits: "userSpaceOnUse",
3181
+ y2: 0,
3182
+ x2: 1,
3183
+ y1: 0,
3184
+ x1: 0,
3185
+ children: [
3186
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3187
+ offset: 0,
3188
+ style: {
3189
+ stopOpacity: 1,
3190
+ stopColor: "#ff4e00"
3191
+ }
3192
+ }),
3193
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("stop", {
3194
+ offset: 1,
3195
+ style: {
3196
+ stopOpacity: 1,
3197
+ stopColor: "#ff1791"
3198
+ }
3199
+ })
3200
+ ]
3201
+ }),
3202
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3203
+ id: a,
3204
+ clipPathUnits: "userSpaceOnUse",
3205
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3206
+ d: "M0 319h657.706V0H0Z"
3207
+ })
3208
+ }),
3209
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3210
+ id: b,
3211
+ clipPathUnits: "userSpaceOnUse",
3212
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3213
+ d: "M423.64 242h164.999V77H423.64Z"
3214
+ })
3215
+ }),
3216
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3217
+ id: e,
3218
+ clipPathUnits: "userSpaceOnUse",
3219
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3220
+ d: "M0 319h657.706V0H0Z"
3221
+ })
3222
+ }),
3223
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3224
+ id: f,
3225
+ clipPathUnits: "userSpaceOnUse",
3226
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3227
+ d: "M311.3 242h93.031V77H311.3Z"
3228
+ })
3229
+ }),
3230
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3231
+ id: h,
3232
+ clipPathUnits: "userSpaceOnUse",
3233
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3234
+ d: "M198.96 242h35.106V77H198.96Z"
3235
+ })
3236
+ }),
3237
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3238
+ id: n,
3239
+ clipPathUnits: "userSpaceOnUse",
3240
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3241
+ d: "M0 319h657.706V0H0Z"
3242
+ })
3243
+ }),
3244
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("clipPath", {
3245
+ id: o,
3246
+ clipPathUnits: "userSpaceOnUse",
3247
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3248
+ d: "M69.067 242H169.12V141.947H69.067Z"
3249
+ })
3250
+ })
3251
+ ]
3252
+ }),
3253
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3254
+ clipPath: `url(#${a})`,
3255
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
3256
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3257
+ style: {
3258
+ opacity: 0.69999701
3259
+ },
3260
+ clipPath: `url(#${b})`,
3261
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3262
+ style: {
3263
+ fill: `url(#${c})`,
3264
+ stroke: "none"
3265
+ },
3266
+ 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"
3267
+ })
3268
+ })
3269
+ }),
3270
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3271
+ style: {
3272
+ fill: `url(#${d})`,
3273
+ stroke: "none"
3274
+ },
3275
+ 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",
3276
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3277
+ }),
3278
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)("g", {
3279
+ clipPath: `url(#${e})`,
3280
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
3281
+ children: [
3282
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3283
+ style: {
3284
+ opacity: 0.69999701
3285
+ },
3286
+ clipPath: `url(#${f})`,
3287
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3288
+ style: {
3289
+ fill: `url(#${g})`,
3290
+ stroke: "none"
3291
+ },
3292
+ 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"
3293
+ })
3294
+ }),
3295
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3296
+ style: {
3297
+ opacity: 0.69999701
3298
+ },
3299
+ clipPath: `url(#${h})`,
3300
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3301
+ style: {
3302
+ fill: `url(#${i})`,
3303
+ stroke: "none"
3304
+ },
3305
+ 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"
3306
+ })
3307
+ })
3308
+ ]
3309
+ }),
3310
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3311
+ style: {
3312
+ fill: `url(#${j})`,
3313
+ stroke: "none"
3314
+ },
3315
+ 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",
3316
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3317
+ }),
3318
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3319
+ style: {
3320
+ fill: `url(#${k})`,
3321
+ stroke: "none"
3322
+ },
3323
+ 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",
3324
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3325
+ }),
3326
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3327
+ style: {
3328
+ fill: `url(#${l})`,
3329
+ stroke: "none"
3330
+ },
3331
+ 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",
3332
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3333
+ }),
3334
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3335
+ style: {
3336
+ fill: `url(#${m})`,
3337
+ stroke: "none"
3338
+ },
3339
+ 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",
3340
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3341
+ }),
3342
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3343
+ clipPath: `url(#${n})`,
3344
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
3345
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("g", {
3346
+ style: {
3347
+ opacity: 0.69999701
3348
+ },
3349
+ clipPath: `url(#${o})`,
3350
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3351
+ style: {
3352
+ fill: `url(#${p})`,
3353
+ stroke: "none"
3354
+ },
3355
+ 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"
3356
+ })
3357
+ })
3358
+ }),
3359
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3360
+ style: {
3361
+ fill: `url(#${q})`,
3362
+ stroke: "none"
3363
+ },
3364
+ 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",
3365
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3366
+ }),
3367
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("path", {
3368
+ style: {
3369
+ fill: `url(#${r})`,
3370
+ stroke: "none"
3371
+ },
3372
+ 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",
3373
+ transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
3374
+ })
3375
+ ]
3376
+ });
15
3377
  }
16
- var $parcel$global =
17
- typeof globalThis !== 'undefined'
18
- ? globalThis
19
- : typeof self !== 'undefined'
20
- ? self
21
- : typeof window !== 'undefined'
22
- ? window
23
- : typeof global !== 'undefined'
24
- ? global
25
- : {};
26
- var $parcel$modules = {};
27
- var $parcel$inits = {};
28
-
29
- var parcelRequire = $parcel$global["parcelRequire4c51"];
30
- if (parcelRequire == null) {
31
- parcelRequire = function(id) {
32
- if (id in $parcel$modules) {
33
- return $parcel$modules[id].exports;
34
- }
35
- if (id in $parcel$inits) {
36
- var init = $parcel$inits[id];
37
- delete $parcel$inits[id];
38
- var module = {id: id, exports: {}};
39
- $parcel$modules[id] = module;
40
- init.call(module.exports, module, module.exports);
41
- return module.exports;
42
- }
43
- var err = new Error("Cannot find module '" + id + "'");
44
- err.code = 'MODULE_NOT_FOUND';
45
- throw err;
46
- };
47
3378
 
48
- parcelRequire.register = function register(id, init) {
49
- $parcel$inits[id] = init;
50
- };
51
3379
 
52
- $parcel$global["parcelRequire4c51"] = parcelRequire;
3380
+ let $11947e4b4e6f3883$var$_ = (t1)=>t1, $11947e4b4e6f3883$var$t;
3381
+ const $11947e4b4e6f3883$var$Logo = (0, ($parcel$interopDefault($ayBmS$styledcomponents))).span($11947e4b4e6f3883$var$t || ($11947e4b4e6f3883$var$t = $11947e4b4e6f3883$var$_`
3382
+ display: inline-block;
3383
+ height: 0.8em;
3384
+ margin-right: 1em;
3385
+ transform: translate(0.3em, -0.2em);
3386
+ `));
3387
+ const $11947e4b4e6f3883$export$8b251419efc915eb = ()=>/*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
3388
+ children: [
3389
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)($11947e4b4e6f3883$var$Logo, {
3390
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $e3a8039a3d28e592$export$2e2bcd8739ae039), {
3391
+ height: 13
3392
+ })
3393
+ }),
3394
+ "API Credentials"
3395
+ ]
3396
+ });
3397
+
3398
+
3399
+
3400
+
3401
+
3402
+ function $4c82d5f60ad56557$var$FormField(props) {
3403
+ const { children: children , title: title , description: description , inputId: inputId } = props;
3404
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
3405
+ space: 1,
3406
+ children: [
3407
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
3408
+ align: "flex-end",
3409
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
3410
+ flex: 1,
3411
+ paddingY: 2,
3412
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Stack), {
3413
+ space: 2,
3414
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
3415
+ children: [
3416
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
3417
+ as: "label",
3418
+ htmlFor: inputId,
3419
+ weight: "semibold",
3420
+ size: 1,
3421
+ children: title || /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("em", {
3422
+ children: "Untitled"
3423
+ })
3424
+ }),
3425
+ description && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
3426
+ muted: true,
3427
+ size: 1,
3428
+ children: description
3429
+ })
3430
+ ]
3431
+ })
3432
+ })
3433
+ })
3434
+ }),
3435
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("div", {
3436
+ children: children
3437
+ })
3438
+ ]
3439
+ });
53
3440
  }
54
- parcelRequire.register("bf6Cb", function(module, exports) {
3441
+ var $4c82d5f60ad56557$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $ayBmS$react.memo)($4c82d5f60ad56557$var$FormField);
55
3442
 
56
- $parcel$export(module.exports, "name", () => $2ffcb7ef2a4a67d0$export$a8ff84c12d48cfa6);
57
- $parcel$export(module.exports, "cacheNs", () => $2ffcb7ef2a4a67d0$export$13cdb654d47e0703);
58
- $parcel$export(module.exports, "muxSecretsDocumentId", () => $2ffcb7ef2a4a67d0$export$64952397958089dd);
59
- const $2ffcb7ef2a4a67d0$export$a8ff84c12d48cfa6 = "mux-input";
60
- const $2ffcb7ef2a4a67d0$export$13cdb654d47e0703 = "sanity-plugin-mux-input";
61
- const $2ffcb7ef2a4a67d0$export$64952397958089dd = "secrets.mux";
62
3443
 
63
- });
3444
+ const $56bacf7dc6478771$var$fieldNames = [
3445
+ "token",
3446
+ "secretKey",
3447
+ "enableSignedUrls"
3448
+ ];
3449
+ function $56bacf7dc6478771$var$ConfigureApi({ secrets: secrets , setDialogState: setDialogState }) {
3450
+ const client = (0, $ayBmS$sanity.useClient)();
3451
+ const [state, dispatch] = (0, $f23684a2b0635ab0$export$e24a74f4fce2446c)(secrets);
3452
+ const hasSecretsInitially = (0, $ayBmS$react.useMemo)(()=>secrets.token && secrets.secretKey, [
3453
+ secrets
3454
+ ]);
3455
+ const handleClose = (0, $ayBmS$react.useCallback)(()=>setDialogState(false), [
3456
+ setDialogState
3457
+ ]);
3458
+ const dirty = (0, $ayBmS$react.useMemo)(()=>secrets.token !== state.token || secrets.secretKey !== state.secretKey || secrets.enableSignedUrls !== state.enableSignedUrls, [
3459
+ secrets,
3460
+ state
3461
+ ]);
3462
+ const id = `ConfigureApi${(0, $ayBmS$reachautoid.useId)()}`;
3463
+ const [tokenId, secretKeyId, enableSignedUrlsId] = (0, $ayBmS$react.useMemo)(()=>$56bacf7dc6478771$var$fieldNames.map((field)=>`${id}-${field}`), [
3464
+ id
3465
+ ]);
3466
+ const firstField = (0, $ayBmS$react.useRef)(null);
3467
+ const handleSaveSecrets = (0, $efecc0530b43438c$export$e1d4ef4fde5dbdf2)(client, secrets);
3468
+ const saving = (0, $ayBmS$react.useRef)(false);
3469
+ const handleSubmit = (0, $ayBmS$react.useCallback)((event)=>{
3470
+ event.preventDefault();
3471
+ if (!saving.current && event.currentTarget.reportValidity()) {
3472
+ saving.current = true;
3473
+ dispatch({
3474
+ type: "submit"
3475
+ });
3476
+ const { token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls } = state;
3477
+ handleSaveSecrets({
3478
+ token: token,
3479
+ secretKey: secretKey,
3480
+ enableSignedUrls: enableSignedUrls
3481
+ }).then((savedSecrets)=>{
3482
+ const { projectId: projectId , dataset: dataset } = client.config();
3483
+ (0, $ayBmS$suspendreact.clear)([
3484
+ (0, $764163079c542eaf$export$13cdb654d47e0703),
3485
+ (0, $ca60bbd6b265fe38$export$9c7ae676ac45430a),
3486
+ projectId,
3487
+ dataset
3488
+ ]);
3489
+ (0, $ayBmS$suspendreact.preload)(()=>Promise.resolve(savedSecrets), [
3490
+ (0, $764163079c542eaf$export$13cdb654d47e0703),
3491
+ (0, $ca60bbd6b265fe38$export$9c7ae676ac45430a),
3492
+ projectId,
3493
+ dataset
3494
+ ]);
3495
+ setDialogState(false);
3496
+ }).catch((err)=>dispatch({
3497
+ type: "error",
3498
+ payload: err.message
3499
+ })).finally(()=>{
3500
+ saving.current = false;
3501
+ });
3502
+ }
3503
+ }, [
3504
+ client,
3505
+ dispatch,
3506
+ handleSaveSecrets,
3507
+ setDialogState,
3508
+ state
3509
+ ]);
3510
+ const handleChangeToken = (0, $ayBmS$react.useCallback)((event)=>{
3511
+ dispatch({
3512
+ type: "change",
3513
+ payload: {
3514
+ name: "token",
3515
+ value: event.currentTarget.value
3516
+ }
3517
+ });
3518
+ }, [
3519
+ dispatch
3520
+ ]);
3521
+ const handleChangeSecretKey = (0, $ayBmS$react.useCallback)((event)=>{
3522
+ dispatch({
3523
+ type: "change",
3524
+ payload: {
3525
+ name: "secretKey",
3526
+ value: event.currentTarget.value
3527
+ }
3528
+ });
3529
+ }, [
3530
+ dispatch
3531
+ ]);
3532
+ const handleChangeEnableSignedUrls = (0, $ayBmS$react.useCallback)((event)=>{
3533
+ dispatch({
3534
+ type: "change",
3535
+ payload: {
3536
+ name: "enableSignedUrls",
3537
+ value: event.currentTarget.checked
3538
+ }
3539
+ });
3540
+ }, [
3541
+ dispatch
3542
+ ]);
3543
+ (0, $ayBmS$react.useEffect)(()=>{
3544
+ if (firstField.current) firstField.current.focus();
3545
+ }, [
3546
+ firstField
3547
+ ]);
3548
+ var _token, _secretKey;
3549
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Dialog), {
3550
+ id: id,
3551
+ onClose: handleClose,
3552
+ header: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $11947e4b4e6f3883$export$8b251419efc915eb), {}),
3553
+ width: 0,
3554
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
3555
+ padding: 4,
3556
+ style: {
3557
+ position: "relative"
3558
+ },
3559
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("form", {
3560
+ onSubmit: handleSubmit,
3561
+ noValidate: true,
3562
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
3563
+ space: 4,
3564
+ children: [
3565
+ !hasSecretsInitially && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
3566
+ padding: [
3567
+ 3,
3568
+ 3,
3569
+ 3
3570
+ ],
3571
+ radius: 2,
3572
+ shadow: 1,
3573
+ tone: "primary",
3574
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
3575
+ space: 3,
3576
+ children: [
3577
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Text), {
3578
+ size: 1,
3579
+ children: [
3580
+ "To set up a new access token, go to your",
3581
+ " ",
3582
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("a", {
3583
+ href: "https://dashboard.mux.com/settings/access-tokens",
3584
+ target: "_blank",
3585
+ rel: "noreferrer noopener",
3586
+ children: "account on mux.com"
3587
+ }),
3588
+ "."
3589
+ ]
3590
+ }),
3591
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Text), {
3592
+ size: 1,
3593
+ children: [
3594
+ "The access token needs permissions: ",
3595
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("strong", {
3596
+ children: "Mux Video "
3597
+ }),
3598
+ "(Full Access) and ",
3599
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("strong", {
3600
+ children: "Mux Data"
3601
+ }),
3602
+ " (Read)",
3603
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("br", {}),
3604
+ "The credentials will be stored safely in a hidden document only available to editors."
3605
+ ]
3606
+ })
3607
+ ]
3608
+ })
3609
+ }),
3610
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $4c82d5f60ad56557$export$2e2bcd8739ae039), {
3611
+ title: "Access Token",
3612
+ inputId: tokenId,
3613
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.TextInput), {
3614
+ id: tokenId,
3615
+ ref: firstField,
3616
+ onChange: handleChangeToken,
3617
+ type: "text",
3618
+ value: (_token = state.token) !== null && _token !== void 0 ? _token : "",
3619
+ required: !!state.secretKey || state.enableSignedUrls
3620
+ })
3621
+ }),
3622
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $4c82d5f60ad56557$export$2e2bcd8739ae039), {
3623
+ title: "Secret Key",
3624
+ inputId: secretKeyId,
3625
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.TextInput), {
3626
+ id: secretKeyId,
3627
+ onChange: handleChangeSecretKey,
3628
+ type: "text",
3629
+ value: (_secretKey = state.secretKey) !== null && _secretKey !== void 0 ? _secretKey : "",
3630
+ required: !!state.token || state.enableSignedUrls
3631
+ })
3632
+ }),
3633
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
3634
+ space: 4,
3635
+ children: [
3636
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
3637
+ align: "center",
3638
+ children: [
3639
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Checkbox), {
3640
+ id: enableSignedUrlsId,
3641
+ onChange: handleChangeEnableSignedUrls,
3642
+ checked: state.enableSignedUrls,
3643
+ style: {
3644
+ display: "block"
3645
+ }
3646
+ }),
3647
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
3648
+ flex: 1,
3649
+ paddingLeft: 3,
3650
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
3651
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("label", {
3652
+ htmlFor: enableSignedUrlsId,
3653
+ children: "Enable Signed Urls"
3654
+ })
3655
+ })
3656
+ })
3657
+ ]
3658
+ }),
3659
+ secrets.signingKeyId && state.enableSignedUrls ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
3660
+ padding: [
3661
+ 3,
3662
+ 3,
3663
+ 3
3664
+ ],
3665
+ radius: 2,
3666
+ shadow: 1,
3667
+ tone: "caution",
3668
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Stack), {
3669
+ space: 3,
3670
+ children: [
3671
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
3672
+ size: 1,
3673
+ children: "The signing key ID that Sanity will use is:"
3674
+ }),
3675
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Code), {
3676
+ size: 1,
3677
+ children: secrets.signingKeyId
3678
+ }),
3679
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Text), {
3680
+ size: 1,
3681
+ children: [
3682
+ "This key is only used for previewing content in the Sanity UI.",
3683
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("br", {}),
3684
+ "You should generate a different key to use in your application server."
3685
+ ]
3686
+ })
3687
+ ]
3688
+ })
3689
+ }) : null
3690
+ ]
3691
+ }),
3692
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Inline), {
3693
+ space: 2,
3694
+ children: [
3695
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
3696
+ text: "Save",
3697
+ disabled: !dirty,
3698
+ loading: state.submitting,
3699
+ tone: "primary",
3700
+ mode: "default",
3701
+ type: "submit"
3702
+ }),
3703
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
3704
+ disabled: state.submitting,
3705
+ text: "Cancel",
3706
+ mode: "bleed",
3707
+ onClick: handleClose
3708
+ })
3709
+ ]
3710
+ }),
3711
+ state.error && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
3712
+ padding: [
3713
+ 3,
3714
+ 3,
3715
+ 3
3716
+ ],
3717
+ radius: 2,
3718
+ shadow: 1,
3719
+ tone: "critical",
3720
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
3721
+ children: state.error
3722
+ })
3723
+ })
3724
+ ]
3725
+ })
3726
+ })
3727
+ })
3728
+ });
3729
+ }
3730
+ var $56bacf7dc6478771$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $ayBmS$react.memo)($56bacf7dc6478771$var$ConfigureApi);
64
3731
 
65
- parcelRequire.register("3PT7X", function(module, exports) {
66
3732
 
67
- $parcel$export(module.exports, "AspectRatioCard", () => $5f180d117773fee7$export$f0c88bc5a320387d);
68
- $parcel$export(module.exports, "InputFallback", () => $5f180d117773fee7$export$18fe723e8683ca03);
69
3733
 
70
3734
 
71
3735
 
72
3736
 
73
- const $5f180d117773fee7$export$f0c88bc5a320387d = (0, ($parcel$interopDefault($dyHF6$styledcomponents)))((0, $dyHF6$sanityui.Card))`
3737
+ let $3c6497e4f99ab548$var$_ = (t1)=>t1, $3c6497e4f99ab548$var$t;
3738
+ const $3c6497e4f99ab548$export$f0c88bc5a320387d = (0, ($parcel$interopDefault($ayBmS$styledcomponents)))((0, $ayBmS$sanityui.Card))($3c6497e4f99ab548$var$t || ($3c6497e4f99ab548$var$t = $3c6497e4f99ab548$var$_`
74
3739
  aspect-ratio: 16 / 9;
75
3740
  position: relative;
76
3741
  width: 100%;
77
- `;
78
- const $5f180d117773fee7$export$18fe723e8683ca03 = ()=>{
79
- return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("div", {
3742
+ `));
3743
+ const $3c6497e4f99ab548$export$18fe723e8683ca03 = ()=>{
3744
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("div", {
80
3745
  style: {
81
3746
  padding: 1
82
3747
  },
83
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Card), {
3748
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
84
3749
  shadow: 1,
85
3750
  sizing: "border",
86
3751
  style: {
@@ -88,18 +3753,18 @@ const $5f180d117773fee7$export$18fe723e8683ca03 = ()=>{
88
3753
  width: "100%",
89
3754
  borderRadius: "1px"
90
3755
  },
91
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Flex), {
3756
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Flex), {
92
3757
  align: "center",
93
3758
  direction: "column",
94
3759
  height: "fill",
95
3760
  justify: "center",
96
3761
  children: [
97
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Spinner), {
3762
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Spinner), {
98
3763
  muted: true
99
3764
  }),
100
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Box), {
3765
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Box), {
101
3766
  marginTop: 3,
102
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Text), {
3767
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Text), {
103
3768
  align: "center",
104
3769
  muted: true,
105
3770
  size: 1,
@@ -112,162 +3777,156 @@ const $5f180d117773fee7$export$18fe723e8683ca03 = ()=>{
112
3777
  });
113
3778
  };
114
3779
 
115
- });
116
-
117
- parcelRequire.register("4M4Xk", function(module, exports) {
118
- module.exports = Promise.resolve(require("./Input.ad849635.js")).then(()=>parcelRequire("lo0FW"));
119
-
120
- });
121
-
122
- parcelRequire.register("2vLfV", function(module, exports) {
123
- module.exports = Promise.resolve(require("./Preview.3e13819d.js")).then(()=>parcelRequire("cjJaV"));
124
-
125
- });
126
-
127
-
128
- $parcel$export(module.exports, "Input", () => $329a1cedcedb1349$export$f5b8910cec6cf069);
129
- $parcel$export(module.exports, "Preview", () => $329a1cedcedb1349$export$133773870222880f);
130
- $parcel$export(module.exports, "defaultConfig", () => $329a1cedcedb1349$export$f84bd70098573c5c);
131
- $parcel$export(module.exports, "muxInput", () => $329a1cedcedb1349$export$4d2e76c338bb9fbd);
132
-
133
3780
 
134
3781
 
135
3782
 
136
3783
 
137
3784
 
138
3785
 
139
-
140
-
141
-
142
- var $bf6Cb = parcelRequire("bf6Cb");
143
- function $440e5e6a7a1a5e7d$var$ErrorBoundaryCard(props) {
144
- const { children: children , schemaType: schemaType } = props;
145
- const { push: pushToast } = (0, $dyHF6$sanityui.useToast)();
146
- const errorRef = (0, $dyHF6$react.useRef)(null);
147
- const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error , reset: reset } = (0, $dyHF6$useerrorboundary.useErrorBoundary)({
148
- onDidCatch: (err, errorInfo)=>{
149
- console.group(err.toString());
150
- console.groupCollapsed("console.error");
151
- console.error(err);
152
- console.groupEnd();
153
- if (err.stack) {
154
- console.groupCollapsed("error.stack");
155
- console.log(err.stack);
156
- console.groupEnd();
157
- }
158
- if (errorInfo?.componentStack) {
159
- console.groupCollapsed("errorInfo.componentStack");
160
- console.log(errorInfo.componentStack);
161
- console.groupEnd();
162
- }
163
- console.groupEnd();
164
- pushToast({
165
- status: "error",
166
- title: "Plugin crashed",
167
- description: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Flex), {
168
- align: "center",
169
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Inline), {
170
- space: 1,
171
- children: [
172
- "An error happened while rendering",
173
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
174
- padding: 1,
175
- fontSize: 1,
176
- style: {
177
- transform: "translateY(1px)"
178
- },
179
- mode: "ghost",
180
- text: schemaType.title,
181
- onClick: ()=>{
182
- if (errorRef.current) (0, ($parcel$interopDefault($dyHF6$scrollintoviewifneeded)))(errorRef.current, {
183
- behavior: "smooth",
184
- scrollMode: "if-needed",
185
- block: "center"
186
- });
187
- }
188
- })
189
- ]
190
- })
191
- })
192
- });
193
- }
194
- });
195
- const handleRetry = (0, $dyHF6$react.useCallback)(()=>{
196
- // Purge request cache before retrying, otherwise the cached errors will rethrow
197
- (0, $dyHF6$suspendreact.clear)([
198
- (0, $bf6Cb.name)
199
- ]);
200
- reset();
201
- }, [
202
- reset
3786
+ function $8283748ba76c562e$export$2e2bcd8739ae039(props) {
3787
+ const { setDialogState: setDialogState } = props;
3788
+ const handleOpen = (0, $ayBmS$react.useCallback)(()=>setDialogState("secrets"), [
3789
+ setDialogState
203
3790
  ]);
204
- if (didCatch) return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Card), {
205
- ref: errorRef,
206
- paddingX: [
207
- 2,
208
- 3,
209
- 4,
210
- 4
211
- ],
212
- height: "fill",
213
- shadow: 1,
214
- overflow: "auto",
215
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Flex), {
216
- justify: "flex-start",
217
- align: "center",
218
- height: "fill",
219
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Grid), {
220
- columns: 1,
221
- gap: [
3791
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$reactjsxruntime.Fragment), {
3792
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("div", {
3793
+ style: {
3794
+ padding: 2
3795
+ },
3796
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Card), {
3797
+ display: "flex",
3798
+ sizing: "border",
3799
+ style: {
3800
+ aspectRatio: "16/9",
3801
+ width: "100%",
3802
+ boxShadow: "var(--card-bg-color) 0 0 0 2px"
3803
+ },
3804
+ paddingX: [
222
3805
  2,
223
3806
  3,
224
3807
  4,
225
3808
  4
226
3809
  ],
227
- children: [
228
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Heading), {
229
- as: "h1",
3810
+ radius: 1,
3811
+ tone: "transparent",
3812
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Flex), {
3813
+ justify: "flex-start",
3814
+ align: "center",
3815
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$sanityui.Grid), {
3816
+ columns: 1,
3817
+ gap: [
3818
+ 2,
3819
+ 3,
3820
+ 4,
3821
+ 4
3822
+ ],
230
3823
  children: [
231
- "The ",
232
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("code", {
233
- children: (0, $bf6Cb.name)
3824
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Inline), {
3825
+ paddingY: 1,
3826
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)("div", {
3827
+ style: {
3828
+ height: "32px"
3829
+ },
3830
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $e3a8039a3d28e592$export$2e2bcd8739ae039), {})
3831
+ })
234
3832
  }),
235
- " plugin crashed"
3833
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Inline), {
3834
+ paddingY: 1,
3835
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Heading), {
3836
+ size: [
3837
+ 0,
3838
+ 1,
3839
+ 2,
3840
+ 2
3841
+ ],
3842
+ children: "Upload and preview videos directly from your studio."
3843
+ })
3844
+ }),
3845
+ /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Inline), {
3846
+ paddingY: 1,
3847
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanityui.Button), {
3848
+ mode: "ghost",
3849
+ icon: (0, $ayBmS$sanityicons.PlugIcon),
3850
+ text: "Configure API",
3851
+ onClick: handleOpen
3852
+ })
3853
+ })
236
3854
  ]
237
- }),
238
- error?.message && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Card), {
239
- padding: 3,
240
- tone: "critical",
241
- shadow: 1,
242
- radius: 2,
243
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Text), {
244
- children: error.message
245
- })
246
- }),
247
- /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Inline), {
248
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
249
- onClick: handleRetry,
250
- text: "Retry"
251
- })
252
3855
  })
253
- ]
3856
+ })
254
3857
  })
255
3858
  })
256
3859
  });
257
- return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)(ErrorBoundary, {
258
- children: children
259
- });
260
3860
  }
261
- var $440e5e6a7a1a5e7d$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $dyHF6$react.memo)($440e5e6a7a1a5e7d$var$ErrorBoundaryCard);
262
3861
 
263
3862
 
3863
+ const $7988e690e4a01972$var$Input = (props)=>{
3864
+ var ref;
3865
+ const client = (0, $ayBmS$sanity.useClient)();
3866
+ const secretDocumentValues = (0, $e0562e9a5cd26710$export$4c2801830a129eb)();
3867
+ const assetDocumentValues = (0, $91e90464b4ca45aa$export$e11a382d55e07f75)((ref = props.value) === null || ref === void 0 ? void 0 : ref.asset);
3868
+ const poll = (0, $b098b0d885e904ff$export$fd270df25d7dbb88)(props.readOnly ? undefined : (assetDocumentValues === null || assetDocumentValues === void 0 ? void 0 : assetDocumentValues.value) || undefined);
3869
+ const [dialogState, setDialogState] = (0, $8ea54a6e4798432c$export$573903f1c655c034)();
3870
+ const error = secretDocumentValues.error || assetDocumentValues.error || poll.error /*||
3871
+ // @TODO move errored logic to Uploader, where handleRemoveVideo can be called
3872
+ (assetDocumentValues.value?.status === 'errored'
3873
+ ? new Error(assetDocumentValues.value.data?.errors?.messages?.join(' '))
3874
+ : undefined)
3875
+ // */ ;
3876
+ if (error) // @TODO deal with it more gracefully
3877
+ throw error;
3878
+ const isLoading = secretDocumentValues.isLoading || assetDocumentValues.isLoading;
3879
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$reactjsxruntime.Fragment), {
3880
+ children: isLoading ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $3c6497e4f99ab548$export$18fe723e8683ca03), {}) : /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsxs)((0, $ayBmS$reactjsxruntime.Fragment), {
3881
+ children: [
3882
+ secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $8283748ba76c562e$export$2e2bcd8739ae039), {
3883
+ setDialogState: setDialogState
3884
+ }) : /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $e43e21f1b2fe430e$export$2e2bcd8739ae039), (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spread_propsjs)))((0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, props), {
3885
+ client: client,
3886
+ secrets: secretDocumentValues.value.secrets,
3887
+ asset: assetDocumentValues.value,
3888
+ dialogState: dialogState,
3889
+ setDialogState: setDialogState,
3890
+ needsSetup: secretDocumentValues.value.needsSetup
3891
+ })),
3892
+ dialogState === "secrets" && /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $56bacf7dc6478771$export$2e2bcd8739ae039), {
3893
+ setDialogState: setDialogState,
3894
+ secrets: secretDocumentValues.value.secrets
3895
+ })
3896
+ ]
3897
+ })
3898
+ });
3899
+ };
3900
+ var $7988e690e4a01972$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $ayBmS$react.memo)($7988e690e4a01972$var$Input);
3901
+
3902
+
3903
+
3904
+
3905
+
3906
+
3907
+
3908
+
3909
+ const $a1523ee7ee9b753a$var$MuxVideoPreview = ({ value: value })=>{
3910
+ const assetDocumentValues = (0, $91e90464b4ca45aa$export$e11a382d55e07f75)(value === null || value === void 0 ? void 0 : value.asset);
3911
+ if (assetDocumentValues.value) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $b4359f9e5317addd$export$bd4b73f15688a160), {
3912
+ asset: assetDocumentValues.value,
3913
+ width: 640
3914
+ });
3915
+ // @ts-expect-error
3916
+ const { filename: filename , playbackId: playbackId , status: status } = value !== null && value !== void 0 ? value : {};
3917
+ return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$sanity_unstable.SanityDefaultPreview), {
3918
+ title: filename || playbackId || "",
3919
+ subtitle: status ? `status: ${status}` : null
3920
+ });
3921
+ };
3922
+ var $a1523ee7ee9b753a$export$2e2bcd8739ae039 = $a1523ee7ee9b753a$var$MuxVideoPreview;
3923
+
264
3924
 
265
- var $3PT7X = parcelRequire("3PT7X");
266
3925
 
267
3926
 
268
- const $75523cdda380b780$export$a8ff84c12d48cfa6 = "mux.videoAsset";
269
- const $75523cdda380b780$var$videoAsset = (0, $dyHF6$sanity.defineField)({
270
- name: $75523cdda380b780$export$a8ff84c12d48cfa6,
3927
+ const $aa6f8a8b344a9a01$export$a8ff84c12d48cfa6 = "mux.videoAsset";
3928
+ const $aa6f8a8b344a9a01$var$videoAsset = (0, $ayBmS$sanity.defineField)({
3929
+ name: $aa6f8a8b344a9a01$export$a8ff84c12d48cfa6,
271
3930
  type: "object",
272
3931
  title: "Video asset",
273
3932
  fields: [
@@ -293,12 +3952,12 @@ const $75523cdda380b780$var$videoAsset = (0, $dyHF6$sanity.defineField)({
293
3952
  },
294
3953
  ]
295
3954
  });
296
- var $75523cdda380b780$export$2e2bcd8739ae039 = $75523cdda380b780$var$videoAsset;
3955
+ var $aa6f8a8b344a9a01$export$2e2bcd8739ae039 = $aa6f8a8b344a9a01$var$videoAsset;
297
3956
 
298
3957
 
299
- const $ac55e63956aa9e84$export$a8ff84c12d48cfa6 = "mux.video";
300
- const $ac55e63956aa9e84$var$video = (0, $dyHF6$sanity.defineField)({
301
- name: $ac55e63956aa9e84$export$a8ff84c12d48cfa6,
3958
+ const $c9d039407c122263$export$a8ff84c12d48cfa6 = "mux.video";
3959
+ const $c9d039407c122263$var$video = (0, $ayBmS$sanity.defineField)({
3960
+ name: $c9d039407c122263$export$a8ff84c12d48cfa6,
302
3961
  type: "object",
303
3962
  title: "Video asset reference",
304
3963
  fields: [
@@ -309,69 +3968,61 @@ const $ac55e63956aa9e84$var$video = (0, $dyHF6$sanity.defineField)({
309
3968
  weak: true,
310
3969
  to: [
311
3970
  {
312
- type: (0, $75523cdda380b780$export$a8ff84c12d48cfa6)
3971
+ type: (0, $aa6f8a8b344a9a01$export$a8ff84c12d48cfa6)
313
3972
  }
314
3973
  ]
315
3974
  },
316
3975
  ]
317
3976
  });
318
- var $ac55e63956aa9e84$export$2e2bcd8739ae039 = $ac55e63956aa9e84$var$video;
3977
+ var $c9d039407c122263$export$2e2bcd8739ae039 = $c9d039407c122263$var$video;
319
3978
 
320
3979
 
321
3980
 
322
3981
 
323
3982
 
324
- function $0c6ceed5d95aa3e9$export$c8119cbbd1c84da1(props) {
325
- return (0, $dyHF6$sanity.isObjectSchemaType)(props.schemaType) && props.schemaType.type?.name === (0, $ac55e63956aa9e84$export$a8ff84c12d48cfa6);
3983
+ function $aa910bb01208cd6d$export$c8119cbbd1c84da1(props) {
3984
+ var ref;
3985
+ return (0, $ayBmS$sanity.isObjectSchemaType)(props.schemaType) && ((ref = props.schemaType.type) === null || ref === void 0 ? void 0 : ref.name) === (0, $c9d039407c122263$export$a8ff84c12d48cfa6);
326
3986
  }
327
- function $0c6ceed5d95aa3e9$export$3542974c36e4d83f(props) {
328
- return props.schemaType.type?.name === (0, $ac55e63956aa9e84$export$a8ff84c12d48cfa6);
3987
+ function $aa910bb01208cd6d$export$3542974c36e4d83f(props) {
3988
+ var ref;
3989
+ return ((ref = props.schemaType.type) === null || ref === void 0 ? void 0 : ref.name) === (0, $c9d039407c122263$export$a8ff84c12d48cfa6);
329
3990
  }
330
3991
 
331
3992
 
332
-
333
- const $329a1cedcedb1349$export$f5b8910cec6cf069 = /*#__PURE__*/ (0, $dyHF6$react.lazy)(()=>(parcelRequire("4M4Xk")));
334
-
335
- const $329a1cedcedb1349$export$133773870222880f = /*#__PURE__*/ (0, $dyHF6$react.lazy)(()=>(parcelRequire("2vLfV")));
336
- const $329a1cedcedb1349$export$f84bd70098573c5c = {
3993
+ const $35eb69de8ff825b5$export$f84bd70098573c5c = {
337
3994
  mp4_support: "none"
338
3995
  };
339
- const $329a1cedcedb1349$export$4d2e76c338bb9fbd = (0, $dyHF6$sanity.createPlugin)((userConfig)=>{
340
- const config = {
341
- ...$329a1cedcedb1349$export$f84bd70098573c5c,
342
- ...userConfig
343
- };
3996
+ const $35eb69de8ff825b5$export$4d2e76c338bb9fbd = (0, $ayBmS$sanity.createPlugin)((userConfig)=>{
3997
+ const config = (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, $35eb69de8ff825b5$export$f84bd70098573c5c, userConfig);
344
3998
  return {
345
3999
  name: "mux-input",
346
4000
  form: {
347
4001
  renderInput (props, next) {
348
- if ((0, $0c6ceed5d95aa3e9$export$c8119cbbd1c84da1)(props)) return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $3PT7X.AspectRatioCard), {
349
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $440e5e6a7a1a5e7d$export$2e2bcd8739ae039), {
4002
+ if ((0, $aa910bb01208cd6d$export$c8119cbbd1c84da1)(props)) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $3c6497e4f99ab548$export$f0c88bc5a320387d), {
4003
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $23a5e4ef1c8a3996$export$2e2bcd8739ae039), {
350
4004
  schemaType: props.schemaType,
351
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$react.Suspense), {
352
- fallback: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $3PT7X.InputFallback), {}),
353
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($329a1cedcedb1349$export$f5b8910cec6cf069, {
354
- config: config,
355
- ...props
356
- })
4005
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $ayBmS$react.Suspense), {
4006
+ fallback: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $3c6497e4f99ab548$export$18fe723e8683ca03), {}),
4007
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $7988e690e4a01972$export$2e2bcd8739ae039), (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({
4008
+ config: config
4009
+ }, props))
357
4010
  })
358
4011
  })
359
4012
  });
360
4013
  return next(props);
361
4014
  },
362
4015
  renderPreview (props, next) {
363
- if ((0, $0c6ceed5d95aa3e9$export$3542974c36e4d83f)(props)) return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $3PT7X.AspectRatioCard), {
364
- children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($329a1cedcedb1349$export$133773870222880f, {
365
- ...props
366
- })
4016
+ if ((0, $aa910bb01208cd6d$export$3542974c36e4d83f)(props)) return /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $3c6497e4f99ab548$export$f0c88bc5a320387d), {
4017
+ children: /*#__PURE__*/ (0, $ayBmS$reactjsxruntime.jsx)((0, $a1523ee7ee9b753a$export$2e2bcd8739ae039), (0, ($parcel$interopDefault($ayBmS$swchelperslib_object_spreadjs)))({}, props))
367
4018
  });
368
4019
  return next(props);
369
4020
  }
370
4021
  },
371
4022
  schema: {
372
4023
  types: [
373
- (0, $ac55e63956aa9e84$export$2e2bcd8739ae039),
374
- (0, $75523cdda380b780$export$2e2bcd8739ae039)
4024
+ (0, $c9d039407c122263$export$2e2bcd8739ae039),
4025
+ (0, $aa6f8a8b344a9a01$export$2e2bcd8739ae039)
375
4026
  ]
376
4027
  }
377
4028
  };