@tailor-cms/ce-brightcove-video-display 0.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,262 +1,707 @@
1
- import "./index.css";
2
- import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, resolveComponent, createElementBlock, openBlock, createBlock, createCommentVNode, withDirectives, withCtx, createVNode, createElementVNode, vShow } from "vue";
1
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, onBeforeUnmount, onMounted, openBlock, ref, resolveComponent, unref, vShow, watch, withCtx, withDirectives } from "vue";
2
+ import './index.css';//#region ../manifest/dist/index.mjs
3
3
  var type = "BRIGHTCOVE_VIDEO";
4
4
  var name = "Brightcove Video";
5
5
  var initState = () => ({
6
- accountId: "",
7
- playerId: "",
8
- videoId: ""
6
+ accountId: "",
7
+ playerId: "",
8
+ videoId: ""
9
9
  });
10
- var ui = {
11
- // Display icon, https://pictogrammers.com/library/mdi/
12
- icon: "mdi-video",
13
- // Does element support only full width or can be used within layouts
14
- // (e.g. 50/50 layout)
15
- forceFullWidth: false
16
- };
10
+ var isEmpty = (data) => !data.videoId;
17
11
  var manifest$1 = {
18
- type,
19
- version: "1.0",
20
- name,
21
- ssr: false,
22
- initState,
23
- ui
12
+ type,
13
+ version: "1.0",
14
+ name,
15
+ ssr: false,
16
+ initState,
17
+ isEmpty,
18
+ ui: {
19
+ icon: "mdi-video",
20
+ forceFullWidth: false
21
+ }
24
22
  };
25
- var index_default = manifest$1;
23
+ //#endregion
24
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
25
+ /** Detect free variable `global` from Node.js. */
26
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
27
+ //#endregion
28
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js
29
+ /** Detect free variable `self`. */
30
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
31
+ /** Used as a reference to the global object. */
32
+ var root = freeGlobal || freeSelf || Function("return this")();
33
+ //#endregion
34
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js
35
+ /** Built-in value references. */
36
+ var Symbol = root.Symbol;
37
+ //#endregion
38
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js
39
+ /** Used for built-in method references. */
40
+ var objectProto = Object.prototype;
41
+ /** Used to check objects for own properties. */
42
+ var hasOwnProperty = objectProto.hasOwnProperty;
43
+ /**
44
+ * Used to resolve the
45
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
46
+ * of values.
47
+ */
48
+ var nativeObjectToString$1 = objectProto.toString;
49
+ /** Built-in value references. */
50
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : void 0;
51
+ /**
52
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
53
+ *
54
+ * @private
55
+ * @param {*} value The value to query.
56
+ * @returns {string} Returns the raw `toStringTag`.
57
+ */
58
+ function getRawTag(value) {
59
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
60
+ try {
61
+ value[symToStringTag$1] = void 0;
62
+ var unmasked = true;
63
+ } catch (e) {}
64
+ var result = nativeObjectToString$1.call(value);
65
+ if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
66
+ else delete value[symToStringTag$1];
67
+ return result;
68
+ }
69
+ //#endregion
70
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
71
+ /**
72
+ * Used to resolve the
73
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
74
+ * of values.
75
+ */
76
+ var nativeObjectToString = Object.prototype.toString;
77
+ /**
78
+ * Converts `value` to a string using `Object.prototype.toString`.
79
+ *
80
+ * @private
81
+ * @param {*} value The value to convert.
82
+ * @returns {string} Returns the converted string.
83
+ */
84
+ function objectToString(value) {
85
+ return nativeObjectToString.call(value);
86
+ }
87
+ //#endregion
88
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
89
+ /** `Object#toString` result references. */
90
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
91
+ /** Built-in value references. */
92
+ var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
93
+ /**
94
+ * The base implementation of `getTag` without fallbacks for buggy environments.
95
+ *
96
+ * @private
97
+ * @param {*} value The value to query.
98
+ * @returns {string} Returns the `toStringTag`.
99
+ */
100
+ function baseGetTag(value) {
101
+ if (value == null) return value === void 0 ? undefinedTag : nullTag;
102
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
103
+ }
104
+ //#endregion
105
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
106
+ /**
107
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
108
+ * and has a `typeof` result of "object".
109
+ *
110
+ * @static
111
+ * @memberOf _
112
+ * @since 4.0.0
113
+ * @category Lang
114
+ * @param {*} value The value to check.
115
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
116
+ * @example
117
+ *
118
+ * _.isObjectLike({});
119
+ * // => true
120
+ *
121
+ * _.isObjectLike([1, 2, 3]);
122
+ * // => true
123
+ *
124
+ * _.isObjectLike(_.noop);
125
+ * // => false
126
+ *
127
+ * _.isObjectLike(null);
128
+ * // => false
129
+ */
130
+ function isObjectLike(value) {
131
+ return value != null && typeof value == "object";
132
+ }
133
+ //#endregion
134
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js
135
+ /** `Object#toString` result references. */
136
+ var symbolTag = "[object Symbol]";
137
+ /**
138
+ * Checks if `value` is classified as a `Symbol` primitive or object.
139
+ *
140
+ * @static
141
+ * @memberOf _
142
+ * @since 4.0.0
143
+ * @category Lang
144
+ * @param {*} value The value to check.
145
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
146
+ * @example
147
+ *
148
+ * _.isSymbol(Symbol.iterator);
149
+ * // => true
150
+ *
151
+ * _.isSymbol('abc');
152
+ * // => false
153
+ */
154
+ function isSymbol(value) {
155
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
156
+ }
157
+ //#endregion
158
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
159
+ /** Used to match a single whitespace character. */
160
+ var reWhitespace = /\s/;
161
+ /**
162
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
163
+ * character of `string`.
164
+ *
165
+ * @private
166
+ * @param {string} string The string to inspect.
167
+ * @returns {number} Returns the index of the last non-whitespace character.
168
+ */
169
+ function trimmedEndIndex(string) {
170
+ var index = string.length;
171
+ while (index-- && reWhitespace.test(string.charAt(index)));
172
+ return index;
173
+ }
174
+ //#endregion
175
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
176
+ /** Used to match leading whitespace. */
177
+ var reTrimStart = /^\s+/;
178
+ /**
179
+ * The base implementation of `_.trim`.
180
+ *
181
+ * @private
182
+ * @param {string} string The string to trim.
183
+ * @returns {string} Returns the trimmed string.
184
+ */
185
+ function baseTrim(string) {
186
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
187
+ }
188
+ //#endregion
189
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
190
+ /**
191
+ * Checks if `value` is the
192
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
193
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
194
+ *
195
+ * @static
196
+ * @memberOf _
197
+ * @since 0.1.0
198
+ * @category Lang
199
+ * @param {*} value The value to check.
200
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
201
+ * @example
202
+ *
203
+ * _.isObject({});
204
+ * // => true
205
+ *
206
+ * _.isObject([1, 2, 3]);
207
+ * // => true
208
+ *
209
+ * _.isObject(_.noop);
210
+ * // => true
211
+ *
212
+ * _.isObject(null);
213
+ * // => false
214
+ */
215
+ function isObject(value) {
216
+ var type = typeof value;
217
+ return value != null && (type == "object" || type == "function");
218
+ }
219
+ //#endregion
220
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
221
+ /** Used as references for various `Number` constants. */
222
+ var NAN = NaN;
223
+ /** Used to detect bad signed hexadecimal string values. */
224
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
225
+ /** Used to detect binary string values. */
226
+ var reIsBinary = /^0b[01]+$/i;
227
+ /** Used to detect octal string values. */
228
+ var reIsOctal = /^0o[0-7]+$/i;
229
+ /** Built-in method references without a dependency on `root`. */
230
+ var freeParseInt = parseInt;
231
+ /**
232
+ * Converts `value` to a number.
233
+ *
234
+ * @static
235
+ * @memberOf _
236
+ * @since 4.0.0
237
+ * @category Lang
238
+ * @param {*} value The value to process.
239
+ * @returns {number} Returns the number.
240
+ * @example
241
+ *
242
+ * _.toNumber(3.2);
243
+ * // => 3.2
244
+ *
245
+ * _.toNumber(Number.MIN_VALUE);
246
+ * // => 5e-324
247
+ *
248
+ * _.toNumber(Infinity);
249
+ * // => Infinity
250
+ *
251
+ * _.toNumber('3.2');
252
+ * // => 3.2
253
+ */
254
+ function toNumber(value) {
255
+ if (typeof value == "number") return value;
256
+ if (isSymbol(value)) return NAN;
257
+ if (isObject(value)) {
258
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
259
+ value = isObject(other) ? other + "" : other;
260
+ }
261
+ if (typeof value != "string") return value === 0 ? value : +value;
262
+ value = baseTrim(value);
263
+ var isBinary = reIsBinary.test(value);
264
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
265
+ }
266
+ //#endregion
267
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
268
+ /**
269
+ * Gets the timestamp of the number of milliseconds that have elapsed since
270
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
271
+ *
272
+ * @static
273
+ * @memberOf _
274
+ * @since 2.4.0
275
+ * @category Date
276
+ * @returns {number} Returns the timestamp.
277
+ * @example
278
+ *
279
+ * _.defer(function(stamp) {
280
+ * console.log(_.now() - stamp);
281
+ * }, _.now());
282
+ * // => Logs the number of milliseconds it took for the deferred invocation.
283
+ */
284
+ var now = function() {
285
+ return root.Date.now();
286
+ };
287
+ //#endregion
288
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/debounce.js
289
+ /** Error message constants. */
290
+ var FUNC_ERROR_TEXT$1 = "Expected a function";
291
+ var nativeMax = Math.max, nativeMin = Math.min;
292
+ /**
293
+ * Creates a debounced function that delays invoking `func` until after `wait`
294
+ * milliseconds have elapsed since the last time the debounced function was
295
+ * invoked. The debounced function comes with a `cancel` method to cancel
296
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
297
+ * Provide `options` to indicate whether `func` should be invoked on the
298
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
299
+ * with the last arguments provided to the debounced function. Subsequent
300
+ * calls to the debounced function return the result of the last `func`
301
+ * invocation.
302
+ *
303
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
304
+ * invoked on the trailing edge of the timeout only if the debounced function
305
+ * is invoked more than once during the `wait` timeout.
306
+ *
307
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
308
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
309
+ *
310
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
311
+ * for details over the differences between `_.debounce` and `_.throttle`.
312
+ *
313
+ * @static
314
+ * @memberOf _
315
+ * @since 0.1.0
316
+ * @category Function
317
+ * @param {Function} func The function to debounce.
318
+ * @param {number} [wait=0] The number of milliseconds to delay.
319
+ * @param {Object} [options={}] The options object.
320
+ * @param {boolean} [options.leading=false]
321
+ * Specify invoking on the leading edge of the timeout.
322
+ * @param {number} [options.maxWait]
323
+ * The maximum time `func` is allowed to be delayed before it's invoked.
324
+ * @param {boolean} [options.trailing=true]
325
+ * Specify invoking on the trailing edge of the timeout.
326
+ * @returns {Function} Returns the new debounced function.
327
+ * @example
328
+ *
329
+ * // Avoid costly calculations while the window size is in flux.
330
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
331
+ *
332
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
333
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
334
+ * 'leading': true,
335
+ * 'trailing': false
336
+ * }));
337
+ *
338
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
339
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
340
+ * var source = new EventSource('/stream');
341
+ * jQuery(source).on('message', debounced);
342
+ *
343
+ * // Cancel the trailing debounced invocation.
344
+ * jQuery(window).on('popstate', debounced.cancel);
345
+ */
346
+ function debounce(func, wait, options) {
347
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
348
+ if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT$1);
349
+ wait = toNumber(wait) || 0;
350
+ if (isObject(options)) {
351
+ leading = !!options.leading;
352
+ maxing = "maxWait" in options;
353
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
354
+ trailing = "trailing" in options ? !!options.trailing : trailing;
355
+ }
356
+ function invokeFunc(time) {
357
+ var args = lastArgs, thisArg = lastThis;
358
+ lastArgs = lastThis = void 0;
359
+ lastInvokeTime = time;
360
+ result = func.apply(thisArg, args);
361
+ return result;
362
+ }
363
+ function leadingEdge(time) {
364
+ lastInvokeTime = time;
365
+ timerId = setTimeout(timerExpired, wait);
366
+ return leading ? invokeFunc(time) : result;
367
+ }
368
+ function remainingWait(time) {
369
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
370
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
371
+ }
372
+ function shouldInvoke(time) {
373
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
374
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
375
+ }
376
+ function timerExpired() {
377
+ var time = now();
378
+ if (shouldInvoke(time)) return trailingEdge(time);
379
+ timerId = setTimeout(timerExpired, remainingWait(time));
380
+ }
381
+ function trailingEdge(time) {
382
+ timerId = void 0;
383
+ if (trailing && lastArgs) return invokeFunc(time);
384
+ lastArgs = lastThis = void 0;
385
+ return result;
386
+ }
387
+ function cancel() {
388
+ if (timerId !== void 0) clearTimeout(timerId);
389
+ lastInvokeTime = 0;
390
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
391
+ }
392
+ function flush() {
393
+ return timerId === void 0 ? result : trailingEdge(now());
394
+ }
395
+ function debounced() {
396
+ var time = now(), isInvoking = shouldInvoke(time);
397
+ lastArgs = arguments;
398
+ lastThis = this;
399
+ lastCallTime = time;
400
+ if (isInvoking) {
401
+ if (timerId === void 0) return leadingEdge(lastCallTime);
402
+ if (maxing) {
403
+ clearTimeout(timerId);
404
+ timerId = setTimeout(timerExpired, wait);
405
+ return invokeFunc(lastCallTime);
406
+ }
407
+ }
408
+ if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
409
+ return result;
410
+ }
411
+ debounced.cancel = cancel;
412
+ debounced.flush = flush;
413
+ return debounced;
414
+ }
415
+ //#endregion
416
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/throttle.js
417
+ /** Error message constants. */
418
+ var FUNC_ERROR_TEXT = "Expected a function";
419
+ /**
420
+ * Creates a throttled function that only invokes `func` at most once per
421
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
422
+ * method to cancel delayed `func` invocations and a `flush` method to
423
+ * immediately invoke them. Provide `options` to indicate whether `func`
424
+ * should be invoked on the leading and/or trailing edge of the `wait`
425
+ * timeout. The `func` is invoked with the last arguments provided to the
426
+ * throttled function. Subsequent calls to the throttled function return the
427
+ * result of the last `func` invocation.
428
+ *
429
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
430
+ * invoked on the trailing edge of the timeout only if the throttled function
431
+ * is invoked more than once during the `wait` timeout.
432
+ *
433
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
434
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
435
+ *
436
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
437
+ * for details over the differences between `_.throttle` and `_.debounce`.
438
+ *
439
+ * @static
440
+ * @memberOf _
441
+ * @since 0.1.0
442
+ * @category Function
443
+ * @param {Function} func The function to throttle.
444
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
445
+ * @param {Object} [options={}] The options object.
446
+ * @param {boolean} [options.leading=true]
447
+ * Specify invoking on the leading edge of the timeout.
448
+ * @param {boolean} [options.trailing=true]
449
+ * Specify invoking on the trailing edge of the timeout.
450
+ * @returns {Function} Returns the new throttled function.
451
+ * @example
452
+ *
453
+ * // Avoid excessively updating the position while scrolling.
454
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
455
+ *
456
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
457
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
458
+ * jQuery(element).on('click', throttled);
459
+ *
460
+ * // Cancel the trailing throttled invocation.
461
+ * jQuery(window).on('popstate', throttled.cancel);
462
+ */
463
+ function throttle(func, wait, options) {
464
+ var leading = true, trailing = true;
465
+ if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
466
+ if (isObject(options)) {
467
+ leading = "leading" in options ? !!options.leading : leading;
468
+ trailing = "trailing" in options ? !!options.trailing : trailing;
469
+ }
470
+ return debounce(func, wait, {
471
+ "leading": leading,
472
+ "maxWait": wait,
473
+ "trailing": trailing
474
+ });
475
+ }
476
+ //#endregion
477
+ //#region ../../node_modules/.pnpm/url-join@5.0.0/node_modules/url-join/lib/url-join.js
26
478
  function normalize(strArray) {
27
- var resultArray = [];
28
- if (strArray.length === 0) {
29
- return "";
30
- }
31
- if (typeof strArray[0] !== "string") {
32
- throw new TypeError("Url must be a string. Received " + strArray[0]);
33
- }
34
- if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
35
- var first = strArray.shift();
36
- strArray[0] = first + strArray[0];
37
- }
38
- if (strArray[0].match(/^file:\/\/\//)) {
39
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
40
- } else {
41
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
42
- }
43
- for (var i = 0; i < strArray.length; i++) {
44
- var component = strArray[i];
45
- if (typeof component !== "string") {
46
- throw new TypeError("Url must be a string. Received " + component);
47
- }
48
- if (component === "") {
49
- continue;
50
- }
51
- if (i > 0) {
52
- component = component.replace(/^[\/]+/, "");
53
- }
54
- if (i < strArray.length - 1) {
55
- component = component.replace(/[\/]+$/, "");
56
- } else {
57
- component = component.replace(/[\/]+$/, "/");
58
- }
59
- resultArray.push(component);
60
- }
61
- var str = resultArray.join("/");
62
- str = str.replace(/\/(\?|&|#[^!])/g, "$1");
63
- var parts = str.split("?");
64
- str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
65
- return str;
479
+ var resultArray = [];
480
+ if (strArray.length === 0) return "";
481
+ if (typeof strArray[0] !== "string") throw new TypeError("Url must be a string. Received " + strArray[0]);
482
+ if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) strArray[0] = strArray.shift() + strArray[0];
483
+ if (strArray[0].match(/^file:\/\/\//)) strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
484
+ else strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
485
+ for (var i = 0; i < strArray.length; i++) {
486
+ var component = strArray[i];
487
+ if (typeof component !== "string") throw new TypeError("Url must be a string. Received " + component);
488
+ if (component === "") continue;
489
+ if (i > 0) component = component.replace(/^[\/]+/, "");
490
+ if (i < strArray.length - 1) component = component.replace(/[\/]+$/, "");
491
+ else component = component.replace(/[\/]+$/, "/");
492
+ resultArray.push(component);
493
+ }
494
+ var str = resultArray.join("/");
495
+ str = str.replace(/\/(\?|&|#[^!])/g, "$1");
496
+ var parts = str.split("?");
497
+ str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
498
+ return str;
66
499
  }
67
500
  function urlJoin() {
68
- var input;
69
- if (typeof arguments[0] === "object") {
70
- input = arguments[0];
71
- } else {
72
- input = [].slice.call(arguments);
73
- }
74
- return normalize(input);
501
+ var input;
502
+ if (typeof arguments[0] === "object") input = arguments[0];
503
+ else input = [].slice.call(arguments);
504
+ return normalize(input);
75
505
  }
76
- const _hoisted_1$1 = { class: "brightcove-player" };
77
- const BASE_URL = "//players.brightcove.net/";
78
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
79
- __name: "BrightcovePlayer",
80
- props: {
81
- accountId: {},
82
- playerId: {},
83
- videoId: {}
84
- },
85
- setup(__props, { expose: __expose }) {
86
- const BrightcoveErrorCode = {
87
- NOT_FOUND: "VIDEO_CLOUD_ERR_VIDEO_NOT_FOUND",
88
- INVALID_CONFIG: "ERR_INVALID_CONFIGURATION"
89
- };
90
- const props = __props;
91
- const error = ref(null);
92
- const style = ref(null);
93
- const script = ref(null);
94
- const player = ref(null);
95
- const playerUrl = computed(
96
- () => urlJoin(BASE_URL, props.accountId, `${props.playerId}_default`, "index.min.js")
97
- );
98
- const showError = computed(() => {
99
- if (!error.value) return false;
100
- const code = error.value.code;
101
- return code === BrightcoveErrorCode.NOT_FOUND || code === BrightcoveErrorCode.INVALID_CONFIG;
102
- });
103
- const createPlayer = () => {
104
- const video = document.createElement("video");
105
- Object.assign(video.dataset, {
106
- account: props.accountId,
107
- player: props.playerId,
108
- videoId: props.videoId
109
- });
110
- video.className = "video-js";
111
- video.setAttribute("controls", "");
112
- return video;
113
- };
114
- const destroyPlayer = () => {
115
- if (player.value) {
116
- player.value.pause();
117
- player.value.dispose();
118
- player.value = null;
119
- }
120
- error.value = null;
121
- if (script.value) document.body.removeChild(script.value);
122
- script.value = null;
123
- if (style.value) document.head.removeChild(style.value);
124
- style.value = null;
125
- if (videoWrapper.value) videoWrapper.value.innerHTML = "";
126
- };
127
- const initPlayer = (url = playerUrl.value) => {
128
- destroyPlayer();
129
- script.value = loadScript(url, document.body, (err) => {
130
- if (err) {
131
- onError({
132
- code: BrightcoveErrorCode.INVALID_CONFIG,
133
- accountId: props.accountId,
134
- playerId: props.playerId
135
- });
136
- return;
137
- }
138
- style.value = setTheme();
139
- const video = createPlayer();
140
- videoWrapper.value?.appendChild(video);
141
- player.value = window.bc(video);
142
- player.value.autoplay(false);
143
- player.value.on("error", () => onError(player.value.error()));
144
- });
145
- };
146
- const setTheme = () => {
147
- const cls = `bc-style-${props.playerId}-default`;
148
- const theme = document.head.getElementsByClassName(cls)[0];
149
- return document.head.insertBefore(theme, null);
150
- };
151
- const pause = () => {
152
- if (player.value) player.value.pause();
153
- };
154
- const onError = (err) => {
155
- error.value = err;
156
- };
157
- watch(playerUrl, () => {
158
- if (!videoWrapper.value) return;
159
- initPlayer();
160
- });
161
- watch(
162
- () => props.videoId,
163
- () => {
164
- if (!videoWrapper.value) return;
165
- initPlayer();
166
- }
167
- );
168
- onMounted(() => {
169
- initPlayer();
170
- });
171
- onBeforeUnmount(() => {
172
- destroyPlayer();
173
- });
174
- const videoWrapper = ref(null);
175
- function loadScript(url, dest, cb) {
176
- const script2 = document.createElement("script");
177
- script2.src = url;
178
- script2.async = false;
179
- script2.onload = () => cb(null, script2);
180
- script2.onerror = () => cb(new Error("Error loading script!"), script2);
181
- return dest.appendChild(script2);
182
- }
183
- __expose({
184
- pause
185
- });
186
- return (_ctx, _cache) => {
187
- const _component_VIcon = resolveComponent("VIcon");
188
- const _component_VSheet = resolveComponent("VSheet");
189
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
190
- showError.value ? (openBlock(), createBlock(_component_VSheet, {
191
- key: 0,
192
- class: "h-100 d-flex flex-column align-center justify-center opacity-90",
193
- color: "black"
194
- }, {
195
- default: withCtx(() => [
196
- createVNode(_component_VIcon, {
197
- class: "mb-2",
198
- icon: "mdi-alert",
199
- size: "42"
200
- }),
201
- _cache[0] || (_cache[0] = createElementVNode("div", { class: "text-h6" }, "Error loading media!", -1))
202
- ]),
203
- _: 1
204
- })) : createCommentVNode("", true),
205
- withDirectives(createElementVNode("div", {
206
- ref_key: "videoWrapper",
207
- ref: videoWrapper,
208
- class: "wrapper"
209
- }, null, 512), [
210
- [vShow, !showError.value]
211
- ])
212
- ]);
213
- };
214
- }
215
- });
216
- const _export_sfc = (sfc, props) => {
217
- const target = sfc.__vccOpts || sfc;
218
- for (const [key, val] of props) {
219
- target[key] = val;
220
- }
221
- return target;
222
- };
223
- const BrightcovePlayer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-dd41e47c"]]);
224
- const _hoisted_1 = { class: "tce-brightcove-video-root" };
225
- const _sfc_main = /* @__PURE__ */ defineComponent({
226
- __name: "Display",
227
- props: {
228
- element: {},
229
- userState: {}
230
- },
231
- emits: ["interaction"],
232
- setup(__props) {
233
- const props = __props;
234
- const accountId = computed(() => props.element.data.accountId);
235
- const playerId = computed(() => props.element.data.playerId);
236
- const videoId = computed(() => props.element.data.videoId);
237
- const isConfigured = computed(
238
- () => accountId.value && playerId.value && videoId.value
239
- );
240
- return (_ctx, _cache) => {
241
- return openBlock(), createElementBlock("div", _hoisted_1, [
242
- isConfigured.value ? (openBlock(), createBlock(BrightcovePlayer, {
243
- key: 0,
244
- ref: "player",
245
- "account-id": accountId.value,
246
- "player-id": playerId.value,
247
- "video-id": videoId.value,
248
- class: "player"
249
- }, null, 8, ["account-id", "player-id", "video-id"])) : createCommentVNode("", true)
250
- ]);
251
- };
252
- }
506
+ //#endregion
507
+ //#region src/components/BrightcovePlayer.vue?vue&type=script&setup=true&lang.ts
508
+ var _hoisted_1$1 = { class: "brightcove-player" };
509
+ var BASE_URL = "//players.brightcove.net/";
510
+ var BrightcovePlayer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
511
+ __name: "BrightcovePlayer",
512
+ props: {
513
+ accountId: {},
514
+ playerId: {},
515
+ videoId: {},
516
+ resumeTime: {}
517
+ },
518
+ emits: ["timeupdate", "seeked"],
519
+ setup(__props, { expose: __expose, emit: __emit }) {
520
+ const BrightcoveErrorCode = {
521
+ NOT_FOUND: "VIDEO_CLOUD_ERR_VIDEO_NOT_FOUND",
522
+ INVALID_CONFIG: "ERR_INVALID_CONFIGURATION"
523
+ };
524
+ const props = __props;
525
+ const emit = __emit;
526
+ const error = ref(null);
527
+ const style = ref(null);
528
+ const script = ref(null);
529
+ const player = ref(null);
530
+ const playerUrl = computed(() => urlJoin(BASE_URL, props.accountId, `${props.playerId}_default`, "index.min.js"));
531
+ const showError = computed(() => {
532
+ if (!error.value) return false;
533
+ const code = error.value.code;
534
+ return code === BrightcoveErrorCode.NOT_FOUND || code === BrightcoveErrorCode.INVALID_CONFIG;
535
+ });
536
+ const createPlayer = () => {
537
+ const video = document.createElement("video");
538
+ Object.assign(video.dataset, {
539
+ account: props.accountId,
540
+ player: props.playerId,
541
+ videoId: props.videoId
542
+ });
543
+ video.className = "video-js";
544
+ video.setAttribute("controls", "");
545
+ return video;
546
+ };
547
+ const destroyPlayer = () => {
548
+ if (player.value) {
549
+ player.value.pause();
550
+ player.value.dispose();
551
+ player.value = null;
552
+ }
553
+ error.value = null;
554
+ if (script.value) document.body.removeChild(script.value);
555
+ script.value = null;
556
+ if (style.value) document.head.removeChild(style.value);
557
+ style.value = null;
558
+ if (videoWrapper.value) videoWrapper.value.innerHTML = "";
559
+ };
560
+ const initPlayer = (url = playerUrl.value) => {
561
+ destroyPlayer();
562
+ script.value = loadScript(url, document.body, (err) => {
563
+ if (err) {
564
+ onError({
565
+ code: BrightcoveErrorCode.INVALID_CONFIG,
566
+ accountId: props.accountId,
567
+ playerId: props.playerId
568
+ });
569
+ return;
570
+ }
571
+ style.value = setTheme();
572
+ const video = createPlayer();
573
+ videoWrapper.value?.appendChild(video);
574
+ player.value = window.bc(video);
575
+ player.value.autoplay(false);
576
+ player.value.on("error", () => onError(player.value.error()));
577
+ player.value.on("timeupdate", () => emit("timeupdate", player.value.currentTime()));
578
+ player.value.on("seeked", () => emit("seeked", player.value.currentTime()));
579
+ if (props.resumeTime) player.value.one("loadedmetadata", () => player.value.currentTime(props.resumeTime));
580
+ });
581
+ };
582
+ const setTheme = () => {
583
+ const cls = `bc-style-${props.playerId}-default`;
584
+ const theme = document.head.getElementsByClassName(cls)[0];
585
+ return document.head.insertBefore(theme, null);
586
+ };
587
+ const pause = () => {
588
+ if (player.value) player.value.pause();
589
+ };
590
+ const onError = (err) => {
591
+ error.value = err;
592
+ };
593
+ watch(playerUrl, () => {
594
+ if (!videoWrapper.value) return;
595
+ initPlayer();
596
+ });
597
+ watch(() => props.videoId, () => {
598
+ if (!videoWrapper.value) return;
599
+ initPlayer();
600
+ });
601
+ onMounted(() => {
602
+ initPlayer();
603
+ });
604
+ onBeforeUnmount(() => {
605
+ destroyPlayer();
606
+ });
607
+ const videoWrapper = ref(null);
608
+ function loadScript(url, dest, cb) {
609
+ const script = document.createElement("script");
610
+ script.src = url;
611
+ script.async = false;
612
+ script.onload = () => cb(null, script);
613
+ script.onerror = () => cb(/* @__PURE__ */ new Error("Error loading script!"), script);
614
+ return dest.appendChild(script);
615
+ }
616
+ __expose({ pause });
617
+ return (_ctx, _cache) => {
618
+ const _component_VIcon = resolveComponent("VIcon");
619
+ const _component_VSheet = resolveComponent("VSheet");
620
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [showError.value ? (openBlock(), createBlock(_component_VSheet, {
621
+ key: 0,
622
+ class: "h-100 d-flex flex-column align-center justify-center opacity-90",
623
+ color: "black"
624
+ }, {
625
+ default: withCtx(() => [createVNode(_component_VIcon, {
626
+ class: "mb-2",
627
+ icon: "mdi-alert",
628
+ size: "42"
629
+ }), _cache[0] || (_cache[0] = createElementVNode("div", { class: "text-title-large" }, "Error loading media!", -1))]),
630
+ _: 1
631
+ })) : createCommentVNode("", true), withDirectives(createElementVNode("div", {
632
+ ref_key: "videoWrapper",
633
+ ref: videoWrapper,
634
+ class: "wrapper"
635
+ }, null, 512), [[vShow, !showError.value]])]);
636
+ };
637
+ }
253
638
  });
254
- const Display = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d82c84d4"]]);
255
- const manifest = {
256
- ...index_default,
257
- Display
639
+ //#endregion
640
+ //#region \0plugin-vue:export-helper
641
+ var _plugin_vue_export_helper_default = (sfc, props) => {
642
+ const target = sfc.__vccOpts || sfc;
643
+ for (const [key, val] of props) target[key] = val;
644
+ return target;
258
645
  };
259
- export {
260
- Display,
261
- manifest as default
646
+ //#endregion
647
+ //#region src/components/BrightcovePlayer.vue
648
+ var BrightcovePlayer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(BrightcovePlayer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-78728a8f"]]);
649
+ //#endregion
650
+ //#region src/components/Display.vue?vue&type=script&setup=true&lang.ts
651
+ var _hoisted_1 = { class: "tce-brightcove-video-root" };
652
+ var PROGRESS_UPDATE_INTERVAL = 5e3;
653
+ var SEEK_DEBOUNCE_INTERVAL = 300;
654
+ //#endregion
655
+ //#region src/components/Display.vue
656
+ var Display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
657
+ __name: "Display",
658
+ props: {
659
+ element: {},
660
+ userState: {}
661
+ },
662
+ emits: ["interaction"],
663
+ setup(__props, { emit: __emit }) {
664
+ const props = __props;
665
+ const emit = __emit;
666
+ const accountId = computed(() => props.element.data.accountId);
667
+ const playerId = computed(() => props.element.data.playerId);
668
+ const videoId = computed(() => props.element.data.videoId);
669
+ const isConfigured = computed(() => accountId.value && playerId.value && videoId.value);
670
+ const interact = (currentTime) => {
671
+ emit("interaction", {
672
+ currentTime,
673
+ furthestTime: Math.max(props.userState?.furthestTime ?? 0, currentTime)
674
+ });
675
+ };
676
+ const handleTimeUpdate = throttle(interact, PROGRESS_UPDATE_INTERVAL);
677
+ const handleSeeked = debounce(interact, SEEK_DEBOUNCE_INTERVAL);
678
+ return (_ctx, _cache) => {
679
+ return openBlock(), createElementBlock("div", _hoisted_1, [isConfigured.value ? (openBlock(), createBlock(BrightcovePlayer_default, {
680
+ key: 0,
681
+ ref: "player",
682
+ "account-id": accountId.value,
683
+ "player-id": playerId.value,
684
+ "resume-time": __props.userState?.currentTime,
685
+ "video-id": videoId.value,
686
+ class: "player",
687
+ onSeeked: unref(handleSeeked),
688
+ onTimeupdate: unref(handleTimeUpdate)
689
+ }, null, 8, [
690
+ "account-id",
691
+ "player-id",
692
+ "resume-time",
693
+ "video-id",
694
+ "onSeeked",
695
+ "onTimeupdate"
696
+ ])) : createCommentVNode("", true)]);
697
+ };
698
+ }
699
+ }), [["__scopeId", "data-v-5652f7ed"]]);
700
+ //#endregion
701
+ //#region src/index.ts
702
+ var manifest = {
703
+ ...manifest$1,
704
+ Display: Display_default
262
705
  };
706
+ //#endregion
707
+ export { Display_default as Display, manifest as default };