@ezuikit/player-theme 1.0.0-beta.1 → 1.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v1.0.0-beta.1
3
- * Copyright (c) 2025-10-27 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v1.0.1-alpha.0
3
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -366,7 +366,12 @@
366
366
  /**
367
367
  * 播放器的类名前缀
368
368
  */ var PREFIX_CLASS = 'ezplayer';
369
- var DATE_PICKER_ICON_WIDTH = 36;
369
+ /** */ var DATE_PICKER_ICON_WIDTH = 36;
370
+ /** 填充模式 */ var THEME_SCALE_MODE_TYPE = {
371
+ /** 画面完全填充canvas区域,画面会被拉伸 */ full: 0,
372
+ /** 画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边 */ auto: 1,
373
+ /** 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全 */ fullAuto: 2
374
+ };
370
375
  // 切换主题时把当前的状态传给控件, 而不是传 theme 对象, 为了解耦
371
376
  // 不要添加方法,只添加状态
372
377
  var THEME_PROPS = [
@@ -534,6 +539,7 @@
534
539
  /** 日期改变 */ dateChange: 'Control.dateChange',
535
540
  /** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
536
541
  /** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
542
+ /** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
537
543
  /** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
538
544
  /** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
539
545
  /** 主题控件挂载完成, 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ mountedControls: 'Control.mountedControls',
@@ -788,8 +794,8 @@
788
794
  return Control;
789
795
  }(EventEmitter);
790
796
 
791
- function _extends$r() {
792
- _extends$r = Object.assign || function(target) {
797
+ function _extends$q() {
798
+ _extends$q = Object.assign || function(target) {
793
799
  for(var i = 1; i < arguments.length; i++){
794
800
  var source = arguments[i];
795
801
  for(var key in source){
@@ -800,7 +806,7 @@
800
806
  }
801
807
  return target;
802
808
  };
803
- return _extends$r.apply(this, arguments);
809
+ return _extends$q.apply(this, arguments);
804
810
  }
805
811
  function _inherits$q(subClass, superClass) {
806
812
  if (typeof superClass !== "function" && superClass !== null) {
@@ -831,7 +837,7 @@
831
837
  function Loading(options) {
832
838
  if (options === void 0) options = {};
833
839
  var _this;
834
- _this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$r({}, options, {
840
+ _this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$q({}, options, {
835
841
  tagName: 'div',
836
842
  controlType: 'block',
837
843
  classNameSuffix: 'loading'
@@ -869,8 +875,8 @@
869
875
  return Loading;
870
876
  }(Control);
871
877
 
872
- function _extends$q() {
873
- _extends$q = Object.assign || function(target) {
878
+ function _extends$p() {
879
+ _extends$p = Object.assign || function(target) {
874
880
  for(var i = 1; i < arguments.length; i++){
875
881
  var source = arguments[i];
876
882
  for(var key in source){
@@ -881,7 +887,7 @@
881
887
  }
882
888
  return target;
883
889
  };
884
- return _extends$q.apply(this, arguments);
890
+ return _extends$p.apply(this, arguments);
885
891
  }
886
892
  function _inherits$p(subClass, superClass) {
887
893
  if (typeof superClass !== "function" && superClass !== null) {
@@ -917,7 +923,7 @@
917
923
  function Poster(options) {
918
924
  if (options === void 0) options = {};
919
925
  var _this;
920
- _this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$q({}, options, {
926
+ _this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$p({}, options, {
921
927
  tagName: 'div',
922
928
  controlType: 'block',
923
929
  classNameSuffix: 'poster'
@@ -980,7 +986,7 @@
980
986
  return Poster;
981
987
  }(Control);
982
988
 
983
- var Icons$1 = {
989
+ var Icons = {
984
990
  /** 播放 */ 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>',
985
991
  /** 暂停 */ 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>',
986
992
  /** 音量 */ volume: function(prefix) {
@@ -1046,136 +1052,136 @@
1046
1052
  var IconComponents = {
1047
1053
  /** 播放 */ play: function(attr) {
1048
1054
  if (attr === void 0) attr = {};
1049
- return createIcon(Icons$1.play, 'play', attr);
1055
+ return createIcon(Icons.play, 'play', attr);
1050
1056
  },
1051
1057
  /** 暂停 */ pause: function(attr) {
1052
1058
  if (attr === void 0) attr = {};
1053
- return createIcon(Icons$1.pause, 'pause', attr);
1059
+ return createIcon(Icons.pause, 'pause', attr);
1054
1060
  },
1055
1061
  volume: function(attr) {
1056
1062
  if (attr === void 0) attr = {};
1057
- return createIcon(Icons$1.volume(PREFIX_CLASS), 'volume', attr);
1063
+ return createIcon(Icons.volume(PREFIX_CLASS), 'volume', attr);
1058
1064
  },
1059
1065
  mobileFullscreen: function(attr) {
1060
1066
  if (attr === void 0) attr = {};
1061
- return createIcon(Icons$1.mobileFullscreen, 'mobile-fullscreen', attr);
1067
+ return createIcon(Icons.mobileFullscreen, 'mobile-fullscreen', attr);
1062
1068
  },
1063
1069
  exitFullscreen: function(attr) {
1064
1070
  if (attr === void 0) attr = {};
1065
- return createIcon(Icons$1.exitFullscreen, 'exit-fullscreen', attr);
1071
+ return createIcon(Icons.exitFullscreen, 'exit-fullscreen', attr);
1066
1072
  },
1067
1073
  fullscreen: function(attr) {
1068
1074
  if (attr === void 0) attr = {};
1069
- return createIcon(Icons$1.fullscreen, 'fullscreen', attr);
1075
+ return createIcon(Icons.fullscreen, 'fullscreen', attr);
1070
1076
  },
1071
1077
  exitGlobalFullscreen: function(attr) {
1072
1078
  if (attr === void 0) attr = {};
1073
- return createIcon(Icons$1.exitGlobalFullscreen, 'exit-global-fullscreen', attr);
1079
+ return createIcon(Icons.exitGlobalFullscreen, 'exit-global-fullscreen', attr);
1074
1080
  },
1075
1081
  globalFullscreen: function(attr) {
1076
1082
  if (attr === void 0) attr = {};
1077
- return createIcon(Icons$1.globalFullscreen, 'global-fullscreen', attr);
1083
+ return createIcon(Icons.globalFullscreen, 'global-fullscreen', attr);
1078
1084
  },
1079
1085
  capturePicture: function(attr) {
1080
1086
  if (attr === void 0) attr = {};
1081
- return createIcon(Icons$1.capturePicture, 'capture-picture', attr);
1087
+ return createIcon(Icons.capturePicture, 'capture-picture', attr);
1082
1088
  },
1083
1089
  ptz: function(attr) {
1084
1090
  if (attr === void 0) attr = {};
1085
- return createIcon(Icons$1.ptz, 'ptz', attr);
1091
+ return createIcon(Icons.ptz, 'ptz', attr);
1086
1092
  },
1087
1093
  record: function(attr) {
1088
1094
  if (attr === void 0) attr = {};
1089
- return createIcon(Icons$1.record, 'record', attr);
1095
+ return createIcon(Icons.record, 'record', attr);
1090
1096
  },
1091
1097
  recordCircle: function(attr) {
1092
1098
  if (attr === void 0) attr = {};
1093
- return createIcon(Icons$1.recordCircle, 'record-circle', attr);
1099
+ return createIcon(Icons.recordCircle, 'record-circle', attr);
1094
1100
  },
1095
1101
  talk: function(attr) {
1096
1102
  if (attr === void 0) attr = {};
1097
- return createIcon(Icons$1.talk, 'talk', attr);
1103
+ return createIcon(Icons.talk, 'talk', attr);
1098
1104
  },
1099
1105
  talkGrowth: function(attr) {
1100
1106
  if (attr === void 0) attr = {};
1101
- return createIcon(Icons$1.talkGrowth(PREFIX_CLASS), 'talk-growth', attr);
1107
+ return createIcon(Icons.talkGrowth(PREFIX_CLASS), 'talk-growth', attr);
1102
1108
  },
1103
1109
  zoom: function(attr) {
1104
1110
  if (attr === void 0) attr = {};
1105
- return createIcon(Icons$1.zoom, 'zoom', attr);
1111
+ return createIcon(Icons.zoom, 'zoom', attr);
1106
1112
  },
1107
1113
  more: function(attr) {
1108
1114
  if (attr === void 0) attr = {};
1109
- return createIcon(Icons$1.more, 'more', attr);
1115
+ return createIcon(Icons.more, 'more', attr);
1110
1116
  },
1111
1117
  moreDot: function(attr) {
1112
1118
  if (attr === void 0) attr = {};
1113
- return createIcon(Icons$1.moreDot, 'more-dot', attr);
1119
+ return createIcon(Icons.moreDot, 'more-dot', attr);
1114
1120
  },
1115
1121
  minusCircle: function(attr) {
1116
1122
  if (attr === void 0) attr = {};
1117
- return createIcon(Icons$1.minusCircle, 'minus-circle', attr);
1123
+ return createIcon(Icons.minusCircle, 'minus-circle', attr);
1118
1124
  },
1119
1125
  plusCircle: function(attr) {
1120
1126
  if (attr === void 0) attr = {};
1121
- return createIcon(Icons$1.plusCircle, 'plus-circle', attr);
1127
+ return createIcon(Icons.plusCircle, 'plus-circle', attr);
1122
1128
  },
1123
1129
  sdk: function(attr) {
1124
1130
  if (attr === void 0) attr = {};
1125
- return createIcon(Icons$1.sdk, 'sdk', attr);
1131
+ return createIcon(Icons.sdk, 'sdk', attr);
1126
1132
  },
1127
1133
  cloudRec: function(attr) {
1128
1134
  if (attr === void 0) attr = {};
1129
- return createIcon(Icons$1.cloudRec, 'cloud-rec', attr);
1135
+ return createIcon(Icons.cloudRec, 'cloud-rec', attr);
1130
1136
  },
1131
1137
  cloudRecord: function(attr) {
1132
1138
  if (attr === void 0) attr = {};
1133
- return createIcon(Icons$1.cloudRecord, 'cloud-record', attr);
1139
+ return createIcon(Icons.cloudRecord, 'cloud-record', attr);
1134
1140
  },
1135
1141
  error: function(attr) {
1136
1142
  if (attr === void 0) attr = {};
1137
- return createIcon(Icons$1.error, 'error', attr);
1143
+ return createIcon(Icons.error, 'error', attr);
1138
1144
  },
1139
1145
  info: function(attr) {
1140
1146
  if (attr === void 0) attr = {};
1141
- return createIcon(Icons$1.info, 'info', attr);
1147
+ return createIcon(Icons.info, 'info', attr);
1142
1148
  },
1143
1149
  close: function(attr) {
1144
1150
  if (attr === void 0) attr = {};
1145
- return createIcon(Icons$1.close, 'close', attr);
1151
+ return createIcon(Icons.close, 'close', attr);
1146
1152
  },
1147
1153
  closeCircleOutLined: function(attr) {
1148
1154
  if (attr === void 0) attr = {};
1149
- return createIcon(Icons$1.closeCircleOutLined, 'close-circle', attr);
1155
+ return createIcon(Icons.closeCircleOutLined, 'close-circle', attr);
1150
1156
  },
1151
1157
  warnCircleOutLined: function(attr) {
1152
1158
  if (attr === void 0) attr = {};
1153
- return createIcon(Icons$1.warnCircleOutLined, 'warn-circle', attr);
1159
+ return createIcon(Icons.warnCircleOutLined, 'warn-circle', attr);
1154
1160
  },
1155
1161
  infoCircleOutLined: function(attr) {
1156
1162
  if (attr === void 0) attr = {};
1157
- return createIcon(Icons$1.infoCircleOutLined, 'info-circle', attr);
1163
+ return createIcon(Icons.infoCircleOutLined, 'info-circle', attr);
1158
1164
  },
1159
1165
  date: function(attr) {
1160
1166
  if (attr === void 0) attr = {};
1161
- return createIcon(Icons$1.date, 'date', attr);
1167
+ return createIcon(Icons.date, 'date', attr);
1162
1168
  },
1163
1169
  filter: function(attr) {
1164
1170
  if (attr === void 0) attr = {};
1165
- return createIcon(Icons$1.filter, 'filter', attr);
1171
+ return createIcon(Icons.filter, 'filter', attr);
1166
1172
  },
1167
1173
  add: function(attr) {
1168
1174
  if (attr === void 0) attr = {};
1169
- return createIcon(Icons$1.add, 'add', attr);
1175
+ return createIcon(Icons.add, 'add', attr);
1170
1176
  },
1171
1177
  reduce: function(attr) {
1172
1178
  if (attr === void 0) attr = {};
1173
- return createIcon(Icons$1.reduce, 'reduce', attr);
1179
+ return createIcon(Icons.reduce, 'reduce', attr);
1174
1180
  }
1175
1181
  };
1176
1182
 
1177
- function _extends$p() {
1178
- _extends$p = Object.assign || function(target) {
1183
+ function _extends$o() {
1184
+ _extends$o = Object.assign || function(target) {
1179
1185
  for(var i = 1; i < arguments.length; i++){
1180
1186
  var source = arguments[i];
1181
1187
  for(var key in source){
@@ -1186,7 +1192,7 @@
1186
1192
  }
1187
1193
  return target;
1188
1194
  };
1189
- return _extends$p.apply(this, arguments);
1195
+ return _extends$o.apply(this, arguments);
1190
1196
  }
1191
1197
  function _inherits$o(subClass, superClass) {
1192
1198
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1217,7 +1223,7 @@
1217
1223
  function Message(options) {
1218
1224
  if (options === void 0) options = {};
1219
1225
  var _this;
1220
- _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$p({}, options, {
1226
+ _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$o({}, options, {
1221
1227
  tagName: 'div',
1222
1228
  controlType: 'block'
1223
1229
  }))) || this;
@@ -1370,8 +1376,8 @@
1370
1376
  if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
1371
1377
  return Constructor;
1372
1378
  }
1373
- function _extends$o() {
1374
- _extends$o = Object.assign || function(target) {
1379
+ function _extends$n() {
1380
+ _extends$n = Object.assign || function(target) {
1375
1381
  for(var i = 1; i < arguments.length; i++){
1376
1382
  var source = arguments[i];
1377
1383
  for(var key in source){
@@ -1382,7 +1388,7 @@
1382
1388
  }
1383
1389
  return target;
1384
1390
  };
1385
- return _extends$o.apply(this, arguments);
1391
+ return _extends$n.apply(this, arguments);
1386
1392
  }
1387
1393
  function _inherits$n(subClass, superClass) {
1388
1394
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1411,7 +1417,7 @@
1411
1417
  _inherits$n(Play, Control);
1412
1418
  function Play(options) {
1413
1419
  var _this;
1414
- _this = Control.call(this, _extends$o({}, options, {
1420
+ _this = Control.call(this, _extends$n({}, options, {
1415
1421
  tagName: 'span',
1416
1422
  controlType: 'button',
1417
1423
  classNameSuffix: 'play'
@@ -1463,609 +1469,704 @@
1463
1469
  }(Control);
1464
1470
 
1465
1471
  /*
1466
- * @skax/picker v1.0.2
1467
- * Copyright (c) 2025-10-26 ShineShao <xiaoshaoqq@gmail.com>
1472
+ * @skax/picker v1.1.2
1473
+ * Copyright (c) 2025-11-09 ShineShao <xiaoshaoqq@gmail.com>
1468
1474
  * Released under the MIT License.
1469
1475
  */
1470
- /**
1471
- * PickerProvider
1472
- */ class PickerProvider {
1473
- static getInstance() {
1474
- if (!PickerProvider.instance) {
1475
- PickerProvider.instance = new PickerProvider();
1476
- }
1477
- return PickerProvider.instance;
1478
- }
1479
- add(picker) {
1480
- this.pickers.push(picker);
1481
- }
1482
- remove(picker) {
1483
- const index = this.pickers.indexOf(picker);
1484
- if (index > -1) {
1485
- this.pickers.splice(index, 1);
1486
- } else {
1487
- console.warn("Picker not found in the provider.");
1488
- }
1489
- }
1490
- closeOther(e) {
1491
- for (const p of this.pickers){
1492
- var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1493
- 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)))) {
1494
- p.open = false;
1495
- }
1496
- }
1497
- }
1498
- constructor(){
1499
- this.pickers = [];
1500
- // Private constructor to prevent instantiation
1501
- }
1502
- }
1503
- const pickerProvider = PickerProvider.getInstance();
1504
1476
 
1505
- /**
1506
- * picker 位置
1507
- * @public
1508
- */ // eslint-disable-next-line @typescript-eslint/naming-convention
1509
- const PICKER_PLACEMENT = [
1510
- "top",
1511
- "tl",
1512
- "tr",
1513
- "bottom",
1514
- "bl",
1515
- "br"
1516
- ];
1517
- /**
1518
- * 默认样式前缀
1519
- */ const PICKER_PREFIX_CLS = "epicker";
1520
- /**
1521
- * Picker 默认值
1522
- */ const DEFAULT_PICKER_OPTIONS = {
1523
- getPopupContainer: ()=>document.body,
1524
- wrapClassName: "",
1525
- open: false,
1526
- placement: "br",
1527
- offset: [
1528
- 0,
1529
- 0
1530
- ],
1531
- zIndex: 1000,
1532
- content: "",
1533
- trigger: "click",
1534
- mouseLeaveDelay: 0.1,
1535
- mouseEnterDelay: 0.1,
1536
- isMobile: false
1537
- };
1538
- /**
1539
- * Picker 弹窗, 支持 PC 和移动端
1540
- * @remarks
1541
- * Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
1542
- * 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
1543
- *
1544
- * @example
1545
- * ```ts
1546
- * import "@skax/picker/dist/style/css";
1547
- * import Picker from '@skax/picker';
1548
- * const picker = new Picker(document.getElementById('picker-container'),
1549
- * {
1550
- * placement: 'bottom',
1551
- * content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
1552
- * trigger: 'click',
1553
- * isMobile: false,
1554
- * });
1555
- * picker.open = true; // 打开弹窗
1556
- * picker.setPlacement('top'); // 设置弹窗位置
1557
- * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1558
- * picker.destroy(); // 销毁弹窗
1559
- * ```
1560
- */ class Picker {
1561
- /**
1562
- * picker 内容挂载节点
1563
- */ get $popupContainer() {
1564
- // prettier-ignore
1565
- if (typeof this._options.getPopupContainer === "function") {
1566
- const $popupContainer = this._options.getPopupContainer();
1567
- if ($popupContainer) {
1568
- if ([
1569
- "INPUT",
1570
- "CANVAS",
1571
- "VIDEO",
1572
- "IMG"
1573
- ].includes($popupContainer == null ? void 0 : $popupContainer.tagName)) {
1574
- console.warn("popup container node does not support child elements, default body!");
1575
- } else {
1576
- // prettier-ignore
1577
- if ($popupContainer !== document.body) $popupContainer.style.cssText += `position: relative;`;
1578
- return $popupContainer;
1579
- }
1580
- } else {
1581
- console.warn("popup container does not exist, default body!");
1582
- }
1583
- }
1584
- return document.body;
1585
- }
1586
- /**
1587
- * 获取当前打开状态
1588
- * @example
1589
- * ```ts
1590
- * console.log(picker.open); // 获取当前打开状态
1591
- * picker.open = true; // 打开
1592
- * picker.open = false; // 关闭
1593
- * ```
1594
- */ get open() {
1595
- return this._open;
1596
- }
1597
- set open(open) {
1598
- if (this._disabled) {
1599
- return;
1600
- }
1601
- if (this._open !== !!open) {
1602
- this._animationTimerClear();
1603
- if (this._timer) {
1604
- clearTimeout(this._timer);
1605
- this._timer = null;
1606
- }
1607
- if (open) {
1608
- this._timer = setTimeout(()=>{
1609
- this.$wrapperContent.style.display = "inline-flex";
1610
- this.$wrapperContent.style.pointerEvents = "";
1611
- // prettier-ignore
1612
- if (this._options.isMobile) document.body.classList.add(`${PICKER_PREFIX_CLS}-body-noscroll`);
1613
- this._animationTimer = setTimeout(()=>{
1614
- this._animationTimerClear();
1615
- this.$wrapperContent.style.opacity = "1";
1616
- }, 0);
1617
- requestAnimationFrame(()=>{
1618
- this._setPlacement();
1619
- });
1620
- this._OpenChange = open;
1621
- this._onOpenChange(open);
1622
- }, // prettier-ignore
1623
- (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1624
- } else {
1625
- this._timer = setTimeout(()=>{
1626
- this.$wrapperContent.style.opacity = "0";
1627
- this.$wrapperContent.style.pointerEvents = "none";
1628
- // prettier-ignore
1629
- if (this._options.isMobile) document.body.classList.remove(`${PICKER_PREFIX_CLS}-body-noscroll`);
1630
- this._animationTimer = setTimeout(()=>{
1631
- this._animationTimerClear();
1632
- this.$wrapperContent.style.display = "none";
1633
- }, 301); // css 动画是 300ms
1634
- this._OpenChange = open;
1635
- this._onOpenChange(open);
1636
- }, // prettier-ignore
1637
- (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1638
- }
1639
- if (this._OpenChange === open) {
1640
- if (this._timer) {
1641
- clearTimeout(this._timer);
1642
- this._timer = null;
1643
- }
1644
- }
1645
- this._open = !!open;
1646
- }
1647
- }
1648
- /**
1649
- * 获取或设置禁用状态
1650
- * @example
1651
- * ```ts
1652
- * picker.disabled = true; // 禁用
1653
- * picker.disabled = false; // 启用
1654
- * console.log(picker.disabled); // 获取禁用状态
1655
- * ```
1656
- */ get disabled() {
1657
- return this._disabled;
1658
- }
1659
- set disabled(disabled) {
1660
- if (disabled) {
1661
- var _this_$container_classList_add, _this_$container_classList, _this_$container;
1662
- (_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`);
1663
- } else {
1664
- var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
1665
- (_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`);
1666
- }
1667
- this._disabled = disabled;
1668
- }
1669
- /**
1670
- * 设置弹出位置
1671
- * @param placement - 弹出位置
1672
- * @example
1673
- * ```ts
1674
- * picker.setPlacement("top");
1675
- * picker.setPlacement("tl");
1676
- * picker.setPlacement("tr");
1677
- * picker.setPlacement("bottom");
1678
- * picker.setPlacement("bl");
1679
- * picker.setPlacement("br");
1680
- * ```
1681
- */ setPlacement(placement) {
1682
- if (this._disabled) {
1683
- return;
1684
- }
1685
- if (PICKER_PLACEMENT.includes(placement)) {
1686
- this._options.placement = placement;
1687
- } else {
1688
- console.warn(`${placement} is not a valid placement`);
1689
- }
1690
- this._setPlacement();
1691
- }
1692
- /**
1693
- * 销毁
1694
- * @example
1695
- * ```ts
1696
- * picker.destroy();
1697
- * ```
1698
- */ destroy() {
1699
- this._animationTimerClear();
1700
- this._removeHtml();
1701
- pickerProvider.remove(this);
1702
- }
1703
- /**
1704
- * 设置内容(会覆盖之前内容)
1705
- * @param html - html 字符串内容
1706
- * @example
1707
- * ```ts
1708
- * picker.innerHTML('<div>内容</div>');
1709
- * ```
1710
- */ innerHTML(html) {
1711
- if (this.$body) {
1712
- this.$body.innerHTML = html || "";
1713
- this._setPlacement();
1714
- }
1715
- }
1716
- // --------------------------------------------------------------------------
1717
- // Private methods
1718
- // --------------------------------------------------------------------------
1719
- /**
1720
- * picker 面板展开或关闭变化时触发
1721
- * @param open - true: 展开, false:关闭
1722
- */ _onOpenChange(open) {
1723
- this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1724
- }
1725
- /**
1726
- * 移除动画定时器
1727
- */ _animationTimerClear() {
1728
- if (this._animationTimer) {
1729
- clearTimeout(this._animationTimer);
1730
- this._animationTimer = null;
1731
- }
1732
- }
1733
- /**
1734
- * 移除html
1735
- */ _removeHtml() {
1736
- var _this_$container_removeEventListener, _this_$container, _this_$popupContainer;
1737
- // eslint-disable-next-line @typescript-eslint/unbound-method
1738
- this.$wrapperContent.removeEventListener("click", this._onContentClick);
1739
- (_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);
1740
- if (this._options.trigger === "click") {
1741
- var _this_$container_removeEventListener1, _this_$container1;
1742
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, "click", this._onShow);
1743
- }
1744
- if (this._options.trigger === "hover") {
1745
- var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4;
1746
- (_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);
1747
- (_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);
1748
- (_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);
1749
- // prettier-ignore
1750
- this.$wrapperContent.removeEventListener("mouseenter", this._onWrapperShow);
1751
- this.$wrapperContent.removeEventListener("mouseleave", this._onHide);
1752
- }
1753
- if (!this._options.isMobile) {
1754
- // eslint-disable-next-line @typescript-eslint/unbound-method
1755
- window.removeEventListener("blur", this._onHide);
1756
- // eslint-disable-next-line @typescript-eslint/unbound-method
1757
- document.removeEventListener("visibilitychange", this._onHide);
1758
- // eslint-disable-next-line @typescript-eslint/unbound-method
1759
- window.removeEventListener("resize", this._onHide);
1760
- // eslint-disable-next-line @typescript-eslint/unbound-method
1761
- document.removeEventListener("click", this._onDocumentClick);
1762
- }
1763
- if (this._$mask) {
1764
- var _this_$wrapperContent;
1765
- this._$mask.removeEventListener("click", this._onHide);
1766
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeChild(this._$mask);
1767
- }
1768
- if (this._options.isMobile) document.body.classList.remove(`${PICKER_PREFIX_CLS}-body-noscroll`);
1769
- (_this_$popupContainer = this.$popupContainer) == null ? void 0 : _this_$popupContainer.removeChild(this.$wrapperContent);
1770
- this.$wrapperContent.innerHTML = "";
1771
- }
1772
- /**
1773
- * 现实位置
1774
- */ _setPlacement() {
1775
- var _this_$container_getBoundingClientRect, _this_$container;
1776
- if (!this._open || this._options.isMobile || !this.$container) {
1777
- return;
1778
- }
1779
- const $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1780
- const $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1781
- const $popupContainerRect = this.$popupContainer.getBoundingClientRect();
1782
- // 容器的坐标 - 挂载的容器的坐标差
1783
- // prettier-ignore
1784
- const containerLeft = $containerRect.left - $popupContainerRect.left;
1785
- const containerRight = -($containerRect.right - $popupContainerRect.right);
1786
- // prettier-ignore
1787
- const containerTop = $containerRect.y - $popupContainerRect.y;
1788
- let left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1789
- let right;
1790
- const top = containerTop - $wrapperContentRect.height;
1791
- const bottom = containerTop + $containerRect.height;
1792
- if (/^t/.test(this._options.placement)) {
1793
- var _this__options_offset, _this__options_offset1, _this__options_offset2;
1794
- switch(this._options.placement){
1795
- case "top":
1796
- right = undefined;
1797
- break;
1798
- case "tl":
1799
- right = undefined;
1800
- left = containerLeft;
1801
- break;
1802
- case "tr":
1803
- left = undefined;
1804
- right = containerRight;
1805
- break;
1806
- }
1807
- this.$wrapperContent.style.cssText += `
1808
- ${right !== undefined ? `right: ${right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)}px;` : ""}
1809
- ${left !== undefined ? `left: ${left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)}px;` : ""}
1810
- top: ${top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)}px;
1811
- z-index:${this._options.zIndex};
1812
- `;
1813
- } else if (/^b/.test(this._options.placement)) {
1814
- var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1815
- switch(this._options.placement){
1816
- case "bottom":
1817
- right = undefined;
1818
- break;
1819
- case "bl":
1820
- right = undefined;
1821
- left = containerLeft;
1822
- break;
1823
- case "br":
1824
- left = undefined;
1825
- right = containerRight;
1826
- break;
1827
- }
1828
- this.$wrapperContent.style.cssText += `
1829
- ${right !== undefined ? `right: ${right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)}px;` : ""}
1830
- ${left !== undefined ? `left: ${left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)}px;` : ""}
1831
- top: ${bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)}px;
1832
- z-index:${this._options.zIndex};
1833
- `;
1834
- }
1835
- }
1836
- /**
1837
- * 初始化内容样式
1838
- */ _initContentStyle() {
1839
- // prettier-ignore
1840
- this.$wrapperContent.classList.add(`${PICKER_PREFIX_CLS}`, `${PICKER_PREFIX_CLS}-wrapper`, `${PICKER_PREFIX_CLS}-${this._options.placement}`);
1841
- // 提升优先级
1842
- this.$wrapperContent.style.display = "none";
1843
- if (this._options.isMobile) {
1844
- this.$wrapperContent.classList.add(`${PICKER_PREFIX_CLS}-mobile`);
1845
- this._$mask = document.createElement("div");
1846
- this._$mask.classList.add(`${PICKER_PREFIX_CLS}-mask`);
1847
- this.$wrapperContent.appendChild(this._$mask);
1848
- }
1849
- this.$body = document.createElement("div");
1850
- this.$body.classList.add(`${PICKER_PREFIX_CLS}-body`);
1851
- this.$wrapperContent.appendChild(this.$body);
1852
- if (typeof this._options.content === "string") {
1853
- this.innerHTML(this._options.content);
1854
- } else if (typeof this._options.content === "function") {
1855
- this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1856
- }
1857
- if (typeof this._options.wrapClassName === "string") {
1858
- try {
1859
- var _this_$wrapperContent;
1860
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.classList.add(...this._options.wrapClassName.split(" "));
1861
- } catch (error) {}
1862
- }
1863
- }
1864
- /**
1865
- * 绑定事件
1866
- */ _eventListener() {
1867
- var _this_$container_addEventListener, _this_$container;
1868
- // eslint-disable-next-line @typescript-eslint/unbound-method
1869
- this.$wrapperContent.addEventListener("click", this._onContentClick);
1870
- (_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);
1871
- //
1872
- if (this._options.trigger === "click") {
1873
- var _this_$container_addEventListener1, _this_$container1;
1874
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, "click", this._onShow);
1875
- }
1876
- if (this._options.trigger === "hover") {
1877
- var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1878
- (_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);
1879
- (_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);
1880
- (_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);
1881
- this.$wrapperContent.addEventListener("mouseenter", this._onWrapperShow);
1882
- this.$wrapperContent.addEventListener("mouseleave", this._onHide);
1883
- }
1884
- if (this._$mask) {
1885
- this._$mask.addEventListener("click", this._onHide);
1886
- }
1887
- if (!this._options.isMobile) {
1888
- // eslint-disable-next-line @typescript-eslint/unbound-method
1889
- window.addEventListener("blur", this._onHide);
1890
- // eslint-disable-next-line @typescript-eslint/unbound-method
1891
- document.addEventListener("visibilitychange", this._onHide);
1892
- // eslint-disable-next-line @typescript-eslint/unbound-method
1893
- window.addEventListener("resize", this._onHide);
1894
- // eslint-disable-next-line @typescript-eslint/unbound-method
1895
- document.addEventListener("click", this._onDocumentClick);
1896
- }
1897
- }
1898
- /**
1899
- * $wrapperContent click event
1900
- * @param e - 内容点击事件
1901
- */ _onContentClick(e) {
1902
- e.stopPropagation();
1903
- pickerProvider.closeOther(e);
1904
- }
1905
- /**
1906
- * 显示事件
1907
- */ _onShow() {
1908
- if (this._disabled) return;
1909
- this.open = true;
1910
- }
1911
- /**
1912
- * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1913
- */ _onWrapperShow() {
1914
- if (this._disabled) {
1915
- return;
1916
- }
1917
- this._onShow();
1918
- }
1919
- /**
1920
- * 隐藏事件
1921
- */ _onHide(e) {
1922
- if (!this._open || this._disabled) return;
1923
- if ((e == null ? void 0 : e.target) === this._$mask) {
1924
- e == null ? void 0 : e.stopPropagation();
1925
- }
1926
- this.open = false;
1927
- }
1928
- /**
1929
- * document 点击事件
1930
- * @param event - 鼠标点击事件
1931
- */ _onDocumentClick(event) {
1932
- var _this_$container;
1933
- 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)) {
1934
- if (this._disabled) return;
1935
- this._onHide();
1936
- }
1937
- }
1938
- constructor(container, options){
1939
- var _this_$popupContainer;
1940
- /** 是否打开 */ this._open = false;
1941
- this._OpenChange = false;
1942
- this._animationTimer = null;
1943
- this._disabled = false;
1944
- this._timer = null;
1945
- // prettier-ignore
1946
- this._options = Object.assign({}, DEFAULT_PICKER_OPTIONS, options || {});
1947
- // 移动端模式强制使用 click 触发
1948
- if (this._options.isMobile) {
1949
- this._options.trigger = "click";
1950
- }
1951
- pickerProvider.add(this);
1952
- if (typeof container === "function") this.$container = container();
1953
- else this.$container = container;
1954
- this.$wrapperContent = document.createElement("div");
1955
- this._initContentStyle();
1956
- (_this_$popupContainer = this.$popupContainer) == null ? void 0 : _this_$popupContainer.appendChild(this.$wrapperContent);
1957
- this._onContentClick = this._onContentClick.bind(this);
1958
- this._onShow = this._onShow.bind(this);
1959
- this._onWrapperShow = this._onWrapperShow.bind(this);
1960
- this._onHide = this._onHide.bind(this);
1961
- this._onDocumentClick = this._onDocumentClick.bind(this);
1962
- this._eventListener();
1963
- this.open = !!this._options.open;
1964
- }
1965
- }
1966
- /**
1967
- * 版本号
1968
- * @example
1969
- * ```ts
1970
- * Picker.VERSION; // 输出版本号
1971
- * ```
1972
- */ Picker.VERSION = "1.0.2";
1477
+ var dist$6;
1478
+ var hasRequiredDist$6;
1479
+
1480
+ function requireDist$6 () {
1481
+ if (hasRequiredDist$6) return dist$6;
1482
+ hasRequiredDist$6 = 1;
1483
+
1484
+ function _array_like_to_array(arr, len) {
1485
+ if (len == null || len > arr.length) len = arr.length;
1486
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1487
+ return arr2;
1488
+ }
1489
+ function _unsupported_iterable_to_array(o, minLen) {
1490
+ if (!o) return;
1491
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1492
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1493
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1494
+ if (n === "Map" || n === "Set") return Array.from(n);
1495
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1496
+ }
1497
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1498
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1499
+ if (it) return (it = it.call(o)).next.bind(it);
1500
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
1501
+ if (it) o = it;
1502
+ var i = 0;
1503
+ return function() {
1504
+ if (i >= o.length) {
1505
+ return {
1506
+ done: true
1507
+ };
1508
+ }
1509
+ return {
1510
+ done: false,
1511
+ value: o[i++]
1512
+ };
1513
+ };
1514
+ }
1515
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1516
+ }
1517
+ /**
1518
+ * PickerProvider 单例类
1519
+ */ var PickerProvider = /*#__PURE__*/ function() {
1520
+ function PickerProvider() {
1521
+ this.pickers = [];
1522
+ }
1523
+ var _proto = PickerProvider.prototype;
1524
+ /**
1525
+ * 添加picker
1526
+ * @param picker Picker 实例
1527
+ */ _proto.add = function add(picker) {
1528
+ this.pickers.push(picker);
1529
+ };
1530
+ /**
1531
+ * 移除picker
1532
+ * @param picker Picker 实例
1533
+ */ _proto.remove = function remove(picker) {
1534
+ var index = this.pickers.indexOf(picker);
1535
+ if (index > -1) {
1536
+ this.pickers.splice(index, 1);
1537
+ }
1538
+ };
1539
+ /**
1540
+ * 关闭其他picker
1541
+ * @param e 事件
1542
+ */ _proto.closeOther = function closeOther(e) {
1543
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;){
1544
+ var p = _step.value;
1545
+ var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1546
+ 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)))) {
1547
+ p.open = false;
1548
+ }
1549
+ }
1550
+ };
1551
+ /**
1552
+ * 获取单例实例
1553
+ * @returns Picker 实例
1554
+ */ PickerProvider.getInstance = function getInstance() {
1555
+ if (!PickerProvider.instance) {
1556
+ PickerProvider.instance = new PickerProvider();
1557
+ }
1558
+ return PickerProvider.instance;
1559
+ };
1560
+ return PickerProvider;
1561
+ }();
1562
+ var pickerProvider = PickerProvider.getInstance();
1563
+
1564
+ function _defineProperties(target, props) {
1565
+ for(var i = 0; i < props.length; i++){
1566
+ var descriptor = props[i];
1567
+ descriptor.enumerable = descriptor.enumerable || false;
1568
+ descriptor.configurable = true;
1569
+ if ("value" in descriptor) descriptor.writable = true;
1570
+ Object.defineProperty(target, descriptor.key, descriptor);
1571
+ }
1572
+ }
1573
+ function _create_class(Constructor, protoProps, staticProps) {
1574
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1575
+ return Constructor;
1576
+ }
1577
+ /**
1578
+ * picker 位置
1579
+ *
1580
+ * | top | tl | tr | bottom | bl | br |
1581
+ * |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
1582
+ * | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
1583
+ *
1584
+ * @public
1585
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
1586
+ var _$PICKER_PLACEMENT$_ = [
1587
+ "top",
1588
+ "tl",
1589
+ "tr",
1590
+ "bottom",
1591
+ "bl",
1592
+ "br"
1593
+ ];
1594
+ /**
1595
+ * 默认样式前缀
1596
+ */ var _$PICKER_PREFIX_CLS$_ = "epicker";
1597
+ /**
1598
+ * Picker 默认值
1599
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
1600
+ var __$PICKER_DEFAULT_OPTIONS$__ = {
1601
+ getPopupContainer: function() {
1602
+ return document.body;
1603
+ },
1604
+ wrapClassName: "",
1605
+ open: false,
1606
+ placement: "br",
1607
+ offset: [
1608
+ 0,
1609
+ 0
1610
+ ],
1611
+ zIndex: 1000,
1612
+ content: "",
1613
+ trigger: "click",
1614
+ mouseLeaveDelay: 0.1,
1615
+ mouseEnterDelay: 0.1,
1616
+ isMobile: false
1617
+ };
1618
+ /**
1619
+ * Picker 弹窗, 支持 PC 和移动端
1620
+ * @remarks
1621
+ * Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
1622
+ * 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
1623
+ *
1624
+ * @example
1625
+ * ```ts
1626
+ * import "@skax/picker/dist/style/css";
1627
+ * import Picker from '@skax/picker';
1628
+ * const picker = new Picker(document.getElementById('picker-container'),
1629
+ * {
1630
+ * placement: 'bottom',
1631
+ * content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
1632
+ * trigger: 'click',
1633
+ * isMobile: false,
1634
+ * });
1635
+ * picker.open = true; // 打开弹窗
1636
+ * picker.setPlacement('top'); // 设置弹窗位置
1637
+ * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1638
+ * picker.destroy(); // 销毁弹窗
1639
+ * ```
1640
+ */ var Picker = /*#__PURE__*/ function() {
1641
+ function Picker(container, options) {
1642
+ var _this__$popupContainer, _this__$popupContainer1;
1643
+ /** 是否打开 */ this._open = false;
1644
+ this._OpenChange = false;
1645
+ this._animationTimer = null;
1646
+ this._disabled = false;
1647
+ this._timer = null;
1648
+ // prettier-ignore
1649
+ this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
1650
+ // 移动端模式强制使用 click 触发
1651
+ if (this._options.isMobile) this._options.trigger = "click";
1652
+ pickerProvider.add(this);
1653
+ if (typeof container === "function") this.$container = container();
1654
+ else this.$container = container;
1655
+ this.$wrapperContent = document.createElement("div");
1656
+ this._initContentStyle();
1657
+ if (typeof this._options.getPopupContainer === "function") {
1658
+ this._$popupContainer = this._options.getPopupContainer();
1659
+ } else {
1660
+ this._$popupContainer = document.body;
1661
+ }
1662
+ if ([
1663
+ "INPUT",
1664
+ "CANVAS",
1665
+ "VIDEO",
1666
+ "IMG"
1667
+ ].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
1668
+ this._$popupContainer = document.body;
1669
+ }
1670
+ if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
1671
+ (_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
1672
+ this._onContentClick = this._onContentClick.bind(this);
1673
+ this._onShow = this._onShow.bind(this);
1674
+ this._onWrapperShow = this._onWrapperShow.bind(this);
1675
+ this._onHide = this._onHide.bind(this);
1676
+ this._onDocumentClick = this._onDocumentClick.bind(this);
1677
+ this._eventListener();
1678
+ this.open = !!this._options.open;
1679
+ }
1680
+ var _proto = Picker.prototype;
1681
+ /**
1682
+ * 设置弹出位置(移动端不生效)
1683
+ * @param placement - 弹出位置
1684
+ * @example
1685
+ * ```ts
1686
+ * picker.setPlacement("top");
1687
+ * picker.setPlacement("tl");
1688
+ * picker.setPlacement("tr");
1689
+ * picker.setPlacement("bottom");
1690
+ * picker.setPlacement("bl");
1691
+ * picker.setPlacement("br");
1692
+ * ```
1693
+ */ _proto.setPlacement = function setPlacement(placement) {
1694
+ if (this._disabled) return;
1695
+ if (_$PICKER_PLACEMENT$_.includes(placement)) {
1696
+ this._options.placement = placement;
1697
+ }
1698
+ this._setPlacement();
1699
+ };
1700
+ /**
1701
+ * 销毁
1702
+ * @example
1703
+ * ```ts
1704
+ * picker.destroy();
1705
+ * ```
1706
+ */ _proto.destroy = function destroy() {
1707
+ this._animationTimerClear();
1708
+ this._removeHtml();
1709
+ pickerProvider.remove(this);
1710
+ // this._$popupContainer 的 position 样式不会被移除
1711
+ };
1712
+ /**
1713
+ * 设置内容(会覆盖之前内容)
1714
+ * @param html - html 字符串内容
1715
+ * @example
1716
+ * ```ts
1717
+ * picker.innerHTML('<div>内容</div>');
1718
+ * ```
1719
+ */ _proto.innerHTML = function innerHTML(html) {
1720
+ if (this.$body) {
1721
+ this.$body.innerHTML = html || "";
1722
+ this._setPlacement();
1723
+ }
1724
+ };
1725
+ // --------------------------------------------------------------------------
1726
+ // Private methods
1727
+ // --------------------------------------------------------------------------
1728
+ /**
1729
+ * picker 面板展开或关闭变化时触发
1730
+ * @param open - true: 展开, false:关闭
1731
+ */ _proto._onOpenChange = function _onOpenChange(open) {
1732
+ this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1733
+ };
1734
+ /**
1735
+ * 移除动画定时器
1736
+ */ _proto._animationTimerClear = function _animationTimerClear() {
1737
+ if (this._animationTimer) {
1738
+ clearTimeout(this._animationTimer);
1739
+ this._animationTimer = null;
1740
+ }
1741
+ };
1742
+ /**
1743
+ * 移除html
1744
+ */ _proto._removeHtml = function _removeHtml() {
1745
+ var // eslint-disable-next-line @typescript-eslint/unbound-method
1746
+ _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
1747
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener("click", this._onContentClick);
1748
+ (_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);
1749
+ 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._onShow);
1750
+ if (this._options.trigger === "hover") {
1751
+ var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4, // prettier-ignore
1752
+ _this_$wrapperContent1, _this_$wrapperContent2;
1753
+ (_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);
1754
+ (_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);
1755
+ (_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);
1756
+ (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
1757
+ (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener("mouseleave", this._onHide);
1758
+ }
1759
+ if (!this._options.isMobile) {
1760
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1761
+ window.removeEventListener("blur", this._onHide);
1762
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1763
+ document.removeEventListener("visibilitychange", this._onHide);
1764
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1765
+ window.removeEventListener("resize", this._onHide);
1766
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1767
+ document.removeEventListener("click", this._onDocumentClick);
1768
+ }
1769
+ if (this._$mask) {
1770
+ this._$mask.removeEventListener("click", this._onHide);
1771
+ this._$mask.remove();
1772
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1773
+ this._$mask = null;
1774
+ }
1775
+ if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1776
+ if (this.$wrapperContent) {
1777
+ this.$wrapperContent.remove();
1778
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1779
+ this.$wrapperContent = null;
1780
+ }
1781
+ };
1782
+ /**
1783
+ * 现实位置
1784
+ */ _proto._setPlacement = function _setPlacement() {
1785
+ var _this_$container_getBoundingClientRect, _this_$container;
1786
+ if (!this._open || this._options.isMobile || !this.$container) return;
1787
+ var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1788
+ var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1789
+ var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
1790
+ // 容器的坐标 - 挂载的容器的坐标差
1791
+ // prettier-ignore
1792
+ var containerLeft = $containerRect.left - $popupContainerRect.left;
1793
+ var containerRight = -($containerRect.right - $popupContainerRect.right);
1794
+ // prettier-ignore
1795
+ var containerTop = $containerRect.y - $popupContainerRect.y;
1796
+ var left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1797
+ var right;
1798
+ var top = containerTop - $wrapperContentRect.height;
1799
+ var bottom = containerTop + $containerRect.height;
1800
+ if (/^t/.test(this._options.placement)) {
1801
+ var _this__options_offset, _this__options_offset1, _this__options_offset2;
1802
+ switch(this._options.placement){
1803
+ case "top":
1804
+ right = undefined;
1805
+ break;
1806
+ case "tl":
1807
+ right = undefined;
1808
+ left = containerLeft;
1809
+ break;
1810
+ case "tr":
1811
+ left = undefined;
1812
+ right = containerRight;
1813
+ break;
1814
+ }
1815
+ 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 ";
1816
+ } else if (/^b/.test(this._options.placement)) {
1817
+ var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1818
+ switch(this._options.placement){
1819
+ case "bottom":
1820
+ right = undefined;
1821
+ break;
1822
+ case "bl":
1823
+ right = undefined;
1824
+ left = containerLeft;
1825
+ break;
1826
+ case "br":
1827
+ left = undefined;
1828
+ right = containerRight;
1829
+ break;
1830
+ }
1831
+ 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 ";
1832
+ }
1833
+ };
1834
+ /**
1835
+ * 初始化内容样式
1836
+ */ _proto._initContentStyle = function _initContentStyle() {
1837
+ if (!this.$wrapperContent) return;
1838
+ // prettier-ignore
1839
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
1840
+ // 提升优先级
1841
+ this.$wrapperContent.style.display = "none";
1842
+ if (this._options.isMobile) {
1843
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
1844
+ this._$mask = document.createElement("div");
1845
+ this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
1846
+ this.$wrapperContent.appendChild(this._$mask);
1847
+ }
1848
+ this.$body = document.createElement("div");
1849
+ this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
1850
+ this.$wrapperContent.appendChild(this.$body);
1851
+ if (typeof this._options.content === "string") {
1852
+ this.innerHTML(this._options.content);
1853
+ } else if (typeof this._options.content === "function") {
1854
+ this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1855
+ }
1856
+ if (typeof this._options.wrapClassName === "string") {
1857
+ try {
1858
+ var _this_$wrapperContent_classList;
1859
+ var _this_$wrapperContent;
1860
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(" ")));
1861
+ } catch (error) {}
1862
+ }
1863
+ };
1864
+ /**
1865
+ * 绑定事件
1866
+ */ _proto._eventListener = function _eventListener() {
1867
+ var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
1868
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1869
+ this.$wrapperContent.addEventListener("click", this._onContentClick);
1870
+ (_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);
1871
+ //
1872
+ 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._onShow);
1873
+ if (this._options.trigger === "hover") {
1874
+ var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1875
+ (_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);
1876
+ (_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);
1877
+ (_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);
1878
+ this.$wrapperContent.addEventListener("mouseenter", this._onWrapperShow);
1879
+ this.$wrapperContent.addEventListener("mouseleave", this._onHide);
1880
+ }
1881
+ if (this._$mask) this._$mask.addEventListener("click", this._onHide);
1882
+ if (!this._options.isMobile) {
1883
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1884
+ window.addEventListener("blur", this._onHide);
1885
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1886
+ document.addEventListener("visibilitychange", this._onHide);
1887
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1888
+ window.addEventListener("resize", this._onHide);
1889
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1890
+ document.addEventListener("click", this._onDocumentClick);
1891
+ }
1892
+ };
1893
+ /**
1894
+ * $wrapperContent click event
1895
+ * @param e - 内容点击事件
1896
+ */ _proto._onContentClick = function _onContentClick(e) {
1897
+ pickerProvider.closeOther(e);
1898
+ };
1899
+ /**
1900
+ * 显示事件
1901
+ */ _proto._onShow = function _onShow() {
1902
+ if (this._disabled) return;
1903
+ this.open = true;
1904
+ };
1905
+ /**
1906
+ * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1907
+ */ _proto._onWrapperShow = function _onWrapperShow() {
1908
+ if (this._disabled) return;
1909
+ this._onShow();
1910
+ };
1911
+ /**
1912
+ * 隐藏事件
1913
+ */ _proto._onHide = function _onHide(e) {
1914
+ if (!this._open || this._disabled) return;
1915
+ if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
1916
+ this.open = false;
1917
+ };
1918
+ /**
1919
+ * document 点击事件
1920
+ * @param event - 鼠标点击事件
1921
+ */ _proto._onDocumentClick = function _onDocumentClick(event) {
1922
+ var _this_$container;
1923
+ 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)) {
1924
+ if (this._disabled) return;
1925
+ this._onHide();
1926
+ }
1927
+ };
1928
+ _create_class(Picker, [
1929
+ {
1930
+ key: "open",
1931
+ get: /**
1932
+ * 获取当前打开状态
1933
+ * @example
1934
+ * ```ts
1935
+ * console.log(picker.open); // 获取当前打开状态
1936
+ * picker.open = true; // 打开
1937
+ * picker.open = false; // 关闭
1938
+ * ```
1939
+ */ function get() {
1940
+ return this._open;
1941
+ },
1942
+ set: function set(open) {
1943
+ var _this = this;
1944
+ if (this._disabled) return;
1945
+ if (this._open !== !!open) {
1946
+ this._animationTimerClear();
1947
+ if (this._timer) {
1948
+ clearTimeout(this._timer);
1949
+ this._timer = null;
1950
+ }
1951
+ if (open) {
1952
+ // prettier-ignore
1953
+ this._timer = setTimeout(function() {
1954
+ if (!_this.$wrapperContent) return;
1955
+ _this.$wrapperContent.style.display = "inline-flex";
1956
+ _this.$wrapperContent.style.pointerEvents = "";
1957
+ // prettier-ignore
1958
+ if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1959
+ _this._animationTimer = setTimeout(function() {
1960
+ _this._animationTimerClear();
1961
+ _this.$wrapperContent.style.opacity = "1";
1962
+ }, 0);
1963
+ requestAnimationFrame(function() {
1964
+ _this._setPlacement();
1965
+ });
1966
+ _this._OpenChange = open;
1967
+ _this._onOpenChange(open);
1968
+ }, // prettier-ignore
1969
+ (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1970
+ } else {
1971
+ // prettier-ignore
1972
+ this._timer = setTimeout(function() {
1973
+ if (!_this.$wrapperContent) return;
1974
+ _this.$wrapperContent.style.opacity = "0";
1975
+ _this.$wrapperContent.style.pointerEvents = "none";
1976
+ // prettier-ignore
1977
+ if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1978
+ _this._animationTimer = setTimeout(function() {
1979
+ _this._animationTimerClear();
1980
+ _this.$wrapperContent.style.display = "none";
1981
+ }, 301); // css 动画是 300ms
1982
+ _this._OpenChange = open;
1983
+ _this._onOpenChange(open);
1984
+ }, // prettier-ignore
1985
+ (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1986
+ }
1987
+ if (this._OpenChange === open) {
1988
+ if (this._timer) {
1989
+ clearTimeout(this._timer);
1990
+ this._timer = null;
1991
+ }
1992
+ }
1993
+ this._open = !!open;
1994
+ }
1995
+ }
1996
+ },
1997
+ {
1998
+ key: "disabled",
1999
+ get: /**
2000
+ * 获取或设置禁用状态
2001
+ * @example
2002
+ * ```ts
2003
+ * picker.disabled = true; // 禁用
2004
+ * picker.disabled = false; // 启用
2005
+ * console.log(picker.disabled); // 获取禁用状态
2006
+ * ```
2007
+ */ function get() {
2008
+ return this._disabled;
2009
+ },
2010
+ set: function set(disabled) {
2011
+ if (disabled) {
2012
+ var _this_$container_classList_add, _this_$container_classList, _this_$container;
2013
+ (_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");
2014
+ } else {
2015
+ var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
2016
+ (_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");
2017
+ }
2018
+ this._disabled = disabled;
2019
+ }
2020
+ }
2021
+ ]);
2022
+ return Picker;
2023
+ }();
2024
+ /**
2025
+ * 版本号
2026
+ * @example
2027
+ * ```ts
2028
+ * Picker.VERSION; // 输出版本号
2029
+ * ```
2030
+ */ Picker.VERSION = "1.1.2";
2031
+
2032
+ dist$6 = Picker;
2033
+ return dist$6;
2034
+ }
2035
+
2036
+ var distExports$5 = requireDist$6();
2037
+ var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports$5);
1973
2038
 
1974
2039
  /*
1975
- * delegate.js v3.2.0
1976
- * Copyright (c) 2025-07-25
2040
+ * delegate.js v4.0.0
2041
+ * Copyright (c) 2025-11-09
1977
2042
  * Released under the MIT License.
1978
2043
  */
1979
- const DOCUMENT_NODE_TYPE = 9;
1980
- /**
1981
- * A polyfill for Element.matches()
1982
- */ if (typeof Element !== "undefined" && !Element.prototype.matches) {
1983
- const proto = Element.prototype;
1984
- 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);
1985
- }
1986
- /**
1987
- * Finds the closest parent that matches a selector.
1988
- *
1989
- * @param {Element} element
1990
- * @param {string} selector
1991
- * @return {Function}
1992
- */ function closest(element, selector) {
1993
- while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
1994
- if (typeof element.matches === "function" && element.matches(selector)) {
1995
- return element;
1996
- }
1997
- element = element.parentNode;
1998
- }
1999
- }
2000
2044
 
2001
- /**
2002
- * Delegates event to a selector.
2003
- *
2004
- * @param {Element} element
2005
- * @param {String} selector
2006
- * @param {String} type
2007
- * @param {Function} callback
2008
- * @param {Boolean} useCapture
2009
- * @return {Object}
2010
- */ // prettier-ignore
2011
- function _delegate(element, selector, type, callback, useCapture) {
2012
- // prettier-ignore
2013
- const listenerFn = listener.apply(this, arguments);
2014
- element.addEventListener(type, listenerFn, useCapture);
2015
- return {
2016
- destroy: function() {
2017
- element.removeEventListener(type, listenerFn, useCapture);
2018
- }
2019
- };
2020
- }
2021
- /**
2022
- * Delegates event to a selector.
2023
- *
2024
- * @param {Element|String|Array} [elements]
2025
- * @param {string | Element} selector
2026
- * @param {String} type
2027
- * @param {Function} callback
2028
- * @param {Boolean} useCapture
2029
- * @return {Object}
2030
- */ // prettier-ignore
2031
- function delegate(elements, selector, type, callback, useCapture) {
2032
- // Handle the regular Element usage
2033
- if (typeof elements.addEventListener === "function") {
2034
- return _delegate.apply(null, arguments);
2035
- }
2036
- // Handle Element-less usage, it defaults to global delegation
2037
- if (typeof type === "function") {
2038
- // Use `document` as the first parameter, then apply arguments
2039
- // This is a short way to .unshift `arguments` without running into deoptimizations
2040
- return _delegate.bind(null, document).apply(null, arguments);
2041
- }
2042
- // Handle Selector-based usage
2043
- if (typeof elements === "string") {
2044
- elements = document.querySelectorAll(elements);
2045
- }
2046
- // Handle Array-like based usage
2047
- return Array.prototype.map.call(elements, function(element) {
2048
- return _delegate(element, selector, type, callback, useCapture);
2049
- });
2050
- }
2051
- /**
2052
- * Finds closest match and invokes callback.
2053
- *
2054
- * @param {Element} element
2055
- * @param {String} selector
2056
- * @param {String} type
2057
- * @param {Function} callback
2058
- * @return {Function}
2059
- */ // prettier-ignore
2060
- function listener(element, selector, type, callback) {
2061
- return function(e) {
2062
- e.delegateTarget = closest(e.target, selector);
2063
- if (e.delegateTarget) {
2064
- callback.call(element, e);
2065
- }
2066
- };
2045
+ var dist$5;
2046
+ var hasRequiredDist$5;
2047
+
2048
+ function requireDist$5 () {
2049
+ if (hasRequiredDist$5) return dist$5;
2050
+ hasRequiredDist$5 = 1;
2051
+
2052
+ const DOCUMENT_NODE_TYPE = 9;
2053
+ /**
2054
+ * A polyfill for Element.matches()
2055
+ */ if (typeof Element !== "undefined" && !Element.prototype.matches) {
2056
+ const proto = Element.prototype;
2057
+ 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);
2058
+ }
2059
+ /**
2060
+ * Finds the closest parent that matches a selector.
2061
+ *
2062
+ * @param {Element} element
2063
+ * @param {string} selector
2064
+ * @return {Element}
2065
+ */ function closest(element, selector) {
2066
+ while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
2067
+ if (typeof element.matches === "function" && element.matches(selector)) {
2068
+ return element;
2069
+ }
2070
+ element = element.parentNode;
2071
+ }
2072
+ return null;
2073
+ }
2074
+ /**
2075
+ * Finds the closest parent that matches a selector.
2076
+ *
2077
+ * @param {Element} element
2078
+ * @param {string} selector
2079
+ * @return {Element}
2080
+ */ function closestNative(element, selector) {
2081
+ return element && element.closest(selector);
2082
+ }
2083
+ var closest$1 = typeof Element.prototype.closest === "function" ? closestNative : closest;
2084
+
2085
+ /**
2086
+ * Delegates event to a selector.
2087
+ *
2088
+ * @param {Element} element
2089
+ * @param {string} selector
2090
+ * @param {string} type
2091
+ * @param {Function} callback
2092
+ * @param {boolean} useCapture
2093
+ * @return {Object}
2094
+ */ // prettier-ignore
2095
+ function _delegate(element, selector, type, callback, useCapture) {
2096
+ // prettier-ignore
2097
+ const listenerFn = listener.apply(this, arguments);
2098
+ element.addEventListener(type, listenerFn, useCapture);
2099
+ return {
2100
+ destroy: function() {
2101
+ element.removeEventListener(type, listenerFn, useCapture);
2102
+ }
2103
+ };
2104
+ }
2105
+ /**
2106
+ * Delegates event to a selector.
2107
+ *
2108
+ * @param {Element|string|Array} [elements]
2109
+ * @param {string | Element} selector
2110
+ * @param {string} type
2111
+ * @param {Function} callback
2112
+ * @param {boolean} useCapture
2113
+ * @return {Object}
2114
+ * @example
2115
+ * ```ts
2116
+ * const delegation = delegate(document.body, 'a', 'click', function (e) {})
2117
+ * // destroy (removeEventListener)
2118
+ * delegation.destroy();
2119
+ *
2120
+ * const delegation1 = delegate(".btn", "click", function (e) { console.log(e.delegateTarget)},false);
2121
+ * // destroy (removeEventListener)
2122
+ * delegation1.destroy();
2123
+ * ```
2124
+ */ // prettier-ignore
2125
+ function delegate(elements, selector, type, callback, useCapture) {
2126
+ // Handle the regular Element usage
2127
+ if (typeof elements.addEventListener === "function") {
2128
+ return _delegate.apply(null, arguments);
2129
+ }
2130
+ // Handle Element-less usage, it defaults to global delegation
2131
+ if (typeof type === "function") {
2132
+ // Use `document` as the first parameter, then apply arguments
2133
+ // This is a short way to .unshift `arguments` without running into deoptimizations
2134
+ return _delegate.bind(null, document).apply(null, arguments);
2135
+ }
2136
+ // Handle Selector-based usage
2137
+ if (typeof elements === "string") {
2138
+ elements = document.querySelectorAll(elements);
2139
+ }
2140
+ // Handle Array-like based usage
2141
+ return Array.prototype.map.call(elements, function(element) {
2142
+ return _delegate(element, selector, type, callback, useCapture);
2143
+ });
2144
+ }
2145
+ /**
2146
+ * Finds closest match and invokes callback.
2147
+ *
2148
+ * @param {Element} element
2149
+ * @param {string} selector
2150
+ * @param {string} type
2151
+ * @param {Function} callback
2152
+ * @return {Function}
2153
+ */ // prettier-ignore
2154
+ function listener(element, selector, type, callback) {
2155
+ return function(e) {
2156
+ e.delegateTarget = closest$1(e.target, selector);
2157
+ if (e.delegateTarget) {
2158
+ callback.call(element, e);
2159
+ }
2160
+ };
2161
+ }
2162
+
2163
+ dist$5 = delegate;
2164
+ return dist$5;
2067
2165
  }
2068
2166
 
2167
+ var distExports$4 = requireDist$5();
2168
+ var delegate = /*@__PURE__*/getDefaultExportFromCjs(distExports$4);
2169
+
2069
2170
  var cjs;
2070
2171
  var hasRequiredCjs;
2071
2172
 
@@ -2210,13 +2311,98 @@
2210
2311
  var cjsExports = requireCjs();
2211
2312
  var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
2212
2313
 
2213
- /*
2214
- * @ezuikit/utils-tools v1.1.1-beta.1
2215
- * tools utils
2216
- * Copyright (c) 2025-09-01 Ezviz-OpenBiz
2217
- * Released under the MIT License.
2218
- */
2219
- const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","");}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;const pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return {}}function isMobile$1(agent){var _navigator,_navigator1,_navigator2,_window;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1||(null==(_window=window)?void 0:_window.__IS_MOBILE_SIMULATOR__)}
2314
+ var dist$4 = {};
2315
+
2316
+ var hasRequiredDist$4;
2317
+
2318
+ function requireDist$4 () {
2319
+ if (hasRequiredDist$4) return dist$4;
2320
+ hasRequiredDist$4 = 1;
2321
+
2322
+ var getQuery = function(url) {
2323
+ var query = url.split("?")[1], obj = {};
2324
+ if (query) for (var vars = query.split("&"), i = 0; i < vars.length; i++) {
2325
+ var pair = vars[i].split("=");
2326
+ obj[pair[0]] = decodeURIComponent(pair[1]);
2327
+ }
2328
+ return obj;
2329
+ };
2330
+
2331
+ function parseEzopenUrl(url) {
2332
+ var obj = {};
2333
+ if (/^ezopen:\/\//.test(url)) {
2334
+ if (url.includes("@")) {
2335
+ var endIndex = url.indexOf("@"), startIndex = url.indexOf("//");
2336
+ obj.validateCode = url.substring(startIndex + 2, endIndex), url = url.replace(obj.validateCode + "@", "");
2337
+ }
2338
+ obj.protocol = url.split("//")[0], obj.search = url.split("?")[1] ? "?" + url.split("?")[1] : "",
2339
+ obj.hostname = url.split("/")[2], obj.origin = obj.protocol + "//" + obj.hostname,
2340
+ obj.pathname = url.split("?")[0].replace(obj.origin, ""), obj.href = url;
2341
+ var pathnames = obj.pathname.split("/"), lastPath = pathnames[2].split(".");
2342
+ return obj.deviceSerial = pathnames[1], obj.channelNo = lastPath[0], obj.type = lastPath[lastPath.length - 1],
2343
+ "live" === obj.type && (obj.definition = lastPath.length > 2 ? lastPath[1] : "sd"),
2344
+ "rec" === obj.type && pathnames[2] && (obj.recType = pathnames[2].includes(".cloud.") ? "cloud" : ""),
2345
+ obj.searchParams = getQuery(url), obj;
2346
+ }
2347
+ return {};
2348
+ }
2349
+
2350
+ var __$codec$__ = {
2351
+ h264: 1,
2352
+ h265: 2,
2353
+ h266: 4,
2354
+ vp8: 8,
2355
+ vp9: 16,
2356
+ av1: 32
2357
+ };
2358
+
2359
+ dist$4.addVc = function(url, codecs) {
2360
+ void 0 === codecs && (codecs = [ "h264" ]);
2361
+ var vc = (codecs || [ "h264" ]).reduce(function(acc, key) {
2362
+ return key = key.toLowerCase(), acc + (__$codec$__[key] || 0);
2363
+ }, 0), host = url.split("?")[0], query = url.split("?")[1];
2364
+ return query = (query || "").split("&").filter(function(item) {
2365
+ return !/^vc=\d?/.test(item);
2366
+ }).join("&"), host + "?" + (query += (query ? "&" : "") + "vc=" + vc);
2367
+ }, dist$4.getQuery = getQuery, dist$4.getStaticPath = function(path, base) {
2368
+ void 0 === base && (base = "");
2369
+ var protocolReg = /^(https?:\/\/|^\/\/)/;
2370
+ if ("" === path || void 0 === path) return "";
2371
+ if (protocolReg.test(path)) return path;
2372
+ path = path.replace(/\/+/g, "/"), base = protocolReg.test(base || "") ? base : window.location.href;
2373
+ try {
2374
+ return new URL(path, base).href;
2375
+ } catch (error) {
2376
+ return path;
2377
+ }
2378
+ }, dist$4.isHttp = function(url) {
2379
+ return /^http[s]?:\/\//.test(url);
2380
+ }, dist$4.isMobile = function(agent) {
2381
+ var _navigator, _navigator1, _navigator2, _window;
2382
+ return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null != agent ? agent : null == (_navigator = navigator) ? void 0 : _navigator.userAgent) || /Macintosh/i.test(null == (_navigator1 = navigator) ? void 0 : _navigator1.userAgent) && (null == (_navigator2 = navigator) ? void 0 : _navigator2.maxTouchPoints) > 1 || (null == (_window = window) ? void 0 : _window.__IS_MOBILE_SIMULATOR__);
2383
+ }, dist$4.parseEzopenUrl = parseEzopenUrl, dist$4.pick = function(obj, keys) {
2384
+ return Object.entries(obj).reduce(function(acc, param) {
2385
+ var key = param[0], value = param[1];
2386
+ return keys.includes(key) && (acc[key] = value), acc;
2387
+ }, {});
2388
+ }, dist$4.switchEzopenUrl = function(url, options) {
2389
+ var _ref = null != options ? options : {}, type = _ref.type, recType = _ref.recType, search = _ref.search, definition = _ref.definition, channelNo = _ref.channelNo, deviceSerial = _ref.deviceSerial, validateCode = _ref.validateCode, obj = parseEzopenUrl(url);
2390
+ if (search) {
2391
+ var ns = Object.assign({}, obj.searchParams, getQuery("?" + search.replace("?", "")));
2392
+ search = Object.entries(ns).reduce(function(acc, param) {
2393
+ var key = param[0], value = param[1];
2394
+ return "" === value ? acc : acc += key + "=" + encodeURIComponent(value) + "&";
2395
+ }, "?").replace(/&$/, "");
2396
+ } else search = obj.search;
2397
+ return type = type || obj.type, recType = null != recType ? recType : obj.recType,
2398
+ definition = null != definition ? definition : obj.definition, channelNo = channelNo || obj.channelNo,
2399
+ deviceSerial = deviceSerial || obj.deviceSerial, validateCode = null != validateCode ? validateCode : obj.validateCode,
2400
+ obj.protocol + "//" + (validateCode ? validateCode + "@" : "") + obj.hostname + "/" + deviceSerial + "/" + channelNo + ("rec" === type && recType ? "." + recType : "") + ("live" === type && "hd" === definition ? "." + definition : "") + "." + type + search;
2401
+ };
2402
+ return dist$4;
2403
+ }
2404
+
2405
+ var distExports$3 = requireDist$4();
2220
2406
 
2221
2407
  /**
2222
2408
  * 节流函数
@@ -2444,7 +2630,7 @@
2444
2630
  * ```ts
2445
2631
  * Utils.isMobile // true | false
2446
2632
  * ```
2447
- */ Utils.isMobile = isMobile$1();
2633
+ */ Utils.isMobile = distExports$3.isMobile();
2448
2634
 
2449
2635
  function _defineProperties$7(target, props) {
2450
2636
  for(var i = 0; i < props.length; i++){
@@ -2783,8 +2969,8 @@
2783
2969
  if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
2784
2970
  return Constructor;
2785
2971
  }
2786
- function _extends$n() {
2787
- _extends$n = Object.assign || function(target) {
2972
+ function _extends$m() {
2973
+ _extends$m = Object.assign || function(target) {
2788
2974
  for(var i = 1; i < arguments.length; i++){
2789
2975
  var source = arguments[i];
2790
2976
  for(var key in source){
@@ -2795,7 +2981,7 @@
2795
2981
  }
2796
2982
  return target;
2797
2983
  };
2798
- return _extends$n.apply(this, arguments);
2984
+ return _extends$m.apply(this, arguments);
2799
2985
  }
2800
2986
  function _inherits$m(subClass, superClass) {
2801
2987
  if (typeof superClass !== "function" && superClass !== null) {
@@ -2834,7 +3020,7 @@
2834
3020
  if (options === void 0) options = {};
2835
3021
  var _this;
2836
3022
  var _this__options_props, _this__options_props1, _this__options_props2, _this__options_props3;
2837
- _this = Control.call(this, _extends$n({}, options, {
3023
+ _this = Control.call(this, _extends$m({}, options, {
2838
3024
  tagName: 'span',
2839
3025
  classNameSuffix: 'volume',
2840
3026
  controlType: 'button'
@@ -3689,8 +3875,8 @@
3689
3875
  return Fullscreen;
3690
3876
  }();
3691
3877
 
3692
- function _extends$m() {
3693
- _extends$m = Object.assign || function(target) {
3878
+ function _extends$l() {
3879
+ _extends$l = Object.assign || function(target) {
3694
3880
  for(var i = 1; i < arguments.length; i++){
3695
3881
  var source = arguments[i];
3696
3882
  for(var key in source){
@@ -3701,7 +3887,7 @@
3701
3887
  }
3702
3888
  return target;
3703
3889
  };
3704
- return _extends$m.apply(this, arguments);
3890
+ return _extends$l.apply(this, arguments);
3705
3891
  }
3706
3892
  function _inherits$l(subClass, superClass) {
3707
3893
  if (typeof superClass !== "function" && superClass !== null) {
@@ -3731,7 +3917,7 @@
3731
3917
  function Fullscreen(options) {
3732
3918
  var _this;
3733
3919
  var _options_props, _this_options;
3734
- _this = Control.call(this, _extends$m({
3920
+ _this = Control.call(this, _extends$l({
3735
3921
  tagName: 'span',
3736
3922
  classNameSuffix: 'fullscreen',
3737
3923
  controlType: 'button'
@@ -3796,8 +3982,8 @@
3796
3982
  return Fullscreen;
3797
3983
  }(Control);
3798
3984
 
3799
- function _extends$l() {
3800
- _extends$l = Object.assign || function(target) {
3985
+ function _extends$k() {
3986
+ _extends$k = Object.assign || function(target) {
3801
3987
  for(var i = 1; i < arguments.length; i++){
3802
3988
  var source = arguments[i];
3803
3989
  for(var key in source){
@@ -3808,7 +3994,7 @@
3808
3994
  }
3809
3995
  return target;
3810
3996
  };
3811
- return _extends$l.apply(this, arguments);
3997
+ return _extends$k.apply(this, arguments);
3812
3998
  }
3813
3999
  function _inherits$k(subClass, superClass) {
3814
4000
  if (typeof superClass !== "function" && superClass !== null) {
@@ -3838,7 +4024,7 @@
3838
4024
  function Rec(options) {
3839
4025
  var _this;
3840
4026
  var _options_props;
3841
- _this = Control.call(this, _extends$l({}, options, {
4027
+ _this = Control.call(this, _extends$k({}, options, {
3842
4028
  tagName: 'div',
3843
4029
  controlType: 'block',
3844
4030
  classNameSuffix: 'rec'
@@ -3930,27 +4116,187 @@
3930
4116
  return Rec;
3931
4117
  }(Control);
3932
4118
 
3933
- /*
3934
- * @ezuikit/utils-i18n v1.1.1
3935
- * i18n utils
3936
- * Copyright (c) 2025-08-30 Ezviz-OpenBiz
3937
- * Released under the MIT License.
3938
- */
3939
- class I18n{t(scope,variables){
3940
- const translation=this._translations[this._locale];let value;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)){const[v,hasProp]=this._findChainValue(translation,scope);if(hasProp)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,((_,varName)=>String(variables[varName])||"")):value}get locale(){return this._locale}get translations(){return this._translations}appendTranslations(translations){this._translations=deepmerge(this._translations,translations,{clone:false}),this._locale||(this._locale=Object.keys(this._translations)[0]),this._onChange();}
3941
- switchLocale(locale){locale in this._translations&&(this._locale=locale,this._onChange());}
3942
- switchTranslation(locale){locale in this._translations&&(this._locale=locale,this._onChange());}
3943
- getCurrentLocale(){return this._locale}getCurrentTranslation(){return this._translations[this._locale]}getVersion(){return "1.1.0"}_onChange(){return null==this.options.onChange?void 0:this.options.onChange.call(this.options,this)}_findChainValue(obj,path){const paths=path.split(".");let translation=obj;for(let i=0;i<paths.length;i++){if(!(paths[i]in translation))return [void 0,false];if(translation=translation[paths[i]],i+1===paths.length)return [translation[paths[i]],true]}return [void 0,false]}constructor(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||{};}}I18n.VERSION="1.1.0";
4119
+ var dist$3 = {exports: {}};
3944
4120
 
3945
- /*
3946
- * @ezuikit/utils-logger v1.1.0
3947
- * logger utils
3948
- * Copyright (c) 2025-08-29 Ezviz-OpenBiz
3949
- * Released under the MIT License.
3950
- */
3951
- const LoggerStyle={info:"",log:"background: #4096ff; color: #FFF;",warn:"background: yellow; color: #FFF;",error:"background: red; color: #FFF;"};class LoggerCls{setOptions(options){var _this__options_level;this._options=Object.assign({},this._options,options),this._levelNum=this._matchLevel(null!=(_this__options_level=this._options.level)?_this__options_level:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0);}_matchLevel(level){let logLevel=3;switch(level){case "INFO":logLevel=3;break;case "LOG":logLevel=2;break;case "WARN":logLevel=1;break;case "ERROR":logLevel=0;}return logLevel}_loggerFactory(type,bool){const fn=console[type];if(bool&&fn){const args0=this._options.name?`%c[${this._options.name}]%c %c[${type.toUpperCase()}]`:`%c[${type.toUpperCase()}]`,color=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,LoggerStyle[type]].filter((color=>null!=color));return fn.bind(console,args0,...color)}return LoggerCls.noop}getOptions(){return this._options}getVersion(){return "1.1.0"}constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._options={level:"INFO",showTime:false},this._levelNum=3,this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(options);}}function fillTen(num){return (num=+num)<10&&(num=`0${num}`),num+""}LoggerCls.noop=()=>{},LoggerCls.VERSION="1.1.0";const list=["info","log","warn","error"];function Logger(options){const logger=new LoggerCls(options);return new Proxy(logger,{get(target,prop){if(list.includes(prop)){var _target__options;if(null==(_target__options=target._options)?void 0:_target__options.showTime){const time=function(){const now=new Date(Date.now()),year=now.getFullYear(),month=now.getMonth()+1,day=now.getDate(),hour=now.getHours(),min=now.getMinutes(),sec=now.getSeconds(),ms=now.getMilliseconds();return `${year}/${fillTen(month)}/${fillTen(day)} ${fillTen(hour)}:${fillTen(min)}:${fillTen(sec)}:${ms}`}();return target[prop].bind(console,`[${time}]`)}return target[prop].bind(console)}return Reflect.get(target,prop)}})}
4121
+ var hasRequiredDist$3;
4122
+
4123
+ function requireDist$3 () {
4124
+ if (hasRequiredDist$3) return dist$3.exports;
4125
+ hasRequiredDist$3 = 1;
4126
+
4127
+ var deepmerge = requireCjs();
4128
+
4129
+ function _create_class(Constructor, protoProps, staticProps) {
4130
+ return protoProps && function(target, props) {
4131
+ for (var i = 0; i < props.length; i++) {
4132
+ var descriptor = props[i];
4133
+ descriptor.enumerable = descriptor.enumerable || false, descriptor.configurable = true,
4134
+ "value" in descriptor && (descriptor.writable = true), Object.defineProperty(target, descriptor.key, descriptor);
4135
+ }
4136
+ }(Constructor.prototype, protoProps), Constructor;
4137
+ }
4138
+
4139
+ var I18n = function() {
4140
+ function I18n(translations, options) {
4141
+ this._translations = {}, this._locale = null == options ? void 0 : options.defaultLocale,
4142
+ translations && (this._translations = translations, (null == options ? void 0 : options.defaultLocale) || (this._locale = Object.keys(translations)[0])),
4143
+ this.options = options || {};
4144
+ }
4145
+ var _proto = I18n.prototype;
4146
+ return _proto.t = function(scope, variables) {
4147
+ var value, translation = this._translations[this._locale];
4148
+ if (!translation) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + '" locale]';
4149
+ if ("string" == typeof scope && scope.includes(".") && !(scope in translation)) {
4150
+ var _this__findChainValue = this._findChainValue(translation, scope), v = _this__findChainValue[0];
4151
+ if (_this__findChainValue[1]) value = v; else {
4152
+ 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]';
4153
+ value = variables.defaultvalue;
4154
+ }
4155
+ } else if (scope in translation) value = translation[scope]; else {
4156
+ 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]';
4157
+ value = variables.defaultvalue;
4158
+ }
4159
+ return "string" == typeof value && variables && /\{\{\s*(\w+)\s*\}\}/.test(value) ? value.replace(/\{\{\s*(\w+)\s*\}\}/g, function(_, varName) {
4160
+ return String(variables[varName]) || "";
4161
+ }) : value;
4162
+ }, _proto.appendTranslations = function(translations) {
4163
+ this._translations = deepmerge(this._translations, translations, {
4164
+ clone: false
4165
+ }), this._locale || (this._locale = Object.keys(this._translations)[0]), this._onChange();
4166
+ }, _proto.switchLocale = function(locale) {
4167
+ locale in this._translations && (this._locale = locale, this._onChange());
4168
+ }, _proto.switchTranslation = function(locale) {
4169
+ this.switchLocale(locale);
4170
+ }, _proto.getCurrentLocale = function() {
4171
+ return this._locale;
4172
+ }, _proto.getCurrentTranslation = function() {
4173
+ return this._translations[this._locale];
4174
+ }, _proto.getVersion = function() {
4175
+ return "2.0.0-beta.4";
4176
+ }, _proto._onChange = function() {
4177
+ return null == this.options.onChange ? void 0 : this.options.onChange.call(this.options, this);
4178
+ }, _proto._findChainValue = function(obj, path) {
4179
+ for (var paths = path.split("."), translation = obj, i = 0; i < paths.length; i++) {
4180
+ if (!(paths[i] in translation)) return [ void 0, false ];
4181
+ if (translation = translation[paths[i]], i + 1 === paths.length) return [ translation[paths[i]], true ];
4182
+ }
4183
+ return [ void 0, false ];
4184
+ }, _create_class(I18n, [ {
4185
+ key: "locale",
4186
+ get: function() {
4187
+ return this._locale;
4188
+ }
4189
+ }, {
4190
+ key: "translations",
4191
+ get: function() {
4192
+ return this._translations;
4193
+ }
4194
+ } ]), I18n;
4195
+ }();
4196
+
4197
+ I18n.VERSION = "2.0.0-beta.4", dist$3.exports = I18n;
4198
+ return dist$3.exports;
4199
+ }
4200
+
4201
+ var distExports$2 = requireDist$3();
4202
+ var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$2);
4203
+
4204
+ var dist$2;
4205
+ var hasRequiredDist$2;
4206
+
4207
+ function requireDist$2 () {
4208
+ if (hasRequiredDist$2) return dist$2;
4209
+ hasRequiredDist$2 = 1;
4210
+
4211
+ var _$LoggerStyle$_ = {
4212
+ info: "",
4213
+ log: "background: #4096ff; color: #FFF;",
4214
+ warn: "background: yellow; color: #FFF;",
4215
+ error: "background: red; color: #FFF;"
4216
+ }, LoggerCls = function() {
4217
+ function LoggerCls(options) {
4218
+ void 0 === options && (options = {}), this._options = {
4219
+ level: "INFO",
4220
+ showTime: false
4221
+ }, this._levelNum = 3, this.info = this._loggerFactory("info", this._levelNum >= 3),
4222
+ this.log = this._loggerFactory("log", this._levelNum >= 2), this.warn = this._loggerFactory("warn", this._levelNum >= 1),
4223
+ this.error = this._loggerFactory("error", this._levelNum >= 0), this.setOptions(options);
4224
+ }
4225
+ var _proto = LoggerCls.prototype;
4226
+ return _proto.setOptions = function(options) {
4227
+ var _this__options_level;
4228
+ this._options = Object.assign({}, this._options, options), this._levelNum = this._matchLevel(null != (_this__options_level = this._options.level) ? _this__options_level : "INFO"),
4229
+ this.info = this._loggerFactory("info", this._levelNum >= 3), this.log = this._loggerFactory("log", this._levelNum >= 2),
4230
+ this.warn = this._loggerFactory("warn", this._levelNum >= 1), this.error = this._loggerFactory("error", this._levelNum >= 0);
4231
+ }, _proto._matchLevel = function(level) {
4232
+ var logLevel = 3;
4233
+ switch (level) {
4234
+ case "INFO":
4235
+ logLevel = 3;
4236
+ break;
4237
+
4238
+ case "LOG":
4239
+ logLevel = 2;
4240
+ break;
4241
+
4242
+ case "WARN":
4243
+ logLevel = 1;
4244
+ break;
4245
+
4246
+ case "ERROR":
4247
+ logLevel = 0;
4248
+ }
4249
+ return logLevel;
4250
+ }, _proto._loggerFactory = function(type, bool) {
4251
+ var fn = console[type];
4252
+ if (bool && fn) {
4253
+ var _fn, args0 = this._options.name ? "%c[" + this._options.name + "]%c %c[" + type.toUpperCase() + "]" : "%c[" + type.toUpperCase() + "]", color = [ this._options.name ? "background: green;color: #fff" : null, this._options.name ? "" : null, _$LoggerStyle$_[type] ].filter(function(color) {
4254
+ return null != color;
4255
+ });
4256
+ return (_fn = fn).bind.apply(_fn, [].concat([ console, args0 ], color));
4257
+ }
4258
+ return LoggerCls.noop;
4259
+ }, _proto.getOptions = function() {
4260
+ return this._options;
4261
+ }, _proto.getVersion = function() {
4262
+ return "2.0.0-beta.1";
4263
+ }, LoggerCls;
4264
+ }();
4265
+
4266
+ function __fillTen__(num) {
4267
+ return (num = +num) < 10 && (num = "0" + num), num + "";
4268
+ }
4269
+
4270
+ LoggerCls.noop = function() {}, LoggerCls.VERSION = "2.0.0-beta.1";
4271
+
4272
+ var __$list$__ = [ "info", "log", "warn", "error" ];
4273
+
4274
+ dist$2 = function(options) {
4275
+ var logger = new LoggerCls(options);
4276
+ return new Proxy(logger, {
4277
+ get: function(target, prop) {
4278
+ if (__$list$__.includes(prop)) {
4279
+ var _target__options;
4280
+ if (null == (_target__options = target._options) ? void 0 : _target__options.showTime) {
4281
+ var time = (now = new Date(Date.now()), year = now.getFullYear(), month = now.getMonth() + 1,
4282
+ day = now.getDate(), hour = now.getHours(), min = now.getMinutes(), sec = now.getSeconds(),
4283
+ ms = now.getMilliseconds(), year + "/" + __fillTen__(month) + "/" + __fillTen__(day) + " " + __fillTen__(hour) + ":" + __fillTen__(min) + ":" + __fillTen__(sec) + ":" + ms);
4284
+ return target[prop].bind(console, "[" + time + "]");
4285
+ }
4286
+ return target[prop].bind(console);
4287
+ }
4288
+ var now, year, month, day, hour, min, sec, ms;
4289
+ return Reflect.get(target, prop);
4290
+ }
4291
+ });
4292
+ };
4293
+ return dist$2;
4294
+ }
4295
+
4296
+ var distExports$1 = requireDist$2();
4297
+ var Logger = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
3952
4298
 
3953
- var zh$1 = {
4299
+ var zh = {
3954
4300
  391001: '取流地址或端口非法',
3955
4301
  395000: '服务内部异常,请稍后重试',
3956
4302
  395400: '预览取流参数异常',
@@ -4220,7 +4566,7 @@
4220
4566
  };
4221
4567
 
4222
4568
  // 不要出现多层的的数据, 数据铺平
4223
- var en$1 = {
4569
+ var en = {
4224
4570
  391001: 'Illegal streaming address or port',
4225
4571
  395000: 'Internal service exception, please try again later',
4226
4572
  395400: 'Preview streaming parameter exception',
@@ -5050,22 +5396,86 @@
5050
5396
  _inherits$j(Content, EventEmitter);
5051
5397
  function Content(options) {
5052
5398
  var _this;
5053
- _this = EventEmitter.call(this) || this;
5399
+ _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0;
5054
5400
  _this.options = options;
5401
+ _this._scaleMode = options.scaleMode || 0;
5055
5402
  _this.$wrapper = document.createElement('div');
5056
5403
  _this.$wrapper.className = "" + PREFIX_CLASS + "-content-wrapper";
5057
5404
  _this.$content = document.createElement('div');
5058
5405
  _this.$content.className = "" + PREFIX_CLASS + "-content";
5406
+ _this.$video = document.createElement('div');
5407
+ _this.$video.className = "" + PREFIX_CLASS + "-content-video";
5408
+ _this.$content.appendChild(_this.$video);
5059
5409
  _this.$wrapper.appendChild(_this.$content);
5060
5410
  if (typeof options.getContainer === 'function') {
5061
5411
  var $popupContainer = options.getContainer();
5062
5412
  $popupContainer.appendChild(_this.$wrapper);
5063
5413
  }
5414
+ _this.on(EVENTS.videoInfo, function(originWidth, originHeight) {
5415
+ _this._rerender(originWidth, originHeight);
5416
+ });
5417
+ _this.on(EVENTS.resize, function() {
5418
+ _this._rerender();
5419
+ });
5064
5420
  return _this;
5065
5421
  }
5066
5422
  var _proto = Content.prototype;
5423
+ /**
5424
+ * 重新画面区域
5425
+ * @param {number} originWidth 画面宽度
5426
+ * @param {number} originHeight 画面高度
5427
+ * @returns {void}
5428
+ */ _proto._rerender = function _rerender(originWidth, originHeight) {
5429
+ if (originWidth === void 0) originWidth = 0;
5430
+ if (originHeight === void 0) originHeight = 0;
5431
+ var width = this.$wrapper.clientWidth;
5432
+ var height = this.$wrapper.clientHeight;
5433
+ if (originWidth > 0 && originHeight > 0) {
5434
+ this._originWidth = originWidth;
5435
+ this._originHeight = originHeight;
5436
+ }
5437
+ // 默认是1
5438
+ // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边
5439
+ var objectFill = 'contain';
5440
+ // 视频画面完全填充canvas区域,画面会被拉伸
5441
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.full) {
5442
+ objectFill = 'fill';
5443
+ }
5444
+ // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
5445
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
5446
+ objectFill = 'cover';
5447
+ }
5448
+ if (width > 0 && height > 0 && this._originWidth > 0 && this._originHeight > 0 && this.$video) {
5449
+ var left = (width - this._originWidth) / 2;
5450
+ var top = (height - this._originHeight) / 2;
5451
+ var wScale = width / this._originWidth;
5452
+ var hScale = height / this._originHeight;
5453
+ var scale = wScale > hScale ? hScale : wScale;
5454
+ //
5455
+ if (!(this._scaleMode === THEME_SCALE_MODE_TYPE.auto)) {
5456
+ if (wScale !== hScale) {
5457
+ scale = wScale + ',' + hScale;
5458
+ }
5459
+ }
5460
+ //
5461
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
5462
+ scale = wScale > hScale ? wScale : hScale;
5463
+ }
5464
+ this.$video.style.cssText += "\n width: " + this._originWidth + "px;\n height: " + this._originHeight + "px;\n position: absolute;\n object-fit:" + objectFill + ";\n left: " + left + "px;\n top: " + top + "px;\n transform-origin: 50% 50%;\n transform: scale(" + scale + ");\n ";
5465
+ }
5466
+ };
5467
+ _proto.setScaleMode = function setScaleMode(scaleMode) {
5468
+ if (scaleMode === void 0) scaleMode = 0;
5469
+ this._scaleMode = scaleMode;
5470
+ this._rerender();
5471
+ };
5067
5472
  _proto.destroy = function destroy() {
5068
5473
  var _this_$wrapper;
5474
+ if (this.$video) {
5475
+ this.$video.remove();
5476
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5477
+ this.$video = null;
5478
+ }
5069
5479
  if (this.$content) {
5070
5480
  this.$content.remove();
5071
5481
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -5080,8 +5490,8 @@
5080
5490
  return Content;
5081
5491
  }(EventEmitter);
5082
5492
 
5083
- function _extends$k() {
5084
- _extends$k = Object.assign || function(target) {
5493
+ function _extends$j() {
5494
+ _extends$j = Object.assign || function(target) {
5085
5495
  for(var i = 1; i < arguments.length; i++){
5086
5496
  var source = arguments[i];
5087
5497
  for(var key in source){
@@ -5092,7 +5502,7 @@
5092
5502
  }
5093
5503
  return target;
5094
5504
  };
5095
- return _extends$k.apply(this, arguments);
5505
+ return _extends$j.apply(this, arguments);
5096
5506
  }
5097
5507
  function _inherits$i(subClass, superClass) {
5098
5508
  if (typeof superClass !== "function" && superClass !== null) {
@@ -5121,7 +5531,7 @@
5121
5531
  _inherits$i(More, Control);
5122
5532
  function More(options) {
5123
5533
  var _this;
5124
- _this = Control.call(this, _extends$k({}, options, {
5534
+ _this = Control.call(this, _extends$j({}, options, {
5125
5535
  tagName: 'span',
5126
5536
  controlType: 'button',
5127
5537
  classNameSuffix: 'more'
@@ -5267,6 +5677,17 @@
5267
5677
  }
5268
5678
  });
5269
5679
  theme == null ? void 0 : theme.on(EVENTS.videoInfo, function(info) {
5680
+ // 排除流信息回调触发的事件
5681
+ if (!!info && info.from !== "setStreamInfoCallBack") {
5682
+ var // rerender 画面
5683
+ _theme_contentControl_emit, _theme_contentControl;
5684
+ (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.videoInfo, info.width, info.height);
5685
+ }
5686
+ });
5687
+ theme == null ? void 0 : theme.on(EVENTS.resize, function() {
5688
+ var // rerender 画面
5689
+ _theme_contentControl_emit, _theme_contentControl;
5690
+ (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.resize);
5270
5691
  });
5271
5692
  theme == null ? void 0 : theme.on('getDeviceInfo', function(info) {
5272
5693
  });
@@ -5581,6 +6002,14 @@
5581
6002
  theme.controls.timeLineControl.on(EVENTS.control.timeLineChange, function(date) {
5582
6003
  theme.emit(EVENTS.control.timeLineChange, date);
5583
6004
  });
6005
+ theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
6006
+ var _theme_controls_dateControl;
6007
+ if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
6008
+ var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
6009
+ (_theme_controls_dateControl1 = theme.controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_dataPickerUtil = _theme_controls_dateControl1.dataPickerUtil) == null ? void 0 : _theme_controls_dateControl_dataPickerUtil.hide();
6010
+ }
6011
+ theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
6012
+ });
5584
6013
  theme.controls.timeLineControl.on(EVENTS.control.timeLineDestroy, function() {
5585
6014
  theme.emit(EVENTS.control.timeLineDestroy);
5586
6015
  });
@@ -5655,12 +6084,12 @@
5655
6084
  * @returns {void}
5656
6085
  */ function _resize(theme, width, height) {
5657
6086
  var cssText = '';
5658
- if (/\d/.test(width + '')) {
6087
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
5659
6088
  cssText += "width: " + width + "px;";
5660
6089
  } else if (width) {
5661
6090
  cssText += "width: " + width + ";";
5662
6091
  }
5663
- if (/\d/.test(height + '')) {
6092
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
5664
6093
  cssText += "height: " + height + "px;";
5665
6094
  } else if (height) {
5666
6095
  cssText += "height: " + height + ";";
@@ -5681,8 +6110,8 @@
5681
6110
  if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
5682
6111
  return Constructor;
5683
6112
  }
5684
- function _extends$j() {
5685
- _extends$j = Object.assign || function(target) {
6113
+ function _extends$i() {
6114
+ _extends$i = Object.assign || function(target) {
5686
6115
  for(var i = 1; i < arguments.length; i++){
5687
6116
  var source = arguments[i];
5688
6117
  for(var key in source){
@@ -5693,7 +6122,7 @@
5693
6122
  }
5694
6123
  return target;
5695
6124
  };
5696
- return _extends$j.apply(this, arguments);
6125
+ return _extends$i.apply(this, arguments);
5697
6126
  }
5698
6127
  function _inherits$h(subClass, superClass) {
5699
6128
  if (typeof superClass !== "function" && superClass !== null) {
@@ -5726,7 +6155,7 @@
5726
6155
  _inherits$h(Zoom, Control);
5727
6156
  function Zoom(options) {
5728
6157
  var _this;
5729
- _this = Control.call(this, _extends$j({}, options, {
6158
+ _this = Control.call(this, _extends$i({}, options, {
5730
6159
  tagName: 'span',
5731
6160
  controlType: 'button',
5732
6161
  classNameSuffix: 'zoom'
@@ -5856,7 +6285,7 @@
5856
6285
 
5857
6286
  /*
5858
6287
  * @ezuikit/control-zoom v0.0.2
5859
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
6288
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
5860
6289
  * Released under the MIT License.
5861
6290
  */
5862
6291
  /**
@@ -6531,8 +6960,8 @@
6531
6960
  }
6532
6961
  Zoom.VERSION = '0.0.2';
6533
6962
 
6534
- function _extends$i() {
6535
- _extends$i = Object.assign || function(target) {
6963
+ function _extends$h() {
6964
+ _extends$h = Object.assign || function(target) {
6536
6965
  for(var i = 1; i < arguments.length; i++){
6537
6966
  var source = arguments[i];
6538
6967
  for(var key in source){
@@ -6543,10 +6972,10 @@
6543
6972
  }
6544
6973
  return target;
6545
6974
  };
6546
- return _extends$i.apply(this, arguments);
6975
+ return _extends$h.apply(this, arguments);
6547
6976
  }
6548
6977
  function __zoom(theme, container, options) {
6549
- theme.zoomUtil = new Zoom(container, _extends$i({}, options || {}, {
6978
+ theme.zoomUtil = new Zoom(container, _extends$h({}, options || {}, {
6550
6979
  min: 1,
6551
6980
  onChange: function(zoom, reset) {
6552
6981
  if (zoom !== theme._zoom) {
@@ -6771,8 +7200,8 @@
6771
7200
  });
6772
7201
  };
6773
7202
  }
6774
- function _extends$h() {
6775
- _extends$h = Object.assign || function(target) {
7203
+ function _extends$g() {
7204
+ _extends$g = Object.assign || function(target) {
6776
7205
  for(var i = 1; i < arguments.length; i++){
6777
7206
  var source = arguments[i];
6778
7207
  for(var key in source){
@@ -6783,7 +7212,7 @@
6783
7212
  }
6784
7213
  return target;
6785
7214
  };
6786
- return _extends$h.apply(this, arguments);
7215
+ return _extends$g.apply(this, arguments);
6787
7216
  }
6788
7217
  function _ts_generator$3(thisArg, body) {
6789
7218
  var f, y, t, _ = {
@@ -6911,7 +7340,7 @@
6911
7340
  }
6912
7341
  if (item.isrender === 1 && REC_GROUP.includes(item.iconId)) {
6913
7342
  // TODO: 因为回放是一组, 位置以第一个位置为准
6914
- recControls.push(recControls[0] ? _extends$h({}, item, {
7343
+ recControls.push(recControls[0] ? _extends$g({}, item, {
6915
7344
  part: recControls[0].part
6916
7345
  }) : item);
6917
7346
  return false;
@@ -6934,7 +7363,7 @@
6934
7363
  }
6935
7364
  if (item.isrender === 1 && REC_GROUP.includes(item.iconId)) {
6936
7365
  // TODO: 因为回放是一组, 位置以第一个位置为准
6937
- recControls.push(recControls[0] ? _extends$h({}, item, {
7366
+ recControls.push(recControls[0] ? _extends$g({}, item, {
6938
7367
  part: recControls[0].part
6939
7368
  }) : item);
6940
7369
  return false;
@@ -7189,8 +7618,8 @@
7189
7618
  return Component;
7190
7619
  }();
7191
7620
 
7192
- function _extends$g() {
7193
- _extends$g = Object.assign || function(target) {
7621
+ function _extends$f() {
7622
+ _extends$f = Object.assign || function(target) {
7194
7623
  for(var i = 1; i < arguments.length; i++){
7195
7624
  var source = arguments[i];
7196
7625
  for(var key in source){
@@ -7201,7 +7630,7 @@
7201
7630
  }
7202
7631
  return target;
7203
7632
  };
7204
- return _extends$g.apply(this, arguments);
7633
+ return _extends$f.apply(this, arguments);
7205
7634
  }
7206
7635
  function _inherits$g(subClass, superClass) {
7207
7636
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7227,15 +7656,15 @@
7227
7656
  _inherits$g(Footer, Component);
7228
7657
  function Footer(options) {
7229
7658
  if (options === void 0) options = {};
7230
- return Component.call(this, _extends$g({}, options, {
7659
+ return Component.call(this, _extends$f({}, options, {
7231
7660
  cType: 'footer'
7232
7661
  })) || this;
7233
7662
  }
7234
7663
  return Footer;
7235
7664
  }(Component);
7236
7665
 
7237
- function _extends$f() {
7238
- _extends$f = Object.assign || function(target) {
7666
+ function _extends$e() {
7667
+ _extends$e = Object.assign || function(target) {
7239
7668
  for(var i = 1; i < arguments.length; i++){
7240
7669
  var source = arguments[i];
7241
7670
  for(var key in source){
@@ -7246,7 +7675,7 @@
7246
7675
  }
7247
7676
  return target;
7248
7677
  };
7249
- return _extends$f.apply(this, arguments);
7678
+ return _extends$e.apply(this, arguments);
7250
7679
  }
7251
7680
  function _inherits$f(subClass, superClass) {
7252
7681
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7272,7 +7701,7 @@
7272
7701
  _inherits$f(Header, Component);
7273
7702
  function Header(options) {
7274
7703
  if (options === void 0) options = {};
7275
- return Component.call(this, _extends$f({}, options, {
7704
+ return Component.call(this, _extends$e({}, options, {
7276
7705
  cType: 'header'
7277
7706
  })) || this;
7278
7707
  }
@@ -7438,8 +7867,8 @@
7438
7867
  };
7439
7868
  }
7440
7869
 
7441
- function _extends$e() {
7442
- _extends$e = Object.assign || function(target) {
7870
+ function _extends$d() {
7871
+ _extends$d = Object.assign || function(target) {
7443
7872
  for(var i = 1; i < arguments.length; i++){
7444
7873
  var source = arguments[i];
7445
7874
  for(var key in source){
@@ -7450,7 +7879,7 @@
7450
7879
  }
7451
7880
  return target;
7452
7881
  };
7453
- return _extends$e.apply(this, arguments);
7882
+ return _extends$d.apply(this, arguments);
7454
7883
  }
7455
7884
  function _inherits$e(subClass, superClass) {
7456
7885
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7479,7 +7908,7 @@
7479
7908
  */ var GlobalFullscreen = /*#__PURE__*/ function(Fullscreen) {
7480
7909
  _inherits$e(GlobalFullscreen, Fullscreen);
7481
7910
  function GlobalFullscreen(options) {
7482
- return Fullscreen.call(this, _extends$e({}, options, {
7911
+ return Fullscreen.call(this, _extends$d({}, options, {
7483
7912
  controlType: 'button',
7484
7913
  classNameSuffix: 'global-fullscreen'
7485
7914
  })) || this;
@@ -7510,8 +7939,8 @@
7510
7939
  return GlobalFullscreen;
7511
7940
  }(Fullscreen);
7512
7941
 
7513
- function _extends$d() {
7514
- _extends$d = Object.assign || function(target) {
7942
+ function _extends$c() {
7943
+ _extends$c = Object.assign || function(target) {
7515
7944
  for(var i = 1; i < arguments.length; i++){
7516
7945
  var source = arguments[i];
7517
7946
  for(var key in source){
@@ -7522,7 +7951,7 @@
7522
7951
  }
7523
7952
  return target;
7524
7953
  };
7525
- return _extends$d.apply(this, arguments);
7954
+ return _extends$c.apply(this, arguments);
7526
7955
  }
7527
7956
  function _inherits$d(subClass, superClass) {
7528
7957
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7551,7 +7980,7 @@
7551
7980
  _inherits$d(CapturePicture, Control);
7552
7981
  function CapturePicture(options) {
7553
7982
  var _this;
7554
- _this = Control.call(this, _extends$d({}, options, {
7983
+ _this = Control.call(this, _extends$c({}, options, {
7555
7984
  tagName: 'span',
7556
7985
  classNameSuffix: 'capture-picture'
7557
7986
  })) || this, _this._timer = null;
@@ -7604,17 +8033,9 @@
7604
8033
  return CapturePicture;
7605
8034
  }(Control);
7606
8035
 
7607
- /*
7608
- * @ezuikit/utils-tools v1.1.0
7609
- * tools utils
7610
- * Copyright (c) 2025-08-29 Ezviz-OpenBiz
7611
- * Released under the MIT License.
7612
- */
7613
- function isMobile(agent){var _navigator,_navigator1,_navigator2;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1}
7614
-
7615
8036
  /*
7616
8037
  * @ezuikit/control-ptz v0.0.1
7617
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
8038
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
7618
8039
  * Released under the MIT License.
7619
8040
  */
7620
8041
 
@@ -7783,11 +8204,11 @@
7783
8204
  $icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
7784
8205
  }
7785
8206
  }
7786
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
8207
+ $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
7787
8208
  if (type === 'stop') {
7788
8209
  var _this_options_env1;
7789
8210
  url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
7790
- $warp.style.cssText = '';
8211
+ $warp.style = '';
7791
8212
  $icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
7792
8213
  $icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
7793
8214
  $icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
@@ -7831,14 +8252,11 @@
7831
8252
  60003,
7832
8253
  60004
7833
8254
  ].includes(+rt.code)) {
7834
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
8255
+ $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
7835
8256
  }
7836
8257
  }
7837
8258
  operationResultCb == null ? void 0 : operationResultCb(rt);
7838
8259
  }).catch((err)=>{
7839
- }).finally(()=>{
7840
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7841
- operationResultCb = null;
7842
8260
  });
7843
8261
  }
7844
8262
  constructor(container, options){
@@ -8154,7 +8572,7 @@
8154
8572
  }
8155
8573
  }
8156
8574
  constructor(container, options = {}){
8157
- super(container, options), this._isMobile = isMobile(), this._isRotate = false, this._clearTimer = null;
8575
+ super(container, options), this._isMobile = distExports$3.isMobile(), this._isRotate = false, this._clearTimer = null;
8158
8576
  this._$wrapper = document.createElement('div');
8159
8577
  this._$wrapper.className = PTZ_PREFIX + '-container-wrap';
8160
8578
  this._$directionCircleContainer = document.createElement('div');
@@ -8390,8 +8808,8 @@
8390
8808
  if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
8391
8809
  return Constructor;
8392
8810
  }
8393
- function _extends$c() {
8394
- _extends$c = Object.assign || function(target) {
8811
+ function _extends$b() {
8812
+ _extends$b = Object.assign || function(target) {
8395
8813
  for(var i = 1; i < arguments.length; i++){
8396
8814
  var source = arguments[i];
8397
8815
  for(var key in source){
@@ -8402,7 +8820,7 @@
8402
8820
  }
8403
8821
  return target;
8404
8822
  };
8405
- return _extends$c.apply(this, arguments);
8823
+ return _extends$b.apply(this, arguments);
8406
8824
  }
8407
8825
  function _inherits$c(subClass, superClass) {
8408
8826
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8431,7 +8849,7 @@
8431
8849
  _inherits$c(Ptz, Control);
8432
8850
  function Ptz(options) {
8433
8851
  var _this;
8434
- _this = Control.call(this, _extends$c({}, options, {
8852
+ _this = Control.call(this, _extends$b({}, options, {
8435
8853
  tagName: 'span',
8436
8854
  controlType: 'button',
8437
8855
  classNameSuffix: 'ptz'
@@ -8474,7 +8892,7 @@
8474
8892
  this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
8475
8893
  this.$panel.appendChild(this.$turntable);
8476
8894
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8477
- this._ptzControl = new Ptz$1(this.$turntable, _extends$c({}, this._options, {
8895
+ this._ptzControl = new Ptz$1(this.$turntable, _extends$b({}, this._options, {
8478
8896
  onSpeedChange: this._onSpeedChange.bind(this),
8479
8897
  onDirection: this._onDirection.bind(this)
8480
8898
  }));
@@ -8483,7 +8901,7 @@
8483
8901
  };
8484
8902
  _proto.renderMobileExtend = function renderMobileExtend($container) {
8485
8903
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8486
- if (!this._ptzControl1) this._ptzControl1 = new MobilePtz($container, _extends$c({}, this._options, {
8904
+ if (!this._ptzControl1) this._ptzControl1 = new MobilePtz($container, _extends$b({}, this._options, {
8487
8905
  onSpeedChange: this._onSpeedChange.bind(this),
8488
8906
  onDirection: this._onDirection.bind(this)
8489
8907
  }));
@@ -8586,8 +9004,8 @@
8586
9004
  if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
8587
9005
  return Constructor;
8588
9006
  }
8589
- function _extends$b() {
8590
- _extends$b = Object.assign || function(target) {
9007
+ function _extends$a() {
9008
+ _extends$a = Object.assign || function(target) {
8591
9009
  for(var i = 1; i < arguments.length; i++){
8592
9010
  var source = arguments[i];
8593
9011
  for(var key in source){
@@ -8598,7 +9016,7 @@
8598
9016
  }
8599
9017
  return target;
8600
9018
  };
8601
- return _extends$b.apply(this, arguments);
9019
+ return _extends$a.apply(this, arguments);
8602
9020
  }
8603
9021
  function _inherits$b(subClass, superClass) {
8604
9022
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8635,7 +9053,7 @@
8635
9053
  _inherits$b(Record, Control);
8636
9054
  function Record(options) {
8637
9055
  var _this;
8638
- _this = Control.call(this, _extends$b({}, options, {
9056
+ _this = Control.call(this, _extends$a({}, options, {
8639
9057
  tagName: 'span',
8640
9058
  controlType: 'button',
8641
9059
  classNameSuffix: 'record'
@@ -8776,8 +9194,8 @@
8776
9194
  if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
8777
9195
  return Constructor;
8778
9196
  }
8779
- function _extends$a() {
8780
- _extends$a = Object.assign || function(target) {
9197
+ function _extends$9() {
9198
+ _extends$9 = Object.assign || function(target) {
8781
9199
  for(var i = 1; i < arguments.length; i++){
8782
9200
  var source = arguments[i];
8783
9201
  for(var key in source){
@@ -8788,7 +9206,7 @@
8788
9206
  }
8789
9207
  return target;
8790
9208
  };
8791
- return _extends$a.apply(this, arguments);
9209
+ return _extends$9.apply(this, arguments);
8792
9210
  }
8793
9211
  function _inherits$a(subClass, superClass) {
8794
9212
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8913,7 +9331,7 @@
8913
9331
  _inherits$a(Talk, Control);
8914
9332
  function Talk(options) {
8915
9333
  var _this;
8916
- _this = Control.call(this, _extends$a({}, options, {
9334
+ _this = Control.call(this, _extends$9({}, options, {
8917
9335
  tagName: 'span',
8918
9336
  controlType: 'button',
8919
9337
  classNameSuffix: 'talk'
@@ -9030,8 +9448,8 @@
9030
9448
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
9031
9449
  return Constructor;
9032
9450
  }
9033
- function _extends$9() {
9034
- _extends$9 = Object.assign || function(target) {
9451
+ function _extends$8() {
9452
+ _extends$8 = Object.assign || function(target) {
9035
9453
  for(var i = 1; i < arguments.length; i++){
9036
9454
  var source = arguments[i];
9037
9455
  for(var key in source){
@@ -9042,7 +9460,7 @@
9042
9460
  }
9043
9461
  return target;
9044
9462
  };
9045
- return _extends$9.apply(this, arguments);
9463
+ return _extends$8.apply(this, arguments);
9046
9464
  }
9047
9465
  function _inherits$9(subClass, superClass) {
9048
9466
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9128,7 +9546,7 @@
9128
9546
  function Select(options) {
9129
9547
  var _this;
9130
9548
  var _this__options_fieldNames, _this__picker_$body;
9131
- _this = Control.call(this, _extends$9({
9549
+ _this = Control.call(this, _extends$8({
9132
9550
  tagName: 'span',
9133
9551
  type: 'button',
9134
9552
  controlType: 'button'
@@ -9326,8 +9744,8 @@
9326
9744
  }
9327
9745
  return self;
9328
9746
  }
9329
- function _extends$8() {
9330
- _extends$8 = Object.assign || function(target) {
9747
+ function _extends$7() {
9748
+ _extends$7 = Object.assign || function(target) {
9331
9749
  for(var i = 1; i < arguments.length; i++){
9332
9750
  var source = arguments[i];
9333
9751
  for(var key in source){
@@ -9338,7 +9756,7 @@
9338
9756
  }
9339
9757
  return target;
9340
9758
  };
9341
- return _extends$8.apply(this, arguments);
9759
+ return _extends$7.apply(this, arguments);
9342
9760
  }
9343
9761
  function _inherits$8(subClass, superClass) {
9344
9762
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9413,7 +9831,7 @@
9413
9831
  if (options === void 0) options = {};
9414
9832
  var _this;
9415
9833
  var _options_props, _options_props1, _options_locales_options_language;
9416
- _this = Select.call(this, _extends$8({}, DEFINITION_DEFAULT_OPTIONS, {
9834
+ _this = Select.call(this, _extends$7({}, DEFINITION_DEFAULT_OPTIONS, {
9417
9835
  value: (_options_props = options.props) == null ? void 0 : _options_props.videoLevel
9418
9836
  }, options, {
9419
9837
  fieldNames: {
@@ -9425,14 +9843,16 @@
9425
9843
  controlType: 'button',
9426
9844
  classNameSuffix: 'definition',
9427
9845
  renderLabel: function(label, item, list) {
9846
+ var _list_;
9428
9847
  if ((item == null ? void 0 : item.level) === 'auto') {
9429
9848
  var _options_locales_options_language;
9430
- var realIitem = list.find(function(it) {
9849
+ var realItem = list.find(function(it) {
9431
9850
  return it.level === _assert_this_initialized$1(_this)._level;
9432
9851
  });
9433
- return "<span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realIitem == null ? void 0 : realIitem.name) || '') + ")</span>";
9852
+ return "<span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realItem == null ? void 0 : realItem.name) || '') + ")</span>";
9434
9853
  }
9435
- return "<span>" + label + "</span>";
9854
+ // 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
9855
+ return "<span>" + (label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || '') + "</span>";
9436
9856
  },
9437
9857
  onChange: function(value, item) {
9438
9858
  var _options_onChange;
@@ -9459,10 +9879,10 @@
9459
9879
  _this._level = realLevel + '';
9460
9880
  if (l === 'auto') {
9461
9881
  var _options_locales_options_language;
9462
- var realIitem = _this.list.find(function(it) {
9882
+ var realItem = _this.list.find(function(it) {
9463
9883
  return it.level === _this._level;
9464
9884
  });
9465
- _this.$container.querySelector("." + PREFIX_CLASS + "-select-btn").innerHTML = "\n <span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realIitem == null ? void 0 : realIitem.name) || '') + ")</span>\n ";
9885
+ _this.$container.querySelector("." + PREFIX_CLASS + "-select-btn").innerHTML = "\n <span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realItem == null ? void 0 : realItem.name) || '') + ")</span>\n ";
9466
9886
  } else {
9467
9887
  if (_this.value !== _this._level + '') _this.value = _this._level + '';
9468
9888
  }
@@ -9485,8 +9905,8 @@
9485
9905
  }
9486
9906
  return self;
9487
9907
  }
9488
- function _extends$7() {
9489
- _extends$7 = Object.assign || function(target) {
9908
+ function _extends$6() {
9909
+ _extends$6 = Object.assign || function(target) {
9490
9910
  for(var i = 1; i < arguments.length; i++){
9491
9911
  var source = arguments[i];
9492
9912
  for(var key in source){
@@ -9497,7 +9917,7 @@
9497
9917
  }
9498
9918
  return target;
9499
9919
  };
9500
- return _extends$7.apply(this, arguments);
9920
+ return _extends$6.apply(this, arguments);
9501
9921
  }
9502
9922
  function _inherits$7(subClass, superClass) {
9503
9923
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9553,7 +9973,7 @@
9553
9973
  function Speed(options) {
9554
9974
  var _this;
9555
9975
  var _options_locales_options_language, _options_locales;
9556
- _this = Select.call(this, _extends$7({}, SPEED_DEFAULT_OPTIONS, options, {
9976
+ _this = Select.call(this, _extends$6({}, SPEED_DEFAULT_OPTIONS, options, {
9557
9977
  value: (options.props.speed || 1) + '',
9558
9978
  classNameSuffix: 'speed',
9559
9979
  controlType: 'button',
@@ -9586,7 +10006,7 @@
9586
10006
 
9587
10007
  /*
9588
10008
  * @ezuikit/control-date-picker v0.0.1
9589
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
10009
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
9590
10010
  * Released under the MIT License.
9591
10011
  */
9592
10012
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
@@ -9681,7 +10101,7 @@
9681
10101
  };
9682
10102
  /**
9683
10103
  * 日期选择器
9684
- */ let DatePicker$1 = class DatePicker {
10104
+ */ class DatePicker {
9685
10105
  _init() {
9686
10106
  // 因为挂载在行内,需要父标签设置 position: relative;
9687
10107
  this.$container.style.cssText += `;position: relative;`;
@@ -9809,7 +10229,7 @@
9809
10229
  }
9810
10230
  });
9811
10231
  }
9812
- };
10232
+ }
9813
10233
 
9814
10234
  /**
9815
10235
  * @description 时间操作
@@ -9958,8 +10378,8 @@
9958
10378
  return DateTime;
9959
10379
  }();
9960
10380
 
9961
- function _extends$6() {
9962
- _extends$6 = Object.assign || function(target) {
10381
+ function _extends$5() {
10382
+ _extends$5 = Object.assign || function(target) {
9963
10383
  for(var i = 1; i < arguments.length; i++){
9964
10384
  var source = arguments[i];
9965
10385
  for(var key in source){
@@ -9970,7 +10390,7 @@
9970
10390
  }
9971
10391
  return target;
9972
10392
  };
9973
- return _extends$6.apply(this, arguments);
10393
+ return _extends$5.apply(this, arguments);
9974
10394
  }
9975
10395
  function _inherits$6(subClass, superClass) {
9976
10396
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9995,12 +10415,12 @@
9995
10415
  /**
9996
10416
  * 日历选择器控件
9997
10417
  * @category Control
9998
- */ var DatePicker = /*#__PURE__*/ function(Control) {
9999
- _inherits$6(DatePicker, Control);
10000
- function DatePicker(options) {
10418
+ */ var DatePickerControl = /*#__PURE__*/ function(Control) {
10419
+ _inherits$6(DatePickerControl, Control);
10420
+ function DatePickerControl(options) {
10001
10421
  var _this;
10002
10422
  var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
10003
- _this = Control.call(this, _extends$6({}, options, {
10423
+ _this = Control.call(this, _extends$5({}, options, {
10004
10424
  tagName: 'span',
10005
10425
  controlType: 'button',
10006
10426
  classNameSuffix: 'date'
@@ -10010,10 +10430,10 @@
10010
10430
  _this._render();
10011
10431
  return _this;
10012
10432
  }
10013
- var _proto = DatePicker.prototype;
10433
+ var _proto = DatePickerControl.prototype;
10014
10434
  _proto._render = function _render() {
10015
10435
  var _this = this;
10016
- if (isMobile$1()) {
10436
+ if (distExports$3.isMobile()) {
10017
10437
  var _this_locale;
10018
10438
  this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
10019
10439
  } else {
@@ -10022,12 +10442,12 @@
10022
10442
  title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
10023
10443
  });
10024
10444
  }
10025
- this.dataPickerUtil = new DatePicker$1(this.$container, {
10445
+ this.dataPickerUtil = new DatePicker(this.$container, {
10026
10446
  staticPath: this.options.staticPath,
10027
10447
  language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
10028
10448
  current: new Date(this._value + ' 00:00:00'),
10029
10449
  maxDate: this.options.maxDate || new Date(),
10030
- place: isMobile$1() ? 'bottom-left' : 'top-right',
10450
+ place: distExports$3.isMobile() ? 'bottom-left' : 'top-right',
10031
10451
  onChange: function(date) {
10032
10452
  if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
10033
10453
  _this._value = DateTime.formate(date, 'YYYY-MM-DD');
@@ -10082,584 +10502,1006 @@
10082
10502
  */ _proto._onControlClick = function _onControlClick(e) {
10083
10503
  Control.prototype._onControlClick.call(this, e);
10084
10504
  };
10085
- return DatePicker;
10505
+ return DatePickerControl;
10086
10506
  }(Control);
10087
10507
 
10088
- /*
10089
- * @ezuikit/control-time-line v1.0.0-beta.2
10090
- * Copyright (c) 2025-10-27 Ezviz-OpenBiz
10091
- * Released under the MIT License.
10092
- */
10093
- var zh={title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"};var en={title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"};const BASE_TIME_LINE_DEFAULT_OPTIONS={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
10094
- // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
10095
- timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
10096
- onChange:()=>{},onDragStart:()=>{},onDragging:()=>{},onDragEnd:()=>{},onDestroy:()=>{}};
10097
- /**
10098
- * 时间轴基类
10099
- * @internal
10100
- */class BaseTimeLine{
10101
- /**
10102
- * 当前时间
10103
- */
10104
- get current(){return this._current}
10105
- /**
10106
- * 当前时间
10107
- */set current(current){this._current=current;}set readOnly(readOnly){if(this._readOnly!==readOnly){this._readOnly=readOnly;this.$container.style.cursor=readOnly?"not-allowed":"pointer";}}
10108
- /**
10109
- * 只读状态
10110
- */get readOnly(){return this._readOnly}
10111
- /**
10112
- *
10113
- */get timeSections(){return this._timeSections}
10114
- /**
10115
- * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
10116
- * @param readOnly - 只读或取消只读
10117
- * @returns
10118
- */setReadOnly(readOnly){this.readOnly=readOnly;}
10119
- /**
10120
- * 更新当前时间
10121
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10122
- */update(current){this._current=current;}
10123
- /**
10124
- * 更新时间片段
10125
- * @param timeSections 片段数据
10126
- */updateTimeSections(timeSections){if(timeSections&&Array.isArray(timeSections))this._timeSections=timeSections;}
10127
- /**
10128
- * 获取 TimeLine 的宽度
10129
- * @returns
10130
- */get width(){return this._width}
10131
- /**
10132
- * 获取 TimeLine 的高度
10133
- */get height(){return this._height}
10134
- /**
10135
- * 重置尺寸
10136
- */resize(width,height){this._resize(width,height);}_resize(width,height){let cssText="";if(/\d/.test(width+""))cssText+=`width: ${width}px;`;else if(width)cssText+=`width: ${width};`;if(/\d/.test(height+""))cssText+=`height: ${height}px;`;else if(height)cssText+=`height: ${height};`;if(this.$container)this.$container.style.cssText+=cssText;this._width=Math.floor(this.$container.clientWidth);this._height=Math.floor(this.$container.clientHeight);}get timeWidth(){return this._timeWidth}
10137
- /**
10138
- * 改变时间轴刻度
10139
- * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
10140
- * PC间距:
10141
- * @param timeWidth 时间轴刻度
10142
- */setTimeWidth(timeWidth){if([0,1,2,3,4,5].includes(timeWidth))this._timeWidth=timeWidth;}
10143
- /**
10144
- * 销毁
10145
- */destroy(){
10146
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10147
- this._current=null;this.options.onDestroy==null?void 0:this.options.onDestroy.call(this.options);this._timeSections=[];this._readOnly=false;this._destroyed=true;}constructor(container,options){this._current=new Date;
10148
- /** 只读 */this._readOnly=false;this._width=0;this._height=0;this._destroyed=false;this._timeWidth=0;
10149
- /** 片段列表 */this._timeSections=[];this.$container=container;this.options=deepmerge(BASE_TIME_LINE_DEFAULT_OPTIONS,options,{clone:false});if(this.options.timeSections&&Array.isArray(this.options.timeSections))this._timeSections=this.options.timeSections;if(this.options.readOnly)this.readOnly=this.options.readOnly;if(this.options.className)this.$container.classList.add(this.options.className);if(this.options.current&&this.options.current instanceof Date)this._current=this.options.current||new Date;
10150
- // prettier-ignore
10151
- this.i18n=new I18n(deepmerge({zh:zh,en:en},this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"});this._timeWidth=this.options.timeWidth||0;this._resize(this.options.width||"100%",this.options.height);}}
10152
- /**
10153
- * 时间轴工具类
10154
- */class TimeLineUtil{
10155
- /**
10156
- * 时间转成日期
10157
- * @param time 时间 (秒, 毫秒, 日期字符串, Date)
10158
- * @returns 日期
10159
- */
10160
- static toDate(time){let date=null;if(typeof time==="string"&&time.includes(":"))date=new Date(time);else if((typeof time==="string"||typeof time==="number")&&/\d/.test(time+"")&&(time+"").length===10)date=new Date(+time*1e3);else if((typeof time==="string"||typeof time==="number")&&/\d/.test(time+"")&&(time+"").length===13)date=new Date(+time);else if(time instanceof Date)date=time;return date}
10161
- /**
10162
- * 时间转成 HH:mm:ss
10163
- * @param time 时间
10164
- * @returns
10165
- */static formatDateToHHmmss(time){const date=TimeLineUtil.toDate(time);if(date){const h=date.getHours();// 返回日期中的小时数(0到23)
10166
- const m=date.getMinutes();// 返回日期中的分钟数(0到59)
10167
- const s=date.getSeconds();// 返回日期中的秒数(0到59)
10168
- return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"}
10169
- /**
10170
- * 十位补充 0
10171
- * @param m 数字
10172
- * @returns 十位补充 0后的结果字符串
10173
- */static subTime(m){return +m>9?m+"":"0"+m}
10174
- /**
10175
- * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
10176
- * @param time 时间
10177
- * @param fmt 时间格式
10178
- * @returns
10179
- */static tranTime(time,fmt="YYYY-MM-DD HH:mm:ss"){const newDate=TimeLineUtil.toDate(time);if(newDate){if(fmt==="YYYY-MM-DD")return newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate());else if(fmt==="HH:mm:ss")return TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds());else if(fmt==="HH")return TimeLineUtil.subTime(newDate.getHours());else if(fmt==="mm:ss")return TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds());else if(fmt==="HH:mm")return TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes());else if(fmt==="YYYYMMDDTHHmmssZ")return newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z";
10180
- // prettier-ignore
10181
- return newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds())}return ""}
10182
- /**
10183
- * 时间转成秒
10184
- * @param time
10185
- * @returns
10186
- */static timeToSecond(time){const e=time.split(":");const h=Number(e[0]);const m=Number(e[1]);const s=Number(e[2]);return h*60*60+m*60+(s||0)}
10187
- /**
10188
- * 分钟转成 HH:mm
10189
- * @param minute
10190
- * @returns
10191
- */static minuteToTime(minute){const hour=Math.floor(minute/60);const m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)}
10192
- /**
10193
- * 时间转成分钟
10194
- * @param time
10195
- * @returns
10196
- */static timeToMinute(time){const e=time.split(":");const h=Number(e[0]);const m=Number(e[1]);
10197
- // const s = Number(e[2]);
10198
- return h*60+m}
10199
- /**
10200
- * @description 判读两个区间是否重叠
10201
- * @param {number} a_start 一个区间的开始
10202
- * @param {number} a_end 一个区间的结束
10203
- * @param {number} b_start 另一个区间的开始
10204
- * @param {number} b_end 另一个区间的结束
10205
- * @returns {boolean}
10206
- */static isOverlap(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)}static tranTimeToString(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1;const secondNum=Math.floor(((_TimeLineUtil_toDate=TimeLineUtil.toDate(end))==null?void 0:_TimeLineUtil_toDate.getTime())-((_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))==null?void 0:_TimeLineUtil_toDate1.getTime()))/1e3;const second=secondNum%60;const minute=Math.floor(secondNum/60);return `${minute>0?TimeLineUtil.subTime(minute)+"'":""}${TimeLineUtil.subTime(second)}''`}}const Icons={tip:`<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>`,plus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,minus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,close:`\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n `,pause:`<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n `};
10508
+ var dist$1 = {exports: {}};
10509
+
10207
10510
  /**
10208
- * 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 说明]
10209
- * 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0, 这样 0 点刻度才能正确显示
10511
+ * drag scroll support move and touch
10512
+ *
10513
+ * @skax/drag-scroll v1.1.0
10514
+ * Copyright (c) 2025-11-08 ShineShao <xiaoshaoqq@gmail.com>
10515
+ *
10516
+ * This source code is licensed under the MIT license found in the
10517
+ * LICENSE file in the root directory of this source tree.
10210
10518
  */
10211
- /**
10212
- * 时间刻度宽度, 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0
10213
- */const TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]];
10214
- /**
10215
- * 时间刻度宽度, 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0
10216
- * // * 0: 1分钟,
10217
- // * 1: 10分钟
10218
- // * 2: 半小时
10219
- // * 3: 1小时
10220
- // * 4: 2小时
10221
- // * 5: 4小时
10222
- */const MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];
10223
- /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable eqeqeq */ /* eslint-disable no-unneeded-ternary */ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/prefer-includes */function _extends$1$1(){_extends$1$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$1$1.apply(this,arguments)}
10224
- /**
10225
- * 时间轴样式类前缀
10226
- */const MOBILE_TIMELINE_PREFIX="ez-time-line";const MOBILE_TIME_LINE_DEFAULT_OPTIONS=Object.assign({},BASE_TIME_LINE_DEFAULT_OPTIONS,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
10227
- /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
10228
- /** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true});class MobileTimeLine extends BaseTimeLine{
10229
- /**
10230
- * 更新状态
10231
- * @param obj
10232
- */
10233
- setState(obj){
10234
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10235
- Object.keys(obj).forEach(key=>{this.state[key]=obj[key];if(key==="scrollTop"&&this._$itemList)
10236
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10237
- this._$itemContainer.scrollTo(0,obj[key]);if(key==="current"&&this._$currentTime&&obj[key]){var _this_timeSections_;this._$currentTime.querySelector(`.${MOBILE_TIMELINE_PREFIX}-current-value`).innerHTML=obj[key];console.log("current",obj[key]);this.current=new Date(TimeLineUtil.tranTime((_this_timeSections_=this.timeSections[0])==null?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]);}});}
10238
- /**
10239
- * 设置只读或取消只读
10240
- * @param readOnly - 只读或取消只读
10241
- * @returns
10242
- */setReadOnly(readOnly){super.setReadOnly(readOnly);if(this._$itemList)this._$itemContainer.style.overflowY=readOnly?"hidden":"scroll";}
10243
- /**
10244
- * 改变时间轴刻度
10245
- * 0: 1分钟,
10246
- * 1: 10分钟
10247
- * 2: 半小时
10248
- * 3: 1小时
10249
- * 4: 2小时
10250
- * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
10251
- */setTimeWidth(timeWidth){if(MOBILE_TIME_WIDTH[timeWidth]){super.setTimeWidth(timeWidth);this._matchTimeDot();}else console.warn(`scale ${timeWidth} not exist!`);}
10252
- /**
10253
- * 获取真实时间刻度(时间单位 分钟)
10254
- */get _scaleWidth(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}
10255
- /**
10256
- * 更新片段数组
10257
- * @param timeSections
10258
- * @param defaultIndex
10259
- */updateTimeSections(timeSections,defaultIndex){super.updateTimeSections(timeSections);const list=timeSections.map(record=>_extends$1$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)}));if(list.length>0){if(typeof defaultIndex==="undefined")defaultIndex=list.length-1;// 默认选中最后一个片段位置
10260
- // 若current不为0,则不重置current,避免拖动后时间轴回弹
10261
- const{current:current}=this.state;this.setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:current===0?list[defaultIndex].startTime:current});this._matchTimeDot();this._primaryOffsetH();}else {this.setState({availTimeLine:[]});this._matchTimeDot();}this._renderPickerContent();}
10262
- /**
10263
- * 更新当前时间
10264
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10265
- */update(time){if(time&&!this._isTouchStart){this.setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")});this._currentOffsetH();}}
10266
- /**
10267
- * 销毁
10268
- */destroy(){if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}if(this._$currentTime){this.$container.removeChild(this._$currentTime);this._$currentTime=null;}if(this._$itemContainer&&this._$itemList){this._$itemContainer.removeChild(this._$itemList);this._$itemList=null;}if(this._$itemContainer){this.$container.removeChild(this._$itemContainer);this._$itemContainer=null;}if(this._$op){this.$container.removeChild(this._$op);this._$op=null;}if(this._picker){this._picker.destroy();this._picker=null;}this._removeEventListener();super.destroy();}
10269
- /**
10270
- * 渲染时间轴刻度数组
10271
- */_matchTimeDot(){const scaleWidth=this._scaleWidth;// 时间单位 分钟
10272
- const timeArr=[];
10273
- // 时间转分钟
10274
- let minute=TimeLineUtil.timeToMinute("24:00:00");minute=Math.floor(minute/scaleWidth)*scaleWidth;for(let i=minute;i>=0;){let marginTop=0;let marginBottom=0;
10275
- // 视频片段
10276
- if(i==minute)marginTop=70;if(i==0)marginBottom=this.$container.clientHeight-70;const time=TimeLineUtil.minuteToTime(i);const startSecond=TimeLineUtil.timeToSecond(time+":00");const endSecond=TimeLineUtil.timeToSecond(time+":00")+scaleWidth*60;const coverList=this.timeSections.filter(item=>{const start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return start>=startSecond&&start<endSecond});timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:coverList});i-=scaleWidth;}this.setState({timeArr:timeArr});this._matchRecTimeDot();}_matchRecTimeDot(){const{availTimeLine:availTimeLine,timeArr:timeArr}=this.state;const scaleWidth=this._scaleWidth;const len=availTimeLine.length;if(len===0)for(let j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(let k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(let i=0;i<len;i++){const temp=availTimeLine[i];const st=TimeLineUtil.timeToSecond(temp.startTime);// "00:01:00" -> 60 // 秒
10277
- const et=TimeLineUtil.timeToSecond(temp.endTime);let stAvailPercent=0;let etAvailPercent=0;const stMinute=Math.floor(st/(scaleWidth*60))*scaleWidth;stAvailPercent=(st-stMinute*60)/scaleWidth;const etMinute=Math.floor(et/(scaleWidth*60))*scaleWidth;etAvailPercent=(et-etMinute*60)/scaleWidth;for(let j=0;j<timeArr.length;j++)if(timeArr[j].id==stMinute&&timeArr[j].id==etMinute){const height=etAvailPercent-stAvailPercent;const top=60-etAvailPercent;
10278
- // prettier-ignore
10279
- timeArr[j].recArr.push({height:height,top:top});}else if(timeArr[j].id==stMinute)timeArr[j].recArr.push({height:60-stAvailPercent,top:0});else if(timeArr[j].id==etMinute)timeArr[j].recArr.push({height:etAvailPercent,top:60-etAvailPercent});else if(timeArr[j].id>stMinute&&timeArr[j].id<etMinute)timeArr[j].recArr.push({height:60,top:0});}}this.setState({timeArr:timeArr});this._renderDateLine();}_renderDateLine(){const{timeArr:timeArr}=this.state;const container=this._$itemList;container.innerHTML="";timeArr.forEach(item=>{const timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class",MOBILE_TIMELINE_PREFIX+"-time-scale-area");if(item.marginTop)timeItemDOM.style.cssText+=`margin-top: ${item.marginTop}px;`;if(item.marginBottom)timeItemDOM.style.cssText+=`margin-bottom: ${item.marginBottom}px;`;timeItemDOM.style.cssText+=`border-right-color: ${this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)"};`;const scaleDOM=document.createElement("div");scaleDOM.setAttribute("class",MOBILE_TIMELINE_PREFIX+"-scale");let timeItemHtml=``;if(item.coverArr.length)timeItemHtml+=`\n <div class="${MOBILE_TIMELINE_PREFIX}-time-cover-fold ${item.coverArr.length>1?`${MOBILE_TIMELINE_PREFIX}-time-cover-fold-multiple`:""} " data-start="${item.current}">\n ${item.coverArr.length>1?`<div class="${MOBILE_TIMELINE_PREFIX}-cover-fold-placeholder" style="color: #FFF"></div>`:""}\n <div class="${MOBILE_TIMELINE_PREFIX}-time-cover-fold-img">\n ${item.coverArr[0].coverPic?`<img src="${item.coverArr[0].coverPic}&x=1000" />`:""}\n <span class="${MOBILE_TIMELINE_PREFIX}-time-cover-fold-len">\n ${item.coverArr.length>1?this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):`${TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm")}`}\n </span>\n ${item.coverArr.length===1?`<span class="${MOBILE_TIMELINE_PREFIX}-time-cover-fold-time">${TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)}</span>`:""}\n <span class="${MOBILE_TIMELINE_PREFIX}-time-cover-fold-pause">${Icons.pause}</span>\n </div>\n </div>`;
10280
- // 六个详细刻度
10281
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
10282
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
10283
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
10284
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
10285
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
10286
- // <div class="${MOBILE_TIMELINE_PREFIX}-time-scale" style="width:10px"></div>
10287
- item.recArr.forEach(i=>{timeItemHtml+=`<div class="${MOBILE_TIMELINE_PREFIX}-time-unavail"\n style="height: ${i.height}px;background-color:${this.options.timeSectionColor||"#369FFF"}; top: ${i.top}px">\n </div>`;});timeItemHtml+=`<div id=${item.label} class="${MOBILE_TIMELINE_PREFIX}-time-label" style="color: ${this.options.timeTextColor||"#666"}">${item.current}</div>`;timeItemDOM.innerHTML=timeItemHtml;container.appendChild(timeItemDOM);});}_primaryOffsetH(){const{start:start,timeArr:timeArr,current:current}=this.state;const scaleWidth=this._scaleWidth;const currentItem=timeArr[0].current;const currentTime=TimeLineUtil.timeToSecond(currentItem);
10288
- // current不为0时,从当前时间开始计算偏移量,避免拖动时间轴后回弹
10289
- const startSecond=TimeLineUtil.timeToSecond(current===0?start:current);const offsetS=currentTime-startSecond;const offsetH=Math.ceil(offsetS/scaleWidth)+60;// offsetS / (scaleWidth * 60) * 60
10290
- this.setState({scrollTop:offsetH});console.log("起始偏移量",offsetH);}_currentOffsetH(){const{current:current,timeArr:timeArr}=this.state;const scale=this._scaleWidth;const startItem=timeArr[0].current;const startSecond=TimeLineUtil.timeToSecond(startItem);const currentSecond=TimeLineUtil.timeToSecond(current);const offsetS=startSecond-currentSecond;const offsetH=Math.ceil(offsetS/scale)+60;// offsetS / (scale * 60) * 60
10291
- this.setState({scrollTop:offsetH});}_rectTopToTime(reactTop){const scaleWidth=this._scaleWidth;
10292
- // let rectTop = rect.top; // 获取当前元素距离父元素顶部的高度
10293
- // let reactTop = 0 - rectTop; // 实际偏移高度
10294
- const index=Math.floor(reactTop/60);// 以分钟为刻度时,每个元素初始高度为60px, 向下取整并除以时刻倍数得出偏移item;
10295
- const offsetH=reactTop-index*60;// 偏移高度
10296
- let current;let offsetSecond;
10297
- // console.log('index:', index, 'offsetH:', offsetH);
10298
- if(offsetH==0){var _this_state_timeArr_;current=(_this_state_timeArr_=this.state.timeArr[index-1])==null?void 0:_this_state_timeArr_.current;offsetSecond=0;}else {
10299
- // 当scaleWidth==120, scaleWidth==60, scaleWidth==30, scaleWidth==10, scaleWidth==1
10300
- const time=this.state.timeArr[index].current;const minute=TimeLineUtil.timeToMinute(time);
10301
- // 相对于下一元素偏移
10302
- const offsetY=60-offsetH;const offsetS=offsetY*scaleWidth;// offsetY / 60 * scaleWidth * 60
10303
- const offsetM=Math.floor(offsetS/60)+minute;const second=Math.floor(offsetS/60)*60;offsetSecond=Math.ceil(offsetS-second);// 保留两位小数
10304
- current=TimeLineUtil.minuteToTime(offsetM);}if(current===void 0||+current.split(":")[0]>=24&&(+current.split(":")[1]>0||offsetSecond>0)){
10305
- // 超出 24h 后不允许
10306
- this.update(new Date(`${(new Date).getFullYear()}-${TimeLineUtil.subTime((new Date).getMonth()+1)}-${TimeLineUtil.subTime((new Date).getDate())} 23:59:59`));return}this.setState({current:current+":"+(offsetSecond>9?offsetSecond:"0"+offsetSecond),scrollTop:reactTop});}_render(){this._$currentTime=document.createElement("div");this._$currentTime.classList.add(MOBILE_TIMELINE_PREFIX+"-current");this._$currentTime.innerHTML=`<div class="${MOBILE_TIMELINE_PREFIX}-current-content" style="color: ${this.options.currentTimeBgColor||"#648FFC"}">\n <span class="${MOBILE_TIMELINE_PREFIX}-current-tip">${Icons.tip}</span>\n <span class="${MOBILE_TIMELINE_PREFIX}-current-tip-line" style="background-color: ${this.options.timePointColor||"#648FFC"};"></span>\n <div class="${MOBILE_TIMELINE_PREFIX}-current-value" style="color: ${this.options.currentTimeColor||"#FFFFFF"}">00:00:00</div>\n </div>`;this.$container.appendChild(this._$currentTime);this._$itemContainer=document.createElement("div");this._$itemContainer.classList.add(MOBILE_TIMELINE_PREFIX+"-item-container");
10307
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10308
- if(/\d/.test(this.options.height))this._$itemContainer.style.cssText+=`height: ${this.options.height}px`;else if(typeof this.options.height==="string")this._$itemContainer.style.cssText+=`height: ${this.options.height}`;else {const height=this.$container.clientHeight;this._$itemContainer.style.cssText+=`height: ${height}px`;}this._$itemList=document.createElement("div");this._$itemList.classList.add(MOBILE_TIMELINE_PREFIX+"-item");this._$itemContainer.appendChild(this._$itemList);this.$container.appendChild(this._$itemContainer);if(this.options.showTimeWidthBtn){
10309
- // 加减
10310
- this._$op=document.createElement("div");this._$op.classList.add(MOBILE_TIMELINE_PREFIX+"-op");this._$op.innerHTML=`<span class="${MOBILE_TIMELINE_PREFIX}-op-wrapper">\n <span class="${MOBILE_TIMELINE_PREFIX}-icon-plus">${Icons.plus}</span>\n <span class="${MOBILE_TIMELINE_PREFIX}-icon-minus">${Icons.minus}</span>\n </span>`;this.$container.appendChild(this._$op);}this._picker=new Picker(null,{isMobile:true,wrapClassName:`${MOBILE_TIMELINE_PREFIX}-picker`,onOpenChange:isOpen=>{var _this_options_onPickerOpenChange,_this_options;(_this_options=this.options)==null?void 0:(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)==null?void 0:_this_options_onPickerOpenChange.call(_this_options,isOpen);}});this._renderPickerContent();this._addEventListener();}_addEventListener(){
10311
- // js安卓、IOS、鸿蒙系统监听开始触摸
10312
- if(this._$itemContainer){
10313
- // console.warn('=== TimeLine HAS_POINTER_EVENT ===', HAS_POINTER_EVENT);
10314
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
10315
- this._$itemContainer.addEventListener("touchstart",this._touchstart,false);
10316
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
10317
- this._$itemContainer.addEventListener("touchmove",this._touchmove,false);
10318
- // 手动滚动停止,选定时刻自动播放
10319
- this._$itemContainer.addEventListener("touchend",this._touchend,false);
10320
- // prettier-ignore
10321
- // this._$itemContainer.addEventListener('scroll', this._touchmove, false);
10322
- }if(this.options.showTimeWidthBtn&&this._$op){var// this._$op.addEventListener('click', this._opClick, false);
10323
- _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-plus`))==null?void 0:_this__$op_querySelector.addEventListener("click",this._plusClick,false);(_this__$op_querySelector1=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-minus`))==null?void 0:_this__$op_querySelector1.addEventListener("click",this._minusClick,false);}this._matchTimeDot();if(this._picker){this._delegatePickerClose=delegate(this._picker.$body,`.${MOBILE_TIMELINE_PREFIX}-picker-close`,"click",this._onPickerClose,false);this._delegateItemContent=delegate(this._picker.$body,`.${MOBILE_TIMELINE_PREFIX}-picker-item-content`,"click",this._onClickItem,false);this._delegateCoverFold=delegate(this.$container,`.${MOBILE_TIMELINE_PREFIX}-time-cover-fold`,"click",this._onClickCoverFold,false);}}_removeEventListener(){if(this._$itemContainer){
10324
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
10325
- this._$itemContainer.removeEventListener("touchstart",this._touchstart);
10326
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
10327
- this._$itemContainer.removeEventListener("touchmove",this._touchmove);
10328
- // 手动滚动停止,选定时刻自动播放
10329
- this._$itemContainer.removeEventListener("touchend",this._touchend);}if(this.options.showTimeWidthBtn&&this._$op){var _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-plus`))==null?void 0:_this__$op_querySelector.removeEventListener("click",this._plusClick);(_this__$op_querySelector1=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-minus`))==null?void 0:_this__$op_querySelector1.removeEventListener("click",this._minusClick);}if(this._picker){var _this__picker_$body_querySelector,_this__picker_$body;(_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelector=_this__picker_$body.querySelector(`.${MOBILE_TIMELINE_PREFIX}-picker-close`))==null?void 0:_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose);if(this._delegateItemContent){this._delegateItemContent.forEach(function(delegation){delegation.destroy();});this._delegateItemContent=null;}if(this._delegatePickerClose){this._delegatePickerClose.forEach(function(delegation){delegation.destroy();});this._delegatePickerClose=null;}if(this._delegateCoverFold){this._delegateCoverFold.forEach(function(delegation){delegation.destroy();});this._delegateCoverFold=null;}}}_plusClick(){const timeWidth=this.timeWidth+1;if(timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(timeWidth);else console.warn("时间轴刻度宽度不能再加了");}_minusClick(){const timeWidth=this.timeWidth-1;if(timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(Math.floor(timeWidth));else console.warn("时间轴刻度宽度不能再减了");}_touchstart(){var _this__$itemContainer;if(this.readOnly)return false;this._isTouchStart=true;this._touchstartTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.state.current);}_touchmove(){var _this__$itemContainer;if(this.readOnly)return false;const reactTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;// 实际偏移高度
10330
- this._rectTopToTime(reactTop);this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,this.state.current);}_touchend(){if(this.readOnly)return false;
10331
- // 这里有问题, 滚动是利用滚动操作(overflow-y: scroll;)的
10332
- new Promise(resolve=>{let preTop=-1;if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}this._scrollTimer=setInterval(()=>{var _this__$itemContainer;
10333
- // debugger
10334
- const reactTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;// 实际偏移高度
10335
- if(reactTop!==preTop){console.log("scrolling",reactTop,preTop);preTop=reactTop;}else {console.log("scroll stop",reactTop,preTop);if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}this._isTouchStart=false;resolve(reactTop);}},100);}).then(reactTop=>{var _this__$itemContainer;this._rectTopToTime(reactTop);console.log("页面滚动实际高度",reactTop,this.state.current);this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.state.current);if(this._touchstartTop!==((_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop)){this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.state.current);this._touchstartTop=0;}});}_timeSectionsToGroupsByHour(){const obj={};this.timeSections.forEach((item,index)=>{
10336
- // 移动端仅支持一天
10337
- // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
10338
- // //
10339
- // }
10340
- const hour=TimeLineUtil.tranTime(item.startTime,"HH");if(obj[+hour])obj[+hour].push(_extends$1$1({},item,{_index:index}));else obj[+hour]=[_extends$1$1({},item,{_index:index})];});return obj}
10341
- /**
10342
- * 渲染选择器内容
10343
- */_renderPickerContent(){var _this__picker_innerHTML,_this__picker;const hourGroups=this._timeSectionsToGroupsByHour();(_this__picker=this._picker)==null?void 0:(_this__picker_innerHTML=_this__picker.innerHTML)==null?void 0:_this__picker_innerHTML.call(_this__picker,`<div class="${MOBILE_TIMELINE_PREFIX}-picker-container">\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-header">\n <span class="${MOBILE_TIMELINE_PREFIX}-picker-close">${Icons.close}</span>\n ${this.i18n.t("title",{len:this.timeSections.length,unit:this.timeSections.length>1?"videos":"video"})}\n </div>\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-content">\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-list">\n ${Object.keys(hourGroups).reverse().map(key=>`<div class="${MOBILE_TIMELINE_PREFIX}-picker-item">\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-item-title">${key}:00</div>\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-item-list">\n ${hourGroups[key].map(item=>`<div class="${MOBILE_TIMELINE_PREFIX}-picker-item-content"\n data-start="${TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")}"\n data-end="${TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")}"\n data-index="${item._index}">\n <span class="${MOBILE_TIMELINE_PREFIX}-picker-item-time">${TimeLineUtil.tranTime(item.startTime,"mm:ss")}</span>\n <span class="${MOBILE_TIMELINE_PREFIX}-picker-item-duration">\n ${TimeLineUtil.tranTimeToString(item.startTime,item.endTime)}\n </span>\n <span class="${MOBILE_TIMELINE_PREFIX}-picker-item-icon-pause">${Icons.pause}</span>\n ${item.coverPic?`<img class="${MOBILE_TIMELINE_PREFIX}-picker-item-cover" src="${item.coverPic}&x=1000"/>`:""}\n </div>`).join("")}\n </div>\n </div>`).join("")}\n </div>\n </div>\n </div>\n </div>`);}_onPickerClose(){if(this._picker)this._picker.open=false;}_onClickItem(e){var _e_target_getAttribute,_e_target;console.log("click item",e);console.log(e.target);console.log(e.delegateTarget);const index=(_e_target=e.target)==null?void 0:(_e_target_getAttribute=_e_target.getAttribute)==null?void 0:_e_target_getAttribute.call(_e_target,"data-index");if(this._picker)this._picker.open=false;this.options.onPickerSelect==null?void 0:this.options.onPickerSelect.call(this.options,this.timeSections[+index]);}_onClickCoverFold(e){e.preventDefault();e.stopPropagation();
10344
- // const index = (e.target as HTMLDivElement)?.getAttribute?.('data-index') as string;
10345
- if(this._picker)this._picker.open=true;}constructor(container,options){super(container,deepmerge(MOBILE_TIME_LINE_DEFAULT_OPTIONS,options,{clone:false})),this._isTouchStart=false,this._touchstartTop=0,this.state={start:"00:00:00",end:"24:00:00",current:0,timeArr:[],availTimeLine:[],scrollTop:0,index:0};this._touchstart=this._touchstart.bind(this);this._touchmove=this._touchmove.bind(this);this._touchend=this._touchend.bind(this);this._plusClick=this._plusClick.bind(this);this._minusClick=this._minusClick.bind(this);this._onPickerClose=this._onPickerClose.bind(this);this._onClickItem=this._onClickItem.bind(this);this._onClickCoverFold=this._onClickCoverFold.bind(this);this._render();}}function _extends$5(){_extends$5=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$5.apply(this,arguments)}
10346
- /**
10347
- * 时间轴配置项
10348
- */const TIMELINE_DEFAULT_OPTIONS={height:36,dpr:window.devicePixelRatio||2,
10349
- // wheelSpeed: 0.1,
10350
- scaleOffsetTop:4,showYearMonthDay:true};
10351
- /**
10352
- * 时间轴控件类, 支持PC/Mobile 拖动和缩放
10353
- * @beta
10354
- * @example
10355
- * ```ts
10356
- * import TimeLine from './TimeLine';
10357
- * const timeLine = new TimeLine(document.getElementById('container'), {})
10358
- * ```
10359
- */class TimeLine extends BaseTimeLine{
10360
- /**
10361
- * 初始化 (canvas)
10362
- */
10363
- _init(){this._$canvas=document.createElement("canvas");this._ctx=this._$canvas.getContext("2d");if(!this.readOnly)this._$canvas.style.cssText+="cursor: pointer;";this.$container.appendChild(this._$canvas);this.resize(this.width,this.height);this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections});this._addEventListener();}
10364
- /**
10365
- * 重置尺寸
10366
- */resize(width,height){super.resize(width,height);if(this._$canvas&&width){this._$canvas.width=this.width*this.options.dpr;this._$canvas.style.cssText+=`width: ${this.width}px;`;}if(this._$canvas&&height){this._$canvas.height=this.height*this.options.dpr;this._$canvas.style.cssText+=`height: ${this.height}px;`;}this._draw();}
10367
- /**
10368
- * 设置时间轴刻度宽度
10369
- * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
10370
- * @returns
10371
- */setTimeWidth(timeWidth){this._update({timeWidth:timeWidth});}
10372
- /**
10373
- * 设置片段数组
10374
- * @param timeSections - 片段数组
10375
- * @returns
10376
- */updateTimeSections(timeSections){this._update({timeSections:timeSections});}
10377
- /**
10378
- * 更新当前时间
10379
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10380
- */update(time){if(time&&!this._isMouseDown)this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});}
10381
- /**
10382
- * 更新
10383
- * @param options - 更新参数
10384
- * @returns
10385
- */_update(options={}){if((options==null?void 0:options.current)&&options.current instanceof Date)this.current=options.current;if(options==null?void 0:options.timeSections)super.updateTimeSections(this._mergeTimeSections(options.timeSections));if(typeof(options==null?void 0:options.timeWidth)==="number"&&(options==null?void 0:options.timeWidth)<TIME_WIDTH.length){super.setTimeWidth(options.timeWidth);this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)];}if(typeof(options==null?void 0:options.timeWidth)==="number"&&this._timeWidthArray)if(this._timeWidthArray[3]){var _this__$canvas;(_this__$canvas=this._$canvas)==null?void 0:_this__$canvas.setAttribute("data-title",this._timeWidthArray[3]);}
10386
- // 清空画布
10387
- if(this._ctx){this._ctx.fillStyle=this.options.timeAxisBgColor;
10388
- // prettier-ignore
10389
- this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr);}this._draw();}
10390
- /**
10391
- * 销毁
10392
- * @returns
10393
- */destroy(){this._removeEventListener();if(this._$canvas){this.$container.removeChild(this._$canvas);
10394
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10395
- this._$canvas=null;}super.destroy();
10396
- // if (this._$tip) {
10397
- // this.$container.removeChild(this._$tip);
10398
- // // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10399
- // this._$tip = null!;
10400
- // }
10401
- }
10402
- // -----------------------------------------------------------------------------------------
10403
- // private
10404
- // -----------------------------------------------------------------------------------------
10405
- /**
10406
- * 缩放时间轴 动态减少间距 (没处理 dpr)
10407
- * @returns 刻度间距
10408
- */
10409
- get _curScaleSpacing(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor(((_this__timeWidthArray=this._timeWidthArray)==null?void 0:_this__timeWidthArray[1])-((_this__timeWidthArray1=this._timeWidthArray)==null?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2));// 刻度间距
10410
- }
10411
- /**
10412
- * 绘制
10413
- */_draw(){this._drawSections();this._drawScale();}
10414
- /**
10415
- * 绘制刻度
10416
- */_drawScale(){const lineWidth=1*this.options.dpr;
10417
- /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");const centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr};const curScaleTime=Math.floor(this.current.getTime()/1e3);// current 秒
10418
- // 由于时区问题 当前时间戳(秒)处理但前刻度有偏移,所以改成使用当天便宜量, 这样就能保证当天的 0 点刻度能展示
10419
- // prettier-ignore
10420
- const offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(curScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0];const padding=this.height*this.options.dpr/20;// 刻度顶部偏移量 高度的 1/8
10421
- const spacing=this._curScaleSpacing*this.options.dpr;
10422
- // 因为右偏移 右侧靠近中心点的X坐标 减去偏移量
10423
- // prettier-ignore
10424
- const rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing);let leftLastScaleTime=curScaleTime-offsetSecond;let rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0];const leftLastScaleTimeX=rightLastScaleTimeX-spacing;
10425
- // 左扩展刻度
10426
- for(let x=leftLastScaleTimeX;x>0;x-=spacing){
10427
- // prettier-ignore
10428
- const leftOffsetSecond=leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(leftLastScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3);
10429
- // prettier-ignore
10430
- const curScale=leftOffsetSecond%(this._timeWidthArray[0]*this._timeWidthArray[2]);if(curScale===0){
10431
- // prettier-ignore
10432
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth);
10433
- // prettier-ignore
10434
- this._drawTextString(TimeLineUtil.tranTime(new Date(leftLastScaleTime*1e3)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center");}else this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth);leftLastScaleTime-=this._timeWidthArray[0];}
10435
- // 右扩展刻度
10436
- // prettier-ignore
10437
- for(let x=rightLastScaleTimeX;x<=this.width*this.options.dpr;x+=spacing){
10438
- // prettier-ignore
10439
- const rightOffsetSecond=rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(rightLastScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3);
10440
- // prettier-ignore
10441
- const curScale=rightOffsetSecond%(this._timeWidthArray[0]*this._timeWidthArray[2]);if(curScale===0){
10442
- // prettier-ignore
10443
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth);
10444
- // prettier-ignore
10445
- this._drawTextString(TimeLineUtil.tranTime(new Date(rightLastScaleTime*1e3)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center");}else this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth);rightLastScaleTime+=this._timeWidthArray[0];}
10446
- // 当前中心位置(当前时间 current)
10447
- // prettier-ignore
10448
- this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);}
10449
- /**
10450
- * 绘制线
10451
- * @param startX - 线起点 x 坐标
10452
- * @param startY - 线起点 y 坐标
10453
- * @param endX - 线终点 x 坐标
10454
- * @param endY - 线终点 y 坐标
10455
- * @param lineWidth - 线宽度
10456
- * @param color - 线颜色
10457
- *
10458
- */
10459
- // prettier-ignore
10460
- _drawSolidLine(startX,startY,endX,endY,lineWidth,color){if(this._ctx){this._ctx.save();this._ctx.strokeStyle=color!=null?color:this.options.timeScaleColor;this._ctx.lineWidth=lineWidth;this._ctx.beginPath();this._ctx.moveTo(startX,startY);this._ctx.lineTo(endX,endY);this._ctx.stroke();this._ctx.restore();}}
10461
- /**
10462
- * 绘制刻度文字
10463
- * @param text - 文本
10464
- * @param x - X
10465
- * @param y - Y
10466
- * @param align - 文本对齐方式
10467
- */_drawTextString(text,x,y,align){if(this._ctx){const timeTexts=text.split(" ");this._ctx.font=`${12*this.options.dpr*1}px serif`;this._ctx.fillStyle=this.options.timeTextColor;this._ctx.textAlign=align||"left";if(this._timeWidthArray[0]%60===0)
10468
- // 仅展示 hh:mm
10469
- timeTexts[1]=timeTexts[1].replace(/:00$/,"");this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr);
10470
- // prettier-ignore
10471
- if(this.options.showYearMonthDay&&(timeTexts[1]==="00:00:00"||timeTexts[1]==="00:00"||this._timeWidthArray[0]*this._timeWidthArray[2]===24*3600)){
10472
- // 展示年月日
10473
- this._ctx.textAlign=align||"left";this._ctx.fillText(timeTexts[0],x,y+(8+10)*this.options.dpr);}}}
10474
- /**
10475
- * 画录像区间
10476
- */_drawSections(){
10477
- // 绘制蓝色区域
10478
- const timeArr=this.timeSections||[];
10479
- // 根据时间查找当前位置
10480
- for(let i=0;i<timeArr.length;i++){const position=this._findPosition(timeArr[i]);
10481
- // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
10482
- // prettier-ignore
10483
- if(this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)){this._ctx.fillStyle=this.options.timeSectionColor;
10484
- // prettier-ignore
10485
- this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr);}}}
10486
- /**
10487
- * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
10488
- * @param item - 时间片段
10489
- * @returns {void}
10490
- */_findPosition(item){
10491
- // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
10492
- // prettier-ignore
10493
- const x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;const x2=x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr;return {x1:x1,x2:x2}}
10494
- /**
10495
- * 合并相邻两个时间区间
10496
- * @param timeSections - 时间区间数组
10497
- *
10498
- * @returns 合并后的时间区间
10499
- */_mergeTimeSections(timeSections){if(timeSections.length===0)return timeSections;timeSections=timeSections.map(item=>{
10500
- // 处理秒
10501
- if((item.startTime+"").length===10)item.startTime=item.startTime*1e3;if((item.endTime+"").length===10)item.endTime=item.endTime*1e3;return _extends$5({},item,{startTime:item.startTime,endTime:item.endTime})});const merged=[timeSections[0]];for(let i=1;i<timeSections.length;i++){const prev=merged[merged.length-1];const curr=timeSections[i];
10502
- // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
10503
- if(prev.endTime>=curr.startTime)
10504
- // 合并区间
10505
- prev.endTime=Math.max(prev.endTime,curr.endTime);else merged.push(curr);}return merged}
10506
- // -------------------------------------
10507
- // mouse event
10508
- // -------------------------------------
10509
- /**
10510
- * 添加事件监听
10511
- * @returns
10512
- */
10513
- _addEventListener(){if(this._$canvas){
10514
- // 事件监听
10515
- this._$canvas.addEventListener("mousemove",this._mousemoveFun);
10516
- // prettier-ignore
10517
- this._$canvas.addEventListener("mouseover",this._mouseoverFun);
10518
- // prettier-ignore
10519
- this._$canvas.addEventListener("mouseleave",this._mouseleaveFun);
10520
- // prettier-ignore
10521
- this._$canvas.addEventListener("mousedown",this._mousedownFun);
10522
- // prettier-ignore
10523
- this._$canvas.addEventListener("mouseup",this._mouseUpFun);this._$canvas.addEventListener("wheel",this._mousewheelFun);
10524
- // prettier-ignore
10525
- this.$container.addEventListener("wheel",e=>{e.preventDefault();},{passive:false});this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun);this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun);
10526
- // ctrl 键事件
10527
- document.addEventListener("keydown",this._ctrlKeyDownFun,false);document.addEventListener("keyup",this._ctrlKeyUpFun,false);this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false});this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false});this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false});}}
10528
- /**
10529
- * 移除事件监听
10530
- * @returns
10531
- */_removeEventListener(){if(this._$canvas){
10532
- // 事件监听
10533
- this._$canvas.removeEventListener("mousemove",this._mousemoveFun);
10534
- // prettier-ignore
10535
- this._$canvas.removeEventListener("mouseover",this._mouseoverFun);
10536
- // prettier-ignore
10537
- this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun);
10538
- // prettier-ignore
10539
- this._$canvas.removeEventListener("mousedown",this._mousedownFun);
10540
- // prettier-ignore
10541
- this._$canvas.removeEventListener("mouseup",this._mouseUpFun);this._$canvas.removeEventListener("wheel",this._mousewheelFun);this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun);this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun);
10542
- // ctrl 键事件
10543
- document.removeEventListener("keydown",this._ctrlKeyDownFun);document.removeEventListener("keyup",this._ctrlKeyUpFun);
10544
- // touch
10545
- this._$canvas.removeEventListener("touchstart",this._touchstartFun);this._$canvas.removeEventListener("touchmove",this._touchmoveFun);this._$canvas.removeEventListener("touchend",this._touchendFun);}}
10546
- /**
10547
- * 鼠标按下事件监听
10548
- * @param e - 鼠标事件
10549
- * @returns
10550
- */_mousedownFun(e){if(this.readOnly)return;this._isMouseDown=true;this._mousePosition=e.pageX;this._oldTime=this.current;this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.current);}
10551
- /**
10552
- * 鼠标移入事件监听
10553
- * @returns
10554
- */_mouseoverFun(){if(this.readOnly)return;this._isOver=true;}
10555
- /**
10556
- * 鼠标离开事件监听
10557
- * @returns
10558
- */_mouseleaveFun(e){if(this.readOnly)return;this._isOver=false;this._moveEndOrTouchEndFun(e);}
10559
- /**
10560
- * 鼠标抬起事件监听
10561
- * @returns
10562
- */_mouseUpFun(e){this._moveEndOrTouchEndFun(e);}
10563
- /**
10564
- * 鼠标移动事件监听
10565
- * @param e - 鼠标事件
10566
- * @returns
10567
- */_mousemoveFun(e){if(this.readOnly)return;if(this._isMouseDown&&this._isOver)
10568
- // 鼠标按下位置和移动位置的偏移量
10569
- this._moveUpdateFun(e.pageX);else {const left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left;this._update();// 更新画面
10570
- }
10571
- // const time = new Date(
10572
- // // prettier-ignore
10573
- // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
10574
- // );
10519
+
10520
+ var dist;
10521
+ var hasRequiredDist$1;
10522
+
10523
+ function requireDist$1 () {
10524
+ if (hasRequiredDist$1) return dist;
10525
+ hasRequiredDist$1 = 1;
10526
+
10527
+ /**
10528
+ * 拖拽滚动状态
10529
+ */ function _defineProperties(target, props) {
10530
+ for(var i = 0; i < props.length; i++){
10531
+ var descriptor = props[i];
10532
+ descriptor.enumerable = descriptor.enumerable || false;
10533
+ descriptor.configurable = true;
10534
+ if ("value" in descriptor) descriptor.writable = true;
10535
+ Object.defineProperty(target, descriptor.key, descriptor);
10536
+ }
10537
+ }
10538
+ function _create_class(Constructor, protoProps, staticProps) {
10539
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10540
+ return Constructor;
10541
+ }
10542
+ /**
10543
+ * 默认参数
10544
+ */ var _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
10545
+ content: '',
10546
+ height: '400px',
10547
+ readonly: false,
10548
+ hideScrollbar: false
10549
+ };
10550
+ /**
10551
+ * 前缀类名
10552
+ */ var _$DRAG_SCROLL_PREFIX_CLASSNAME$_ = 'drag-scroll';
10553
+ /**
10554
+ * 拖拽滚动(使用 PointerEvent 统一处理鼠标和触摸事件)
10555
+ * @class DragScroll
10556
+ * @example
10557
+ * ```ts
10558
+ * const container = document.getElementById('scrollContainer');
10559
+ * const dragScroll = new DragScroll(container, {
10560
+ * width: '300px',
10561
+ * height: '500px',
10562
+ * content: '<div>...</div>',
10563
+ * });
10564
+ * ```
10565
+ */ var DragScroll = /*#__PURE__*/ function() {
10566
+ function DragScroll(container, options) {
10567
+ if (options === void 0) options = {};
10568
+ this._indicatorTimeout = null;
10569
+ /** 滚动条元素 */ this._$scrollbar = null;
10570
+ /** 滚动条指示器元素 */ this._$scrollbarThumb = null;
10571
+ /** 是否只读 */ this._readonly = false;
10572
+ this.$container = container;
10573
+ this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
10574
+ this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-container");
10575
+ this.$content = document.createElement('div');
10576
+ this.$content.classList.add("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-content");
10577
+ this.innerHtml(this.options.content);
10578
+ this.$container.appendChild(this.$content);
10579
+ this.isDragging = false;
10580
+ this._startY = 0;
10581
+ this.currentY = 0;
10582
+ this.velocity = 0;
10583
+ this._animationId = null;
10584
+ this._lastTimestamp = 0;
10585
+ // 物理参数
10586
+ this._spring = 0.25; // 弹性系数
10587
+ this._friction = 0.92; // 摩擦力
10588
+ this._bounceDamping = 0.6; // 边界反弹阻尼
10589
+ this._maxVelocity = 30; // 最大速度限制
10590
+ if (!this.options.hideScrollbar) {
10591
+ this._renderScrollbar();
10592
+ }
10593
+ this._onMouseDown = this._onMouseDown.bind(this);
10594
+ this._onTouchMove = this._onTouchMove.bind(this);
10595
+ this._onMouseMove = this._onMouseMove.bind(this);
10596
+ this._onMouseUp = this._onMouseUp.bind(this);
10597
+ this.readonly = this.options.readonly;
10598
+ this._init();
10599
+ }
10600
+ var _proto = DragScroll.prototype;
10601
+ /**
10602
+ * 设置容器尺寸
10603
+ * @param width 容器宽度
10604
+ * @param height 容器高度
10605
+ * @example
10606
+ * ```ts
10607
+ * dragScroll.resize(500, '400px');
10608
+ * dragScroll.resize('80%', '600px');
10609
+ * ```
10610
+ */ _proto.resize = function resize(width, height) {
10611
+ var css = "";
10612
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
10613
+ css = "width: " + width + "px;";
10614
+ } else if (typeof width === 'string') {
10615
+ css = "width: " + width + ";";
10616
+ }
10617
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
10618
+ css += "height: " + height + "px;";
10619
+ } else if (typeof height === 'string') {
10620
+ css += "height: " + height + ";";
10621
+ }
10622
+ this.$container.style.cssText += css;
10623
+ this._applyTransform();
10624
+ };
10625
+ /**
10626
+ * 设置 HTML 内容
10627
+ * @param html HTML 字符串或返回 HTML 字符串的函数
10628
+ * @example
10629
+ * ```ts
10630
+ * dragScroll.innerHtml('<div>New Content</div>');
10631
+ * dragScroll.innerHtml(() => '<div>Dynamic Content</div>');
10632
+ * ```
10633
+ */ _proto.innerHtml = function innerHtml(html) {
10634
+ this.$content.innerHTML = typeof html === 'function' ? html() : html;
10635
+ this._applyTransform();
10636
+ };
10637
+ /**
10638
+ * Y轴滚动到指定位置
10639
+ * @param y Y轴平移值 (需正值不支持负值)
10640
+ * @example
10641
+ * ```ts
10642
+ * dragScroll.scrollToY(200);
10643
+ * dragScroll.scrollToY(0); // 平移到顶部
10644
+ * dragScroll.scrollToY(-2); // 无效
10645
+ * ```
10646
+ */ _proto.scrollToY = function scrollToY(y, triggerChange) {
10647
+ if (triggerChange === void 0) triggerChange = true;
10648
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10649
+ // 边界检查
10650
+ if (y < 0 || y > maxScroll) return;
10651
+ this.currentY = y;
10652
+ this.velocity = 0;
10653
+ this._applyTransform();
10654
+ if (triggerChange) this._updateState();
10655
+ };
10656
+ /**
10657
+ * 销毁方法,用于清理资源
10658
+ * @example
10659
+ * ```ts
10660
+ * dragScroll.destroy();
10661
+ * dragScroll = null;
10662
+ * ```
10663
+ */ _proto.destroy = function destroy() {
10664
+ var _this__$scrollbarThumb, _this__$scrollbar, _this_$content;
10665
+ if (this._animationId) {
10666
+ cancelAnimationFrame(this._animationId);
10667
+ this._animationId = null;
10668
+ }
10669
+ if (this._indicatorTimeout) {
10670
+ clearTimeout(this._indicatorTimeout);
10671
+ this._indicatorTimeout = null;
10672
+ }
10673
+ (_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
10674
+ this._$scrollbarThumb = null;
10675
+ (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
10676
+ this._$scrollbar = null;
10677
+ (_this_$content = this.$content) == null ? void 0 : _this_$content.remove();
10678
+ this.$content = null;
10679
+ this._removeEventListeners();
10680
+ };
10681
+ // ---------------------------------------------------------------------- //
10682
+ // 私有方法
10683
+ // ---------------------------------------------------------------------- //
10684
+ _proto._renderScrollbar = function _renderScrollbar() {
10685
+ this._$scrollbar = document.createElement('div');
10686
+ this._$scrollbar.className = "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-scrollbar";
10687
+ this._$scrollbarThumb = document.createElement('div');
10688
+ this._$scrollbarThumb.className = "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-scrollbar-thumb";
10689
+ this._$scrollbar.appendChild(this._$scrollbarThumb);
10690
+ this.$container.appendChild(this._$scrollbar);
10691
+ };
10692
+ // 初始化
10693
+ _proto._init = function _init() {
10694
+ this.resize(this.options.width, this.options.height);
10695
+ this._addEventListeners();
10696
+ // 初始化滚动条
10697
+ this._updateScrollbar();
10698
+ // 初始化动画
10699
+ this._animate();
10700
+ };
10701
+ // ----------- 事件处理 ----------- //
10702
+ /**
10703
+ * 添加事件监听器
10704
+ */ _proto._addEventListeners = function _addEventListeners() {
10705
+ // 添加事件监听器
10706
+ this.$container.addEventListener('pointerdown', this._onMouseDown);
10707
+ document.addEventListener('pointermove', this._onMouseMove);
10708
+ // 务必同时监听 pointerup 和 pointercancel,都要做收尾和状态清理,否则会出现“拖动卡死”问题
10709
+ document.addEventListener('pointerup', this._onMouseUp); // 指针正常抬起时
10710
+ document.addEventListener('pointercancel', this._onMouseUp); // 指针操作被系统/外部原因打断时
10711
+ };
10712
+ /**
10713
+ * 移除事件监听器
10714
+ */ _proto._removeEventListeners = function _removeEventListeners() {
10715
+ this.$container.removeEventListener('touchmove', this._onTouchMove);
10716
+ // 移除事件监听器
10717
+ this.$container.removeEventListener('pointerdown', this._onMouseDown);
10718
+ document.removeEventListener('pointermove', this._onMouseMove);
10719
+ document.removeEventListener('pointerup', this._onMouseUp);
10720
+ document.removeEventListener('pointercancel', this._onMouseUp);
10721
+ };
10722
+ /**
10723
+ * 鼠标按下
10724
+ * @param e 鼠标事件
10725
+ */ _proto._onMouseDown = function _onMouseDown(e) {
10726
+ if (!this.canDrag) return;
10727
+ this._startDrag(e.clientY);
10728
+ this.options.onDragStart == null ? void 0 : this.options.onDragStart.call(this.options, e);
10729
+ };
10730
+ /**
10731
+ * 触摸移动
10732
+ * @param e 触摸移动事件
10733
+ */ _proto._onTouchMove = function _onTouchMove(e) {
10734
+ e.preventDefault();
10735
+ };
10736
+ /**
10737
+ * 开始拖拽
10738
+ * @param clientY 鼠标或触摸的 Y 坐标
10739
+ */ _proto._startDrag = function _startDrag(clientY) {
10740
+ var _this__$scrollbar_classList, _this__$scrollbar;
10741
+ if (!this.canDrag) return;
10742
+ this.isDragging = true;
10743
+ this._startY = clientY;
10744
+ this.velocity = 0;
10745
+ (_this__$scrollbar = this._$scrollbar) == null ? void 0 : (_this__$scrollbar_classList = _this__$scrollbar.classList) == null ? void 0 : _this__$scrollbar_classList.add("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-show");
10746
+ // 更新光标样式
10747
+ this.$container.style.cursor = 'grabbing';
10748
+ };
10749
+ /**
10750
+ * 鼠标移动
10751
+ * @param e 鼠标事件
10752
+ */ _proto._onMouseMove = function _onMouseMove(e) {
10753
+ // e.preventDefault();
10754
+ if (!this.canDrag) return;
10755
+ if (!this.isDragging) return;
10756
+ this._drag(e.clientY);
10757
+ this.options.onDragging == null ? void 0 : this.options.onDragging.call(this.options, 0, this.currentY);
10758
+ };
10759
+ /**
10760
+ * 拖动
10761
+ * @param clientY 鼠标或触摸的 Y 坐标
10762
+ */ _proto._drag = function _drag(clientY) {
10763
+ if (!this.canDrag) return;
10764
+ var deltaY = this._startY - clientY;
10765
+ this._startY = clientY;
10766
+ // 更新位置
10767
+ this.currentY += deltaY;
10768
+ // 计算速度(用于惯性滚动)
10769
+ this.velocity = deltaY;
10770
+ // 限制速度
10771
+ this.velocity = Math.max(Math.min(this.velocity, this._maxVelocity), -this._maxVelocity);
10772
+ this._applyTransform();
10773
+ this._updateState();
10774
+ };
10775
+ /**
10776
+ * 鼠标释放
10777
+ */ _proto._onMouseUp = function _onMouseUp(e) {
10778
+ if (!this.canDrag) return;
10779
+ if (!this.isDragging) return;
10780
+ this.isDragging = false; // 停止拖动, 放置在最后
10781
+ this._endDrag();
10782
+ this.options.onDragEnd == null ? void 0 : this.options.onDragEnd.call(this.options, e);
10783
+ };
10784
+ /**
10785
+ * 结束拖动
10786
+ */ _proto._endDrag = function _endDrag() {
10787
+ var _this = this;
10788
+ // 恢复光标样式
10789
+ this.$container.style.cursor = 'grab';
10790
+ // 延迟隐藏滚动条
10791
+ setTimeout(function() {
10792
+ var _this__$scrollbar;
10793
+ if (!_this.isDragging) (_this__$scrollbar = _this._$scrollbar) == null ? void 0 : _this__$scrollbar.classList.remove("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-show");
10794
+ }, 1500);
10795
+ };
10796
+ /**
10797
+ * 平移内容
10798
+ */ _proto._applyTransform = function _applyTransform() {
10799
+ var clientHeight = this.$content.clientHeight;
10800
+ // 内容高度小于等于容器高度时,不进行滚动
10801
+ if (clientHeight <= this.$container.clientHeight) {
10802
+ this.$content.style.transform = "translate3d(0, 0, 0)";
10803
+ return;
10804
+ }
10805
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10806
+ // 边界检查与弹性效果
10807
+ if (this.currentY < 0) {
10808
+ // 超出顶部边界
10809
+ this.currentY = 0; // this.currentY * this._bounceDamping;
10810
+ this.velocity *= this._bounceDamping;
10811
+ } else if (this.currentY > maxScroll) {
10812
+ // 超出底部边界
10813
+ this.currentY = maxScroll; // maxScroll + (this.currentY - maxScroll) * this._bounceDamping;
10814
+ this.velocity *= this._bounceDamping;
10815
+ }
10816
+ // 应用 transform
10817
+ this.$content.style.transform = "translate3d(0, " + -this.currentY + "px, 0)";
10818
+ this._updateScrollbar();
10819
+ };
10820
+ /**
10821
+ * 动画
10822
+ * @param timestamp 时间戳
10823
+ */ _proto._animate = function _animate(timestamp) {
10824
+ if (timestamp === void 0) timestamp = 0;
10825
+ var clientHeight = this.$content.clientHeight;
10826
+ // 内容高度小于等于容器高度时,不进行滚动
10827
+ if (clientHeight <= this.$container.clientHeight) {
10828
+ return;
10829
+ }
10830
+ if (!this._lastTimestamp) this._lastTimestamp = timestamp;
10831
+ var deltaTime = Math.min(timestamp - this._lastTimestamp, 100) / 16; // 限制最大时间增量
10832
+ this._lastTimestamp = timestamp;
10833
+ if (!this.isDragging) {
10834
+ // 惯性滚动
10835
+ this.velocity *= this._friction;
10836
+ this.currentY += this.velocity;
10837
+ // 弹性回弹
10838
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10839
+ if (this.currentY < 0) {
10840
+ // 顶部弹性
10841
+ this.velocity -= this.currentY * this._spring * deltaTime;
10842
+ } else if (this.currentY > maxScroll) {
10843
+ // 底部弹性
10844
+ this.velocity -= (this.currentY - maxScroll) * this._spring * deltaTime;
10845
+ }
10846
+ this._applyTransform();
10847
+ this._updateState();
10848
+ // 当速度足够小时停止动画
10849
+ if (Math.abs(this.velocity) < 0.1 && this.currentY >= 0 && this.currentY <= maxScroll) {
10850
+ this.velocity = 0;
10851
+ }
10852
+ }
10853
+ this._animationId = requestAnimationFrame(this._animate.bind(this));
10854
+ };
10855
+ /**
10856
+ * 更新滚动条
10857
+ */ _proto._updateScrollbar = function _updateScrollbar() {
10858
+ var containerHeight = this.$container.clientHeight;
10859
+ var contentHeight = this.$content.scrollHeight;
10860
+ var maxScroll = contentHeight - containerHeight;
10861
+ if (maxScroll <= 0) {
10862
+ if (this._$scrollbarThumb) this._$scrollbarThumb.style.height = '0';
10863
+ return;
10864
+ }
10865
+ // 计算滚动条高度和位置
10866
+ var thumbHeight = Math.max(containerHeight / contentHeight * containerHeight, 20);
10867
+ var thumbPosition = this.currentY / maxScroll * (containerHeight - thumbHeight);
10868
+ if (this._$scrollbarThumb) {
10869
+ this._$scrollbarThumb.style.height = "" + thumbHeight + "px";
10870
+ this._$scrollbarThumb.style.transform = "translateY(" + thumbPosition + "px)";
10871
+ }
10872
+ };
10873
+ /**
10874
+ * 更新统计信息
10875
+ */ _proto._updateState = function _updateState() {
10876
+ this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, {
10877
+ x: 0,
10878
+ y: this.currentY,
10879
+ velocity: +this.velocity.toFixed(1)
10880
+ });
10881
+ };
10882
+ _create_class(DragScroll, [
10883
+ {
10884
+ key: "width",
10885
+ get: /**
10886
+ * 获取容器宽度
10887
+ * @example
10888
+ * ```ts
10889
+ * const width = dragScroll.width;
10890
+ * ```
10891
+ * @return {number}
10892
+ */ function get() {
10893
+ return this.$container.clientWidth;
10894
+ }
10895
+ },
10896
+ {
10897
+ key: "height",
10898
+ get: /**
10899
+ * 获取容器高度
10900
+ * @example
10901
+ * ```ts
10902
+ * const height = dragScroll.height;
10903
+ * ```
10904
+ * @return {number}
10905
+ */ function get() {
10906
+ return this.$container.clientHeight;
10907
+ }
10908
+ },
10909
+ {
10910
+ key: "readonly",
10911
+ get: /**
10912
+ * 只读属性
10913
+ */ function get() {
10914
+ return this._readonly;
10915
+ },
10916
+ set: function set(value) {
10917
+ if (this._readonly !== value) {
10918
+ this.$container.style.cursor = value ? 'not-allowed' : 'grab';
10919
+ this._readonly = value;
10920
+ }
10921
+ this.$container.removeEventListener('touchmove', this._onTouchMove);
10922
+ if (!value) {
10923
+ // 当非只读时,添加 touchmove 事件监听, 阻止透传到body默认滚动行为
10924
+ this.$container.addEventListener('touchmove', this._onTouchMove, {
10925
+ passive: false
10926
+ }); //
10927
+ }
10928
+ }
10929
+ },
10930
+ {
10931
+ key: "canDrag",
10932
+ get: /**
10933
+ * 内容是否可滚动
10934
+ */ function get() {
10935
+ var clientHeight = this.$content.clientHeight;
10936
+ return !this.readonly && clientHeight > this.$container.clientHeight;
10937
+ }
10938
+ }
10939
+ ]);
10940
+ return DragScroll;
10941
+ }();
10942
+
10943
+ dist = DragScroll;
10944
+ return dist;
10575
10945
  }
10576
- /**
10577
- * 鼠标滚轮滚动
10578
- * @param e - 鼠标滚轮滚动事件
10579
- * @returns
10580
- */_mousewheelFun(e){e.preventDefault();// 阻止默认滚动行为
10581
- // eslint-disable-next-line no-useless-return
10582
- if(this.readOnly)return;
10583
- // if (this._isCtrlKeyDown) {
10584
- // const zoom = e.deltaY > 0 ? -this.options.wheelSpeed : this.options.wheelSpeed;
10585
- // this._timeWidth = +(this._timeWidth + zoom).toFixed(2);
10586
- // if (this._timeWidth <= 0) {
10587
- // this._timeWidth = 0;
10588
- // } else if (this._timeWidth >= TIME_WIDTH.length) {
10589
- // this._timeWidth = TIME_WIDTH.length - 0.01;
10590
- // }
10591
- // this._update({
10592
- // timeWidth: Math.floor(this._timeWidth),
10593
- // });
10594
- // }
10946
+
10947
+ /*
10948
+ * @ezuikit/control-time-line v1.0.1-beta.14
10949
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
10950
+ * Released under the MIT License.
10951
+ */
10952
+
10953
+ var hasRequiredDist;
10954
+
10955
+ function requireDist () {
10956
+ if (hasRequiredDist) return dist$1.exports;
10957
+ hasRequiredDist = 1;
10958
+ (function (module, exports) {
10959
+ Object.defineProperty(exports,"__esModule",{value:true});var deepmerge=requireCjs(),I18n=requireDist$3(),Picker=requireDist$6(),DragScroll=requireDist$1(),delegate=requireDist$5(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(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}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
10960
+ // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
10961
+ timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
10962
+ onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,
10963
+ /** 只读 */this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,
10964
+ /** 片段列表 */this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,
10965
+ // prettier-ignore
10966
+ this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._timeWidth=this.options.timeWidth||0,this._resize(this.options.width||"100%",this.options.height);}var _proto=BaseTimeLine.prototype;
10967
+ /**
10968
+ * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
10969
+ * @param readOnly - 只读或取消只读
10970
+ * @returns
10971
+ */return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},
10972
+ /**
10973
+ * 更新当前时间
10974
+ * @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10975
+ */
10976
+ _proto.update=function(current){this._current=current;},
10977
+ /**
10978
+ * 更新时间片段
10979
+ * @param timeSections 片段数据
10980
+ */
10981
+ _proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},
10982
+ /**
10983
+ * 重置尺寸
10984
+ */
10985
+ _proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},
10986
+ /**
10987
+ * 改变时间轴刻度
10988
+ * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
10989
+ * PC间距:
10990
+ * @param timeWidth 时间轴刻度
10991
+ */
10992
+ _proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},
10993
+ /**
10994
+ * 销毁
10995
+ */
10996
+ _proto.destroy=function(){
10997
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10998
+ this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:
10999
+ /**
11000
+ * 当前时间
11001
+ */
11002
+ function(){return this._current},set:
11003
+ /**
11004
+ * 当前时间
11005
+ */
11006
+ function(current){this._current=current;}},{key:"readOnly",get:
11007
+ /**
11008
+ * 只读状态
11009
+ */
11010
+ function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:
11011
+ /**
11012
+ * 时间片段
11013
+ */
11014
+ function(){return this._timeSections}},{key:"width",get:
11015
+ /**
11016
+ * 获取 TimeLine 的宽度
11017
+ * @returns
11018
+ */
11019
+ function(){return this._width}},{key:"height",get:
11020
+ /**
11021
+ * 获取 TimeLine 的高度
11022
+ */
11023
+ function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();
11024
+ /**
11025
+ * 时间轴基类
11026
+ * @internal
11027
+ */
11028
+ /** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}
11029
+ /**
11030
+ * 时间转成日期
11031
+ * @param time 时间 (秒, 毫秒, 日期字符串, Date)
11032
+ * @returns 日期
11033
+ */return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(date=time)):date=new Date(+time):date=new Date(1e3*+time),date},
11034
+ /**
11035
+ * 时间转成 HH:mm:ss
11036
+ * @param time 时间
11037
+ * @returns
11038
+ */
11039
+ TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();// 返回日期中的小时数(0到23)
11040
+ // 返回日期中的秒数(0到59)
11041
+ return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},
11042
+ /**
11043
+ * 十位补充 0
11044
+ * @param m 数字
11045
+ * @returns 十位补充 0后的结果字符串
11046
+ */
11047
+ TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},
11048
+ /**
11049
+ * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
11050
+ * @param time 时间
11051
+ * @param fmt 时间格式
11052
+ * @returns
11053
+ */
11054
+ TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},
11055
+ /**
11056
+ * 时间转成秒
11057
+ * @param time
11058
+ * @returns
11059
+ */
11060
+ TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},
11061
+ /**
11062
+ * 分钟转成 HH:mm
11063
+ * @param minute
11064
+ * @returns
11065
+ */
11066
+ TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},
11067
+ /**
11068
+ * 时间转成分钟
11069
+ * @param time
11070
+ * @returns
11071
+ */
11072
+ TimeLineUtil.timeToMinute=function(time){var e=time.split(":");
11073
+ // const s = Number(e[2]);
11074
+ return 60*Number(e[0])+Number(e[1])},
11075
+ /**
11076
+ * @description 判读两个区间是否重叠
11077
+ * @param {number} a_start 一个区间的开始
11078
+ * @param {number} a_end 一个区间的结束
11079
+ * @param {number} b_start 另一个区间的开始
11080
+ * @param {number} b_end 另一个区间的结束
11081
+ * @returns {boolean}
11082
+ */
11083
+ TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$TIMELINE_ICONS$__tip='<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>',_$TIMELINE_ICONS$__plus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__minus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__close='\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n ',_$TIMELINE_ICONS$__pause='<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n ',_$TIMELINE_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];
11084
+ /**
11085
+ * 时间轴图标集
11086
+ */function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&
11087
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable eqeqeq */ /* eslint-disable no-unneeded-ternary */ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/prefer-includes */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 _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}
11088
+ /**
11089
+ * 时间轴样式类前缀
11090
+ */var _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
11091
+ /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
11092
+ /** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0},_this._plusClick=_this._plusClick.bind(_this),_this._minusClick=_this._minusClick.bind(_this),_this._onPickerClose=_this._onPickerClose.bind(_this),_this._onClickItem=_this._onClickItem.bind(_this),_this._onClickCoverFold=_this._onClickCoverFold.bind(_this),_this._onImageError=_this._onImageError.bind(_this),_this._render(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;
11093
+ /**
11094
+ * 设置只读或取消只读
11095
+ * @param readOnly - 只读或取消只读
11096
+ * @returns
11097
+ */return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},
11098
+ /**
11099
+ * 改变时间轴刻度
11100
+ * 0: 1分钟,
11101
+ * 1: 10分钟
11102
+ * 2: 半小时
11103
+ * 3: 1小时
11104
+ * 4: 2小时
11105
+ * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
11106
+ */
11107
+ _proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},
11108
+ /**
11109
+ * 更新片段数组
11110
+ * @param timeSections
11111
+ * @param defaultIndex
11112
+ */
11113
+ _proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);
11114
+ // 若current不为 null,则不重置current,避免拖动后时间轴回弹
11115
+ var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},
11116
+ /**
11117
+ * 更新当前时间
11118
+ * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11119
+ */
11120
+ _proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},
11121
+ /**
11122
+ * 销毁
11123
+ */
11124
+ _proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList),this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer),this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op),this._$op=null;}catch(error){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},
11125
+ /**
11126
+ * 更新状态
11127
+ * @param obj
11128
+ */
11129
+ _proto._setState=function(obj){var _this=this;
11130
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11131
+ Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime(null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},
11132
+ /**
11133
+ * 渲染时间轴刻度数组
11134
+ */
11135
+ _proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth// 时间单位 分钟
11136
+ ;i>=0;){var marginTop=0,marginBottom=0;
11137
+ // 视频片段
11138
+ i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)}),i-=scaleWidth;}this._setState({timeArr:timeArr}),this._matchRecTimeDot();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;
11139
+ // prettier-ignore
11140
+ timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;
11141
+ // 清理上一次的error 事件
11142
+ this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),item.marginBottom&&(timeItemDOM.style.cssText+="margin-bottom: "+item.marginBottom+"px;"),timeItemDOM.style.cssText+="border-right-color: "+(_this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)")+";",timeItemDOM.setAttribute("data-time",item.current),timeItemDOM.setAttribute("data-index",index+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-time-cover-fold-len">\n '+(item.coverArr.length>1?_this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):""+TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm"))+"\n </span>\n "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),
11143
+ // 六个详细刻度
11144
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11145
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11146
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11147
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11148
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11149
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
11150
+ item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-time-unavail"\n style="height: '+i.height+"px;background-color:"+(_this.options.timeSectionColor||"#369FFF")+"; top: "+i.top+'px">\n </div>';}),timeItemHtml+="<div id="+item.label+' class="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;
11151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11152
+ if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-current-value" style="color: '+(this.options.currentTimeColor||"#FFFFFF")+'">00:00:00</div>\n </div>',this.$container.appendChild(this._$currentTime),this._$itemContainer=document.createElement("div"),this._$itemContainer.classList.add("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(
11153
+ // 加减
11154
+ this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var// this._$op.addEventListener('click', this._opClick, false);
11155
+ _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){
11156
+ // 移动端仅支持一天
11157
+ // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
11158
+ // }
11159
+ var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?
11160
+ // prettier-ignore
11161
+ obj[+hour].push(_extends$1({},item,{_index:index})):
11162
+ // prettier-ignore
11163
+ obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},
11164
+ /**
11165
+ *
11166
+ * @param start 仅支持判断同一天的, 如果是多天的或出错
11167
+ */
11168
+ _proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},
11169
+ /**
11170
+ * 渲染选择器内容
11171
+ */
11172
+ _proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-picker-close">'+_$TIMELINE_ICONS$__close+"</span>\n "+this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})+'\n </div>\n <div class="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-picker-item-content"\n data-start="'+TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")+'"\n data-end="'+TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")+'"\n data-index="'+item._index+'">\n <span class="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},
11173
+ /**
11174
+ * 图片加载失败事件监听
11175
+ * @param list
11176
+ */
11177
+ _proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11178
+ // 避免重复添加事件
11179
+ img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},
11180
+ /**
11181
+ * 图片加载失败移除
11182
+ * @param list
11183
+ */
11184
+ _proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11185
+ // 避免重复添加事件
11186
+ img.removeEventListener("error",_this._onImageError);});},
11187
+ /**
11188
+ * 图片加载失败
11189
+ * @param e
11190
+ */
11191
+ _proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");
11192
+ // 加密图片不能加载或没有图片
11193
+ placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);
11194
+ // moveX >= 1 || moveY >= 1 用于判断是否移动
11195
+ this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=1000&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(
11196
+ // 60 是下限
11197
+ y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:
11198
+ /**
11199
+ * 获取真实时间刻度(时间单位 分钟)
11200
+ */
11201
+ function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);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 _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}
11202
+ /**
11203
+ * 时间轴配置项
11204
+ */var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
11205
+ // wheelSpeed: 0.1,
11206
+ scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,// mouse
11207
+ _this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,
11208
+ // prettier-ignore
11209
+ _this._mousemoveFun=_this._mousemoveFun.bind(_this),_this._mouseoverFun=_this._mouseoverFun.bind(_this),_this._mouseleaveFun=_this._mouseleaveFun.bind(_this),_this._mousedownFun=_this._mousedownFun.bind(_this),_this._mouseUpFun=_this._mouseUpFun.bind(_this),_this._mousewheelFun=_this._mousewheelFun.bind(_this),_this._touchstartFun=_this._touchstartFun.bind(_this),_this._touchmoveFun=_this._touchmoveFun.bind(_this),_this._touchendFun=_this._touchendFun.bind(_this),_this._ctrlKeyDownFun=_this._ctrlKeyDownFun.bind(_this),_this._ctrlKeyUpFun=_this._ctrlKeyUpFun.bind(_this),_this._init(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;
11210
+ /**
11211
+ * 初始化 (canvas)
11212
+ */return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},
11213
+ /**
11214
+ * 重置尺寸
11215
+ */
11216
+ _proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},
11217
+ /**
11218
+ * 设置时间轴刻度宽度
11219
+ * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
11220
+ * @returns
11221
+ */
11222
+ _proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},
11223
+ /**
11224
+ * 设置片段数组
11225
+ * @param timeSections - 片段数组
11226
+ * @returns
11227
+ */
11228
+ _proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},
11229
+ /**
11230
+ * 更新当前时间
11231
+ * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11232
+ */
11233
+ _proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},
11234
+ /**
11235
+ * 更新
11236
+ * @param options - 更新参数
11237
+ * @returns
11238
+ */
11239
+ _proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},
11240
+ /**
11241
+ * 销毁
11242
+ * @returns
11243
+ */
11244
+ _proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),
11245
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11246
+ this._$canvas=null;}catch(e){
11247
+ // console.error(e);
11248
+ }BaseTimeLine.prototype.destroy.call(this);},
11249
+ /**
11250
+ * 绘制
11251
+ */
11252
+ _proto._draw=function(){
11253
+ // 清空画布
11254
+ this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,
11255
+ // prettier-ignore
11256
+ this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},
11257
+ /**
11258
+ * 绘制刻度
11259
+ */
11260
+ _proto._drawScale=function(){var lineWidth=1*this.options.dpr;
11261
+ /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");
11262
+ // 左扩展刻度
11263
+ for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11264
+ // prettier-ignore
11265
+ this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11266
+ // prettier-ignore
11267
+ this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}
11268
+ // 右扩展刻度
11269
+ // prettier-ignore
11270
+ for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11271
+ // prettier-ignore
11272
+ this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11273
+ // prettier-ignore
11274
+ this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}
11275
+ // 当前中心位置(当前时间 current)
11276
+ // prettier-ignore
11277
+ this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},
11278
+ /**
11279
+ * 绘制线
11280
+ * @param startX - 线起点 x 坐标
11281
+ * @param startY - 线起点 y 坐标
11282
+ * @param endX - 线终点 x 坐标
11283
+ * @param endY - 线终点 y 坐标
11284
+ * @param lineWidth - 线宽度
11285
+ * @param color - 线颜色
11286
+ *
11287
+ */
11288
+ // prettier-ignore
11289
+ _proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},
11290
+ /**
11291
+ * 绘制刻度文字
11292
+ * @param text - 文本
11293
+ * @param x - X
11294
+ * @param y - Y
11295
+ * @param align - 文本对齐方式
11296
+ */
11297
+ _proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(
11298
+ // 仅展示 hh:mm
11299
+ timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),
11300
+ // prettier-ignore
11301
+ !this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(
11302
+ // 展示年月日
11303
+ this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},
11304
+ /**
11305
+ * 画录像区间
11306
+ */
11307
+ _proto._drawSections=function(){
11308
+ // 根据时间查找当前位置
11309
+ for(
11310
+ // 绘制蓝色区域
11311
+ var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);
11312
+ // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
11313
+ // prettier-ignore
11314
+ this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,
11315
+ // prettier-ignore
11316
+ this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},
11317
+ /**
11318
+ * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
11319
+ * @param item - 时间片段
11320
+ * @returns {void}
11321
+ */
11322
+ _proto._findPosition=function(item){
11323
+ // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
11324
+ // prettier-ignore
11325
+ var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},
11326
+ /**
11327
+ * 合并相邻两个时间区间
11328
+ * @param timeSections - 时间区间数组
11329
+ *
11330
+ * @returns 合并后的时间区间
11331
+ */
11332
+ _proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){
11333
+ // 处理秒
11334
+ return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];
11335
+ // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
11336
+ prev.endTime>=curr.startTime?
11337
+ // 合并区间
11338
+ prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},
11339
+ // -------------------------------------
11340
+ // mouse event
11341
+ // -------------------------------------
11342
+ /**
11343
+ * 添加事件监听
11344
+ * @returns
11345
+ */
11346
+ _proto._addEventListener=function(){this._$canvas&&(
11347
+ // 事件监听
11348
+ this._$canvas.addEventListener("mousemove",this._mousemoveFun),
11349
+ // prettier-ignore
11350
+ this._$canvas.addEventListener("mouseover",this._mouseoverFun),
11351
+ // prettier-ignore
11352
+ this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),
11353
+ // prettier-ignore
11354
+ this._$canvas.addEventListener("mousedown",this._mousedownFun),
11355
+ // prettier-ignore
11356
+ this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),
11357
+ // prettier-ignore
11358
+ this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),
11359
+ // ctrl 键事件
11360
+ document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},
11361
+ /**
11362
+ * 移除事件监听
11363
+ * @returns
11364
+ */
11365
+ _proto._removeEventListener=function(){this._$canvas&&(
11366
+ // 事件监听
11367
+ this._$canvas.removeEventListener("mousemove",this._mousemoveFun),
11368
+ // prettier-ignore
11369
+ this._$canvas.removeEventListener("mouseover",this._mouseoverFun),
11370
+ // prettier-ignore
11371
+ this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),
11372
+ // prettier-ignore
11373
+ this._$canvas.removeEventListener("mousedown",this._mousedownFun),
11374
+ // prettier-ignore
11375
+ this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),
11376
+ // ctrl 键事件
11377
+ document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),
11378
+ // touch
11379
+ this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},
11380
+ /**
11381
+ * 鼠标按下事件监听
11382
+ * @param e - 鼠标事件
11383
+ * @returns
11384
+ */
11385
+ _proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},
11386
+ /**
11387
+ * 鼠标移入事件监听
11388
+ * @returns
11389
+ */
11390
+ _proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},
11391
+ /**
11392
+ * 鼠标离开事件监听
11393
+ * @returns
11394
+ */
11395
+ _proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},
11396
+ /**
11397
+ * 鼠标抬起事件监听
11398
+ * @returns
11399
+ */
11400
+ _proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},
11401
+ /**
11402
+ * 鼠标移动事件监听
11403
+ * @param e - 鼠标事件
11404
+ * @returns
11405
+ */
11406
+ _proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)
11407
+ // 鼠标按下位置和移动位置的偏移量
11408
+ this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}
11409
+ // const time = new Date(
11410
+ // // prettier-ignore
11411
+ // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
11412
+ // );
11413
+ },
11414
+ /**
11415
+ * 鼠标滚轮滚动
11416
+ * @param e - 鼠标滚轮滚动事件
11417
+ * @returns
11418
+ */
11419
+ _proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},
11420
+ /**
11421
+ * ctrl键按下事件
11422
+ * @param e - 键盘按下事件
11423
+ */
11424
+ _proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},
11425
+ /**
11426
+ * ctrl键抬起事件
11427
+ * @param e - 键盘按下事件
11428
+ */
11429
+ _proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},
11430
+ // ----------------------------------------------------------------------
11431
+ // touch
11432
+ // ----------------------------------------------------------------------
11433
+ /**
11434
+ * 触摸距离
11435
+ * @param touches - 两指触摸点
11436
+ * @returns
11437
+ */
11438
+ _proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},
11439
+ /**
11440
+ * 触摸开始
11441
+ * @param e - 触摸事件
11442
+ * @returns
11443
+ */
11444
+ _proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){
11445
+ // 单指
11446
+ var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(
11447
+ // 双指
11448
+ this._lastTouchDist=this._getTouchDistance(e.touches));},
11449
+ /**
11450
+ * 触摸移动
11451
+ * @param e - 触摸事件
11452
+ * @returns
11453
+ */
11454
+ _proto._touchmoveFun=function(e){if(e.preventDefault(),// 防止页面缩放
11455
+ e.stopPropagation(),!this.readOnly)if(1===e.touches.length){
11456
+ // 单指
11457
+ var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){
11458
+ // 双指
11459
+ this._getTouchDistance(e.touches);this._lastTouchDist;}},
11460
+ /**
11461
+ * 触摸结束
11462
+ * @param e - 触摸事件
11463
+ * @returns
11464
+ */
11465
+ _proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},
11466
+ /**
11467
+ * 拖动结束
11468
+ * @returns
11469
+ */
11470
+ _proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},
11471
+ /**
11472
+ * 移动更新时间
11473
+ * @param x - 移动的x坐标
11474
+ * @returns
11475
+ */
11476
+ _proto._moveUpdateFun=function(x){
11477
+ // 鼠标按下位置和移动位置的偏移量
11478
+ var mouseOffset=this._mousePosition-x;
11479
+ // fix点击引起mousemove的问题
11480
+ if(0!==mouseOffset){if(this._oldTime){
11481
+ // prettier-ignore
11482
+ var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:// -----------------------------------------------------------------------------------------
11483
+ // private
11484
+ // -----------------------------------------------------------------------------------------
11485
+ /**
11486
+ * 缩放时间轴 动态减少间距 (没处理 dpr)
11487
+ * @returns 刻度间距
11488
+ */
11489
+ function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2));// 刻度间距
11490
+ }}]),TimeLine}(BaseTimeLine);
11491
+ /**
11492
+ * 时间轴控件类, 支持PC/Mobile 拖动和缩放
11493
+ * @beta
11494
+ * @example
11495
+ * ```ts
11496
+ * import TimeLine from './TimeLine';
11497
+ * const timeLine = new TimeLine(document.getElementById('container'), {})
11498
+ * ```
11499
+ */TimeLine.TIME_WIDTH=TIME_WIDTH;var index={MobileTimeLine:MobileTimeLine,TimeLine:TimeLine,BaseTimeLine:BaseTimeLine};exports.BaseTimeLine=BaseTimeLine,exports.MobileTimeLine=MobileTimeLine,exports.TimeLine=TimeLine,module.exports=index;
11500
+ } (dist$1, dist$1.exports));
11501
+ return dist$1.exports;
10595
11502
  }
10596
- /**
10597
- * ctrl键按下事件
10598
- * @param e - 键盘按下事件
10599
- */_ctrlKeyDownFun(e){if(e.ctrlKey||e.key==="Control"){console.log("Ctrl 键被按下");this._isCtrlKeyDown=true;}}
10600
- /**
10601
- * ctrl键抬起事件
10602
- * @param e - 键盘按下事件
10603
- */_ctrlKeyUpFun(e){if(e.ctrlKey||e.key==="Control"){console.log("Ctrl 键UP");this._isCtrlKeyDown=false;}}
10604
- // ----------------------------------------------------------------------
10605
- // touch
10606
- // ----------------------------------------------------------------------
10607
- /**
10608
- * 触摸距离
10609
- * @param touches - 两指触摸点
10610
- * @returns
10611
- */
10612
- _getTouchDistance(touches){const[touch1,touch2]=touches;const dx=touch2.clientX-touch1.clientX;const dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)}
10613
- /**
10614
- * 触摸开始
10615
- * @param e - 触摸事件
10616
- * @returns
10617
- */_touchstartFun(e){if(this.readOnly)return;this._oldTime=this.current;this._isOver=true;if(e.touches.length===1){
10618
- // 单指
10619
- const touch=e.touches[0];this._isMouseDown=true;this._mousePosition=touch.clientX;
10620
- // this._touchmoveFun(e);
10621
- }else if(e.touches.length===2){
10622
- // 双指
10623
- this._lastTouchDist=this._getTouchDistance(e.touches);console.warn("_touchstartFun",this._lastTouchDist);}}
10624
- /**
10625
- * 触摸移动
10626
- * @param e - 触摸事件
10627
- * @returns
10628
- */_touchmoveFun(e){e.preventDefault();// 防止页面缩放
10629
- e.stopPropagation();if(this.readOnly)return;console.warn(e.touches.length);if(e.touches.length===1){
10630
- // 单指
10631
- const touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(e.touches.length===2){
10632
- // 双指
10633
- const newDist=this._getTouchDistance(e.touches);const zoom=newDist/this._lastTouchDist;console.warn("_touchmoveFun",this._lastTouchDist,zoom);
10634
- // scale *= zoom;
10635
- // // 限制缩放范围
10636
- // scale = Math.max(0.5, Math.min(3, scale));
10637
- // img.style.transform = `scale(${scale})`;
10638
- // lastDist = newDist;
10639
- }}
10640
- /**
10641
- * 触摸结束
10642
- * @param e - 触摸事件
10643
- * @returns
10644
- */_touchendFun(e){if(this.readOnly)return;this._moveEndOrTouchEndFun(e);}
10645
- /**
10646
- * 拖动结束
10647
- * @returns
10648
- */_moveEndOrTouchEndFun(e){e.preventDefault();if(this.readOnly)return;if(this._isMouseDown){this._isMouseDown=false;if(this._moved){this._moved=false;this._update({current:this.current});this._oldTime=this.current;this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.current,this._isOver);}if(this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5)this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.current);this._mousePosition=0;this._lastTouchDist=0;}}
10649
- /**
10650
- * 移动更新时间
10651
- * @param x - 移动的x坐标
10652
- * @returns
10653
- */_moveUpdateFun(x){
10654
- // 鼠标按下位置和移动位置的偏移量
10655
- const mouseOffset=this._mousePosition-x;
10656
- // fix点击引起mousemove的问题
10657
- if(mouseOffset===0)return;if(this._oldTime){
10658
- // prettier-ignore
10659
- const currentTime=this._oldTime.getTime()+parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10)*1e3;this._update({current:new Date(currentTime)});this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}constructor(container,options){super(container,deepmerge(TIMELINE_DEFAULT_OPTIONS,options,{clone:true})),this._$canvas=null,this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */this._timeWidthArray=TIME_WIDTH[0],this._centerPositionX=0,// mouse
10660
- this._isMouseDown=false,this._mousePosition=0,this._oldTime=null,this._isOver=false,this._moved=false,this._isCtrlKeyDown=false,this._lastTouchDist=0;this.$container=container;
10661
- // prettier-ignore
10662
- console.log("TimeLine dpr",JSON.stringify(this.options));this._mousemoveFun=this._mousemoveFun.bind(this);this._mouseoverFun=this._mouseoverFun.bind(this);this._mouseleaveFun=this._mouseleaveFun.bind(this);this._mousedownFun=this._mousedownFun.bind(this);this._mouseUpFun=this._mouseUpFun.bind(this);this._mousewheelFun=this._mousewheelFun.bind(this);this._touchstartFun=this._touchstartFun.bind(this);this._touchmoveFun=this._touchmoveFun.bind(this);this._touchendFun=this._touchendFun.bind(this);this._ctrlKeyDownFun=this._ctrlKeyDownFun.bind(this);this._ctrlKeyUpFun=this._ctrlKeyUpFun.bind(this);this._init();}}TimeLine.TIME_WIDTH=TIME_WIDTH;
11503
+
11504
+ var distExports = requireDist();
10663
11505
 
10664
11506
  function _extends$4() {
10665
11507
  _extends$4 = Object.assign || function(target) {
@@ -10706,7 +11548,8 @@
10706
11548
  tagName: 'div',
10707
11549
  controlType: 'block',
10708
11550
  classNameSuffix: 'time-line'
10709
- })) || this, _this._$add = null, _this._$reduce = null, _this.records = [];
11551
+ })) || this, _this._$add = null, _this._$reduce = null, _this._currentTime = 0, _this.records = [];
11552
+ _this._currentTime = 0;
10710
11553
  _this._options = options;
10711
11554
  _this.records = ((_this__options = _this._options) == null ? void 0 : (_this__options_props = _this__options.props) == null ? void 0 : _this__options_props.recordList) || [];
10712
11555
  _this._render();
@@ -10717,9 +11560,13 @@
10717
11560
  (_this_timeLineUtil = _this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, records);
10718
11561
  });
10719
11562
  _this.on(EVENTS.getOSDTime, function(time) {
10720
- var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10721
- _this_timeLineUtil_update, _this_timeLineUtil;
10722
- (_this_timeLineUtil = _this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, new Date(time * 1000));
11563
+ if (time) {
11564
+ var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11565
+ _this_timeLineUtil_update, _this_timeLineUtil;
11566
+ var date = new Date(time * 1000);
11567
+ _this._currentTime = date.getTime();
11568
+ (_this_timeLineUtil = _this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, date);
11569
+ }
10723
11570
  });
10724
11571
  return _this;
10725
11572
  }
@@ -10728,10 +11575,16 @@
10728
11575
  var _this = this;
10729
11576
  var _this_timeLineUtil_updateTimeSections, _this_timeLineUtil;
10730
11577
  var _timeLineOptions = {
10731
- // locale: this._options.locale,
11578
+ language: this._options.language || 'zh',
11579
+ coverQuery: this._options.coverQuery || '',
10732
11580
  onChange: function(date) {
10733
- _this._options.onChange == null ? void 0 : _this._options.onChange.call(_this._options, date);
10734
- _this.emit(EVENTS.control.timeLineChange, date);
11581
+ if (_this._currentTime !== (date == null ? void 0 : date.getTime())) {
11582
+ _this._options.onChange == null ? void 0 : _this._options.onChange.call(_this._options, date);
11583
+ _this.emit(EVENTS.control.timeLineChange, date);
11584
+ }
11585
+ },
11586
+ onPickerOpenChange: function(open) {
11587
+ _this.emit(EVENTS.control.timeLinePanelOpenChange, open);
10735
11588
  },
10736
11589
  // 2025-10-27 仅移动端支持
10737
11590
  onPickerSelect: function(item) {
@@ -10746,17 +11599,17 @@
10746
11599
  }
10747
11600
  }
10748
11601
  };
10749
- if (isMobile$1()) {
10750
- this.timeLineUtil = new MobileTimeLine(this.$container, _timeLineOptions);
11602
+ if (distExports$3.isMobile()) {
11603
+ this.timeLineUtil = new distExports.MobileTimeLine(this.$container, _timeLineOptions);
10751
11604
  } else {
10752
- this.timeLineUtil = new TimeLine(this.$container, _timeLineOptions);
11605
+ this.timeLineUtil = new distExports.TimeLine(this.$container, _timeLineOptions);
10753
11606
  this._renderAddReduce();
10754
11607
  }
10755
11608
  (_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, this.records);
10756
11609
  this.timeLineUtil.update(new Date());
10757
11610
  };
10758
11611
  _proto.setWidth = function setWidth(width) {
10759
- if (!isMobile$1()) this.timeLineUtil.resize(width);
11612
+ if (!distExports$3.isMobile()) this.timeLineUtil.resize(width);
10760
11613
  };
10761
11614
  _proto._renderAddReduce = function _renderAddReduce() {
10762
11615
  var _this = this;
@@ -10891,7 +11744,7 @@
10891
11744
  globalFullscreen: GlobalFullscreen,
10892
11745
  rec: Rec,
10893
11746
  speed: Speed,
10894
- date: DatePicker,
11747
+ date: DatePickerControl,
10895
11748
  timeLine: TimeLineControl
10896
11749
  };
10897
11750
 
@@ -11546,7 +12399,7 @@
11546
12399
  if (theme.options.posterOptions !== null) {
11547
12400
  theme.posterControl = new Poster(_extends$1({}, theme.options.posterOptions || {}, {
11548
12401
  getPopupContainer: function() {
11549
- return theme.contentControl.$content;
12402
+ return theme.contentControl.$video;
11550
12403
  }
11551
12404
  }));
11552
12405
  }
@@ -11691,14 +12544,15 @@
11691
12544
  var _renderTimeLine = function(theme, container, props) {
11692
12545
  if (props === void 0) props = {};
11693
12546
  if (!theme.controls.timeLineControl && theme.options.timeLineOptions !== null) {
11694
- var _theme_options;
12547
+ var _theme_urlInfo, _theme_options;
11695
12548
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11696
12549
  theme.controls.timeLineControl = new Controls['timeLine'](_extends$1({
11697
12550
  getPopupContainer: function() {
11698
12551
  return container;
11699
12552
  },
11700
12553
  language: theme.options.language,
11701
- locales: theme.i18n.translations
12554
+ locales: theme.i18n.translations,
12555
+ coverQuery: ((_theme_urlInfo = theme.urlInfo) == null ? void 0 : _theme_urlInfo.validateCode) ? "decodekey=" + theme.urlInfo.validateCode : ''
11702
12556
  }, ((_theme_options = theme.options) == null ? void 0 : _theme_options["timeLineOptions"]) || {}, {
11703
12557
  props: props
11704
12558
  }));
@@ -11945,6 +12799,7 @@
11945
12799
  dblClickFullscreen: true,
11946
12800
  language: 'zh',
11947
12801
  autoPlay: true,
12802
+ scaleMode: THEME_SCALE_MODE_TYPE.full,
11948
12803
  loggerOptions: {
11949
12804
  level: 'INFO',
11950
12805
  showTime: true
@@ -12013,11 +12868,11 @@
12013
12868
  */ _this._footerMoreControl = null, /** 头部控件 @since 0.0.1 @private */ _this._header = null, /** 低部控件 @since 0.0.1 @private */ _this._footer = null, /** 回放底部时间轴 @since 0.0.1 @private */ _this._recFooter = null, /**
12014
12869
  * 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
12015
12870
  * @private
12016
- */ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null;
12871
+ */ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
12017
12872
  _this._initOptions(options);
12018
12873
  if (_this.options.type === 'ezopen') {
12019
12874
  var _this_urlInfo_searchParams, _this_urlInfo;
12020
- _this.urlInfo = parseEzopenUrl(_this.options.url);
12875
+ _this.urlInfo = distExports$3.parseEzopenUrl(_this.options.url);
12021
12876
  if ((_this_urlInfo = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams = _this_urlInfo.searchParams) == null ? void 0 : _this_urlInfo_searchParams.spaceId) {
12022
12877
  _this.options.spaceId = _this.urlInfo.searchParams.spaceId;
12023
12878
  }
@@ -12037,7 +12892,8 @@
12037
12892
  _this.contentControl = new Content({
12038
12893
  getContainer: function() {
12039
12894
  return _this.$container;
12040
- }
12895
+ },
12896
+ scaleMode: _this.scaleMode
12041
12897
  });
12042
12898
  // zoom utils
12043
12899
  __zoom(_this, _this.contentControl.$content, _extends({}, _this.options.zoomOptions || {}, {
@@ -12198,6 +13054,38 @@
12198
13054
  (_this = this) == null ? void 0 : _this.emit(EVENTS.setLoggerOptions, options);
12199
13055
  };
12200
13056
  /**
13057
+ * 设置视频画面缩放模式
13058
+ * @since 1.0.1
13059
+ * @param {0 | 1 | 2} scaleMode - 缩放模式, 0: 窗口铺满, 1: 等比缩放大边铺满, 2: 等比缩放小边铺满
13060
+ */ _proto.setScaleMode = function setScaleMode(scaleMode) {
13061
+ if ([
13062
+ 0,
13063
+ 1,
13064
+ 2
13065
+ ].includes(+scaleMode)) {
13066
+ var _this_contentControl_setScaleMode, _this_contentControl;
13067
+ this.scaleMode = +scaleMode;
13068
+ (_this_contentControl = this.contentControl) == null ? void 0 : (_this_contentControl_setScaleMode = _this_contentControl.setScaleMode) == null ? void 0 : _this_contentControl_setScaleMode.call(_this_contentControl, +scaleMode);
13069
+ var classList = this.$container.classList;
13070
+ for(var _iterator = _create_for_of_iterator_helper_loose(classList), _step; !(_step = _iterator()).done;){
13071
+ var item = _step.value;
13072
+ if (item.startsWith("" + PREFIX_CLASS + "-scale-mode-")) {
13073
+ classList.remove(item);
13074
+ }
13075
+ }
13076
+ if (this.scaleMode === 0) {
13077
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-full");
13078
+ } else if (this.scaleMode === 1) {
13079
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-auto");
13080
+ } else if (this.scaleMode === 2) {
13081
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-full-auto");
13082
+ }
13083
+ } else {
13084
+ var _this_logger;
13085
+ (_this_logger = this.logger) == null ? void 0 : _this_logger.warn('scaleMode must be 0 | 1 | 2');
13086
+ }
13087
+ };
13088
+ /**
12201
13089
  * 销毁包括事件、控件 ...
12202
13090
  *
12203
13091
  * Destroy (including events, controls...)
@@ -12248,7 +13136,7 @@
12248
13136
  // ==============================================================================================
12249
13137
  /** 初始化配置项 */ _proto._initOptions = function _initOptions(options) {
12250
13138
  if (options === void 0) options = {};
12251
- var _this_options_loggerOptions;
13139
+ var _this_options_loggerOptions, _this_options_definitionOptions_list, _this_options_definitionOptions, _this_options_videoLevelList;
12252
13140
  this.options = deepmerge(THEME_DEFAULT_OPTIONS, options, {
12253
13141
  clone: false
12254
13142
  });
@@ -12262,7 +13150,7 @@
12262
13150
  }
12263
13151
  if (!this.$container) throw new Error('container option is required!');
12264
13152
  if ([
12265
- 'VIDOE',
13153
+ 'VIDEO',
12266
13154
  'CANVAS'
12267
13155
  ].includes(this.$container.tagName)) {
12268
13156
  throw new Error('container node cannot be video or canvas!');
@@ -12273,11 +13161,19 @@
12273
13161
  }));
12274
13162
  this.logger.log(navigator.userAgent || 'unknown');
12275
13163
  this.logger.log('[Theme Version] ', Theme.THEME_VERSION);
12276
- this.logger.log(JSON.stringify(this.options));
13164
+ if ('container' in this.options) {
13165
+ // JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
13166
+ delete this.options.container;
13167
+ }
13168
+ try {
13169
+ this.logger.log('[options] \n', JSON.stringify(this.options));
13170
+ } catch (error) {
13171
+ this.logger.log('[options] \n', this.options);
13172
+ }
12277
13173
  var language = this.options.language || 'zh';
12278
13174
  var locales = deepmerge({
12279
- zh: zh$1,
12280
- en: en$1
13175
+ zh: zh,
13176
+ en: en
12281
13177
  }, this.options.locales || {}, {
12282
13178
  clone: false
12283
13179
  });
@@ -12285,6 +13181,12 @@
12285
13181
  this.i18n = new I18n(locales, {
12286
13182
  defaultLocale: language
12287
13183
  });
13184
+ // 默认清晰度列表
13185
+ if (((_this_options_definitionOptions = this.options.definitionOptions) == null ? void 0 : (_this_options_definitionOptions_list = _this_options_definitionOptions.list) == null ? void 0 : _this_options_definitionOptions_list.length) > 0 || ((_this_options_videoLevelList = this.options.videoLevelList) == null ? void 0 : _this_options_videoLevelList.length) > 0) {
13186
+ var _this_options_definitionOptions1;
13187
+ this.videoLevelList = ((_this_options_definitionOptions1 = this.options.definitionOptions) == null ? void 0 : _this_options_definitionOptions1.list) || this.options.videoLevelList;
13188
+ }
13189
+ this.setScaleMode(this.options.scaleMode);
12288
13190
  };
12289
13191
  /**
12290
13192
  * 初始化设置类名和设置宽高
@@ -12720,7 +13622,7 @@
12720
13622
  };
12721
13623
  _proto._getRecType = function _getRecType(url) {
12722
13624
  if (this.options.type === 'ezopen' && /^ezopen:\/\//.test(url)) {
12723
- var urlInfo = parseEzopenUrl(url);
13625
+ var urlInfo = distExports$3.parseEzopenUrl(url);
12724
13626
  if (urlInfo.type === 'rec') {
12725
13627
  var _urlInfo_searchParams;
12726
13628
  if (urlInfo.recType === 'cloud' && (urlInfo == null ? void 0 : (_urlInfo_searchParams = urlInfo.searchParams) == null ? void 0 : _urlInfo_searchParams.busType) === '7') {
@@ -13176,10 +14078,10 @@
13176
14078
  /** 所有私有流的模板 @since 0.0.1 */ Theme.TEMPLATES = TEMPLATES;
13177
14079
  /** 事件名称 @since 0.0.1 */ Theme.EVENTS = EVENTS;
13178
14080
  /** 语言包 @since 0.0.1 */ Theme.LOCALES = {
13179
- zh: zh$1,
13180
- en: en$1
14081
+ zh: zh,
14082
+ en: en
13181
14083
  };
13182
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.0-beta.1';
14084
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.1-alpha.0';
13183
14085
 
13184
14086
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
13185
14087