@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,34 +1,14 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports[Symbol.toStringTag] = "Module";
23
- 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}";
24
- 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}';
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ var fancyScrollbar = "";
4
+ var style$4 = "";
25
5
  var eventemitter3 = { exports: {} };
26
6
  (function(module) {
27
7
  var has = Object.prototype.hasOwnProperty, prefix = "~";
28
8
  function Events() {
29
9
  }
30
10
  if (Object.create) {
31
- Events.prototype = Object.create(null);
11
+ Events.prototype = /* @__PURE__ */ Object.create(null);
32
12
  if (!new Events().__proto__)
33
13
  prefix = false;
34
14
  }
@@ -214,8 +194,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
214
194
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
215
195
  PERFORMANCE OF THIS SOFTWARE.
216
196
  ***************************************************************************** */
217
- var __assign$1 = function() {
218
- __assign$1 = Object.assign || function __assign2(t2) {
197
+ var __assign = function() {
198
+ __assign = Object.assign || function __assign2(t2) {
219
199
  for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
220
200
  s2 = arguments[i2];
221
201
  for (var p in s2)
@@ -224,7 +204,7 @@ var __assign$1 = function() {
224
204
  }
225
205
  return t2;
226
206
  };
227
- return __assign$1.apply(this, arguments);
207
+ return __assign.apply(this, arguments);
228
208
  };
229
209
  function __rest(s2, e2) {
230
210
  var t2 = {};
@@ -255,8 +235,8 @@ var createStep = function(setRunNextFrame) {
255
235
  var numThisFrame = 0;
256
236
  var isProcessing2 = false;
257
237
  var i2 = 0;
258
- var cancelled = new WeakSet();
259
- var toKeepAlive = new WeakSet();
238
+ var cancelled = /* @__PURE__ */ new WeakSet();
239
+ var toKeepAlive = /* @__PURE__ */ new WeakSet();
260
240
  var renderStep = {
261
241
  cancel: function(process) {
262
242
  var indexOfCallback = processToRunNextFrame.indexOf(process);
@@ -361,32 +341,6 @@ var startLoop = function() {
361
341
  if (!isProcessing)
362
342
  onNextFrame(processFrame);
363
343
  };
364
- /*! *****************************************************************************
365
- Copyright (c) Microsoft Corporation.
366
-
367
- Permission to use, copy, modify, and/or distribute this software for any
368
- purpose with or without fee is hereby granted.
369
-
370
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
371
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
372
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
373
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
374
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
375
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
376
- PERFORMANCE OF THIS SOFTWARE.
377
- ***************************************************************************** */
378
- var __assign = function() {
379
- __assign = Object.assign || function __assign2(t2) {
380
- for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
381
- s2 = arguments[i2];
382
- for (var p in s2)
383
- if (Object.prototype.hasOwnProperty.call(s2, p))
384
- t2[p] = s2[p];
385
- }
386
- return t2;
387
- };
388
- return __assign.apply(this, arguments);
389
- };
390
344
  var clamp$1 = function(min, max) {
391
345
  return function(v) {
392
346
  return Math.max(Math.min(v, max), min);
@@ -544,7 +498,7 @@ var color = {
544
498
  }
545
499
  };
546
500
  var createStyler = function(_a) {
547
- 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;
501
+ 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;
548
502
  return function(_a2) {
549
503
  if (_a2 === void 0) {
550
504
  _a2 = {};
@@ -627,7 +581,7 @@ var testPrefix = function(key) {
627
581
  return;
628
582
  }
629
583
  camelCache.set(key, prefixedPropertyName);
630
- setDashPrefix(key, "" + (noPrefix ? "" : "-") + camelToDash(prefixedPropertyName));
584
+ setDashPrefix(key, (noPrefix ? "" : "-") + camelToDash(prefixedPropertyName));
631
585
  }
632
586
  }
633
587
  };
@@ -666,7 +620,7 @@ var transformOriginProps = /* @__PURE__ */ new Set(["originX", "originY", "origi
666
620
  function isTransformOriginProp(key) {
667
621
  return transformOriginProps.has(key);
668
622
  }
669
- var int = /* @__PURE__ */ __assign$1(/* @__PURE__ */ __assign$1({}, number), { transform: Math.round });
623
+ var int = /* @__PURE__ */ __assign(/* @__PURE__ */ __assign({}, number), { transform: Math.round });
670
624
  var valueTypes = {
671
625
  color,
672
626
  backgroundColor: color,
@@ -885,7 +839,7 @@ function createCssStyler(element, _a) {
885
839
  _a = {};
886
840
  }
887
841
  var enableHardwareAcceleration = _a.enableHardwareAcceleration, allowTransformNone = _a.allowTransformNone, props = __rest(_a, ["enableHardwareAcceleration", "allowTransformNone"]);
888
- return cssStyler(__assign$1({ element, buildStyles: createStyleBuilder({
842
+ return cssStyler(__assign({ element, buildStyles: createStyleBuilder({
889
843
  enableHardwareAcceleration,
890
844
  allowTransformNone
891
845
  }), preparseOutput: true }, props));
@@ -1075,7 +1029,7 @@ const e$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop
1075
1029
  };
1076
1030
  class o {
1077
1031
  constructor() {
1078
- this.disposers = new Map();
1032
+ this.disposers = /* @__PURE__ */ new Map();
1079
1033
  }
1080
1034
  add(e2, s2 = r$1()) {
1081
1035
  return this.flush(s2), this.disposers.set(s2, e2()), s2;
@@ -1123,9 +1077,9 @@ class o {
1123
1077
  }), this.disposers.clear();
1124
1078
  }
1125
1079
  }
1126
- var e = Object.defineProperty, s = (typeof require != "undefined" && require, (s2, r2, t2) => (((s3, r3, t3) => {
1080
+ var e = Object.defineProperty, s = ("undefined" != typeof require && require, (s2, r2, t2) => (((s3, r3, t3) => {
1127
1081
  r3 in s3 ? e(s3, r3, { enumerable: true, configurable: true, writable: true, value: t3 }) : s3[r3] = t3;
1128
- })(s2, typeof r2 != "symbol" ? r2 + "" : r2, t2), t2));
1082
+ })(s2, "symbol" != typeof r2 ? r2 + "" : r2, t2), t2));
1129
1083
  class r {
1130
1084
  constructor(e2, r2) {
1131
1085
  s(this, "_value"), s(this, "_beforeDestroys"), s(this, "_subscribers"), this._value = e2, r2 && (this.compare = r2);
@@ -1140,7 +1094,7 @@ class r {
1140
1094
  }
1141
1095
  }
1142
1096
  reaction(e2) {
1143
- return this._subscribers || (this._subscribers = new Set()), this._subscribers.add(e2), () => {
1097
+ return this._subscribers || (this._subscribers = /* @__PURE__ */ new Set()), this._subscribers.add(e2), () => {
1144
1098
  this._subscribers && this._subscribers.delete(e2);
1145
1099
  };
1146
1100
  }
@@ -1158,7 +1112,7 @@ class r {
1158
1112
  this._beforeDestroys && (this._beforeDestroys.forEach((e2) => e2()), this._beforeDestroys.clear()), this._subscribers && this._subscribers.clear();
1159
1113
  }
1160
1114
  addBeforeDestroy(e2) {
1161
- return this._beforeDestroys || (this._beforeDestroys = new Set()), this._beforeDestroys.add(e2), () => {
1115
+ return this._beforeDestroys || (this._beforeDestroys = /* @__PURE__ */ new Set()), this._beforeDestroys.add(e2), () => {
1162
1116
  this._beforeDestroys && this._beforeDestroys.delete(e2);
1163
1117
  };
1164
1118
  }
@@ -1199,21 +1153,20 @@ function c(e2) {
1199
1153
  };
1200
1154
  return { bindSideEffect: s2, combine: (e3, r2, i2, o2) => s2(t(e3, r2, i2, o2)), createVal: (e3, t2) => s2(new r(e3, t2)) };
1201
1155
  }
1202
- 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}';
1203
- exports.TELE_BOX_COLOR_SCHEME = void 0;
1204
- (function(TELE_BOX_COLOR_SCHEME2) {
1156
+ var style$3 = "";
1157
+ var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
1205
1158
  TELE_BOX_COLOR_SCHEME2["Light"] = "light";
1206
1159
  TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
1207
1160
  TELE_BOX_COLOR_SCHEME2["Auto"] = "auto";
1208
- })(exports.TELE_BOX_COLOR_SCHEME || (exports.TELE_BOX_COLOR_SCHEME = {}));
1209
- exports.TELE_BOX_STATE = void 0;
1210
- (function(TELE_BOX_STATE2) {
1161
+ return TELE_BOX_COLOR_SCHEME2;
1162
+ })(TELE_BOX_COLOR_SCHEME || {});
1163
+ var TELE_BOX_STATE = /* @__PURE__ */ ((TELE_BOX_STATE2) => {
1211
1164
  TELE_BOX_STATE2["Normal"] = "normal";
1212
1165
  TELE_BOX_STATE2["Minimized"] = "minimized";
1213
1166
  TELE_BOX_STATE2["Maximized"] = "maximized";
1214
- })(exports.TELE_BOX_STATE || (exports.TELE_BOX_STATE = {}));
1215
- exports.TELE_BOX_EVENT = void 0;
1216
- (function(TELE_BOX_EVENT2) {
1167
+ return TELE_BOX_STATE2;
1168
+ })(TELE_BOX_STATE || {});
1169
+ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
1217
1170
  TELE_BOX_EVENT2["DarkMode"] = "dark_mode";
1218
1171
  TELE_BOX_EVENT2["PrefersColorScheme"] = "prefers_color_scheme";
1219
1172
  TELE_BOX_EVENT2["Close"] = "close";
@@ -1232,15 +1185,15 @@ exports.TELE_BOX_EVENT = void 0;
1232
1185
  TELE_BOX_EVENT2["Destroyed"] = "destroyed";
1233
1186
  TELE_BOX_EVENT2["BoxStatus"] = "box_status";
1234
1187
  TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
1235
- })(exports.TELE_BOX_EVENT || (exports.TELE_BOX_EVENT = {}));
1236
- exports.TELE_BOX_DELEGATE_EVENT = void 0;
1237
- (function(TELE_BOX_DELEGATE_EVENT2) {
1188
+ return TELE_BOX_EVENT2;
1189
+ })(TELE_BOX_EVENT || {});
1190
+ var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
1238
1191
  TELE_BOX_DELEGATE_EVENT2["Close"] = "close";
1239
1192
  TELE_BOX_DELEGATE_EVENT2["Maximize"] = "maximize";
1240
1193
  TELE_BOX_DELEGATE_EVENT2["Minimize"] = "minimize";
1241
- })(exports.TELE_BOX_DELEGATE_EVENT || (exports.TELE_BOX_DELEGATE_EVENT = {}));
1242
- exports.TELE_BOX_RESIZE_HANDLE = void 0;
1243
- (function(TELE_BOX_RESIZE_HANDLE2) {
1194
+ return TELE_BOX_DELEGATE_EVENT2;
1195
+ })(TELE_BOX_DELEGATE_EVENT || {});
1196
+ var TELE_BOX_RESIZE_HANDLE = /* @__PURE__ */ ((TELE_BOX_RESIZE_HANDLE2) => {
1244
1197
  TELE_BOX_RESIZE_HANDLE2["North"] = "n";
1245
1198
  TELE_BOX_RESIZE_HANDLE2["South"] = "s";
1246
1199
  TELE_BOX_RESIZE_HANDLE2["West"] = "w";
@@ -1249,7 +1202,8 @@ exports.TELE_BOX_RESIZE_HANDLE = void 0;
1249
1202
  TELE_BOX_RESIZE_HANDLE2["NorthEast"] = "ne";
1250
1203
  TELE_BOX_RESIZE_HANDLE2["SouthEast"] = "se";
1251
1204
  TELE_BOX_RESIZE_HANDLE2["SouthWest"] = "sw";
1252
- })(exports.TELE_BOX_RESIZE_HANDLE || (exports.TELE_BOX_RESIZE_HANDLE = {}));
1205
+ return TELE_BOX_RESIZE_HANDLE2;
1206
+ })(TELE_BOX_RESIZE_HANDLE || {});
1253
1207
  const TeleBoxDragHandleType = "dh";
1254
1208
  function clamp(value, min, max) {
1255
1209
  return Math.min(Math.max(value, min), max);
@@ -1284,7 +1238,7 @@ class DefaultTitleBar {
1284
1238
  onEvent,
1285
1239
  onDragStart,
1286
1240
  namespace = "telebox",
1287
- state = exports.TELE_BOX_STATE.Normal,
1241
+ state = TELE_BOX_STATE.Normal,
1288
1242
  boxStatus
1289
1243
  } = {}) {
1290
1244
  this.$btns = [];
@@ -1310,7 +1264,7 @@ class DefaultTitleBar {
1310
1264
  if (now - this.lastTitleBarClick.timestamp <= 500) {
1311
1265
  if (Math.abs(ev.clientX - this.lastTitleBarClick.clientX) <= 5 && Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <= 5) {
1312
1266
  if (this.onEvent) {
1313
- this.onEvent({ type: exports.TELE_BOX_DELEGATE_EVENT.Maximize });
1267
+ this.onEvent({ type: TELE_BOX_DELEGATE_EVENT.Maximize });
1314
1268
  }
1315
1269
  }
1316
1270
  } else if (this.onDragStart) {
@@ -1342,7 +1296,7 @@ class DefaultTitleBar {
1342
1296
  if (now - this.lastTitleBarTouch.timestamp <= 500) {
1343
1297
  if (Math.abs(clientX - this.lastTitleBarTouch.clientX) <= 10 && Math.abs(clientY - this.lastTitleBarTouch.clientY) <= 10) {
1344
1298
  if (this.onEvent) {
1345
- this.onEvent({ type: exports.TELE_BOX_DELEGATE_EVENT.Maximize });
1299
+ this.onEvent({ type: TELE_BOX_DELEGATE_EVENT.Maximize });
1346
1300
  }
1347
1301
  }
1348
1302
  } else if (this.onDragStart) {
@@ -1361,16 +1315,16 @@ class DefaultTitleBar {
1361
1315
  this.boxStatus = boxStatus;
1362
1316
  this.buttons = buttons || [
1363
1317
  {
1364
- type: exports.TELE_BOX_DELEGATE_EVENT.Minimize,
1318
+ type: TELE_BOX_DELEGATE_EVENT.Minimize,
1365
1319
  iconClassName: this.wrapClassName("titlebar-icon-minimize")
1366
1320
  },
1367
1321
  {
1368
- type: exports.TELE_BOX_DELEGATE_EVENT.Maximize,
1322
+ type: TELE_BOX_DELEGATE_EVENT.Maximize,
1369
1323
  iconClassName: this.wrapClassName("titlebar-icon-maximize"),
1370
- isActive: (state2) => state2 === exports.TELE_BOX_STATE.Maximized
1324
+ isActive: (state2) => state2 === TELE_BOX_STATE.Maximized
1371
1325
  },
1372
1326
  {
1373
- type: exports.TELE_BOX_DELEGATE_EVENT.Close,
1327
+ type: TELE_BOX_DELEGATE_EVENT.Close,
1374
1328
  iconClassName: this.wrapClassName("titlebar-icon-close")
1375
1329
  }
1376
1330
  ];
@@ -1388,7 +1342,10 @@ class DefaultTitleBar {
1388
1342
  this.state = state;
1389
1343
  this.buttons.forEach((btn, i2) => {
1390
1344
  if (btn.isActive) {
1391
- this.$btns[i2].classList.toggle("is-active", btn.isActive(state));
1345
+ this.$btns[i2].classList.toggle(
1346
+ "is-active",
1347
+ btn.isActive(state)
1348
+ );
1392
1349
  }
1393
1350
  });
1394
1351
  }
@@ -1399,7 +1356,10 @@ class DefaultTitleBar {
1399
1356
  if (boxStatus) {
1400
1357
  this.buttons.forEach((btn, i2) => {
1401
1358
  if (btn.isActive) {
1402
- this.$btns[i2].classList.toggle("is-active", btn.isActive(boxStatus));
1359
+ this.$btns[i2].classList.toggle(
1360
+ "is-active",
1361
+ btn.isActive(boxStatus)
1362
+ );
1403
1363
  }
1404
1364
  });
1405
1365
  }
@@ -1431,7 +1391,9 @@ class DefaultTitleBar {
1431
1391
  this.buttons.forEach(({ iconClassName, isActive }, i2) => {
1432
1392
  const teleTitleBarBtnIndex = String(i2);
1433
1393
  const $btn = document.createElement("button");
1434
- $btn.className = `${this.wrapClassName("titlebar-btn")} ${iconClassName}`;
1394
+ $btn.className = `${this.wrapClassName(
1395
+ "titlebar-btn"
1396
+ )} ${iconClassName}`;
1435
1397
  $btn.dataset.teleTitleBarBtnIndex = teleTitleBarBtnIndex;
1436
1398
  $btn.dataset.teleTitleBarNoDblClick = "true";
1437
1399
  if (isActive) {
@@ -1440,24 +1402,30 @@ class DefaultTitleBar {
1440
1402
  this.$btns.push($btn);
1441
1403
  $buttonsContainer.appendChild($btn);
1442
1404
  });
1443
- this.sideEffect.addEventListener($buttonsContainer, "click", (ev) => {
1444
- var _a;
1445
- if (this.readonly) {
1446
- return;
1447
- }
1448
- const target = ev.target;
1449
- const teleTitleBarBtnIndex = Number((_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex);
1450
- if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
1451
- preventEvent(ev);
1452
- const btn = this.buttons[teleTitleBarBtnIndex];
1453
- if (this.onEvent) {
1454
- this.onEvent({
1455
- type: btn.type,
1456
- value: btn.value
1457
- });
1405
+ this.sideEffect.addEventListener(
1406
+ $buttonsContainer,
1407
+ "click",
1408
+ (ev) => {
1409
+ var _a;
1410
+ if (this.readonly) {
1411
+ return;
1412
+ }
1413
+ const target = ev.target;
1414
+ const teleTitleBarBtnIndex = Number(
1415
+ (_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex
1416
+ );
1417
+ if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
1418
+ preventEvent(ev);
1419
+ const btn = this.buttons[teleTitleBarBtnIndex];
1420
+ if (this.onEvent) {
1421
+ this.onEvent({
1422
+ type: btn.type,
1423
+ value: btn.value
1424
+ });
1425
+ }
1458
1426
  }
1459
1427
  }
1460
- });
1428
+ );
1461
1429
  this.$titleBar.appendChild($titleArea);
1462
1430
  this.$titleBar.appendChild($buttonsContainer);
1463
1431
  }
@@ -1467,8 +1435,17 @@ class DefaultTitleBar {
1467
1435
  const $dragArea = document.createElement("div");
1468
1436
  $dragArea.className = this.wrapClassName("drag-area");
1469
1437
  $dragArea.dataset.teleBoxHandle = TeleBoxDragHandleType;
1470
- this.sideEffect.addEventListener($dragArea, "mousedown", this.handleTitleBarClick);
1471
- this.sideEffect.addEventListener($dragArea, "touchstart", this.handleTitleBarTouch, { passive: true });
1438
+ this.sideEffect.addEventListener(
1439
+ $dragArea,
1440
+ "mousedown",
1441
+ this.handleTitleBarClick
1442
+ );
1443
+ this.sideEffect.addEventListener(
1444
+ $dragArea,
1445
+ "touchstart",
1446
+ this.handleTitleBarTouch,
1447
+ { passive: true }
1448
+ );
1472
1449
  return $dragArea;
1473
1450
  }
1474
1451
  dragHandle() {
@@ -1492,7 +1469,7 @@ class TeleBox {
1492
1469
  constructor({
1493
1470
  id = genUniqueKey(),
1494
1471
  title = getBoxDefaultName(),
1495
- prefersColorScheme = exports.TELE_BOX_COLOR_SCHEME.Light,
1472
+ prefersColorScheme = TELE_BOX_COLOR_SCHEME.Light,
1496
1473
  darkMode,
1497
1474
  visible = true,
1498
1475
  width = 0.5,
@@ -1539,38 +1516,53 @@ class TeleBox {
1539
1516
  this._delegateEvents = new EventEmitter();
1540
1517
  const boxStatus$ = createVal(boxStatus);
1541
1518
  const lastNotMinimizedBoxStatus$ = createVal(lastNotMinimizedBoxStatus);
1542
- const prefersColorScheme$ = createVal(prefersColorScheme);
1519
+ const prefersColorScheme$ = createVal(
1520
+ prefersColorScheme
1521
+ );
1543
1522
  prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
1544
1523
  if (!skipUpdate) {
1545
- this.events.emit(exports.TELE_BOX_EVENT.PrefersColorScheme, prefersColorScheme2);
1524
+ this.events.emit(
1525
+ TELE_BOX_EVENT.PrefersColorScheme,
1526
+ prefersColorScheme2
1527
+ );
1546
1528
  }
1547
1529
  });
1548
1530
  const darkMode$ = createVal(Boolean(darkMode));
1549
1531
  if (darkMode == null) {
1550
- prefersColorScheme$.subscribe((prefersColorScheme2, _, skipUpdate) => {
1551
- this._sideEffect.add(() => {
1552
- if (prefersColorScheme2 === "auto") {
1553
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
1554
- if (prefersDark) {
1555
- darkMode$.setValue(prefersDark.matches, skipUpdate);
1556
- const handler = (evt) => {
1557
- darkMode$.setValue(evt.matches, skipUpdate);
1558
- };
1559
- prefersDark.addListener(handler);
1560
- return () => prefersDark.removeListener(handler);
1532
+ prefersColorScheme$.subscribe(
1533
+ (prefersColorScheme2, _, skipUpdate) => {
1534
+ this._sideEffect.add(() => {
1535
+ if (prefersColorScheme2 === "auto") {
1536
+ const prefersDark = window.matchMedia(
1537
+ "(prefers-color-scheme: dark)"
1538
+ );
1539
+ if (prefersDark) {
1540
+ darkMode$.setValue(
1541
+ prefersDark.matches,
1542
+ skipUpdate
1543
+ );
1544
+ const handler = (evt) => {
1545
+ darkMode$.setValue(evt.matches, skipUpdate);
1546
+ };
1547
+ prefersDark.addListener(handler);
1548
+ return () => prefersDark.removeListener(handler);
1549
+ } else {
1550
+ return noop;
1551
+ }
1561
1552
  } else {
1553
+ darkMode$.setValue(
1554
+ prefersColorScheme2 === "dark",
1555
+ skipUpdate
1556
+ );
1562
1557
  return noop;
1563
1558
  }
1564
- } else {
1565
- darkMode$.setValue(prefersColorScheme2 === "dark", skipUpdate);
1566
- return noop;
1567
- }
1568
- }, "prefers-color-scheme");
1569
- });
1559
+ }, "prefers-color-scheme");
1560
+ }
1561
+ );
1570
1562
  }
1571
1563
  darkMode$.reaction((darkMode2, _, skipUpdate) => {
1572
1564
  if (!skipUpdate) {
1573
- this.events.emit(exports.TELE_BOX_EVENT.DarkMode, darkMode2);
1565
+ this.events.emit(TELE_BOX_EVENT.DarkMode, darkMode2);
1574
1566
  }
1575
1567
  });
1576
1568
  const containerRect$ = createVal(containerRect, shallowequal);
@@ -1584,13 +1576,13 @@ class TeleBox {
1584
1576
  const visible$ = createVal(visible);
1585
1577
  visible$.reaction((visible2, _, skipUpdate) => {
1586
1578
  if (!skipUpdate && !visible2) {
1587
- this.events.emit(exports.TELE_BOX_EVENT.Close);
1579
+ this.events.emit(TELE_BOX_EVENT.Close);
1588
1580
  }
1589
1581
  });
1590
1582
  const readonly$ = createVal(readonly);
1591
1583
  readonly$.reaction((readonly2, _, skipUpdate) => {
1592
1584
  if (!skipUpdate) {
1593
- this.events.emit(exports.TELE_BOX_EVENT.Readonly, readonly2);
1585
+ this.events.emit(TELE_BOX_EVENT.Readonly, readonly2);
1594
1586
  }
1595
1587
  });
1596
1588
  const resizable$ = createVal(resizable);
@@ -1600,122 +1592,151 @@ class TeleBox {
1600
1592
  const zIndex$ = createVal(zIndex);
1601
1593
  zIndex$.reaction((zIndex2, _, skipUpdate) => {
1602
1594
  if (!skipUpdate) {
1603
- this.events.emit(exports.TELE_BOX_EVENT.ZIndex, zIndex2);
1595
+ this.events.emit(TELE_BOX_EVENT.ZIndex, zIndex2);
1604
1596
  }
1605
1597
  });
1606
1598
  const focus$ = createVal(focus);
1607
1599
  focus$.reaction((focus2, _, skipUpdate) => {
1608
1600
  if (!skipUpdate) {
1609
- this.events.emit(focus2 ? exports.TELE_BOX_EVENT.Focus : exports.TELE_BOX_EVENT.Blur);
1601
+ this.events.emit(
1602
+ focus2 ? TELE_BOX_EVENT.Focus : TELE_BOX_EVENT.Blur
1603
+ );
1610
1604
  }
1611
1605
  });
1612
1606
  const minimized$ = createVal(minimized);
1613
1607
  minimized$.reaction((minimized2, _, skipUpdate) => {
1614
1608
  if (!skipUpdate) {
1615
- this.events.emit(exports.TELE_BOX_EVENT.Minimized, minimized2);
1609
+ this.events.emit(TELE_BOX_EVENT.Minimized, minimized2);
1616
1610
  }
1617
1611
  });
1618
1612
  const maximized$ = createVal(maximized);
1619
1613
  maximized$.reaction((maximized2, _, skipUpdate) => {
1620
1614
  if (!skipUpdate) {
1621
- this.events.emit(exports.TELE_BOX_EVENT.Maximized, maximized2);
1615
+ this.events.emit(TELE_BOX_EVENT.Maximized, maximized2);
1622
1616
  }
1623
1617
  });
1624
- const state$ = combine([minimized$, maximized$, boxStatus$], ([minimized2, maximized2, boxStatus2]) => minimized2 ? exports.TELE_BOX_STATE.Minimized : maximized2 ? exports.TELE_BOX_STATE.Maximized : !boxStatus2 ? exports.TELE_BOX_STATE.Normal : boxStatus2);
1618
+ const state$ = combine(
1619
+ [minimized$, maximized$, boxStatus$],
1620
+ ([minimized2, maximized2, boxStatus2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : !boxStatus2 ? TELE_BOX_STATE.Normal : boxStatus2
1621
+ );
1625
1622
  state$.reaction((state, _, skipUpdate) => {
1626
1623
  if (!skipUpdate) {
1627
- this.events.emit(exports.TELE_BOX_EVENT.State, state);
1624
+ this.events.emit(TELE_BOX_EVENT.State, state);
1628
1625
  }
1629
1626
  });
1630
- const minSize$ = createVal({
1631
- width: clamp(minWidth, 0, 1),
1632
- height: clamp(minHeight, 0, 1)
1633
- }, shallowequal);
1634
- const intrinsicSize$ = createVal({
1635
- width: clamp(width, minSize$.value.width, 1),
1636
- height: clamp(height, minSize$.value.height, 1)
1637
- }, shallowequal);
1627
+ const minSize$ = createVal(
1628
+ {
1629
+ width: clamp(minWidth, 0, 1),
1630
+ height: clamp(minHeight, 0, 1)
1631
+ },
1632
+ shallowequal
1633
+ );
1634
+ const intrinsicSize$ = createVal(
1635
+ {
1636
+ width: clamp(width, minSize$.value.width, 1),
1637
+ height: clamp(height, minSize$.value.height, 1)
1638
+ },
1639
+ shallowequal
1640
+ );
1638
1641
  minSize$.reaction((minSize, _, skipUpdate) => {
1639
- intrinsicSize$.setValue({
1640
- width: clamp(width, minSize.width, 1),
1641
- height: clamp(height, minSize.height, 1)
1642
- }, skipUpdate);
1642
+ intrinsicSize$.setValue(
1643
+ {
1644
+ width: clamp(width, minSize.width, 1),
1645
+ height: clamp(height, minSize.height, 1)
1646
+ },
1647
+ skipUpdate
1648
+ );
1643
1649
  });
1644
1650
  intrinsicSize$.reaction((size, _, skipUpdate) => {
1645
1651
  if (!skipUpdate) {
1646
- this.events.emit(exports.TELE_BOX_EVENT.IntrinsicResize, size);
1652
+ this.events.emit(TELE_BOX_EVENT.IntrinsicResize, size);
1647
1653
  }
1648
1654
  });
1649
- const size$ = combine([intrinsicSize$, maximized$, boxStatus$], ([intrinsicSize, maximized2, boxStatus2]) => {
1650
- if (maximized2 || boxStatus2 === exports.TELE_BOX_STATE.Maximized) {
1651
- return { width: 1, height: 1 };
1652
- }
1653
- return intrinsicSize;
1654
- }, shallowequal);
1655
+ const size$ = combine(
1656
+ [intrinsicSize$, maximized$, boxStatus$],
1657
+ ([intrinsicSize, maximized2, boxStatus2]) => {
1658
+ if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1659
+ return { width: 1, height: 1 };
1660
+ }
1661
+ return intrinsicSize;
1662
+ },
1663
+ shallowequal
1664
+ );
1655
1665
  size$.reaction((size, _, skipUpdate) => {
1656
1666
  if (!skipUpdate) {
1657
- this.events.emit(exports.TELE_BOX_EVENT.Resize, size);
1667
+ this.events.emit(TELE_BOX_EVENT.Resize, size);
1658
1668
  }
1659
1669
  });
1660
- const visualSize$ = combine([size$, minimized$, containerRect$, collectorRect$, boxStatus$], ([size, minimized2, containerRect2, collectorRect2, boxStatus2]) => {
1661
- if ((minimized2 || boxStatus2 === exports.TELE_BOX_STATE.Minimized) && collectorRect2) {
1662
- return {
1663
- width: collectorRect2.width / size.width / containerRect2.width,
1664
- height: collectorRect2.height / size.height / containerRect2.height
1665
- };
1666
- }
1667
- return size;
1668
- }, shallowequal);
1670
+ const visualSize$ = combine(
1671
+ [size$, minimized$, containerRect$, collectorRect$, boxStatus$],
1672
+ ([size, minimized2, containerRect2, collectorRect2, boxStatus2]) => {
1673
+ if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1674
+ return {
1675
+ width: collectorRect2.width / size.width / containerRect2.width,
1676
+ height: collectorRect2.height / size.height / containerRect2.height
1677
+ };
1678
+ }
1679
+ return size;
1680
+ },
1681
+ shallowequal
1682
+ );
1669
1683
  visualSize$.reaction((size, _, skipUpdate) => {
1670
1684
  if (!skipUpdate) {
1671
- this.events.emit(exports.TELE_BOX_EVENT.VisualResize, size);
1685
+ this.events.emit(TELE_BOX_EVENT.VisualResize, size);
1672
1686
  }
1673
1687
  });
1674
- const intrinsicCoord$ = createVal({ x: clamp(x, 0, 1), y: clamp(y, 0, 1) }, shallowequal);
1688
+ const intrinsicCoord$ = createVal(
1689
+ { x: clamp(x, 0, 1), y: clamp(y, 0, 1) },
1690
+ shallowequal
1691
+ );
1675
1692
  intrinsicCoord$.reaction((coord, _, skipUpdate) => {
1676
1693
  if (!skipUpdate) {
1677
- this.events.emit(exports.TELE_BOX_EVENT.IntrinsicMove, coord);
1678
- }
1679
- });
1680
- const coord$ = combine([
1681
- intrinsicCoord$,
1682
- intrinsicSize$,
1683
- containerRect$,
1684
- collectorRect$,
1685
- minimized$,
1686
- maximized$,
1687
- boxStatus$,
1688
- lastNotMinimizedBoxStatus$
1689
- ], ([
1690
- intrinsicCoord,
1691
- intrinsicSize,
1692
- containerRect2,
1693
- collectorRect2,
1694
- minimized2,
1695
- maximized2,
1696
- boxStatus2,
1697
- lastNotMinimizedBoxStatus2
1698
- ]) => {
1699
- if ((minimized2 || boxStatus2 === exports.TELE_BOX_STATE.Minimized) && collectorRect2) {
1700
- if (maximized2 || lastNotMinimizedBoxStatus2 === exports.TELE_BOX_STATE.Maximized) {
1694
+ this.events.emit(TELE_BOX_EVENT.IntrinsicMove, coord);
1695
+ }
1696
+ });
1697
+ const coord$ = combine(
1698
+ [
1699
+ intrinsicCoord$,
1700
+ intrinsicSize$,
1701
+ containerRect$,
1702
+ collectorRect$,
1703
+ minimized$,
1704
+ maximized$,
1705
+ boxStatus$,
1706
+ lastNotMinimizedBoxStatus$
1707
+ ],
1708
+ ([
1709
+ intrinsicCoord,
1710
+ intrinsicSize,
1711
+ containerRect2,
1712
+ collectorRect2,
1713
+ minimized2,
1714
+ maximized2,
1715
+ boxStatus2,
1716
+ lastNotMinimizedBoxStatus2
1717
+ ]) => {
1718
+ if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
1719
+ if (maximized2 || lastNotMinimizedBoxStatus2 === TELE_BOX_STATE.Maximized) {
1720
+ return {
1721
+ x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - 1 / 2,
1722
+ y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - 1 / 2
1723
+ };
1724
+ }
1701
1725
  return {
1702
- x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - 1 / 2,
1703
- y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - 1 / 2
1726
+ x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - intrinsicSize.width / 2,
1727
+ y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - intrinsicSize.height / 2
1704
1728
  };
1705
1729
  }
1706
- return {
1707
- x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - intrinsicSize.width / 2,
1708
- y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - intrinsicSize.height / 2
1709
- };
1710
- }
1711
- if (maximized2 || boxStatus2 === exports.TELE_BOX_STATE.Maximized) {
1712
- return { x: 0, y: 0 };
1713
- }
1714
- return intrinsicCoord;
1715
- }, shallowequal);
1730
+ if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
1731
+ return { x: 0, y: 0 };
1732
+ }
1733
+ return intrinsicCoord;
1734
+ },
1735
+ shallowequal
1736
+ );
1716
1737
  coord$.reaction((coord, _, skipUpdate) => {
1717
1738
  if (!skipUpdate) {
1718
- this.events.emit(exports.TELE_BOX_EVENT.Move, coord);
1739
+ this.events.emit(TELE_BOX_EVENT.Move, coord);
1719
1740
  }
1720
1741
  });
1721
1742
  this.titleBar = titleBar || new DefaultTitleBar({
@@ -1732,24 +1753,27 @@ class TeleBox {
1732
1753
  this._delegateEvents.emit(event.type);
1733
1754
  } else {
1734
1755
  switch (event.type) {
1735
- case exports.TELE_BOX_DELEGATE_EVENT.Maximize: {
1756
+ case TELE_BOX_DELEGATE_EVENT.Maximize: {
1736
1757
  if (!boxStatus$.value) {
1737
1758
  maximized$.setValue(!maximized$.value);
1738
1759
  }
1739
1760
  break;
1740
1761
  }
1741
- case exports.TELE_BOX_DELEGATE_EVENT.Minimize: {
1762
+ case TELE_BOX_DELEGATE_EVENT.Minimize: {
1742
1763
  if (!boxStatus$.value) {
1743
1764
  minimized$.setValue(true);
1744
1765
  }
1745
1766
  break;
1746
1767
  }
1747
- case exports.TELE_BOX_DELEGATE_EVENT.Close: {
1768
+ case TELE_BOX_DELEGATE_EVENT.Close: {
1748
1769
  visible$.setValue(false);
1749
1770
  break;
1750
1771
  }
1751
1772
  default: {
1752
- console.error("Unsupported titleBar event:", event);
1773
+ console.error(
1774
+ "Unsupported titleBar event:",
1775
+ event
1776
+ );
1753
1777
  break;
1754
1778
  }
1755
1779
  }
@@ -1796,7 +1820,13 @@ class TeleBox {
1796
1820
  this._boxStatus$ = boxStatus$;
1797
1821
  this._lastNotMinimizedBoxStatus$ = lastNotMinimizedBoxStatus$;
1798
1822
  if (this.fixRatio) {
1799
- this.transform(coord$.value.x, coord$.value.y, size$.value.width, size$.value.height, true);
1823
+ this.transform(
1824
+ coord$.value.x,
1825
+ coord$.value.y,
1826
+ size$.value.width,
1827
+ size$.value.height,
1828
+ true
1829
+ );
1800
1830
  }
1801
1831
  this.$box = this.render();
1802
1832
  }
@@ -1817,12 +1847,12 @@ class TeleBox {
1817
1847
  }
1818
1848
  setState(state, skipUpdate = false) {
1819
1849
  switch (state) {
1820
- case exports.TELE_BOX_STATE.Maximized: {
1850
+ case TELE_BOX_STATE.Maximized: {
1821
1851
  this.setMinimized(false, skipUpdate);
1822
1852
  this.setMaximized(true, skipUpdate);
1823
1853
  break;
1824
1854
  }
1825
- case exports.TELE_BOX_STATE.Minimized: {
1855
+ case TELE_BOX_STATE.Minimized: {
1826
1856
  this.setMinimized(true, skipUpdate);
1827
1857
  this.setMaximized(false, skipUpdate);
1828
1858
  break;
@@ -1836,8 +1866,8 @@ class TeleBox {
1836
1866
  return this;
1837
1867
  }
1838
1868
  setBoxStatus(boxStatus, skipUpdate = false) {
1839
- if (boxStatus === exports.TELE_BOX_STATE.Minimized) {
1840
- if (this._boxStatus$.value && this._boxStatus$.value !== exports.TELE_BOX_STATE.Minimized) {
1869
+ if (boxStatus === TELE_BOX_STATE.Minimized) {
1870
+ if (this._boxStatus$.value && this._boxStatus$.value !== TELE_BOX_STATE.Minimized) {
1841
1871
  this.setLastNotMinimizedBoxStatus(this._boxStatus$.value, skipUpdate);
1842
1872
  }
1843
1873
  } else {
@@ -1845,14 +1875,14 @@ class TeleBox {
1845
1875
  }
1846
1876
  this._boxStatus$.setValue(boxStatus, skipUpdate);
1847
1877
  if (!skipUpdate) {
1848
- this.events.emit(exports.TELE_BOX_EVENT.BoxStatus, { id: this.id, boxStatus });
1878
+ this.events.emit(TELE_BOX_EVENT.BoxStatus, { id: this.id, boxStatus });
1849
1879
  }
1850
1880
  return this;
1851
1881
  }
1852
1882
  setLastNotMinimizedBoxStatus(lastNotMinimizedBoxStatus, skipUpdate = false) {
1853
1883
  this._lastNotMinimizedBoxStatus$.setValue(lastNotMinimizedBoxStatus, skipUpdate);
1854
1884
  if (!skipUpdate) {
1855
- this.events.emit(exports.TELE_BOX_EVENT.LastNotMinimizedBoxStatus, { id: this.id, lastNotMinimizedBoxStatus });
1885
+ this.events.emit(TELE_BOX_EVENT.LastNotMinimizedBoxStatus, { id: this.id, lastNotMinimizedBoxStatus });
1856
1886
  }
1857
1887
  return this;
1858
1888
  }
@@ -1863,11 +1893,17 @@ class TeleBox {
1863
1893
  return this._minSize$.value.height;
1864
1894
  }
1865
1895
  setMinWidth(minWidth, skipUpdate = false) {
1866
- this._minSize$.setValue({ width: minWidth, height: this.minHeight }, skipUpdate);
1896
+ this._minSize$.setValue(
1897
+ { width: minWidth, height: this.minHeight },
1898
+ skipUpdate
1899
+ );
1867
1900
  return this;
1868
1901
  }
1869
1902
  setMinHeight(minHeight, skipUpdate = false) {
1870
- this._minSize$.setValue({ width: this.minWidth, height: minHeight }, skipUpdate);
1903
+ this._minSize$.setValue(
1904
+ { width: this.minWidth, height: minHeight },
1905
+ skipUpdate
1906
+ );
1871
1907
  return this;
1872
1908
  }
1873
1909
  get intrinsicWidth() {
@@ -1928,14 +1964,20 @@ class TeleBox {
1928
1964
  height = this.intrinsicHeight;
1929
1965
  }
1930
1966
  }
1931
- this._intrinsicCoord$.setValue({
1932
- x: width >= this.minWidth ? x : this.intrinsicX,
1933
- y: height >= this.minHeight ? y : this.intrinsicY
1934
- }, skipUpdate);
1935
- this._intrinsicSize$.setValue({
1936
- width: clamp(width, this.minWidth, 1),
1937
- height: clamp(height, this.minHeight, 1)
1938
- }, skipUpdate);
1967
+ this._intrinsicCoord$.setValue(
1968
+ {
1969
+ x: width >= this.minWidth ? x : this.intrinsicX,
1970
+ y: height >= this.minHeight ? y : this.intrinsicY
1971
+ },
1972
+ skipUpdate
1973
+ );
1974
+ this._intrinsicSize$.setValue(
1975
+ {
1976
+ width: clamp(width, this.minWidth, 1),
1977
+ height: clamp(height, this.minHeight, 1)
1978
+ },
1979
+ skipUpdate
1980
+ );
1939
1981
  return this;
1940
1982
  }
1941
1983
  mount(container) {
@@ -2011,33 +2053,52 @@ class TeleBox {
2011
2053
  bindClassName(this.$box, this._resizable$, "no-resize", isFalsy);
2012
2054
  bindClassName(this.$box, this._focus$, "blur", isFalsy);
2013
2055
  bindClassName(this.$box, this._darkMode$, "color-scheme-dark");
2014
- bindClassName(this.$box, this._darkMode$, "color-scheme-light", isFalsy);
2056
+ bindClassName(
2057
+ this.$box,
2058
+ this._darkMode$,
2059
+ "color-scheme-light",
2060
+ isFalsy
2061
+ );
2015
2062
  this._renderSideEffect.add(() => {
2016
2063
  const minimizedClassName = this.wrapClassName("minimized");
2017
2064
  const maximizedClassName = this.wrapClassName("maximized");
2018
2065
  const MAXIMIZED_TIMER_ID = "box-maximized-timer";
2019
2066
  return this._state$.subscribe((state) => {
2020
- this.$box.classList.toggle(minimizedClassName, state === exports.TELE_BOX_STATE.Minimized);
2021
- if (state === exports.TELE_BOX_STATE.Maximized) {
2067
+ this.$box.classList.toggle(
2068
+ minimizedClassName,
2069
+ state === TELE_BOX_STATE.Minimized
2070
+ );
2071
+ if (state === TELE_BOX_STATE.Maximized) {
2022
2072
  this._renderSideEffect.flush(MAXIMIZED_TIMER_ID);
2023
2073
  this.$box.classList.toggle(maximizedClassName, true);
2024
2074
  } else {
2025
- this._renderSideEffect.setTimeout(() => {
2026
- this.$box.classList.toggle(maximizedClassName, false);
2027
- }, 0, MAXIMIZED_TIMER_ID);
2075
+ this._renderSideEffect.setTimeout(
2076
+ () => {
2077
+ this.$box.classList.toggle(
2078
+ maximizedClassName,
2079
+ false
2080
+ );
2081
+ },
2082
+ 0,
2083
+ MAXIMIZED_TIMER_ID
2084
+ );
2028
2085
  }
2029
2086
  });
2030
2087
  });
2031
- this._renderSideEffect.add(() => this._visible$.subscribe((visible) => {
2032
- if (visible) {
2033
- this.$box.style.removeProperty("display");
2034
- } else {
2035
- this.$box.style.display = "none";
2036
- }
2037
- }));
2038
- this._renderSideEffect.add(() => this._zIndex$.subscribe((zIndex) => {
2039
- this.$box.style.zIndex = String(zIndex);
2040
- }));
2088
+ this._renderSideEffect.add(
2089
+ () => this._visible$.subscribe((visible) => {
2090
+ if (visible) {
2091
+ this.$box.style.removeProperty("display");
2092
+ } else {
2093
+ this.$box.style.display = "none";
2094
+ }
2095
+ })
2096
+ );
2097
+ this._renderSideEffect.add(
2098
+ () => this._zIndex$.subscribe((zIndex) => {
2099
+ this.$box.style.zIndex = String(zIndex);
2100
+ })
2101
+ );
2041
2102
  const boxStyler = index(this.$box);
2042
2103
  this.$box.dataset.teleBoxID = this.id;
2043
2104
  this.$box.style.width = this.absoluteWidth + "px";
@@ -2045,25 +2106,29 @@ class TeleBox {
2045
2106
  const translateX = this.x * this.containerRect.width + this.containerRect.x;
2046
2107
  const translateY = this.y * this.containerRect.height + this.containerRect.y;
2047
2108
  this.$box.style.transform = `translate(${translateX - 10}px,${translateY - 10}px)`;
2048
- this._valSideEffectBinder.combine([
2049
- this._coord$,
2050
- this._size$,
2051
- this._minimized$,
2052
- this._containerRect$,
2053
- this._collectorRect$,
2054
- this._boxStatus$
2055
- ], ([coord, size, minimized, containerRect, collectorRect, boxStatus]) => {
2056
- const absoluteWidth = size.width * containerRect.width;
2057
- const absoluteHeight = size.height * containerRect.height;
2058
- return {
2059
- width: absoluteWidth + ((minimized || boxStatus === exports.TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2060
- height: absoluteHeight + ((minimized || boxStatus === exports.TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2061
- x: coord.x * containerRect.width,
2062
- y: coord.y * containerRect.height,
2063
- scaleX: (minimized || boxStatus === exports.TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.width / absoluteWidth : 1,
2064
- scaleY: (minimized || boxStatus === exports.TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.height / absoluteHeight : 1
2065
- };
2066
- }, shallowequal).subscribe((styles) => {
2109
+ this._valSideEffectBinder.combine(
2110
+ [
2111
+ this._coord$,
2112
+ this._size$,
2113
+ this._minimized$,
2114
+ this._containerRect$,
2115
+ this._collectorRect$,
2116
+ this._boxStatus$
2117
+ ],
2118
+ ([coord, size, minimized, containerRect, collectorRect, boxStatus]) => {
2119
+ const absoluteWidth = size.width * containerRect.width;
2120
+ const absoluteHeight = size.height * containerRect.height;
2121
+ return {
2122
+ width: absoluteWidth + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2123
+ height: absoluteHeight + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
2124
+ x: coord.x * containerRect.width,
2125
+ y: coord.y * containerRect.height,
2126
+ scaleX: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.width / absoluteWidth : 1,
2127
+ scaleY: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.height / absoluteHeight : 1
2128
+ };
2129
+ },
2130
+ shallowequal
2131
+ ).subscribe((styles) => {
2067
2132
  boxStyler.set(styles);
2068
2133
  });
2069
2134
  boxStyler.set({ x: translateX, y: translateY });
@@ -2128,7 +2193,7 @@ class TeleBox {
2128
2193
  _renderResizeHandlers() {
2129
2194
  const $resizeHandles = document.createElement("div");
2130
2195
  $resizeHandles.className = this.wrapClassName("resize-handles");
2131
- Object.values(exports.TELE_BOX_RESIZE_HANDLE).forEach((handleType) => {
2196
+ Object.values(TELE_BOX_RESIZE_HANDLE).forEach((handleType) => {
2132
2197
  const $handle = document.createElement("div");
2133
2198
  $handle.className = this.wrapClassName(handleType) + " " + this.wrapClassName("resize-handle");
2134
2199
  $handle.dataset.teleBoxHandle = handleType;
@@ -2146,7 +2211,7 @@ class TeleBox {
2146
2211
  let trackStartPageY = 0;
2147
2212
  let trackingHandle;
2148
2213
  const handleTracking = (ev) => {
2149
- if (this.state !== exports.TELE_BOX_STATE.Normal) {
2214
+ if (this.state !== TELE_BOX_STATE.Normal) {
2150
2215
  return;
2151
2216
  }
2152
2217
  preventEvent(ev);
@@ -2157,45 +2222,95 @@ class TeleBox {
2157
2222
  const offsetX = (pageX - trackStartPageX) / this.containerRect.width;
2158
2223
  const offsetY = (pageY - trackStartPageY) / this.containerRect.height;
2159
2224
  switch (trackingHandle) {
2160
- case exports.TELE_BOX_RESIZE_HANDLE.North: {
2161
- this.transform(this.x, trackStartY + offsetY, this.width, trackStartHeight - offsetY);
2225
+ case TELE_BOX_RESIZE_HANDLE.North: {
2226
+ this.transform(
2227
+ this.x,
2228
+ trackStartY + offsetY,
2229
+ this.width,
2230
+ trackStartHeight - offsetY
2231
+ );
2162
2232
  break;
2163
2233
  }
2164
- case exports.TELE_BOX_RESIZE_HANDLE.South: {
2165
- this.transform(this.x, this.y, this.width, trackStartHeight + offsetY);
2234
+ case TELE_BOX_RESIZE_HANDLE.South: {
2235
+ this.transform(
2236
+ this.x,
2237
+ this.y,
2238
+ this.width,
2239
+ trackStartHeight + offsetY
2240
+ );
2166
2241
  break;
2167
2242
  }
2168
- case exports.TELE_BOX_RESIZE_HANDLE.West: {
2169
- this.transform(trackStartX + offsetX, this.y, trackStartWidth - offsetX, this.height);
2243
+ case TELE_BOX_RESIZE_HANDLE.West: {
2244
+ this.transform(
2245
+ trackStartX + offsetX,
2246
+ this.y,
2247
+ trackStartWidth - offsetX,
2248
+ this.height
2249
+ );
2170
2250
  break;
2171
2251
  }
2172
- case exports.TELE_BOX_RESIZE_HANDLE.East: {
2173
- this.transform(this.x, this.y, trackStartWidth + offsetX, this.height);
2252
+ case TELE_BOX_RESIZE_HANDLE.East: {
2253
+ this.transform(
2254
+ this.x,
2255
+ this.y,
2256
+ trackStartWidth + offsetX,
2257
+ this.height
2258
+ );
2174
2259
  break;
2175
2260
  }
2176
- case exports.TELE_BOX_RESIZE_HANDLE.NorthWest: {
2177
- this.transform(trackStartX + offsetX, trackStartY + offsetY, trackStartWidth - offsetX, trackStartHeight - offsetY);
2261
+ case TELE_BOX_RESIZE_HANDLE.NorthWest: {
2262
+ this.transform(
2263
+ trackStartX + offsetX,
2264
+ trackStartY + offsetY,
2265
+ trackStartWidth - offsetX,
2266
+ trackStartHeight - offsetY
2267
+ );
2178
2268
  break;
2179
2269
  }
2180
- case exports.TELE_BOX_RESIZE_HANDLE.NorthEast: {
2181
- this.transform(this.x, trackStartY + offsetY, trackStartWidth + offsetX, trackStartHeight - offsetY);
2270
+ case TELE_BOX_RESIZE_HANDLE.NorthEast: {
2271
+ this.transform(
2272
+ this.x,
2273
+ trackStartY + offsetY,
2274
+ trackStartWidth + offsetX,
2275
+ trackStartHeight - offsetY
2276
+ );
2182
2277
  break;
2183
2278
  }
2184
- case exports.TELE_BOX_RESIZE_HANDLE.SouthEast: {
2185
- this.transform(this.x, this.y, trackStartWidth + offsetX, trackStartHeight + offsetY);
2279
+ case TELE_BOX_RESIZE_HANDLE.SouthEast: {
2280
+ this.transform(
2281
+ this.x,
2282
+ this.y,
2283
+ trackStartWidth + offsetX,
2284
+ trackStartHeight + offsetY
2285
+ );
2186
2286
  break;
2187
2287
  }
2188
- case exports.TELE_BOX_RESIZE_HANDLE.SouthWest: {
2189
- this.transform(trackStartX + offsetX, this.y, trackStartWidth - offsetX, trackStartHeight + offsetY);
2288
+ case TELE_BOX_RESIZE_HANDLE.SouthWest: {
2289
+ this.transform(
2290
+ trackStartX + offsetX,
2291
+ this.y,
2292
+ trackStartWidth - offsetX,
2293
+ trackStartHeight + offsetY
2294
+ );
2190
2295
  break;
2191
2296
  }
2192
2297
  default: {
2193
2298
  if (this.fence) {
2194
- this.move(clamp(trackStartX + offsetX, 0, 1 - this.width), clamp(trackStartY + offsetY, 0, 1 - this.height));
2299
+ this.move(
2300
+ clamp(trackStartX + offsetX, 0, 1 - this.width),
2301
+ clamp(trackStartY + offsetY, 0, 1 - this.height)
2302
+ );
2195
2303
  } else {
2196
2304
  const xOverflowOffset = 20 / this.containerRect.width;
2197
2305
  const yOverflowOffset = 20 / this.containerRect.height;
2198
- this.move(clamp(trackStartX + offsetX, xOverflowOffset - this.width, 1 - xOverflowOffset), clamp(trackStartY + offsetY, 0, 1 - yOverflowOffset));
2306
+ this.move(
2307
+ clamp(
2308
+ trackStartX + offsetX,
2309
+ xOverflowOffset - this.width,
2310
+ 1 - xOverflowOffset
2311
+ ),
2312
+ clamp(trackStartY + offsetY, 0, 1 - yOverflowOffset)
2313
+ );
2199
2314
  }
2200
2315
  break;
2201
2316
  }
@@ -2219,7 +2334,7 @@ class TeleBox {
2219
2334
  if (ev.button != null && ev.button !== 0) {
2220
2335
  return;
2221
2336
  }
2222
- if (!this.draggable || trackingHandle || this.state !== exports.TELE_BOX_STATE.Normal) {
2337
+ if (!this.draggable || trackingHandle || this.state !== TELE_BOX_STATE.Normal) {
2223
2338
  return;
2224
2339
  }
2225
2340
  const target = ev.target;
@@ -2235,7 +2350,9 @@ class TeleBox {
2235
2350
  $trackMask = document.createElement("div");
2236
2351
  }
2237
2352
  const cursor = trackingHandle ? this.wrapClassName(`cursor-${trackingHandle}`) : "";
2238
- $trackMask.className = this.wrapClassName(`track-mask${cursor ? ` ${cursor}` : ""}`);
2353
+ $trackMask.className = this.wrapClassName(
2354
+ `track-mask${cursor ? ` ${cursor}` : ""}`
2355
+ );
2239
2356
  this.$box.appendChild($trackMask);
2240
2357
  this.$box.classList.add(transformingClassName);
2241
2358
  this._sideEffect.add(() => {
@@ -2255,18 +2372,33 @@ class TeleBox {
2255
2372
  window.removeEventListener("touchmove", handleTracking);
2256
2373
  window.removeEventListener("mouseup", handleTrackEnd);
2257
2374
  window.removeEventListener("touchend", handleTrackEnd);
2258
- window.removeEventListener("touchcancel", handleTrackEnd);
2375
+ window.removeEventListener(
2376
+ "touchcancel",
2377
+ handleTrackEnd
2378
+ );
2259
2379
  };
2260
2380
  }, TRACKING_DISPOSER_ID);
2261
2381
  }
2262
2382
  };
2263
2383
  this._handleTrackStart = handleTrackStart;
2264
- this._sideEffect.addEventListener($resizeHandles, "mousedown", handleTrackStart, {}, "box-resizeHandles-mousedown");
2265
- this._sideEffect.addEventListener($resizeHandles, "touchstart", handleTrackStart, { passive: false }, "box-resizeHandles-touchstart");
2384
+ this._sideEffect.addEventListener(
2385
+ $resizeHandles,
2386
+ "mousedown",
2387
+ handleTrackStart,
2388
+ {},
2389
+ "box-resizeHandles-mousedown"
2390
+ );
2391
+ this._sideEffect.addEventListener(
2392
+ $resizeHandles,
2393
+ "touchstart",
2394
+ handleTrackStart,
2395
+ { passive: false },
2396
+ "box-resizeHandles-touchstart"
2397
+ );
2266
2398
  }
2267
2399
  destroy() {
2268
2400
  this.$box.remove();
2269
- this.events.emit(exports.TELE_BOX_EVENT.Destroyed);
2401
+ this.events.emit(TELE_BOX_EVENT.Destroyed);
2270
2402
  this._sideEffect.flushAll();
2271
2403
  this._renderSideEffect.flushAll();
2272
2404
  this.events.removeAllListeners();
@@ -2279,7 +2411,7 @@ class TeleBox {
2279
2411
  function noop() {
2280
2412
  return;
2281
2413
  }
2282
- 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}";
2414
+ var style$2 = "";
2283
2415
  var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
2284
2416
  class TeleBoxCollector {
2285
2417
  constructor({
@@ -2288,8 +2420,10 @@ class TeleBoxCollector {
2288
2420
  darkMode = false,
2289
2421
  namespace = "telebox",
2290
2422
  styles = {},
2291
- onClick
2292
- } = {}) {
2423
+ onClick,
2424
+ getBoxesStatus
2425
+ }) {
2426
+ this.$appMenuContainer = document.createElement("div");
2293
2427
  this.handleCollectorClick = () => {
2294
2428
  if (!this._readonly && this.onClick) {
2295
2429
  this.onClick();
@@ -2301,6 +2435,11 @@ class TeleBoxCollector {
2301
2435
  this.namespace = namespace;
2302
2436
  this.styles = styles;
2303
2437
  this.onClick = onClick;
2438
+ this.getBoxesStatus = getBoxesStatus;
2439
+ }
2440
+ get boxesStatus() {
2441
+ var _a;
2442
+ return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
2304
2443
  }
2305
2444
  get visible() {
2306
2445
  return this._visible;
@@ -2321,11 +2460,29 @@ class TeleBoxCollector {
2321
2460
  }
2322
2461
  return this;
2323
2462
  }
2463
+ hasMinimizedBox() {
2464
+ const boxesStatus = this.boxesStatus;
2465
+ if (boxesStatus) {
2466
+ for (const status of boxesStatus.values()) {
2467
+ if (status === TELE_BOX_STATE.Minimized) {
2468
+ return true;
2469
+ }
2470
+ }
2471
+ }
2472
+ return false;
2473
+ }
2474
+ updateBoxesStatus() {
2475
+ const hasMinimizedBox = this.hasMinimizedBox();
2476
+ this.setVisible(hasMinimizedBox);
2477
+ }
2324
2478
  setVisible(visible) {
2325
2479
  if (this._visible !== visible) {
2326
2480
  this._visible = visible;
2327
2481
  if (this.$collector) {
2328
- this.$collector.classList.toggle(this.wrapClassName("collector-visible"), visible);
2482
+ this.$collector.classList.toggle(
2483
+ this.wrapClassName("collector-visible"),
2484
+ visible
2485
+ );
2329
2486
  }
2330
2487
  }
2331
2488
  return this;
@@ -2334,7 +2491,10 @@ class TeleBoxCollector {
2334
2491
  if (this._readonly !== readonly) {
2335
2492
  this._readonly = readonly;
2336
2493
  if (this.$collector) {
2337
- this.$collector.classList.toggle(this.wrapClassName("collector-readonly"), readonly);
2494
+ this.$collector.classList.toggle(
2495
+ this.wrapClassName("collector-readonly"),
2496
+ readonly
2497
+ );
2338
2498
  }
2339
2499
  }
2340
2500
  return this;
@@ -2343,8 +2503,14 @@ class TeleBoxCollector {
2343
2503
  if (this._darkMode !== darkMode) {
2344
2504
  this._darkMode = darkMode;
2345
2505
  if (this.$collector) {
2346
- this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
2347
- this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
2506
+ this.$collector.classList.toggle(
2507
+ this.wrapClassName("color-scheme-dark"),
2508
+ darkMode
2509
+ );
2510
+ this.$collector.classList.toggle(
2511
+ this.wrapClassName("color-scheme-light"),
2512
+ !darkMode
2513
+ );
2348
2514
  }
2349
2515
  }
2350
2516
  return this;
@@ -2367,21 +2533,37 @@ class TeleBoxCollector {
2367
2533
  this.$collector = document.createElement("button");
2368
2534
  this.$collector.className = this.wrapClassName("collector");
2369
2535
  this.$collector.style.backgroundImage = `url('${collectorSVG}')`;
2370
- this.$collector.addEventListener("click", this.handleCollectorClick);
2536
+ this.$collector.addEventListener(
2537
+ "click",
2538
+ this.handleCollectorClick
2539
+ );
2371
2540
  if (this._visible) {
2372
- this.$collector.classList.add(this.wrapClassName("collector-visible"));
2541
+ this.$collector.classList.add(
2542
+ this.wrapClassName("collector-visible")
2543
+ );
2373
2544
  }
2374
2545
  if (this._readonly) {
2375
- this.$collector.classList.add(this.wrapClassName("collector-readonly"));
2376
- }
2377
- this.$collector.classList.add(this.wrapClassName(this._darkMode ? "color-scheme-dark" : "color-scheme-light"));
2546
+ this.$collector.classList.add(
2547
+ this.wrapClassName("collector-readonly")
2548
+ );
2549
+ }
2550
+ this.$collector.classList.add(
2551
+ this.wrapClassName(
2552
+ this._darkMode ? "color-scheme-dark" : "color-scheme-light"
2553
+ )
2554
+ );
2555
+ this.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow"));
2556
+ this.$collector.append(this.$appMenuContainer);
2378
2557
  this.setStyles(this.styles);
2379
2558
  }
2380
2559
  return this.$collector;
2381
2560
  }
2382
2561
  destroy() {
2383
2562
  if (this.$collector) {
2384
- this.$collector.removeEventListener("click", this.handleCollectorClick);
2563
+ this.$collector.removeEventListener(
2564
+ "click",
2565
+ this.handleCollectorClick
2566
+ );
2385
2567
  this.$collector.remove();
2386
2568
  this.$collector = void 0;
2387
2569
  }
@@ -2391,8 +2573,7 @@ class TeleBoxCollector {
2391
2573
  return `${this.namespace}-${className}`;
2392
2574
  }
2393
2575
  }
2394
- exports.TELE_BOX_MANAGER_EVENT = void 0;
2395
- (function(TELE_BOX_MANAGER_EVENT2) {
2576
+ var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
2396
2577
  TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
2397
2578
  TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
2398
2579
  TELE_BOX_MANAGER_EVENT2["Created"] = "created";
@@ -2410,8 +2591,9 @@ exports.TELE_BOX_MANAGER_EVENT = void 0;
2410
2591
  TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
2411
2592
  TELE_BOX_MANAGER_EVENT2["BoxStatus"] = "box_status";
2412
2593
  TELE_BOX_MANAGER_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
2413
- })(exports.TELE_BOX_MANAGER_EVENT || (exports.TELE_BOX_MANAGER_EVENT = {}));
2414
- 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}";
2594
+ return TELE_BOX_MANAGER_EVENT2;
2595
+ })(TELE_BOX_MANAGER_EVENT || {});
2596
+ var style$1 = "";
2415
2597
  class MaxTitleBar extends DefaultTitleBar {
2416
2598
  constructor(config) {
2417
2599
  super(config);
@@ -2421,11 +2603,15 @@ class MaxTitleBar extends DefaultTitleBar {
2421
2603
  this.darkMode = config.darkMode;
2422
2604
  this.getBoxesStatus = config.getBoxesStatus;
2423
2605
  }
2606
+ get boxesStatus() {
2607
+ var _a;
2608
+ return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
2609
+ }
2424
2610
  hasMaximizedBoxInStatus() {
2425
2611
  if (this.getBoxesStatus) {
2426
2612
  const boxesStatus = this.getBoxesStatus();
2427
2613
  if (boxesStatus.size) {
2428
- const hasMaximizedBox = [...boxesStatus.values()].find((state) => state === exports.TELE_BOX_STATE.Maximized);
2614
+ const hasMaximizedBox = [...boxesStatus.values()].find((state) => state === TELE_BOX_STATE.Maximized);
2429
2615
  return !!hasMaximizedBox;
2430
2616
  }
2431
2617
  }
@@ -2435,7 +2621,7 @@ class MaxTitleBar extends DefaultTitleBar {
2435
2621
  if (this.getBoxesStatus) {
2436
2622
  const boxesStatus = this.getBoxesStatus();
2437
2623
  if (boxesStatus) {
2438
- return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === exports.TELE_BOX_STATE.Maximized);
2624
+ return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
2439
2625
  }
2440
2626
  }
2441
2627
  return [];
@@ -2447,15 +2633,21 @@ class MaxTitleBar extends DefaultTitleBar {
2447
2633
  }
2448
2634
  if (this.$titles) {
2449
2635
  const { children } = this.$titles.firstElementChild;
2450
- if (this.state === exports.TELE_BOX_STATE.Maximized && !this.hasMaximizedBoxInStatus()) {
2636
+ if (this.state === TELE_BOX_STATE.Maximized && !this.hasMaximizedBoxInStatus()) {
2451
2637
  for (let i2 = children.length - 1; i2 >= 0; i2 -= 1) {
2452
2638
  const $tab = children[i2];
2453
2639
  const id = (_a = $tab.dataset) == null ? void 0 : _a.teleBoxID;
2454
2640
  if (id) {
2455
2641
  if (box && id === box.id) {
2456
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), true);
2642
+ $tab.classList.toggle(
2643
+ this.wrapClassName("titles-tab-focus"),
2644
+ true
2645
+ );
2457
2646
  } else if (this.focusedBox && id === this.focusedBox.id) {
2458
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), false);
2647
+ $tab.classList.toggle(
2648
+ this.wrapClassName("titles-tab-focus"),
2649
+ false
2650
+ );
2459
2651
  }
2460
2652
  }
2461
2653
  }
@@ -2465,9 +2657,15 @@ class MaxTitleBar extends DefaultTitleBar {
2465
2657
  const id = (_b = $tab.dataset) == null ? void 0 : _b.teleBoxID;
2466
2658
  if (id) {
2467
2659
  if (box && id === box.id) {
2468
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), true);
2660
+ $tab.classList.toggle(
2661
+ this.wrapClassName("titles-tab-focus"),
2662
+ true
2663
+ );
2469
2664
  } else if (this.focusedBox && id === this.focusedBox.id) {
2470
- $tab.classList.toggle(this.wrapClassName("titles-tab-focus"), false);
2665
+ $tab.classList.toggle(
2666
+ this.wrapClassName("titles-tab-focus"),
2667
+ false
2668
+ );
2471
2669
  }
2472
2670
  }
2473
2671
  }
@@ -2485,39 +2683,57 @@ class MaxTitleBar extends DefaultTitleBar {
2485
2683
  }
2486
2684
  updateBoxesStatus() {
2487
2685
  if (this.hasMaximizedBoxInStatus()) {
2488
- this.setBoxStatus(exports.TELE_BOX_STATE.Maximized);
2686
+ this.setBoxStatus(TELE_BOX_STATE.Maximized);
2489
2687
  }
2490
2688
  if (this.$titleBar) {
2491
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === exports.TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus());
2689
+ this.$titleBar.classList.toggle(
2690
+ this.wrapClassName("max-titlebar-maximized"),
2691
+ this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
2692
+ );
2492
2693
  }
2493
2694
  this.updateTitles();
2494
2695
  }
2495
2696
  setBoxes(boxes) {
2496
2697
  this.boxes = boxes;
2497
2698
  if (this.$titleBar) {
2498
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === exports.TELE_BOX_STATE.Maximized && boxes.length > 0 || this.hasMaximizedBoxInStatus());
2699
+ this.$titleBar.classList.toggle(
2700
+ this.wrapClassName("max-titlebar-maximized"),
2701
+ this.state === TELE_BOX_STATE.Maximized && boxes.length > 0 || this.hasMaximizedBoxInStatus()
2702
+ );
2499
2703
  }
2500
2704
  this.updateTitles();
2501
2705
  }
2502
2706
  setState(state) {
2503
2707
  super.setState(state);
2504
2708
  if (this.$titleBar) {
2505
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), state === exports.TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus());
2709
+ this.$titleBar.classList.toggle(
2710
+ this.wrapClassName("max-titlebar-maximized"),
2711
+ state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
2712
+ );
2506
2713
  }
2507
2714
  this.updateTitles();
2508
2715
  }
2509
2716
  setReadonly(readonly) {
2510
2717
  super.setReadonly(readonly);
2511
2718
  if (this.$titleBar) {
2512
- this.$titleBar.classList.toggle(this.wrapClassName("readonly"), this.readonly);
2719
+ this.$titleBar.classList.toggle(
2720
+ this.wrapClassName("readonly"),
2721
+ this.readonly
2722
+ );
2513
2723
  }
2514
2724
  }
2515
2725
  setDarkMode(darkMode) {
2516
2726
  if (darkMode !== this.darkMode) {
2517
2727
  this.darkMode = darkMode;
2518
2728
  if (this.$titleBar) {
2519
- this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
2520
- this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
2729
+ this.$titleBar.classList.toggle(
2730
+ this.wrapClassName("color-scheme-dark"),
2731
+ darkMode
2732
+ );
2733
+ this.$titleBar.classList.toggle(
2734
+ this.wrapClassName("color-scheme-light"),
2735
+ !darkMode
2736
+ );
2521
2737
  }
2522
2738
  }
2523
2739
  }
@@ -2527,9 +2743,19 @@ class MaxTitleBar extends DefaultTitleBar {
2527
2743
  $titleBar.style.transform = `translate(${x}px, ${y}px)`;
2528
2744
  $titleBar.style.width = width + "px";
2529
2745
  $titleBar.classList.add(this.wrapClassName("max-titlebar"));
2530
- $titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), this.state === exports.TELE_BOX_STATE.Maximized && this.boxes.length > 0);
2531
- $titleBar.classList.toggle(this.wrapClassName("readonly"), this.readonly);
2532
- $titleBar.classList.add(this.wrapClassName(this.darkMode ? "color-scheme-dark" : "color-scheme-light"));
2746
+ $titleBar.classList.toggle(
2747
+ this.wrapClassName("max-titlebar-maximized"),
2748
+ this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0
2749
+ );
2750
+ $titleBar.classList.toggle(
2751
+ this.wrapClassName("readonly"),
2752
+ this.readonly
2753
+ );
2754
+ $titleBar.classList.add(
2755
+ this.wrapClassName(
2756
+ this.darkMode ? "color-scheme-dark" : "color-scheme-light"
2757
+ )
2758
+ );
2533
2759
  const $titlesArea = document.createElement("div");
2534
2760
  $titlesArea.classList.add(this.wrapClassName("titles-area"));
2535
2761
  $titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
@@ -2543,24 +2769,34 @@ class MaxTitleBar extends DefaultTitleBar {
2543
2769
  this.focusedBox = void 0;
2544
2770
  }
2545
2771
  updateTitles() {
2546
- if (this.$titleBar && (this.state === exports.TELE_BOX_STATE.Maximized || this.hasMaximizedBoxInStatus())) {
2547
- this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"), this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1);
2772
+ if (this.$titleBar && (this.state === TELE_BOX_STATE.Maximized || this.hasMaximizedBoxInStatus())) {
2773
+ this.$titleBar.classList.toggle(
2774
+ this.wrapClassName("max-titlebar-single-title"),
2775
+ this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1
2776
+ );
2548
2777
  if (this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1) {
2549
2778
  this.setTitle(this.boxes[0].title);
2550
2779
  } else {
2551
- this.$titleBar.replaceChild(this.renderTitles(), this.$titleBar.firstElementChild);
2780
+ this.$titleBar.replaceChild(
2781
+ this.renderTitles(),
2782
+ this.$titleBar.firstElementChild
2783
+ );
2552
2784
  }
2553
2785
  }
2554
2786
  }
2555
2787
  renderTitles() {
2556
2788
  this.$titles = document.createElement("div");
2557
2789
  this.$titles.className = this.wrapClassName("titles");
2558
- this.$titles.addEventListener("wheel", (ev) => {
2559
- ev.currentTarget.scrollBy({
2560
- left: ev.deltaY > 0 ? 250 : -250,
2561
- behavior: "smooth"
2562
- });
2563
- }, { passive: false });
2790
+ this.$titles.addEventListener(
2791
+ "wheel",
2792
+ (ev) => {
2793
+ ev.currentTarget.scrollBy({
2794
+ left: ev.deltaY > 0 ? 250 : -250,
2795
+ behavior: "smooth"
2796
+ });
2797
+ },
2798
+ { passive: false }
2799
+ );
2564
2800
  const $content = document.createElement("div");
2565
2801
  $content.className = this.wrapClassName("titles-content");
2566
2802
  this.$titles.appendChild($content);
@@ -2578,10 +2814,124 @@ class MaxTitleBar extends DefaultTitleBar {
2578
2814
  return this.$titles;
2579
2815
  }
2580
2816
  }
2817
+ var style = "";
2818
+ class AppMenu {
2819
+ constructor(props) {
2820
+ this.namespace = "telebox-app-menu";
2821
+ this.badge = document.createElement("div");
2822
+ this.menuView = document.createElement("div");
2823
+ this.containerClickHandler = () => {
2824
+ if (this.manager.readonly) {
2825
+ return;
2826
+ }
2827
+ const isShowMenuView = getComputedStyle(this.menuView).display === "flex";
2828
+ if (isShowMenuView) {
2829
+ this.menuView.style.display = "none";
2830
+ } else {
2831
+ this.menuView.style.display = "flex";
2832
+ }
2833
+ };
2834
+ this.menuViewClickHandler = (e2) => {
2835
+ e2.stopPropagation();
2836
+ e2.stopImmediatePropagation();
2837
+ const target = e2.target;
2838
+ const id = target.getAttribute(`data-${this.c("app-id")}`);
2839
+ if (id) {
2840
+ const lastNotMinimizedBoxStatus = this.manager.getLastNotMinimizedBoxStatus(id) || TELE_BOX_STATE.Normal;
2841
+ const zIndex = (lastNotMinimizedBoxStatus === TELE_BOX_STATE.Maximized ? this.manager.getMaxMaximizedBoxZIndex() : this.manager.getMaxNormalBoxZIndex()) + 1;
2842
+ this.manager.setBox(id, {
2843
+ status: lastNotMinimizedBoxStatus,
2844
+ zIndex
2845
+ }, false, () => {
2846
+ this.manager.focusBox(id);
2847
+ });
2848
+ return;
2849
+ }
2850
+ };
2851
+ this.updatePrefersColorSchemeHandler = () => {
2852
+ this.container.classList.remove(this.theme);
2853
+ this.theme = this.manager.prefersColorScheme;
2854
+ this.container.classList.add(this.theme);
2855
+ };
2856
+ this.appMenuChange = () => {
2857
+ const minimizedBoxesStatus = this.manager.getMinimizedBoxesStatus();
2858
+ this.render(minimizedBoxesStatus);
2859
+ };
2860
+ this.container = props.container;
2861
+ this.manager = props.manager;
2862
+ this.theme = props.theme;
2863
+ this.getBoxesStatus = props.getBoxesStatus;
2864
+ this.init();
2865
+ }
2866
+ get boxesStatus() {
2867
+ var _a;
2868
+ return ((_a = this.getBoxesStatus) == null ? void 0 : _a.call(this)) || /* @__PURE__ */ new Map();
2869
+ }
2870
+ get minimizedBoxesStatus() {
2871
+ const arr = [];
2872
+ this.boxesStatus.forEach((status) => {
2873
+ if (status === TELE_BOX_STATE.Minimized) {
2874
+ arr.push(status);
2875
+ }
2876
+ });
2877
+ return arr;
2878
+ }
2879
+ c(className) {
2880
+ return `${this.namespace}-${className}`;
2881
+ }
2882
+ createDefaultAppMenu() {
2883
+ this.badge.classList.add(this.c("app-menu-badge"));
2884
+ this.menuView.classList.add(this.c("app-menu-tooltip"));
2885
+ this.container.classList.add(this.c("app-menu-container"), this.theme);
2886
+ this.menuView.addEventListener("click", this.menuViewClickHandler);
2887
+ this.container.append(this.badge, this.menuView);
2888
+ }
2889
+ async init() {
2890
+ this.createDefaultAppMenu();
2891
+ this.appMenuChange();
2892
+ }
2893
+ createMinimizedItem(appId) {
2894
+ const appItem = document.createElement("div");
2895
+ appItem.classList.add(this.c("app-menu-item"));
2896
+ console.log("appId=====>", appId);
2897
+ appItem.setAttribute(`data-${this.c("app-id")}`, appId);
2898
+ const titleDiv = document.createElement("div");
2899
+ titleDiv.classList.add(this.c("app-menu-item-title"));
2900
+ const app = this.manager.getBox(appId);
2901
+ titleDiv.innerText = (app == null ? void 0 : app.title) || appId;
2902
+ appItem.appendChild(titleDiv);
2903
+ return appItem;
2904
+ }
2905
+ renderMenuView(minimizedBoxesStatus) {
2906
+ const items = [];
2907
+ minimizedBoxesStatus.forEach((_, appId) => {
2908
+ items.push(this.createMinimizedItem(appId));
2909
+ });
2910
+ this.menuView.append(...items);
2911
+ }
2912
+ render(minimizedBoxesStatus) {
2913
+ this.menuView.style.display = "none";
2914
+ this.badge.innerText = "";
2915
+ this.menuView.innerHTML = "";
2916
+ if (minimizedBoxesStatus.size === 0) {
2917
+ this.container.style.display = "none";
2918
+ } else {
2919
+ this.badge.innerText = minimizedBoxesStatus.size.toString();
2920
+ this.renderMenuView(minimizedBoxesStatus);
2921
+ this.container.style.display = "block";
2922
+ }
2923
+ }
2924
+ destroy() {
2925
+ this.badge.remove();
2926
+ this.menuView.removeEventListener("click", this.menuViewClickHandler);
2927
+ this.menuView.remove();
2928
+ this.container.remove();
2929
+ }
2930
+ }
2581
2931
  class TeleBoxManager {
2582
2932
  constructor({
2583
2933
  root = document.body,
2584
- prefersColorScheme = exports.TELE_BOX_COLOR_SCHEME.Light,
2934
+ prefersColorScheme = TELE_BOX_COLOR_SCHEME.Light,
2585
2935
  minimized = false,
2586
2936
  maximized = false,
2587
2937
  fence = true,
@@ -2593,28 +2943,37 @@ class TeleBoxManager {
2593
2943
  },
2594
2944
  collector,
2595
2945
  namespace = "telebox",
2596
- readonly = false
2946
+ readonly = false,
2947
+ useBoxesStatus = false
2597
2948
  } = {}) {
2598
2949
  this.events = new EventEmitter();
2599
2950
  this._sideEffect = new o();
2951
+ this.useBoxesStatus = useBoxesStatus;
2600
2952
  const { combine, createVal } = c(this._sideEffect);
2601
2953
  this.root = root;
2602
2954
  this.namespace = namespace;
2603
2955
  this.boxes$ = createVal([]);
2604
2956
  this.topBox$ = this.boxes$.derive((boxes) => {
2605
2957
  if (boxes.length > 0) {
2958
+ console.log("topBox===>topBox$===>000");
2959
+ let currentTopBox = void 0;
2606
2960
  const topBox = boxes.reduce((topBox2, box) => {
2607
- if (box.boxStatus && box.boxStatus === exports.TELE_BOX_STATE.Minimized) {
2961
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
2962
+ return topBox2;
2963
+ }
2964
+ if (!topBox2) {
2965
+ topBox2 = box;
2608
2966
  return topBox2;
2609
2967
  }
2610
2968
  return topBox2.zIndex > box.zIndex ? topBox2 : box;
2611
- });
2969
+ }, currentTopBox);
2970
+ console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
2612
2971
  return topBox;
2613
2972
  }
2614
2973
  return;
2615
2974
  });
2616
- this.boxesStatus$ = new Map();
2617
- this.lastNotMinimizedBoxesStatus$ = new Map();
2975
+ this.boxesStatus$ = /* @__PURE__ */ new Map();
2976
+ this.lastNotMinimizedBoxesStatus$ = /* @__PURE__ */ new Map();
2618
2977
  const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
2619
2978
  const prefersDark$ = createVal(false);
2620
2979
  if (prefersDark) {
@@ -2629,16 +2988,24 @@ class TeleBoxManager {
2629
2988
  }
2630
2989
  const prefersColorScheme$ = createVal(prefersColorScheme);
2631
2990
  prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
2632
- this.boxes.forEach((box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate));
2991
+ this.boxes.forEach(
2992
+ (box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate)
2993
+ );
2633
2994
  if (!skipUpdate) {
2634
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.PrefersColorScheme, prefersColorScheme2);
2995
+ this.events.emit(
2996
+ TELE_BOX_MANAGER_EVENT.PrefersColorScheme,
2997
+ prefersColorScheme2
2998
+ );
2635
2999
  }
2636
3000
  });
2637
- this._darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark");
3001
+ this._darkMode$ = combine(
3002
+ [prefersDark$, prefersColorScheme$],
3003
+ ([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark"
3004
+ );
2638
3005
  this._darkMode$.reaction((darkMode, _, skipUpdate) => {
2639
3006
  this.boxes.forEach((box) => box.setDarkMode(darkMode, skipUpdate));
2640
3007
  if (!skipUpdate) {
2641
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.DarkMode, darkMode);
3008
+ this.events.emit(TELE_BOX_MANAGER_EVENT.DarkMode, darkMode);
2642
3009
  }
2643
3010
  });
2644
3011
  const readonly$ = createVal(readonly);
@@ -2648,16 +3015,21 @@ class TeleBoxManager {
2648
3015
  const minimized$ = createVal(minimized);
2649
3016
  const maximized$ = createVal(maximized);
2650
3017
  maximized$.reaction((maximized2, _, skipUpdate) => {
2651
- this.boxes.forEach((box) => box.setMaximized(maximized2, skipUpdate));
3018
+ this.boxes.forEach(
3019
+ (box) => box.setMaximized(maximized2, skipUpdate)
3020
+ );
2652
3021
  if (!skipUpdate) {
2653
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
3022
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
2654
3023
  }
2655
3024
  });
2656
- const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? exports.TELE_BOX_STATE.Minimized : maximized2 ? exports.TELE_BOX_STATE.Maximized : exports.TELE_BOX_STATE.Normal);
3025
+ const state$ = combine(
3026
+ [minimized$, maximized$],
3027
+ ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal
3028
+ );
2657
3029
  state$.reaction((state, _, skipUpdate) => {
2658
3030
  this.maxTitleBar.setState(state);
2659
3031
  if (!skipUpdate) {
2660
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.State, state);
3032
+ this.events.emit(TELE_BOX_MANAGER_EVENT.State, state);
2661
3033
  }
2662
3034
  });
2663
3035
  const fence$ = createVal(fence);
@@ -2666,44 +3038,46 @@ class TeleBoxManager {
2666
3038
  });
2667
3039
  const containerRect$ = createVal(containerRect, shallowequal);
2668
3040
  containerRect$.reaction((containerRect2, _, skipUpdate) => {
2669
- this.boxes.forEach((box) => box.setContainerRect(containerRect2, skipUpdate));
3041
+ this.boxes.forEach(
3042
+ (box) => box.setContainerRect(containerRect2, skipUpdate)
3043
+ );
2670
3044
  this.maxTitleBar.setContainerRect(containerRect2);
2671
3045
  });
2672
- const collector$ = createVal(collector === null ? null : collector || new TeleBoxCollector({
2673
- visible: minimized,
2674
- readonly,
2675
- namespace
2676
- }).mount(root));
3046
+ const collector$ = createVal(
3047
+ collector === null ? null : collector || new TeleBoxCollector({
3048
+ visible: minimized,
3049
+ readonly,
3050
+ namespace
3051
+ }).mount(root)
3052
+ );
2677
3053
  collector$.subscribe((collector2) => {
2678
3054
  if (collector2) {
2679
3055
  collector2.setVisible(minimized$.value);
2680
3056
  collector2.setReadonly(readonly$.value);
2681
3057
  collector2.setDarkMode(this._darkMode$.value);
2682
3058
  this._sideEffect.add(() => {
3059
+ collector2.getBoxesStatus = () => {
3060
+ return this.boxesStatus$;
3061
+ };
2683
3062
  collector2.onClick = () => {
2684
3063
  if (!readonly$.value) {
2685
- if (this.hasMinimizedBox()) {
2686
- this.getAllMinimizedBoxes().forEach((box) => {
2687
- const lastNotMinimizedBoxStatus = box.lastNotMinimizedBoxStatus;
2688
- if (lastNotMinimizedBoxStatus) {
2689
- this.setBoxStatus(box.id, lastNotMinimizedBoxStatus);
2690
- } else {
2691
- this.setBoxStatus(box.id, exports.TELE_BOX_STATE.Normal);
2692
- }
2693
- });
2694
- this.effectBoxStatusChange();
3064
+ if (!this.useBoxesStatus) {
3065
+ minimized$.setValue(false);
3066
+ } else if (this.useBoxesStatus && this.appMenu) {
3067
+ this.appMenu.containerClickHandler();
2695
3068
  }
2696
- minimized$.setValue(false);
2697
3069
  }
2698
3070
  };
2699
3071
  return () => collector2.destroy();
2700
3072
  }, "collect-onClick");
2701
3073
  }
2702
3074
  });
2703
- readonly$.subscribe((readonly2) => {
2704
- var _a;
2705
- return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
2706
- });
3075
+ readonly$.subscribe(
3076
+ (readonly2) => {
3077
+ var _a;
3078
+ return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
3079
+ }
3080
+ );
2707
3081
  this._darkMode$.subscribe((darkMode) => {
2708
3082
  var _a;
2709
3083
  (_a = collector$.value) == null ? void 0 : _a.setDarkMode(darkMode);
@@ -2722,23 +3096,31 @@ class TeleBoxManager {
2722
3096
  }
2723
3097
  return;
2724
3098
  };
2725
- const collectorRect$ = createVal(minimized$.value ? this._calcCollectorRect() : void 0);
3099
+ this._setCollectorRect = (collectorRect) => {
3100
+ var _a;
3101
+ if ((_a = collector$.value) == null ? void 0 : _a.$collector) {
3102
+ collectorRect$.setValue(collectorRect);
3103
+ }
3104
+ };
3105
+ const collectorRect$ = createVal(
3106
+ minimized$.value ? this._calcCollectorRect() : void 0
3107
+ );
2726
3108
  collectorRect$.subscribe((collectorRect, _, skipUpdate) => {
2727
3109
  this.boxes.forEach((box) => {
2728
3110
  box.setCollectorRect(collectorRect, skipUpdate);
2729
3111
  });
2730
3112
  });
2731
3113
  minimized$.subscribe((minimized2, _, skipUpdate) => {
2732
- var _a, _b;
3114
+ var _a;
2733
3115
  (_a = collector$.value) == null ? void 0 : _a.setVisible(minimized2);
2734
3116
  if (minimized2) {
2735
- if ((_b = collector$.value) == null ? void 0 : _b.$collector) {
2736
- collectorRect$.setValue(this._calcCollectorRect());
2737
- }
3117
+ this._setCollectorRect(this._calcCollectorRect());
2738
3118
  }
2739
- this.boxes.forEach((box) => box.setMinimized(minimized2, skipUpdate));
3119
+ this.boxes.forEach(
3120
+ (box) => box.setMinimized(minimized2, skipUpdate)
3121
+ );
2740
3122
  if (!skipUpdate) {
2741
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
3123
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
2742
3124
  }
2743
3125
  });
2744
3126
  const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
@@ -2759,17 +3141,45 @@ class TeleBoxManager {
2759
3141
  if (id) {
2760
3142
  const box = this.getBox(id);
2761
3143
  if (box) {
2762
- this.focusBox(box);
2763
- if (box.boxStatus && box.boxStatus !== exports.TELE_BOX_STATE.Maximized || !box.boxStatus) {
3144
+ if (!this.useBoxesStatus) {
2764
3145
  this.makeBoxTop(box);
3146
+ } else {
3147
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3148
+ const maxNormalBoxZIndex = this.getMaxNormalBoxZIndex();
3149
+ if (maxNormalBoxZIndex > box.zIndex) {
3150
+ this.setBox(box, {
3151
+ zIndex: maxNormalBoxZIndex + 1
3152
+ }, false);
3153
+ }
3154
+ } else if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3155
+ const maxMaximizedBoxZIndex = this.getMaxMaximizedBoxZIndex();
3156
+ if (maxMaximizedBoxZIndex > box.zIndex) {
3157
+ this.setBox(box, {
3158
+ zIndex: maxMaximizedBoxZIndex + 1
3159
+ }, false);
3160
+ }
3161
+ this.makeMaximizedTopBoxFocus();
3162
+ }
2765
3163
  }
3164
+ console.log("checkFocusBox===>", box.id);
3165
+ this.focusBox(box);
2766
3166
  return;
2767
3167
  }
2768
3168
  }
2769
3169
  }
2770
3170
  };
2771
- this._sideEffect.addEventListener(window, "mousedown", checkFocusBox, true);
2772
- this._sideEffect.addEventListener(window, "touchstart", checkFocusBox, true);
3171
+ this._sideEffect.addEventListener(
3172
+ window,
3173
+ "mousedown",
3174
+ checkFocusBox,
3175
+ true
3176
+ );
3177
+ this._sideEffect.addEventListener(
3178
+ window,
3179
+ "touchstart",
3180
+ checkFocusBox,
3181
+ true
3182
+ );
2773
3183
  this.maxTitleBar = new MaxTitleBar({
2774
3184
  darkMode: this.darkMode,
2775
3185
  readonly: readonly$.value,
@@ -2781,32 +3191,81 @@ class TeleBoxManager {
2781
3191
  return this.boxesStatus$;
2782
3192
  },
2783
3193
  onEvent: (event) => {
2784
- var _a, _b, _c;
2785
3194
  switch (event.type) {
2786
- case exports.TELE_BOX_DELEGATE_EVENT.Maximize: {
2787
- if (this.hasBoxesStatus() && ((_a = this.maxTitleBar.focusedBox) == null ? void 0 : _a.id)) {
2788
- this.setBoxStatus(this.maxTitleBar.focusedBox.id, exports.TELE_BOX_STATE.Normal);
2789
- this.effectBoxStatusChange();
2790
- this.makeMaximizedTopBoxFocus();
3195
+ case TELE_BOX_DELEGATE_EVENT.Maximize: {
3196
+ if (this.hasBoxesStatus()) {
3197
+ let targetBox = this.maxTitleBar.focusedBox;
3198
+ if (!targetBox) {
3199
+ targetBox = this.getMaximizedTopBox();
3200
+ }
3201
+ if (targetBox == null ? void 0 : targetBox.id) {
3202
+ const box = this.getBox(targetBox.id);
3203
+ if (box) {
3204
+ this.setBox(box, {
3205
+ status: TELE_BOX_STATE.Normal,
3206
+ zIndex: this.getMaxNormalBoxZIndex() + 1
3207
+ }, false, () => {
3208
+ this.makeMaximizedTopBoxFocus();
3209
+ });
3210
+ }
3211
+ }
2791
3212
  } else {
2792
3213
  maximized$.setValue(!maximized$.value);
2793
3214
  }
2794
3215
  break;
2795
3216
  }
2796
- case exports.TELE_BOX_DELEGATE_EVENT.Minimize: {
2797
- if (this.hasBoxesStatus() && ((_b = this.maxTitleBar.focusedBox) == null ? void 0 : _b.id)) {
2798
- this.setBoxStatus(this.maxTitleBar.focusedBox.id, exports.TELE_BOX_STATE.Minimized);
2799
- this.effectBoxStatusChange();
2800
- this.makeMaximizedTopBoxFocus();
3217
+ case TELE_BOX_DELEGATE_EVENT.Minimize: {
3218
+ if (this.hasBoxesStatus()) {
3219
+ let targetBox = this.maxTitleBar.focusedBox;
3220
+ if (!targetBox) {
3221
+ targetBox = this.getMaximizedTopBox();
3222
+ }
3223
+ if (targetBox == null ? void 0 : targetBox.id) {
3224
+ const box = this.getBox(targetBox.id);
3225
+ if (box) {
3226
+ let isFocusChanged = false;
3227
+ if (this.topBox === box) {
3228
+ this.blurBox(box);
3229
+ isFocusChanged = true;
3230
+ }
3231
+ this.setBox(box, {
3232
+ status: TELE_BOX_STATE.Minimized,
3233
+ zIndex: -1
3234
+ }, false);
3235
+ if (isFocusChanged) {
3236
+ this.focusTopBox();
3237
+ } else {
3238
+ this.makeMaximizedTopBoxFocus();
3239
+ }
3240
+ }
3241
+ }
2801
3242
  } else {
2802
3243
  minimized$.setValue(true);
2803
3244
  }
2804
3245
  break;
2805
3246
  }
2806
- case exports.TELE_BOX_EVENT.Close: {
2807
- if (this.hasBoxesStatus() && ((_c = this.maxTitleBar.focusedBox) == null ? void 0 : _c.id)) {
2808
- this.remove(this.maxTitleBar.focusedBox.id);
2809
- this.makeMaximizedTopBoxFocus();
3247
+ case TELE_BOX_EVENT.Close: {
3248
+ if (this.hasBoxesStatus()) {
3249
+ let targetBox = this.maxTitleBar.focusedBox;
3250
+ if (!targetBox) {
3251
+ targetBox = this.getMaximizedTopBox();
3252
+ }
3253
+ if (targetBox == null ? void 0 : targetBox.id) {
3254
+ const box = this.getBox(targetBox.id);
3255
+ if (box) {
3256
+ let isFocusChanged = false;
3257
+ if (this.topBox === box) {
3258
+ this.blurBox(box);
3259
+ isFocusChanged = true;
3260
+ }
3261
+ this.remove(box, false);
3262
+ if (isFocusChanged) {
3263
+ this.focusTopBox();
3264
+ } else {
3265
+ this.makeMaximizedTopBoxFocus();
3266
+ }
3267
+ }
3268
+ }
2810
3269
  } else {
2811
3270
  this.removeTopBox();
2812
3271
  this.focusTopBox();
@@ -2816,7 +3275,9 @@ class TeleBoxManager {
2816
3275
  }
2817
3276
  }
2818
3277
  });
2819
- readonly$.subscribe((readonly2) => this.maxTitleBar.setReadonly(readonly2));
3278
+ readonly$.subscribe(
3279
+ (readonly2) => this.maxTitleBar.setReadonly(readonly2)
3280
+ );
2820
3281
  this._darkMode$.subscribe((darkMode) => {
2821
3282
  this.maxTitleBar.setDarkMode(darkMode);
2822
3283
  });
@@ -2836,6 +3297,9 @@ class TeleBoxManager {
2836
3297
  i(this, valConfig);
2837
3298
  this._state$ = state$;
2838
3299
  this.root.appendChild(this.maxTitleBar.render());
3300
+ if (useBoxesStatus) {
3301
+ this.appMenu = this.createMinimizedAppMenu();
3302
+ }
2839
3303
  }
2840
3304
  get boxes() {
2841
3305
  return this.boxes$.value;
@@ -2851,12 +3315,12 @@ class TeleBoxManager {
2851
3315
  }
2852
3316
  setState(state, skipUpdate = false) {
2853
3317
  switch (state) {
2854
- case exports.TELE_BOX_STATE.Maximized: {
3318
+ case TELE_BOX_STATE.Maximized: {
2855
3319
  this.setMinimized(false, skipUpdate);
2856
3320
  this.setMaximized(true, skipUpdate);
2857
3321
  break;
2858
3322
  }
2859
- case exports.TELE_BOX_STATE.Minimized: {
3323
+ case TELE_BOX_STATE.Minimized: {
2860
3324
  this.setMinimized(true, skipUpdate);
2861
3325
  this.setMaximized(false, skipUpdate);
2862
3326
  break;
@@ -2873,28 +3337,22 @@ class TeleBoxManager {
2873
3337
  if (boxStatus) {
2874
3338
  const oldBoxStatus = this.boxesStatus$.get(boxId);
2875
3339
  this.boxesStatus$.set(boxId, boxStatus);
2876
- if (boxStatus === exports.TELE_BOX_STATE.Minimized && oldBoxStatus !== exports.TELE_BOX_STATE.Minimized) {
3340
+ if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
2877
3341
  this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
2878
- this.effectLastNotMinimizedBoxStatusChange();
2879
- } else if (oldBoxStatus === exports.TELE_BOX_STATE.Minimized && boxStatus !== exports.TELE_BOX_STATE.Minimized) {
3342
+ } else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
2880
3343
  this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
2881
- this.effectLastNotMinimizedBoxStatusChange();
2882
3344
  }
2883
3345
  } else {
2884
3346
  this.boxesStatus$.delete(boxId);
2885
3347
  this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
2886
- this.effectLastNotMinimizedBoxStatusChange();
2887
3348
  }
2888
3349
  if (!skipUpdate) {
2889
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
3350
+ this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
2890
3351
  }
2891
3352
  }
2892
3353
  getBoxStatus(boxId) {
2893
3354
  return this.boxesStatus$.get(boxId);
2894
3355
  }
2895
- getLastNotMinimizedBoxStatus(boxId) {
2896
- return this.lastNotMinimizedBoxesStatus$.get(boxId);
2897
- }
2898
3356
  get boxesStatus() {
2899
3357
  return this.boxesStatus$;
2900
3358
  }
@@ -2903,71 +3361,153 @@ class TeleBoxManager {
2903
3361
  }
2904
3362
  setBoxesStatus(boxesStatus, skipUpdate = false) {
2905
3363
  this.boxesStatus$ = boxesStatus;
2906
- this.effectBoxStatusChange(skipUpdate);
2907
- }
2908
- effectBoxStatusTimerFunc(skipUpdate) {
2909
- var _a, _b, _c, _d;
2910
- this.effectBoxStatusTimer = void 0;
2911
- let topBox;
2912
- const topBoxId = (_a = this.topBox) == null ? void 0 : _a.id;
2913
- let hasMinimizedBox = false;
3364
+ this.effectBoxesStatusChange(skipUpdate);
3365
+ }
3366
+ getBoxesStatus() {
3367
+ return this.boxesStatus$;
3368
+ }
3369
+ effectBoxStatusChange() {
3370
+ if (!this.useBoxesStatus) {
3371
+ return;
3372
+ }
3373
+ if (this.collector) {
3374
+ this.collector.updateBoxesStatus();
3375
+ if (this.hasMinimizedBox()) {
3376
+ this._setCollectorRect(this._calcCollectorRect());
3377
+ }
3378
+ }
3379
+ if (this.appMenu) {
3380
+ this.appMenu.appMenuChange();
3381
+ }
3382
+ if (this.maxTitleBar) {
3383
+ this.maxTitleBar.updateBoxesStatus();
3384
+ }
3385
+ }
3386
+ effectBoxesStatusTimerFunc(skipUpdate) {
3387
+ if (!this.useBoxesStatus) {
3388
+ return;
3389
+ }
3390
+ let newTopBox;
3391
+ const curTopBox = this.topBox;
2914
3392
  this.boxes.forEach((box) => {
2915
- var _a2;
3393
+ var _a;
2916
3394
  const boxStatus = this.boxesStatus$.get(box.id);
2917
3395
  if (boxStatus) {
2918
- if (boxStatus !== exports.TELE_BOX_STATE.Minimized && box.zIndex > ((_a2 = topBox == null ? void 0 : topBox.zIndex) != null ? _a2 : 0)) {
2919
- topBox = box;
3396
+ if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3397
+ newTopBox = box;
2920
3398
  }
2921
3399
  box.setBoxStatus(boxStatus, skipUpdate);
2922
- if (boxStatus === exports.TELE_BOX_STATE.Minimized) {
2923
- hasMinimizedBox = true;
2924
- }
2925
3400
  }
2926
3401
  });
2927
- if (hasMinimizedBox) {
2928
- (_b = this.collector) == null ? void 0 : _b.setVisible(true);
2929
- if ((_c = this.collector) == null ? void 0 : _c.$collector) {
2930
- this.setCollectorRect(this._calcCollectorRect());
3402
+ this.effectBoxStatusChange();
3403
+ if (newTopBox && curTopBox !== newTopBox) {
3404
+ this.topBox$.setValue(newTopBox);
3405
+ this.focusBox(newTopBox, skipUpdate);
3406
+ }
3407
+ if (!newTopBox && curTopBox) {
3408
+ this.topBox$.setValue(void 0);
3409
+ this.blurBox(curTopBox, skipUpdate);
3410
+ }
3411
+ }
3412
+ async effectBoxesStatusChange(skipUpdate = false) {
3413
+ var _a, _b, _c, _d, _e, _f;
3414
+ if (!this.useBoxesStatus) {
3415
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
3416
+ clearTimeout(this.effectBoxesStatusTimer.timer);
3417
+ if (this.effectBoxesStatusTimer.resolve) {
3418
+ this.effectBoxesStatusTimer.resolve(!!((_a = this.effectBoxesStatusTimer) == null ? void 0 : _a.skipUpdate));
3419
+ }
2931
3420
  }
2932
- } else {
2933
- (_d = this.collector) == null ? void 0 : _d.setVisible(false);
2934
- }
2935
- if (topBox && topBoxId !== topBox.id) {
2936
- this.makeBoxTop(topBox, skipUpdate);
2937
- this.topBox$.setValue(topBox);
2938
- this.focusTopBox();
2939
- }
2940
- if (this.maxTitleBar) {
2941
- this.maxTitleBar.updateBoxesStatus();
3421
+ this.effectBoxesStatusTimer = void 0;
3422
+ return;
2942
3423
  }
2943
- console.log("effectBoxStatusTimerFunc===>end", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
2944
- }
2945
- effectBoxStatusChange(skipUpdate = false) {
2946
- var _a, _b;
2947
- if (this.effectBoxStatusTimer && this.effectBoxStatusTimer.timer) {
2948
- clearTimeout(this.effectBoxStatusTimer.timer);
2949
- if (this.effectBoxStatusTimer.skipUpdate !== skipUpdate) {
2950
- this.effectBoxStatusTimer.skipUpdate = skipUpdate;
2951
- console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
2952
- this.effectBoxStatusTimerFunc(this.effectBoxStatusTimer.skipUpdate);
3424
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
3425
+ if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
3426
+ clearTimeout(this.effectBoxesStatusTimer.timer);
3427
+ if (this.effectBoxesStatusTimer.resolve) {
3428
+ console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
3429
+ this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
3430
+ }
3431
+ this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
3432
+ console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
3433
+ } else {
3434
+ return;
2953
3435
  }
2954
3436
  }
2955
- if (!this.effectBoxStatusTimer) {
2956
- this.effectBoxStatusTimer = {
3437
+ if (!this.effectBoxesStatusTimer) {
3438
+ this.effectBoxesStatusTimer = {
2957
3439
  skipUpdate,
2958
- timer: void 0
3440
+ timer: void 0,
3441
+ resolve: void 0
2959
3442
  };
2960
3443
  }
2961
- 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 })));
2962
- this.effectBoxStatusTimer.timer = setTimeout(() => {
2963
- this.effectBoxStatusTimerFunc(skipUpdate);
2964
- }, 100);
3444
+ if (this.effectBoxesStatusTimer) {
3445
+ const _skipUpdate = await new Promise((resolve) => {
3446
+ this.effectBoxesStatusTimer.resolve = resolve;
3447
+ this.effectBoxesStatusTimer.timer = setTimeout(() => {
3448
+ var _a2, _b2;
3449
+ if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
3450
+ 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 })));
3451
+ this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
3452
+ }
3453
+ }, 100);
3454
+ });
3455
+ 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 })));
3456
+ this.effectBoxesStatusTimerFunc(_skipUpdate);
3457
+ this.effectBoxesStatusTimer = void 0;
3458
+ 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 })));
3459
+ }
2965
3460
  }
2966
3461
  hasBoxesStatus() {
3462
+ if (!this.useBoxesStatus) {
3463
+ return false;
3464
+ }
2967
3465
  return this.boxesStatus$.size > 0;
2968
3466
  }
2969
3467
  hasMinimizedBox() {
2970
- return this.boxes.some((box) => box.boxStatus && box.boxStatus === exports.TELE_BOX_STATE.Minimized);
3468
+ if (!this.useBoxesStatus) {
3469
+ return false;
3470
+ }
3471
+ return this.boxes.some((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
3472
+ }
3473
+ getMinimizedBoxesStatus() {
3474
+ const minimizedBoxes = /* @__PURE__ */ new Map();
3475
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3476
+ if (boxStatus === TELE_BOX_STATE.Minimized) {
3477
+ minimizedBoxes.set(boxId, boxStatus);
3478
+ }
3479
+ });
3480
+ return minimizedBoxes;
3481
+ }
3482
+ getNotMinimizedBoxesStatus() {
3483
+ const notMinimizedBoxes = /* @__PURE__ */ new Map();
3484
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3485
+ if (boxStatus !== TELE_BOX_STATE.Minimized) {
3486
+ notMinimizedBoxes.set(boxId, boxStatus);
3487
+ }
3488
+ });
3489
+ return notMinimizedBoxes;
3490
+ }
3491
+ getAllMaximizedBoxesStatus() {
3492
+ const maximizedBoxes = /* @__PURE__ */ new Map();
3493
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3494
+ if (boxStatus === TELE_BOX_STATE.Maximized) {
3495
+ maximizedBoxes.set(boxId, boxStatus);
3496
+ }
3497
+ });
3498
+ return maximizedBoxes;
3499
+ }
3500
+ getAllNormalBoxesStatus() {
3501
+ const normalBoxes = /* @__PURE__ */ new Map();
3502
+ this.boxesStatus$.forEach((boxStatus, boxId) => {
3503
+ if (boxStatus === TELE_BOX_STATE.Normal) {
3504
+ normalBoxes.set(boxId, boxStatus);
3505
+ }
3506
+ });
3507
+ return normalBoxes;
3508
+ }
3509
+ getLastNotMinimizedBoxStatus(boxId) {
3510
+ return this.lastNotMinimizedBoxesStatus$.get(boxId);
2971
3511
  }
2972
3512
  setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
2973
3513
  if (lastNotMinimizedBoxStatus) {
@@ -2976,26 +3516,104 @@ class TeleBoxManager {
2976
3516
  this.lastNotMinimizedBoxesStatus$.delete(boxId);
2977
3517
  }
2978
3518
  if (!skipUpdate) {
2979
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus: lastNotMinimizedBoxStatus });
3519
+ this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus: lastNotMinimizedBoxStatus });
2980
3520
  }
2981
3521
  }
2982
3522
  setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus, skipUpdate = false) {
2983
3523
  this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
2984
3524
  this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
2985
3525
  }
2986
- effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
3526
+ async effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
3527
+ var _a, _b;
3528
+ if (!this.useBoxesStatus) {
3529
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
3530
+ clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
3531
+ if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3532
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_a = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _a.skipUpdate));
3533
+ }
3534
+ }
3535
+ this.effectLastNotMinimizedBoxStatusTimer = void 0;
3536
+ return;
3537
+ }
3538
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
3539
+ clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
3540
+ if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
3541
+ if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3542
+ console.log("effectLastNotMinimizedBoxStatusFunc===>1111", skipUpdate);
3543
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
3544
+ }
3545
+ this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
3546
+ console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
3547
+ } else {
3548
+ return;
3549
+ }
3550
+ }
3551
+ if (!this.effectLastNotMinimizedBoxStatusTimer) {
3552
+ this.effectLastNotMinimizedBoxStatusTimer = {
3553
+ skipUpdate,
3554
+ timer: void 0,
3555
+ resolve: void 0
3556
+ };
3557
+ }
3558
+ if (this.effectLastNotMinimizedBoxStatusTimer) {
3559
+ const _skipUpdate = await new Promise((resolve) => {
3560
+ this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
3561
+ this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
3562
+ if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3563
+ console.log("effectLastNotMinimizedBoxStatusTimer===>000", skipUpdate);
3564
+ this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
3565
+ }
3566
+ }, 100);
3567
+ });
3568
+ 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 })));
3569
+ this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
3570
+ this.effectLastNotMinimizedBoxStatusTimer = void 0;
3571
+ 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 })));
3572
+ }
3573
+ }
3574
+ effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
3575
+ if (!this.useBoxesStatus) {
3576
+ return;
3577
+ }
3578
+ console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
2987
3579
  this.boxes.forEach((box) => {
2988
3580
  const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
2989
- box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
3581
+ if (boxStatus) {
3582
+ box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
3583
+ }
2990
3584
  });
2991
3585
  }
2992
- getAllMinimizedBoxes() {
2993
- return this.boxes.filter((box) => box.boxStatus && box.boxStatus === exports.TELE_BOX_STATE.Minimized);
3586
+ getUnabledBoxesStatusZIndex() {
3587
+ return this.topBox ? this.topBox.zIndex : 99;
3588
+ }
3589
+ getMaxMaximizedBoxZIndex() {
3590
+ if (!this.useBoxesStatus) {
3591
+ return this.getUnabledBoxesStatusZIndex();
3592
+ }
3593
+ return this.boxes.reduce((maxZIndex, box) => {
3594
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3595
+ return Math.max(maxZIndex, box.zIndex);
3596
+ }
3597
+ return maxZIndex;
3598
+ }, 99);
3599
+ }
3600
+ getMaxNormalBoxZIndex() {
3601
+ if (!this.useBoxesStatus) {
3602
+ return this.getUnabledBoxesStatusZIndex();
3603
+ }
3604
+ return this.boxes.reduce((maxZIndex, box) => {
3605
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3606
+ return Math.max(maxZIndex, box.zIndex);
3607
+ }
3608
+ return maxZIndex;
3609
+ }, 299);
2994
3610
  }
2995
3611
  create(config = {}, smartPosition = true) {
2996
- const box = new TeleBox(__spreadProps(__spreadValues({
2997
- zIndex: this.topBox ? this.topBox.zIndex + 1 : 100
2998
- }, smartPosition ? this.smartPosition(config) : config), {
3612
+ var _a;
3613
+ console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
3614
+ const box = new TeleBox({
3615
+ zIndex: this.getMaxNormalBoxZIndex() + 1,
3616
+ ...smartPosition ? this.smartPosition(config) : config,
2999
3617
  darkMode: this.darkMode,
3000
3618
  prefersColorScheme: this.prefersColorScheme,
3001
3619
  maximized: this.maximized,
@@ -3005,96 +3623,113 @@ class TeleBoxManager {
3005
3623
  containerRect: this.containerRect,
3006
3624
  readonly: this.readonly,
3007
3625
  collectorRect: this.collectorRect
3008
- }));
3626
+ });
3009
3627
  box.mount(this.root);
3628
+ this.boxes$.setValue([...this.boxes, box]);
3629
+ if (box.boxStatus && this.useBoxesStatus) {
3630
+ this.setBox(box, {
3631
+ status: box.boxStatus,
3632
+ lastNotMinimizedBoxStatus: box._lastNotMinimizedBoxStatus$.value
3633
+ }, true);
3634
+ }
3010
3635
  if (box.focus) {
3011
3636
  this.focusBox(box);
3012
3637
  if (smartPosition) {
3013
3638
  this.makeBoxTop(box);
3014
3639
  }
3015
3640
  }
3016
- this.boxes$.setValue([...this.boxes, box]);
3017
- if (box.boxStatus) {
3018
- this.setBoxStatus(box.id, box.boxStatus, true);
3019
- this.effectBoxStatusChange(true);
3020
- }
3021
- if (box._lastNotMinimizedBoxStatus$.value) {
3022
- this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
3023
- this.effectLastNotMinimizedBoxStatusChange();
3024
- }
3025
- box._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Maximize, () => {
3026
- if (box.boxStatus) {
3027
- if (box.boxStatus === exports.TELE_BOX_STATE.Maximized) {
3028
- this.setBoxStatus(box.id, exports.TELE_BOX_STATE.Normal);
3641
+ box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
3642
+ if (this.useBoxesStatus && box.boxStatus) {
3643
+ if (box.boxStatus === TELE_BOX_STATE.Maximized) {
3644
+ this.setBox(box.id, {
3645
+ status: TELE_BOX_STATE.Normal,
3646
+ zIndex: this.getMaxNormalBoxZIndex() + 1
3647
+ }, false);
3029
3648
  } else {
3030
- this.boxes.forEach((box2) => {
3031
- if (box2.boxStatus === exports.TELE_BOX_STATE.Normal) {
3032
- this.setBoxStatus(box2.id, exports.TELE_BOX_STATE.Maximized);
3649
+ [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3650
+ if (box2.boxStatus === TELE_BOX_STATE.Normal) {
3651
+ console.log("maximized===>", box2.id);
3652
+ this.setBox(box2.id, {
3653
+ status: TELE_BOX_STATE.Maximized,
3654
+ zIndex: this.getMaxMaximizedBoxZIndex() + 1
3655
+ }, false);
3033
3656
  }
3034
3657
  });
3658
+ this.makeMaximizedTopBoxFocus();
3035
3659
  }
3036
- this.effectBoxStatusChange();
3037
- this.makeMaximizedTopBoxFocus();
3038
3660
  } else {
3039
3661
  this.setMaximized(!this.maximized);
3040
3662
  }
3041
3663
  });
3042
- box._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3043
- if (box.boxStatus) {
3044
- const oldBoxStatus = box.boxStatus;
3045
- this.setBoxStatus(box.id, exports.TELE_BOX_STATE.Minimized);
3046
- this.effectBoxStatusChange();
3047
- if (oldBoxStatus === exports.TELE_BOX_STATE.Maximized) {
3048
- this.makeMaximizedTopBoxFocus();
3664
+ box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3665
+ var _a2;
3666
+ if (box.boxStatus && this.useBoxesStatus) {
3667
+ if (this.topBox === box) {
3668
+ if ((_a2 = this.topBox) == null ? void 0 : _a2.focus) {
3669
+ this.blurBox(this.topBox);
3670
+ }
3049
3671
  }
3672
+ this.setBox(box, {
3673
+ status: TELE_BOX_STATE.Minimized,
3674
+ zIndex: -1
3675
+ }, false, () => {
3676
+ this.focusTopBox();
3677
+ });
3050
3678
  } else {
3051
3679
  this.setMinimized(true);
3052
3680
  }
3053
3681
  });
3054
- box._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Close, () => {
3682
+ box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
3055
3683
  this.remove(box);
3056
3684
  this.focusTopBox();
3057
3685
  });
3058
3686
  box._coord$.reaction((_, __, skipUpdate) => {
3059
3687
  if (!skipUpdate) {
3060
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Move, box);
3688
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Move, box);
3061
3689
  }
3062
3690
  });
3063
3691
  box._size$.reaction((_, __, skipUpdate) => {
3064
3692
  if (!skipUpdate) {
3065
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Resize, box);
3693
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Resize, box);
3066
3694
  }
3067
3695
  });
3068
3696
  box._intrinsicCoord$.reaction((_, __, skipUpdate) => {
3069
3697
  if (!skipUpdate) {
3070
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicMove, box);
3698
+ this.events.emit(TELE_BOX_MANAGER_EVENT.IntrinsicMove, box);
3071
3699
  }
3072
3700
  });
3073
3701
  box._intrinsicSize$.reaction((_, __, skipUpdate) => {
3074
3702
  if (!skipUpdate) {
3075
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicResize, box);
3703
+ this.events.emit(TELE_BOX_MANAGER_EVENT.IntrinsicResize, box);
3076
3704
  }
3077
3705
  });
3078
3706
  box._visualSize$.reaction((_, __, skipUpdate) => {
3079
3707
  if (!skipUpdate) {
3080
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.VisualResize, box);
3708
+ this.events.emit(TELE_BOX_MANAGER_EVENT.VisualResize, box);
3081
3709
  }
3082
3710
  });
3083
3711
  box._zIndex$.reaction((_, __, skipUpdate) => {
3084
3712
  if (this.boxes.length > 0) {
3713
+ console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
3714
+ let currentTopBox = void 0;
3085
3715
  const topBox = this.boxes.reduce((topBox2, box2) => {
3086
- if (box2.boxStatus && box2.boxStatus === exports.TELE_BOX_STATE.Minimized) {
3716
+ if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
3717
+ return topBox2;
3718
+ }
3719
+ if (!topBox2) {
3720
+ topBox2 = box2;
3087
3721
  return topBox2;
3088
3722
  }
3089
3723
  return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
3090
- });
3724
+ }, currentTopBox);
3725
+ console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
3091
3726
  this.topBox$.setValue(topBox);
3092
3727
  }
3093
3728
  if (!skipUpdate) {
3094
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.ZIndex, box);
3729
+ this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
3095
3730
  }
3096
3731
  });
3097
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Created, box);
3732
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Created, box);
3098
3733
  return box;
3099
3734
  }
3100
3735
  query(config) {
@@ -3114,7 +3749,26 @@ class TeleBoxManager {
3114
3749
  this.updateBox(box, config, skipUpdate);
3115
3750
  });
3116
3751
  }
3117
- remove(boxOrID, skipUpdate = false) {
3752
+ setBox(boxOrID, options, skipUpdate = false, effectFunc) {
3753
+ const box = this.getBox(boxOrID);
3754
+ if (box) {
3755
+ const { status, zIndex, lastNotMinimizedBoxStatus } = options;
3756
+ if (status) {
3757
+ this.setBoxStatus(box.id, status, skipUpdate);
3758
+ box.setBoxStatus(status, skipUpdate);
3759
+ this.effectBoxStatusChange();
3760
+ }
3761
+ if (zIndex) {
3762
+ box.setZIndex(zIndex, skipUpdate);
3763
+ }
3764
+ if (lastNotMinimizedBoxStatus) {
3765
+ this.setLastNotMinimizedBoxStatus(box.id, lastNotMinimizedBoxStatus, skipUpdate);
3766
+ box.setLastNotMinimizedBoxStatus(lastNotMinimizedBoxStatus, skipUpdate);
3767
+ }
3768
+ effectFunc && effectFunc();
3769
+ }
3770
+ }
3771
+ remove(boxOrID, skipUpdate = false, effectFunc) {
3118
3772
  const box = this.getBox(boxOrID);
3119
3773
  const index2 = this.getBoxIndex(boxOrID);
3120
3774
  if (index2 >= 0) {
@@ -3122,20 +3776,18 @@ class TeleBoxManager {
3122
3776
  const deletedBoxes = boxes.splice(index2, 1);
3123
3777
  this.boxes$.setValue(boxes);
3124
3778
  deletedBoxes.forEach((box2) => box2.destroy());
3125
- if (box) {
3779
+ if (box && this.useBoxesStatus) {
3126
3780
  this.setBoxStatus(box.id, void 0, skipUpdate);
3127
- this.boxesStatus$.delete(box.id);
3128
- this.effectBoxStatusChange(skipUpdate);
3129
3781
  this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
3130
- this.lastNotMinimizedBoxesStatus$.delete(box.id);
3131
- this.effectLastNotMinimizedBoxStatusChange();
3782
+ this.effectBoxStatusChange();
3783
+ effectFunc && effectFunc();
3132
3784
  }
3133
3785
  if (!skipUpdate) {
3134
3786
  if (this.boxes.length <= 0) {
3135
3787
  this.setMaximized(false);
3136
3788
  this.setMinimized(false);
3137
3789
  }
3138
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
3790
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
3139
3791
  }
3140
3792
  return deletedBoxes[0];
3141
3793
  }
@@ -3158,7 +3810,7 @@ class TeleBoxManager {
3158
3810
  this.setMaximized(false);
3159
3811
  this.setMinimized(false);
3160
3812
  }
3161
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
3813
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
3162
3814
  }
3163
3815
  return deletedBoxes;
3164
3816
  }
@@ -3187,16 +3839,19 @@ class TeleBoxManager {
3187
3839
  targetBox.setFocus(true, skipUpdate);
3188
3840
  }
3189
3841
  if (focusChanged && !skipUpdate) {
3190
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused, targetBox);
3842
+ this.events.emit(
3843
+ TELE_BOX_MANAGER_EVENT.Focused,
3844
+ targetBox
3845
+ );
3191
3846
  }
3192
3847
  } else if (box.focus) {
3193
3848
  this.blurBox(box, skipUpdate);
3194
3849
  }
3195
3850
  });
3196
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3197
- this.makeMaximizedBoxFocus(targetBox);
3198
- } else {
3851
+ if (!this.useBoxesStatus) {
3199
3852
  this.maxTitleBar.focusBox(targetBox);
3853
+ } else if (this.useBoxesStatus && this.maxTitleBar.hasMaximizedBoxInStatus()) {
3854
+ this.makeMaximizedTopBoxFocus();
3200
3855
  }
3201
3856
  }
3202
3857
  }
@@ -3211,15 +3866,11 @@ class TeleBoxManager {
3211
3866
  if (targetBox.focus) {
3212
3867
  targetBox.setFocus(false, skipUpdate);
3213
3868
  if (!skipUpdate) {
3214
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Blurred, targetBox);
3869
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Blurred, targetBox);
3215
3870
  }
3216
3871
  }
3217
3872
  if (this.maxTitleBar.focusedBox === targetBox) {
3218
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3219
- this.makeMaximizedTopBoxFocus();
3220
- } else {
3221
- this.maxTitleBar.focusBox();
3222
- }
3873
+ this.maxTitleBar.focusBox();
3223
3874
  }
3224
3875
  }
3225
3876
  }
@@ -3228,16 +3879,12 @@ class TeleBoxManager {
3228
3879
  if (box.focus) {
3229
3880
  box.setFocus(false, skipUpdate);
3230
3881
  if (!skipUpdate) {
3231
- this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Blurred, box);
3882
+ this.events.emit(TELE_BOX_MANAGER_EVENT.Blurred, box);
3232
3883
  }
3233
3884
  }
3234
3885
  });
3235
3886
  if (this.maxTitleBar.focusedBox) {
3236
- if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3237
- this.makeMaximizedBoxBlur();
3238
- } else {
3239
- this.maxTitleBar.focusBox();
3240
- }
3887
+ this.maxTitleBar.focusBox();
3241
3888
  }
3242
3889
  }
3243
3890
  teleBoxMatcher(config) {
@@ -3246,10 +3893,18 @@ class TeleBoxManager {
3246
3893
  }
3247
3894
  updateBox(box, config, skipUpdate = false) {
3248
3895
  if (config.x != null || config.y != null) {
3249
- box.move(config.x == null ? box.intrinsicX : config.x, config.y == null ? box.intrinsicY : config.y, skipUpdate);
3896
+ box.move(
3897
+ config.x == null ? box.intrinsicX : config.x,
3898
+ config.y == null ? box.intrinsicY : config.y,
3899
+ skipUpdate
3900
+ );
3250
3901
  }
3251
3902
  if (config.width != null || config.height != null) {
3252
- box.resize(config.width == null ? box.intrinsicWidth : config.width, config.height == null ? box.intrinsicHeight : config.height, skipUpdate);
3903
+ box.resize(
3904
+ config.width == null ? box.intrinsicWidth : config.width,
3905
+ config.height == null ? box.intrinsicHeight : config.height,
3906
+ skipUpdate
3907
+ );
3253
3908
  }
3254
3909
  if (config.title != null) {
3255
3910
  box.setTitle(config.title);
@@ -3282,13 +3937,11 @@ class TeleBoxManager {
3282
3937
  if (config.footer != null) {
3283
3938
  box.mountFooter(config.footer);
3284
3939
  }
3285
- if (config.boxStatus) {
3286
- this.setBoxStatus(box.id, config.boxStatus, skipUpdate);
3287
- this.effectBoxStatusChange(skipUpdate);
3288
- }
3289
- if (config.lastNotMinimizedBoxStatus) {
3290
- this.setLastNotMinimizedBoxStatus(box.id, config.lastNotMinimizedBoxStatus, skipUpdate);
3291
- this.effectLastNotMinimizedBoxStatusChange();
3940
+ if (this.useBoxesStatus && (config.boxStatus || config.lastNotMinimizedBoxStatus)) {
3941
+ this.setBox(box, {
3942
+ status: config.boxStatus,
3943
+ lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
3944
+ }, skipUpdate);
3292
3945
  }
3293
3946
  }
3294
3947
  smartPosition(config = {}) {
@@ -3301,6 +3954,10 @@ class TeleBoxManager {
3301
3954
  if (vx > this.containerRect.width - width * this.containerRect.width) {
3302
3955
  vx = 20;
3303
3956
  }
3957
+ } else if (this.hasMinimizedBox()) {
3958
+ vx = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxX, box) => {
3959
+ return Math.max(maxX, box.intrinsicX * this.containerRect.width + 20);
3960
+ }, vx);
3304
3961
  }
3305
3962
  x = vx / this.containerRect.width;
3306
3963
  }
@@ -3311,37 +3968,27 @@ class TeleBoxManager {
3311
3968
  if (vy > this.containerRect.height - height * this.containerRect.height) {
3312
3969
  vy = 20;
3313
3970
  }
3971
+ } else if (this.hasMinimizedBox()) {
3972
+ vy = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxY, box) => {
3973
+ return Math.max(maxY, box.intrinsicY * this.containerRect.height + 20);
3974
+ }, vy);
3314
3975
  }
3315
3976
  y = vy / this.containerRect.height;
3316
3977
  }
3317
- return __spreadProps(__spreadValues({}, config), { x, y, width, height });
3978
+ return { ...config, x, y, width, height };
3318
3979
  }
3319
3980
  makeBoxTop(box, skipUpdate = false) {
3320
- if (this.topBox) {
3981
+ if (!this.useBoxesStatus && this.topBox) {
3321
3982
  if (box !== this.topBox) {
3322
- if (!this.hasBoxesStatus()) {
3323
- box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3324
- return;
3325
- }
3326
- const maxZIndex = this.boxes.reduce((maxZIndex2, box2) => {
3327
- return Math.max(maxZIndex2, box2.zIndex);
3328
- }, 0);
3329
- const currentTopBoxZIndex = Math.min(this.topBox.zIndex, box.zIndex);
3330
- const addZIndex = maxZIndex + 1 - currentTopBoxZIndex;
3331
- box.setZIndex(maxZIndex + 1, skipUpdate);
3332
- console.log("makeBoxTop===>", box.id, maxZIndex + 1, addZIndex, this.topBox.id, currentTopBoxZIndex);
3333
- if (box.boxStatus !== exports.TELE_BOX_STATE.Minimized) {
3334
- this.boxes.forEach((b) => {
3335
- if (b.boxStatus === exports.TELE_BOX_STATE.Minimized && b.zIndex >= currentTopBoxZIndex) {
3336
- console.log("makeBoxTop===>111", b.id, b.zIndex + addZIndex);
3337
- b.setZIndex(b.zIndex + addZIndex, skipUpdate);
3338
- }
3339
- });
3340
- }
3983
+ box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3341
3984
  }
3342
- }
3985
+ } else if (this.useBoxesStatus)
3986
+ ;
3343
3987
  }
3344
- makeMaximizedTopBoxFocus() {
3988
+ getMaximizedTopBox() {
3989
+ if (!this.useBoxesStatus) {
3990
+ return void 0;
3991
+ }
3345
3992
  let maximizedBox;
3346
3993
  if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
3347
3994
  maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, currentBox) => {
@@ -3350,36 +3997,17 @@ class TeleBoxManager {
3350
3997
  }
3351
3998
  return topBox.zIndex > currentBox.zIndex ? topBox : currentBox;
3352
3999
  });
3353
- if (maximizedBox) {
3354
- this.maxTitleBar.focusBox(maximizedBox);
3355
- }
3356
4000
  }
4001
+ return maximizedBox;
3357
4002
  }
3358
- makeMaximizedBoxFocus(maximizedBox, skipUpdate = false) {
3359
- if (this.maxTitleBar.hasMaximizedBoxInStatus() && this.maxTitleBar.MaximizedBoxes.find((box) => box.id === maximizedBox.id)) {
3360
- const currentZIndex = maximizedBox.zIndex;
3361
- const currentMaximizedTopBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, box) => {
3362
- if (!topBox) {
3363
- return box;
3364
- }
3365
- return topBox.zIndex > box.zIndex ? topBox : box;
3366
- });
3367
- if (currentMaximizedTopBox !== maximizedBox) {
3368
- const addZIndex = currentMaximizedTopBox.zIndex - currentZIndex + 1;
3369
- this.boxes.forEach((box) => {
3370
- if (this.maxTitleBar.MaximizedBoxes.find((b) => b.id === box.id && b.id !== maximizedBox.id)) {
3371
- return;
3372
- }
3373
- if (box.zIndex >= currentZIndex) {
3374
- box.setZIndex(box.zIndex + addZIndex, skipUpdate);
3375
- }
3376
- });
3377
- }
3378
- this.maxTitleBar.focusBox(maximizedBox);
4003
+ makeMaximizedTopBoxFocus() {
4004
+ if (!this.useBoxesStatus) {
4005
+ return;
3379
4006
  }
3380
- }
3381
- makeMaximizedBoxBlur() {
3382
- this.maxTitleBar.focusBox();
4007
+ const maximizedBox = this.getMaximizedTopBox();
4008
+ console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
4009
+ this.maxTitleBar.focusBox(maximizedBox);
4010
+ console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
3383
4011
  }
3384
4012
  getBoxIndex(boxOrID) {
3385
4013
  return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
@@ -3387,8 +4015,28 @@ class TeleBoxManager {
3387
4015
  getBox(boxOrID) {
3388
4016
  return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
3389
4017
  }
4018
+ createMinimizedAppMenu() {
4019
+ var _a, _b;
4020
+ if ((_a = this.collector) == null ? void 0 : _a.$appMenuContainer) {
4021
+ return new AppMenu({
4022
+ manager: this,
4023
+ container: (_b = this.collector) == null ? void 0 : _b.$appMenuContainer,
4024
+ theme: this.prefersColorScheme ? "dark" : "light",
4025
+ getBoxesStatus: () => {
4026
+ return this.boxesStatus$;
4027
+ }
4028
+ });
4029
+ }
4030
+ return;
4031
+ }
3390
4032
  }
3391
4033
  exports.DefaultTitleBar = DefaultTitleBar;
4034
+ exports.TELE_BOX_COLOR_SCHEME = TELE_BOX_COLOR_SCHEME;
4035
+ exports.TELE_BOX_DELEGATE_EVENT = TELE_BOX_DELEGATE_EVENT;
4036
+ exports.TELE_BOX_EVENT = TELE_BOX_EVENT;
4037
+ exports.TELE_BOX_MANAGER_EVENT = TELE_BOX_MANAGER_EVENT;
4038
+ exports.TELE_BOX_RESIZE_HANDLE = TELE_BOX_RESIZE_HANDLE;
4039
+ exports.TELE_BOX_STATE = TELE_BOX_STATE;
3392
4040
  exports.TeleBox = TeleBox;
3393
4041
  exports.TeleBoxCollector = TeleBoxCollector;
3394
4042
  exports.TeleBoxDragHandleType = TeleBoxDragHandleType;