@ezuikit/multi-screen 0.1.0-beta.1

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.
@@ -0,0 +1,4016 @@
1
+ /*
2
+ * MultiScreen v0.1.0-beta.1
3
+ * Copyright (c) 2026-03-03 Ezviz-OpenBiz
4
+ * Released under the MIT License.
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8
+ typeof define === 'function' && define.amd ? define(factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MultiScreen = factory());
10
+ })(this, (function () { 'use strict';
11
+
12
+ function getDefaultExportFromCjs (x) {
13
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
+ }
15
+
16
+ var eventemitter3 = {exports: {}};
17
+
18
+ var hasRequiredEventemitter3;
19
+
20
+ function requireEventemitter3 () {
21
+ if (hasRequiredEventemitter3) return eventemitter3.exports;
22
+ hasRequiredEventemitter3 = 1;
23
+ (function (module) {
24
+
25
+ var has = Object.prototype.hasOwnProperty
26
+ , prefix = '~';
27
+
28
+ /**
29
+ * Constructor to create a storage for our `EE` objects.
30
+ * An `Events` instance is a plain object whose properties are event names.
31
+ *
32
+ * @constructor
33
+ * @private
34
+ */
35
+ function Events() {}
36
+
37
+ //
38
+ // We try to not inherit from `Object.prototype`. In some engines creating an
39
+ // instance in this way is faster than calling `Object.create(null)` directly.
40
+ // If `Object.create(null)` is not supported we prefix the event names with a
41
+ // character to make sure that the built-in object properties are not
42
+ // overridden or used as an attack vector.
43
+ //
44
+ if (Object.create) {
45
+ Events.prototype = Object.create(null);
46
+
47
+ //
48
+ // This hack is needed because the `__proto__` property is still inherited in
49
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
50
+ //
51
+ if (!new Events().__proto__) prefix = false;
52
+ }
53
+
54
+ /**
55
+ * Representation of a single event listener.
56
+ *
57
+ * @param {Function} fn The listener function.
58
+ * @param {*} context The context to invoke the listener with.
59
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
60
+ * @constructor
61
+ * @private
62
+ */
63
+ function EE(fn, context, once) {
64
+ this.fn = fn;
65
+ this.context = context;
66
+ this.once = once || false;
67
+ }
68
+
69
+ /**
70
+ * Add a listener for a given event.
71
+ *
72
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
73
+ * @param {(String|Symbol)} event The event name.
74
+ * @param {Function} fn The listener function.
75
+ * @param {*} context The context to invoke the listener with.
76
+ * @param {Boolean} once Specify if the listener is a one-time listener.
77
+ * @returns {EventEmitter}
78
+ * @private
79
+ */
80
+ function addListener(emitter, event, fn, context, once) {
81
+ if (typeof fn !== 'function') {
82
+ throw new TypeError('The listener must be a function');
83
+ }
84
+
85
+ var listener = new EE(fn, context || emitter, once)
86
+ , evt = prefix ? prefix + event : event;
87
+
88
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
89
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
90
+ else emitter._events[evt] = [emitter._events[evt], listener];
91
+
92
+ return emitter;
93
+ }
94
+
95
+ /**
96
+ * Clear event by name.
97
+ *
98
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
99
+ * @param {(String|Symbol)} evt The Event name.
100
+ * @private
101
+ */
102
+ function clearEvent(emitter, evt) {
103
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
104
+ else delete emitter._events[evt];
105
+ }
106
+
107
+ /**
108
+ * Minimal `EventEmitter` interface that is molded against the Node.js
109
+ * `EventEmitter` interface.
110
+ *
111
+ * @constructor
112
+ * @public
113
+ */
114
+ function EventEmitter() {
115
+ this._events = new Events();
116
+ this._eventsCount = 0;
117
+ }
118
+
119
+ /**
120
+ * Return an array listing the events for which the emitter has registered
121
+ * listeners.
122
+ *
123
+ * @returns {Array}
124
+ * @public
125
+ */
126
+ EventEmitter.prototype.eventNames = function eventNames() {
127
+ var names = []
128
+ , events
129
+ , name;
130
+
131
+ if (this._eventsCount === 0) return names;
132
+
133
+ for (name in (events = this._events)) {
134
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
135
+ }
136
+
137
+ if (Object.getOwnPropertySymbols) {
138
+ return names.concat(Object.getOwnPropertySymbols(events));
139
+ }
140
+
141
+ return names;
142
+ };
143
+
144
+ /**
145
+ * Return the listeners registered for a given event.
146
+ *
147
+ * @param {(String|Symbol)} event The event name.
148
+ * @returns {Array} The registered listeners.
149
+ * @public
150
+ */
151
+ EventEmitter.prototype.listeners = function listeners(event) {
152
+ var evt = prefix ? prefix + event : event
153
+ , handlers = this._events[evt];
154
+
155
+ if (!handlers) return [];
156
+ if (handlers.fn) return [handlers.fn];
157
+
158
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
159
+ ee[i] = handlers[i].fn;
160
+ }
161
+
162
+ return ee;
163
+ };
164
+
165
+ /**
166
+ * Return the number of listeners listening to a given event.
167
+ *
168
+ * @param {(String|Symbol)} event The event name.
169
+ * @returns {Number} The number of listeners.
170
+ * @public
171
+ */
172
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
173
+ var evt = prefix ? prefix + event : event
174
+ , listeners = this._events[evt];
175
+
176
+ if (!listeners) return 0;
177
+ if (listeners.fn) return 1;
178
+ return listeners.length;
179
+ };
180
+
181
+ /**
182
+ * Calls each of the listeners registered for a given event.
183
+ *
184
+ * @param {(String|Symbol)} event The event name.
185
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
186
+ * @public
187
+ */
188
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
189
+ var evt = prefix ? prefix + event : event;
190
+
191
+ if (!this._events[evt]) return false;
192
+
193
+ var listeners = this._events[evt]
194
+ , len = arguments.length
195
+ , args
196
+ , i;
197
+
198
+ if (listeners.fn) {
199
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
200
+
201
+ switch (len) {
202
+ case 1: return listeners.fn.call(listeners.context), true;
203
+ case 2: return listeners.fn.call(listeners.context, a1), true;
204
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
205
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
206
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
207
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
208
+ }
209
+
210
+ for (i = 1, args = new Array(len -1); i < len; i++) {
211
+ args[i - 1] = arguments[i];
212
+ }
213
+
214
+ listeners.fn.apply(listeners.context, args);
215
+ } else {
216
+ var length = listeners.length
217
+ , j;
218
+
219
+ for (i = 0; i < length; i++) {
220
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
221
+
222
+ switch (len) {
223
+ case 1: listeners[i].fn.call(listeners[i].context); break;
224
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
225
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
226
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
227
+ default:
228
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
229
+ args[j - 1] = arguments[j];
230
+ }
231
+
232
+ listeners[i].fn.apply(listeners[i].context, args);
233
+ }
234
+ }
235
+ }
236
+
237
+ return true;
238
+ };
239
+
240
+ /**
241
+ * Add a listener for a given event.
242
+ *
243
+ * @param {(String|Symbol)} event The event name.
244
+ * @param {Function} fn The listener function.
245
+ * @param {*} [context=this] The context to invoke the listener with.
246
+ * @returns {EventEmitter} `this`.
247
+ * @public
248
+ */
249
+ EventEmitter.prototype.on = function on(event, fn, context) {
250
+ return addListener(this, event, fn, context, false);
251
+ };
252
+
253
+ /**
254
+ * Add a one-time listener for a given event.
255
+ *
256
+ * @param {(String|Symbol)} event The event name.
257
+ * @param {Function} fn The listener function.
258
+ * @param {*} [context=this] The context to invoke the listener with.
259
+ * @returns {EventEmitter} `this`.
260
+ * @public
261
+ */
262
+ EventEmitter.prototype.once = function once(event, fn, context) {
263
+ return addListener(this, event, fn, context, true);
264
+ };
265
+
266
+ /**
267
+ * Remove the listeners of a given event.
268
+ *
269
+ * @param {(String|Symbol)} event The event name.
270
+ * @param {Function} fn Only remove the listeners that match this function.
271
+ * @param {*} context Only remove the listeners that have this context.
272
+ * @param {Boolean} once Only remove one-time listeners.
273
+ * @returns {EventEmitter} `this`.
274
+ * @public
275
+ */
276
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
277
+ var evt = prefix ? prefix + event : event;
278
+
279
+ if (!this._events[evt]) return this;
280
+ if (!fn) {
281
+ clearEvent(this, evt);
282
+ return this;
283
+ }
284
+
285
+ var listeners = this._events[evt];
286
+
287
+ if (listeners.fn) {
288
+ if (
289
+ listeners.fn === fn &&
290
+ (!once || listeners.once) &&
291
+ (!context || listeners.context === context)
292
+ ) {
293
+ clearEvent(this, evt);
294
+ }
295
+ } else {
296
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
297
+ if (
298
+ listeners[i].fn !== fn ||
299
+ (once && !listeners[i].once) ||
300
+ (context && listeners[i].context !== context)
301
+ ) {
302
+ events.push(listeners[i]);
303
+ }
304
+ }
305
+
306
+ //
307
+ // Reset the array, or remove it completely if we have no more listeners.
308
+ //
309
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
310
+ else clearEvent(this, evt);
311
+ }
312
+
313
+ return this;
314
+ };
315
+
316
+ /**
317
+ * Remove all listeners, or those of the specified event.
318
+ *
319
+ * @param {(String|Symbol)} [event] The event name.
320
+ * @returns {EventEmitter} `this`.
321
+ * @public
322
+ */
323
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
324
+ var evt;
325
+
326
+ if (event) {
327
+ evt = prefix ? prefix + event : event;
328
+ if (this._events[evt]) clearEvent(this, evt);
329
+ } else {
330
+ this._events = new Events();
331
+ this._eventsCount = 0;
332
+ }
333
+
334
+ return this;
335
+ };
336
+
337
+ //
338
+ // Alias methods names because people roll like that.
339
+ //
340
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
341
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
342
+
343
+ //
344
+ // Expose the prefix.
345
+ //
346
+ EventEmitter.prefixed = prefix;
347
+
348
+ //
349
+ // Allow `EventEmitter` to be imported as module namespace.
350
+ //
351
+ EventEmitter.EventEmitter = EventEmitter;
352
+
353
+ //
354
+ // Expose the module.
355
+ //
356
+ {
357
+ module.exports = EventEmitter;
358
+ }
359
+ } (eventemitter3));
360
+ return eventemitter3.exports;
361
+ }
362
+
363
+ var eventemitter3Exports = requireEventemitter3();
364
+ var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
365
+
366
+ var cjs;
367
+ var hasRequiredCjs;
368
+
369
+ function requireCjs () {
370
+ if (hasRequiredCjs) return cjs;
371
+ hasRequiredCjs = 1;
372
+
373
+ var isMergeableObject = function isMergeableObject(value) {
374
+ return isNonNullObject(value)
375
+ && !isSpecial(value)
376
+ };
377
+
378
+ function isNonNullObject(value) {
379
+ return !!value && typeof value === 'object'
380
+ }
381
+
382
+ function isSpecial(value) {
383
+ var stringValue = Object.prototype.toString.call(value);
384
+
385
+ return stringValue === '[object RegExp]'
386
+ || stringValue === '[object Date]'
387
+ || isReactElement(value)
388
+ }
389
+
390
+ // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
391
+ var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
392
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
393
+
394
+ function isReactElement(value) {
395
+ return value.$$typeof === REACT_ELEMENT_TYPE
396
+ }
397
+
398
+ function emptyTarget(val) {
399
+ return Array.isArray(val) ? [] : {}
400
+ }
401
+
402
+ function cloneUnlessOtherwiseSpecified(value, options) {
403
+ return (options.clone !== false && options.isMergeableObject(value))
404
+ ? deepmerge(emptyTarget(value), value, options)
405
+ : value
406
+ }
407
+
408
+ function defaultArrayMerge(target, source, options) {
409
+ return target.concat(source).map(function(element) {
410
+ return cloneUnlessOtherwiseSpecified(element, options)
411
+ })
412
+ }
413
+
414
+ function getMergeFunction(key, options) {
415
+ if (!options.customMerge) {
416
+ return deepmerge
417
+ }
418
+ var customMerge = options.customMerge(key);
419
+ return typeof customMerge === 'function' ? customMerge : deepmerge
420
+ }
421
+
422
+ function getEnumerableOwnPropertySymbols(target) {
423
+ return Object.getOwnPropertySymbols
424
+ ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
425
+ return Object.propertyIsEnumerable.call(target, symbol)
426
+ })
427
+ : []
428
+ }
429
+
430
+ function getKeys(target) {
431
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
432
+ }
433
+
434
+ function propertyIsOnObject(object, property) {
435
+ try {
436
+ return property in object
437
+ } catch(_) {
438
+ return false
439
+ }
440
+ }
441
+
442
+ // Protects from prototype poisoning and unexpected merging up the prototype chain.
443
+ function propertyIsUnsafe(target, key) {
444
+ return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
445
+ && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
446
+ && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
447
+ }
448
+
449
+ function mergeObject(target, source, options) {
450
+ var destination = {};
451
+ if (options.isMergeableObject(target)) {
452
+ getKeys(target).forEach(function(key) {
453
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
454
+ });
455
+ }
456
+ getKeys(source).forEach(function(key) {
457
+ if (propertyIsUnsafe(target, key)) {
458
+ return
459
+ }
460
+
461
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
462
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
463
+ } else {
464
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
465
+ }
466
+ });
467
+ return destination
468
+ }
469
+
470
+ function deepmerge(target, source, options) {
471
+ options = options || {};
472
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
473
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
474
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
475
+ // implementations can use it. The caller may not replace it.
476
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
477
+
478
+ var sourceIsArray = Array.isArray(source);
479
+ var targetIsArray = Array.isArray(target);
480
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
481
+
482
+ if (!sourceAndTargetTypesMatch) {
483
+ return cloneUnlessOtherwiseSpecified(source, options)
484
+ } else if (sourceIsArray) {
485
+ return options.arrayMerge(target, source, options)
486
+ } else {
487
+ return mergeObject(target, source, options)
488
+ }
489
+ }
490
+
491
+ deepmerge.all = function deepmergeAll(array, options) {
492
+ if (!Array.isArray(array)) {
493
+ throw new Error('first argument should be an array')
494
+ }
495
+
496
+ return array.reduce(function(prev, next) {
497
+ return deepmerge(prev, next, options)
498
+ }, {})
499
+ };
500
+
501
+ var deepmerge_1 = deepmerge;
502
+
503
+ cjs = deepmerge_1;
504
+ return cjs;
505
+ }
506
+
507
+ var cjsExports = requireCjs();
508
+ var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
509
+
510
+ var dist$1 = {exports: {}};
511
+
512
+ /*
513
+ * @ezuikit/utils-i18n v2.0.0
514
+ * i18n utils
515
+ * Copyright (c) 2026-01-16 Ezviz-OpenBiz
516
+ * Released under the MIT License.
517
+ */
518
+
519
+ var hasRequiredDist$1;
520
+
521
+ function requireDist$1 () {
522
+ if (hasRequiredDist$1) return dist$1.exports;
523
+ hasRequiredDist$1 = 1;
524
+ var deepmerge=requireCjs();function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}var I18n=function(){function I18n(translations,options){this._translations={},this._locale=null==options?void 0:options.defaultLocale,translations&&(this._translations=translations,(null==options?void 0:options.defaultLocale)||(this._locale=Object.keys(translations)[0])),this.options=options||{};}var _proto=I18n.prototype;return _proto.t=function(scope,variables){var value,translation=this._translations[this._locale];if(!translation)return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):'[missing "'+this._locale+'" locale]';if("string"==typeof scope&&scope.includes(".")&&!(scope in translation)){var _this__findChainValue=this._findChainValue(translation,scope),v=_this__findChainValue[0];if(_this__findChainValue[1])value=v;else {if(void 0===(null==variables?void 0:variables.defaultvalue))return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):'[missing "'+this._locale+"."+scope+'" translation]';value=variables.defaultvalue;}}else if(scope in translation)value=translation[scope];else {if(void 0===(null==variables?void 0:variables.defaultvalue))return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):'[missing "'+this._locale+"."+scope+'" translation]';value=variables.defaultvalue;}return "string"==typeof value&&variables&&/\{\{\s*(\w+)\s*\}\}/.test(value)?value.replace(/\{\{\s*(\w+)\s*\}\}/g,(function(_,varName){return String(variables[varName])||""})):value},_proto.appendTranslations=function(translations){this._translations=deepmerge(this._translations,translations,{clone:false}),this._locale||(this._locale=Object.keys(this._translations)[0]),this._onChange();},_proto.switchLocale=function(locale){locale in this._translations&&(this._locale=locale,this._onChange());},_proto.switchTranslation=function(locale){this.switchLocale(locale);},_proto.getCurrentLocale=function(){return this._locale},_proto.getCurrentTranslation=function(){return this._translations[this._locale]},_proto.getVersion=function(){return "2.0.0"},_proto._onChange=function(){return null==this.options.onChange?void 0:this.options.onChange.call(this.options,this)},_proto._findChainValue=function(obj,path){for(var paths=path.split("."),translation=obj,i=0;i<paths.length;i++){if(!paths[i])return [void 0,false];if("object"!==(void 0===translation?"undefined":_type_of(translation))||null===translation)return [void 0,false];if(!(paths[i]in translation))return [void 0,false];if(translation=translation[paths[i]],i+1===paths.length)return [translation,true]}return [void 0,false]},_create_class(I18n,[{key:"locale",get:function(){return this._locale}},{key:"translations",get:function(){return this._translations}}]),I18n}();I18n.VERSION="2.0.0",dist$1.exports=I18n;
525
+ return dist$1.exports;
526
+ }
527
+
528
+ var distExports$1 = requireDist$1();
529
+ var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
530
+
531
+ var delegate$2 = {exports: {}};
532
+
533
+ /*
534
+ * delegate.js v4.0.2
535
+ * Copyright (c) 2025-12-16
536
+ * Released under the MIT License.
537
+ */
538
+ var delegate$1 = delegate$2.exports;
539
+
540
+ var hasRequiredDelegate;
541
+
542
+ function requireDelegate () {
543
+ if (hasRequiredDelegate) return delegate$2.exports;
544
+ hasRequiredDelegate = 1;
545
+ (function (module, exports) {
546
+ (function (global, factory) {
547
+ module.exports = factory() ;
548
+ })(delegate$1, (function () {
549
+ var DOCUMENT_NODE_TYPE = 9;
550
+ /**
551
+ * A polyfill for Element.matches()
552
+ */ if (typeof Element !== "undefined" && !Element.prototype.matches) {
553
+ var proto = Element.prototype;
554
+ proto.matches = (proto == null ? void 0 : proto.matchesSelector) || (proto == null ? void 0 : proto.mozMatchesSelector) || (proto == null ? void 0 : proto.msMatchesSelector) || (proto == null ? void 0 : proto.oMatchesSelector) || (proto == null ? void 0 : proto.webkitMatchesSelector);
555
+ }
556
+ /**
557
+ * Finds the closest parent that matches a selector.
558
+ *
559
+ * @param {Element} element
560
+ * @param {string} selector
561
+ * @return {Element}
562
+ */ function closest(element, selector) {
563
+ while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
564
+ if (typeof element.matches === "function" && element.matches(selector)) {
565
+ return element;
566
+ }
567
+ element = element.parentNode;
568
+ }
569
+ return null;
570
+ }
571
+ /**
572
+ * Finds the closest parent that matches a selector.
573
+ *
574
+ * @param {Element} element
575
+ * @param {string} selector
576
+ * @return {Element}
577
+ */ function closestNative(element, selector) {
578
+ return element && element.closest(selector);
579
+ }
580
+ var closest$1 = typeof Element.prototype.closest === "function" ? closestNative : closest;
581
+
582
+ /**
583
+ * Delegates event to a selector.
584
+ *
585
+ * @param {Element} element
586
+ * @param {string} selector
587
+ * @param {string} type
588
+ * @param {Function} callback
589
+ * @param {boolean} useCapture
590
+ * @return {Object}
591
+ */ // prettier-ignore
592
+ function _delegate(element, selector, type, callback, useCapture) {
593
+ // prettier-ignore
594
+ var listenerFn = listener.apply(this, arguments);
595
+ element.addEventListener(type, listenerFn, useCapture);
596
+ return {
597
+ destroy: function destroy() {
598
+ element.removeEventListener(type, listenerFn, useCapture);
599
+ }
600
+ };
601
+ }
602
+ /**
603
+ * Delegates event to a selector.
604
+ *
605
+ * @param {Element|string|Array} [elements]
606
+ * @param {string | Element} selector
607
+ * @param {string} type
608
+ * @param {Function} callback
609
+ * @param {boolean} useCapture
610
+ * @return {Object}
611
+ * @example
612
+ * ```ts
613
+ * const delegation = delegate(document.body, 'a', 'click', function (e) {})
614
+ * // destroy (removeEventListener)
615
+ * delegation.destroy();
616
+ *
617
+ * const delegation1 = delegate(".btn", "click", function (e) { console.log(e.delegateTarget)},false);
618
+ * // destroy (removeEventListener)
619
+ * delegation1.destroy();
620
+ * ```
621
+ */ // prettier-ignore
622
+ function delegate(elements, selector, type, callback, useCapture) {
623
+ // Handle the regular Element usage
624
+ if (typeof elements.addEventListener === "function") {
625
+ return _delegate.apply(null, arguments);
626
+ }
627
+ // Handle Element-less usage, it defaults to global delegation
628
+ if (typeof type === "function") {
629
+ // Use `document` as the first parameter, then apply arguments
630
+ // This is a short way to .unshift `arguments` without running into deoptimizations
631
+ return _delegate.bind(null, document).apply(null, arguments);
632
+ }
633
+ // Handle Selector-based usage
634
+ if (typeof elements === "string") {
635
+ elements = document.querySelectorAll(elements);
636
+ }
637
+ // Handle Array-like based usage
638
+ return Array.prototype.map.call(elements, function(element) {
639
+ return _delegate(element, selector, type, callback, useCapture);
640
+ });
641
+ }
642
+ /**
643
+ * Finds closest match and invokes callback.
644
+ *
645
+ * @param {Element} element
646
+ * @param {string} selector
647
+ * @param {string} type
648
+ * @param {Function} callback
649
+ * @return {Function}
650
+ */ // prettier-ignore
651
+ function listener(element, selector, type, callback) {
652
+ return function(e) {
653
+ e.delegateTarget = closest$1(e.target, selector);
654
+ if (e.delegateTarget) {
655
+ callback.call(element, e);
656
+ }
657
+ };
658
+ }
659
+
660
+ return delegate;
661
+
662
+ }));
663
+ } (delegate$2));
664
+ return delegate$2.exports;
665
+ }
666
+
667
+ var delegateExports = requireDelegate();
668
+ var delegate = /*@__PURE__*/getDefaultExportFromCjs(delegateExports);
669
+
670
+ /*
671
+ *
672
+ * @skax/camel v0.2.8
673
+ * (c) 2026 ShineShao <xiaoshaoqq@gmail.com>
674
+ * Released under the MIT License.
675
+ *
676
+ */
677
+ /**
678
+ * lower camel case
679
+ *
680
+ * @example
681
+ *
682
+ * lowerCamel("abcce_dddd_ffff") // -> abcceDdddFfff
683
+ *
684
+ * lowerCamel("abcce-dddd-ffff", "-") // -> abcceDdddFfff
685
+ *
686
+ * @param {string} str
687
+ * @param {string} split split line
688
+ * @returns {string}
689
+ */
690
+ function lowerCamel(str, split) {
691
+ if (split === void 0) { split = '_'; }
692
+ var reg = new RegExp(split + '([a-z])', 'g');
693
+ return str.replace(reg, function (_, letter) { return letter.toUpperCase(); });
694
+ }
695
+ /**
696
+ * upper camel case
697
+ *
698
+ * @example
699
+ *
700
+ * upperCamel("abcce_dddd_ffff") // -> AbcceDdddFfff
701
+ *
702
+ * upperCamel("abcce-dddd-ffff", "-") // -> AbcceDdddFfff
703
+ *
704
+ *
705
+ * @param {string} str
706
+ * @param {string} split split line
707
+ * @returns {string}
708
+ */
709
+ function upperCamel(str, split) {
710
+ if (split === void 0) { split = '_'; }
711
+ return lowerCamel(str, split).replace(/^\S/, function (s) {
712
+ return s.toUpperCase();
713
+ });
714
+ }
715
+
716
+ var screenfull$1 = {exports: {}};
717
+
718
+ /*!
719
+ * screenfull
720
+ * v5.2.0 - 2021-11-03
721
+ * (c) Sindre Sorhus; MIT License
722
+ */
723
+
724
+ var hasRequiredScreenfull;
725
+
726
+ function requireScreenfull () {
727
+ if (hasRequiredScreenfull) return screenfull$1.exports;
728
+ hasRequiredScreenfull = 1;
729
+ (function (module) {
730
+ (function () {
731
+
732
+ var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
733
+ var isCommonjs = module.exports;
734
+
735
+ var fn = (function () {
736
+ var val;
737
+
738
+ var fnMap = [
739
+ [
740
+ 'requestFullscreen',
741
+ 'exitFullscreen',
742
+ 'fullscreenElement',
743
+ 'fullscreenEnabled',
744
+ 'fullscreenchange',
745
+ 'fullscreenerror'
746
+ ],
747
+ // New WebKit
748
+ [
749
+ 'webkitRequestFullscreen',
750
+ 'webkitExitFullscreen',
751
+ 'webkitFullscreenElement',
752
+ 'webkitFullscreenEnabled',
753
+ 'webkitfullscreenchange',
754
+ 'webkitfullscreenerror'
755
+
756
+ ],
757
+ // Old WebKit
758
+ [
759
+ 'webkitRequestFullScreen',
760
+ 'webkitCancelFullScreen',
761
+ 'webkitCurrentFullScreenElement',
762
+ 'webkitCancelFullScreen',
763
+ 'webkitfullscreenchange',
764
+ 'webkitfullscreenerror'
765
+
766
+ ],
767
+ [
768
+ 'mozRequestFullScreen',
769
+ 'mozCancelFullScreen',
770
+ 'mozFullScreenElement',
771
+ 'mozFullScreenEnabled',
772
+ 'mozfullscreenchange',
773
+ 'mozfullscreenerror'
774
+ ],
775
+ [
776
+ 'msRequestFullscreen',
777
+ 'msExitFullscreen',
778
+ 'msFullscreenElement',
779
+ 'msFullscreenEnabled',
780
+ 'MSFullscreenChange',
781
+ 'MSFullscreenError'
782
+ ]
783
+ ];
784
+
785
+ var i = 0;
786
+ var l = fnMap.length;
787
+ var ret = {};
788
+
789
+ for (; i < l; i++) {
790
+ val = fnMap[i];
791
+ if (val && val[1] in document) {
792
+ for (i = 0; i < val.length; i++) {
793
+ ret[fnMap[0][i]] = val[i];
794
+ }
795
+ return ret;
796
+ }
797
+ }
798
+
799
+ return false;
800
+ })();
801
+
802
+ var eventNameMap = {
803
+ change: fn.fullscreenchange,
804
+ error: fn.fullscreenerror
805
+ };
806
+
807
+ var screenfull = {
808
+ request: function (element, options) {
809
+ return new Promise(function (resolve, reject) {
810
+ var onFullScreenEntered = function () {
811
+ this.off('change', onFullScreenEntered);
812
+ resolve();
813
+ }.bind(this);
814
+
815
+ this.on('change', onFullScreenEntered);
816
+
817
+ element = element || document.documentElement;
818
+
819
+ var returnPromise = element[fn.requestFullscreen](options);
820
+
821
+ if (returnPromise instanceof Promise) {
822
+ returnPromise.then(onFullScreenEntered).catch(reject);
823
+ }
824
+ }.bind(this));
825
+ },
826
+ exit: function () {
827
+ return new Promise(function (resolve, reject) {
828
+ if (!this.isFullscreen) {
829
+ resolve();
830
+ return;
831
+ }
832
+
833
+ var onFullScreenExit = function () {
834
+ this.off('change', onFullScreenExit);
835
+ resolve();
836
+ }.bind(this);
837
+
838
+ this.on('change', onFullScreenExit);
839
+
840
+ var returnPromise = document[fn.exitFullscreen]();
841
+
842
+ if (returnPromise instanceof Promise) {
843
+ returnPromise.then(onFullScreenExit).catch(reject);
844
+ }
845
+ }.bind(this));
846
+ },
847
+ toggle: function (element, options) {
848
+ return this.isFullscreen ? this.exit() : this.request(element, options);
849
+ },
850
+ onchange: function (callback) {
851
+ this.on('change', callback);
852
+ },
853
+ onerror: function (callback) {
854
+ this.on('error', callback);
855
+ },
856
+ on: function (event, callback) {
857
+ var eventName = eventNameMap[event];
858
+ if (eventName) {
859
+ document.addEventListener(eventName, callback, false);
860
+ }
861
+ },
862
+ off: function (event, callback) {
863
+ var eventName = eventNameMap[event];
864
+ if (eventName) {
865
+ document.removeEventListener(eventName, callback, false);
866
+ }
867
+ },
868
+ raw: fn
869
+ };
870
+
871
+ if (!fn) {
872
+ if (isCommonjs) {
873
+ module.exports = {isEnabled: false};
874
+ } else {
875
+ window.screenfull = {isEnabled: false};
876
+ }
877
+
878
+ return;
879
+ }
880
+
881
+ Object.defineProperties(screenfull, {
882
+ isFullscreen: {
883
+ get: function () {
884
+ return Boolean(document[fn.fullscreenElement]);
885
+ }
886
+ },
887
+ element: {
888
+ enumerable: true,
889
+ get: function () {
890
+ return document[fn.fullscreenElement];
891
+ }
892
+ },
893
+ isEnabled: {
894
+ enumerable: true,
895
+ get: function () {
896
+ // Coerce to boolean in case of old WebKit
897
+ return Boolean(document[fn.fullscreenEnabled]);
898
+ }
899
+ }
900
+ });
901
+
902
+ if (isCommonjs) {
903
+ module.exports = screenfull;
904
+ } else {
905
+ window.screenfull = screenfull;
906
+ }
907
+ })();
908
+ } (screenfull$1));
909
+ return screenfull$1.exports;
910
+ }
911
+
912
+ var screenfullExports = requireScreenfull();
913
+ var screenfull = /*@__PURE__*/getDefaultExportFromCjs(screenfullExports);
914
+
915
+ /**
916
+ * 布局配置
917
+ * @public
918
+ */ /**
919
+ * 根据分屏模式获取布局配置
920
+ * @param mode - 分屏数量
921
+ * @returns 布局配置(行数和列数)
922
+ * @example
923
+ * ```typescript
924
+ * const config = getLayoutConfig(4);
925
+ * // 返回 { rows: 2, cols: 2 }
926
+ * ```
927
+ * @public
928
+ */ function getLayoutConfig(mode) {
929
+ var configs = {
930
+ 1: {
931
+ rows: 1,
932
+ cols: 1
933
+ },
934
+ 2: {
935
+ rows: 1,
936
+ cols: 2
937
+ },
938
+ 4: {
939
+ rows: 2,
940
+ cols: 2
941
+ },
942
+ 6: {
943
+ rows: 2,
944
+ cols: 3
945
+ },
946
+ 9: {
947
+ rows: 3,
948
+ cols: 3
949
+ },
950
+ 16: {
951
+ rows: 4,
952
+ cols: 4
953
+ },
954
+ 25: {
955
+ rows: 5,
956
+ cols: 5
957
+ },
958
+ 36: {
959
+ rows: 6,
960
+ cols: 6
961
+ },
962
+ 64: {
963
+ rows: 8,
964
+ cols: 8
965
+ }
966
+ };
967
+ return configs[mode] || {
968
+ rows: 2,
969
+ cols: 2
970
+ };
971
+ }
972
+
973
+ var translations = {
974
+ 'zh': {
975
+ clickToSelect: '请选择屏幕',
976
+ mode1: '1分屏',
977
+ mode2: '2分屏',
978
+ mode4: '4分屏',
979
+ mode6: '6分屏',
980
+ mode9: '9分屏',
981
+ mode16: '16分屏',
982
+ mode25: '25分屏',
983
+ mode36: '36分屏',
984
+ mode64: '64分屏',
985
+ playAll: '全部播放',
986
+ pauseAll: '全部暂停',
987
+ webFullscreen: '网页全屏',
988
+ exitWebFullscreen: '退出网页全屏',
989
+ globalFullscreen: '全局全屏',
990
+ exitGlobalFullscreen: '退出全局全屏',
991
+ settings: '设置',
992
+ scaleMode: '画面填充',
993
+ /** 不保证保持原有的比例,内容拉伸填充整个内容容器 */ scaleModeFill: '填充',
994
+ /** 保持原有尺寸比例。内容被缩放 */ scaleModeContain: '全部包含',
995
+ /** 保持原有尺寸比例。但部分内容可能被剪切 */ scaleModeCover: '覆盖',
996
+ audioSettings: '声音设置',
997
+ audioMutedAll: '所有画面静音',
998
+ audioSelected: '仅播放选中画面的声音',
999
+ audioAll: '播放所有画面的声音',
1000
+ audioNone: '静音',
1001
+ enableHardwareDecoding: '浏览器硬解开关',
1002
+ enableHardwareDecodingDesc: '切换软硬解模式将初始化视频画面',
1003
+ screensNote: "备注:超过9分屏后,浏览器性能不足,可能会导致黑屏无法播放,请谨慎开启。"
1004
+ },
1005
+ 'en': {
1006
+ clickToSelect: 'Click to select',
1007
+ mode1: '1 Screen',
1008
+ mode2: '2 Screens',
1009
+ mode4: '4 Screens',
1010
+ mode6: '6 Screens',
1011
+ mode9: '9 Screens',
1012
+ mode16: '16 Screens',
1013
+ mode25: '25 Screens',
1014
+ mode36: '36 Screens',
1015
+ mode64: '64 Screens',
1016
+ playAll: 'Play All',
1017
+ pauseAll: 'Pause All',
1018
+ webFullscreen: 'Web Fullscreen',
1019
+ exitWebFullscreen: 'Exit Web Fullscreen',
1020
+ globalFullscreen: 'Global Fullscreen',
1021
+ exitGlobalFullscreen: 'Exit Global Fullscreen',
1022
+ settings: 'Settings',
1023
+ scaleMode: 'Scale Mode',
1024
+ scaleModeFill: 'fill',
1025
+ scaleModeContain: 'contain',
1026
+ scaleModeCover: 'cover',
1027
+ audioSettings: 'Audio Settings',
1028
+ audioMutedAll: 'Mute all screens',
1029
+ audioSelected: 'Play selected screen audio only',
1030
+ audioAll: 'Play all screens audio',
1031
+ audioNone: 'Mute',
1032
+ enableHardwareDecoding: 'Hardware Decoding',
1033
+ enableHardwareDecodingDesc: 'Switching mode will reinitialize video',
1034
+ screensNote: "Note: When exceeding 9 split screens, browser performance may be insufficient, potentially causing black screen or playback failure. Please proceed with caution."
1035
+ }
1036
+ };
1037
+
1038
+ var _EZ_SL_CLASS_PREFIX_ = 'ez-sl';
1039
+ var __EZ_SL_OPTIONS__ = {
1040
+ // 默认语言
1041
+ language: 'zh',
1042
+ // 默认主题
1043
+ theme: 'dark',
1044
+ // 默认分屏模式
1045
+ mode: 4,
1046
+ // 默认分屏数据
1047
+ screens: [],
1048
+ scaleMode: 1,
1049
+ // 默认分屏配置
1050
+ customLayout: null,
1051
+ showToolbar: true,
1052
+ enableHardwareDecoding: true,
1053
+ // 默认分屏点击事件回调
1054
+ onScreenClick: function() {},
1055
+ // 默认分屏模式切换事件回调
1056
+ onModeChange: function() {},
1057
+ // 默认全屏状态变化事件回调
1058
+ onFullscreenChange: function() {}
1059
+ };
1060
+ var EVENTS = {};
1061
+
1062
+ /**
1063
+ * 重新调整播放器窗口大小, 支持数字和字符串两种类型
1064
+ *
1065
+ * Adjust the player window size
1066
+ * @param {number | string} width 宽度(number 类型默认px, 支持字符串大小 "100%" | "50vw")
1067
+ * @param {number | string} height 高度(number 类型默认px, 支持字符串大小 "100%" | "50vh")
1068
+ * @since 0.0.1
1069
+ * @example
1070
+ * ```ts
1071
+ * theme.resize(600, 400) // 600px * 400px
1072
+ * theme.resize("600px", "400px") // 600px * 400px
1073
+ * theme.resize("50%", "1vh")
1074
+ * theme.resize("2em", "2rem")
1075
+ * // 事件监听 event, 这里是具体的宽高(单位px)
1076
+ * theme.on(Theme.EVENTS.resize, (width: number, height: number) => {})
1077
+ * ```
1078
+ * @returns {void}
1079
+ */ function _resize(layout, width, height) {
1080
+ var cssText = '';
1081
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
1082
+ cssText += "width: " + width + "px;";
1083
+ } else if (width) {
1084
+ cssText += "width: " + width + ";";
1085
+ }
1086
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
1087
+ cssText += "height: " + height + "px;";
1088
+ } else if (height) {
1089
+ cssText += "height: " + height + ";";
1090
+ }
1091
+ if (layout.$container) layout.$container.style.cssText += cssText;
1092
+ }
1093
+
1094
+ var __SVG__ = {
1095
+ /** 播放 */ play: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="play">\n <rect x="6.5" y="5.5" rx="1.25" width="2.5" height="13"/>\n <rect x="15" y="5.5" rx="1.25" width="2.5" height="13"/>\n </svg>',
1096
+ /** 暂停 */ pause: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="pause"> <path d="M17.5 13.66L9.1 19.26C7.78 20.14 6 19.19 6 17.59L6 6.4C6 4.8 7.78 3.85 9.1 4.73L17.5 10.33C18.69 11.12 18.69 12.87 17.5 13.66Z" /></svg>',
1097
+ /** 音量 */ muted: '<svg width="1em" height="1em" viewBox="0 0 24 24" stroke="currentColor" fill="none" focusable="false" aria-hidden="true" data-icon="volume">\n <path d="M20.57 9.69L16.07 14.19" stroke-width="1.500000" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M20.57 14.19L16.07 9.69" stroke-width="1.500000" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M5.87 8.62L9.85 5.25C10.5 4.7 11.49 5.16 11.49 6.01L11.49 17.98C11.49 18.83 10.5 19.29 9.85 18.74L5.87 15.37" stroke-width="1.500000" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M5.87 15.37L3.49 15.37C2.94 15.37 2.49 14.92 2.49 14.37L2.49 9.62C2.49 9.07 2.94 8.62 3.49 8.62L5.87 8.62" stroke-width="1.500000" stroke-linejoin="round" stroke-linecap="round"/>\n </svg>',
1098
+ /** 相机 */ screenshot: '<svg viewBox="0 0 1024 1024" stroke="currentColor" fill="currentColor" focusable="false" aria-hidden="true" data-icon="screenshot" width="1em" height="1em">\n <path d="M269.44 256l23.296-75.381333A74.666667 74.666667 0 0 1 364.074667 128h295.850666a74.666667 74.666667 0 0 1 71.338667 52.618667L754.56 256H821.333333c64.8 0 117.333333 52.533333 117.333334 117.333333v426.666667c0 64.8-52.533333 117.333333-117.333334 117.333333H202.666667c-64.8 0-117.333333-52.533333-117.333334-117.333333V373.333333c0-64.8 52.533333-117.333333 117.333334-117.333333h66.773333z m23.605333 64H202.666667a53.333333 53.333333 0 0 0-53.333334 53.333333v426.666667a53.333333 53.333333 0 0 0 53.333334 53.333333h618.666666a53.333333 53.333333 0 0 0 53.333334-53.333333V373.333333a53.333333 53.333333 0 0 0-53.333334-53.333333h-90.378666a32 32 0 0 1-30.570667-22.549333l-30.272-97.930667a10.666667 10.666667 0 0 0-10.186667-7.52H364.074667a10.666667 10.666667 0 0 0-10.186667 7.52l-30.272 97.92A32 32 0 0 1 293.045333 320zM512 725.333333c-88.362667 0-160-71.637333-160-160 0-88.362667 71.637333-160 160-160 88.362667 0 160 71.637333 160 160 0 88.362667-71.637333 160-160 160z m0-64a96 96 0 1 0 0-192 96 96 0 0 0 0 192z"></path>\n </svg>',
1099
+ /** 录像机 */ record: '<svg viewBox="0 0 1024 1024" stroke="currentColor" fill="none" focusable="false" aria-hidden="true" data-icon="record" width="1em" height="1em">\n <path d="M800 349.4V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v512c0 35.3 28.7 64 64 64h672c35.3 0 64-28.7 64-64v-93.4c0-2.9 3-4.8 5.6-3.7L934 728c42.3 18.8 90-12.2 90-58.5v-315c0-46.3-47.7-77.3-90-58.5l-128.4 57.1c-2.6 1.1-5.6-0.8-5.6-3.7zM720 768H80c-8.8 0-16-7.2-16-16V272c0-8.8 7.2-16 16-16h640c8.8 0 16 7.2 16 16v480c0 8.8-7.2 16-16 16z m217.5-108.5l-128-56.9c-5.8-2.6-9.5-8.3-9.5-14.6V436c0-6.3 3.7-12.1 9.5-14.6l128-56.9c10.6-4.7 22.5 3 22.5 14.6v265.8c0 11.6-11.9 19.3-22.5 14.6z"></path>\n </svg>',
1100
+ /** 设置 */ setting: '<svg viewBox="0 0 1024 1024" fill="currentColor" focusable="false" aria-hidden="true" data-icon="setting" width="1em" height="1em">\n <path d="M636.864 96l166.272 97.824-14.4 38.912c-24.928 67.424 8.512 142.656 74.656 168.032 7.872 3.04 16.032 5.28 24.32 6.656l40.288 6.752v195.648l-40.32 6.752c-69.76 11.744-116.96 78.848-105.44 149.92 1.344 8.448 3.52 16.768 6.496 24.768l14.4 38.912L636.864 928l-25.92-32.16a126.4 126.4 0 0 0-180.128-18.144c-6.496 5.44-12.48 11.52-17.792 18.144L387.136 928l-166.272-97.824 14.4-38.912c24.928-67.392-8.512-142.624-74.656-168.032a126.112 126.112 0 0 0-24.32-6.656L96 609.824v-195.648l40.288-6.752c69.76-11.712 116.992-78.816 105.504-149.888a132.384 132.384 0 0 0-6.528-24.8l-14.4-38.912L387.136 96l25.888 32.16a126.4 126.4 0 0 0 180.16 18.144c6.496-5.44 12.48-11.52 17.792-18.144L636.864 96z m14.624 83.904a193.472 193.472 0 0 1-17.728 16.832 189.44 189.44 0 0 1-261.248-16.832L299.488 222.88c2.304 7.872 4.128 15.936 5.44 24.064 16.48 102.016-47.68 198.592-144.928 222.08v85.952c7.872 1.92 15.616 4.32 23.2 7.232 94.944 36.48 144.928 141.376 116.288 238.944l73.024 42.944c5.568-5.984 11.488-11.584 17.728-16.832a189.44 189.44 0 0 1 261.248 16.832l73.024-42.976a198.784 198.784 0 0 1-5.44-24c-16.512-102.08 47.68-198.656 144.928-222.144v-85.952a189.376 189.376 0 0 1-23.168-7.232c-94.976-36.448-144.96-141.344-116.32-238.944l-73.024-42.944zM512 334.848c88.352 0 160 72.992 160 163.04 0 90.048-71.648 163.008-160 163.008s-160-72.96-160-163.008c0-90.048 71.648-163.04 160-163.04z m0 65.216c-53.024 0-96 43.808-96 97.824s42.976 97.824 96 97.824 96-43.808 96-97.824-42.976-97.824-96-97.824z"></path>\n </svg>',
1101
+ webFullscreen: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="webFullscreen">\n <path d="M18.4009 2.40125L5.59972 2.40125C4.74849 2.39276 3.9297 2.72729 3.32788 3.32935C2.72607 3.9314 2.39188 4.75031 2.40062 5.6015L2.40062 18.4015C2.3922 19.2527 2.7267 20.0715 3.32874 20.6733C3.93079 21.2751 4.74969 21.6093 5.60091 21.6006L18.4009 21.6006C19.2519 21.609 20.0705 21.2747 20.6723 20.6729C21.2741 20.0711 21.6084 19.2525 21.6 18.4015L21.6 5.60034C21.6084 4.74933 21.2741 3.93073 20.6723 3.32892C20.0705 2.72711 19.2519 2.39282 18.4009 2.40125ZM18.401 20.3213C19.4246 20.3213 20.321 19.4249 20.321 18.4014L20.321 5.60022C20.321 4.5766 19.4246 3.68024 18.401 3.68024L5.59987 3.68024C4.57631 3.68024 3.67993 4.5766 3.67993 5.60022L3.67993 18.4014C3.67993 19.4249 4.57631 20.3213 5.59987 20.3213L18.401 20.3213ZM14.5599 5.27087L18.3997 5.27087L18.3997 5.27209C18.7849 5.27087 19.0405 5.52527 19.0405 5.91168L19.0405 9.75153C19.0405 10.1331 18.7849 10.3887 18.401 10.3911C18.0158 10.3887 17.7602 10.1331 17.7602 9.75153L17.7602 7.44763L14.0487 11.1591C13.9313 11.2808 13.7695 11.3494 13.6005 11.3494C13.4315 11.3494 13.2697 11.2808 13.1523 11.1591C13.0292 11.0428 12.9594 10.8809 12.9594 10.7115C12.9594 10.5421 13.0292 10.3802 13.1523 10.2639L16.8638 6.55005L14.5599 6.55005C14.1735 6.54883 13.9179 6.29443 13.9203 5.91046C13.9179 5.52411 14.1735 5.26971 14.5599 5.27087ZM10.594 12.6625L6.88254 16.3751L6.88254 14.0712C6.88254 13.686 6.62695 13.4304 6.24297 13.4304C5.85898 13.4304 5.60338 13.686 5.60219 14.0712L5.60219 17.9111C5.60219 18.2939 5.85898 18.5483 6.24297 18.5507L10.0828 18.5507C10.4668 18.5483 10.7224 18.2939 10.7224 17.9099C10.7224 17.5247 10.4668 17.2691 10.0816 17.2703L7.77771 17.2703L11.4904 13.5588C11.6133 13.4421 11.6829 13.2801 11.6829 13.1107C11.6829 12.9412 11.6133 12.7791 11.4904 12.6625C11.3737 12.5396 11.2117 12.47 11.0422 12.47C10.8727 12.47 10.7107 12.5396 10.594 12.6625Z" clip-rule="evenodd" fill-rule="evenodd"></path>\n </svg>',
1102
+ exitWebFullscreen: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="exitWebFullscreen">\n <path d="M18.4009 2.40125L5.59978 2.40125C4.74855 2.39276 3.92976 2.72729 3.32794 3.32935C2.72614 3.9314 2.39194 4.75031 2.40068 5.6015L2.40068 18.4015C2.39226 19.2527 2.72676 20.0715 3.3288 20.6733C3.93085 21.2751 4.74976 21.6093 5.60097 21.6006L18.4009 21.6006C19.252 21.609 20.0706 21.2747 20.6723 20.6729C21.2741 20.0711 21.6085 19.2525 21.6 18.4015L21.6 5.60034C21.6085 4.74933 21.2741 3.93073 20.6723 3.32892C20.0706 2.72711 19.252 2.39282 18.4009 2.40125ZM18.4012 20.3212C19.4247 20.3212 20.3211 19.4248 20.3211 18.4012L20.3211 5.6001C20.3211 4.57648 19.4247 3.68011 18.4012 3.68011L5.59999 3.68011C4.57643 3.68011 3.68005 4.57648 3.68005 5.6001L3.68005 18.4012C3.68005 19.4248 4.57643 20.3212 5.59999 20.3212L18.4012 20.3212ZM17.4401 11.3494L13.6002 11.3494L13.6002 11.3483C13.215 11.3494 12.9594 11.095 12.9594 10.7087L12.9594 6.86877C12.9594 6.48718 13.215 6.23163 13.599 6.22925C13.9842 6.23163 14.2398 6.48718 14.2398 6.86877L14.2398 9.17273L17.9512 5.46124C18.0686 5.3396 18.2304 5.27087 18.3994 5.27087C18.5685 5.27087 18.7303 5.3396 18.8476 5.46124C18.9708 5.57751 19.0406 5.73944 19.0406 5.90881C19.0406 6.07825 18.9708 6.24011 18.8476 6.35645L15.1362 10.0703L17.4401 10.0703C17.8265 10.0715 18.082 10.3259 18.0797 10.7099C18.082 11.0963 17.8265 11.3506 17.4401 11.3494ZM6.69115 18.358L10.4026 14.6454L10.4026 16.9493C10.4026 17.3345 10.6582 17.5901 11.0422 17.5901C11.4262 17.5901 11.6818 17.3345 11.683 16.9493L11.683 13.1094C11.683 12.7266 11.4262 12.4722 11.0422 12.4698L7.20233 12.4698C6.81834 12.4722 6.56276 12.7266 6.56276 13.1106C6.56276 13.4958 6.81834 13.7514 7.20354 13.7502L9.50746 13.7502L5.79478 17.4617C5.67188 17.5784 5.60228 17.7404 5.60228 17.9099C5.60228 18.0793 5.67188 18.2413 5.79478 18.358C5.91145 18.481 6.07349 18.5505 6.24297 18.5505C6.41243 18.5505 6.57446 18.481 6.69115 18.358Z" clip-rule="evenodd" fill-rule="evenodd"></path>\n</svg>',
1103
+ fullscreen: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="fullscreen">\n <path d="M8 4L6 4C4.89 4 4 4.89 4 6L4 8" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M4 16L4 18C4 19.1 4.89 20 6 20L8 20" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M16 20L18 20C19.1 20 20 19.1 20 18L20 16" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M20 8L20 6C20 4.89 19.1 4 18 4L16 4" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"></path>\n </svg>',
1104
+ exitFullscreen: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="exitFullscreen">\n <path d="M4 8L6 8C7.1 8 8 7.1 8 6L8 4" stroke-width="1.488819" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M8 20L8 18C8 16.89 7.1 16 6 16L4 16" stroke-width="1.488819" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M20 16L18 16C16.89 16 16 16.89 16 18L16 20" stroke-width="1.488819" stroke-linejoin="round" stroke-linecap="round"></path>\n <path d="M16 4L16 6C16 7.1 16.89 8 18 8L20 8" stroke-width="1.488819" stroke-linejoin="round" stroke-linecap="round"></path>\n </svg>',
1105
+ close: '<svg width="1em" height="1em" viewBox="0 0 1024 1024" fill="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n <path d="M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>\n </svg>\n ',
1106
+ screens: '\n <svg viewBox="0 0 100 100" width="1em" height="1em" fill="currentColor" focusable="false" aria-hidden="true" data-icon="screens">\n <rect x="5" y="5" width="40" height="40" rx="2"></rect>\n <rect x="55" y="5" width="40" height="40" rx="2"></rect>\n <rect x="5" y="55" width="40" height="40" rx="2"></rect>\n <rect x="55" y="55" width="40" height="40" rx="2"></rect>\n </svg>\n '
1107
+ };
1108
+ /**
1109
+ * 创建 icon 组件
1110
+ * @param svg - svg 字符串
1111
+ * @param type - icon 类型
1112
+ * @returns icon 组件
1113
+ * @example
1114
+ * ```ts
1115
+ * createIcon('<svg>....</svg>', 'logo') // <span class="ezplayer-icon ezplayer-icon-logo"><svg>....</svg></span>
1116
+ * ```
1117
+ */ function createIcon(svg, type, attr) {
1118
+ if (attr === void 0) attr = {};
1119
+ var attrStr = '';
1120
+ if (attr) {
1121
+ Object.keys(attr).forEach(function(key) {
1122
+ if (!(attr[key] === undefined || attr[key] === null)) attrStr += key + '="' + attr[key] + '"';
1123
+ });
1124
+ }
1125
+ return '<span class="ez-sl-icon ez-sl-icon-' + type + '" ' + attrStr + ">" + svg + "</span>";
1126
+ }
1127
+ var ICONS = {
1128
+ /** 播放 */ play: function(attr) {
1129
+ if (attr === void 0) attr = {};
1130
+ return createIcon(__SVG__.play, 'play', attr);
1131
+ },
1132
+ /** 暂停 */ pause: function(attr) {
1133
+ if (attr === void 0) attr = {};
1134
+ return createIcon(__SVG__.pause, 'pause', attr);
1135
+ },
1136
+ /** 静音 */ muted: function(attr) {
1137
+ if (attr === void 0) attr = {};
1138
+ return createIcon(__SVG__.muted, 'muted', attr);
1139
+ },
1140
+ /** 截图 */ screenshot: function(attr) {
1141
+ if (attr === void 0) attr = {};
1142
+ return createIcon(__SVG__.screenshot, 'screenshot', attr);
1143
+ },
1144
+ /** 录制 */ record: function(attr) {
1145
+ if (attr === void 0) attr = {};
1146
+ return createIcon(__SVG__.record, 'record', attr);
1147
+ },
1148
+ /** 设置 */ setting: function(attr) {
1149
+ if (attr === void 0) attr = {};
1150
+ return createIcon(__SVG__.setting, 'setting', attr);
1151
+ },
1152
+ /** 网页全屏 */ webFullscreen: function(attr) {
1153
+ if (attr === void 0) attr = {};
1154
+ return createIcon(__SVG__.webFullscreen, 'webFullscreen', attr);
1155
+ },
1156
+ /** 退出网页全屏 */ exitWebFullscreen: function(attr) {
1157
+ if (attr === void 0) attr = {};
1158
+ return createIcon(__SVG__.exitWebFullscreen, 'exitWebFullscreen', attr);
1159
+ },
1160
+ /** 全屏 */ fullscreen: function(attr) {
1161
+ if (attr === void 0) attr = {};
1162
+ return createIcon(__SVG__.fullscreen, 'fullscreen', attr);
1163
+ },
1164
+ /** 退出全屏 */ exitFullscreen: function(attr) {
1165
+ if (attr === void 0) attr = {};
1166
+ return createIcon(__SVG__.exitFullscreen, 'exitFullscreen', attr);
1167
+ },
1168
+ close: function(attr) {
1169
+ if (attr === void 0) attr = {};
1170
+ return createIcon(__SVG__.close, 'close', attr);
1171
+ },
1172
+ screens: function(attr) {
1173
+ if (attr === void 0) attr = {};
1174
+ return createIcon(__SVG__.screens, 'screens', attr);
1175
+ }
1176
+ };
1177
+
1178
+ function getLocale(locales, language) {
1179
+ if (language === void 0) language = 'zh';
1180
+ return (locales == null ? void 0 : locales[language]) || (locales == null ? void 0 : locales['zh']) || {};
1181
+ }
1182
+
1183
+ function _defineProperties$5(target, props) {
1184
+ for(var i = 0; i < props.length; i++){
1185
+ var descriptor = props[i];
1186
+ descriptor.enumerable = descriptor.enumerable || false;
1187
+ descriptor.configurable = true;
1188
+ if ("value" in descriptor) descriptor.writable = true;
1189
+ Object.defineProperty(target, descriptor.key, descriptor);
1190
+ }
1191
+ }
1192
+ function _create_class$5(Constructor, protoProps, staticProps) {
1193
+ if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
1194
+ return Constructor;
1195
+ }
1196
+ function _inherits$8(subClass, superClass) {
1197
+ if (typeof superClass !== "function" && superClass !== null) {
1198
+ throw new TypeError("Super expression must either be null or a function");
1199
+ }
1200
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1201
+ constructor: {
1202
+ value: subClass,
1203
+ writable: true,
1204
+ configurable: true
1205
+ }
1206
+ });
1207
+ if (superClass) _set_prototype_of$8(subClass, superClass);
1208
+ }
1209
+ function _set_prototype_of$8(o, p) {
1210
+ _set_prototype_of$8 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1211
+ o.__proto__ = p;
1212
+ return o;
1213
+ };
1214
+ return _set_prototype_of$8(o, p);
1215
+ }
1216
+ /**
1217
+ * 控件基类
1218
+ * @remarks
1219
+ * 提供控件的基础功能,包括状态管理、事件处理、国际化等
1220
+ * @category Control
1221
+ * @example
1222
+ * ```ts
1223
+ * // 创建自定义控件
1224
+ * class MyControl extends Control {
1225
+ * protected _onControlClick(e: Event): void {
1226
+ * console.log('Control clicked');
1227
+ * }
1228
+ * }
1229
+ *
1230
+ * // 使用控件
1231
+ * const myControl = new MyControl({
1232
+ * classNameSuffix: 'my-control',
1233
+ * language: 'zh',
1234
+ * onClick: (e) => console.log('Clicked')
1235
+ * });
1236
+ * ```
1237
+ * @public
1238
+ */ var Control = /*#__PURE__*/ function(EventEmitter) {
1239
+ _inherits$8(Control, EventEmitter);
1240
+ function Control(options) {
1241
+ var _this;
1242
+ _this = EventEmitter.call(this) || this, /** 当前语言对应的翻译数据 */ _this.locale = null, /** 是否禁用状态 */ _this._disabled = false, /** 是否激活状态 */ _this._active = false, /** 驼峰命名的控件名称 */ _this._camelCaseName = '';
1243
+ _this.options = options;
1244
+ _this.layout = options.layout;
1245
+ // 初始化国际化
1246
+ _this.locale = getLocale(_this.options.locales, _this.options.language);
1247
+ // 生成驼峰命名
1248
+ _this._camelCaseName = _this.options.classNameSuffix ? _this.options.classNameSuffix.replace(/[-_\s]+(.)?/g, function(_, c) {
1249
+ return c ? c.toUpperCase() : '';
1250
+ }).replace(/^(.)/, function(first) {
1251
+ return first.toLowerCase();
1252
+ }) : '';
1253
+ // 创建容器元素
1254
+ _this.$container = document.createElement('div');
1255
+ _this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-control");
1256
+ // 根据控件类型添加样式类
1257
+ if ((options == null ? void 0 : options.controlType) === 'text') {
1258
+ _this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-control-text");
1259
+ } else {
1260
+ _this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-control-btn");
1261
+ }
1262
+ // 添加自定义样式类
1263
+ if (options == null ? void 0 : options.classNameSuffix) {
1264
+ _this.$container.classList.add(_EZ_SL_CLASS_PREFIX_ + "-control-" + options.classNameSuffix);
1265
+ }
1266
+ if (options == null ? void 0 : options.className) {
1267
+ _this.$container.classList.add(options.className);
1268
+ }
1269
+ // 设置挂载容器
1270
+ if (options.getPopupContainer) {
1271
+ _this.$popupContainer = options.getPopupContainer();
1272
+ } else {
1273
+ _this.$popupContainer = document.body;
1274
+ }
1275
+ _this.$popupContainer.appendChild(_this.$container);
1276
+ // 绑定点击事件
1277
+ _this._onClick();
1278
+ return _this;
1279
+ }
1280
+ var _proto = Control.prototype;
1281
+ /**
1282
+ * 重置控件状态
1283
+ * @param hide - 是否隐藏控件
1284
+ */ _proto.reset = function reset(hide) {
1285
+ if (this._camelCaseName) {
1286
+ this.emit("Control." + this._camelCaseName + "Reset", hide);
1287
+ }
1288
+ };
1289
+ /**
1290
+ * 重置控件挂载节点
1291
+ * @param popupContainer - 新的挂载节点
1292
+ * @param append - 添加方式:prepend(插入第一个位置) | append(追加在末尾) | before(插入指定元素前)
1293
+ * @param element - 当 append = 'before' 时需要,插入到该元素之前
1294
+ * @example
1295
+ * ```ts
1296
+ * // 追加到容器末尾
1297
+ * control.resetPopupContainer(newContainer, 'append');
1298
+ *
1299
+ * // 插入到容器第一个位置
1300
+ * control.resetPopupContainer(newContainer, 'prepend');
1301
+ *
1302
+ * // 插入到指定元素之前
1303
+ * control.resetPopupContainer(newContainer, 'before', targetElement);
1304
+ * ```
1305
+ */ // prettier-ignore
1306
+ _proto.resetPopupContainer = function resetPopupContainer(popupContainer, append, element) {
1307
+ if (popupContainer === this.$popupContainer) {
1308
+ return;
1309
+ }
1310
+ // 从旧容器中移除
1311
+ if (this.$popupContainer.contains(this.$container)) {
1312
+ this.$popupContainer.removeChild(this.$container);
1313
+ }
1314
+ // 设置新容器
1315
+ this.$popupContainer = popupContainer;
1316
+ // 根据不同方式添加到新容器
1317
+ switch(append){
1318
+ case 'prepend':
1319
+ this.$popupContainer.prepend(this.$container);
1320
+ break;
1321
+ case 'before':
1322
+ if (element) {
1323
+ this.$popupContainer.insertBefore(this.$container, element);
1324
+ } else {
1325
+ this.$popupContainer.appendChild(this.$container);
1326
+ }
1327
+ break;
1328
+ default:
1329
+ this.$popupContainer.appendChild(this.$container);
1330
+ break;
1331
+ }
1332
+ // 触发容器重置事件
1333
+ if (this._camelCaseName) {
1334
+ this.emit("Control." + this._camelCaseName + "ResetContainer", this.options.classNameSuffix, popupContainer);
1335
+ }
1336
+ };
1337
+ /**
1338
+ * 显示控件
1339
+ */ _proto.show = function show() {
1340
+ if (this.$container) {
1341
+ this.$container.style.display = '';
1342
+ this.$container.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "-hide");
1343
+ }
1344
+ };
1345
+ /**
1346
+ * 隐藏控件
1347
+ */ _proto.hide = function hide() {
1348
+ if (this.$container) {
1349
+ this.$container.style.display = 'none';
1350
+ this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-hide");
1351
+ }
1352
+ };
1353
+ /**
1354
+ * 销毁控件
1355
+ * @remarks
1356
+ * 清理所有事件监听器和 DOM 元素
1357
+ */ _proto.destroy = function destroy() {
1358
+ if (this._camelCaseName) {
1359
+ this.emit("Control." + this._camelCaseName + "Destroy");
1360
+ }
1361
+ this._active = false;
1362
+ this.removeAllListeners();
1363
+ if (this.$container) {
1364
+ this.$container.remove();
1365
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1366
+ // @ts-expect-error - 需要清空引用
1367
+ this.$container = null;
1368
+ }
1369
+ };
1370
+ /**
1371
+ * 更新控件显示
1372
+ * @remarks
1373
+ * 子类可以重写此方法来实现自定义更新逻辑
1374
+ * @public
1375
+ */ _proto.update = function update() {
1376
+ // 默认空实现,子类可重写
1377
+ };
1378
+ /**
1379
+ * 更新禁用状态的样式
1380
+ * @param disabled - 是否禁用
1381
+ * @protected
1382
+ */ _proto._updateDisabledState = function _updateDisabledState(disabled) {
1383
+ if (disabled) {
1384
+ var _this_$container;
1385
+ (_this_$container = this.$container) == null ? void 0 : _this_$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-disabled");
1386
+ } else {
1387
+ var _this_$container1;
1388
+ (_this_$container1 = this.$container) == null ? void 0 : _this_$container1.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "-disabled");
1389
+ }
1390
+ };
1391
+ /**
1392
+ * 更新激活状态的样式
1393
+ * @param active - 是否激活
1394
+ * @protected
1395
+ */ _proto._updateActiveState = function _updateActiveState(active) {
1396
+ if (active) {
1397
+ var _this_$container;
1398
+ (_this_$container = this.$container) == null ? void 0 : _this_$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "-active");
1399
+ } else {
1400
+ var _this_$container1;
1401
+ (_this_$container1 = this.$container) == null ? void 0 : _this_$container1.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "-active");
1402
+ }
1403
+ };
1404
+ /**
1405
+ * 绑定点击事件
1406
+ * @private
1407
+ */ _proto._onClick = function _onClick() {
1408
+ var _this = this;
1409
+ this.$container.addEventListener('click', function(e) {
1410
+ var _this_$container;
1411
+ // 禁用状态下不触发点击事件
1412
+ if (!((_this_$container = _this.$container) == null ? void 0 : _this_$container.classList.contains("" + _EZ_SL_CLASS_PREFIX_ + "-disabled"))) {
1413
+ _this._onControlClick(e);
1414
+ }
1415
+ });
1416
+ };
1417
+ /**
1418
+ * 控件点击事件处理
1419
+ * @param e - 事件对象
1420
+ * @remarks
1421
+ * 子类可以重写此方法来实现自定义点击行为
1422
+ * @protected
1423
+ */ _proto._onControlClick = function _onControlClick(e) {
1424
+ this.options.onClick == null ? void 0 : this.options.onClick.call(this.options, e);
1425
+ };
1426
+ _create_class$5(Control, [
1427
+ {
1428
+ key: "active",
1429
+ get: /**
1430
+ * 获取或设置激活状态
1431
+ */ function get() {
1432
+ return this._active;
1433
+ },
1434
+ set: function set(active) {
1435
+ // 禁用状态下不允许激活
1436
+ if (this._disabled && !this._active) {
1437
+ return;
1438
+ }
1439
+ this._active = active;
1440
+ this._updateActiveState(active);
1441
+ }
1442
+ },
1443
+ {
1444
+ key: "disabled",
1445
+ get: /**
1446
+ * 获取或设置禁用状态
1447
+ */ function get() {
1448
+ return this._disabled;
1449
+ },
1450
+ set: function set(disabled) {
1451
+ this._disabled = disabled;
1452
+ this._updateDisabledState(disabled);
1453
+ }
1454
+ }
1455
+ ]);
1456
+ return Control;
1457
+ }(EventEmitter);
1458
+ Control.cname = 'control';
1459
+
1460
+ function _defineProperties$4(target, props) {
1461
+ for(var i = 0; i < props.length; i++){
1462
+ var descriptor = props[i];
1463
+ descriptor.enumerable = descriptor.enumerable || false;
1464
+ descriptor.configurable = true;
1465
+ if ("value" in descriptor) descriptor.writable = true;
1466
+ Object.defineProperty(target, descriptor.key, descriptor);
1467
+ }
1468
+ }
1469
+ function _create_class$4(Constructor, protoProps, staticProps) {
1470
+ if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
1471
+ return Constructor;
1472
+ }
1473
+ function _extends$8() {
1474
+ _extends$8 = Object.assign || function(target) {
1475
+ for(var i = 1; i < arguments.length; i++){
1476
+ var source = arguments[i];
1477
+ for(var key in source){
1478
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1479
+ target[key] = source[key];
1480
+ }
1481
+ }
1482
+ }
1483
+ return target;
1484
+ };
1485
+ return _extends$8.apply(this, arguments);
1486
+ }
1487
+ function _inherits$7(subClass, superClass) {
1488
+ if (typeof superClass !== "function" && superClass !== null) {
1489
+ throw new TypeError("Super expression must either be null or a function");
1490
+ }
1491
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1492
+ constructor: {
1493
+ value: subClass,
1494
+ writable: true,
1495
+ configurable: true
1496
+ }
1497
+ });
1498
+ if (superClass) _set_prototype_of$7(subClass, superClass);
1499
+ }
1500
+ function _set_prototype_of$7(o, p) {
1501
+ _set_prototype_of$7 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1502
+ o.__proto__ = p;
1503
+ return o;
1504
+ };
1505
+ return _set_prototype_of$7(o, p);
1506
+ }
1507
+ /**
1508
+ * 播放/暂停控件
1509
+ * @remarks
1510
+ * 提供视频播放和暂停功能,支持状态自动切换
1511
+ * @category Control
1512
+ * @public
1513
+ */ var Play = /*#__PURE__*/ function(Control) {
1514
+ _inherits$7(Play, Control);
1515
+ function Play(options) {
1516
+ var _this;
1517
+ _this = Control.call(this, _extends$8({}, options, {
1518
+ controlType: 'button',
1519
+ classNameSuffix: 'play'
1520
+ })) || this, /** 播放状态 */ _this._playing = true;
1521
+ _this._render();
1522
+ return _this;
1523
+ }
1524
+ var _proto = Play.prototype;
1525
+ /**
1526
+ * 点击控件触发
1527
+ * @protected
1528
+ */ _proto._onControlClick = function _onControlClick(e) {
1529
+ if (this._playing) {
1530
+ var _this_layout;
1531
+ (_this_layout = this.layout) == null ? void 0 : _this_layout.pause();
1532
+ } else {
1533
+ var _this_layout1;
1534
+ (_this_layout1 = this.layout) == null ? void 0 : _this_layout1.play();
1535
+ }
1536
+ this._playing = !this._playing;
1537
+ this._render();
1538
+ Control.prototype._onControlClick.call(this, e);
1539
+ };
1540
+ /**
1541
+ * 渲染控件内容
1542
+ * @private
1543
+ */ _proto._render = function _render() {
1544
+ this.$container.innerHTML = this.playing ? ICONS.play() : ICONS.pause();
1545
+ };
1546
+ /**
1547
+ * 更新控件显示
1548
+ * @public
1549
+ */ _proto.update = function update() {
1550
+ this._render();
1551
+ };
1552
+ _create_class$4(Play, [
1553
+ {
1554
+ key: "playing",
1555
+ get: /**
1556
+ * 播放状态
1557
+ */ function get() {
1558
+ return this._playing;
1559
+ }
1560
+ }
1561
+ ]);
1562
+ return Play;
1563
+ }(Control);
1564
+ Play.cname = 'play';
1565
+
1566
+ function _extends$7() {
1567
+ _extends$7 = Object.assign || function(target) {
1568
+ for(var i = 1; i < arguments.length; i++){
1569
+ var source = arguments[i];
1570
+ for(var key in source){
1571
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1572
+ target[key] = source[key];
1573
+ }
1574
+ }
1575
+ }
1576
+ return target;
1577
+ };
1578
+ return _extends$7.apply(this, arguments);
1579
+ }
1580
+ function _inherits$6(subClass, superClass) {
1581
+ if (typeof superClass !== "function" && superClass !== null) {
1582
+ throw new TypeError("Super expression must either be null or a function");
1583
+ }
1584
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1585
+ constructor: {
1586
+ value: subClass,
1587
+ writable: true,
1588
+ configurable: true
1589
+ }
1590
+ });
1591
+ if (superClass) _set_prototype_of$6(subClass, superClass);
1592
+ }
1593
+ function _set_prototype_of$6(o, p) {
1594
+ _set_prototype_of$6 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1595
+ o.__proto__ = p;
1596
+ return o;
1597
+ };
1598
+ return _set_prototype_of$6(o, p);
1599
+ }
1600
+ /**
1601
+ * 静音控件
1602
+ * @remarks
1603
+ * 提供静音控制功能,支持全部静音、其他静音、取消静音
1604
+ * @category Control
1605
+ * @public
1606
+ */ var Muted = /*#__PURE__*/ function(Control) {
1607
+ _inherits$6(Muted, Control);
1608
+ function Muted(options) {
1609
+ var _this;
1610
+ _this = Control.call(this, _extends$7({}, options, {
1611
+ controlType: 'button',
1612
+ classNameSuffix: 'muted'
1613
+ })) || this;
1614
+ _this._render();
1615
+ return _this;
1616
+ }
1617
+ var _proto = Muted.prototype;
1618
+ /**
1619
+ * 点击控件触发
1620
+ * @protected
1621
+ */ _proto._onControlClick = function _onControlClick(e) {
1622
+ var _this_layout_muted, _this_layout;
1623
+ (_this_layout = this.layout) == null ? void 0 : (_this_layout_muted = _this_layout.muted) == null ? void 0 : _this_layout_muted.call(_this_layout, true);
1624
+ Control.prototype._onControlClick.call(this, e);
1625
+ };
1626
+ /**
1627
+ * 渲染控件内容
1628
+ * @private
1629
+ */ _proto._render = function _render() {
1630
+ this.$container.innerHTML = ICONS.muted();
1631
+ };
1632
+ return Muted;
1633
+ }(Control);
1634
+ Muted.cname = 'muted';
1635
+
1636
+ function _extends$6() {
1637
+ _extends$6 = Object.assign || function(target) {
1638
+ for(var i = 1; i < arguments.length; i++){
1639
+ var source = arguments[i];
1640
+ for(var key in source){
1641
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1642
+ target[key] = source[key];
1643
+ }
1644
+ }
1645
+ }
1646
+ return target;
1647
+ };
1648
+ return _extends$6.apply(this, arguments);
1649
+ }
1650
+ function _inherits$5(subClass, superClass) {
1651
+ if (typeof superClass !== "function" && superClass !== null) {
1652
+ throw new TypeError("Super expression must either be null or a function");
1653
+ }
1654
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1655
+ constructor: {
1656
+ value: subClass,
1657
+ writable: true,
1658
+ configurable: true
1659
+ }
1660
+ });
1661
+ if (superClass) _set_prototype_of$5(subClass, superClass);
1662
+ }
1663
+ function _set_prototype_of$5(o, p) {
1664
+ _set_prototype_of$5 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1665
+ o.__proto__ = p;
1666
+ return o;
1667
+ };
1668
+ return _set_prototype_of$5(o, p);
1669
+ }
1670
+ /**
1671
+ * 截图控件
1672
+ * @remarks
1673
+ * 提供视频截图功能
1674
+ * @category Control
1675
+ * @public
1676
+ */ var Screenshot = /*#__PURE__*/ function(Control) {
1677
+ _inherits$5(Screenshot, Control);
1678
+ function Screenshot(options) {
1679
+ var _this;
1680
+ _this = Control.call(this, _extends$6({}, options, {
1681
+ controlType: 'button',
1682
+ classNameSuffix: 'screenshot'
1683
+ })) || this;
1684
+ _this._render();
1685
+ return _this;
1686
+ }
1687
+ var _proto = Screenshot.prototype;
1688
+ /**
1689
+ * 点击控件触发
1690
+ * @protected
1691
+ */ _proto._onControlClick = function _onControlClick(e) {
1692
+ var _this_layout_screenshot, _this_layout;
1693
+ (_this_layout = this.layout) == null ? void 0 : (_this_layout_screenshot = _this_layout.screenshot) == null ? void 0 : _this_layout_screenshot.call(_this_layout);
1694
+ Control.prototype._onControlClick.call(this, e);
1695
+ };
1696
+ /**
1697
+ * 渲染控件内容
1698
+ * @private
1699
+ */ _proto._render = function _render() {
1700
+ this.$container.innerHTML = ICONS.screenshot();
1701
+ };
1702
+ return Screenshot;
1703
+ }(Control);
1704
+ Screenshot.cname = 'screenshot';
1705
+
1706
+ /**
1707
+ * picker component for js framework, support mobile and pc
1708
+ *
1709
+ * @skax/picker v1.1.8
1710
+ * Copyright (c) 2025-12-12 ShineShao <xiaoshaoqq@gmail.com>
1711
+ *
1712
+ * This source code is licensed under the MIT license found in the
1713
+ * LICENSE file in the root directory of this source tree.
1714
+ */
1715
+
1716
+ var dist;
1717
+ var hasRequiredDist;
1718
+
1719
+ function requireDist () {
1720
+ if (hasRequiredDist) return dist;
1721
+ hasRequiredDist = 1;
1722
+
1723
+ function _array_like_to_array(arr, len) {
1724
+ if (len == null || len > arr.length) len = arr.length;
1725
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1726
+ return arr2;
1727
+ }
1728
+ function _unsupported_iterable_to_array(o, minLen) {
1729
+ if (!o) return;
1730
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1731
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1732
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1733
+ if (n === "Map" || n === "Set") return Array.from(n);
1734
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1735
+ }
1736
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1737
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1738
+ if (it) return (it = it.call(o)).next.bind(it);
1739
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
1740
+ if (it) o = it;
1741
+ var i = 0;
1742
+ return function () {
1743
+ if (i >= o.length) {
1744
+ return {
1745
+ done: true
1746
+ };
1747
+ }
1748
+ return {
1749
+ done: false,
1750
+ value: o[i++]
1751
+ };
1752
+ };
1753
+ }
1754
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1755
+ }
1756
+ /**
1757
+ * PickerProvider 单例类
1758
+ */
1759
+ var PickerProvider = /*#__PURE__*/function () {
1760
+
1761
+ function PickerProvider() {
1762
+ this.pickers = [];
1763
+ }
1764
+ var _proto = PickerProvider.prototype;
1765
+ /**
1766
+ * 添加picker
1767
+ * @param picker Picker 实例
1768
+ */
1769
+ _proto.add = function add(picker) {
1770
+ this.pickers.push(picker);
1771
+ };
1772
+ /**
1773
+ * 移除picker
1774
+ * @param picker Picker 实例
1775
+ */
1776
+ _proto.remove = function remove(picker) {
1777
+ var index = this.pickers.indexOf(picker);
1778
+ if (index > -1) {
1779
+ this.pickers.splice(index, 1);
1780
+ } else {
1781
+ console.warn('Picker not found in the provider.');
1782
+ }
1783
+ };
1784
+ /**
1785
+ * 关闭其他picker
1786
+ * @param e 事件
1787
+ */
1788
+ _proto.closeOther = function closeOther(e) {
1789
+ for (var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;) {
1790
+ var p = _step.value;
1791
+ var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1792
+ if (p && !(e.target === p.$container || ((_p_$container = p.$container) == null ? void 0 : (_p_$container_contains = _p_$container.contains) == null ? void 0 : _p_$container_contains.call(_p_$container, e.target)) || e.target === p.$wrapperContent || ((_p_$wrapperContent = p.$wrapperContent) == null ? void 0 : (_p_$wrapperContent_contains = _p_$wrapperContent.contains) == null ? void 0 : _p_$wrapperContent_contains.call(_p_$wrapperContent, e.target)))) {
1793
+ p.open = false;
1794
+ }
1795
+ }
1796
+ };
1797
+ /**
1798
+ * 获取单例实例
1799
+ * @returns Picker 实例
1800
+ */
1801
+ PickerProvider.getInstance = function getInstance() {
1802
+ if (!PickerProvider.instance) {
1803
+ PickerProvider.instance = new PickerProvider();
1804
+ }
1805
+ return PickerProvider.instance;
1806
+ };
1807
+ return PickerProvider;
1808
+ }();
1809
+ var pickerProvider = PickerProvider.getInstance();
1810
+
1811
+ function _defineProperties(target, props) {
1812
+ for (var i = 0; i < props.length; i++) {
1813
+ var descriptor = props[i];
1814
+ descriptor.enumerable = descriptor.enumerable || false;
1815
+ descriptor.configurable = true;
1816
+ if ("value" in descriptor) descriptor.writable = true;
1817
+ Object.defineProperty(target, descriptor.key, descriptor);
1818
+ }
1819
+ }
1820
+ function _create_class(Constructor, protoProps, staticProps) {
1821
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1822
+ return Constructor;
1823
+ }
1824
+ /**
1825
+ * picker 位置
1826
+ *
1827
+ * | top | tl | tr | bottom | bl | br |
1828
+ * |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
1829
+ * | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
1830
+ *
1831
+ * @public
1832
+ */
1833
+ var _$PICKER_PLACEMENT$_ = ['top', 'tl', 'tr', 'bottom', 'bl', 'br'];
1834
+ /**
1835
+ * 默认样式前缀
1836
+ */
1837
+ var _$PICKER_PREFIX_CLS$_ = 'epicker';
1838
+ /**
1839
+ * Picker 默认值
1840
+ */
1841
+ var __$PICKER_DEFAULT_OPTIONS$__ = {
1842
+ getPopupContainer: function () {
1843
+ return document.body;
1844
+ },
1845
+ wrapClassName: '',
1846
+ open: false,
1847
+ placement: 'br',
1848
+ offset: [0, 0],
1849
+ zIndex: 1000,
1850
+ content: '',
1851
+ trigger: 'click',
1852
+ mouseLeaveDelay: 0.1,
1853
+ mouseEnterDelay: 0.1,
1854
+ isMobile: false,
1855
+ triggerClose: false
1856
+ };
1857
+ /**
1858
+ * Picker 弹窗, 支持 PC 和移动端
1859
+ * @remarks
1860
+ * Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
1861
+ * 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
1862
+ *
1863
+ * @example
1864
+ * ```ts
1865
+ * import "@skax/picker/dist/style/css";
1866
+ * import Picker from '@skax/picker';
1867
+ * const picker = new Picker(document.getElementById('picker-container'),
1868
+ * {
1869
+ * placement: 'bottom',
1870
+ * content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
1871
+ * trigger: 'click',
1872
+ * isMobile: false,
1873
+ * });
1874
+ * picker.open = true; // 打开弹窗
1875
+ * picker.setPlacement('top'); // 设置弹窗位置
1876
+ * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1877
+ * picker.destroy(); // 销毁弹窗
1878
+ * ```
1879
+ */
1880
+ var Picker = /*#__PURE__*/function () {
1881
+
1882
+ function Picker(container, options) {
1883
+ var _this__$popupContainer, _this__$popupContainer1;
1884
+ /** 是否打开 */
1885
+ this._open = false;
1886
+ this._OpenChange = false;
1887
+ this._animationTimer = null;
1888
+ this._disabled = false;
1889
+ this._timer = null;
1890
+ // prettier-ignore
1891
+ this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
1892
+ // 移动端模式强制使用 click 触发
1893
+ if (this._options.isMobile) this._options.trigger = "click";
1894
+ pickerProvider.add(this);
1895
+ if (typeof container === "function") this.$container = container();else this.$container = container;
1896
+ this.$wrapperContent = document.createElement("div");
1897
+ this._initContentStyle();
1898
+ if (typeof this._options.getPopupContainer === "function") {
1899
+ this._$popupContainer = this._options.getPopupContainer();
1900
+ } else {
1901
+ this._$popupContainer = document.body;
1902
+ }
1903
+ if (["INPUT", "CANVAS", "VIDEO", "IMG"].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
1904
+ console.warn("popup container node does not support child elements, default body!");
1905
+ this._$popupContainer = document.body;
1906
+ }
1907
+ if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
1908
+ (_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
1909
+ this._onContentClick = this._onContentClick.bind(this);
1910
+ this._onShow = this._onShow.bind(this);
1911
+ this._onContainerClick = this._onContainerClick.bind(this);
1912
+ this._onWrapperShow = this._onWrapperShow.bind(this);
1913
+ this._onHide = this._onHide.bind(this);
1914
+ this._onDocumentClick = this._onDocumentClick.bind(this);
1915
+ this._eventListener();
1916
+ this.open = !!this._options.open;
1917
+ }
1918
+ var _proto = Picker.prototype;
1919
+ /**
1920
+ * 设置弹出位置(移动端不生效)
1921
+ * @param placement - 弹出位置
1922
+ * @example
1923
+ * ```ts
1924
+ * picker.setPlacement("top");
1925
+ * picker.setPlacement("tl");
1926
+ * picker.setPlacement("tr");
1927
+ * picker.setPlacement("bottom");
1928
+ * picker.setPlacement("bl");
1929
+ * picker.setPlacement("br");
1930
+ * ```
1931
+ */
1932
+ _proto.setPlacement = function setPlacement(placement) {
1933
+ if (this._disabled) return;
1934
+ if (_$PICKER_PLACEMENT$_.includes(placement)) {
1935
+ this._options.placement = placement;
1936
+ } else {
1937
+ console.warn("" + placement + " is not a valid placement");
1938
+ }
1939
+ this._setPlacement();
1940
+ };
1941
+ /**
1942
+ * 销毁
1943
+ * @example
1944
+ * ```ts
1945
+ * picker.destroy();
1946
+ * ```
1947
+ */
1948
+ _proto.destroy = function destroy() {
1949
+ this._animationTimerClear();
1950
+ this._removeHtml();
1951
+ pickerProvider.remove(this);
1952
+ // this._$popupContainer 的 position 样式不会被移除
1953
+ };
1954
+ /**
1955
+ * 设置内容(会覆盖之前内容)
1956
+ * @param html - html 字符串内容
1957
+ * @example
1958
+ * ```ts
1959
+ * picker.innerHTML('<div>内容</div>');
1960
+ * ```
1961
+ */
1962
+ _proto.innerHTML = function innerHTML(html) {
1963
+ if (this.$body) {
1964
+ this.$body.innerHTML = html || '';
1965
+ this._setPlacement();
1966
+ }
1967
+ };
1968
+ // --------------------------------------------------------------------------
1969
+ // Private methods
1970
+ // --------------------------------------------------------------------------
1971
+ /**
1972
+ * picker 面板展开或关闭变化时触发
1973
+ * @param open - true: 展开, false:关闭
1974
+ */
1975
+ _proto._onOpenChange = function _onOpenChange(open) {
1976
+ this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1977
+ };
1978
+ /**
1979
+ * 移除动画定时器
1980
+ */
1981
+ _proto._animationTimerClear = function _animationTimerClear() {
1982
+ if (this._animationTimer) {
1983
+ clearTimeout(this._animationTimer);
1984
+ this._animationTimer = null;
1985
+ }
1986
+ };
1987
+ /**
1988
+ * 移除html
1989
+ */
1990
+ _proto._removeHtml = function _removeHtml() {
1991
+ var _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
1992
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener('click', this._onContentClick);
1993
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_removeEventListener = _this_$container.removeEventListener) == null ? void 0 : _this_$container_removeEventListener.call(_this_$container, 'click', this._onContentClick);
1994
+ if (this._options.trigger === 'click') (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, 'click', this._onContainerClick);
1995
+ if (this._options.trigger === 'hover') {
1996
+ var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4,
1997
+ // prettier-ignore
1998
+ _this_$wrapperContent1, _this_$wrapperContent2;
1999
+ (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_removeEventListener2 = _this_$container2.removeEventListener) == null ? void 0 : _this_$container_removeEventListener2.call(_this_$container2, 'mouseenter', this._onShow);
2000
+ (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_removeEventListener3 = _this_$container3.removeEventListener) == null ? void 0 : _this_$container_removeEventListener3.call(_this_$container3, 'mouseover', this._onShow);
2001
+ (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_removeEventListener4 = _this_$container4.removeEventListener) == null ? void 0 : _this_$container_removeEventListener4.call(_this_$container4, 'mouseleave', this._onHide);
2002
+ (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
2003
+ (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener('mouseleave', this._onHide);
2004
+ }
2005
+ if (!this._options.isMobile) {
2006
+ window.removeEventListener('blur', this._onHide);
2007
+ document.removeEventListener('visibilitychange', this._onHide);
2008
+ window.removeEventListener('resize', this._onHide);
2009
+ document.removeEventListener('click', this._onDocumentClick);
2010
+ }
2011
+ if (this._$mask) {
2012
+ this._$mask.removeEventListener('click', this._onHide);
2013
+ this._$mask.remove();
2014
+ this._$mask = null;
2015
+ }
2016
+ if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
2017
+ if (this.$wrapperContent) {
2018
+ this.$wrapperContent.remove();
2019
+ this.$wrapperContent = null;
2020
+ }
2021
+ };
2022
+ /**
2023
+ * 现实位置
2024
+ */
2025
+ _proto._setPlacement = function _setPlacement() {
2026
+ var _this_$container_getBoundingClientRect, _this_$container;
2027
+ if (!this._open || this._options.isMobile || !this.$container) return;
2028
+ var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
2029
+ var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
2030
+ var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
2031
+ // 容器的坐标 - 挂载的容器的坐标差
2032
+ // prettier-ignore
2033
+ var containerLeft = Math.ceil($containerRect.left) - Math.ceil($popupContainerRect.left);
2034
+ var containerRight = -(Math.ceil($containerRect.right) - Math.ceil($popupContainerRect.right));
2035
+ // prettier-ignore
2036
+ var containerTop = Math.ceil($containerRect.y) - Math.ceil($popupContainerRect.y);
2037
+ var left = containerLeft + (Math.ceil($containerRect.width) - Math.ceil($wrapperContentRect.width)) / 2;
2038
+ var right;
2039
+ var top = containerTop - Math.ceil($wrapperContentRect.height);
2040
+ var bottom = containerTop + Math.ceil($containerRect.height);
2041
+ if (/^t/.test(this._options.placement)) {
2042
+ var _this__options_offset, _this__options_offset1, _this__options_offset2;
2043
+ switch (this._options.placement) {
2044
+ case 'top':
2045
+ right = undefined;
2046
+ break;
2047
+ case 'tl':
2048
+ right = undefined;
2049
+ left = containerLeft;
2050
+ break;
2051
+ case 'tr':
2052
+ left = undefined;
2053
+ right = containerRight;
2054
+ break;
2055
+ }
2056
+ this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)) + "px;" : '') + "\n top: " + (top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
2057
+ } else if (/^b/.test(this._options.placement)) {
2058
+ var _this__options_offset3, _this__options_offset4, _this__options_offset5;
2059
+ switch (this._options.placement) {
2060
+ case 'bottom':
2061
+ right = undefined;
2062
+ break;
2063
+ case 'bl':
2064
+ right = undefined;
2065
+ left = containerLeft;
2066
+ break;
2067
+ case 'br':
2068
+ left = undefined;
2069
+ right = containerRight;
2070
+ break;
2071
+ }
2072
+ if (this.$wrapperContent) this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)) + "px;" : '') + "\n top: " + (bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
2073
+ }
2074
+ };
2075
+ /**
2076
+ * 初始化内容样式
2077
+ */
2078
+ _proto._initContentStyle = function _initContentStyle() {
2079
+ if (!this.$wrapperContent) return;
2080
+ // prettier-ignore
2081
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
2082
+ // 提升优先级
2083
+ this.$wrapperContent.style.display = 'none';
2084
+ if (this._options.isMobile) {
2085
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
2086
+ this._$mask = document.createElement('div');
2087
+ this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
2088
+ this.$wrapperContent.appendChild(this._$mask);
2089
+ }
2090
+ this.$body = document.createElement('div');
2091
+ this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
2092
+ this.$wrapperContent.appendChild(this.$body);
2093
+ if (typeof this._options.content === 'string') {
2094
+ this.innerHTML(this._options.content);
2095
+ } else if (typeof this._options.content === 'function') {
2096
+ this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
2097
+ }
2098
+ if (typeof this._options.wrapClassName === 'string') {
2099
+ try {
2100
+ var _this_$wrapperContent_classList;
2101
+ var _this_$wrapperContent;
2102
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(' ')));
2103
+ } catch (_error) {
2104
+ //
2105
+ }
2106
+ }
2107
+ };
2108
+ /**
2109
+ * 绑定事件
2110
+ */
2111
+ _proto._eventListener = function _eventListener() {
2112
+ var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
2113
+ this.$wrapperContent.addEventListener('click', this._onContentClick);
2114
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, 'click', this._onContentClick);
2115
+ //
2116
+ if (this._options.trigger === 'click') (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, 'click', this._onContainerClick);
2117
+ if (this._options.trigger === 'hover') {
2118
+ var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
2119
+ (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, 'mouseenter', this._onShow);
2120
+ (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, 'mouseover', this._onShow);
2121
+ (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, 'mouseleave', this._onHide);
2122
+ this.$wrapperContent.addEventListener('mouseenter', this._onWrapperShow);
2123
+ this.$wrapperContent.addEventListener('mouseleave', this._onHide);
2124
+ }
2125
+ if (this._$mask) this._$mask.addEventListener('click', this._onHide);
2126
+ if (!this._options.isMobile) {
2127
+ window.addEventListener('blur', this._onHide);
2128
+ document.addEventListener('visibilitychange', this._onHide);
2129
+ window.addEventListener('resize', this._onHide);
2130
+ document.addEventListener('click', this._onDocumentClick);
2131
+ }
2132
+ };
2133
+ /**
2134
+ * $wrapperContent click event
2135
+ * @param e - 内容点击事件
2136
+ */
2137
+ _proto._onContentClick = function _onContentClick(e) {
2138
+ pickerProvider.closeOther(e);
2139
+ };
2140
+ /**
2141
+ * $container click event
2142
+ * @param event - 鼠标点击事件
2143
+ * @returns
2144
+ */
2145
+ _proto._onContainerClick = function _onContainerClick(event) {
2146
+ var _this_$wrapperContent_contains, _this_$wrapperContent;
2147
+ if (this._disabled) return;
2148
+ // wrapper contain
2149
+ var contain = ((_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_contains = _this_$wrapperContent.contains) == null ? void 0 : _this_$wrapperContent_contains.call(_this_$wrapperContent, event.target)) || this.$wrapperContent === event.target;
2150
+ // open 状态下触发关闭
2151
+ if (this._options.triggerClose && this._options.trigger === 'click' && !contain) {
2152
+ this.open = !this.open;
2153
+ } else {
2154
+ this.open = true;
2155
+ }
2156
+ };
2157
+ /**
2158
+ * 显示事件
2159
+ */
2160
+ _proto._onShow = function _onShow() {
2161
+ if (this._disabled) return;
2162
+ this.open = true;
2163
+ };
2164
+ /**
2165
+ * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
2166
+ */
2167
+ _proto._onWrapperShow = function _onWrapperShow() {
2168
+ if (this._disabled) return;
2169
+ this._onShow();
2170
+ };
2171
+ /**
2172
+ * 隐藏事件
2173
+ */
2174
+ _proto._onHide = function _onHide(e) {
2175
+ if (!this._open || this._disabled) return;
2176
+ if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
2177
+ this.open = false;
2178
+ };
2179
+ /**
2180
+ * document 点击事件
2181
+ * @param event - 鼠标点击事件
2182
+ */
2183
+ _proto._onDocumentClick = function _onDocumentClick(event) {
2184
+ var _this_$container;
2185
+ if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
2186
+ if (this._disabled) return;
2187
+ this._onHide();
2188
+ }
2189
+ };
2190
+ _create_class(Picker, [{
2191
+ key: "open",
2192
+ get:
2193
+ /**
2194
+ * 获取当前打开状态
2195
+ * @example
2196
+ * ```ts
2197
+ * console.log(picker.open); // 获取当前打开状态
2198
+ * picker.open = true; // 打开
2199
+ * picker.open = false; // 关闭
2200
+ * ```
2201
+ */
2202
+ function get() {
2203
+ return this._open;
2204
+ },
2205
+ set: function set(open) {
2206
+ var _this = this;
2207
+ if (this._disabled) return;
2208
+ if (this._open !== !!open) {
2209
+ this._animationTimerClear();
2210
+ if (this._timer) {
2211
+ clearTimeout(this._timer);
2212
+ this._timer = null;
2213
+ }
2214
+ if (open) {
2215
+ // prettier-ignore
2216
+ this._timer = setTimeout(function () {
2217
+ if (!_this.$wrapperContent) return;
2218
+ _this.$wrapperContent.style.display = "inline-flex";
2219
+ _this.$wrapperContent.style.pointerEvents = "";
2220
+ // prettier-ignore
2221
+ if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
2222
+ _this._animationTimer = setTimeout(function () {
2223
+ _this._animationTimerClear();
2224
+ _this.$wrapperContent.style.opacity = "1";
2225
+ }, 0);
2226
+ requestAnimationFrame(function () {
2227
+ _this._setPlacement();
2228
+ });
2229
+ _this._OpenChange = open;
2230
+ _this._onOpenChange(open);
2231
+ },
2232
+ // prettier-ignore
2233
+ (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
2234
+ } else {
2235
+ // prettier-ignore
2236
+ this._timer = setTimeout(function () {
2237
+ if (!_this.$wrapperContent) return;
2238
+ _this.$wrapperContent.style.opacity = "0";
2239
+ _this.$wrapperContent.style.pointerEvents = "none";
2240
+ // prettier-ignore
2241
+ if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
2242
+ _this._animationTimer = setTimeout(function () {
2243
+ _this._animationTimerClear();
2244
+ _this.$wrapperContent.style.display = "none";
2245
+ }, 301); // css 动画是 300ms
2246
+ _this._OpenChange = open;
2247
+ _this._onOpenChange(open);
2248
+ },
2249
+ // prettier-ignore
2250
+ (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
2251
+ }
2252
+ if (this._OpenChange === open) {
2253
+ if (this._timer) {
2254
+ clearTimeout(this._timer);
2255
+ this._timer = null;
2256
+ }
2257
+ }
2258
+ this._open = !!open;
2259
+ }
2260
+ }
2261
+ }, {
2262
+ key: "disabled",
2263
+ get:
2264
+ /**
2265
+ * 获取或设置禁用状态
2266
+ * @example
2267
+ * ```ts
2268
+ * picker.disabled = true; // 禁用
2269
+ * picker.disabled = false; // 启用
2270
+ * console.log(picker.disabled); // 获取禁用状态
2271
+ * ```
2272
+ */
2273
+ function get() {
2274
+ return this._disabled;
2275
+ },
2276
+ set: function set(disabled) {
2277
+ if (disabled) {
2278
+ var _this_$container_classList_add, _this_$container_classList, _this_$container;
2279
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2280
+ } else {
2281
+ var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
2282
+ (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2283
+ }
2284
+ this._disabled = disabled;
2285
+ }
2286
+ }]);
2287
+ return Picker;
2288
+ }();
2289
+ /**
2290
+ * 版本号
2291
+ * @example
2292
+ * ```ts
2293
+ * Picker.VERSION; // 输出版本号
2294
+ * ```
2295
+ */
2296
+ Picker.VERSION = '1.1.8';
2297
+
2298
+ dist = Picker;
2299
+ return dist;
2300
+ }
2301
+
2302
+ var distExports = requireDist();
2303
+ var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports);
2304
+
2305
+ function _defineProperties$3(target, props) {
2306
+ for(var i = 0; i < props.length; i++){
2307
+ var descriptor = props[i];
2308
+ descriptor.enumerable = descriptor.enumerable || false;
2309
+ descriptor.configurable = true;
2310
+ if ("value" in descriptor) descriptor.writable = true;
2311
+ Object.defineProperty(target, descriptor.key, descriptor);
2312
+ }
2313
+ }
2314
+ function _create_class$3(Constructor, protoProps, staticProps) {
2315
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
2316
+ return Constructor;
2317
+ }
2318
+ /**
2319
+ * 分屏模式选择器组件
2320
+ * @remarks
2321
+ * 提供一个下拉菜单样式的分屏模式选择器
2322
+ * @public
2323
+ */ var ModePicker = /*#__PURE__*/ function() {
2324
+ function ModePicker(container, options) {
2325
+ this._currentMode = 4;
2326
+ this.modeOptions = [
2327
+ {
2328
+ mode: 1,
2329
+ label: '1分屏',
2330
+ icon: this._createModeIcon(1, 1)
2331
+ },
2332
+ {
2333
+ mode: 2,
2334
+ label: '2分屏',
2335
+ icon: this._createModeIcon(1, 2)
2336
+ },
2337
+ {
2338
+ mode: 4,
2339
+ label: '4分屏',
2340
+ icon: this._createModeIcon(2, 2)
2341
+ },
2342
+ {
2343
+ mode: 6,
2344
+ label: '6分屏',
2345
+ icon: this._createModeIcon(2, 3)
2346
+ },
2347
+ {
2348
+ mode: 9,
2349
+ label: '9分屏',
2350
+ icon: this._createModeIcon(3, 3)
2351
+ },
2352
+ {
2353
+ mode: 16,
2354
+ label: '16分屏',
2355
+ icon: this._createModeIcon(4, 4)
2356
+ }
2357
+ ];
2358
+ this.container = container;
2359
+ this.onChange = options.onChange;
2360
+ this.i18n = options.i18n;
2361
+ this._init();
2362
+ this._onOptionsClick = this._onOptionsClick.bind(this);
2363
+ this.current = options.currentMode;
2364
+ }
2365
+ var _proto = ModePicker.prototype;
2366
+ /**
2367
+ * 初始化组件
2368
+ * @private
2369
+ */ _proto._init = function _init() {
2370
+ this.createPicker();
2371
+ };
2372
+ /**
2373
+ * 创建分屏模式图标
2374
+ * @param rows - 行数
2375
+ * @param cols - 列数
2376
+ * @returns SVG 图标字符串
2377
+ * @private
2378
+ */ _proto._createModeIcon = function _createModeIcon(rows, cols) {
2379
+ var cellWidth = 100 / cols;
2380
+ var cellHeight = 100 / rows;
2381
+ var cells = '';
2382
+ for(var i = 0; i < rows * cols; i++){
2383
+ var row = Math.floor(i / cols);
2384
+ var col = i % cols;
2385
+ var x = col * cellWidth;
2386
+ var y = row * cellHeight;
2387
+ cells += '<rect x="' + (x + 2) + '" y="' + (y + 2) + '" width="' + (cellWidth - 4) + '" height="' + (cellHeight - 4) + '" \n fill="currentColor" opacity="0.8" rx="2"/>';
2388
+ }
2389
+ return '<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">\n ' + cells + "\n </svg>";
2390
+ };
2391
+ /**
2392
+ * 创建下拉选择器
2393
+ * @private
2394
+ */ _proto.createPicker = function createPicker() {
2395
+ var _this = this;
2396
+ // 创建下拉内容
2397
+ var dropdownContent = this.createDropdownContent();
2398
+ // 使用 @skax/picker 创建弹出层
2399
+ this.picker = new Picker(this.container, {
2400
+ placement: 'tr',
2401
+ trigger: 'hover',
2402
+ wrapClassName: 'mode-picker-dropdown',
2403
+ getPopupContainer: function() {
2404
+ return _this.container;
2405
+ },
2406
+ onOpenChange: function(_open) {
2407
+ // 打开时更新内容,确保状态同步
2408
+ }
2409
+ });
2410
+ // 设置弹出内容
2411
+ this.picker.innerHTML(dropdownContent);
2412
+ };
2413
+ /**
2414
+ * 创建下拉菜单内容
2415
+ * @returns 下拉菜单 HTML 字符串
2416
+ * @private
2417
+ */ _proto.createDropdownContent = function createDropdownContent() {
2418
+ var _this = this;
2419
+ var _this_i18n_t, _this_i18n;
2420
+ var options = this.modeOptions.map(function(option) {
2421
+ var isActive = option.mode === _this.current;
2422
+ return '\n <div class="mode-picker_option ' + (isActive ? 'mode-picker_option-active' : '') + '" data-mode="' + option.mode + '">\n <span class="mode-picker_option-icon">' + option.icon + "</span>\n </div>";
2423
+ }).join('');
2424
+ // 添加事件委托
2425
+ setTimeout(function() {
2426
+ if (_this.picker.$body) {
2427
+ _this.picker.$body.addEventListener('click', _this._onOptionsClick);
2428
+ }
2429
+ }, 0);
2430
+ return '<div class="mode-picker_options">' + options + '</div>\n <div class="mode-picker_tip">\n ' + ((_this_i18n = this.i18n) == null ? void 0 : (_this_i18n_t = _this_i18n.t) == null ? void 0 : _this_i18n_t.call(_this_i18n, "screensNote")) + "\n </div>\n ";
2431
+ };
2432
+ _proto._onOptionsClick = function _onOptionsClick(e) {
2433
+ var target = e.target;
2434
+ var optionEl = target.closest('.mode-picker_option');
2435
+ if (optionEl) {
2436
+ var mode = Number(optionEl.dataset.mode);
2437
+ this.selectMode(mode);
2438
+ }
2439
+ };
2440
+ /**
2441
+ * 选中指定模式
2442
+ * @param mode - 分屏模式
2443
+ * @private
2444
+ */ _proto.selectMode = function selectMode(mode) {
2445
+ this.current = mode;
2446
+ this.picker.open = false; // 关闭弹窗
2447
+ this.onChange(mode);
2448
+ };
2449
+ /**
2450
+ * 设置当前分屏模式
2451
+ * @param mode - 分屏模式
2452
+ */ _proto.setMode = function setMode(mode) {
2453
+ this.current = mode;
2454
+ };
2455
+ /**
2456
+ * 销毁选择器实例
2457
+ * @remarks
2458
+ * 清理所有 DOM 元素和事件监听器
2459
+ */ _proto.destroy = function destroy() {
2460
+ if (this.picker) {
2461
+ if (this.picker.$body) {
2462
+ this.picker.$body.removeEventListener('click', this._onOptionsClick);
2463
+ }
2464
+ this.picker.destroy();
2465
+ }
2466
+ };
2467
+ _create_class$3(ModePicker, [
2468
+ {
2469
+ key: "current",
2470
+ get: function get() {
2471
+ return this._currentMode;
2472
+ },
2473
+ set: function set(mode) {
2474
+ if (mode !== this._currentMode) {
2475
+ this._currentMode = mode;
2476
+ if (this.picker) {
2477
+ var _this_picker_$body, _this_picker_$body1;
2478
+ var optionEl = (_this_picker_$body = this.picker.$body) == null ? void 0 : _this_picker_$body.querySelector('[data-mode="' + mode + '"]');
2479
+ var activeEls = (_this_picker_$body1 = this.picker.$body) == null ? void 0 : _this_picker_$body1.querySelectorAll('.mode-picker_option-active');
2480
+ activeEls == null ? void 0 : activeEls.forEach(function(el) {
2481
+ return el.classList.remove('mode-picker_option-active');
2482
+ });
2483
+ if (optionEl) optionEl.classList.add('mode-picker_option-active');
2484
+ }
2485
+ }
2486
+ }
2487
+ }
2488
+ ]);
2489
+ return ModePicker;
2490
+ }();
2491
+
2492
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */ function _defineProperties$2(target, props) {
2493
+ for(var i = 0; i < props.length; i++){
2494
+ var descriptor = props[i];
2495
+ descriptor.enumerable = descriptor.enumerable || false;
2496
+ descriptor.configurable = true;
2497
+ if ("value" in descriptor) descriptor.writable = true;
2498
+ Object.defineProperty(target, descriptor.key, descriptor);
2499
+ }
2500
+ }
2501
+ function _create_class$2(Constructor, protoProps, staticProps) {
2502
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
2503
+ return Constructor;
2504
+ }
2505
+ function _extends$5() {
2506
+ _extends$5 = Object.assign || function(target) {
2507
+ for(var i = 1; i < arguments.length; i++){
2508
+ var source = arguments[i];
2509
+ for(var key in source){
2510
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2511
+ target[key] = source[key];
2512
+ }
2513
+ }
2514
+ }
2515
+ return target;
2516
+ };
2517
+ return _extends$5.apply(this, arguments);
2518
+ }
2519
+ function _inherits$4(subClass, superClass) {
2520
+ if (typeof superClass !== "function" && superClass !== null) {
2521
+ throw new TypeError("Super expression must either be null or a function");
2522
+ }
2523
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2524
+ constructor: {
2525
+ value: subClass,
2526
+ writable: true,
2527
+ configurable: true
2528
+ }
2529
+ });
2530
+ if (superClass) _set_prototype_of$4(subClass, superClass);
2531
+ }
2532
+ function _set_prototype_of$4(o, p) {
2533
+ _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2534
+ o.__proto__ = p;
2535
+ return o;
2536
+ };
2537
+ return _set_prototype_of$4(o, p);
2538
+ }
2539
+ /**
2540
+ * 分屏模式控件
2541
+ * @remarks
2542
+ * 提供分屏模式选择功能
2543
+ * @category Control
2544
+ * @public
2545
+ */ var Mode = /*#__PURE__*/ function(Control) {
2546
+ _inherits$4(Mode, Control);
2547
+ function Mode(options) {
2548
+ var _this;
2549
+ var _this_layout;
2550
+ _this = Control.call(this, _extends$5({}, options, {
2551
+ controlType: 'button',
2552
+ classNameSuffix: 'mode'
2553
+ })) || this, _this.mode = 4;
2554
+ _this._onModeChange = options.onModeChange;
2555
+ _this.mode = (_this_layout = _this.layout) == null ? void 0 : _this_layout.mode;
2556
+ _this._render();
2557
+ _this._initModePicker();
2558
+ return _this;
2559
+ }
2560
+ var _proto = Mode.prototype;
2561
+ /**
2562
+ * 点击控件触发
2563
+ * @protected
2564
+ */ _proto._onControlClick = function _onControlClick(e) {
2565
+ Control.prototype._onControlClick.call(this, e);
2566
+ };
2567
+ /**
2568
+ * 渲染控件内容
2569
+ * @private
2570
+ */ _proto._render = function _render() {
2571
+ this.$container.innerHTML = ICONS.screens();
2572
+ };
2573
+ /**
2574
+ * 初始化模式选择器
2575
+ * @private
2576
+ */ _proto._initModePicker = function _initModePicker() {
2577
+ var _this = this;
2578
+ // 延迟初始化,确保 DOM 已挂载
2579
+ setTimeout(function() {
2580
+ var _this_layout;
2581
+ _this._modePicker = new ModePicker(_this.$container, {
2582
+ currentMode: _this.mode,
2583
+ i18n: (_this_layout = _this.layout) == null ? void 0 : _this_layout.i18n,
2584
+ onChange: function(mode) {
2585
+ var // 更新 MultiScreen 模式
2586
+ _this_layout_setMode, _this_layout;
2587
+ (_this_layout = _this.layout) == null ? void 0 : (_this_layout_setMode = _this_layout.setMode) == null ? void 0 : _this_layout_setMode.call(_this_layout, mode);
2588
+ // 触发回调
2589
+ _this._onModeChange == null ? void 0 : _this._onModeChange.call(_this, mode);
2590
+ }
2591
+ });
2592
+ }, 0);
2593
+ };
2594
+ /**
2595
+ * 更新当前模式
2596
+ * @param mode - 分屏模式
2597
+ * @public
2598
+ */ _proto.setMode = function setMode(mode) {
2599
+ if (this.mode !== mode && this._modePicker) {
2600
+ this._modePicker.setMode(mode);
2601
+ }
2602
+ };
2603
+ /**
2604
+ * 销毁控件
2605
+ * @public
2606
+ */ _proto.destroy = function destroy() {
2607
+ if (this._modePicker) {
2608
+ this._modePicker.destroy();
2609
+ this._modePicker = null;
2610
+ }
2611
+ Control.prototype.destroy.call(this);
2612
+ };
2613
+ _create_class$2(Mode, [
2614
+ {
2615
+ key: "modePicker",
2616
+ get: /**
2617
+ * 获取模式选择器实例
2618
+ * @public
2619
+ */ function get() {
2620
+ return this._modePicker;
2621
+ }
2622
+ }
2623
+ ]);
2624
+ return Mode;
2625
+ }(Control);
2626
+ Mode.cname = 'mode';
2627
+
2628
+ /* eslint-disable @typescript-eslint/naming-convention */ function _extends$4() {
2629
+ _extends$4 = Object.assign || function(target) {
2630
+ for(var i = 1; i < arguments.length; i++){
2631
+ var source = arguments[i];
2632
+ for(var key in source){
2633
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2634
+ target[key] = source[key];
2635
+ }
2636
+ }
2637
+ }
2638
+ return target;
2639
+ };
2640
+ return _extends$4.apply(this, arguments);
2641
+ }
2642
+ var __Settings_PANEL_CLASS__ = 'ez-sl_settings';
2643
+ /**
2644
+ * 设置面板组件
2645
+ * @remarks
2646
+ * 提供画面比例、声音设置、浏览器硬解等设置选项
2647
+ * @public
2648
+ */ var SettingsPanel = /*#__PURE__*/ function() {
2649
+ function SettingsPanel(container, options) {
2650
+ this.container = container;
2651
+ this.language = options.language || 'zh';
2652
+ this.i18n = options.i18n;
2653
+ this.onChange = options.onChange;
2654
+ var _options_scaleMode;
2655
+ this.settings = {
2656
+ scaleMode: (_options_scaleMode = options.scaleMode) != null ? _options_scaleMode : 1,
2657
+ audioMode: options.audioMode || 'muted',
2658
+ enableHardwareDecoding: options.enableHardwareDecoding !== false
2659
+ };
2660
+ this._scaleModes = [
2661
+ {
2662
+ label: this.t('scaleModeFill'),
2663
+ value: 0
2664
+ },
2665
+ {
2666
+ label: this.t('scaleModeContain'),
2667
+ value: 1
2668
+ },
2669
+ {
2670
+ label: this.t('scaleModeCover'),
2671
+ value: 2
2672
+ }
2673
+ ];
2674
+ this.init();
2675
+ }
2676
+ var _proto = SettingsPanel.prototype;
2677
+ /**
2678
+ * 获取国际化文本
2679
+ * @private
2680
+ */ _proto.t = function t(key) {
2681
+ var _translations_this_language;
2682
+ if (this.i18n) {
2683
+ return String(this.i18n.t(key));
2684
+ }
2685
+ return ((_translations_this_language = translations[this.language]) == null ? void 0 : _translations_this_language[key]) || key;
2686
+ };
2687
+ /**
2688
+ * 初始化组件
2689
+ * @private
2690
+ */ _proto.init = function init() {
2691
+ this.createPicker();
2692
+ };
2693
+ /**
2694
+ * 创建设置面板 Picker
2695
+ * @private
2696
+ */ _proto.createPicker = function createPicker() {
2697
+ var _this = this;
2698
+ var panelContent = this.getPanelHTML();
2699
+ this.picker = new Picker(this.container, {
2700
+ placement: 'tr',
2701
+ trigger: 'hover',
2702
+ wrapClassName: "" + __Settings_PANEL_CLASS__ + "-dropdown",
2703
+ getPopupContainer: function() {
2704
+ return _this.container;
2705
+ },
2706
+ onOpenChange: function(open) {
2707
+ if (open) {
2708
+ _this.container.classList.add("" + __Settings_PANEL_CLASS__ + "_trigger-open");
2709
+ } else {
2710
+ _this.container.classList.remove("" + __Settings_PANEL_CLASS__ + "_trigger-open");
2711
+ }
2712
+ }
2713
+ });
2714
+ this.picker.innerHTML(panelContent);
2715
+ // 绑定事件
2716
+ setTimeout(function() {
2717
+ _this.bindEvents();
2718
+ }, 0);
2719
+ };
2720
+ /**
2721
+ * 获取面板 HTML
2722
+ * @private
2723
+ */ _proto.getPanelHTML = function getPanelHTML() {
2724
+ var _this = this;
2725
+ return '\n <div class="' + __Settings_PANEL_CLASS__ + '">\n <div class="' + __Settings_PANEL_CLASS__ + '_section">\n <div class="' + __Settings_PANEL_CLASS__ + '_section-title">' + this.t('scaleMode') + '</div>\n <div class="' + __Settings_PANEL_CLASS__ + '_aspect-ratio">\n ' + this._scaleModes.map(function(item, index) {
2726
+ return '<button class="' + __Settings_PANEL_CLASS__ + "_ratio-btn " + (_this.settings.scaleMode === index ? "" + __Settings_PANEL_CLASS__ + "_ratio-btn-active" : '') + '" \n data-ratio="' + index + '">' + item.label + "</button>";
2727
+ }).join('') + '\n </div>\n </div>\n\n <div class="' + __Settings_PANEL_CLASS__ + '_section">\n <div class="' + __Settings_PANEL_CLASS__ + '_section-title">' + this.t('audioSettings') + '</div>\n <div class="' + __Settings_PANEL_CLASS__ + '_audio-select">\n <span class="' + __Settings_PANEL_CLASS__ + '_audio-text">' + this.getAudioModeText() + '</span>\n <span class="' + __Settings_PANEL_CLASS__ + '_audio-arrow">▼</span>\n </div>\n </div>\n\n <div class="' + __Settings_PANEL_CLASS__ + '_section">\n <div class="' + __Settings_PANEL_CLASS__ + '_toggle-item">\n <div class="' + __Settings_PANEL_CLASS__ + '_toggle-info">\n <div class="' + __Settings_PANEL_CLASS__ + '_toggle-title">' + this.t('enableHardwareDecoding') + '</div>\n <div class="' + __Settings_PANEL_CLASS__ + '_toggle-desc">' + this.t('enableHardwareDecodingDesc') + '</div>\n </div>\n <label class="' + __Settings_PANEL_CLASS__ + '_switch">\n <input type="checkbox" ' + (this.settings.enableHardwareDecoding ? 'checked' : '') + ' data-setting="enableHardwareDecoding">\n <span class="' + __Settings_PANEL_CLASS__ + '_switch-slider"></span>\n </label>\n </div>\n </div>\n </div>\n ';
2728
+ };
2729
+ /**
2730
+ * 获取音频模式文本
2731
+ * @private
2732
+ */ _proto.getAudioModeText = function getAudioModeText() {
2733
+ var modeMap = {
2734
+ selected: this.t('audioSelected'),
2735
+ all: this.t('audioAll'),
2736
+ muted: this.t('audioMutedAll')
2737
+ };
2738
+ return modeMap[this.settings.audioMode || 'muted'];
2739
+ };
2740
+ /**
2741
+ * 绑定事件
2742
+ * @private
2743
+ */ _proto.bindEvents = function bindEvents() {
2744
+ var _this = this;
2745
+ var pickerBody = this.picker.$body;
2746
+ if (!pickerBody) return;
2747
+ // 画面比例按钮
2748
+ var ratioButtons = pickerBody.querySelectorAll("." + __Settings_PANEL_CLASS__ + "_ratio-btn");
2749
+ ratioButtons.forEach(function(btn) {
2750
+ btn.addEventListener('click', function() {
2751
+ var ratioAttr = btn.dataset.ratio;
2752
+ var ratio = Number(ratioAttr);
2753
+ if (Number.isNaN(ratio)) return;
2754
+ _this.setScaleMode(ratio);
2755
+ });
2756
+ });
2757
+ // 音频选择下拉框
2758
+ var audioTrigger = pickerBody.querySelector("." + __Settings_PANEL_CLASS__ + "_audio-select");
2759
+ if (audioTrigger) {
2760
+ this.createAudioPicker(audioTrigger);
2761
+ }
2762
+ // 开关按钮
2763
+ var switches = pickerBody.querySelectorAll("." + __Settings_PANEL_CLASS__ + "_switch input");
2764
+ switches.forEach(function(input) {
2765
+ input.addEventListener('change', function(e) {
2766
+ var target = e.target;
2767
+ var setting = target.dataset.setting;
2768
+ var hasChanged = _this.settings[setting] !== target.checked;
2769
+ if (hasChanged) {
2770
+ _this.settings[setting] = target.checked;
2771
+ _this.notifyChange();
2772
+ }
2773
+ });
2774
+ });
2775
+ };
2776
+ /**
2777
+ * 创建音频选择器
2778
+ * @private
2779
+ */ _proto.createAudioPicker = function createAudioPicker(trigger) {
2780
+ var _this = this;
2781
+ var dropdownContent = '\n <div class="' + __Settings_PANEL_CLASS__ + '_audio-dropdown">\n <div class="' + __Settings_PANEL_CLASS__ + "_audio-option " + (this.settings.audioMode === 'muted' ? "" + __Settings_PANEL_CLASS__ + "_audio-option-active" : '') + '" \n data-mode="muted">' + this.t('audioMutedAll') + '</div>\n <div class="' + __Settings_PANEL_CLASS__ + "_audio-option " + (this.settings.audioMode === 'selected' ? "" + __Settings_PANEL_CLASS__ + "_audio-option-active" : '') + '" \n data-mode="selected">' + this.t('audioSelected') + '</div>\n <div class="' + __Settings_PANEL_CLASS__ + "_audio-option " + (this.settings.audioMode === 'all' ? "" + __Settings_PANEL_CLASS__ + "_audio-option-active" : '') + '" \n data-mode="all">' + this.t('audioAll') + "</div>\n </div>\n ";
2782
+ this.audioPicker = new Picker(trigger, {
2783
+ placement: 'bl',
2784
+ trigger: 'hover',
2785
+ wrapClassName: "" + __Settings_PANEL_CLASS__ + "-audio-dropdown",
2786
+ getPopupContainer: function() {
2787
+ return trigger;
2788
+ }
2789
+ });
2790
+ this.audioPicker.innerHTML(dropdownContent);
2791
+ // 绑定选项点击事件
2792
+ setTimeout(function() {
2793
+ var _this_audioPicker;
2794
+ var pickerBody = (_this_audioPicker = _this.audioPicker) == null ? void 0 : _this_audioPicker.$body;
2795
+ if (pickerBody) {
2796
+ pickerBody.addEventListener('click', function(e) {
2797
+ var target = e.target;
2798
+ var optionEl = target.closest("." + __Settings_PANEL_CLASS__ + "_audio-option");
2799
+ if (optionEl) {
2800
+ var mode = optionEl.dataset.mode;
2801
+ _this.setAudioMode(mode);
2802
+ if (_this.audioPicker) _this.audioPicker.open = false;
2803
+ e.stopPropagation();
2804
+ e.preventDefault();
2805
+ }
2806
+ });
2807
+ }
2808
+ }, 0);
2809
+ };
2810
+ /**
2811
+ * 设置画面比例
2812
+ * @param ratio - 画面比例
2813
+ */ _proto.setScaleMode = function setScaleMode(ratio) {
2814
+ var hasChanged = this.settings.scaleMode !== ratio;
2815
+ if (hasChanged) this.settings.scaleMode = ratio;
2816
+ // 更新按钮状态
2817
+ var pickerBody = this.picker.$body;
2818
+ if (pickerBody) {
2819
+ var buttons = pickerBody.querySelectorAll("." + __Settings_PANEL_CLASS__ + "_ratio-btn");
2820
+ buttons.forEach(function(btn) {
2821
+ if (btn.dataset.ratio === String(ratio)) {
2822
+ btn.classList.add("" + __Settings_PANEL_CLASS__ + "_ratio-btn-active");
2823
+ } else {
2824
+ btn.classList.remove("" + __Settings_PANEL_CLASS__ + "_ratio-btn-active");
2825
+ }
2826
+ });
2827
+ }
2828
+ if (hasChanged) this.notifyChange();
2829
+ };
2830
+ /**
2831
+ * 设置音频模式
2832
+ * @param mode - 音频模式
2833
+ */ _proto.setAudioMode = function setAudioMode(mode) {
2834
+ var hasChanged = this.settings.audioMode !== mode;
2835
+ if (!hasChanged) return;
2836
+ if (hasChanged) this.settings.audioMode = mode;
2837
+ // 更新显示文本
2838
+ var pickerBody = this.picker.$body;
2839
+ if (pickerBody) {
2840
+ var textEl = pickerBody.querySelector("." + __Settings_PANEL_CLASS__ + "_audio-text");
2841
+ if (textEl) {
2842
+ textEl.textContent = this.getAudioModeText();
2843
+ }
2844
+ }
2845
+ // 更新下拉选项状态
2846
+ if (this.audioPicker) {
2847
+ var _this_audioPicker_$body;
2848
+ var options = (_this_audioPicker_$body = this.audioPicker.$body) == null ? void 0 : _this_audioPicker_$body.querySelectorAll("." + __Settings_PANEL_CLASS__ + "_audio-option");
2849
+ options == null ? void 0 : options.forEach(function(opt) {
2850
+ if (opt.dataset.mode === mode) {
2851
+ opt.classList.add("" + __Settings_PANEL_CLASS__ + "_audio-option-active");
2852
+ } else {
2853
+ opt.classList.remove("" + __Settings_PANEL_CLASS__ + "_audio-option-active");
2854
+ }
2855
+ });
2856
+ }
2857
+ // 关闭下拉框
2858
+ if (this.audioPicker) {
2859
+ this.audioPicker.open = false;
2860
+ }
2861
+ if (hasChanged) this.notifyChange();
2862
+ };
2863
+ /**
2864
+ * 获取当前设置
2865
+ */ _proto.getSettings = function getSettings() {
2866
+ return _extends$4({}, this.settings);
2867
+ };
2868
+ /**
2869
+ * 通知设置变化
2870
+ * @private
2871
+ */ _proto.notifyChange = function notifyChange() {
2872
+ if (this.onChange) {
2873
+ this.onChange(this.getSettings());
2874
+ }
2875
+ };
2876
+ /**
2877
+ * 销毁组件
2878
+ */ _proto.destroy = function destroy() {
2879
+ if (this.audioPicker) {
2880
+ this.audioPicker.destroy();
2881
+ }
2882
+ if (this.picker) {
2883
+ this.picker.destroy();
2884
+ }
2885
+ };
2886
+ return SettingsPanel;
2887
+ }();
2888
+
2889
+ function _defineProperties$1(target, props) {
2890
+ for(var i = 0; i < props.length; i++){
2891
+ var descriptor = props[i];
2892
+ descriptor.enumerable = descriptor.enumerable || false;
2893
+ descriptor.configurable = true;
2894
+ if ("value" in descriptor) descriptor.writable = true;
2895
+ Object.defineProperty(target, descriptor.key, descriptor);
2896
+ }
2897
+ }
2898
+ function _create_class$1(Constructor, protoProps, staticProps) {
2899
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
2900
+ return Constructor;
2901
+ }
2902
+ function _extends$3() {
2903
+ _extends$3 = Object.assign || function(target) {
2904
+ for(var i = 1; i < arguments.length; i++){
2905
+ var source = arguments[i];
2906
+ for(var key in source){
2907
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2908
+ target[key] = source[key];
2909
+ }
2910
+ }
2911
+ }
2912
+ return target;
2913
+ };
2914
+ return _extends$3.apply(this, arguments);
2915
+ }
2916
+ function _inherits$3(subClass, superClass) {
2917
+ if (typeof superClass !== "function" && superClass !== null) {
2918
+ throw new TypeError("Super expression must either be null or a function");
2919
+ }
2920
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2921
+ constructor: {
2922
+ value: subClass,
2923
+ writable: true,
2924
+ configurable: true
2925
+ }
2926
+ });
2927
+ if (superClass) _set_prototype_of$3(subClass, superClass);
2928
+ }
2929
+ function _set_prototype_of$3(o, p) {
2930
+ _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2931
+ o.__proto__ = p;
2932
+ return o;
2933
+ };
2934
+ return _set_prototype_of$3(o, p);
2935
+ }
2936
+ /**
2937
+ * 设置控件
2938
+ * @remarks
2939
+ * 提供画面比例、声音设置、浏览器硬解等设置选项
2940
+ * @category Control
2941
+ * @public
2942
+ */ var Settings = /*#__PURE__*/ function(Control) {
2943
+ _inherits$3(Settings, Control);
2944
+ function Settings(options) {
2945
+ var _this;
2946
+ _this = Control.call(this, _extends$3({}, options, {
2947
+ controlType: 'button',
2948
+ classNameSuffix: 'settings'
2949
+ })) || this;
2950
+ _this._layout = options.layout;
2951
+ _this._onSettingsChange = options.onSettingsChange;
2952
+ // 添加特殊的包装类名用于 Picker 定位
2953
+ _this.$container.classList.add('ez-sl-toolbar-item-settings');
2954
+ _this._render();
2955
+ _this._initSettingsPanel();
2956
+ return _this;
2957
+ }
2958
+ var _proto = Settings.prototype;
2959
+ /**
2960
+ * 点击控件触发
2961
+ * @protected
2962
+ */ _proto._onControlClick = function _onControlClick(e) {
2963
+ // 点击事件由 SettingsPanel 的 Picker 处理
2964
+ Control.prototype._onControlClick.call(this, e);
2965
+ };
2966
+ /**
2967
+ * 渲染控件内容
2968
+ * @private
2969
+ */ _proto._render = function _render() {
2970
+ this.$container.innerHTML = ICONS.setting();
2971
+ };
2972
+ /**
2973
+ * 初始化设置面板
2974
+ * @private
2975
+ */ _proto._initSettingsPanel = function _initSettingsPanel() {
2976
+ var _this = this;
2977
+ // 延迟初始化,确保 DOM 已挂载
2978
+ setTimeout(function() {
2979
+ var _this__layout_i18n;
2980
+ _this._settingsPanel = new SettingsPanel(_this.$container, {
2981
+ language: ((_this__layout_i18n = _this._layout.i18n) == null ? void 0 : _this__layout_i18n.locale) || 'zh',
2982
+ i18n: _this._layout.i18n || undefined,
2983
+ scaleMode: _this._layout.scaleMode,
2984
+ audioMode: _this._layout.audioMode || "muted",
2985
+ enableHardwareDecoding: _this._layout.enableHardwareDecoding,
2986
+ onChange: function(settings) {
2987
+ if (settings.audioMode !== _this._layout.audioMode) {
2988
+ _this._layout.setAudioMode(settings.audioMode);
2989
+ }
2990
+ if (settings.enableHardwareDecoding !== _this._layout.enableHardwareDecoding) {
2991
+ // 重试初始化播放器生效
2992
+ _this._layout.enableHardwareDecoding = settings.enableHardwareDecoding;
2993
+ }
2994
+ if (settings.scaleMode !== _this._layout.scaleMode) {
2995
+ _this._layout.setScaleMode(settings.scaleMode);
2996
+ }
2997
+ // 触发回调
2998
+ _this._onSettingsChange == null ? void 0 : _this._onSettingsChange.call(_this, settings);
2999
+ _this.emit("setting:change", settings);
3000
+ }
3001
+ });
3002
+ }, 0);
3003
+ };
3004
+ /**
3005
+ * 销毁控件
3006
+ * @public
3007
+ */ _proto.destroy = function destroy() {
3008
+ if (this._settingsPanel) {
3009
+ this._settingsPanel.destroy();
3010
+ }
3011
+ Control.prototype.destroy.call(this);
3012
+ };
3013
+ _create_class$1(Settings, [
3014
+ {
3015
+ key: "settingsPanel",
3016
+ get: /**
3017
+ * 获取设置面板实例
3018
+ * @public
3019
+ */ function get() {
3020
+ return this._settingsPanel;
3021
+ }
3022
+ }
3023
+ ]);
3024
+ return Settings;
3025
+ }(Control);
3026
+ Settings.cname = 'settings';
3027
+
3028
+ function _extends$2() {
3029
+ _extends$2 = Object.assign || function(target) {
3030
+ for(var i = 1; i < arguments.length; i++){
3031
+ var source = arguments[i];
3032
+ for(var key in source){
3033
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3034
+ target[key] = source[key];
3035
+ }
3036
+ }
3037
+ }
3038
+ return target;
3039
+ };
3040
+ return _extends$2.apply(this, arguments);
3041
+ }
3042
+ function _inherits$2(subClass, superClass) {
3043
+ if (typeof superClass !== "function" && superClass !== null) {
3044
+ throw new TypeError("Super expression must either be null or a function");
3045
+ }
3046
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3047
+ constructor: {
3048
+ value: subClass,
3049
+ writable: true,
3050
+ configurable: true
3051
+ }
3052
+ });
3053
+ if (superClass) _set_prototype_of$2(subClass, superClass);
3054
+ }
3055
+ function _set_prototype_of$2(o, p) {
3056
+ _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3057
+ o.__proto__ = p;
3058
+ return o;
3059
+ };
3060
+ return _set_prototype_of$2(o, p);
3061
+ }
3062
+ /**
3063
+ * 网页全屏控件
3064
+ * @remarks
3065
+ * 提供网页全屏功能(伪全屏,仅在网页内全屏)
3066
+ * @category Control
3067
+ * @public
3068
+ */ var WebFullscreen = /*#__PURE__*/ function(Control) {
3069
+ _inherits$2(WebFullscreen, Control);
3070
+ function WebFullscreen(options) {
3071
+ var _this;
3072
+ _this = Control.call(this, _extends$2({}, options, {
3073
+ controlType: 'button',
3074
+ classNameSuffix: 'web-fullscreen'
3075
+ })) || this;
3076
+ _this.layout = options.layout;
3077
+ _this._render();
3078
+ return _this;
3079
+ }
3080
+ var _proto = WebFullscreen.prototype;
3081
+ /**
3082
+ * 点击控件触发
3083
+ * @protected
3084
+ */ _proto._onControlClick = function _onControlClick(e) {
3085
+ var _this = this;
3086
+ this.layout.toggleWebFullscreen == null ? void 0 : this.layout.toggleWebFullscreen.call(this.layout).then(function() {
3087
+ _this._render();
3088
+ });
3089
+ Control.prototype._onControlClick.call(this, e);
3090
+ };
3091
+ /**
3092
+ * 渲染控件内容
3093
+ * @private
3094
+ */ _proto._render = function _render() {
3095
+ this.$container.innerHTML = this.layout.isWebFullscreen ? ICONS.exitWebFullscreen() : ICONS.webFullscreen();
3096
+ };
3097
+ /**
3098
+ * 更新控件显示
3099
+ * @public
3100
+ */ _proto.update = function update() {
3101
+ this._render();
3102
+ };
3103
+ return WebFullscreen;
3104
+ }(Control);
3105
+ WebFullscreen.cname = 'webFullscreen';
3106
+
3107
+ function _extends$1() {
3108
+ _extends$1 = Object.assign || function(target) {
3109
+ for(var i = 1; i < arguments.length; i++){
3110
+ var source = arguments[i];
3111
+ for(var key in source){
3112
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3113
+ target[key] = source[key];
3114
+ }
3115
+ }
3116
+ }
3117
+ return target;
3118
+ };
3119
+ return _extends$1.apply(this, arguments);
3120
+ }
3121
+ function _inherits$1(subClass, superClass) {
3122
+ if (typeof superClass !== "function" && superClass !== null) {
3123
+ throw new TypeError("Super expression must either be null or a function");
3124
+ }
3125
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3126
+ constructor: {
3127
+ value: subClass,
3128
+ writable: true,
3129
+ configurable: true
3130
+ }
3131
+ });
3132
+ if (superClass) _set_prototype_of$1(subClass, superClass);
3133
+ }
3134
+ function _set_prototype_of$1(o, p) {
3135
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3136
+ o.__proto__ = p;
3137
+ return o;
3138
+ };
3139
+ return _set_prototype_of$1(o, p);
3140
+ }
3141
+ /**
3142
+ * 全局全屏控件
3143
+ * @remarks
3144
+ * 提供浏览器原生全屏功能
3145
+ * @category Control
3146
+ * @public
3147
+ */ var Fullscreen = /*#__PURE__*/ function(Control) {
3148
+ _inherits$1(Fullscreen, Control);
3149
+ function Fullscreen(options) {
3150
+ var _this;
3151
+ _this = Control.call(this, _extends$1({}, options, {
3152
+ controlType: 'button',
3153
+ classNameSuffix: 'fullscreen'
3154
+ })) || this;
3155
+ _this.layout = options.layout;
3156
+ _this._render();
3157
+ return _this;
3158
+ }
3159
+ var _proto = Fullscreen.prototype;
3160
+ /**
3161
+ * 点击控件触发
3162
+ * @protected
3163
+ */ _proto._onControlClick = function _onControlClick(e) {
3164
+ var _this = this;
3165
+ this.layout.toggleFullscreen == null ? void 0 : this.layout.toggleFullscreen.call(this.layout).then(function() {
3166
+ _this._render();
3167
+ });
3168
+ Control.prototype._onControlClick.call(this, e);
3169
+ };
3170
+ /**
3171
+ * 渲染控件内容
3172
+ * @private
3173
+ */ _proto._render = function _render() {
3174
+ this.$container.innerHTML = this.layout.isGlobalFullscreen ? ICONS.exitFullscreen() : ICONS.fullscreen();
3175
+ };
3176
+ /**
3177
+ * 更新控件显示
3178
+ * @public
3179
+ */ _proto.update = function update() {
3180
+ this._render();
3181
+ };
3182
+ return Fullscreen;
3183
+ }(Control);
3184
+ Fullscreen.cname = 'fullscreen';
3185
+
3186
+ // Control class constructors for left toolbar
3187
+ var LeftControls = [
3188
+ Play,
3189
+ Muted,
3190
+ Screenshot
3191
+ ];
3192
+ // Control class constructors for right toolbar
3193
+ var RightControls = [
3194
+ Mode,
3195
+ Settings,
3196
+ WebFullscreen,
3197
+ Fullscreen
3198
+ ];
3199
+ var __CAN_DISABLED_CONTROL__ = [
3200
+ 'play',
3201
+ 'muted',
3202
+ 'screenshot'
3203
+ ];
3204
+
3205
+ /**
3206
+ * 切换网页全屏模式
3207
+ * @private
3208
+ */ function _toggleWebFullscreen(layout) {
3209
+ if (!layout.isWebFullscreen) {
3210
+ layout.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "_web-fullscreen");
3211
+ layout.isWebFullscreen = true;
3212
+ } else {
3213
+ layout.$container.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "_web-fullscreen");
3214
+ layout.isWebFullscreen = false;
3215
+ }
3216
+ layout.emit('fullscreen:change', layout.isWebFullscreen, 'web');
3217
+ return Promise.resolve();
3218
+ }
3219
+ /**
3220
+ * 切换全局全屏模式
3221
+ * @private
3222
+ */ function _toggleGlobalFullscreen(layout) {
3223
+ if (!screenfull.isEnabled) {
3224
+ return Promise.reject();
3225
+ }
3226
+ if (!layout.isGlobalFullscreen) {
3227
+ // prettier-ignore
3228
+ return screenfull.request(layout.$container).then(function() {
3229
+ layout.isGlobalFullscreen = true;
3230
+ layout.emit('fullscreen:change', true, 'global');
3231
+ }).catch(function(err) {
3232
+ });
3233
+ } else {
3234
+ // prettier-ignore
3235
+ return screenfull.exit().then(function() {
3236
+ layout.isGlobalFullscreen = false;
3237
+ layout.emit('fullscreen:change', false, 'global');
3238
+ }).catch(function(err) {
3239
+ });
3240
+ }
3241
+ }
3242
+
3243
+ function _screenshot(layout, filename, format, quality, type, index) {
3244
+ var _layout_players__index_screenshot, _layout_players__index;
3245
+ if (index === undefined) index = layout.current;
3246
+ if (index < 1 || index > layout._totalScreens) {
3247
+ return;
3248
+ }
3249
+ var _index = index - 1; // 数组下标
3250
+ if (layout.players[_index]) return (_layout_players__index = layout.players[_index]) == null ? void 0 : (_layout_players__index_screenshot = _layout_players__index.screenshot) == null ? void 0 : _layout_players__index_screenshot.call(_layout_players__index, filename, format, quality, type);
3251
+ }
3252
+
3253
+ function _destroy(layout) {
3254
+ var _layout_players;
3255
+ // 销毁播放器
3256
+ if (((_layout_players = layout.players) == null ? void 0 : _layout_players.length) > 0) {
3257
+ layout.players.forEach(function(player, index) {
3258
+ if (player) layout.close(index + 1); // close 方法会销毁播放器并清理分屏数据
3259
+ });
3260
+ layout.players = [];
3261
+ }
3262
+ // 销毁所有控件
3263
+ if (layout.controls) {
3264
+ Object.keys(layout.controls).forEach(function(controlName) {
3265
+ return layout.controls[controlName].destroy();
3266
+ });
3267
+ layout.controls = null;
3268
+ }
3269
+ // 移除 screenfull 事件监听器
3270
+ if (screenfull.isEnabled && layout._fullscreenChangeHandler) {
3271
+ screenfull.off('change', layout._fullscreenChangeHandler);
3272
+ layout._fullscreenChangeHandler = null;
3273
+ }
3274
+ // 清理国际化
3275
+ if (layout.i18n) layout.i18n = null;
3276
+ // 移除所有事件监听器
3277
+ layout.removeAllListeners();
3278
+ // 清空容器
3279
+ layout.$container.innerHTML = '';
3280
+ }
3281
+
3282
+ /* eslint-disable @typescript-eslint/array-type */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/promise-function-async */ /* eslint-disable @typescript-eslint/no-explicit-any */ function _defineProperties(target, props) {
3283
+ for(var i = 0; i < props.length; i++){
3284
+ var descriptor = props[i];
3285
+ descriptor.enumerable = descriptor.enumerable || false;
3286
+ descriptor.configurable = true;
3287
+ if ("value" in descriptor) descriptor.writable = true;
3288
+ Object.defineProperty(target, descriptor.key, descriptor);
3289
+ }
3290
+ }
3291
+ function _create_class(Constructor, protoProps, staticProps) {
3292
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3293
+ return Constructor;
3294
+ }
3295
+ function _extends() {
3296
+ _extends = Object.assign || function(target) {
3297
+ for(var i = 1; i < arguments.length; i++){
3298
+ var source = arguments[i];
3299
+ for(var key in source){
3300
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3301
+ target[key] = source[key];
3302
+ }
3303
+ }
3304
+ }
3305
+ return target;
3306
+ };
3307
+ return _extends.apply(this, arguments);
3308
+ }
3309
+ function _inherits(subClass, superClass) {
3310
+ if (typeof superClass !== "function" && superClass !== null) {
3311
+ throw new TypeError("Super expression must either be null or a function");
3312
+ }
3313
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3314
+ constructor: {
3315
+ value: subClass,
3316
+ writable: true,
3317
+ configurable: true
3318
+ }
3319
+ });
3320
+ if (superClass) _set_prototype_of(subClass, superClass);
3321
+ }
3322
+ function _set_prototype_of(o, p) {
3323
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3324
+ o.__proto__ = p;
3325
+ return o;
3326
+ };
3327
+ return _set_prototype_of(o, p);
3328
+ }
3329
+ function _type_of(obj) {
3330
+ "@swc/helpers - typeof";
3331
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3332
+ }
3333
+ /**
3334
+ * 分屏布局组件
3335
+ * @remarks
3336
+ * 支持多种分屏模式、主题切换、国际化、全屏显示等功能
3337
+ * @example
3338
+ * ```typescript
3339
+ * import MultiScreen from '@ezuikit/player-multi-screen';
3340
+ * import '@ezuikit/player-multi-screen/style.css';
3341
+ * const layout = new MultiScreen('app', Player{
3342
+ * mode: 4,
3343
+ * theme: 'dark',
3344
+ * language: 'zh',
3345
+ * screens: [
3346
+ * { url: 'https://www.example.com/video.flv' },
3347
+ * { url: 'https://www.example.com/video.flv' }
3348
+ * ]
3349
+ * });
3350
+ * // 切换分屏模式
3351
+ * layout.setMode(9);
3352
+ * // 切换主题
3353
+ * layout.setTheme('light');
3354
+ * ```
3355
+ * @public
3356
+ */ var MultiScreen = /*#__PURE__*/ function(EventEmitter) {
3357
+ _inherits(MultiScreen, EventEmitter);
3358
+ function MultiScreen(containerID, Player, options) {
3359
+ var _this;
3360
+ var _this1;
3361
+ _this = EventEmitter.call(this) || this, /** 播放器实例数组 */ _this.players = [], /** 当前选中的分屏索引 */ _this._current = 0, // private _totalScreens = 4;
3362
+ _this._isGlobalFullscreenOp = false, /** 控件集合 */ _this.controls = {}, /** 填充模式 */ _this.scaleMode = 1, /** 音频模式 */ _this.audioMode = 'muted', /** 是否正在播放 */ _this.playing = false, /** 是网页全屏 */ _this.isWebFullscreen = false, /** 是全局全屏 */ _this.isGlobalFullscreen = false, /** 是否启用硬件解码 */ _this.enableHardwareDecoding = true, _this.language = 'zh', _this._delegations = [], _this._delegationsClose = [];
3363
+ // 初始化容器
3364
+ _this.$container = document.getElementById(containerID);
3365
+ _this.options = deepmerge.all([
3366
+ __EZ_SL_OPTIONS__,
3367
+ options
3368
+ ], {
3369
+ clone: false
3370
+ });
3371
+ _this._Player = Player;
3372
+ if (!_this.$container) throw new Error('Container not found');
3373
+ if (!_this._Player) ;
3374
+ // 初始化配置
3375
+ _this.mode = _this.options.mode || 4;
3376
+ _this.customLayout = _this.options.customLayout;
3377
+ _this.enableHardwareDecoding = _this.options.enableHardwareDecoding !== false;
3378
+ _this.language = [
3379
+ 'zh',
3380
+ 'en'
3381
+ ].includes(_this.options.language) ? _this.options.language : 'zh';
3382
+ if (((_this1 = options.screens || []) == null ? void 0 : _this1.length) < _this._totalScreens) {
3383
+ _this._screens = [].concat(options.screens || [], new Array(_this._totalScreens - (options.screens || []).length).fill(null));
3384
+ } else {
3385
+ _this._screens = options.screens || [];
3386
+ }
3387
+ _this.theme = _this.options.theme || 'dark';
3388
+ _this.showToolbar = _this.options.showToolbar !== false;
3389
+ _this.scaleMode = [
3390
+ 0,
3391
+ 1,
3392
+ 2
3393
+ ].includes(_this.options.scaleMode) ? _this.options.scaleMode : 1;
3394
+ _this.audioMode = [
3395
+ 'muted',
3396
+ 'all',
3397
+ 'selected'
3398
+ ].includes(_this.options.audioMode) ? _this.options.audioMode : 'muted';
3399
+ // 初始化国际化
3400
+ _this.i18n = new I18n(translations, {
3401
+ defaultLocale: _this.language
3402
+ });
3403
+ // 绑定事件回调
3404
+ if (options.onScreenClick) _this.on('screen:click', options.onScreenClick);
3405
+ if (options.onModeChange) _this.on('mode:change', options.onModeChange);
3406
+ if (options.onFullscreenChange) _this.on('fullscreen:change', options.onFullscreenChange);
3407
+ // 初始化UI
3408
+ _this._init();
3409
+ _this.current = 1;
3410
+ return _this;
3411
+ }
3412
+ var _proto = MultiScreen.prototype;
3413
+ /**
3414
+ * 初始化组件
3415
+ * @private
3416
+ */ _proto._init = function _init() {
3417
+ this.$container.classList.add(_EZ_SL_CLASS_PREFIX_);
3418
+ this.$container.setAttribute('data-theme', this.theme);
3419
+ // 创建分屏容器
3420
+ this.$screenContainer = document.createElement('div');
3421
+ this.$screenContainer.className = "" + _EZ_SL_CLASS_PREFIX_ + "_container";
3422
+ this.$container.appendChild(this.$screenContainer);
3423
+ // 创建工具栏
3424
+ if (this.showToolbar) {
3425
+ this.toolbar = document.createElement('div');
3426
+ this.toolbar.className = "" + _EZ_SL_CLASS_PREFIX_ + "_toolbar";
3427
+ this.$container.appendChild(this.toolbar);
3428
+ // 创建工具栏左右容器
3429
+ this.$toolbarLeft = document.createElement('div');
3430
+ this.$toolbarLeft.className = "" + _EZ_SL_CLASS_PREFIX_ + "_toolbar-left";
3431
+ this.toolbar.appendChild(this.$toolbarLeft);
3432
+ this.$toolbarRight = document.createElement('div');
3433
+ this.$toolbarRight.className = "" + _EZ_SL_CLASS_PREFIX_ + "_toolbar-right";
3434
+ this.toolbar.appendChild(this.$toolbarRight);
3435
+ // 初始化控件(在 UI 创建后)
3436
+ this._initControls(this.options);
3437
+ }
3438
+ // 渲染分屏
3439
+ this._renderScreens();
3440
+ // 监听全屏变化
3441
+ this._listenFullscreenChange();
3442
+ };
3443
+ /**
3444
+ * 初始化控件
3445
+ * @private
3446
+ */ _proto._initControls = function _initControls(options) {
3447
+ var _this = this;
3448
+ if (this.controls === null) this.controls = {};
3449
+ var leftControls = [].concat(LeftControls, options.plugins || []);
3450
+ // 处理左侧控件
3451
+ leftControls.forEach(function(ControlClass) {
3452
+ var controlName = upperCamel(ControlClass.cname || '');
3453
+ var optionKey = "" + controlName + "Options";
3454
+ if (options[optionKey] !== null) {
3455
+ var control = new ControlClass({
3456
+ layout: _this,
3457
+ getPopupContainer: function() {
3458
+ return _this.$toolbarLeft;
3459
+ }
3460
+ });
3461
+ _this.controls[ControlClass.cname] = control;
3462
+ }
3463
+ });
3464
+ this._disabledControl();
3465
+ // 处理右侧控件
3466
+ RightControls.forEach(function(ControlClass) {
3467
+ var controlName = upperCamel(ControlClass.cname || '');
3468
+ var optionKey = "" + controlName + "Options";
3469
+ if (options[optionKey] !== null) {
3470
+ var control = new ControlClass({
3471
+ layout: _this,
3472
+ getPopupContainer: function() {
3473
+ return _this.$toolbarRight;
3474
+ }
3475
+ });
3476
+ _this.controls[ControlClass.cname] = control;
3477
+ }
3478
+ });
3479
+ };
3480
+ /**
3481
+ * 渲染分屏列表
3482
+ * @private
3483
+ */ _proto._renderScreens = function _renderScreens() {
3484
+ var _this = this;
3485
+ var config = this.mode === 'custom' && this.customLayout ? this.customLayout : getLayoutConfig(this.mode);
3486
+ this.$screenContainer.style.gridTemplateColumns = "repeat(" + config.cols + ", 1fr)";
3487
+ this.$screenContainer.style.gridTemplateRows = "repeat(" + config.rows + ", 1fr)";
3488
+ var existingScreens = this.$screenContainer.querySelectorAll("." + _EZ_SL_CLASS_PREFIX_ + "_screen");
3489
+ // 复用或创建屏幕元素
3490
+ for(var i = 0; i < this._totalScreens; i++){
3491
+ var screen = this._screens[i] || {
3492
+ id: i
3493
+ };
3494
+ var screenEl = existingScreens[i];
3495
+ if (!screenEl) {
3496
+ // 创建新的屏幕元素
3497
+ screenEl = this._createScreenElement(screen, i);
3498
+ this.$screenContainer.appendChild(screenEl);
3499
+ }
3500
+ }
3501
+ if (this._totalScreens < existingScreens.length) this.current = 1;
3502
+ // 移除多余的屏幕元素
3503
+ for(var i1 = this._totalScreens; i1 < existingScreens.length; i1++){
3504
+ if (this.players[i1]) {
3505
+ var _this_players_i_destroy, _this_players_i;
3506
+ (_this_players_i = this.players[i1]) == null ? void 0 : (_this_players_i_destroy = _this_players_i.destroy) == null ? void 0 : _this_players_i_destroy.call(_this_players_i);
3507
+ this.players[i1] = null;
3508
+ }
3509
+ existingScreens[i1].remove();
3510
+ }
3511
+ if (this._delegations.length > 0) {
3512
+ this._delegations.forEach(function(delegation) {
3513
+ return delegation.destroy();
3514
+ });
3515
+ this._delegations = [];
3516
+ }
3517
+ // 只在首次渲染时绑定事件委托
3518
+ this._delegations = delegate(this.$screenContainer, "div." + _EZ_SL_CLASS_PREFIX_ + "_screen", 'click', function(event) {
3519
+ var index = parseInt(event.delegateTarget.dataset.index || '1', 10);
3520
+ _this.current = index;
3521
+ });
3522
+ if (this._delegationsClose.length > 0) {
3523
+ this._delegationsClose.forEach(function(delegation) {
3524
+ return delegation.destroy();
3525
+ });
3526
+ this._delegationsClose = [];
3527
+ }
3528
+ this._delegationsClose = delegate(this.$screenContainer, "div." + _EZ_SL_CLASS_PREFIX_ + "_screen-close", 'click', function(event) {
3529
+ var $parentEle = event.delegateTarget.parentElement;
3530
+ var index = parseInt($parentEle.dataset.index || '1', 10);
3531
+ _this.close(index);
3532
+ });
3533
+ var len = this._totalScreens;
3534
+ for(var i2 = 0; i2 < len; i2++){
3535
+ if (![
3536
+ null,
3537
+ undefined
3538
+ ].includes(this._screens[i2])) {
3539
+ if (!this.players[i2]) {
3540
+ this.players[i2] = this._initPlayer(_extends({
3541
+ scaleMode: this.scaleMode
3542
+ }, this._screens[i2], {
3543
+ id: "_screen_player_" + (i2 + 1)
3544
+ }));
3545
+ }
3546
+ } else {
3547
+ this.players[i2] = null;
3548
+ }
3549
+ }
3550
+ this._disabledControl();
3551
+ };
3552
+ _proto._disabledControl = function _disabledControl() {
3553
+ var _this = this;
3554
+ var isPlaying = this.players.some(function(player) {
3555
+ return player == null ? void 0 : player.playing;
3556
+ });
3557
+ __CAN_DISABLED_CONTROL__.forEach(function(key) {
3558
+ if (_this.controls[key]) _this.controls[key].disabled = !isPlaying;
3559
+ });
3560
+ };
3561
+ /**
3562
+ * 初始化播放器实例
3563
+ * @param playerOptions Player 播放器的配置
3564
+ * @returns 播放器实例
3565
+ * @example
3566
+ * ```typescript
3567
+ * const player = layout._initPlayer({
3568
+ * url: "https://example.com/video.flv",
3569
+ * // 其他播放器配置项...
3570
+ * });
3571
+ * ```
3572
+ */ _proto._initPlayer = function _initPlayer(playerOptions) {
3573
+ if (this._Player) {
3574
+ var _document_getElementById;
3575
+ var $idParentEle = (_document_getElementById = document.getElementById(playerOptions.id)) == null ? void 0 : _document_getElementById.parentElement;
3576
+ if ($idParentEle) {
3577
+ var _$placeholder_classList_add, _$placeholder_classList;
3578
+ var $placeholder = $idParentEle.querySelector("." + _EZ_SL_CLASS_PREFIX_ + "_screen-placeholder");
3579
+ $placeholder == null ? void 0 : (_$placeholder_classList = $placeholder.classList) == null ? void 0 : (_$placeholder_classList_add = _$placeholder_classList.add) == null ? void 0 : _$placeholder_classList_add.call(_$placeholder_classList, "" + _EZ_SL_CLASS_PREFIX_ + "_hide");
3580
+ }
3581
+ if ($idParentEle) {
3582
+ var _$placeholder_classList_remove, _$placeholder_classList1;
3583
+ var $placeholder1 = $idParentEle.querySelector("." + _EZ_SL_CLASS_PREFIX_ + "_screen-close");
3584
+ $placeholder1 == null ? void 0 : (_$placeholder_classList1 = $placeholder1.classList) == null ? void 0 : (_$placeholder_classList_remove = _$placeholder_classList1.remove) == null ? void 0 : _$placeholder_classList_remove.call(_$placeholder_classList1, "" + _EZ_SL_CLASS_PREFIX_ + "_hide");
3585
+ }
3586
+ var _playerOptions_muted;
3587
+ var muted = (_playerOptions_muted = playerOptions.muted) != null ? _playerOptions_muted : this.audioMode === 'all' ? false : this.audioMode === 'muted' ? true : this.audioMode !== 'selected';
3588
+ try {
3589
+ return new this._Player(_extends({}, playerOptions, {
3590
+ muted: muted,
3591
+ staticPath: './flv/',
3592
+ language: this.language || 'zh',
3593
+ useMSE: this.enableHardwareDecoding
3594
+ }));
3595
+ } catch (error) {
3596
+ return null;
3597
+ }
3598
+ } else {
3599
+ return null;
3600
+ }
3601
+ };
3602
+ /**
3603
+ * 创建单个分屏元素
3604
+ * @param screen - 分屏数据
3605
+ * @param index - 分屏索引
3606
+ * @returns 分屏 DOM 元素
3607
+ * @private
3608
+ */ _proto._createScreenElement = function _createScreenElement(screen, index) {
3609
+ var _this_i18n;
3610
+ var _index = index + 1;
3611
+ var el = document.createElement('div');
3612
+ el.className = "" + _EZ_SL_CLASS_PREFIX_ + "_screen";
3613
+ el.dataset.index = String(_index);
3614
+ // 序号
3615
+ var number = document.createElement('div');
3616
+ number.className = "" + _EZ_SL_CLASS_PREFIX_ + "_screen-number";
3617
+ number.textContent = String(_index);
3618
+ el.appendChild(number);
3619
+ var $player = document.createElement('div');
3620
+ $player.className = "" + _EZ_SL_CLASS_PREFIX_ + "_screen-player";
3621
+ $player.id = "_screen_player_" + _index;
3622
+ el.appendChild($player);
3623
+ var placeholder = String((_this_i18n = this.i18n) == null ? void 0 : _this_i18n.t('clickToSelect'));
3624
+ if (this.options.placeholder) placeholder = typeof this.options.placeholder === 'function' ? this.options.placeholder() : this.options.placeholder;
3625
+ if (placeholder !== null) {
3626
+ var _this_i18n1;
3627
+ // 仅当 placeholder 为 () => null 时才不显示占位元素
3628
+ var $placeholder = document.createElement('div');
3629
+ $placeholder.className = "" + _EZ_SL_CLASS_PREFIX_ + "_screen-placeholder";
3630
+ $placeholder.innerHTML = placeholder !== undefined ? placeholder : String((_this_i18n1 = this.i18n) == null ? void 0 : _this_i18n1.t('clickToSelect'));
3631
+ el.appendChild($placeholder);
3632
+ }
3633
+ // close
3634
+ var $close = document.createElement('div');
3635
+ $close.className = _EZ_SL_CLASS_PREFIX_ + "_screen-close " + _EZ_SL_CLASS_PREFIX_ + "_hide";
3636
+ $close.innerHTML = ICONS.close();
3637
+ el.appendChild($close);
3638
+ return el;
3639
+ };
3640
+ /**
3641
+ * 选中指定分屏
3642
+ * @param index - 分屏索引
3643
+ * @private
3644
+ */ _proto._selectScreen = function _selectScreen(index) {
3645
+ var _this = this;
3646
+ // 取消之前的选中
3647
+ if (this._current >= 1) {
3648
+ var els = this.$screenContainer.querySelectorAll("." + _EZ_SL_CLASS_PREFIX_ + "_screen-selected");
3649
+ if (els.length > 0) {
3650
+ els.forEach(function(el) {
3651
+ return el.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "_screen-selected");
3652
+ });
3653
+ }
3654
+ }
3655
+ var el = this.$screenContainer.querySelector('[data-index="' + index + '"]');
3656
+ el == null ? void 0 : el.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "_screen-selected");
3657
+ if (this.audioMode === 'selected') {
3658
+ (this.players || []).forEach(function(player, index) {
3659
+ if (player) {
3660
+ if (index === _this.current - 1) player.muted = false;
3661
+ else player.muted = true;
3662
+ }
3663
+ });
3664
+ }
3665
+ var screen = this._screens[index] || {
3666
+ id: index
3667
+ };
3668
+ this.emit('screen:click', index, screen);
3669
+ };
3670
+ /**
3671
+ * 获取国际化翻译文本
3672
+ * @param key - 翻译键
3673
+ * @returns 翻译后的文本
3674
+ */ _proto.t = function t(key) {
3675
+ var _this_i18n;
3676
+ return String(((_this_i18n = this.i18n) == null ? void 0 : _this_i18n.t(key)) || key);
3677
+ };
3678
+ /**
3679
+ * 设置分屏模式
3680
+ * @param mode - 分屏模式(预设模式或自定义布局配置)
3681
+ * @fires mode:change - 当模式变化时触发
3682
+ * @example
3683
+ * ```typescript
3684
+ * // 使用预设模式
3685
+ * layout.setMode(9); // 切换为 9 分屏
3686
+ * // 使用自定义布局
3687
+ * layout.setMode({ rows: 3, cols: 5 }); // 自定义 3x5 布局 mode 为 'custom'
3688
+ * ```
3689
+ */ _proto.setMode = function setMode(mode) {
3690
+ // 判断是否为自定义布局
3691
+ if ((typeof mode === "undefined" ? "undefined" : _type_of(mode)) === 'object' && 'rows' in mode && 'cols' in mode) {
3692
+ this.mode = 'custom';
3693
+ this.customLayout = mode;
3694
+ this._renderScreens();
3695
+ this.emit('mode:change', 'custom');
3696
+ } else {
3697
+ this.mode = mode;
3698
+ this._renderScreens();
3699
+ this.emit('mode:change', mode);
3700
+ }
3701
+ if (this.controls['mode']) {
3702
+ this.controls['mode'].setMode(this.mode);
3703
+ }
3704
+ };
3705
+ /**
3706
+ * 设置分屏数据
3707
+ * @param screen - 分屏数据数
3708
+ * @param index - 分屏索引(从1开始)(可选),默认当前选中的分屏索引(从1开始)
3709
+ * @example
3710
+ * ```typescript
3711
+ * layout.setScreen({
3712
+ * url: "https://example.com/video.flv"
3713
+ * });
3714
+ * ```
3715
+ */ _proto.setScreen = function setScreen(screen, index) {
3716
+ var _this = this;
3717
+ if (index === undefined) index = this.current;
3718
+ if (index < 1 || index > this._totalScreens) {
3719
+ return;
3720
+ }
3721
+ var _index = index - 1; // 数组下标
3722
+ if (this.players[_index]) {
3723
+ var // 不对 screen 数据进行对比, 每次都重新创建播放器实例, 以确保播放器状态与 screen 数据完全一致
3724
+ _this_players__index_destroy, _this_players__index;
3725
+ (_this_players__index = this.players[_index]) == null ? void 0 : (_this_players__index_destroy = _this_players__index.destroy) == null ? void 0 : _this_players__index_destroy.call(_this_players__index);
3726
+ this.players[_index] = null;
3727
+ }
3728
+ this._screens[_index] = _extends({}, screen, {
3729
+ id: "_screen_player_" + index
3730
+ });
3731
+ setTimeout(function() {
3732
+ _this.players[_index] = _this._initPlayer(_extends({}, screen, {
3733
+ id: "_screen_player_" + index
3734
+ }));
3735
+ _this._disabledControl();
3736
+ }, 0);
3737
+ };
3738
+ /**
3739
+ * 关闭指定分屏, 删除对应分屏数据(不可恢复)
3740
+ * @param index - 分屏索引(从1开始)(可选),默认当前选中的分屏索引(从1开始)
3741
+ * @example
3742
+ * ```typescript
3743
+ * layout.close(1); // 关闭第 1 分屏
3744
+ * ```
3745
+ */ _proto.close = function close(index) {
3746
+ if (index === undefined) index = this.current;
3747
+ if (index < 1 || index > this._totalScreens) {
3748
+ return;
3749
+ }
3750
+ var _index = index - 1; // 数组下标
3751
+ this._screens[_index] = null;
3752
+ if (this.players[_index]) {
3753
+ var _this_players__index_destroy, _this_players__index;
3754
+ (_this_players__index = this.players[_index]) == null ? void 0 : (_this_players__index_destroy = _this_players__index.destroy) == null ? void 0 : _this_players__index_destroy.call(_this_players__index);
3755
+ this.players[_index] = null;
3756
+ }
3757
+ var $parentEle = this.$screenContainer.querySelector('[data-index="' + index + '"]');
3758
+ if ($parentEle) {
3759
+ var _$parentEle_querySelector, _$parentEle_querySelector_classList_remove, _$parentEle_querySelector_classList, _$parentEle_querySelector1;
3760
+ (_$parentEle_querySelector = $parentEle.querySelector("." + _EZ_SL_CLASS_PREFIX_ + "_screen-close")) == null ? void 0 : _$parentEle_querySelector.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "_hide");
3761
+ (_$parentEle_querySelector1 = $parentEle.querySelector("." + _EZ_SL_CLASS_PREFIX_ + "_screen-placeholder")) == null ? void 0 : (_$parentEle_querySelector_classList = _$parentEle_querySelector1.classList) == null ? void 0 : (_$parentEle_querySelector_classList_remove = _$parentEle_querySelector_classList.remove) == null ? void 0 : _$parentEle_querySelector_classList_remove.call(_$parentEle_querySelector_classList, "" + _EZ_SL_CLASS_PREFIX_ + "_hide");
3762
+ }
3763
+ this._disabledControl();
3764
+ };
3765
+ /**
3766
+ * 设置主题模式
3767
+ * @param theme - 主题('light' 或 'dark')
3768
+ * @fires theme:change - 当主题变化时触发
3769
+ * @example
3770
+ * ```typescript
3771
+ * layout.setTheme('light');
3772
+ * ```
3773
+ */ _proto.setTheme = function setTheme(theme) {
3774
+ this.theme = theme;
3775
+ this.$container.setAttribute('data-theme', theme);
3776
+ this.emit('theme:change', theme);
3777
+ };
3778
+ /**
3779
+ * 切换网页全屏模式
3780
+ * @returns Promise - 全屏操作结果
3781
+ * @example
3782
+ * ```typescript
3783
+ * layout.toggleWebFullscreen();
3784
+ * ```
3785
+ */ _proto.toggleWebFullscreen = function toggleWebFullscreen() {
3786
+ var _this = this;
3787
+ return _toggleWebFullscreen(this).then(function() {
3788
+ var _this_controls_webFullscreen_update, _this_controls_webFullscreen;
3789
+ (_this_controls_webFullscreen = _this.controls.webFullscreen) == null ? void 0 : (_this_controls_webFullscreen_update = _this_controls_webFullscreen.update) == null ? void 0 : _this_controls_webFullscreen_update.call(_this_controls_webFullscreen);
3790
+ });
3791
+ };
3792
+ /**
3793
+ * 切换全局`全屏模式
3794
+ * @returns Promise - 全屏操作结果
3795
+ * @example
3796
+ * ```typescript
3797
+ * layout.toggleFullscreen();
3798
+ * ```
3799
+ */ _proto.toggleFullscreen = function toggleFullscreen() {
3800
+ this._isGlobalFullscreenOp = true;
3801
+ return _toggleGlobalFullscreen(this);
3802
+ };
3803
+ /**
3804
+ * 全部播放
3805
+ * @param index - 窗口索引(从1开始),不传则全部播放
3806
+ */ _proto.play = function play(index) {
3807
+ var list = this._getPlayers(index);
3808
+ if (list.length > 0) {
3809
+ list.forEach(function(player) {
3810
+ if (player) player.play == null ? void 0 : player.play.call(player);
3811
+ });
3812
+ }
3813
+ };
3814
+ /**
3815
+ * 全部暂停
3816
+ * @param index - 窗口索引(从1开始),不传则全部暂停
3817
+ */ _proto.pause = function pause(index) {
3818
+ var list = this._getPlayers(index);
3819
+ if (list.length > 0) {
3820
+ list.forEach(function(player) {
3821
+ if (player) player.pause == null ? void 0 : player.pause.call(player);
3822
+ });
3823
+ }
3824
+ };
3825
+ /**
3826
+ * 指定窗口静音或取消静音
3827
+ * @param {boolean} muted - 是否静音
3828
+ * @param {number=} index - 窗口索引(从1开始),空值默认所有窗口
3829
+ */ _proto.muted = function muted(muted, index) {
3830
+ if (muted === void 0) muted = true;
3831
+ var list = this._getPlayers(index);
3832
+ if (list.length > 0) {
3833
+ list.forEach(function(player) {
3834
+ if (player) player.muted = muted;
3835
+ });
3836
+ }
3837
+ // 这里仅做全部静音和全部取消静音状态同步
3838
+ if (index === undefined && this.controls[Settings.cname]) {
3839
+ var _this_controls_Settings_cname__settingsPanel_setAudioMode, _this_controls_Settings_cname__settingsPanel, _this_controls_Settings_cname;
3840
+ (_this_controls_Settings_cname = this.controls[Settings.cname]) == null ? void 0 : (_this_controls_Settings_cname__settingsPanel = _this_controls_Settings_cname._settingsPanel) == null ? void 0 : (_this_controls_Settings_cname__settingsPanel_setAudioMode = _this_controls_Settings_cname__settingsPanel.setAudioMode) == null ? void 0 : _this_controls_Settings_cname__settingsPanel_setAudioMode.call(_this_controls_Settings_cname__settingsPanel, muted ? 'muted' : 'all');
3841
+ }
3842
+ };
3843
+ /**
3844
+ * @description 截图,调用后弹出下载框保存截图
3845
+ * @param {string=} filename 保存的文件名, 默认 时间戳
3846
+ * @param {string=} format 截图的格式,可选png或jpeg或者webp ,默认 png
3847
+ * @param {number=} quality 当格式是jpeg或者webp时,压缩质量,取值0 ~ 1 ,默认 0.92
3848
+ * @param {("download" | "base64" | "blob")=} type download,base64,blob, 默认download
3849
+ * @param {number=} index - 窗口索引(从1开始),空值默认当前选中窗口
3850
+ *
3851
+ * @returns {string | Blob | undefined} undefined 代表截图失败
3852
+ * @example
3853
+ * ```ts
3854
+ * player.screenshot()
3855
+ * player.screenshot("filename", "jpeg", 0.7, "download")
3856
+ * ```
3857
+ */ _proto.screenshot = function screenshot(filename, format, quality, type, index) {
3858
+ if (format === void 0) format = 'png';
3859
+ if (quality === void 0) quality = 0.92;
3860
+ if (type === void 0) type = 'download';
3861
+ return _screenshot(this, filename, format, quality, type, index);
3862
+ };
3863
+ /**
3864
+ * 设置视频画面缩放模式
3865
+ * @param {0 | 1 | 2} scaleMode - 缩放模式, 0: 窗口铺满, 1: 等比缩放大边铺满, 2: 等比缩放小边铺满
3866
+ * @param {number=} index - 窗口索引(从1开始),空值默认所有窗口
3867
+ */ _proto.setScaleMode = function setScaleMode(scaleMode, index) {
3868
+ if ([
3869
+ 0,
3870
+ 1,
3871
+ 2
3872
+ ].includes(scaleMode)) {
3873
+ this.scaleMode = scaleMode;
3874
+ var list = this._getPlayers(index);
3875
+ if (list.length > 0) {
3876
+ list.forEach(function(player) {
3877
+ if (player) player.setScaleMode == null ? void 0 : player.setScaleMode.call(player, scaleMode);
3878
+ });
3879
+ }
3880
+ }
3881
+ };
3882
+ /**
3883
+ * 设置视频画面缩放模式
3884
+ * @param {SettingsPanelOptions['audioMode']} audioMode - 音频模式 selected: 选中的有声音 all: 所有窗口都有声音 muted: 所有窗口都静音
3885
+ */ _proto.setAudioMode = function setAudioMode(audioMode) {
3886
+ var _this = this;
3887
+ if ([
3888
+ 'selected',
3889
+ 'all',
3890
+ 'muted'
3891
+ ].includes(audioMode)) {
3892
+ this.audioMode = audioMode;
3893
+ switch(audioMode){
3894
+ case 'muted':
3895
+ this.muted(true);
3896
+ break;
3897
+ case 'all':
3898
+ this.muted(false);
3899
+ break;
3900
+ case 'selected':
3901
+ (this.players || []).forEach(function(player, index) {
3902
+ if (player) {
3903
+ if (index === _this.current - 1) player.muted = false;
3904
+ else player.muted = true;
3905
+ }
3906
+ });
3907
+ break;
3908
+ }
3909
+ // 这里仅做 全部静音和全部取消静音状态同步
3910
+ if (this.controls[Settings.cname]) {
3911
+ var _this_controls_Settings_cname__settingsPanel_setAudioMode, _this_controls_Settings_cname__settingsPanel, _this_controls_Settings_cname;
3912
+ (_this_controls_Settings_cname = this.controls[Settings.cname]) == null ? void 0 : (_this_controls_Settings_cname__settingsPanel = _this_controls_Settings_cname._settingsPanel) == null ? void 0 : (_this_controls_Settings_cname__settingsPanel_setAudioMode = _this_controls_Settings_cname__settingsPanel.setAudioMode) == null ? void 0 : _this_controls_Settings_cname__settingsPanel_setAudioMode.call(_this_controls_Settings_cname__settingsPanel, audioMode);
3913
+ }
3914
+ }
3915
+ };
3916
+ /**
3917
+ * 重新调整播放器窗口大小
3918
+ *
3919
+ * Adjust the player window size
3920
+ * @param {number | string} width 宽度(容器的宽度,支持 CSS 单位或数字(px))
3921
+ * @param {number | string} height 高度(容器的高度,支持 CSS 单位或数字(px))
3922
+ * @example
3923
+ * ```ts
3924
+ * layout.resize(600, 400) // 600px * 400px
3925
+ * layout.resize("600px", "400px") // 600px * 400px
3926
+ * layout.resize("50%", "1vh")
3927
+ * layout.resize("2em", "2rem")
3928
+ * ```
3929
+ */ _proto.resize = function resize(width, height) {
3930
+ _resize(this, width, height);
3931
+ };
3932
+ /**
3933
+ * 销毁组件实例
3934
+ * @remarks
3935
+ * 清理所有事件监听器和 DOM 元素
3936
+ * @example
3937
+ * ```typescript
3938
+ * layout.destroy();
3939
+ * ```
3940
+ */ _proto.destroy = function destroy() {
3941
+ _destroy(this);
3942
+ };
3943
+ /**
3944
+ * @param {number=} index - 窗口索引(从1开始),空值默认所有窗口
3945
+ */ _proto._getPlayers = function _getPlayers(index) {
3946
+ if (index === undefined || index === null) {
3947
+ return this.players;
3948
+ } else if (index >= 1 && index <= this.players.length) {
3949
+ if (this.players[index - 1]) {
3950
+ return [
3951
+ this.players[index - 1]
3952
+ ];
3953
+ }
3954
+ } else ;
3955
+ return [];
3956
+ };
3957
+ /**
3958
+ * 监听全屏状态变化
3959
+ * @private
3960
+ */ _proto._listenFullscreenChange = function _listenFullscreenChange() {
3961
+ var _this = this;
3962
+ if (!screenfull.isEnabled) return;
3963
+ // 不支持外部实现当前节点全屏, 不做处理, 如果想做请参考 theme 的全屏实现
3964
+ this._fullscreenChangeHandler = function() {
3965
+ if (_this._isGlobalFullscreenOp) {
3966
+ var _this_controls_fullscreen;
3967
+ _this._isGlobalFullscreenOp = false;
3968
+ _this.emit('fullscreen:change', false, 'global');
3969
+ if (_this.isGlobalFullscreen) {
3970
+ _this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "_fullscreen");
3971
+ } else {
3972
+ _this.$container.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "_fullscreen");
3973
+ }
3974
+ if ((_this_controls_fullscreen = _this.controls.fullscreen) == null ? void 0 : _this_controls_fullscreen.update) _this.controls.fullscreen.update();
3975
+ } else if (!screenfull.isFullscreen && _this.isGlobalFullscreen) {
3976
+ var _this_controls_fullscreen1;
3977
+ // 退出
3978
+ _this.isGlobalFullscreen = false;
3979
+ if (_this.isGlobalFullscreen) {
3980
+ _this.$container.classList.add("" + _EZ_SL_CLASS_PREFIX_ + "_fullscreen");
3981
+ } else {
3982
+ _this.$container.classList.remove("" + _EZ_SL_CLASS_PREFIX_ + "_fullscreen");
3983
+ }
3984
+ if ((_this_controls_fullscreen1 = _this.controls.fullscreen) == null ? void 0 : _this_controls_fullscreen1.update) _this.controls.fullscreen.update();
3985
+ }
3986
+ };
3987
+ screenfull.on('change', this._fullscreenChangeHandler);
3988
+ };
3989
+ _create_class(MultiScreen, [
3990
+ {
3991
+ key: "_totalScreens",
3992
+ get: function get() {
3993
+ var config = this.mode === 'custom' && this.customLayout ? this.customLayout : getLayoutConfig(this.mode);
3994
+ return config.rows * config.cols;
3995
+ }
3996
+ },
3997
+ {
3998
+ key: "current",
3999
+ get: function get() {
4000
+ return this._current;
4001
+ },
4002
+ set: function set(index) {
4003
+ // 防止多次操作
4004
+ if (this._current === index) return;
4005
+ this._current = index;
4006
+ this._selectScreen(index);
4007
+ }
4008
+ }
4009
+ ]);
4010
+ return MultiScreen;
4011
+ }(EventEmitter);
4012
+ /** 事件常量 */ MultiScreen.EVENTS = EVENTS;
4013
+
4014
+ return MultiScreen;
4015
+
4016
+ }));