react-iiif-vault 1.0.6 → 1.0.8

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.
@@ -1217,23 +1217,24 @@ function On(e, t) {
1217
1217
  }
1218
1218
  const kn = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1219
1219
  function Fn(e, t) {
1220
- var a;
1221
- const n = t.items.filter((s) => s.type === "video");
1222
- if (!e.duration)
1223
- return E("No duration on canvas");
1224
- if (n.length > 1)
1220
+ var s;
1221
+ const n = t.items.filter((c) => c.type === "video");
1222
+ let r = !1;
1223
+ if (e.duration || (r = !0), n.length > 1)
1225
1224
  return E("Only one video source supported");
1226
- const r = (a = n[0]) == null ? void 0 : a.resource, i = !!(r.service || []).find(
1227
- (s) => (s.profile || "").includes("youtube.com")
1225
+ const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1226
+ (c) => (c.profile || "").includes("youtube.com")
1228
1227
  );
1229
- if (!r)
1228
+ if (!o && r)
1229
+ return E("Video does not have duration");
1230
+ if (!i)
1230
1231
  return E("Unknown video");
1231
- if ((!r.format || r.format === "text/html") && !i)
1232
+ if ((!i.format || i.format === "text/html") && !o)
1232
1233
  return E("Video does not have format");
1233
- const o = {
1234
+ const a = {
1234
1235
  annotationId: t.items[0].annotationId,
1235
1236
  duration: e.duration,
1236
- url: r.id,
1237
+ url: i.id,
1237
1238
  type: "Video",
1238
1239
  items: [],
1239
1240
  target: {
@@ -1243,7 +1244,7 @@ function Fn(e, t) {
1243
1244
  endTime: e.duration
1244
1245
  }
1245
1246
  },
1246
- format: r.format,
1247
+ format: i.format,
1247
1248
  selector: {
1248
1249
  type: "TemporalSelector",
1249
1250
  temporal: {
@@ -1252,16 +1253,16 @@ function Fn(e, t) {
1252
1253
  }
1253
1254
  }
1254
1255
  };
1255
- if (i) {
1256
- o.type = "VideoYouTube";
1257
- const s = r.id.match(kn);
1258
- if (!s[1])
1256
+ if (o) {
1257
+ a.type = "VideoYouTube";
1258
+ const c = i.id.match(kn);
1259
+ if (!c[1])
1259
1260
  return E("Video is not known youtube video");
1260
- o.youTubeId = s[1];
1261
+ a.youTubeId = c[1];
1261
1262
  }
1262
1263
  return {
1263
1264
  type: "media",
1264
- media: o,
1265
+ media: a,
1265
1266
  annotations: {
1266
1267
  pages: []
1267
1268
  }