@netless/telebox-insider 0.3.0-beta.5 → 0.3.0-beta.7

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.
@@ -1,31 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var fancyScrollbar = ".tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}";
21
- var style$3 = '.telebox-box {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n transition: width 0.4s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.4s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.4s ease;\n}\n\n.telebox-box-main {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: #f9f9fc;\n box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);\n border-radius: 6px;\n border: 1px solid #e3e3ec;\n}\n\n.telebox-titlebar-wrap {\n flex-shrink: 0;\n position: relative;\n z-index: 1;\n}\n\n.telebox-content-wrap {\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n}\n\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n\n.telebox-resize-handle {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: absolute;\n z-index: 2147483647;\n}\n\n.telebox-n {\n width: 100%;\n height: 5px;\n left: 0;\n top: -5px;\n cursor: n-resize;\n}\n\n.telebox-s {\n width: 100%;\n height: 5px;\n left: 0;\n bottom: -5px;\n cursor: s-resize;\n}\n\n.telebox-w {\n width: 5px;\n height: 100%;\n left: -5px;\n top: 0;\n cursor: w-resize;\n}\n\n.telebox-e {\n width: 5px;\n height: 100%;\n right: -5px;\n top: 0;\n cursor: e-resize;\n}\n\n.telebox-nw {\n width: 15px;\n height: 15px;\n top: -5px;\n left: -5px;\n cursor: nw-resize;\n}\n\n.telebox-ne {\n width: 15px;\n height: 15px;\n top: -5px;\n right: -5px;\n cursor: ne-resize;\n}\n\n.telebox-se {\n width: 15px;\n height: 15px;\n bottom: -5px;\n right: -5px;\n cursor: se-resize;\n}\n\n.telebox-sw {\n width: 15px;\n height: 15px;\n bottom: -5px;\n left: -5px;\n cursor: sw-resize;\n}\n\n.telebox-track-mask {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 2147483647;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.0001);\n cursor: move;\n}\n\n.telebox-cursor-n {\n cursor: n-resize;\n}\n\n.telebox-cursor-s {\n cursor: s-resize;\n}\n\n.telebox-cursor-w {\n cursor: w-resize;\n}\n\n.telebox-cursor-e {\n cursor: e-resize;\n}\n\n.telebox-cursor-nw {\n cursor: nw-resize;\n}\n\n.telebox-cursor-ne {\n cursor: ne-resize;\n}\n\n.telebox-cursor-se {\n cursor: se-resize;\n}\n\n.telebox-cursor-sw {\n cursor: sw-resize;\n}\n\n.telebox-maximized .telebox-resize-handles,\n.telebox-no-resize .telebox-resize-handles {\n display: none;\n}\n\n.telebox-maximized {\n box-shadow: none;\n transition: none;\n}\n\n.telebox-minimized {\n transition: width 0.05s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.05s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.6s ease;\n opacity: 0;\n pointer-events: none;\n user-select: none;\n}\n\n.telebox-transforming {\n will-change: transform;\n transition: opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0);\n}\n\n.telebox-readonly .telebox-resize-handle {\n cursor: initial !important;\n pointer-events: none !important;\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark .telebox-box-main {\n color: #e9e9e9;\n background: #212126;\n border-color: #43434d;\n}';
1
+ var fancyScrollbar = "";
2
+ var style$4 = "";
22
3
  var eventemitter3 = { exports: {} };
23
4
  (function(module) {
24
5
  var has = Object.prototype.hasOwnProperty, prefix = "~";
25
6
  function Events() {
26
7
  }
27
8
  if (Object.create) {
28
- Events.prototype = Object.create(null);
9
+ Events.prototype = /* @__PURE__ */ Object.create(null);
29
10
  if (!new Events().__proto__)
30
11
  prefix = false;
31
12
  }
@@ -211,8 +192,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
211
192
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
212
193
  PERFORMANCE OF THIS SOFTWARE.
213
194
  ***************************************************************************** */
214
- var __assign$1 = function() {
215
- __assign$1 = Object.assign || function __assign2(t2) {
195
+ var __assign = function() {
196
+ __assign = Object.assign || function __assign2(t2) {
216
197
  for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
217
198
  s2 = arguments[i2];
218
199
  for (var p in s2)
@@ -221,7 +202,7 @@ var __assign$1 = function() {
221
202
  }
222
203
  return t2;
223
204
  };
224
- return __assign$1.apply(this, arguments);
205
+ return __assign.apply(this, arguments);
225
206
  };
226
207
  function __rest(s2, e2) {
227
208
  var t2 = {};
@@ -252,8 +233,8 @@ var createStep = function(setRunNextFrame) {
252
233
  var numThisFrame = 0;
253
234
  var isProcessing2 = false;
254
235
  var i2 = 0;
255
- var cancelled = new WeakSet();
256
- var toKeepAlive = new WeakSet();
236
+ var cancelled = /* @__PURE__ */ new WeakSet();
237
+ var toKeepAlive = /* @__PURE__ */ new WeakSet();
257
238
  var renderStep = {
258
239
  cancel: function(process) {
259
240
  var indexOfCallback = processToRunNextFrame.indexOf(process);
@@ -358,32 +339,6 @@ var startLoop = function() {
358
339
  if (!isProcessing)
359
340
  onNextFrame(processFrame);
360
341
  };
361
- /*! *****************************************************************************
362
- Copyright (c) Microsoft Corporation.
363
-
364
- Permission to use, copy, modify, and/or distribute this software for any
365
- purpose with or without fee is hereby granted.
366
-
367
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
368
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
369
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
370
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
371
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
372
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
373
- PERFORMANCE OF THIS SOFTWARE.
374
- ***************************************************************************** */
375
- var __assign = function() {
376
- __assign = Object.assign || function __assign2(t2) {
377
- for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
378
- s2 = arguments[i2];
379
- for (var p in s2)
380
- if (Object.prototype.hasOwnProperty.call(s2, p))
381
- t2[p] = s2[p];
382
- }
383
- return t2;
384
- };
385
- return __assign.apply(this, arguments);
386
- };
387
342
  var clamp$1 = function(min, max) {
388
343
  return function(v) {
389
344
  return Math.max(Math.min(v, max), min);
@@ -541,7 +496,7 @@ var color = {
541
496
  }
542
497
  };
543
498
  var createStyler = function(_a) {
544
- var onRead2 = _a.onRead, onRender2 = _a.onRender, _b = _a.uncachedValues, uncachedValues = _b === void 0 ? new Set() : _b, _c = _a.useCache, useCache = _c === void 0 ? true : _c;
499
+ var onRead2 = _a.onRead, onRender2 = _a.onRender, _b = _a.uncachedValues, uncachedValues = _b === void 0 ? /* @__PURE__ */ new Set() : _b, _c = _a.useCache, useCache = _c === void 0 ? true : _c;
545
500
  return function(_a2) {
546
501
  if (_a2 === void 0) {
547
502
  _a2 = {};
@@ -624,7 +579,7 @@ var testPrefix = function(key) {
624
579
  return;
625
580
  }
626
581
  camelCache.set(key, prefixedPropertyName);
627
- setDashPrefix(key, "" + (noPrefix ? "" : "-") + camelToDash(prefixedPropertyName));
582
+ setDashPrefix(key, (noPrefix ? "" : "-") + camelToDash(prefixedPropertyName));
628
583
  }
629
584
  }
630
585
  };
@@ -663,7 +618,7 @@ var transformOriginProps = /* @__PURE__ */ new Set(["originX", "originY", "origi
663
618
  function isTransformOriginProp(key) {
664
619
  return transformOriginProps.has(key);
665
620
  }
666
- var int = /* @__PURE__ */ __assign$1(/* @__PURE__ */ __assign$1({}, number), { transform: Math.round });
621
+ var int = /* @__PURE__ */ __assign(/* @__PURE__ */ __assign({}, number), { transform: Math.round });
667
622
  var valueTypes = {
668
623
  color,
669
624
  backgroundColor: color,
@@ -882,7 +837,7 @@ function createCssStyler(element, _a) {
882
837
  _a = {};
883
838
  }
884
839
  var enableHardwareAcceleration = _a.enableHardwareAcceleration, allowTransformNone = _a.allowTransformNone, props = __rest(_a, ["enableHardwareAcceleration", "allowTransformNone"]);
885
- return cssStyler(__assign$1({ element, buildStyles: createStyleBuilder({
840
+ return cssStyler(__assign({ element, buildStyles: createStyleBuilder({
886
841
  enableHardwareAcceleration,
887
842
  allowTransformNone
888
843
  }), preparseOutput: true }, props));
@@ -1072,7 +1027,7 @@ const e$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop
1072
1027
  };
1073
1028
  class o {
1074
1029
  constructor() {
1075
- this.disposers = new Map();
1030
+ this.disposers = /* @__PURE__ */ new Map();
1076
1031
  }
1077
1032
  add(e2, s2 = r$1()) {
1078
1033
  return this.flush(s2), this.disposers.set(s2, e2()), s2;
@@ -1120,9 +1075,9 @@ class o {
1120
1075
  }), this.disposers.clear();
1121
1076
  }
1122
1077
  }
1123
- var e = Object.defineProperty, s = (typeof require != "undefined" && require, (s2, r2, t2) => (((s3, r3, t3) => {
1078
+ var e = Object.defineProperty, s = ("undefined" != typeof require && require, (s2, r2, t2) => (((s3, r3, t3) => {
1124
1079
  r3 in s3 ? e(s3, r3, { enumerable: true, configurable: true, writable: true, value: t3 }) : s3[r3] = t3;
1125
- })(s2, typeof r2 != "symbol" ? r2 + "" : r2, t2), t2));
1080
+ })(s2, "symbol" != typeof r2 ? r2 + "" : r2, t2), t2));
1126
1081
  class r {
1127
1082
  constructor(e2, r2) {
1128
1083
  s(this, "_value"), s(this, "_beforeDestroys"), s(this, "_subscribers"), this._value = e2, r2 && (this.compare = r2);
@@ -1137,7 +1092,7 @@ class r {
1137
1092
  }
1138
1093
  }
1139
1094
  reaction(e2) {
1140
- return this._subscribers || (this._subscribers = new Set()), this._subscribers.add(e2), () => {
1095
+ return this._subscribers || (this._subscribers = /* @__PURE__ */ new Set()), this._subscribers.add(e2), () => {
1141
1096
  this._subscribers && this._subscribers.delete(e2);
1142
1097
  };
1143
1098
  }
@@ -1155,7 +1110,7 @@ class r {
1155
1110
  this._beforeDestroys && (this._beforeDestroys.forEach((e2) => e2()), this._beforeDestroys.clear()), this._subscribers && this._subscribers.clear();
1156
1111
  }
1157
1112
  addBeforeDestroy(e2) {
1158
- return this._beforeDestroys || (this._beforeDestroys = new Set()), this._beforeDestroys.add(e2), () => {
1113
+ return this._beforeDestroys || (this._beforeDestroys = /* @__PURE__ */ new Set()), this._beforeDestroys.add(e2), () => {
1159
1114
  this._beforeDestroys && this._beforeDestroys.delete(e2);
1160
1115
  };
1161
1116
  }
@@ -1196,21 +1151,20 @@ function c(e2) {
1196
1151
  };
1197
1152
  return { bindSideEffect: s2, combine: (e3, r2, i2, o2) => s2(t(e3, r2, i2, o2)), createVal: (e3, t2) => s2(new r(e3, t2)) };
1198
1153
  }
1199
- var style$2 = '.telebox-titlebar {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n box-sizing: border-box;\n height: 26px;\n display: flex;\n align-items: center;\n background: #fff;\n user-select: none;\n border-bottom: 1px solid #eeeef7;\n touch-action: manipulation;\n}\n\n.telebox-title-area {\n padding-left: 16px;\n overflow: hidden;\n position: relative;\n height: 100%;\n flex: 1;\n display: flex;\n align-items: center;\n}\n\n.telebox-title {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n overflow: hidden;\n margin: 0;\n padding: 0;\n font-size: 14px;\n font-weight: 400;\n font-family: PingFangSC-Regular, PingFang SC;\n white-space: nowrap;\n word-break: keep-all;\n text-overflow: ellipsis;\n color: #191919;\n}\n\n.telebox-drag-area {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: auto;\n z-index: 10;\n}\n\n.telebox-titlebar-btns {\n position: absolute;\n right: 16px;\n white-space: nowrap;\n word-break: keep-all;\n margin-left: auto;\n font-size: 0;\n z-index: 10;\n}\n\n.telebox-titlebar-btn {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n width: 22px;\n height: 22px;\n padding: 0;\n outline: none;\n border: none;\n background: transparent;\n cursor: pointer;\n}\n\n.telebox-titlebar-btn ~ .telebox-titlebar-btn {\n margin-left: 10px;\n}\n\n.telebox-titlebar-btn-icon {\n width: 22px;\n height: 22px;\n}\n\n.telebox-readonly .telebox-titlebar-btn {\n cursor: not-allowed;\n}\n\n.telebox-titlebar-icon-minimize {\n background: center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=");\n}\n\n.telebox-titlebar-icon-maximize {\n background: center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==");\n}\n\n.telebox-titlebar-icon-maximize.is-active {\n background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K");\n}\n\n.telebox-titlebar-icon-close {\n background: center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=");\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark .telebox-title {\n color: #e9e9e9;\n}\n\n.telebox-color-scheme-dark .telebox-titlebar {\n color: #e9e9e9;\n background: #43434d;\n border-bottom: none;\n}';
1200
- var TELE_BOX_COLOR_SCHEME;
1201
- (function(TELE_BOX_COLOR_SCHEME2) {
1154
+ var style$3 = "";
1155
+ var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
1202
1156
  TELE_BOX_COLOR_SCHEME2["Light"] = "light";
1203
1157
  TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
1204
1158
  TELE_BOX_COLOR_SCHEME2["Auto"] = "auto";
1205
- })(TELE_BOX_COLOR_SCHEME || (TELE_BOX_COLOR_SCHEME = {}));
1206
- var TELE_BOX_STATE;
1207
- (function(TELE_BOX_STATE2) {
1159
+ return TELE_BOX_COLOR_SCHEME2;
1160
+ })(TELE_BOX_COLOR_SCHEME || {});
1161
+ var TELE_BOX_STATE = /* @__PURE__ */ ((TELE_BOX_STATE2) => {
1208
1162
  TELE_BOX_STATE2["Normal"] = "normal";
1209
1163
  TELE_BOX_STATE2["Minimized"] = "minimized";
1210
1164
  TELE_BOX_STATE2["Maximized"] = "maximized";
1211
- })(TELE_BOX_STATE || (TELE_BOX_STATE = {}));
1212
- var TELE_BOX_EVENT;
1213
- (function(TELE_BOX_EVENT2) {
1165
+ return TELE_BOX_STATE2;
1166
+ })(TELE_BOX_STATE || {});
1167
+ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
1214
1168
  TELE_BOX_EVENT2["DarkMode"] = "dark_mode";
1215
1169
  TELE_BOX_EVENT2["PrefersColorScheme"] = "prefers_color_scheme";
1216
1170
  TELE_BOX_EVENT2["Close"] = "close";
@@ -1229,15 +1183,15 @@ var TELE_BOX_EVENT;
1229
1183
  TELE_BOX_EVENT2["Destroyed"] = "destroyed";
1230
1184
  TELE_BOX_EVENT2["BoxStatus"] = "box_status";
1231
1185
  TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
1232
- })(TELE_BOX_EVENT || (TELE_BOX_EVENT = {}));
1233
- var TELE_BOX_DELEGATE_EVENT;
1234
- (function(TELE_BOX_DELEGATE_EVENT2) {
1186
+ return TELE_BOX_EVENT2;
1187
+ })(TELE_BOX_EVENT || {});
1188
+ var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
1235
1189
  TELE_BOX_DELEGATE_EVENT2["Close"] = "close";
1236
1190
  TELE_BOX_DELEGATE_EVENT2["Maximize"] = "maximize";
1237
1191
  TELE_BOX_DELEGATE_EVENT2["Minimize"] = "minimize";
1238
- })(TELE_BOX_DELEGATE_EVENT || (TELE_BOX_DELEGATE_EVENT = {}));
1239
- var TELE_BOX_RESIZE_HANDLE;
1240
- (function(TELE_BOX_RESIZE_HANDLE2) {
1192
+ return TELE_BOX_DELEGATE_EVENT2;
1193
+ })(TELE_BOX_DELEGATE_EVENT || {});
1194
+ var TELE_BOX_RESIZE_HANDLE = /* @__PURE__ */ ((TELE_BOX_RESIZE_HANDLE2) => {
1241
1195
  TELE_BOX_RESIZE_HANDLE2["North"] = "n";
1242
1196
  TELE_BOX_RESIZE_HANDLE2["South"] = "s";
1243
1197
  TELE_BOX_RESIZE_HANDLE2["West"] = "w";
@@ -1246,7 +1200,8 @@ var TELE_BOX_RESIZE_HANDLE;
1246
1200
  TELE_BOX_RESIZE_HANDLE2["NorthEast"] = "ne";
1247
1201
  TELE_BOX_RESIZE_HANDLE2["SouthEast"] = "se";
1248
1202
  TELE_BOX_RESIZE_HANDLE2["SouthWest"] = "sw";
1249
- })(TELE_BOX_RESIZE_HANDLE || (TELE_BOX_RESIZE_HANDLE = {}));
1203
+ return TELE_BOX_RESIZE_HANDLE2;
1204
+ })(TELE_BOX_RESIZE_HANDLE || {});
1250
1205
  const TeleBoxDragHandleType = "dh";
1251
1206
  function clamp(value, min, max) {
1252
1207
  return Math.min(Math.max(value, min), max);
@@ -1385,7 +1340,10 @@ class DefaultTitleBar {
1385
1340
  this.state = state;
1386
1341
  this.buttons.forEach((btn, i2) => {
1387
1342
  if (btn.isActive) {
1388
- this.$btns[i2].classList.toggle("is-active", btn.isActive(state));
1343
+ this.$btns[i2].classList.toggle(
1344
+ "is-active",
1345
+ btn.isActive(state)
1346
+ );
1389
1347
  }
1390
1348
  });
1391
1349
  }
@@ -1396,7 +1354,10 @@ class DefaultTitleBar {
1396
1354
  if (boxStatus) {
1397
1355
  this.buttons.forEach((btn, i2) => {
1398
1356
  if (btn.isActive) {
1399
- this.$btns[i2].classList.toggle("is-active", btn.isActive(boxStatus));
1357
+ this.$btns[i2].classList.toggle(
1358
+ "is-active",
1359
+ btn.isActive(boxStatus)
1360
+ );
1400
1361
  }
1401
1362
  });
1402
1363
  }
@@ -1428,7 +1389,9 @@ class DefaultTitleBar {
1428
1389
  this.buttons.forEach(({ iconClassName, isActive }, i2) => {
1429
1390
  const teleTitleBarBtnIndex = String(i2);
1430
1391
  const $btn = document.createElement("button");
1431
- $btn.className = `${this.wrapClassName("titlebar-btn")} ${iconClassName}`;
1392
+ $btn.className = `${this.wrapClassName(
1393
+ "titlebar-btn"
1394
+ )} ${iconClassName}`;
1432
1395
  $btn.dataset.teleTitleBarBtnIndex = teleTitleBarBtnIndex;
1433
1396
  $btn.dataset.teleTitleBarNoDblClick = "true";
1434
1397
  if (isActive) {
@@ -1437,24 +1400,30 @@ class DefaultTitleBar {
1437
1400
  this.$btns.push($btn);
1438
1401
  $buttonsContainer.appendChild($btn);
1439
1402
  });
1440
- this.sideEffect.addEventListener($buttonsContainer, "click", (ev) => {
1441
- var _a;
1442
- if (this.readonly) {
1443
- return;
1444
- }
1445
- const target = ev.target;
1446
- const teleTitleBarBtnIndex = Number((_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex);
1447
- if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
1448
- preventEvent(ev);
1449
- const btn = this.buttons[teleTitleBarBtnIndex];
1450
- if (this.onEvent) {
1451
- this.onEvent({
1452
- type: btn.type,
1453
- value: btn.value
1454
- });
1403
+ this.sideEffect.addEventListener(
1404
+ $buttonsContainer,
1405
+ "click",
1406
+ (ev) => {
1407
+ var _a;
1408
+ if (this.readonly) {
1409
+ return;
1410
+ }
1411
+ const target = ev.target;
1412
+ const teleTitleBarBtnIndex = Number(
1413
+ (_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex
1414
+ );
1415
+ if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
1416
+ preventEvent(ev);
1417
+ const btn = this.buttons[teleTitleBarBtnIndex];
1418
+ if (this.onEvent) {
1419
+ this.onEvent({
1420
+ type: btn.type,
1421
+ value: btn.value
1422
+ });
1423
+ }
1455
1424
  }
1456
1425
  }
1457
- });
1426
+ );
1458
1427
  this.$titleBar.appendChild($titleArea);
1459
1428
  this.$titleBar.appendChild($buttonsContainer);
1460
1429
  }
@@ -1464,8 +1433,17 @@ class DefaultTitleBar {
1464
1433
  const $dragArea = document.createElement("div");
1465
1434
  $dragArea.className = this.wrapClassName("drag-area");
1466
1435
  $dragArea.dataset.teleBoxHandle = TeleBoxDragHandleType;
1467
- this.sideEffect.addEventListener($dragArea, "mousedown", this.handleTitleBarClick);
1468
- this.sideEffect.addEventListener($dragArea, "touchstart", this.handleTitleBarTouch, { passive: true });
1436
+ this.sideEffect.addEventListener(
1437
+ $dragArea,
1438
+ "mousedown",
1439
+ this.handleTitleBarClick
1440
+ );
1441
+ this.sideEffect.addEventListener(
1442
+ $dragArea,
1443
+ "touchstart",
1444
+ this.handleTitleBarTouch,
1445
+ { passive: true }
1446
+ );
1469
1447
  return $dragArea;
1470
1448
  }
1471
1449
  dragHandle() {
@@ -1536,34 +1514,49 @@ class TeleBox {
1536
1514
  this._delegateEvents = new EventEmitter();
1537
1515
  const boxStatus$ = createVal(boxStatus);
1538
1516
  const lastNotMinimizedBoxStatus$ = createVal(lastNotMinimizedBoxStatus);
1539
- const prefersColorScheme$ = createVal(prefersColorScheme);
1517
+ const prefersColorScheme$ = createVal(
1518
+ prefersColorScheme
1519
+ );
1540
1520
  prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
1541
1521
  if (!skipUpdate) {
1542
- this.events.emit(TELE_BOX_EVENT.PrefersColorScheme, prefersColorScheme2);
1522
+ this.events.emit(
1523
+ TELE_BOX_EVENT.PrefersColorScheme,
1524
+ prefersColorScheme2
1525
+ );
1543
1526
  }
1544
1527
  });
1545
1528
  const darkMode$ = createVal(Boolean(darkMode));
1546
1529
  if (darkMode == null) {
1547
- prefersColorScheme$.subscribe((prefersColorScheme2, _, skipUpdate) => {
1548
- this._sideEffect.add(() => {
1549
- if (prefersColorScheme2 === "auto") {
1550
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
1551
- if (prefersDark) {
1552
- darkMode$.setValue(prefersDark.matches, skipUpdate);
1553
- const handler = (evt) => {
1554
- darkMode$.setValue(evt.matches, skipUpdate);
1555
- };
1556
- prefersDark.addListener(handler);
1557
- return () => prefersDark.removeListener(handler);
1530
+ prefersColorScheme$.subscribe(
1531
+ (prefersColorScheme2, _, skipUpdate) => {
1532
+ this._sideEffect.add(() => {
1533
+ if (prefersColorScheme2 === "auto") {
1534
+ const prefersDark = window.matchMedia(
1535
+ "(prefers-color-scheme: dark)"
1536
+ );
1537
+ if (prefersDark) {
1538
+ darkMode$.setValue(
1539
+ prefersDark.matches,
1540
+ skipUpdate
1541
+ );
1542
+ const handler = (evt) => {
1543
+ darkMode$.setValue(evt.matches, skipUpdate);
1544
+ };
1545
+ prefersDark.addListener(handler);
1546
+ return () => prefersDark.removeListener(handler);
1547
+ } else {
1548
+ return noop;
1549
+ }
1558
1550
  } else {
1551
+ darkMode$.setValue(
1552
+ prefersColorScheme2 === "dark",
1553
+ skipUpdate
1554
+ );
1559
1555
  return noop;
1560
1556
  }
1561
- } else {
1562
- darkMode$.setValue(prefersColorScheme2 === "dark", skipUpdate);
1563
- return noop;
1564
- }
1565
- }, "prefers-color-scheme");
1566
- });
1557
+ }, "prefers-color-scheme");
1558
+ }
1559
+ );
1567
1560
  }
1568
1561
  darkMode$.reaction((darkMode2, _, skipUpdate) => {
1569
1562
  if (!skipUpdate) {
@@ -1603,7 +1596,9 @@ class TeleBox {
1603
1596
  const focus$ = createVal(focus);
1604
1597
  focus$.reaction((focus2, _, skipUpdate) => {
1605
1598
  if (!skipUpdate) {
1606
- this.events.emit(focus2 ? TELE_BOX_EVENT.Focus : TELE_BOX_EVENT.Blur);
1599
+ this.events.emit(
1600
+ focus2 ? TELE_BOX_EVENT.Focus : TELE_BOX_EVENT.Blur
1601
+ );
1607
1602
  }
1608
1603
  });
1609
1604
  const minimized$ = createVal(minimized);
@@ -1618,98 +1613,125 @@ class TeleBox {
1618
1613
  this.events.emit(TELE_BOX_EVENT.Maximized, maximized2);
1619
1614
  }
1620
1615
  });
1621
- const state$ = combine([minimized$, maximized$, boxStatus$], ([minimized2, maximized2, boxStatus2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : !boxStatus2 ? TELE_BOX_STATE.Normal : boxStatus2);
1616
+ const state$ = combine(
1617
+ [minimized$, maximized$, boxStatus$],
1618
+ ([minimized2, maximized2, boxStatus2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : !boxStatus2 ? TELE_BOX_STATE.Normal : boxStatus2
1619
+ );
1622
1620
  state$.reaction((state, _, skipUpdate) => {
1623
1621
  if (!skipUpdate) {
1624
1622
  this.events.emit(TELE_BOX_EVENT.State, state);
1625
1623
  }
1626
1624
  });
1627
- const minSize$ = createVal({
1628
- width: clamp(minWidth, 0, 1),
1629
- height: clamp(minHeight, 0, 1)
1630
- }, shallowequal);
1631
- const intrinsicSize$ = createVal({
1632
- width: clamp(width, minSize$.value.width, 1),
1633
- height: clamp(height, minSize$.value.height, 1)
1634
- }, shallowequal);
1625
+ const minSize$ = createVal(
1626
+ {
1627
+ width: clamp(minWidth, 0, 1),
1628
+ height: clamp(minHeight, 0, 1)
1629
+ },
1630
+ shallowequal
1631
+ );
1632
+ const intrinsicSize$ = createVal(
1633
+ {
1634
+ width: clamp(width, minSize$.value.width, 1),
1635
+ height: clamp(height, minSize$.value.height, 1)
1636
+ },
1637
+ shallowequal
1638
+ );
1635
1639
  minSize$.reaction((minSize, _, skipUpdate) => {
1636
- intrinsicSize$.setValue({
1637
- width: clamp(width, minSize.width, 1),
1638
- height: clamp(height, minSize.height, 1)
1639
- }, skipUpdate);
1640
+ intrinsicSize$.setValue(
1641
+ {
1642
+ width: clamp(width, minSize.width, 1),
1643
+ height: clamp(height, minSize.height, 1)
1644
+ },
1645
+ skipUpdate
1646
+ );
1640
1647
  });
1641
1648
  intrinsicSize$.reaction((size, _, skipUpdate) => {
1642
1649
  if (!skipUpdate) {
1643
1650
  this.events.emit(TELE_BOX_EVENT.IntrinsicResize, size);
1644
1651
  }
1645
1652
  });
1646
- const size$ = combine([intrinsicSize$, maximized$, boxStatus$], ([intrinsicSize, maximized2, boxStatus2]) => {
1647
- if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1648
- return { width: 1, height: 1 };
1649
- }
1650
- return intrinsicSize;
1651
- }, shallowequal);
1653
+ const size$ = combine(
1654
+ [intrinsicSize$, maximized$, boxStatus$],
1655
+ ([intrinsicSize, maximized2, boxStatus2]) => {
1656
+ if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1657
+ return { width: 1, height: 1 };
1658
+ }
1659
+ return intrinsicSize;
1660
+ },
1661
+ shallowequal
1662
+ );
1652
1663
  size$.reaction((size, _, skipUpdate) => {
1653
1664
  if (!skipUpdate) {
1654
1665
  this.events.emit(TELE_BOX_EVENT.Resize, size);
1655
1666
  }
1656
1667
  });
1657
- const visualSize$ = combine([size$, minimized$, containerRect$, collectorRect$, boxStatus$], ([size, minimized2, containerRect2, collectorRect2, boxStatus2]) => {
1658
- if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1659
- return {
1660
- width: collectorRect2.width / size.width / containerRect2.width,
1661
- height: collectorRect2.height / size.height / containerRect2.height
1662
- };
1663
- }
1664
- return size;
1665
- }, shallowequal);
1668
+ const visualSize$ = combine(
1669
+ [size$, minimized$, containerRect$, collectorRect$, boxStatus$],
1670
+ ([size, minimized2, containerRect2, collectorRect2, boxStatus2]) => {
1671
+ if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1672
+ return {
1673
+ width: collectorRect2.width / size.width / containerRect2.width,
1674
+ height: collectorRect2.height / size.height / containerRect2.height
1675
+ };
1676
+ }
1677
+ return size;
1678
+ },
1679
+ shallowequal
1680
+ );
1666
1681
  visualSize$.reaction((size, _, skipUpdate) => {
1667
1682
  if (!skipUpdate) {
1668
1683
  this.events.emit(TELE_BOX_EVENT.VisualResize, size);
1669
1684
  }
1670
1685
  });
1671
- const intrinsicCoord$ = createVal({ x: clamp(x, 0, 1), y: clamp(y, 0, 1) }, shallowequal);
1686
+ const intrinsicCoord$ = createVal(
1687
+ { x: clamp(x, 0, 1), y: clamp(y, 0, 1) },
1688
+ shallowequal
1689
+ );
1672
1690
  intrinsicCoord$.reaction((coord, _, skipUpdate) => {
1673
1691
  if (!skipUpdate) {
1674
1692
  this.events.emit(TELE_BOX_EVENT.IntrinsicMove, coord);
1675
1693
  }
1676
1694
  });
1677
- const coord$ = combine([
1678
- intrinsicCoord$,
1679
- intrinsicSize$,
1680
- containerRect$,
1681
- collectorRect$,
1682
- minimized$,
1683
- maximized$,
1684
- boxStatus$,
1685
- lastNotMinimizedBoxStatus$
1686
- ], ([
1687
- intrinsicCoord,
1688
- intrinsicSize,
1689
- containerRect2,
1690
- collectorRect2,
1691
- minimized2,
1692
- maximized2,
1693
- boxStatus2,
1694
- lastNotMinimizedBoxStatus2
1695
- ]) => {
1696
- if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1697
- if (maximized2 || lastNotMinimizedBoxStatus2 === TELE_BOX_STATE.Maximized) {
1695
+ const coord$ = combine(
1696
+ [
1697
+ intrinsicCoord$,
1698
+ intrinsicSize$,
1699
+ containerRect$,
1700
+ collectorRect$,
1701
+ minimized$,
1702
+ maximized$,
1703
+ boxStatus$,
1704
+ lastNotMinimizedBoxStatus$
1705
+ ],
1706
+ ([
1707
+ intrinsicCoord,
1708
+ intrinsicSize,
1709
+ containerRect2,
1710
+ collectorRect2,
1711
+ minimized2,
1712
+ maximized2,
1713
+ boxStatus2,
1714
+ lastNotMinimizedBoxStatus2
1715
+ ]) => {
1716
+ if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1717
+ if (maximized2 || lastNotMinimizedBoxStatus2 === TELE_BOX_STATE.Maximized) {
1718
+ return {
1719
+ x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - 1 / 2,
1720
+ y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - 1 / 2
1721
+ };
1722
+ }
1698
1723
  return {
1699
- x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - 1 / 2,
1700
- y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - 1 / 2
1724
+ x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - intrinsicSize.width / 2,
1725
+ y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - intrinsicSize.height / 2
1701
1726
  };
1702
1727
  }
1703
- return {
1704
- x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - intrinsicSize.width / 2,
1705
- y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - intrinsicSize.height / 2
1706
- };
1707
- }
1708
- if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1709
- return { x: 0, y: 0 };
1710
- }
1711
- return intrinsicCoord;
1712
- }, shallowequal);
1728
+ if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1729
+ return { x: 0, y: 0 };
1730
+ }
1731
+ return intrinsicCoord;
1732
+ },
1733
+ shallowequal
1734
+ );
1713
1735
  coord$.reaction((coord, _, skipUpdate) => {
1714
1736
  if (!skipUpdate) {
1715
1737
  this.events.emit(TELE_BOX_EVENT.Move, coord);
@@ -1746,7 +1768,10 @@ class TeleBox {
1746
1768
  break;
1747
1769
  }
1748
1770
  default: {
1749
- console.error("Unsupported titleBar event:", event);
1771
+ console.error(
1772
+ "Unsupported titleBar event:",
1773
+ event
1774
+ );
1750
1775
  break;
1751
1776
  }
1752
1777
  }
@@ -1793,7 +1818,13 @@ class TeleBox {
1793
1818
  this._boxStatus$ = boxStatus$;
1794
1819
  this._lastNotMinimizedBoxStatus$ = lastNotMinimizedBoxStatus$;
1795
1820
  if (this.fixRatio) {
1796
- this.transform(coord$.value.x, coord$.value.y, size$.value.width, size$.value.height, true);
1821
+ this.transform(
1822
+ coord$.value.x,
1823
+ coord$.value.y,
1824
+ size$.value.width,
1825
+ size$.value.height,
1826
+ true
1827
+ );
1797
1828
  }
1798
1829
  this.$box = this.render();
1799
1830
  }
@@ -1860,11 +1891,17 @@ class TeleBox {
1860
1891
  return this._minSize$.value.height;
1861
1892
  }
1862
1893
  setMinWidth(minWidth, skipUpdate = false) {
1863
- this._minSize$.setValue({ width: minWidth, height: this.minHeight }, skipUpdate);
1894
+ this._minSize$.setValue(
1895
+ { width: minWidth, height: this.minHeight },
1896
+ skipUpdate
1897
+ );
1864
1898
  return this;
1865
1899
  }
1866
1900
  setMinHeight(minHeight, skipUpdate = false) {
1867
- this._minSize$.setValue({ width: this.minWidth, height: minHeight }, skipUpdate);
1901
+ this._minSize$.setValue(
1902
+ { width: this.minWidth, height: minHeight },
1903
+ skipUpdate
1904
+ );
1868
1905
  return this;
1869
1906
  }
1870
1907
  get intrinsicWidth() {
@@ -1925,14 +1962,20 @@ class TeleBox {
1925
1962
  height = this.intrinsicHeight;
1926
1963
  }
1927
1964
  }
1928
- this._intrinsicCoord$.setValue({
1929
- x: width >= this.minWidth ? x : this.intrinsicX,
1930
- y: height >= this.minHeight ? y : this.intrinsicY
1931
- }, skipUpdate);
1932
- this._intrinsicSize$.setValue({
1933
- width: clamp(width, this.minWidth, 1),
1934
- height: clamp(height, this.minHeight, 1)
1935
- }, skipUpdate);
1965
+ this._intrinsicCoord$.setValue(
1966
+ {
1967
+ x: width >= this.minWidth ? x : this.intrinsicX,
1968
+ y: height >= this.minHeight ? y : this.intrinsicY
1969
+ },
1970
+ skipUpdate
1971
+ );
1972
+ this._intrinsicSize$.setValue(
1973
+ {
1974
+ width: clamp(width, this.minWidth, 1),
1975
+ height: clamp(height, this.minHeight, 1)
1976
+ },
1977
+ skipUpdate
1978
+ );
1936
1979
  return this;
1937
1980
  }
1938
1981
  mount(container) {
@@ -2008,33 +2051,52 @@ class TeleBox {
2008
2051
  bindClassName(this.$box, this._resizable$, "no-resize", isFalsy);
2009
2052
  bindClassName(this.$box, this._focus$, "blur", isFalsy);
2010
2053
  bindClassName(this.$box, this._darkMode$, "color-scheme-dark");
2011
- bindClassName(this.$box, this._darkMode$, "color-scheme-light", isFalsy);
2054
+ bindClassName(
2055
+ this.$box,
2056
+ this._darkMode$,
2057
+ "color-scheme-light",
2058
+ isFalsy
2059
+ );
2012
2060
  this._renderSideEffect.add(() => {
2013
2061
  const minimizedClassName = this.wrapClassName("minimized");
2014
2062
  const maximizedClassName = this.wrapClassName("maximized");
2015
2063
  const MAXIMIZED_TIMER_ID = "box-maximized-timer";
2016
2064
  return this._state$.subscribe((state) => {
2017
- this.$box.classList.toggle(minimizedClassName, state === TELE_BOX_STATE.Minimized);
2065
+ this.$box.classList.toggle(
2066
+ minimizedClassName,
2067
+ state === TELE_BOX_STATE.Minimized
2068
+ );
2018
2069
  if (state === TELE_BOX_STATE.Maximized) {
2019
2070
  this._renderSideEffect.flush(MAXIMIZED_TIMER_ID);
2020
2071
  this.$box.classList.toggle(maximizedClassName, true);
2021
2072
  } else {
2022
- this._renderSideEffect.setTimeout(() => {
2023
- this.$box.classList.toggle(maximizedClassName, false);
2024
- }, 0, MAXIMIZED_TIMER_ID);
2073
+ this._renderSideEffect.setTimeout(
2074
+ () => {
2075
+ this.$box.classList.toggle(
2076
+ maximizedClassName,
2077
+ false
2078
+ );
2079
+ },
2080
+ 0,
2081
+ MAXIMIZED_TIMER_ID
2082
+ );
2025
2083
  }
2026
2084
  });
2027
2085
  });
2028
- this._renderSideEffect.add(() => this._visible$.subscribe((visible) => {
2029
- if (visible) {
2030
- this.$box.style.removeProperty("display");
2031
- } else {
2032
- this.$box.style.display = "none";
2033
- }
2034
- }));
2035
- this._renderSideEffect.add(() => this._zIndex$.subscribe((zIndex) => {
2036
- this.$box.style.zIndex = String(zIndex);
2037
- }));
2086
+ this._renderSideEffect.add(
2087
+ () => this._visible$.subscribe((visible) => {
2088
+ if (visible) {
2089
+ this.$box.style.removeProperty("display");
2090
+ } else {
2091
+ this.$box.style.display = "none";
2092
+ }
2093
+ })
2094
+ );
2095
+ this._renderSideEffect.add(
2096
+ () => this._zIndex$.subscribe((zIndex) => {
2097
+ this.$box.style.zIndex = String(zIndex);
2098
+ })
2099
+ );
2038
2100
  const boxStyler = index(this.$box);
2039
2101
  this.$box.dataset.teleBoxID = this.id;
2040
2102
  this.$box.style.width = this.absoluteWidth + "px";
@@ -2042,25 +2104,29 @@ class TeleBox {
2042
2104
  const translateX = this.x * this.containerRect.width + this.containerRect.x;
2043
2105
  const translateY = this.y * this.containerRect.height + this.containerRect.y;
2044
2106
  this.$box.style.transform = `translate(${translateX - 10}px,${translateY - 10}px)`;
2045
- this._valSideEffectBinder.combine([
2046
- this._coord$,
2047
- this._size$,
2048
- this._minimized$,
2049
- this._containerRect$,
2050
- this._collectorRect$,
2051
- this._boxStatus$
2052
- ], ([coord, size, minimized, containerRect, collectorRect, boxStatus]) => {
2053
- const absoluteWidth = size.width * containerRect.width;
2054
- const absoluteHeight = size.height * containerRect.height;
2055
- return {
2056
- width: absoluteWidth + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2057
- height: absoluteHeight + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2058
- x: coord.x * containerRect.width,
2059
- y: coord.y * containerRect.height,
2060
- scaleX: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.width / absoluteWidth : 1,
2061
- scaleY: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.height / absoluteHeight : 1
2062
- };
2063
- }, shallowequal).subscribe((styles) => {
2107
+ this._valSideEffectBinder.combine(
2108
+ [
2109
+ this._coord$,
2110
+ this._size$,
2111
+ this._minimized$,
2112
+ this._containerRect$,
2113
+ this._collectorRect$,
2114
+ this._boxStatus$
2115
+ ],
2116
+ ([coord, size, minimized, containerRect, collectorRect, boxStatus]) => {
2117
+ const absoluteWidth = size.width * containerRect.width;
2118
+ const absoluteHeight = size.height * containerRect.height;
2119
+ return {
2120
+ width: absoluteWidth + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2121
+ height: absoluteHeight + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2122
+ x: coord.x * containerRect.width,
2123
+ y: coord.y * containerRect.height,
2124
+ scaleX: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.width / absoluteWidth : 1,
2125
+ scaleY: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.height / absoluteHeight : 1
2126
+ };
2127
+ },
2128
+ shallowequal
2129
+ ).subscribe((styles) => {
2064
2130
  boxStyler.set(styles);
2065
2131
  });
2066
2132
  boxStyler.set({ x: translateX, y: translateY });
@@ -2155,44 +2221,94 @@ class TeleBox {
2155
2221
  const offsetY = (pageY - trackStartPageY) / this.containerRect.height;
2156
2222
  switch (trackingHandle) {
2157
2223
  case TELE_BOX_RESIZE_HANDLE.North: {
2158
- this.transform(this.x, trackStartY + offsetY, this.width, trackStartHeight - offsetY);
2224
+ this.transform(
2225
+ this.x,
2226
+ trackStartY + offsetY,
2227
+ this.width,
2228
+ trackStartHeight - offsetY
2229
+ );
2159
2230
  break;
2160
2231
  }
2161
2232
  case TELE_BOX_RESIZE_HANDLE.South: {
2162
- this.transform(this.x, this.y, this.width, trackStartHeight + offsetY);
2233
+ this.transform(
2234
+ this.x,
2235
+ this.y,
2236
+ this.width,
2237
+ trackStartHeight + offsetY
2238
+ );
2163
2239
  break;
2164
2240
  }
2165
2241
  case TELE_BOX_RESIZE_HANDLE.West: {
2166
- this.transform(trackStartX + offsetX, this.y, trackStartWidth - offsetX, this.height);
2242
+ this.transform(
2243
+ trackStartX + offsetX,
2244
+ this.y,
2245
+ trackStartWidth - offsetX,
2246
+ this.height
2247
+ );
2167
2248
  break;
2168
2249
  }
2169
2250
  case TELE_BOX_RESIZE_HANDLE.East: {
2170
- this.transform(this.x, this.y, trackStartWidth + offsetX, this.height);
2251
+ this.transform(
2252
+ this.x,
2253
+ this.y,
2254
+ trackStartWidth + offsetX,
2255
+ this.height
2256
+ );
2171
2257
  break;
2172
2258
  }
2173
2259
  case TELE_BOX_RESIZE_HANDLE.NorthWest: {
2174
- this.transform(trackStartX + offsetX, trackStartY + offsetY, trackStartWidth - offsetX, trackStartHeight - offsetY);
2260
+ this.transform(
2261
+ trackStartX + offsetX,
2262
+ trackStartY + offsetY,
2263
+ trackStartWidth - offsetX,
2264
+ trackStartHeight - offsetY
2265
+ );
2175
2266
  break;
2176
2267
  }
2177
2268
  case TELE_BOX_RESIZE_HANDLE.NorthEast: {
2178
- this.transform(this.x, trackStartY + offsetY, trackStartWidth + offsetX, trackStartHeight - offsetY);
2269
+ this.transform(
2270
+ this.x,
2271
+ trackStartY + offsetY,
2272
+ trackStartWidth + offsetX,
2273
+ trackStartHeight - offsetY
2274
+ );
2179
2275
  break;
2180
2276
  }
2181
2277
  case TELE_BOX_RESIZE_HANDLE.SouthEast: {
2182
- this.transform(this.x, this.y, trackStartWidth + offsetX, trackStartHeight + offsetY);
2278
+ this.transform(
2279
+ this.x,
2280
+ this.y,
2281
+ trackStartWidth + offsetX,
2282
+ trackStartHeight + offsetY
2283
+ );
2183
2284
  break;
2184
2285
  }
2185
2286
  case TELE_BOX_RESIZE_HANDLE.SouthWest: {
2186
- this.transform(trackStartX + offsetX, this.y, trackStartWidth - offsetX, trackStartHeight + offsetY);
2287
+ this.transform(
2288
+ trackStartX + offsetX,
2289
+ this.y,
2290
+ trackStartWidth - offsetX,
2291
+ trackStartHeight + offsetY
2292
+ );
2187
2293
  break;
2188
2294
  }
2189
2295
  default: {
2190
2296
  if (this.fence) {
2191
- this.move(clamp(trackStartX + offsetX, 0, 1 - this.width), clamp(trackStartY + offsetY, 0, 1 - this.height));
2297
+ this.move(
2298
+ clamp(trackStartX + offsetX, 0, 1 - this.width),
2299
+ clamp(trackStartY + offsetY, 0, 1 - this.height)
2300
+ );
2192
2301
  } else {
2193
2302
  const xOverflowOffset = 20 / this.containerRect.width;
2194
2303
  const yOverflowOffset = 20 / this.containerRect.height;
2195
- this.move(clamp(trackStartX + offsetX, xOverflowOffset - this.width, 1 - xOverflowOffset), clamp(trackStartY + offsetY, 0, 1 - yOverflowOffset));
2304
+ this.move(
2305
+ clamp(
2306
+ trackStartX + offsetX,
2307
+ xOverflowOffset - this.width,
2308
+ 1 - xOverflowOffset
2309
+ ),
2310
+ clamp(trackStartY + offsetY, 0, 1 - yOverflowOffset)
2311
+ );
2196
2312
  }
2197
2313
  break;
2198
2314
  }
@@ -2232,7 +2348,9 @@ class TeleBox {
2232
2348
  $trackMask = document.createElement("div");
2233
2349
  }
2234
2350
  const cursor = trackingHandle ? this.wrapClassName(`cursor-${trackingHandle}`) : "";
2235
- $trackMask.className = this.wrapClassName(`track-mask${cursor ? ` ${cursor}` : ""}`);
2351
+ $trackMask.className = this.wrapClassName(
2352
+ `track-mask${cursor ? ` ${cursor}` : ""}`
2353
+ );
2236
2354
  this.$box.appendChild($trackMask);
2237
2355
  this.$box.classList.add(transformingClassName);
2238
2356
  this._sideEffect.add(() => {
@@ -2252,14 +2370,29 @@ class TeleBox {
2252
2370
  window.removeEventListener("touchmove", handleTracking);
2253
2371
  window.removeEventListener("mouseup", handleTrackEnd);
2254
2372
  window.removeEventListener("touchend", handleTrackEnd);
2255
- window.removeEventListener("touchcancel", handleTrackEnd);
2373
+ window.removeEventListener(
2374
+ "touchcancel",
2375
+ handleTrackEnd
2376
+ );
2256
2377
  };
2257
2378
  }, TRACKING_DISPOSER_ID);
2258
2379
  }
2259
2380
  };
2260
2381
  this._handleTrackStart = handleTrackStart;
2261
- this._sideEffect.addEventListener($resizeHandles, "mousedown", handleTrackStart, {}, "box-resizeHandles-mousedown");
2262
- this._sideEffect.addEventListener($resizeHandles, "touchstart", handleTrackStart, { passive: false }, "box-resizeHandles-touchstart");
2382
+ this._sideEffect.addEventListener(
2383
+ $resizeHandles,
2384
+ "mousedown",
2385
+ handleTrackStart,
2386
+ {},
2387
+ "box-resizeHandles-mousedown"
2388
+ );
2389
+ this._sideEffect.addEventListener(
2390
+ $resizeHandles,
2391
+ "touchstart",
2392
+ handleTrackStart,
2393
+ { passive: false },
2394
+ "box-resizeHandles-touchstart"
2395
+ );
2263
2396
  }
2264
2397
  destroy() {
2265
2398
  this.$box.remove();
@@ -2276,7 +2409,7 @@ class TeleBox {
2276
2409
  function noop() {
2277
2410
  return;
2278
2411
  }
2279
- var style$1 = ".telebox-collector {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n visibility: hidden;\n display: block;\n position: absolute;\n z-index: 200;\n width: 40px;\n height: 40px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 0;\n border-radius: 50%;\n background: #fff;\n box-shadow: 0px 2px 6px 0px rgba(47, 65, 146, 0.15);\n cursor: pointer;\n user-select: none;\n pointer-events: none;\n background-repeat: no-repeat;\n background-size: 18px 16px;\n background-position: center;\n -webkit-tap-highlight-color: transparent;\n}\n\n.telebox-collector-visible {\n visibility: visible;\n pointer-events: initial;\n}\n\n.telebox-collector-readonly {\n cursor: not-allowed;\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark.telebox-collector {\n background-color: #43434d;\n}";
2412
+ var style$2 = "";
2280
2413
  var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
2281
2414
  class TeleBoxCollector {
2282
2415
  constructor({
@@ -2285,8 +2418,10 @@ class TeleBoxCollector {
2285
2418
  darkMode = false,
2286
2419
  namespace = "telebox",
2287
2420
  styles = {},
2288
- onClick
2289
- } = {}) {
2421
+ onClick,
2422
+ getBoxesStatus
2423
+ }) {
2424
+ this.$appMenuContainer = document.createElement("div");
2290
2425
  this.handleCollectorClick = () => {
2291
2426
  if (!this._readonly && this.onClick) {
2292
2427
  this.onClick();
@@ -2298,6 +2433,11 @@ class TeleBoxCollector {
2298
2433
  this.namespace = namespace;
2299
2434
  this.styles = styles;
2300
2435
  this.onClick = onClick;
2436
+ this.getBoxesStatus = getBoxesStatus;
2437
+ }
2438
+ get boxesStatus() {
2439
+ var _a;
2440
+ return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
2301
2441
  }
2302
2442
  get visible() {
2303
2443
  return this._visible;
@@ -2318,11 +2458,29 @@ class TeleBoxCollector {
2318
2458
  }
2319
2459
  return this;
2320
2460
  }
2461
+ hasMinimizedBox() {
2462
+ const boxesStatus = this.boxesStatus;
2463
+ if (boxesStatus) {
2464
+ for (const status of boxesStatus.values()) {
2465
+ if (status === TELE_BOX_STATE.Minimized) {
2466
+ return true;
2467
+ }
2468
+ }
2469
+ }
2470
+ return false;
2471
+ }
2472
+ updateBoxesStatus() {
2473
+ const hasMinimizedBox = this.hasMinimizedBox();
2474
+ this.setVisible(hasMinimizedBox);
2475
+ }
2321
2476
  setVisible(visible) {
2322
2477
  if (this._visible !== visible) {
2323
2478
  this._visible = visible;
2324
2479
  if (this.$collector) {
2325
- this.$collector.classList.toggle(this.wrapClassName("collector-visible"), visible);
2480
+ this.$collector.classList.toggle(
2481
+ this.wrapClassName("collector-visible"),
2482
+ visible
2483
+ );
2326
2484
  }
2327
2485
  }
2328
2486
  return this;
@@ -2331,7 +2489,10 @@ class TeleBoxCollector {
2331
2489
  if (this._readonly !== readonly) {
2332
2490
  this._readonly = readonly;
2333
2491
  if (this.$collector) {
2334
- this.$collector.classList.toggle(this.wrapClassName("collector-readonly"), readonly);
2492
+ this.$collector.classList.toggle(
2493
+ this.wrapClassName("collector-readonly"),
2494
+ readonly
2495
+ );
2335
2496
  }
2336
2497
  }
2337
2498
  return this;
@@ -2340,8 +2501,14 @@ class TeleBoxCollector {
2340
2501
  if (this._darkMode !== darkMode) {
2341
2502
  this._darkMode = darkMode;
2342
2503
  if (this.$collector) {
2343
- this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
2344
- this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
2504
+ this.$collector.classList.toggle(
2505
+ this.wrapClassName("color-scheme-dark"),
2506
+ darkMode
2507
+ );
2508
+ this.$collector.classList.toggle(
2509
+ this.wrapClassName("color-scheme-light"),
2510
+ !darkMode
2511
+ );
2345
2512
  }
2346
2513
  }
2347
2514
  return this;
@@ -2364,21 +2531,37 @@ class TeleBoxCollector {
2364
2531
  this.$collector = document.createElement("button");
2365
2532
  this.$collector.className = this.wrapClassName("collector");
2366
2533
  this.$collector.style.backgroundImage = `url('${collectorSVG}')`;
2367
- this.$collector.addEventListener("click", this.handleCollectorClick);
2534
+ this.$collector.addEventListener(
2535
+ "click",
2536
+ this.handleCollectorClick
2537
+ );
2368
2538
  if (this._visible) {
2369
- this.$collector.classList.add(this.wrapClassName("collector-visible"));
2539
+ this.$collector.classList.add(
2540
+ this.wrapClassName("collector-visible")
2541
+ );
2370
2542
  }
2371
2543
  if (this._readonly) {
2372
- this.$collector.classList.add(this.wrapClassName("collector-readonly"));
2373
- }
2374
- this.$collector.classList.add(this.wrapClassName(this._darkMode ? "color-scheme-dark" : "color-scheme-light"));
2544
+ this.$collector.classList.add(
2545
+ this.wrapClassName("collector-readonly")
2546
+ );
2547
+ }
2548
+ this.$collector.classList.add(
2549
+ this.wrapClassName(
2550
+ this._darkMode ? "color-scheme-dark" : "color-scheme-light"
2551
+ )
2552
+ );
2553
+ this.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow"));
2554
+ this.$collector.append(this.$appMenuContainer);
2375
2555
  this.setStyles(this.styles);
2376
2556
  }
2377
2557
  return this.$collector;
2378
2558
  }
2379
2559
  destroy() {
2380
2560
  if (this.$collector) {
2381
- this.$collector.removeEventListener("click", this.handleCollectorClick);
2561
+ this.$collector.removeEventListener(
2562
+ "click",
2563
+ this.handleCollectorClick
2564
+ );
2382
2565
  this.$collector.remove();
2383
2566
  this.$collector = void 0;
2384
2567
  }
@@ -2388,8 +2571,7 @@ class TeleBoxCollector {
2388
2571
  return `${this.namespace}-${className}`;
2389
2572
  }
2390
2573
  }
2391
- var TELE_BOX_MANAGER_EVENT;
2392
- (function(TELE_BOX_MANAGER_EVENT2) {
2574
+ var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
2393
2575
  TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
2394
2576
  TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
2395
2577
  TELE_BOX_MANAGER_EVENT2["Created"] = "created";
@@ -2407,8 +2589,9 @@ var TELE_BOX_MANAGER_EVENT;
2407
2589
  TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
2408
2590
  TELE_BOX_MANAGER_EVENT2["BoxStatus"] = "box_status";
2409
2591
  TELE_BOX_MANAGER_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
2410
- })(TELE_BOX_MANAGER_EVENT || (TELE_BOX_MANAGER_EVENT = {}));
2411
- var style = ".telebox-max-titlebar {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 50000;\n}\n.telebox-max-titlebar .telebox-title {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-titles {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-title {\n display: block;\n}\n.telebox-max-titlebar-maximized {\n display: flex;\n}\n.telebox-titles {\n height: 100%;\n margin: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n overflow-x: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.telebox-titles::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.telebox-titles::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.telebox-titles::-webkit-scrollbar-thumb {\n background-color: rgba(238, 238, 247, 0.8);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.telebox-titles:hover::-webkit-scrollbar-thumb {\n background-color: rgba(238, 238, 247, 0.8);\n}\n.telebox-titles::-webkit-scrollbar-thumb:hover {\n background-color: #eeeef7;\n}\n.telebox-titles::-webkit-scrollbar-thumb:active {\n background-color: #eeeef7;\n}\n.telebox-titles::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.telebox-titles::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}\n.telebox-titles-content {\n height: 100%;\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n padding: 0;\n}\n.telebox-titles-tab {\n height: 100%;\n overflow: hidden;\n max-width: 182px;\n min-width: 50px;\n padding: 0 26px 0 16px;\n outline: none;\n font-size: 13px;\n font-family: PingFangSC-Regular, PingFang SC;\n font-weight: 400;\n text-overflow: ellipsis;\n white-space: nowrap;\n word-break: keep-all;\n border: none;\n border-right: 1px solid #e5e5f0;\n color: #7b88a0;\n background: transparent;\n cursor: pointer;\n user-select: none;\n}\n.telebox-titles-tab-focus {\n color: #357bf6;\n}\n.telebox-readonly .telebox-titles-tab {\n cursor: not-allowed;\n}\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n.telebox-color-scheme-dark.telebox-titlebar {\n color: #e9e9e9;\n background: #43434d;\n border-bottom: none;\n}\n.telebox-color-scheme-dark .telebox-titles-tab {\n border-right-color: #7b88a0;\n}\n.telebox-color-scheme-dark .telebox-title {\n color: #e9e9e9;\n}";
2592
+ return TELE_BOX_MANAGER_EVENT2;
2593
+ })(TELE_BOX_MANAGER_EVENT || {});
2594
+ var style$1 = "";
2412
2595
  class MaxTitleBar extends DefaultTitleBar {
2413
2596
  constructor(config) {
2414
2597
  super(config);
@@ -2418,6 +2601,10 @@ class MaxTitleBar extends DefaultTitleBar {
2418
2601
  this.darkMode = config.darkMode;
2419
2602
  this.getBoxesStatus = config.getBoxesStatus;
2420
2603
  }
2604
+ get boxesStatus() {
2605
+ var _a;
2606
+ return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
2607
+ }
2421
2608
  hasMaximizedBoxInStatus() {
2422
2609
  if (this.getBoxesStatus) {
2423
2610
  const boxesStatus = this.getBoxesStatus();
@@ -2450,9 +2637,15 @@ class MaxTitleBar extends DefaultTitleBar {
2450
2637
  const id = (_a = $tab.dataset) == null ? void 0 : _a.teleBoxID;
2451
2638
  if (id) {
2452
2639
  if (box && id === box.id) {
2453
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), true);
2640
+ $tab.classList.toggle(
2641
+ this.wrapClassName("titles-tab-focus"),
2642
+ true
2643
+ );
2454
2644
  } else if (this.focusedBox && id === this.focusedBox.id) {
2455
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), false);
2645
+ $tab.classList.toggle(
2646
+ this.wrapClassName("titles-tab-focus"),
2647
+ false
2648
+ );
2456
2649
  }
2457
2650
  }
2458
2651
  }
@@ -2462,9 +2655,15 @@ class MaxTitleBar extends DefaultTitleBar {
2462
2655
  const id = (_b = $tab.dataset) == null ? void 0 : _b.teleBoxID;
2463
2656
  if (id) {
2464
2657
  if (box && id === box.id) {
2465
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), true);
2658
+ $tab.classList.toggle(
2659
+ this.wrapClassName("titles-tab-focus"),
2660
+ true
2661
+ );
2466
2662
  } else if (this.focusedBox && id === this.focusedBox.id) {
2467
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), false);
2663
+ $tab.classList.toggle(
2664
+ this.wrapClassName("titles-tab-focus"),
2665
+ false
2666
+ );
2468
2667
  }
2469
2668
  }
2470
2669
  }
@@ -2485,36 +2684,54 @@ class MaxTitleBar extends DefaultTitleBar {
2485
2684
  this.setBoxStatus(TELE_BOX_STATE.Maximized);
2486
2685
  }
2487
2686
  if (this.$titleBar) {
2488
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus());
2687
+ this.$titleBar.classList.toggle(
2688
+ this.wrapClassName("max-titlebar-maximized"),
2689
+ this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
2690
+ );
2489
2691
  }
2490
2692
  this.updateTitles();
2491
2693
  }
2492
2694
  setBoxes(boxes) {
2493
2695
  this.boxes = boxes;
2494
2696
  if (this.$titleBar) {
2495
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === TELE_BOX_STATE.Maximized && boxes.length > 0 || this.hasMaximizedBoxInStatus());
2697
+ this.$titleBar.classList.toggle(
2698
+ this.wrapClassName("max-titlebar-maximized"),
2699
+ this.state === TELE_BOX_STATE.Maximized && boxes.length > 0 || this.hasMaximizedBoxInStatus()
2700
+ );
2496
2701
  }
2497
2702
  this.updateTitles();
2498
2703
  }
2499
2704
  setState(state) {
2500
2705
  super.setState(state);
2501
2706
  if (this.$titleBar) {
2502
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus());
2707
+ this.$titleBar.classList.toggle(
2708
+ this.wrapClassName("max-titlebar-maximized"),
2709
+ state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
2710
+ );
2503
2711
  }
2504
2712
  this.updateTitles();
2505
2713
  }
2506
2714
  setReadonly(readonly) {
2507
2715
  super.setReadonly(readonly);
2508
2716
  if (this.$titleBar) {
2509
- this.$titleBar.classList.toggle(this.wrapClassName("readonly"), this.readonly);
2717
+ this.$titleBar.classList.toggle(
2718
+ this.wrapClassName("readonly"),
2719
+ this.readonly
2720
+ );
2510
2721
  }
2511
2722
  }
2512
2723
  setDarkMode(darkMode) {
2513
2724
  if (darkMode !== this.darkMode) {
2514
2725
  this.darkMode = darkMode;
2515
2726
  if (this.$titleBar) {
2516
- this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
2517
- this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
2727
+ this.$titleBar.classList.toggle(
2728
+ this.wrapClassName("color-scheme-dark"),
2729
+ darkMode
2730
+ );
2731
+ this.$titleBar.classList.toggle(
2732
+ this.wrapClassName("color-scheme-light"),
2733
+ !darkMode
2734
+ );
2518
2735
  }
2519
2736
  }
2520
2737
  }
@@ -2524,9 +2741,19 @@ class MaxTitleBar extends DefaultTitleBar {
2524
2741
  $titleBar.style.transform = `translate(${x}px, ${y}px)`;
2525
2742
  $titleBar.style.width = width + "px";
2526
2743
  $titleBar.classList.add(this.wrapClassName("max-titlebar"));
2527
- $titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0);
2528
- $titleBar.classList.toggle(this.wrapClassName("readonly"), this.readonly);
2529
- $titleBar.classList.add(this.wrapClassName(this.darkMode ? "color-scheme-dark" : "color-scheme-light"));
2744
+ $titleBar.classList.toggle(
2745
+ this.wrapClassName("max-titlebar-maximized"),
2746
+ this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0
2747
+ );
2748
+ $titleBar.classList.toggle(
2749
+ this.wrapClassName("readonly"),
2750
+ this.readonly
2751
+ );
2752
+ $titleBar.classList.add(
2753
+ this.wrapClassName(
2754
+ this.darkMode ? "color-scheme-dark" : "color-scheme-light"
2755
+ )
2756
+ );
2530
2757
  const $titlesArea = document.createElement("div");
2531
2758
  $titlesArea.classList.add(this.wrapClassName("titles-area"));
2532
2759
  $titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
@@ -2541,23 +2768,33 @@ class MaxTitleBar extends DefaultTitleBar {
2541
2768
  }
2542
2769
  updateTitles() {
2543
2770
  if (this.$titleBar && (this.state === TELE_BOX_STATE.Maximized || this.hasMaximizedBoxInStatus())) {
2544
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"), this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1);
2771
+ this.$titleBar.classList.toggle(
2772
+ this.wrapClassName("max-titlebar-single-title"),
2773
+ this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1
2774
+ );
2545
2775
  if (this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1) {
2546
2776
  this.setTitle(this.boxes[0].title);
2547
2777
  } else {
2548
- this.$titleBar.replaceChild(this.renderTitles(), this.$titleBar.firstElementChild);
2778
+ this.$titleBar.replaceChild(
2779
+ this.renderTitles(),
2780
+ this.$titleBar.firstElementChild
2781
+ );
2549
2782
  }
2550
2783
  }
2551
2784
  }
2552
2785
  renderTitles() {
2553
2786
  this.$titles = document.createElement("div");
2554
2787
  this.$titles.className = this.wrapClassName("titles");
2555
- this.$titles.addEventListener("wheel", (ev) => {
2556
- ev.currentTarget.scrollBy({
2557
- left: ev.deltaY > 0 ? 250 : -250,
2558
- behavior: "smooth"
2559
- });
2560
- }, { passive: false });
2788
+ this.$titles.addEventListener(
2789
+ "wheel",
2790
+ (ev) => {
2791
+ ev.currentTarget.scrollBy({
2792
+ left: ev.deltaY > 0 ? 250 : -250,
2793
+ behavior: "smooth"
2794
+ });
2795
+ },
2796
+ { passive: false }
2797
+ );
2561
2798
  const $content = document.createElement("div");
2562
2799
  $content.className = this.wrapClassName("titles-content");
2563
2800
  this.$titles.appendChild($content);
@@ -2575,6 +2812,120 @@ class MaxTitleBar extends DefaultTitleBar {
2575
2812
  return this.$titles;
2576
2813
  }
2577
2814
  }
2815
+ var style = "";
2816
+ class AppMenu {
2817
+ constructor(props) {
2818
+ this.namespace = "telebox-app-menu";
2819
+ this.badge = document.createElement("div");
2820
+ this.menuView = document.createElement("div");
2821
+ this.containerClickHandler = () => {
2822
+ if (this.manager.readonly) {
2823
+ return;
2824
+ }
2825
+ const isShowMenuView = getComputedStyle(this.menuView).display === "flex";
2826
+ if (isShowMenuView) {
2827
+ this.menuView.style.display = "none";
2828
+ } else {
2829
+ this.menuView.style.display = "flex";
2830
+ }
2831
+ };
2832
+ this.menuViewClickHandler = (e2) => {
2833
+ e2.stopPropagation();
2834
+ e2.stopImmediatePropagation();
2835
+ const target = e2.target;
2836
+ const id = target.getAttribute(`data-${this.c("app-id")}`);
2837
+ if (id) {
2838
+ const lastNotMinimizedBoxStatus = this.manager.getLastNotMinimizedBoxStatus(id) || TELE_BOX_STATE.Normal;
2839
+ const zIndex = (lastNotMinimizedBoxStatus === TELE_BOX_STATE.Maximized ? this.manager.getMaxMaximizedBoxZIndex() : this.manager.getMaxNormalBoxZIndex()) + 1;
2840
+ this.manager.setBox(id, {
2841
+ status: lastNotMinimizedBoxStatus,
2842
+ zIndex
2843
+ }, false, () => {
2844
+ this.manager.focusBox(id);
2845
+ });
2846
+ return;
2847
+ }
2848
+ };
2849
+ this.updatePrefersColorSchemeHandler = () => {
2850
+ this.container.classList.remove(this.theme);
2851
+ this.theme = this.manager.prefersColorScheme;
2852
+ this.container.classList.add(this.theme);
2853
+ };
2854
+ this.appMenuChange = () => {
2855
+ const minimizedBoxesStatus = this.manager.getMinimizedBoxesStatus();
2856
+ this.render(minimizedBoxesStatus);
2857
+ };
2858
+ this.container = props.container;
2859
+ this.manager = props.manager;
2860
+ this.theme = props.theme;
2861
+ this.getBoxesStatus = props.getBoxesStatus;
2862
+ this.init();
2863
+ }
2864
+ get boxesStatus() {
2865
+ var _a;
2866
+ return ((_a = this.getBoxesStatus) == null ? void 0 : _a.call(this)) || /* @__PURE__ */ new Map();
2867
+ }
2868
+ get minimizedBoxesStatus() {
2869
+ const arr = [];
2870
+ this.boxesStatus.forEach((status) => {
2871
+ if (status === TELE_BOX_STATE.Minimized) {
2872
+ arr.push(status);
2873
+ }
2874
+ });
2875
+ return arr;
2876
+ }
2877
+ c(className) {
2878
+ return `${this.namespace}-${className}`;
2879
+ }
2880
+ createDefaultAppMenu() {
2881
+ this.badge.classList.add(this.c("app-menu-badge"));
2882
+ this.menuView.classList.add(this.c("app-menu-tooltip"));
2883
+ this.container.classList.add(this.c("app-menu-container"), this.theme);
2884
+ this.menuView.addEventListener("click", this.menuViewClickHandler);
2885
+ this.container.append(this.badge, this.menuView);
2886
+ }
2887
+ async init() {
2888
+ this.createDefaultAppMenu();
2889
+ this.appMenuChange();
2890
+ }
2891
+ createMinimizedItem(appId) {
2892
+ const appItem = document.createElement("div");
2893
+ appItem.classList.add(this.c("app-menu-item"));
2894
+ console.log("appId=====>", appId);
2895
+ appItem.setAttribute(`data-${this.c("app-id")}`, appId);
2896
+ const titleDiv = document.createElement("div");
2897
+ titleDiv.classList.add(this.c("app-menu-item-title"));
2898
+ const app = this.manager.getBox(appId);
2899
+ titleDiv.innerText = (app == null ? void 0 : app.title) || appId;
2900
+ appItem.appendChild(titleDiv);
2901
+ return appItem;
2902
+ }
2903
+ renderMenuView(minimizedBoxesStatus) {
2904
+ const items = [];
2905
+ minimizedBoxesStatus.forEach((_, appId) => {
2906
+ items.push(this.createMinimizedItem(appId));
2907
+ });
2908
+ this.menuView.append(...items);
2909
+ }
2910
+ render(minimizedBoxesStatus) {
2911
+ this.menuView.style.display = "none";
2912
+ this.badge.innerText = "";
2913
+ this.menuView.innerHTML = "";
2914
+ if (minimizedBoxesStatus.size === 0) {
2915
+ this.container.style.display = "none";
2916
+ } else {
2917
+ this.badge.innerText = minimizedBoxesStatus.size.toString();
2918
+ this.renderMenuView(minimizedBoxesStatus);
2919
+ this.container.style.display = "block";
2920
+ }
2921
+ }
2922
+ destroy() {
2923
+ this.badge.remove();
2924
+ this.menuView.removeEventListener("click", this.menuViewClickHandler);
2925
+ this.menuView.remove();
2926
+ this.container.remove();
2927
+ }
2928
+ }
2578
2929
  class TeleBoxManager {
2579
2930
  constructor({
2580
2931
  root = document.body,
@@ -2590,28 +2941,37 @@ class TeleBoxManager {
2590
2941
  },
2591
2942
  collector,
2592
2943
  namespace = "telebox",
2593
- readonly = false
2944
+ readonly = false,
2945
+ useBoxesStatus = false
2594
2946
  } = {}) {
2595
2947
  this.events = new EventEmitter();
2596
2948
  this._sideEffect = new o();
2949
+ this.useBoxesStatus = useBoxesStatus;
2597
2950
  const { combine, createVal } = c(this._sideEffect);
2598
2951
  this.root = root;
2599
2952
  this.namespace = namespace;
2600
2953
  this.boxes$ = createVal([]);
2601
2954
  this.topBox$ = this.boxes$.derive((boxes) => {
2602
2955
  if (boxes.length > 0) {
2956
+ console.log("topBox===>topBox$===>000");
2957
+ let currentTopBox = void 0;
2603
2958
  const topBox = boxes.reduce((topBox2, box) => {
2604
2959
  if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
2605
2960
  return topBox2;
2606
2961
  }
2962
+ if (!topBox2) {
2963
+ topBox2 = box;
2964
+ return topBox2;
2965
+ }
2607
2966
  return topBox2.zIndex > box.zIndex ? topBox2 : box;
2608
- });
2967
+ }, currentTopBox);
2968
+ console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
2609
2969
  return topBox;
2610
2970
  }
2611
2971
  return;
2612
2972
  });
2613
- this.boxesStatus$ = new Map();
2614
- this.lastNotMinimizedBoxesStatus$ = new Map();
2973
+ this.boxesStatus$ = /* @__PURE__ */ new Map();
2974
+ this.lastNotMinimizedBoxesStatus$ = /* @__PURE__ */ new Map();
2615
2975
  const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
2616
2976
  const prefersDark$ = createVal(false);
2617
2977
  if (prefersDark) {
@@ -2626,12 +2986,20 @@ class TeleBoxManager {
2626
2986
  }
2627
2987
  const prefersColorScheme$ = createVal(prefersColorScheme);
2628
2988
  prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
2629
- this.boxes.forEach((box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate));
2989
+ this.boxes.forEach(
2990
+ (box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate)
2991
+ );
2630
2992
  if (!skipUpdate) {
2631
- this.events.emit(TELE_BOX_MANAGER_EVENT.PrefersColorScheme, prefersColorScheme2);
2993
+ this.events.emit(
2994
+ TELE_BOX_MANAGER_EVENT.PrefersColorScheme,
2995
+ prefersColorScheme2
2996
+ );
2632
2997
  }
2633
2998
  });
2634
- this._darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark");
2999
+ this._darkMode$ = combine(
3000
+ [prefersDark$, prefersColorScheme$],
3001
+ ([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark"
3002
+ );
2635
3003
  this._darkMode$.reaction((darkMode, _, skipUpdate) => {
2636
3004
  this.boxes.forEach((box) => box.setDarkMode(darkMode, skipUpdate));
2637
3005
  if (!skipUpdate) {
@@ -2645,12 +3013,17 @@ class TeleBoxManager {
2645
3013
  const minimized$ = createVal(minimized);
2646
3014
  const maximized$ = createVal(maximized);
2647
3015
  maximized$.reaction((maximized2, _, skipUpdate) => {
2648
- this.boxes.forEach((box) => box.setMaximized(maximized2, skipUpdate));
3016
+ this.boxes.forEach(
3017
+ (box) => box.setMaximized(maximized2, skipUpdate)
3018
+ );
2649
3019
  if (!skipUpdate) {
2650
3020
  this.events.emit(TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
2651
3021
  }
2652
3022
  });
2653
- const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
3023
+ const state$ = combine(
3024
+ [minimized$, maximized$],
3025
+ ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal
3026
+ );
2654
3027
  state$.reaction((state, _, skipUpdate) => {
2655
3028
  this.maxTitleBar.setState(state);
2656
3029
  if (!skipUpdate) {
@@ -2663,44 +3036,46 @@ class TeleBoxManager {
2663
3036
  });
2664
3037
  const containerRect$ = createVal(containerRect, shallowequal);
2665
3038
  containerRect$.reaction((containerRect2, _, skipUpdate) => {
2666
- this.boxes.forEach((box) => box.setContainerRect(containerRect2, skipUpdate));
3039
+ this.boxes.forEach(
3040
+ (box) => box.setContainerRect(containerRect2, skipUpdate)
3041
+ );
2667
3042
  this.maxTitleBar.setContainerRect(containerRect2);
2668
3043
  });
2669
- const collector$ = createVal(collector === null ? null : collector || new TeleBoxCollector({
2670
- visible: minimized,
2671
- readonly,
2672
- namespace
2673
- }).mount(root));
3044
+ const collector$ = createVal(
3045
+ collector === null ? null : collector || new TeleBoxCollector({
3046
+ visible: minimized,
3047
+ readonly,
3048
+ namespace
3049
+ }).mount(root)
3050
+ );
2674
3051
  collector$.subscribe((collector2) => {
2675
3052
  if (collector2) {
2676
3053
  collector2.setVisible(minimized$.value);
2677
3054
  collector2.setReadonly(readonly$.value);
2678
3055
  collector2.setDarkMode(this._darkMode$.value);
2679
3056
  this._sideEffect.add(() => {
3057
+ collector2.getBoxesStatus = () => {
3058
+ return this.boxesStatus$;
3059
+ };
2680
3060
  collector2.onClick = () => {
2681
3061
  if (!readonly$.value) {
2682
- if (this.hasMinimizedBox()) {
2683
- this.getAllMinimizedBoxes().forEach((box) => {
2684
- const lastNotMinimizedBoxStatus = box.lastNotMinimizedBoxStatus;
2685
- if (lastNotMinimizedBoxStatus) {
2686
- this.setBoxStatus(box.id, lastNotMinimizedBoxStatus);
2687
- } else {
2688
- this.setBoxStatus(box.id, TELE_BOX_STATE.Normal);
2689
- }
2690
- });
2691
- this.effectBoxStatusChange();
3062
+ if (!this.useBoxesStatus) {
3063
+ minimized$.setValue(false);
3064
+ } else if (this.useBoxesStatus && this.appMenu) {
3065
+ this.appMenu.containerClickHandler();
2692
3066
  }
2693
- minimized$.setValue(false);
2694
3067
  }
2695
3068
  };
2696
3069
  return () => collector2.destroy();
2697
3070
  }, "collect-onClick");
2698
3071
  }
2699
3072
  });
2700
- readonly$.subscribe((readonly2) => {
2701
- var _a;
2702
- return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
2703
- });
3073
+ readonly$.subscribe(
3074
+ (readonly2) => {
3075
+ var _a;
3076
+ return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
3077
+ }
3078
+ );
2704
3079
  this._darkMode$.subscribe((darkMode) => {
2705
3080
  var _a;
2706
3081
  (_a = collector$.value) == null ? void 0 : _a.setDarkMode(darkMode);
@@ -2719,21 +3094,29 @@ class TeleBoxManager {
2719
3094
  }
2720
3095
  return;
2721
3096
  };
2722
- const collectorRect$ = createVal(minimized$.value ? this._calcCollectorRect() : void 0);
3097
+ this._setCollectorRect = (collectorRect) => {
3098
+ var _a;
3099
+ if ((_a = collector$.value) == null ? void 0 : _a.$collector) {
3100
+ collectorRect$.setValue(collectorRect);
3101
+ }
3102
+ };
3103
+ const collectorRect$ = createVal(
3104
+ minimized$.value ? this._calcCollectorRect() : void 0
3105
+ );
2723
3106
  collectorRect$.subscribe((collectorRect, _, skipUpdate) => {
2724
3107
  this.boxes.forEach((box) => {
2725
3108
  box.setCollectorRect(collectorRect, skipUpdate);
2726
3109
  });
2727
3110
  });
2728
3111
  minimized$.subscribe((minimized2, _, skipUpdate) => {
2729
- var _a, _b;
3112
+ var _a;
2730
3113
  (_a = collector$.value) == null ? void 0 : _a.setVisible(minimized2);
2731
3114
  if (minimized2) {
2732
- if ((_b = collector$.value) == null ? void 0 : _b.$collector) {
2733
- collectorRect$.setValue(this._calcCollectorRect());
2734
- }
3115
+ this._setCollectorRect(this._calcCollectorRect());
2735
3116
  }
2736
- this.boxes.forEach((box) => box.setMinimized(minimized2, skipUpdate));
3117
+ this.boxes.forEach(
3118
+ (box) => box.setMinimized(minimized2, skipUpdate)
3119
+ );
2737
3120
  if (!skipUpdate) {
2738
3121
  this.events.emit(TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
2739
3122
  }
@@ -2756,17 +3139,45 @@ class TeleBoxManager {
2756
3139
  if (id) {
2757
3140
  const box = this.getBox(id);
2758
3141
  if (box) {
2759
- this.focusBox(box);
2760
- if (box.boxStatus && box.boxStatus !== TELE_BOX_STATE.Maximized || !box.boxStatus) {
3142
+ if (!this.useBoxesStatus) {
2761
3143
  this.makeBoxTop(box);
3144
+ } else {
3145
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3146
+ const maxNormalBoxZIndex = this.getMaxNormalBoxZIndex();
3147
+ if (maxNormalBoxZIndex > box.zIndex) {
3148
+ this.setBox(box, {
3149
+ zIndex: maxNormalBoxZIndex + 1
3150
+ }, false);
3151
+ }
3152
+ } else if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3153
+ const maxMaximizedBoxZIndex = this.getMaxMaximizedBoxZIndex();
3154
+ if (maxMaximizedBoxZIndex > box.zIndex) {
3155
+ this.setBox(box, {
3156
+ zIndex: maxMaximizedBoxZIndex + 1
3157
+ }, false);
3158
+ }
3159
+ this.makeMaximizedTopBoxFocus();
3160
+ }
2762
3161
  }
3162
+ console.log("checkFocusBox===>", box.id);
3163
+ this.focusBox(box);
2763
3164
  return;
2764
3165
  }
2765
3166
  }
2766
3167
  }
2767
3168
  };
2768
- this._sideEffect.addEventListener(window, "mousedown", checkFocusBox, true);
2769
- this._sideEffect.addEventListener(window, "touchstart", checkFocusBox, true);
3169
+ this._sideEffect.addEventListener(
3170
+ window,
3171
+ "mousedown",
3172
+ checkFocusBox,
3173
+ true
3174
+ );
3175
+ this._sideEffect.addEventListener(
3176
+ window,
3177
+ "touchstart",
3178
+ checkFocusBox,
3179
+ true
3180
+ );
2770
3181
  this.maxTitleBar = new MaxTitleBar({
2771
3182
  darkMode: this.darkMode,
2772
3183
  readonly: readonly$.value,
@@ -2778,32 +3189,81 @@ class TeleBoxManager {
2778
3189
  return this.boxesStatus$;
2779
3190
  },
2780
3191
  onEvent: (event) => {
2781
- var _a, _b, _c;
2782
3192
  switch (event.type) {
2783
3193
  case TELE_BOX_DELEGATE_EVENT.Maximize: {
2784
- if (this.hasBoxesStatus() && ((_a = this.maxTitleBar.focusedBox) == null ? void 0 : _a.id)) {
2785
- this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Normal);
2786
- this.effectBoxStatusChange();
2787
- this.makeMaximizedTopBoxFocus();
3194
+ if (this.hasBoxesStatus()) {
3195
+ let targetBox = this.maxTitleBar.focusedBox;
3196
+ if (!targetBox) {
3197
+ targetBox = this.getMaximizedTopBox();
3198
+ }
3199
+ if (targetBox == null ? void 0 : targetBox.id) {
3200
+ const box = this.getBox(targetBox.id);
3201
+ if (box) {
3202
+ this.setBox(box, {
3203
+ status: TELE_BOX_STATE.Normal,
3204
+ zIndex: this.getMaxNormalBoxZIndex() + 1
3205
+ }, false, () => {
3206
+ this.makeMaximizedTopBoxFocus();
3207
+ });
3208
+ }
3209
+ }
2788
3210
  } else {
2789
3211
  maximized$.setValue(!maximized$.value);
2790
3212
  }
2791
3213
  break;
2792
3214
  }
2793
3215
  case TELE_BOX_DELEGATE_EVENT.Minimize: {
2794
- if (this.hasBoxesStatus() && ((_b = this.maxTitleBar.focusedBox) == null ? void 0 : _b.id)) {
2795
- this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Minimized);
2796
- this.effectBoxStatusChange();
2797
- this.makeMaximizedTopBoxFocus();
3216
+ if (this.hasBoxesStatus()) {
3217
+ let targetBox = this.maxTitleBar.focusedBox;
3218
+ if (!targetBox) {
3219
+ targetBox = this.getMaximizedTopBox();
3220
+ }
3221
+ if (targetBox == null ? void 0 : targetBox.id) {
3222
+ const box = this.getBox(targetBox.id);
3223
+ if (box) {
3224
+ let isFocusChanged = false;
3225
+ if (this.topBox === box) {
3226
+ this.blurBox(box);
3227
+ isFocusChanged = true;
3228
+ }
3229
+ this.setBox(box, {
3230
+ status: TELE_BOX_STATE.Minimized,
3231
+ zIndex: -1
3232
+ }, false);
3233
+ if (isFocusChanged) {
3234
+ this.focusTopBox();
3235
+ } else {
3236
+ this.makeMaximizedTopBoxFocus();
3237
+ }
3238
+ }
3239
+ }
2798
3240
  } else {
2799
3241
  minimized$.setValue(true);
2800
3242
  }
2801
3243
  break;
2802
3244
  }
2803
3245
  case TELE_BOX_EVENT.Close: {
2804
- if (this.hasBoxesStatus() && ((_c = this.maxTitleBar.focusedBox) == null ? void 0 : _c.id)) {
2805
- this.remove(this.maxTitleBar.focusedBox.id);
2806
- this.makeMaximizedTopBoxFocus();
3246
+ if (this.hasBoxesStatus()) {
3247
+ let targetBox = this.maxTitleBar.focusedBox;
3248
+ if (!targetBox) {
3249
+ targetBox = this.getMaximizedTopBox();
3250
+ }
3251
+ if (targetBox == null ? void 0 : targetBox.id) {
3252
+ const box = this.getBox(targetBox.id);
3253
+ if (box) {
3254
+ let isFocusChanged = false;
3255
+ if (this.topBox === box) {
3256
+ this.blurBox(box);
3257
+ isFocusChanged = true;
3258
+ }
3259
+ this.remove(box, false);
3260
+ if (isFocusChanged) {
3261
+ this.focusTopBox();
3262
+ } else {
3263
+ this.makeMaximizedTopBoxFocus();
3264
+ }
3265
+ }
3266
+ }
2807
3267
  } else {
2808
3268
  this.removeTopBox();
2809
3269
  this.focusTopBox();
@@ -2813,7 +3273,9 @@ class TeleBoxManager {
2813
3273
  }
2814
3274
  }
2815
3275
  });
2816
- readonly$.subscribe((readonly2) => this.maxTitleBar.setReadonly(readonly2));
3276
+ readonly$.subscribe(
3277
+ (readonly2) => this.maxTitleBar.setReadonly(readonly2)
3278
+ );
2817
3279
  this._darkMode$.subscribe((darkMode) => {
2818
3280
  this.maxTitleBar.setDarkMode(darkMode);
2819
3281
  });
@@ -2833,6 +3295,9 @@ class TeleBoxManager {
2833
3295
  i(this, valConfig);
2834
3296
  this._state$ = state$;
2835
3297
  this.root.appendChild(this.maxTitleBar.render());
3298
+ if (useBoxesStatus) {
3299
+ this.appMenu = this.createMinimizedAppMenu();
3300
+ }
2836
3301
  }
2837
3302
  get boxes() {
2838
3303
  return this.boxes$.value;
@@ -2872,15 +3337,12 @@ class TeleBoxManager {
2872
3337
  this.boxesStatus$.set(boxId, boxStatus);
2873
3338
  if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
2874
3339
  this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
2875
- this.effectLastNotMinimizedBoxStatusChange();
2876
3340
  } else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
2877
3341
  this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
2878
- this.effectLastNotMinimizedBoxStatusChange();
2879
3342
  }
2880
3343
  } else {
2881
3344
  this.boxesStatus$.delete(boxId);
2882
3345
  this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
2883
- this.effectLastNotMinimizedBoxStatusChange();
2884
3346
  }
2885
3347
  if (!skipUpdate) {
2886
3348
  this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
@@ -2889,9 +3351,6 @@ class TeleBoxManager {
2889
3351
  getBoxStatus(boxId) {
2890
3352
  return this.boxesStatus$.get(boxId);
2891
3353
  }
2892
- getLastNotMinimizedBoxStatus(boxId) {
2893
- return this.lastNotMinimizedBoxesStatus$.get(boxId);
2894
- }
2895
3354
  get boxesStatus() {
2896
3355
  return this.boxesStatus$;
2897
3356
  }
@@ -2900,72 +3359,154 @@ class TeleBoxManager {
2900
3359
  }
2901
3360
  setBoxesStatus(boxesStatus, skipUpdate = false) {
2902
3361
  this.boxesStatus$ = boxesStatus;
2903
- this.effectBoxStatusChange(skipUpdate);
2904
- }
2905
- effectBoxStatusTimerFunc(skipUpdate) {
2906
- var _a, _b, _c, _d;
2907
- this.effectBoxStatusTimer = void 0;
2908
- let topBox;
2909
- const topBoxId = (_a = this.topBox) == null ? void 0 : _a.id;
2910
- let hasMinimizedBox = false;
3362
+ this.effectBoxesStatusChange(skipUpdate);
3363
+ }
3364
+ getBoxesStatus() {
3365
+ return this.boxesStatus$;
3366
+ }
3367
+ effectBoxStatusChange() {
3368
+ if (!this.useBoxesStatus) {
3369
+ return;
3370
+ }
3371
+ if (this.collector) {
3372
+ this.collector.updateBoxesStatus();
3373
+ if (this.hasMinimizedBox()) {
3374
+ this._setCollectorRect(this._calcCollectorRect());
3375
+ }
3376
+ }
3377
+ if (this.appMenu) {
3378
+ this.appMenu.appMenuChange();
3379
+ }
3380
+ if (this.maxTitleBar) {
3381
+ this.maxTitleBar.updateBoxesStatus();
3382
+ }
3383
+ }
3384
+ effectBoxesStatusTimerFunc(skipUpdate) {
3385
+ if (!this.useBoxesStatus) {
3386
+ return;
3387
+ }
3388
+ let newTopBox;
3389
+ const curTopBox = this.topBox;
2911
3390
  this.boxes.forEach((box) => {
2912
- var _a2;
3391
+ var _a;
2913
3392
  const boxStatus = this.boxesStatus$.get(box.id);
2914
3393
  if (boxStatus) {
2915
- if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a2 = topBox == null ? void 0 : topBox.zIndex) != null ? _a2 : 0)) {
2916
- topBox = box;
3394
+ if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3395
+ newTopBox = box;
2917
3396
  }
2918
3397
  box.setBoxStatus(boxStatus, skipUpdate);
2919
- if (boxStatus === TELE_BOX_STATE.Minimized) {
2920
- hasMinimizedBox = true;
2921
- }
2922
3398
  }
2923
3399
  });
2924
- if (hasMinimizedBox) {
2925
- (_b = this.collector) == null ? void 0 : _b.setVisible(true);
2926
- if ((_c = this.collector) == null ? void 0 : _c.$collector) {
2927
- this.setCollectorRect(this._calcCollectorRect());
3400
+ this.effectBoxStatusChange();
3401
+ if (newTopBox && curTopBox !== newTopBox) {
3402
+ this.topBox$.setValue(newTopBox);
3403
+ this.focusBox(newTopBox, skipUpdate);
3404
+ }
3405
+ if (!newTopBox && curTopBox) {
3406
+ this.topBox$.setValue(void 0);
3407
+ this.blurBox(curTopBox, skipUpdate);
3408
+ }
3409
+ }
3410
+ async effectBoxesStatusChange(skipUpdate = false) {
3411
+ var _a, _b, _c, _d, _e, _f;
3412
+ if (!this.useBoxesStatus) {
3413
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
3414
+ clearTimeout(this.effectBoxesStatusTimer.timer);
3415
+ if (this.effectBoxesStatusTimer.resolve) {
3416
+ this.effectBoxesStatusTimer.resolve(!!((_a = this.effectBoxesStatusTimer) == null ? void 0 : _a.skipUpdate));
3417
+ }
2928
3418
  }
2929
- } else {
2930
- (_d = this.collector) == null ? void 0 : _d.setVisible(false);
2931
- }
2932
- if (topBox && topBoxId !== topBox.id) {
2933
- this.makeBoxTop(topBox, skipUpdate);
2934
- this.topBox$.setValue(topBox);
2935
- this.focusTopBox();
2936
- }
2937
- if (this.maxTitleBar) {
2938
- this.maxTitleBar.updateBoxesStatus();
3419
+ this.effectBoxesStatusTimer = void 0;
3420
+ return;
2939
3421
  }
2940
- console.log("effectBoxStatusTimerFunc===>end", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
2941
- }
2942
- effectBoxStatusChange(skipUpdate = false) {
2943
- var _a, _b;
2944
- if (this.effectBoxStatusTimer && this.effectBoxStatusTimer.timer) {
2945
- clearTimeout(this.effectBoxStatusTimer.timer);
2946
- if (this.effectBoxStatusTimer.skipUpdate !== skipUpdate) {
2947
- this.effectBoxStatusTimer.skipUpdate = skipUpdate;
2948
- console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
2949
- this.effectBoxStatusTimerFunc(this.effectBoxStatusTimer.skipUpdate);
3422
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
3423
+ if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
3424
+ clearTimeout(this.effectBoxesStatusTimer.timer);
3425
+ if (this.effectBoxesStatusTimer.resolve) {
3426
+ console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
3427
+ this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
3428
+ }
3429
+ this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
3430
+ console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
3431
+ } else {
3432
+ return;
2950
3433
  }
2951
3434
  }
2952
- if (!this.effectBoxStatusTimer) {
2953
- this.effectBoxStatusTimer = {
3435
+ if (!this.effectBoxesStatusTimer) {
3436
+ this.effectBoxesStatusTimer = {
2954
3437
  skipUpdate,
2955
- timer: void 0
3438
+ timer: void 0,
3439
+ resolve: void 0
2956
3440
  };
2957
3441
  }
2958
- console.log("effectBoxStatusTimerFunc===>000", skipUpdate, { id: (_a = this.topBox$.value) == null ? void 0 : _a.id, zIndex: (_b = this.topBox$.value) == null ? void 0 : _b.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
2959
- this.effectBoxStatusTimer.timer = setTimeout(() => {
2960
- this.effectBoxStatusTimerFunc(skipUpdate);
2961
- }, 100);
3442
+ if (this.effectBoxesStatusTimer) {
3443
+ const _skipUpdate = await new Promise((resolve) => {
3444
+ this.effectBoxesStatusTimer.resolve = resolve;
3445
+ this.effectBoxesStatusTimer.timer = setTimeout(() => {
3446
+ var _a2, _b2;
3447
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
3448
+ console.log("effectBoxStatusTimerFunc===>000", skipUpdate, { id: (_a2 = this.topBox$.value) == null ? void 0 : _a2.id, zIndex: (_b2 = this.topBox$.value) == null ? void 0 : _b2.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3449
+ this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
3450
+ }
3451
+ }, 100);
3452
+ });
3453
+ console.log("effectBoxStatusTimerFunc===>000==>00", skipUpdate, { id: (_c = this.topBox$.value) == null ? void 0 : _c.id, zIndex: (_d = this.topBox$.value) == null ? void 0 : _d.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3454
+ this.effectBoxesStatusTimerFunc(_skipUpdate);
3455
+ this.effectBoxesStatusTimer = void 0;
3456
+ console.log("effectBoxStatusTimerFunc===>000==>11", skipUpdate, { id: (_e = this.topBox$.value) == null ? void 0 : _e.id, zIndex: (_f = this.topBox$.value) == null ? void 0 : _f.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3457
+ }
2962
3458
  }
2963
3459
  hasBoxesStatus() {
3460
+ if (!this.useBoxesStatus) {
3461
+ return false;
3462
+ }
2964
3463
  return this.boxesStatus$.size > 0;
2965
3464
  }
2966
3465
  hasMinimizedBox() {
3466
+ if (!this.useBoxesStatus) {
3467
+ return false;
3468
+ }
2967
3469
  return this.boxes.some((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
2968
3470
  }
3471
+ getMinimizedBoxesStatus() {
3472
+ const minimizedBoxes = /* @__PURE__ */ new Map();
3473
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3474
+ if (boxStatus === TELE_BOX_STATE.Minimized) {
3475
+ minimizedBoxes.set(boxId, boxStatus);
3476
+ }
3477
+ });
3478
+ return minimizedBoxes;
3479
+ }
3480
+ getNotMinimizedBoxesStatus() {
3481
+ const notMinimizedBoxes = /* @__PURE__ */ new Map();
3482
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3483
+ if (boxStatus !== TELE_BOX_STATE.Minimized) {
3484
+ notMinimizedBoxes.set(boxId, boxStatus);
3485
+ }
3486
+ });
3487
+ return notMinimizedBoxes;
3488
+ }
3489
+ getAllMaximizedBoxesStatus() {
3490
+ const maximizedBoxes = /* @__PURE__ */ new Map();
3491
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3492
+ if (boxStatus === TELE_BOX_STATE.Maximized) {
3493
+ maximizedBoxes.set(boxId, boxStatus);
3494
+ }
3495
+ });
3496
+ return maximizedBoxes;
3497
+ }
3498
+ getAllNormalBoxesStatus() {
3499
+ const normalBoxes = /* @__PURE__ */ new Map();
3500
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3501
+ if (boxStatus === TELE_BOX_STATE.Normal) {
3502
+ normalBoxes.set(boxId, boxStatus);
3503
+ }
3504
+ });
3505
+ return normalBoxes;
3506
+ }
3507
+ getLastNotMinimizedBoxStatus(boxId) {
3508
+ return this.lastNotMinimizedBoxesStatus$.get(boxId);
3509
+ }
2969
3510
  setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
2970
3511
  if (lastNotMinimizedBoxStatus) {
2971
3512
  this.lastNotMinimizedBoxesStatus$.set(boxId, lastNotMinimizedBoxStatus);
@@ -2980,19 +3521,97 @@ class TeleBoxManager {
2980
3521
  this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
2981
3522
  this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
2982
3523
  }
2983
- effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
3524
+ async effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
3525
+ var _a, _b;
3526
+ if (!this.useBoxesStatus) {
3527
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
3528
+ clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
3529
+ if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3530
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_a = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _a.skipUpdate));
3531
+ }
3532
+ }
3533
+ this.effectLastNotMinimizedBoxStatusTimer = void 0;
3534
+ return;
3535
+ }
3536
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
3537
+ clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
3538
+ if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
3539
+ if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3540
+ console.log("effectLastNotMinimizedBoxStatusFunc===>1111", skipUpdate);
3541
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
3542
+ }
3543
+ this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
3544
+ console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
3545
+ } else {
3546
+ return;
3547
+ }
3548
+ }
3549
+ if (!this.effectLastNotMinimizedBoxStatusTimer) {
3550
+ this.effectLastNotMinimizedBoxStatusTimer = {
3551
+ skipUpdate,
3552
+ timer: void 0,
3553
+ resolve: void 0
3554
+ };
3555
+ }
3556
+ if (this.effectLastNotMinimizedBoxStatusTimer) {
3557
+ const _skipUpdate = await new Promise((resolve) => {
3558
+ this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
3559
+ this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
3560
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3561
+ console.log("effectLastNotMinimizedBoxStatusTimer===>000", skipUpdate);
3562
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
3563
+ }
3564
+ }, 100);
3565
+ });
3566
+ console.log("effectLastNotMinimizedBoxStatusFunc===>000==>00", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
3567
+ this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
3568
+ this.effectLastNotMinimizedBoxStatusTimer = void 0;
3569
+ console.log("effectLastNotMinimizedBoxStatusFunc===>000==>11", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
3570
+ }
3571
+ }
3572
+ effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
3573
+ if (!this.useBoxesStatus) {
3574
+ return;
3575
+ }
3576
+ console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
2984
3577
  this.boxes.forEach((box) => {
2985
3578
  const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
2986
- box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
3579
+ if (boxStatus) {
3580
+ box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
3581
+ }
2987
3582
  });
2988
3583
  }
2989
- getAllMinimizedBoxes() {
2990
- return this.boxes.filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
3584
+ getUnabledBoxesStatusZIndex() {
3585
+ return this.topBox ? this.topBox.zIndex : 99;
3586
+ }
3587
+ getMaxMaximizedBoxZIndex() {
3588
+ if (!this.useBoxesStatus) {
3589
+ return this.getUnabledBoxesStatusZIndex();
3590
+ }
3591
+ return this.boxes.reduce((maxZIndex, box) => {
3592
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3593
+ return Math.max(maxZIndex, box.zIndex);
3594
+ }
3595
+ return maxZIndex;
3596
+ }, 99);
3597
+ }
3598
+ getMaxNormalBoxZIndex() {
3599
+ if (!this.useBoxesStatus) {
3600
+ return this.getUnabledBoxesStatusZIndex();
3601
+ }
3602
+ return this.boxes.reduce((maxZIndex, box) => {
3603
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3604
+ return Math.max(maxZIndex, box.zIndex);
3605
+ }
3606
+ return maxZIndex;
3607
+ }, 299);
2991
3608
  }
2992
3609
  create(config = {}, smartPosition = true) {
2993
- const box = new TeleBox(__spreadProps(__spreadValues({
2994
- zIndex: this.topBox ? this.topBox.zIndex + 1 : 100
2995
- }, smartPosition ? this.smartPosition(config) : config), {
3610
+ var _a;
3611
+ console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
3612
+ const box = new TeleBox({
3613
+ zIndex: this.getMaxNormalBoxZIndex() + 1,
3614
+ ...smartPosition ? this.smartPosition(config) : config,
2996
3615
  darkMode: this.darkMode,
2997
3616
  prefersColorScheme: this.prefersColorScheme,
2998
3617
  maximized: this.maximized,
@@ -3002,48 +3621,58 @@ class TeleBoxManager {
3002
3621
  containerRect: this.containerRect,
3003
3622
  readonly: this.readonly,
3004
3623
  collectorRect: this.collectorRect
3005
- }));
3624
+ });
3006
3625
  box.mount(this.root);
3626
+ this.boxes$.setValue([...this.boxes, box]);
3627
+ if (box.boxStatus && this.useBoxesStatus) {
3628
+ this.setBox(box, {
3629
+ status: box.boxStatus,
3630
+ lastNotMinimizedBoxStatus: box._lastNotMinimizedBoxStatus$.value
3631
+ }, true);
3632
+ }
3007
3633
  if (box.focus) {
3008
3634
  this.focusBox(box);
3009
3635
  if (smartPosition) {
3010
3636
  this.makeBoxTop(box);
3011
3637
  }
3012
3638
  }
3013
- this.boxes$.setValue([...this.boxes, box]);
3014
- if (box.boxStatus) {
3015
- this.setBoxStatus(box.id, box.boxStatus, true);
3016
- this.effectBoxStatusChange(true);
3017
- }
3018
- if (box._lastNotMinimizedBoxStatus$.value) {
3019
- this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
3020
- this.effectLastNotMinimizedBoxStatusChange();
3021
- }
3022
3639
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
3023
- if (box.boxStatus) {
3640
+ if (this.useBoxesStatus && box.boxStatus) {
3024
3641
  if (box.boxStatus === TELE_BOX_STATE.Maximized) {
3025
- this.setBoxStatus(box.id, TELE_BOX_STATE.Normal);
3642
+ this.setBox(box.id, {
3643
+ status: TELE_BOX_STATE.Normal,
3644
+ zIndex: this.getMaxNormalBoxZIndex() + 1
3645
+ }, false);
3026
3646
  } else {
3027
- this.boxes.forEach((box2) => {
3647
+ [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3028
3648
  if (box2.boxStatus === TELE_BOX_STATE.Normal) {
3029
- this.setBoxStatus(box2.id, TELE_BOX_STATE.Maximized);
3649
+ console.log("maximized===>", box2.id);
3650
+ this.setBox(box2.id, {
3651
+ status: TELE_BOX_STATE.Maximized,
3652
+ zIndex: this.getMaxMaximizedBoxZIndex() + 1
3653
+ }, false);
3030
3654
  }
3031
3655
  });
3656
+ this.makeMaximizedTopBoxFocus();
3032
3657
  }
3033
- this.effectBoxStatusChange();
3034
- this.makeMaximizedTopBoxFocus();
3035
3658
  } else {
3036
3659
  this.setMaximized(!this.maximized);
3037
3660
  }
3038
3661
  });
3039
3662
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3040
- if (box.boxStatus) {
3041
- const oldBoxStatus = box.boxStatus;
3042
- this.setBoxStatus(box.id, TELE_BOX_STATE.Minimized);
3043
- this.effectBoxStatusChange();
3044
- if (oldBoxStatus === TELE_BOX_STATE.Maximized) {
3045
- this.makeMaximizedTopBoxFocus();
3663
+ var _a2;
3664
+ if (box.boxStatus && this.useBoxesStatus) {
3665
+ if (this.topBox === box) {
3666
+ if ((_a2 = this.topBox) == null ? void 0 : _a2.focus) {
3667
+ this.blurBox(this.topBox);
3668
+ }
3046
3669
  }
3670
+ this.setBox(box, {
3671
+ status: TELE_BOX_STATE.Minimized,
3672
+ zIndex: -1
3673
+ }, false, () => {
3674
+ this.focusTopBox();
3675
+ });
3047
3676
  } else {
3048
3677
  this.setMinimized(true);
3049
3678
  }
@@ -3079,12 +3708,19 @@ class TeleBoxManager {
3079
3708
  });
3080
3709
  box._zIndex$.reaction((_, __, skipUpdate) => {
3081
3710
  if (this.boxes.length > 0) {
3711
+ console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
3712
+ let currentTopBox = void 0;
3082
3713
  const topBox = this.boxes.reduce((topBox2, box2) => {
3083
3714
  if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
3084
3715
  return topBox2;
3085
3716
  }
3717
+ if (!topBox2) {
3718
+ topBox2 = box2;
3719
+ return topBox2;
3720
+ }
3086
3721
  return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
3087
- });
3722
+ }, currentTopBox);
3723
+ console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
3088
3724
  this.topBox$.setValue(topBox);
3089
3725
  }
3090
3726
  if (!skipUpdate) {
@@ -3111,7 +3747,26 @@ class TeleBoxManager {
3111
3747
  this.updateBox(box, config, skipUpdate);
3112
3748
  });
3113
3749
  }
3114
- remove(boxOrID, skipUpdate = false) {
3750
+ setBox(boxOrID, options, skipUpdate = false, effectFunc) {
3751
+ const box = this.getBox(boxOrID);
3752
+ if (box) {
3753
+ const { status, zIndex, lastNotMinimizedBoxStatus } = options;
3754
+ if (status) {
3755
+ this.setBoxStatus(box.id, status, skipUpdate);
3756
+ box.setBoxStatus(status, skipUpdate);
3757
+ this.effectBoxStatusChange();
3758
+ }
3759
+ if (zIndex) {
3760
+ box.setZIndex(zIndex, skipUpdate);
3761
+ }
3762
+ if (lastNotMinimizedBoxStatus) {
3763
+ this.setLastNotMinimizedBoxStatus(box.id, lastNotMinimizedBoxStatus, skipUpdate);
3764
+ box.setLastNotMinimizedBoxStatus(lastNotMinimizedBoxStatus, skipUpdate);
3765
+ }
3766
+ effectFunc && effectFunc();
3767
+ }
3768
+ }
3769
+ remove(boxOrID, skipUpdate = false, effectFunc) {
3115
3770
  const box = this.getBox(boxOrID);
3116
3771
  const index2 = this.getBoxIndex(boxOrID);
3117
3772
  if (index2 >= 0) {
@@ -3119,13 +3774,11 @@ class TeleBoxManager {
3119
3774
  const deletedBoxes = boxes.splice(index2, 1);
3120
3775
  this.boxes$.setValue(boxes);
3121
3776
  deletedBoxes.forEach((box2) => box2.destroy());
3122
- if (box) {
3777
+ if (box && this.useBoxesStatus) {
3123
3778
  this.setBoxStatus(box.id, void 0, skipUpdate);
3124
- this.boxesStatus$.delete(box.id);
3125
- this.effectBoxStatusChange(skipUpdate);
3126
3779
  this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
3127
- this.lastNotMinimizedBoxesStatus$.delete(box.id);
3128
- this.effectLastNotMinimizedBoxStatusChange();
3780
+ this.effectBoxStatusChange();
3781
+ effectFunc && effectFunc();
3129
3782
  }
3130
3783
  if (!skipUpdate) {
3131
3784
  if (this.boxes.length <= 0) {
@@ -3184,16 +3837,19 @@ class TeleBoxManager {
3184
3837
  targetBox.setFocus(true, skipUpdate);
3185
3838
  }
3186
3839
  if (focusChanged && !skipUpdate) {
3187
- this.events.emit(TELE_BOX_MANAGER_EVENT.Focused, targetBox);
3840
+ this.events.emit(
3841
+ TELE_BOX_MANAGER_EVENT.Focused,
3842
+ targetBox
3843
+ );
3188
3844
  }
3189
3845
  } else if (box.focus) {
3190
3846
  this.blurBox(box, skipUpdate);
3191
3847
  }
3192
3848
  });
3193
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3194
- this.makeMaximizedBoxFocus(targetBox);
3195
- } else {
3849
+ if (!this.useBoxesStatus) {
3196
3850
  this.maxTitleBar.focusBox(targetBox);
3851
+ } else if (this.useBoxesStatus && this.maxTitleBar.hasMaximizedBoxInStatus()) {
3852
+ this.makeMaximizedTopBoxFocus();
3197
3853
  }
3198
3854
  }
3199
3855
  }
@@ -3212,11 +3868,7 @@ class TeleBoxManager {
3212
3868
  }
3213
3869
  }
3214
3870
  if (this.maxTitleBar.focusedBox === targetBox) {
3215
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3216
- this.makeMaximizedTopBoxFocus();
3217
- } else {
3218
- this.maxTitleBar.focusBox();
3219
- }
3871
+ this.maxTitleBar.focusBox();
3220
3872
  }
3221
3873
  }
3222
3874
  }
@@ -3230,11 +3882,7 @@ class TeleBoxManager {
3230
3882
  }
3231
3883
  });
3232
3884
  if (this.maxTitleBar.focusedBox) {
3233
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3234
- this.makeMaximizedBoxBlur();
3235
- } else {
3236
- this.maxTitleBar.focusBox();
3237
- }
3885
+ this.maxTitleBar.focusBox();
3238
3886
  }
3239
3887
  }
3240
3888
  teleBoxMatcher(config) {
@@ -3243,10 +3891,18 @@ class TeleBoxManager {
3243
3891
  }
3244
3892
  updateBox(box, config, skipUpdate = false) {
3245
3893
  if (config.x != null || config.y != null) {
3246
- box.move(config.x == null ? box.intrinsicX : config.x, config.y == null ? box.intrinsicY : config.y, skipUpdate);
3894
+ box.move(
3895
+ config.x == null ? box.intrinsicX : config.x,
3896
+ config.y == null ? box.intrinsicY : config.y,
3897
+ skipUpdate
3898
+ );
3247
3899
  }
3248
3900
  if (config.width != null || config.height != null) {
3249
- box.resize(config.width == null ? box.intrinsicWidth : config.width, config.height == null ? box.intrinsicHeight : config.height, skipUpdate);
3901
+ box.resize(
3902
+ config.width == null ? box.intrinsicWidth : config.width,
3903
+ config.height == null ? box.intrinsicHeight : config.height,
3904
+ skipUpdate
3905
+ );
3250
3906
  }
3251
3907
  if (config.title != null) {
3252
3908
  box.setTitle(config.title);
@@ -3279,13 +3935,11 @@ class TeleBoxManager {
3279
3935
  if (config.footer != null) {
3280
3936
  box.mountFooter(config.footer);
3281
3937
  }
3282
- if (config.boxStatus) {
3283
- this.setBoxStatus(box.id, config.boxStatus, skipUpdate);
3284
- this.effectBoxStatusChange(skipUpdate);
3285
- }
3286
- if (config.lastNotMinimizedBoxStatus) {
3287
- this.setLastNotMinimizedBoxStatus(box.id, config.lastNotMinimizedBoxStatus, skipUpdate);
3288
- this.effectLastNotMinimizedBoxStatusChange();
3938
+ if (this.useBoxesStatus && (config.boxStatus || config.lastNotMinimizedBoxStatus)) {
3939
+ this.setBox(box, {
3940
+ status: config.boxStatus,
3941
+ lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
3942
+ }, skipUpdate);
3289
3943
  }
3290
3944
  }
3291
3945
  smartPosition(config = {}) {
@@ -3298,6 +3952,10 @@ class TeleBoxManager {
3298
3952
  if (vx > this.containerRect.width - width * this.containerRect.width) {
3299
3953
  vx = 20;
3300
3954
  }
3955
+ } else if (this.hasMinimizedBox()) {
3956
+ vx = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxX, box) => {
3957
+ return Math.max(maxX, box.intrinsicX * this.containerRect.width + 20);
3958
+ }, vx);
3301
3959
  }
3302
3960
  x = vx / this.containerRect.width;
3303
3961
  }
@@ -3308,37 +3966,27 @@ class TeleBoxManager {
3308
3966
  if (vy > this.containerRect.height - height * this.containerRect.height) {
3309
3967
  vy = 20;
3310
3968
  }
3969
+ } else if (this.hasMinimizedBox()) {
3970
+ vy = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxY, box) => {
3971
+ return Math.max(maxY, box.intrinsicY * this.containerRect.height + 20);
3972
+ }, vy);
3311
3973
  }
3312
3974
  y = vy / this.containerRect.height;
3313
3975
  }
3314
- return __spreadProps(__spreadValues({}, config), { x, y, width, height });
3976
+ return { ...config, x, y, width, height };
3315
3977
  }
3316
3978
  makeBoxTop(box, skipUpdate = false) {
3317
- if (this.topBox) {
3979
+ if (!this.useBoxesStatus && this.topBox) {
3318
3980
  if (box !== this.topBox) {
3319
- if (!this.hasBoxesStatus()) {
3320
- box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3321
- return;
3322
- }
3323
- const maxZIndex = this.boxes.reduce((maxZIndex2, box2) => {
3324
- return Math.max(maxZIndex2, box2.zIndex);
3325
- }, 0);
3326
- const currentTopBoxZIndex = Math.min(this.topBox.zIndex, box.zIndex);
3327
- const addZIndex = maxZIndex + 1 - currentTopBoxZIndex;
3328
- box.setZIndex(maxZIndex + 1, skipUpdate);
3329
- console.log("makeBoxTop===>", box.id, maxZIndex + 1, addZIndex, this.topBox.id, currentTopBoxZIndex);
3330
- if (box.boxStatus !== TELE_BOX_STATE.Minimized) {
3331
- this.boxes.forEach((b) => {
3332
- if (b.boxStatus === TELE_BOX_STATE.Minimized && b.zIndex >= currentTopBoxZIndex) {
3333
- console.log("makeBoxTop===>111", b.id, b.zIndex + addZIndex);
3334
- b.setZIndex(b.zIndex + addZIndex, skipUpdate);
3335
- }
3336
- });
3337
- }
3981
+ box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3338
3982
  }
3339
- }
3983
+ } else if (this.useBoxesStatus)
3984
+ ;
3340
3985
  }
3341
- makeMaximizedTopBoxFocus() {
3986
+ getMaximizedTopBox() {
3987
+ if (!this.useBoxesStatus) {
3988
+ return void 0;
3989
+ }
3342
3990
  let maximizedBox;
3343
3991
  if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3344
3992
  maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, currentBox) => {
@@ -3347,36 +3995,17 @@ class TeleBoxManager {
3347
3995
  }
3348
3996
  return topBox.zIndex > currentBox.zIndex ? topBox : currentBox;
3349
3997
  });
3350
- if (maximizedBox) {
3351
- this.maxTitleBar.focusBox(maximizedBox);
3352
- }
3353
3998
  }
3999
+ return maximizedBox;
3354
4000
  }
3355
- makeMaximizedBoxFocus(maximizedBox, skipUpdate = false) {
3356
- if (this.maxTitleBar.hasMaximizedBoxInStatus() && this.maxTitleBar.MaximizedBoxes.find((box) => box.id === maximizedBox.id)) {
3357
- const currentZIndex = maximizedBox.zIndex;
3358
- const currentMaximizedTopBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, box) => {
3359
- if (!topBox) {
3360
- return box;
3361
- }
3362
- return topBox.zIndex > box.zIndex ? topBox : box;
3363
- });
3364
- if (currentMaximizedTopBox !== maximizedBox) {
3365
- const addZIndex = currentMaximizedTopBox.zIndex - currentZIndex + 1;
3366
- this.boxes.forEach((box) => {
3367
- if (this.maxTitleBar.MaximizedBoxes.find((b) => b.id === box.id && b.id !== maximizedBox.id)) {
3368
- return;
3369
- }
3370
- if (box.zIndex >= currentZIndex) {
3371
- box.setZIndex(box.zIndex + addZIndex, skipUpdate);
3372
- }
3373
- });
3374
- }
3375
- this.maxTitleBar.focusBox(maximizedBox);
4001
+ makeMaximizedTopBoxFocus() {
4002
+ if (!this.useBoxesStatus) {
4003
+ return;
3376
4004
  }
3377
- }
3378
- makeMaximizedBoxBlur() {
3379
- this.maxTitleBar.focusBox();
4005
+ const maximizedBox = this.getMaximizedTopBox();
4006
+ console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
4007
+ this.maxTitleBar.focusBox(maximizedBox);
4008
+ console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
3380
4009
  }
3381
4010
  getBoxIndex(boxOrID) {
3382
4011
  return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
@@ -3384,6 +4013,20 @@ class TeleBoxManager {
3384
4013
  getBox(boxOrID) {
3385
4014
  return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
3386
4015
  }
4016
+ createMinimizedAppMenu() {
4017
+ var _a, _b;
4018
+ if ((_a = this.collector) == null ? void 0 : _a.$appMenuContainer) {
4019
+ return new AppMenu({
4020
+ manager: this,
4021
+ container: (_b = this.collector) == null ? void 0 : _b.$appMenuContainer,
4022
+ theme: this.prefersColorScheme ? "dark" : "light",
4023
+ getBoxesStatus: () => {
4024
+ return this.boxesStatus$;
4025
+ }
4026
+ });
4027
+ }
4028
+ return;
4029
+ }
3387
4030
  }
3388
4031
  export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager };
3389
4032
  //# sourceMappingURL=telebox-insider.es.js.map