@netless/telebox-insider 0.2.6 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TeleBox/constants.d.ts +7 -0
- package/dist/TeleBox/index.d.ts +5 -2
- package/dist/TeleBox/typings.d.ts +8 -1
- package/dist/TeleBoxCollector/index.d.ts +5 -1
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +3 -0
- package/dist/TeleBoxManager/constants.d.ts +3 -1
- package/dist/TeleBoxManager/index.d.ts +5 -1
- package/dist/TeleBoxManager/typings.d.ts +4 -1
- package/dist/style.css +1 -1
- package/dist/telebox-insider.cjs.js +2 -2
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +2 -2
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBox/constants.ts +8 -0
- package/src/TeleBox/index.ts +79 -0
- package/src/TeleBox/style.scss +10 -0
- package/src/TeleBox/typings.ts +9 -0
- package/src/TeleBoxCollector/index.ts +34 -8
- package/src/TeleBoxCollector/style.scss +11 -5
- package/src/TeleBoxManager/MaxTitleBar/index.ts +25 -0
- package/src/TeleBoxManager/MaxTitleBar/style.scss +18 -0
- package/src/TeleBoxManager/constants.ts +2 -0
- package/src/TeleBoxManager/index.ts +73 -9
- package/src/TeleBoxManager/typings.ts +4 -0
- package/src/TeleBoxReact/index.tsx +18 -0
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +14 -0
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
export declare enum TELE_BOX_COLOR_SCHEME {
|
|
2
|
+
Light = "light",
|
|
3
|
+
Dark = "dark",
|
|
4
|
+
Auto = "auto"
|
|
5
|
+
}
|
|
1
6
|
export declare enum TELE_BOX_STATE {
|
|
2
7
|
Normal = "normal",
|
|
3
8
|
Minimized = "minimized",
|
|
4
9
|
Maximized = "maximized"
|
|
5
10
|
}
|
|
6
11
|
export declare enum TELE_BOX_EVENT {
|
|
12
|
+
DarkMode = "dark_mode",
|
|
13
|
+
PrefersColorScheme = "prefers_color_scheme",
|
|
7
14
|
Close = "close",
|
|
8
15
|
Focus = "focus",
|
|
9
16
|
Blur = "blur",
|
package/dist/TeleBox/index.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import "./style.scss";
|
|
|
2
2
|
import { SideEffectManager } from "side-effect-manager";
|
|
3
3
|
import { Val, ValEnhancedResult, ValSideEffectBinder } from "value-enhancer";
|
|
4
4
|
import { TeleTitleBar } from "../TeleTitleBar";
|
|
5
|
-
import type { TeleBoxConfig, TeleBoxRect, TeleBoxEvents, TeleBoxState, TeleBoxDelegateEvents, TeleBoxCoord, TeleBoxSize } from "./typings";
|
|
5
|
+
import type { TeleBoxConfig, TeleBoxRect, TeleBoxEvents, TeleBoxState, TeleBoxDelegateEvents, TeleBoxCoord, TeleBoxSize, TeleBoxColorScheme } from "./typings";
|
|
6
6
|
export * from "./constants";
|
|
7
7
|
export * from "./typings";
|
|
8
8
|
declare type ValConfig = {
|
|
9
|
+
prefersColorScheme: Val<TeleBoxColorScheme, boolean>;
|
|
10
|
+
darkMode: Val<boolean, boolean>;
|
|
9
11
|
containerRect: Val<TeleBoxRect, boolean>;
|
|
10
12
|
collectorRect: Val<TeleBoxRect | undefined, boolean>;
|
|
11
13
|
/** Box title. Default empty. */
|
|
@@ -35,7 +37,7 @@ declare type ValConfig = {
|
|
|
35
37
|
export interface TeleBox extends ValEnhancedResult<ValConfig> {
|
|
36
38
|
}
|
|
37
39
|
export declare class TeleBox {
|
|
38
|
-
constructor({ id, title, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, }?: TeleBoxConfig);
|
|
40
|
+
constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, }?: TeleBoxConfig);
|
|
39
41
|
readonly id: string;
|
|
40
42
|
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
41
43
|
readonly namespace: string;
|
|
@@ -50,6 +52,7 @@ export declare class TeleBox {
|
|
|
50
52
|
_visualSize$: Val<TeleBoxSize, boolean>;
|
|
51
53
|
_coord$: Val<TeleBoxCoord, boolean>;
|
|
52
54
|
_intrinsicCoord$: Val<TeleBoxCoord, boolean>;
|
|
55
|
+
get darkMode(): boolean;
|
|
53
56
|
_state$: Val<TeleBoxState, boolean>;
|
|
54
57
|
get state(): TeleBoxState;
|
|
55
58
|
/** @deprecated use setMaximized and setMinimized instead */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type EventEmitter from "eventemitter3";
|
|
2
2
|
import type { TeleTitleBar } from "../TeleTitleBar";
|
|
3
|
-
import type { TeleBoxDragHandleType, TELE_BOX_EVENT, TELE_BOX_DELEGATE_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE } from "./constants";
|
|
3
|
+
import type { TeleBoxDragHandleType, TELE_BOX_EVENT, TELE_BOX_DELEGATE_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TELE_BOX_COLOR_SCHEME } from "./constants";
|
|
4
|
+
export declare type TeleBoxColorScheme = `${TELE_BOX_COLOR_SCHEME}`;
|
|
4
5
|
export declare type TeleBoxCoord = {
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
@@ -21,6 +22,10 @@ export interface TeleBoxConfig {
|
|
|
21
22
|
readonly id?: string;
|
|
22
23
|
/** Box title. Default empty. */
|
|
23
24
|
readonly title?: string;
|
|
25
|
+
/** Prefers Box color scheme. Default light. */
|
|
26
|
+
readonly prefersColorScheme?: TeleBoxColorScheme;
|
|
27
|
+
/** Actual Box Dark Mode */
|
|
28
|
+
readonly darkMode?: boolean;
|
|
24
29
|
/** Box visible. Default true. */
|
|
25
30
|
readonly visible?: boolean;
|
|
26
31
|
/** Box width relative to root element. 0~1. Default 0.5. */
|
|
@@ -72,6 +77,8 @@ export interface TeleBoxConfig {
|
|
|
72
77
|
}
|
|
73
78
|
declare type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
74
79
|
export declare type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
80
|
+
dark_mode: boolean;
|
|
81
|
+
prefers_color_scheme: TeleBoxColorScheme;
|
|
75
82
|
close: void;
|
|
76
83
|
focus: void;
|
|
77
84
|
blur: void;
|
|
@@ -3,16 +3,18 @@ import { TeleStyles } from "../typings";
|
|
|
3
3
|
export interface TeleBoxCollectorConfig {
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
readonly?: boolean;
|
|
6
|
+
darkMode?: boolean;
|
|
6
7
|
namespace?: string;
|
|
7
8
|
styles?: TeleStyles;
|
|
8
9
|
onClick?: () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare class TeleBoxCollector {
|
|
11
|
-
constructor({ visible, readonly, namespace, styles, onClick, }?: TeleBoxCollectorConfig);
|
|
12
|
+
constructor({ visible, readonly, darkMode, namespace, styles, onClick, }?: TeleBoxCollectorConfig);
|
|
12
13
|
readonly styles: TeleStyles;
|
|
13
14
|
readonly namespace: string;
|
|
14
15
|
get visible(): boolean;
|
|
15
16
|
get readonly(): boolean;
|
|
17
|
+
get darkMode(): boolean;
|
|
16
18
|
onClick: (() => void) | undefined;
|
|
17
19
|
$collector: HTMLElement | undefined;
|
|
18
20
|
/**
|
|
@@ -25,11 +27,13 @@ export declare class TeleBoxCollector {
|
|
|
25
27
|
unmount(): this;
|
|
26
28
|
setVisible(visible: boolean): this;
|
|
27
29
|
setReadonly(readonly: boolean): this;
|
|
30
|
+
setDarkMode(darkMode: boolean): this;
|
|
28
31
|
setStyles(styles: TeleStyles): this;
|
|
29
32
|
render(): HTMLElement;
|
|
30
33
|
destroy(): void;
|
|
31
34
|
wrapClassName(className: string): string;
|
|
32
35
|
protected _visible: boolean;
|
|
33
36
|
protected _readonly: boolean;
|
|
37
|
+
protected _darkMode: boolean;
|
|
34
38
|
protected handleCollectorClick: () => void;
|
|
35
39
|
}
|
|
@@ -4,6 +4,7 @@ import { DefaultTitleBar, DefaultTitleBarConfig } from "../../TeleTitleBar";
|
|
|
4
4
|
import { TeleBoxRect, TeleBoxState } from "../../TeleBox/typings";
|
|
5
5
|
export declare type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly">;
|
|
6
6
|
export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
7
|
+
darkMode: boolean;
|
|
7
8
|
boxes: MaxTitleBarTeleBox[];
|
|
8
9
|
containerRect: TeleBoxRect;
|
|
9
10
|
focusedBox?: MaxTitleBarTeleBox;
|
|
@@ -15,10 +16,12 @@ export declare class MaxTitleBar extends DefaultTitleBar {
|
|
|
15
16
|
setBoxes(boxes: MaxTitleBarTeleBox[]): void;
|
|
16
17
|
setState(state: TeleBoxState): void;
|
|
17
18
|
setReadonly(readonly: boolean): void;
|
|
19
|
+
setDarkMode(darkMode: boolean): void;
|
|
18
20
|
render(): HTMLElement;
|
|
19
21
|
destroy(): void;
|
|
20
22
|
updateTitles(): void;
|
|
21
23
|
protected renderTitles(): HTMLElement;
|
|
24
|
+
protected darkMode: boolean;
|
|
22
25
|
protected $titles: HTMLElement | undefined;
|
|
23
26
|
protected boxes: MaxTitleBarTeleBox[];
|
|
24
27
|
protected focusedBox: MaxTitleBarTeleBox | undefined;
|
|
@@ -9,5 +9,7 @@ export declare enum TELE_BOX_MANAGER_EVENT {
|
|
|
9
9
|
Resize = "resize",
|
|
10
10
|
IntrinsicMove = "intrinsic_move",
|
|
11
11
|
IntrinsicResize = "intrinsic_resize",
|
|
12
|
-
VisualResize = "visual_resize"
|
|
12
|
+
VisualResize = "visual_resize",
|
|
13
|
+
PrefersColorScheme = "prefers_color_scheme",
|
|
14
|
+
DarkMode = "dark_mode"
|
|
13
15
|
}
|
|
@@ -3,11 +3,13 @@ import { TeleBoxCollector } from "../TeleBoxCollector";
|
|
|
3
3
|
import { ReadonlyTeleBox, TeleBox } from "../TeleBox";
|
|
4
4
|
import type { TeleBoxManagerConfig, TeleBoxManagerCreateConfig, TeleBoxManagerEvents, TeleBoxManagerQueryConfig, TeleBoxManagerUpdateConfig } from "./typings";
|
|
5
5
|
import { MaxTitleBar } from "./MaxTitleBar";
|
|
6
|
+
import { TeleBoxColorScheme } from "..";
|
|
6
7
|
import { SideEffectManager } from "side-effect-manager";
|
|
7
8
|
import { Val, ValEnhancedResult } from "value-enhancer";
|
|
8
9
|
export * from "./typings";
|
|
9
10
|
export * from "./constants";
|
|
10
11
|
declare type ValConfig = {
|
|
12
|
+
prefersColorScheme: Val<TeleBoxColorScheme, boolean>;
|
|
11
13
|
containerRect: Val<TeleBoxRect, boolean>;
|
|
12
14
|
collector: Val<TeleBoxCollector | null>;
|
|
13
15
|
readonly: Val<boolean, boolean>;
|
|
@@ -18,12 +20,14 @@ declare type ValConfig = {
|
|
|
18
20
|
export interface TeleBoxManager extends ValEnhancedResult<ValConfig> {
|
|
19
21
|
}
|
|
20
22
|
export declare class TeleBoxManager {
|
|
21
|
-
constructor({ root, minimized, maximized, fence, containerRect, collector, namespace, zIndex, readonly, }?: TeleBoxManagerConfig);
|
|
23
|
+
constructor({ root, prefersColorScheme, minimized, maximized, fence, containerRect, collector, namespace, zIndex, readonly, }?: TeleBoxManagerConfig);
|
|
22
24
|
readonly events: TeleBoxManagerEvents;
|
|
23
25
|
protected _sideEffect: SideEffectManager;
|
|
24
26
|
protected root: HTMLElement;
|
|
25
27
|
readonly namespace: string;
|
|
26
28
|
zIndex: number;
|
|
29
|
+
_darkMode$: Val<boolean, boolean>;
|
|
30
|
+
get darkMode(): boolean;
|
|
27
31
|
_state$: Val<TeleBoxState, boolean>;
|
|
28
32
|
get state(): TeleBoxState;
|
|
29
33
|
/** @deprecated use setMaximized and setMinimized instead */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type EventEmitter from "eventemitter3";
|
|
2
|
+
import { TeleBoxColorScheme } from "..";
|
|
2
3
|
import type { ReadonlyTeleBox, TeleBoxState } from "../TeleBox";
|
|
3
4
|
import type { TeleBoxConfig } from "../TeleBox/typings";
|
|
4
5
|
import type { TeleBoxCollector } from "../TeleBoxCollector";
|
|
5
6
|
import type { TELE_BOX_MANAGER_EVENT } from "./constants";
|
|
6
|
-
export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "fence" | "containerRect" | "maximized" | "minimized" | "namespace" | "zIndex" | "readonly"> {
|
|
7
|
+
export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme" | "fence" | "containerRect" | "maximized" | "minimized" | "namespace" | "zIndex" | "readonly"> {
|
|
7
8
|
/** Element to mount boxes. */
|
|
8
9
|
root?: HTMLElement;
|
|
9
10
|
/** Where the minimized boxes go. */
|
|
@@ -27,6 +28,8 @@ export declare type TeleBoxManagerEventConfig = CheckTeleBoxManagerConfig<{
|
|
|
27
28
|
intrinsic_move: [ReadonlyTeleBox];
|
|
28
29
|
intrinsic_resize: [ReadonlyTeleBox];
|
|
29
30
|
visual_resize: [ReadonlyTeleBox];
|
|
31
|
+
prefers_color_scheme: [TeleBoxColorScheme];
|
|
32
|
+
dark_mode: [boolean];
|
|
30
33
|
}>;
|
|
31
34
|
export declare type TeleBoxManagerEvent = keyof TeleBoxManagerEventConfig;
|
|
32
35
|
export interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:rgba(68,78,96,.1);background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:rgba(68,78,96,.1)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:rgba(68,78,96,.2)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:rgba(68,78,96,.2)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;will-change:transform;transition:width .4s cubic-bezier(.4, .9, .71, 1.02),height .4s cubic-bezier(.55, .82, .63, .95),opacity .6s cubic-bezier(.7, 0, .84, 0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px 0 rgba(47,65,146,.15);border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap::before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{will-change:transform;transition:width 50ms cubic-bezier(.4, .9, .71, 1.02),height 50ms cubic-bezier(.55, .82, .63, .95),opacity .6s cubic-bezier(.7, 0, .84, 0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7, 0, .84, 0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7}.telebox-title{overflow:hidden;margin:0 24px 0 0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=")}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==")}.telebox-titlebar-icon-maximize.is-active{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K")}.telebox-titlebar-icon-close{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=")}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px 0 rgba(47,65,146,.15);cursor:pointer;user-select:none;pointer-events:none}.telebox-collector-icon{width:18px;height:16px}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{flex:1;height:100%;margin:0 16px 0 -16px;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:rgba(238,238,247,.8);background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:rgba(238,238,247,.8)}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer}.telebox-titles-tab~.telebox-titles-tab{margin-left:2px}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}
|
|
1
|
+
.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:rgba(68,78,96,.1);background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:rgba(68,78,96,.1)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:rgba(68,78,96,.2)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:rgba(68,78,96,.2)}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;will-change:transform;transition:width .4s cubic-bezier(.4, .9, .71, 1.02),height .4s cubic-bezier(.55, .82, .63, .95),opacity .6s cubic-bezier(.7, 0, .84, 0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px 0 rgba(47,65,146,.15);border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap::before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{will-change:transform;transition:width 50ms cubic-bezier(.4, .9, .71, 1.02),height 50ms cubic-bezier(.55, .82, .63, .95),opacity .6s cubic-bezier(.7, 0, .84, 0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7, 0, .84, 0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7}.telebox-title{overflow:hidden;margin:0 24px 0 0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=")}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==")}.telebox-titlebar-icon-maximize.is-active{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K")}.telebox-titlebar-icon-close{background:center/cover no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=")}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}.telebox-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px 0 rgba(47,65,146,.15);cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{flex:1;height:100%;margin:0 16px 0 -16px;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:rgba(238,238,247,.8);background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:rgba(238,238,247,.8)}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer}.telebox-titles-tab~.telebox-titles-tab{margin-left:2px}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=Object.defineProperties,
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i;Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module";var a=require("react");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=l(a),c={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,s="~";function i(){}function r(e,t,s){this.fn=e,this.context=t,this.once=s||!1}function n(e,t,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,n||e,o),l=s?s+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),a.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=s?s+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,o=new Array(n);r<n;r++)o[r]=i[r].fn;return o},a.prototype.listenerCount=function(e){var t=s?s+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,n,o){var a=s?s+e:e;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,n),!0;case 6:return c.fn.call(c.context,t,i,r,n,o),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var u,f=c.length;for(h=0;h<f;h++)switch(c[h].once&&this.removeListener(e,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,t);break;case 3:c[h].fn.call(c[h].context,t,i);break;case 4:c[h].fn.call(c[h].context,t,i,r);break;default:if(!l)for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(e,t,s){return n(this,e,t,s,!1)},a.prototype.once=function(e,t,s){return n(this,e,t,s,!0)},a.prototype.removeListener=function(e,t,i,r){var n=s?s+e:e;if(!this._events[n])return this;if(!t)return o(this,n),this;var a=this._events[n];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||o(this,n);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||i&&a[l].context!==i)&&h.push(a[l]);h.length?this._events[n]=1===h.length?h[0]:h:o(this,n)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=s,a.EventEmitter=a,e.exports=a}(c);var d=c.exports,u=function(){return(u=Object.assign||function(e){for(var t,s=1,i=arguments.length;s<i;s++)for(var r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function f(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}var E=0,m="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),i=Math.max(0,16.7-(t-E));E=t+i,setTimeout((function(){return e(E)}),i)},p=1/60*1e3,v=!0,x=!1,_=!1,b={delta:0,timestamp:0},g=["read","update","preRender","render","postRender"],T=function(e){return x=e},y=g.reduce((function(e,t){var i,s,r,n,o,a,l,h,c;return e[t]=(i=T,s=[],r=[],n=0,o=!1,a=0,l=new WeakSet,h=new WeakSet,c={cancel:function(e){var t=r.indexOf(e);l.add(e),-1!==t&&r.splice(t,1)},process:function(e){var t,d;if(o=!0,s=(t=[r,s])[0],(r=t[1]).length=0,n=s.length)for(a=0;a<n;a++)(d=s[a])(e),!0!==h.has(d)||l.has(d)||(c.schedule(d),i(!0));o=!1},schedule:function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var a=i&&o,c=a?s:r;l.delete(e),t&&h.add(e),-1===c.indexOf(e)&&(c.push(e),a&&(n=s.length))}}),e}),{}),w=g.reduce((function(e,t){var i=y[t];return e[t]=function(e,t,s){return void 0===t&&(t=!1),void 0===s&&(s=!1),x||N(),i.schedule(e,t,s),e},e}),{}),B=function(e){return y[e].process(b)},L=function(e){x=!1,b.delta=v?p:Math.max(Math.min(e-b.timestamp,40),1),v||(p=b.delta),b.timestamp=e,_=!0,g.forEach(B),_=!1,x&&(v=!1,m(L))},N=function(){x=!0,v=!0,_||m(L)},C=function(){return(C=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},$=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},O=function(e){return e%1?Number(e.toFixed(5)):e},z=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,R={test:function(e){return"number"==typeof e},parse:parseFloat,transform:function(e){return e}},S=C(C({},R),{transform:$(0,1)}),A=C(C({},R),{default:1}),M=function(e){return{test:function(t){return"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+e}}},X=M("deg"),V=M("%"),k=M("px"),I=C(C({},V),{parse:function(e){return V.parse(e)/100},transform:function(e){return V.transform(100*e)}}),D=$(0,255),H=function(e){return void 0!==e.red},W=function(e){return void 0!==e.hue};var j=function(e){return function(t){if("string"!=typeof t)return t;for(var i={},s=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))}(t).replace(/(,|\/)/g," ").split(/ \s*/),r=0;r<4;r++)i[e[r]]=void 0!==s[r]?parseFloat(s[r]):1;return i}},G=C(C({},R),{transform:function(e){return Math.round(D(e))}});function Z(e,t){return e.startsWith(t)&&z.test(e)}var F,P={test:function(e){return"string"==typeof e?Z(e,"rgb"):H(e)},parse:j(["red","green","blue","alpha"]),transform:function(e){var t=e.red,i=e.green,s=e.blue,r=e.alpha,n=void 0===r?1:r;return function(e){var t=e.red,i=e.green,s=e.blue,r=e.alpha;return"rgba("+t+", "+i+", "+s+", "+(void 0===r?1:r)+")"}({red:G.transform(t),green:G.transform(i),blue:G.transform(s),alpha:O(S.transform(n))})}},Y={test:function(e){return"string"==typeof e?Z(e,"hsl"):W(e)},parse:j(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,i=e.saturation,s=e.lightness,r=e.alpha,n=void 0===r?1:r;return function(e){var t=e.hue,i=e.saturation,s=e.lightness,r=e.alpha;return"hsla("+t+", "+i+", "+s+", "+(void 0===r?1:r)+")"}({hue:Math.round(t),saturation:V.transform(O(i)),lightness:V.transform(O(s)),alpha:O(S.transform(n))})}},q=C(C({},P),{test:function(e){return"string"==typeof e&&Z(e,"#")},parse:function(e){var t="",i="",s="";return e.length>4?(t=e.substr(1,2),i=e.substr(3,2),s=e.substr(5,2)):(t=e.substr(1,1),i=e.substr(2,1),s=e.substr(3,1),t+=t,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:1}}}),U={test:function(e){return"string"==typeof e&&z.test(e)||H(e)||W(e)},parse:function(e){return P.test(e)?P.parse(e):Y.test(e)?Y.parse(e):q.test(e)?q.parse(e):e},transform:function(e){return H(e)?P.transform(e):W(e)?Y.transform(e):e}},J=function(e){var t=e.onRead,i=e.onRender,s=e.uncachedValues,r=void 0===s?new Set:s,n=e.useCache,o=void 0===n||n;return function(e){void 0===e&&(e={});var s=f(e,[]),n={},a=[],l=!1;function h(e,t){e.startsWith("--")&&(s.hasCSSVariable=!0);var i=n[e];n[e]=t,n[e]!==i&&(-1===a.indexOf(e)&&a.push(e),l||(l=!0,w.render(c.render)))}var c={get:function(e,i){return void 0===i&&(i=!1),!i&&o&&!r.has(e)&&void 0!==n[e]?n[e]:t(e,s)},set:function(e,t){if("string"==typeof e)h(e,t);else for(var i in e)h(i,e[i]);return this},render:function(e){return void 0===e&&(e=!1),(l||!0===e)&&(i(n,s,a),l=!1,a.length=0),this}};return c}},Q=/([a-z])([A-Z])/g,K=function(e){return e.replace(Q,"$1-$2").toLowerCase()},ee=new Map,te=new Map,ie=["Webkit","Moz","O","ms",""],se=ie.length,re="undefined"!=typeof document,ne=function(e,t){return te.set(e,K(t))},oe=function(e,t){void 0===t&&(t=!1);var i=t?te:ee;return i.has(e)||(re?function(e){F=F||document.createElement("div");for(var t=0;t<se;t++){var i=ie[t],s=""===i,r=s?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(r in F.style||s){if(s&&"clipPath"===e&&te.has(e))return;ee.set(e,r),ne(e,(s?"":"-")+K(r))}}}(e):function(e){ne(e,e)}(e)),i.get(e)||e},ae=["","X","Y","Z"],le=["translate","scale","rotate","skew","transformPerspective"].reduce((function(e,t){return ae.reduce((function(e,i){return e.push(t+i),e}),e)}),["x","y","z"]),he=le.reduce((function(e,t){return e[t]=!0,e}),{});function ce(e){return!0===he[e]}function de(e,t){return le.indexOf(e)-le.indexOf(t)}var ue=new Set(["originX","originY","originZ"]);function fe(e){return ue.has(e)}var Ee=u(u({},R),{transform:Math.round}),me={color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,borderWidth:k,borderTopWidth:k,borderRightWidth:k,borderBottomWidth:k,borderLeftWidth:k,borderRadius:k,radius:k,borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomRightRadius:k,borderBottomLeftRadius:k,width:k,maxWidth:k,height:k,maxHeight:k,size:k,top:k,right:k,bottom:k,left:k,padding:k,paddingTop:k,paddingRight:k,paddingBottom:k,paddingLeft:k,margin:k,marginTop:k,marginRight:k,marginBottom:k,marginLeft:k,rotate:X,rotateX:X,rotateY:X,rotateZ:X,scale:A,scaleX:A,scaleY:A,scaleZ:A,skew:X,skewX:X,skewY:X,distance:k,translateX:k,translateY:k,translateZ:k,x:k,y:k,z:k,perspective:k,opacity:S,originX:I,originY:I,originZ:k,zIndex:Ee,fillOpacity:S,strokeOpacity:S,numOctaves:Ee},pe=function(e){return me[e]},ve=function(e,t){return t&&"number"==typeof e?t.transform(e):e},xe=new Set(["scrollLeft","scrollTop"]),_e=new Set(["scrollLeft","scrollTop","transform"]),be={x:"translateX",y:"translateY",z:"translateZ"};function ge(e){return"function"==typeof e}function Te(e,t,i,s,r,n,o,a){void 0===t&&(t=!0),void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={}),void 0===n&&(n=[]),void 0===o&&(o=!1),void 0===a&&(a=!0);var l=!0,h=!1,c=!1;for(var d in e){var u=e[d],f=pe(d),E=ve(u,f);ce(d)?(h=!0,s[d]=E,n.push(d),l&&(f.default&&u!==f.default||!f.default&&0!==u)&&(l=!1)):fe(d)?(r[d]=E,c=!0):_e.has(d)&&ge(E)||(i[oe(d,o)]=E)}return(h||"function"==typeof e.transform)&&(i.transform=function(e,t,i,s,r,n){void 0===n&&(n=!0);var o="",a=!1;i.sort(de);for(var l=i.length,h=0;h<l;h++){var c=i[h];o+=(be[c]||c)+"("+t[c]+") ",a="z"===c||a}return!a&&r?o+="translateZ(0)":o=o.trim(),ge(e.transform)?o=e.transform(t,s?"":o):n&&s&&(o="none"),o}(e,s,n,l,t,a)),c&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function ye(e){var t=void 0===e?{}:e,i=t.enableHardwareAcceleration,s=void 0===i||i,r=t.isDashCase,n=void 0===r||r,o=t.allowTransformNone,a=void 0===o||o,l={},h={},c={},d=[];return function(e){return d.length=0,Te(e,s,l,h,c,d,n,a),l}}var we=J({onRead:function(e,t){var i=t.element,s=t.preparseOutput,r=pe(e);if(ce(e))return r&&r.default||0;if(xe.has(e))return i[e];var n=window.getComputedStyle(i,null).getPropertyValue(oe(e,!0))||0;return s&&r&&r.test(n)&&r.parse?r.parse(n):n},onRender:function(e,t,i){var s=t.element,r=t.buildStyles,n=t.hasCSSVariable;if(Object.assign(s.style,r(e)),n)for(var o=i.length,a=0;a<o;a++){var l=i[a];l.startsWith("--")&&s.style.setProperty(l,e[l])}-1!==i.indexOf("scrollLeft")&&(s.scrollLeft=e.scrollLeft),-1!==i.indexOf("scrollTop")&&(s.scrollTop=e.scrollTop)},uncachedValues:xe});var Be=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Le=function(e,t){return k.transform(e*t)},Ne={x:0,y:0,width:0,height:0};function Ce(e,t,i){return"string"==typeof e?e:k.transform(t+i*e)}var $e={enableHardwareAcceleration:!1,isDashCase:!1};function Oe(e,t,i,s,r,n){void 0===t&&(t=Ne),void 0===s&&(s=ye($e)),void 0===r&&(r={style:{}}),void 0===n&&(n=!0);var o=e.attrX,a=e.attrY,l=e.originX,h=e.originY,c=e.pathLength,d=e.pathSpacing,u=void 0===d?1:d,E=e.pathOffset,m=void 0===E?0:E,p=s(f(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var v in p){if("transform"===v)r.style.transform=p[v];else r[n&&!Be.has(v)?K(v):v]=p[v]}return(void 0!==l||void 0!==h||p.transform)&&(r.style.transformOrigin=function(e,t,i){return Ce(t,e.x,e.width)+" "+Ce(i,e.y,e.height)}(t,void 0!==l?l:.5,void 0!==h?h:.5)),void 0!==o&&(r.x=o),void 0!==a&&(r.y=a),void 0!==i&&void 0!==c&&(r[n?"stroke-dashoffset":"strokeDashoffset"]=Le(-m,i),r[n?"stroke-dasharray":"strokeDasharray"]=Le(c,i)+" "+Le(u,i)),r}function ze(e,t,i){void 0===i&&(i=!0);var s={style:{}},r=ye($e);return function(n){return Oe(n,e,t,r,s,i)}}var Re=J({onRead:function(e,t){var i=t.element;if(ce(e=Be.has(e)?e:K(e))){var s=pe(e);return s&&s.default||0}return i.getAttribute(e)},onRender:function(e,t){var i=t.element,s=(0,t.buildAttrs)(e);for(var r in s)"style"===r?Object.assign(i.style,s.style):i.setAttribute(r,s[r])}}),Se=J({useCache:!1,onRead:function(e){return"scrollTop"===e?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,i=void 0===t?0:t,s=e.scrollLeft,r=void 0===s?0:s;return window.scrollTo(r,i)}}),Ae=new WeakMap,Me=function(e,t){var i,s,r,n;return e===window?i=Se(e):!function(e){return e instanceof HTMLElement||"function"==typeof e.click}(e)?function(e){return e instanceof SVGElement||"ownerSVGElement"in e}(e)&&(r=function(e){try{return function(e){return"function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}(e)}catch(t){return{x:0,y:0,width:0,height:0}}}(s=e),n=function(e){return"path"===e.tagName}(s)&&s.getTotalLength?s.getTotalLength():void 0,i=Re({element:s,buildAttrs:ze(r,n)})):i=function(e,t){void 0===t&&(t={});var i=t.enableHardwareAcceleration,s=t.allowTransformNone,r=f(t,["enableHardwareAcceleration","allowTransformNone"]);return we(u({element:e,buildStyles:ye({enableHardwareAcceleration:i,allowTransformNone:s}),preparseOutput:!0},r))}(e,t),Ae.set(e,i),i};function Xe(e,t){return function(e,t){return Ae.has(e)?Ae.get(e):Me(e,t)}("string"==typeof e?document.querySelector(e):e,t)}var Ve=function(e,t,i,s){var r=i?i.call(s,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;l<n.length;l++){var h=n[l];if(!a(h))return!1;var c=e[h],d=t[h];if(!1===(r=i?i.call(s,c,d,h):void 0)||void 0===r&&c!==d)return!1}return!0};const ke="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Ie=ke.length,De=Array(20),He=()=>{for(let e=0;e<20;e++)De[e]=ke.charAt(Math.random()*Ie);return De.join("")};class We{constructor(){this.disposers=new Map}add(e,t=He()){return this.flush(t),this.disposers.set(t,e()),t}addDisposer(e,t=He()){return this.flush(t),this.disposers.set(t,e),t}addEventListener(e,t,i,s,r=He()){return this.add((()=>(e.addEventListener(t,i,s),()=>e.removeEventListener(t,i,s))),r),r}setTimeout(e,t,i=He()){return this.add((()=>{const s=window.setTimeout((()=>{this.remove(i),e()}),t);return()=>window.clearTimeout(s)}),i)}setInterval(e,t,i=He()){return this.add((()=>{const i=window.setInterval(e,t);return()=>window.clearInterval(i)}),i)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);if(t)try{t()}catch(i){console.error(i)}}flushAll(){this.disposers.forEach((e=>{try{e()}catch(t){console.error(t)}})),this.disposers.clear()}}var je=Object.defineProperty,Ge=("undefined"!=typeof require&&require,(e,t,i)=>{return n=i,(r="symbol"!=typeof t?t+"":t)in(s=e)?je(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,i;var s,r,n});class Ze{constructor(e,t){Ge(this,"_value"),Ge(this,"_beforeDestroys"),Ge(this,"_subscribers"),this._value=e,t&&(this.compare=t)}get value(){return this._value}setValue(e,t){if(!this.compare(e,this._value)){const i=this._value;this._value=e,this._subscribers&&this._subscribers.forEach((s=>s(e,i,t)))}}reaction(e){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),()=>{this._subscribers&&this._subscribers.delete(e)}}subscribe(e,t){const i=this.reaction(e);return e(this._value,void 0,t),i}derive(e,t,i){const s=new Ze(e(this.value,void 0,i),t),r=this.reaction(((t,i,r)=>{s.setValue(e(t,i,r))}));return s.addBeforeDestroy(r),s}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach((e=>e())),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(e){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(e),()=>{this._beforeDestroys&&this._beforeDestroys.delete(e)}}compare(e,t){return e===t}}function Fe(e,t){Object.keys(t).forEach((i=>{!function(e,t,i){var s;Object.defineProperties(e,{[t]:{get:()=>i.value},[`_${t}$`]:{value:i},[`set${s=t,s[0].toUpperCase()+s.slice(1)}`]:{value:(e,t)=>i.setValue(e,t)}})}(e,i,t[i])}))}function Pe(e){const t=t=>{const i=e.addDisposer((()=>{t.destroy()}));return t.addBeforeDestroy((()=>{e.remove(i)})),t};return{bindSideEffect:t,combine:(e,i,s,r)=>t(function(e,t,i,s){let r=e.map((e=>e.value));const n=new Ze(t(r,void 0,s),i);return e.forEach(((e,i)=>{const s=e.reaction(((e,s,o)=>{const a=r.slice();a[i]=e;const l=r;r=a,n.setValue(t(a,l,o),o)}));n.addBeforeDestroy(s)})),n}(e,i,s,r)),createVal:(e,i)=>t(new Ze(e,i))}}var Ye,qe,Ue,Je;exports.TELE_BOX_STATE=void 0,(Ye=exports.TELE_BOX_STATE||(exports.TELE_BOX_STATE={})).Normal="normal",Ye.Minimized="minimized",Ye.Maximized="maximized",exports.TELE_BOX_EVENT=void 0,(qe=exports.TELE_BOX_EVENT||(exports.TELE_BOX_EVENT={})).Close="close",qe.Focus="focus",qe.Blur="blur",qe.Move="move",qe.Resize="resize",qe.IntrinsicMove="intrinsic_move",qe.IntrinsicResize="intrinsic_resize",qe.VisualResize="visual_resize",qe.State="state",qe.Minimized="minimized",qe.Maximized="maximized",qe.Readonly="readonly",qe.Destroyed="destroyed",exports.TELE_BOX_DELEGATE_EVENT=void 0,(Ue=exports.TELE_BOX_DELEGATE_EVENT||(exports.TELE_BOX_DELEGATE_EVENT={})).Close="close",Ue.Maximize="maximize",Ue.Minimize="minimize",exports.TELE_BOX_RESIZE_HANDLE=void 0,(Je=exports.TELE_BOX_RESIZE_HANDLE||(exports.TELE_BOX_RESIZE_HANDLE={})).North="n",Je.South="s",Je.West="w",Je.East="e",Je.NorthWest="nw",Je.NorthEast="ne",Je.SouthEast="se",Je.SouthWest="sw";function Qe(e,t,i){return Math.min(Math.max(e,t),i)}function Ke(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function et(e){return e.touches?e.touches[0]:e}function tt(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let it=1;function st(){return"New Box "+it++}function rt(e){return Boolean(e)}function nt(e){return!e}class ot{constructor({readonly:e=!1,title:t,buttons:i,onEvent:s,onDragStart:r,namespace:n="telebox",state:o=exports.TELE_BOX_STATE.Normal}={}){this.$btns=[],this.sideEffect=new We,this.lastTitleBarClick=0,this.handleTitleBarClick=e=>{var t;if(this.readonly)return;if(null!=e.button&&0!==e.button)return;if(null==(t=e.target.dataset)?void 0:t.teleTitleBarNoDblClick)return;Ke(e);const i=Date.now();i-this.lastTitleBarClick<=500?this.onEvent&&this.onEvent({type:exports.TELE_BOX_DELEGATE_EVENT.Maximize}):this.onDragStart&&this.onDragStart(e),this.lastTitleBarClick=i},this.readonly=e,this.onEvent=s,this.onDragStart=r,this.namespace=n,this.title=t,this.state=o,this.buttons=i||[{type:exports.TELE_BOX_DELEGATE_EVENT.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:exports.TELE_BOX_DELEGATE_EVENT.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:e=>e===exports.TELE_BOX_STATE.Maximized},{type:exports.TELE_BOX_DELEGATE_EVENT.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]}setTitle(e){this.title=e,this.$title&&(this.$title.textContent=e,this.$title.title=e)}setState(e){this.state!==e&&(this.state=e,this.buttons.forEach(((t,i)=>{t.isActive&&this.$btns[i].classList.toggle("is-active",t.isActive(e))})))}setReadonly(e){this.readonly!==e&&(this.readonly=e)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar"),this.$titleBar.dataset.teleBoxHandle="dh",this.sideEffect.addEventListener(this.$titleBar,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(this.$titleBar,"touchstart",this.handleTitleBarClick,{passive:!0}),this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle="dh",this.title&&(this.$title.textContent=this.title,this.$title.title=this.title);const e=document.createElement("div");e.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach((({iconClassName:t,isActive:i},s)=>{const r=String(s),n=document.createElement("button");n.className=`${this.wrapClassName("titlebar-btn")} ${t}`,n.dataset.teleTitleBarBtnIndex=r,n.dataset.teleTitleBarNoDblClick="true",i&&n.classList.toggle("is-active",i(this.state)),this.$btns.push(n),e.appendChild(n)})),this.sideEffect.addEventListener(e,"click",(e=>{var t;if(this.readonly)return;const i=e.target,s=Number(null==(t=i.dataset)?void 0:t.teleTitleBarBtnIndex);if(!Number.isNaN(s)&&s<this.buttons.length){Ke(e);const t=this.buttons[s];this.onEvent&&this.onEvent({type:t.type,value:t.value})}})),this.$titleBar.appendChild(this.$title),this.$titleBar.appendChild(e)}return this.$titleBar}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class at{constructor({id:e=tt(),title:t=st(),visible:i=!0,width:s=.5,height:r=.5,minWidth:n=0,minHeight:o=0,x:a=.1,y:l=.1,minimized:h=!1,maximized:c=!1,readonly:u=!1,resizable:f=!0,draggable:E=!0,fence:m=!0,fixRatio:p=!1,focus:v=!1,zIndex:x=100,namespace:_="telebox",titleBar:b,content:g,footer:T,styles:y,containerRect:w={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:B}={}){this._renderSideEffect=new We,this.handleTrackStart=e=>{var t;return null==(t=this._handleTrackStart)?void 0:t.call(this,e)},this._sideEffect=new We,this._valSideEffectBinder=Pe(this._sideEffect);const{combine:L,createVal:N}=this._valSideEffectBinder;this.id=e,this.namespace=_,this.events=new d,this._delegateEvents=new d;const C=N(w,Ve),$=N(B,Ve),O=N(t),z=N(i);z.reaction(((e,t,i)=>{i||e||this.events.emit(exports.TELE_BOX_EVENT.Close)}));const R=N(u);R.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.Readonly,e)}));const S=N(f),A=N(E),M=N(m),X=N(p),V=N(x),k=N(v);k.reaction(((e,t,i)=>{i||this.events.emit(e?exports.TELE_BOX_EVENT.Focus:exports.TELE_BOX_EVENT.Blur)}));const I=N(h);I.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.Minimized,e)}));const D=N(c);D.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.Maximized,e)}));const H=L([I,D],(([e,t])=>e?exports.TELE_BOX_STATE.Minimized:t?exports.TELE_BOX_STATE.Maximized:exports.TELE_BOX_STATE.Normal));H.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.State,e)}));const W=N({width:Qe(n,0,1),height:Qe(o,0,1)},Ve),j=N({width:Qe(s,W.value.width,1),height:Qe(r,W.value.height,1)},Ve);W.reaction(((e,t,i)=>{j.setValue({width:Qe(s,e.width,1),height:Qe(r,e.height,1)},i)})),j.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.IntrinsicResize,e)}));const G=L([j,D],(([e,t])=>t?{width:1,height:1}:e),Ve);G.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.Resize,e)}));const Z=L([G,I,C,$],(([e,t,i,s])=>t&&s?{width:s.width/e.width/i.width,height:s.height/e.height/i.height}:e),Ve);Z.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.VisualResize,e)}));const F=N({x:Qe(a,0,1),y:Qe(l,0,1)},Ve);F.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.IntrinsicMove,e)}));const P=L([F,j,C,$,I,D],(([e,t,i,s,r,n])=>r&&s?n?{x:(s.x+s.width/2)/i.width-.5,y:(s.y+s.height/2)/i.height-.5}:{x:(s.x+s.width/2)/i.width-t.width/2,y:(s.y+s.height/2)/i.height-t.height/2}:n?{x:0,y:0}:e),Ve);P.reaction(((e,t,i)=>{i||this.events.emit(exports.TELE_BOX_EVENT.Move,e)})),this.titleBar=b||new ot({readonly:R.value,title:O.value,namespace:this.namespace,onDragStart:e=>{var t;return null==(t=this._handleTrackStart)?void 0:t.call(this,e)},onEvent:e=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(e.type);else switch(e.type){case exports.TELE_BOX_DELEGATE_EVENT.Maximize:D.setValue(!D.value);break;case exports.TELE_BOX_DELEGATE_EVENT.Minimize:I.setValue(!0);break;case exports.TELE_BOX_DELEGATE_EVENT.Close:z.setValue(!1);break;default:console.error("Unsupported titleBar event:",e)}}}),R.reaction((e=>{this.titleBar.setReadonly(e)}));const Y=N(g),q=N(T),U=N(y);Fe(this,{containerRect:C,collectorRect:$,title:O,visible:z,readonly:R,resizable:S,draggable:A,fence:M,fixRatio:X,focus:k,zIndex:V,minimized:I,maximized:D,$userContent:Y,$userFooter:q,$userStyles:U}),this._state$=H,this._minSize$=W,this._size$=G,this._intrinsicSize$=j,this._visualSize$=Z,this._coord$=P,this._intrinsicCoord$=F,this.fixRatio&&this.transform(P.value.x,P.value.y,G.value.width,G.value.height,!0),this.$box=this.render()}get state(){return this._state$.value}setState(e,t=!1){switch(e){case exports.TELE_BOX_STATE.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case exports.TELE_BOX_STATE.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,t=!1){return this._minSize$.setValue({width:e,height:this.minHeight},t),this}setMinHeight(e,t=!1){return this._minSize$.setValue({width:this.minWidth,height:e},t),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(e,t,i=!1){return this._intrinsicSize$.setValue({width:e,height:t},i),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(e,t,i=!1){return this._intrinsicCoord$.setValue({x:e,y:t},i),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(e,t,i,s,r=!1){if(this.fixRatio){const e=this.intrinsicHeight/this.intrinsicWidth*i;t!==this.intrinsicY&&(t-=e-s),s=e}return t<0&&(t=0,s>this.intrinsicHeight&&(s=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:i>=this.minWidth?e:this.intrinsicX,y:s>=this.minHeight?t:this.intrinsicY},r),this._intrinsicSize$.setValue({width:Qe(i,this.minWidth,1),height:Qe(s,this.minHeight,1)},r),this}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(e){return this.set$userContent(e),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(e){return this.set$userFooter(e),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(e){let t;return"string"==typeof e?(t=document.createElement("style"),t.textContent=e):t=e,this.set$userStyles(t),this}unmountStyles(){return this.set$userStyles(void 0),this}render(e){if(e){if(e===this.$box)return this.$box;this.$box=e}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));const t=(e,t,i,s=rt)=>this._renderSideEffect.add((()=>{const r=this.wrapClassName(i);return t.subscribe((t=>{e.classList.toggle(r,s(t))}))}));t(this.$box,this._readonly$,"readonly"),t(this.$box,this._draggable$,"no-drag",nt),t(this.$box,this._resizable$,"no-resize",nt),t(this.$box,this._focus$,"blur",nt),this._renderSideEffect.add((()=>{const e=this.wrapClassName("minimized"),t=this.wrapClassName("maximized"),i="box-maximized-timer";return this._state$.subscribe((s=>{this.$box.classList.toggle(e,s===exports.TELE_BOX_STATE.Minimized),s===exports.TELE_BOX_STATE.Maximized?(this._renderSideEffect.flush(i),this.$box.classList.toggle(t,!0)):this._renderSideEffect.setTimeout((()=>{this.$box.classList.toggle(t,!1)}),0,i)}))})),this._renderSideEffect.add((()=>this._visible$.subscribe((e=>{this.$box.style.display=e?"block":"none"})))),this._renderSideEffect.add((()=>this._zIndex$.subscribe((e=>{this.$box.style.zIndex=String(e)}))));const i=Xe(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";const s=this.x*this.containerRect.width+this.containerRect.x,r=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${s-10}px,${r-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$],(([e,t,i,s,r])=>{const n=t.width*s.width,o=t.height*s.height;return{width:n,height:o,x:e.x*s.width,y:e.y*s.height,scaleX:i&&r?r.width/n:1,scaleY:i&&r?r.height/o:1}}),Ve).subscribe((e=>{i.set(e)})),i.set({x:s,y:r});const n=document.createElement("div");n.className=this.wrapClassName("box-main"),this.$box.appendChild(n);const o=document.createElement("div");o.className=this.wrapClassName("titlebar-wrap"),o.appendChild(this.titleBar.render()),this.$titleBar=o;const a=document.createElement("div");a.className=this.wrapClassName("content-wrap");const l=document.createElement("div");l.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=l,this._renderSideEffect.add((()=>{let e;return this._$userStyles$.subscribe((t=>{e&&e.remove(),e=t,t&&l.appendChild(t)}))})),this._renderSideEffect.add((()=>{let e;return this._$userContent$.subscribe((t=>{e&&e.remove(),e=t,t&&l.appendChild(t)}))})),a.appendChild(l);const h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add((()=>{let e;return this._$userFooter$.subscribe((t=>{e&&e.remove(),e=t,t&&h.appendChild(t)}))})),n.appendChild(o),n.appendChild(a),n.appendChild(h),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(exports.TELE_BOX_RESIZE_HANDLE).forEach((t=>{const i=document.createElement("div");i.className=this.wrapClassName(t)+" "+this.wrapClassName("resize-handle"),i.dataset.teleBoxHandle=t,e.appendChild(i)})),this.$box.appendChild(e);const t="handle-tracking-listener",i=this.wrapClassName("transforming");let s,r,n=0,o=0,a=0,l=0,h=0,c=0;const d=e=>{if(this.state!==exports.TELE_BOX_STATE.Normal)return;Ke(e);let{pageX:t,pageY:i}=et(e);i<0&&(i=0);const s=(t-h)/this.containerRect.width,d=(i-c)/this.containerRect.height;switch(r){case exports.TELE_BOX_RESIZE_HANDLE.North:this.transform(this.x,o+d,this.width,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.South:this.transform(this.x,this.y,this.width,l+d);break;case exports.TELE_BOX_RESIZE_HANDLE.West:this.transform(n+s,this.y,a-s,this.height);break;case exports.TELE_BOX_RESIZE_HANDLE.East:this.transform(this.x,this.y,a+s,this.height);break;case exports.TELE_BOX_RESIZE_HANDLE.NorthWest:this.transform(n+s,o+d,a-s,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.NorthEast:this.transform(this.x,o+d,a+s,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.SouthEast:this.transform(this.x,this.y,a+s,l+d);break;case exports.TELE_BOX_RESIZE_HANDLE.SouthWest:this.transform(n+s,this.y,a-s,l+d);break;default:if(this.fence)this.move(Qe(n+s,0,1-this.width),Qe(o+d,0,1-this.height));else{const e=20/this.containerRect.width,t=20/this.containerRect.height;this.move(Qe(n+s,e-this.width,1-e),Qe(o+d,0,1-t))}}},u=e=>{r=void 0,s&&(Ke(e),this.$box.classList.toggle(i,!1),this._sideEffect.flush(t),s.remove())},f=e=>{var f;if(this.readonly)return;if(null!=e.button&&0!==e.button)return;if(!this.draggable||r||this.state!==exports.TELE_BOX_STATE.Normal)return;const E=e.target;if(null==(f=E.dataset)?void 0:f.teleBoxHandle){Ke(e),n=this.x,o=this.y,a=this.width,l=this.height,({pageX:h,pageY:c}=et(e)),r=E.dataset.teleBoxHandle,s||(s=document.createElement("div"));const f=r?this.wrapClassName(`cursor-${r}`):"";s.className=this.wrapClassName("track-mask"+(f?` ${f}`:"")),this.$box.appendChild(s),this.$box.classList.add(i),this._sideEffect.add((()=>(window.addEventListener("mousemove",d),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("mouseup",u),window.addEventListener("touchend",u,{passive:!1}),window.addEventListener("touchcancel",u,{passive:!1}),()=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d),window.removeEventListener("mouseup",u),window.removeEventListener("touchend",u),window.removeEventListener("touchcancel",u)})),t)}};this._handleTrackStart=f,this._sideEffect.addEventListener(e,"mousedown",f,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(e,"touchstart",f,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(exports.TELE_BOX_EVENT.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}const lt=(e,t)=>{const i=a.useRef(!0);a.useEffect((()=>{if(!i.current)return e();i.current=!1}),t)};var ht;class ct{constructor({visible:e=!0,readonly:t=!1,namespace:i="telebox",styles:s={},onClick:r}={}){this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=Boolean(e),this._readonly=Boolean(t),this.namespace=i,this.styles=s,this.onClick=r}get visible(){return this._visible}get readonly(){return this._readonly}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}setVisible(e){return this._visible!==e&&(this._visible=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),e)),this}setReadonly(e){return this._readonly!==e&&(this._readonly=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),e)),this}setStyles(e){if(Object.assign(this.styles,e),this.$collector){const t=this.$collector;Object.keys(e).forEach((i=>{const s=e[i];null!=s&&(t.style[i]=s)}))}return this}render(){if(!this.$collector){this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.addEventListener("click",this.handleCollectorClick),this._visible&&this.$collector.classList.add(this.wrapClassName("collector-visible")),this._readonly&&this.$collector.classList.add(this.wrapClassName("collector-readonly"));const e=document.createElement("img");e.draggable=!1,e.className=this.wrapClassName("collector-icon"),e.src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K",this.$collector.appendChild(e),this.setStyles(this.styles)}return this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(e){return`${this.namespace}-${e}`}}exports.TELE_BOX_MANAGER_EVENT=void 0,(ht=exports.TELE_BOX_MANAGER_EVENT||(exports.TELE_BOX_MANAGER_EVENT={})).Focused="focused",ht.Created="created",ht.Removed="removed",ht.State="state",ht.Maximized="maximized",ht.Minimized="minimized",ht.Move="move",ht.Resize="resize",ht.IntrinsicMove="intrinsic_move",ht.IntrinsicResize="intrinsic_resize",ht.VisualResize="visual_resize";class dt extends ot{constructor(e){super(e),this.boxes=e.boxes,this.focusedBox=e.focusedBox,this.containerRect=e.containerRect}focusBox(e){var t;if(e||(e=this.boxes[this.boxes.length-1]),!this.focusedBox||this.focusedBox!==e){if(this.$titles&&this.state===exports.TELE_BOX_STATE.Maximized){const{children:i}=this.$titles.firstElementChild;for(let s=i.length-1;s>=0;s-=1){const r=i[s],n=null==(t=r.dataset)?void 0:t.teleBoxID;n&&(e&&n===e.id?r.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&n===this.focusedBox.id&&r.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}setContainerRect(e){if(this.containerRect=e,this.$titleBar){const{x:t,y:i,width:s}=e;this.$titleBar.style.transform=`translate(${t}px, ${i}px)`,this.$titleBar.style.width=s+"px"}}setBoxes(e){this.boxes=e,this.updateTitles()}setState(e){super.setState(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),e===exports.TELE_BOX_STATE.Maximized),this.updateTitles()}setReadonly(e){super.setReadonly(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}render(){const e=super.render(),{x:t,y:i,width:s}=this.containerRect;return e.style.transform=`translate(${t}px, ${i}px)`,e.style.width=s+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===exports.TELE_BOX_STATE.Maximized),e.classList.toggle(this.wrapClassName("readonly"),this.readonly),this.updateTitles(),e}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&this.state===exports.TELE_BOX_STATE.Maximized&&(1===this.boxes.length?this.$title&&(this.$title.textContent=this.boxes[0].title,this.$titleBar.replaceChild(this.$title,this.$titleBar.firstElementChild)):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",(e=>{e.currentTarget.scrollBy({left:e.deltaY>0?250:-250,behavior:"smooth"})}),{passive:!1});const e=document.createElement("div");return e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e),this.boxes.forEach((t=>{const i=document.createElement("button");i.className=this.wrapClassName("titles-tab"),i.textContent=t.title,i.dataset.teleBoxID=t.id,i.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&t.id===this.focusedBox.id&&i.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(i)})),this.$titles}}exports.DefaultTitleBar=ot,exports.TeleBox=at,exports.TeleBoxCollector=ct,exports.TeleBoxDragHandleType="dh",exports.TeleBoxManager=class{constructor({root:e=document.body,minimized:t=!1,maximized:i=!1,fence:s=!0,containerRect:r={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:n,namespace:o="telebox",zIndex:a=100,readonly:l=!1}={}){this.events=new d,this.boxes=[],this._sideEffect=new We;const{combine:h,createVal:c}=Pe(this._sideEffect);this.root=e,this.namespace=o,this.zIndex=a;const u=c(l);u.reaction(((e,t,i)=>{this.boxes.forEach((t=>t.setReadonly(e,i)))}));const f=c(t),E=c(i);E.reaction(((e,t,i)=>{this.boxes.forEach((t=>t.setMaximized(e,i))),i||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Maximized,e)}));const m=h([f,E],(([e,t])=>e?exports.TELE_BOX_STATE.Minimized:t?exports.TELE_BOX_STATE.Maximized:exports.TELE_BOX_STATE.Normal));m.reaction(((e,t,i)=>{this.maxTitleBar.setState(e),i||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.State,e)}));const p=c(s);p.subscribe(((e,t,i)=>{this.boxes.forEach((t=>t.setFence(e,i)))}));const v=c(r,Ve);v.reaction(((e,t,i)=>{this.boxes.forEach((t=>t.setContainerRect(e,i))),this.maxTitleBar.setContainerRect(e)}));const x=c(null===n?null:n||new ct({visible:t,readonly:l,namespace:o}).mount(e));x.subscribe((e=>{e&&(e.setVisible(f.value),e.setReadonly(u.value),this._sideEffect.add((()=>(e.onClick=()=>{u.value||f.setValue(!1)},()=>e.destroy())),"collect-onClick"))})),u.subscribe((e=>{var t;return null==(t=x.value)?void 0:t.setReadonly(e)})),f.subscribe(((e,t,i)=>{var s,r;if(null==(s=x.value)||s.setVisible(e),e&&(null==(r=x.value)?void 0:r.$collector)){const{x:e,y:t,width:i,height:s}=x.value.$collector.getBoundingClientRect(),r=this.root.getBoundingClientRect();this.boxes.forEach((n=>{n.setCollectorRect({x:e-r.x,y:t-r.y,width:i,height:s},!0)}))}this.boxes.forEach((t=>t.setMinimized(e,i))),i||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Minimized,e)}));const _=e=>{var t;if(u.value)return;const i=e.target;if(i.tagName)for(let s=i;s;s=s.parentElement){const e=null==(t=s.dataset)?void 0:t.teleBoxID;if(e){const t=this.boxes.find((t=>t.id===e));if(t)return void this.focusBox({focus:!0,box:t})}}};this._sideEffect.addEventListener(window,"mousedown",_,!0),this._sideEffect.addEventListener(window,"touchstart",_,!0),this.maxTitleBar=new dt({readonly:u.value,namespace:this.namespace,state:m.value,boxes:this.boxes,focusedBox:this._focusedBox,containerRect:v.value,onEvent:e=>{var t;switch(e.type){case exports.TELE_BOX_DELEGATE_EVENT.Maximize:E.setValue(!E.value);break;case exports.TELE_BOX_DELEGATE_EVENT.Minimize:f.setValue(!0);break;case exports.TELE_BOX_EVENT.Close:{const e=null!=(t=this._focusedBox)?t:this.boxes[this.boxes.length-1];e&&this.remove(e.id);break}}}}),u.subscribe((e=>this.maxTitleBar.setReadonly(e)));Fe(this,{containerRect:v,collector:x,readonly:u,fence:p,minimized:f,maximized:E}),this._state$=m,this.root.appendChild(this.maxTitleBar.render())}get state(){return this._state$.value}setState(e,t=!1){switch(e){case exports.TELE_BOX_STATE.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case exports.TELE_BOX_STATE.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}create(e){const t=new at(this.wrapCreateConfig(e));return t.mount(this.root),this.boxes.push(t),t.focus&&this.focusBox({focus:!0,box:t,increaseZIndex:!1}),this.maxTitleBar.setBoxes(this.boxes),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Maximize,(()=>{this.setMaximized(!this.maximized)})),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Minimize,(()=>{this.setMinimized(!0)})),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Close,(()=>{this.focusBox({focus:!1,box:t}),this.remove(t.id)})),t.events.on(exports.TELE_BOX_EVENT.Move,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Move,t)})),t.events.on(exports.TELE_BOX_EVENT.Resize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Resize,t)})),t.events.on(exports.TELE_BOX_EVENT.IntrinsicMove,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicMove,t)})),t.events.on(exports.TELE_BOX_EVENT.IntrinsicResize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicResize,t)})),t.events.on(exports.TELE_BOX_EVENT.VisualResize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.VisualResize,t)})),this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Created,t),t}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,t,i=!1){const s=this.boxes.find((t=>t.id===e));if(s)return this.updateBox(s,t,i)}updateAll(e,t=!1){this.boxes.forEach((i=>{this.updateBox(i,e,t)}))}remove(e,t=!1){const i=this.boxes.findIndex((t=>t.id===e));if(i>=0){const e=this.boxes.splice(i,1);this.maxTitleBar.setBoxes(this.boxes);const s=e[0];return this.focusBox({focus:!1,box:s}),s.destroy(),this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),t||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed,e),s}}removeAll(e=!1){if(this._focusedBox){const t=this._focusedBox;this._focusedBox=void 0,e||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,void 0,t)}const t=this.boxes.splice(0,this.boxes.length);return this.maxTitleBar.setBoxes(this.boxes),t.forEach((e=>e.destroy())),this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),e||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed,t),t}destroy(e=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this._focusedBox=void 0,this.removeAll(e),Object.keys(this).forEach((e=>{const t=this[e];t instanceof Ze&&t.destroy()}))}wrapClassName(e){return`${this.namespace}-${e}`}teleBoxMatcher(e){const t=Object.keys(e);return i=>t.every((t=>e[t]===i[t]))}updateBox(e,t,i=!1){null==t.x&&null==t.y||e.move(null==t.x?e.intrinsicX:t.x,null==t.y?e.intrinsicY:t.y,i),null==t.width&&null==t.height||e.resize(null==t.width?e.intrinsicWidth:t.width,null==t.height?e.intrinsicHeight:t.height,i),null!=t.title&&(e.setTitle(t.title),this.maxTitleBar.updateTitles()),null!=t.visible&&e.setVisible(t.visible,i),null!=t.minHeight&&e.setMinHeight(t.minHeight,i),null!=t.minWidth&&e.setMinWidth(t.minWidth,i),null!=t.resizable&&e.setResizable(t.resizable),null!=t.draggable&&e.setDraggable(t.draggable),null!=t.fixRatio&&e.setFixRatio(t.fixRatio,i),null!=t.focus&&this.focusBox({focus:t.focus,box:e,skipUpdate:i}),null!=t.content&&e.mountContent(t.content),null!=t.footer&&e.mountFooter(t.footer)}focusBox({focus:e,box:t,skipUpdate:i=!1,increaseZIndex:s=!0}){if(t.setFocus(e,i),t.focus){if(this._focusedBox!==t){const e=this._focusedBox;this._focusedBox&&this._focusedBox.setFocus(!1,i),this._focusedBox=t,s&&t.setZIndex(++this.zIndex),i||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,t,e)}}else this._focusedBox===t&&(this._focusedBox=void 0,i||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,void 0,t));this.maxTitleBar.focusBox(this._focusedBox)}getInitialPosition(e,t){const i=this.boxes.length>0&&this.boxes.reduce(((e,t)=>e.zIndex>t.zIndex?e:t));let s=20,r=20;return i&&(s=i.intrinsicX*this.containerRect.width+20,r=i.intrinsicY*this.containerRect.height+20,(s>this.containerRect.width-e*this.containerRect.width||r>this.containerRect.height-t*this.containerRect.height)&&(s=20,r=20)),{x:s/this.containerRect.width,y:r/this.containerRect.height}}wrapCreateConfig(e={}){let{x:a,y:l}=e;const{width:h=.5,height:c=.5}=e;if(null==a||null==l){const e=this.getInitialPosition(h,c);null==a&&(a=e.x),null==l&&(l=e.y)}return d=((e,t)=>{for(var i in t||(t={}))r.call(t,i)&&o(e,i,t[i]);if(s)for(var i of s(t))n.call(t,i)&&o(e,i,t[i]);return e})({},e),u={x:a,y:l,width:h,height:c,maximized:this.maximized,minimized:this.minimized,fence:this.fence,zIndex:this.zIndex,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly},t(d,i(u));var d,u}},exports.TeleBoxReact=e=>{const[t]=a.useState((()=>new at(e)));return lt((()=>{null!=e.minWidth&&t.setMinWidth(e.minWidth)}),[t,e.minWidth]),lt((()=>{null!=e.minHeight&&t.setMinHeight(e.minHeight)}),[t,e.minHeight]),lt((()=>{var i,s;t.resize(null!=(i=e.width)?i:t.width,null!=(s=e.height)?s:t.height,!0)}),[t,e.width,e.height]),lt((()=>{var i,s;t.move(null!=(i=e.x)?i:t.x,null!=(s=e.y)?s:t.y,!0)}),[t,e.x,e.y]),lt((()=>{null!=e.title&&t.setTitle(e.title)}),[t,e.title]),lt((()=>{null!=e.visible&&t.setVisible(e.visible)}),[t,e.visible]),lt((()=>{null!=e.state&&t.setState(e.state,!0)}),[t,e.state]),lt((()=>{null!=e.draggable&&t.setDraggable(e.draggable)}),[t,e.draggable]),lt((()=>{null!=e.resizable&&t.setResizable(e.resizable)}),[t,e.resizable]),lt((()=>{null!=e.fence&&t.setFence(e.fence)}),[t,e.fence]),lt((()=>{null!=e.containerRect&&t.setContainerRect(e.containerRect)}),[t,e.containerRect]),lt((()=>{null!=e.fixRatio&&t.setFixRatio(e.fixRatio)}),[t,e.fixRatio]),a.useEffect((()=>{if(e.onResize)return t.events.on(exports.TELE_BOX_EVENT.Resize,e.onResize),()=>{t.events.off(exports.TELE_BOX_EVENT.Resize,e.onResize)}}),[t,e.onResize]),a.useEffect((()=>{if(e.onMove)return t.events.on(exports.TELE_BOX_EVENT.Move,e.onMove),()=>{t.events.off(exports.TELE_BOX_EVENT.Move,e.onMove)}}),[t,e.onMove]),a.useEffect((()=>{if(e.onClose)return t.events.on(exports.TELE_BOX_EVENT.Close,e.onClose),()=>{t.events.off(exports.TELE_BOX_EVENT.Close,e.onClose)}}),[t,e.onClose]),a.useEffect((()=>{if(e.onFocus)return t.events.on(exports.TELE_BOX_EVENT.Focus,e.onFocus),()=>{t.events.off(exports.TELE_BOX_EVENT.Focus,e.onFocus)}}),[t,e.onFocus]),a.useEffect((()=>{if(e.onBlur)return t.events.on(exports.TELE_BOX_EVENT.Blur,e.onBlur),()=>{t.events.off(exports.TELE_BOX_EVENT.Blur,e.onBlur)}}),[t,e.onBlur]),a.useEffect((()=>{if(e.onStateChanged)return t.events.on(exports.TELE_BOX_EVENT.State,e.onStateChanged),()=>{t.events.off(exports.TELE_BOX_EVENT.State,e.onStateChanged)}}),[t,e.onStateChanged]),h.default.createElement("div",{ref:e=>e&&t.render(e),className:t.wrapClassName("box")})};
|
|
15
|
+
***************************************************************************** */function f(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(s[i[r]]=e[i[r]])}return s}var E=0,m="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),s=Math.max(0,16.7-(t-E));E=t+s,setTimeout((function(){return e(E)}),s)},p=1/60*1e3,v=!0,x=!1,_=!1,b={delta:0,timestamp:0},g=["read","update","preRender","render","postRender"],T=function(e){return x=e},y=g.reduce((function(e,t){var s,i,r,n,o,a,l,h,c;return e[t]=(s=T,i=[],r=[],n=0,o=!1,a=0,l=new WeakSet,h=new WeakSet,c={cancel:function(e){var t=r.indexOf(e);l.add(e),-1!==t&&r.splice(t,1)},process:function(e){var t,d;if(o=!0,i=(t=[r,i])[0],(r=t[1]).length=0,n=i.length)for(a=0;a<n;a++)(d=i[a])(e),!0!==h.has(d)||l.has(d)||(c.schedule(d),s(!0));o=!1},schedule:function(e,t,s){void 0===t&&(t=!1),void 0===s&&(s=!1);var a=s&&o,c=a?i:r;l.delete(e),t&&h.add(e),-1===c.indexOf(e)&&(c.push(e),a&&(n=i.length))}}),e}),{}),w=g.reduce((function(e,t){var s=y[t];return e[t]=function(e,t,i){return void 0===t&&(t=!1),void 0===i&&(i=!1),x||C(),s.schedule(e,t,i),e},e}),{}),B=function(e){return y[e].process(b)},L=function(e){x=!1,b.delta=v?p:Math.max(Math.min(e-b.timestamp,40),1),v||(p=b.delta),b.timestamp=e,_=!0,g.forEach(B),_=!1,x&&(v=!1,m(L))},C=function(){x=!0,v=!0,_||m(L)},N=function(){return(N=Object.assign||function(e){for(var t,s=1,i=arguments.length;s<i;s++)for(var r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},$=function(e,t){return function(s){return Math.max(Math.min(s,t),e)}},O=function(e){return e%1?Number(e.toFixed(5)):e},z=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,M={test:function(e){return"number"==typeof e},parse:parseFloat,transform:function(e){return e}},S=N(N({},M),{transform:$(0,1)}),R=N(N({},M),{default:1}),A=function(e){return{test:function(t){return"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+e}}},k=A("deg"),X=A("%"),V=A("px"),D=N(N({},X),{parse:function(e){return X.parse(e)/100},transform:function(e){return X.transform(100*e)}}),I=$(0,255),H=function(e){return void 0!==e.red},W=function(e){return void 0!==e.hue};var j=function(e){return function(t){if("string"!=typeof t)return t;for(var s={},i=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))}(t).replace(/(,|\/)/g," ").split(/ \s*/),r=0;r<4;r++)s[e[r]]=void 0!==i[r]?parseFloat(i[r]):1;return s}},G=N(N({},M),{transform:function(e){return Math.round(I(e))}});function P(e,t){return e.startsWith(t)&&z.test(e)}var Z,F={test:function(e){return"string"==typeof e?P(e,"rgb"):H(e)},parse:j(["red","green","blue","alpha"]),transform:function(e){var t=e.red,s=e.green,i=e.blue,r=e.alpha,n=void 0===r?1:r;return function(e){var t=e.red,s=e.green,i=e.blue,r=e.alpha;return"rgba("+t+", "+s+", "+i+", "+(void 0===r?1:r)+")"}({red:G.transform(t),green:G.transform(s),blue:G.transform(i),alpha:O(S.transform(n))})}},Y={test:function(e){return"string"==typeof e?P(e,"hsl"):W(e)},parse:j(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,s=e.saturation,i=e.lightness,r=e.alpha,n=void 0===r?1:r;return function(e){var t=e.hue,s=e.saturation,i=e.lightness,r=e.alpha;return"hsla("+t+", "+s+", "+i+", "+(void 0===r?1:r)+")"}({hue:Math.round(t),saturation:X.transform(O(s)),lightness:X.transform(O(i)),alpha:O(S.transform(n))})}},q=N(N({},F),{test:function(e){return"string"==typeof e&&P(e,"#")},parse:function(e){var t="",s="",i="";return e.length>4?(t=e.substr(1,2),s=e.substr(3,2),i=e.substr(5,2)):(t=e.substr(1,1),s=e.substr(2,1),i=e.substr(3,1),t+=t,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:1}}}),U={test:function(e){return"string"==typeof e&&z.test(e)||H(e)||W(e)},parse:function(e){return F.test(e)?F.parse(e):Y.test(e)?Y.parse(e):q.test(e)?q.parse(e):e},transform:function(e){return H(e)?F.transform(e):W(e)?Y.transform(e):e}},J=function(e){var t=e.onRead,s=e.onRender,i=e.uncachedValues,r=void 0===i?new Set:i,n=e.useCache,o=void 0===n||n;return function(e){void 0===e&&(e={});var i=f(e,[]),n={},a=[],l=!1;function h(e,t){e.startsWith("--")&&(i.hasCSSVariable=!0);var s=n[e];n[e]=t,n[e]!==s&&(-1===a.indexOf(e)&&a.push(e),l||(l=!0,w.render(c.render)))}var c={get:function(e,s){return void 0===s&&(s=!1),!s&&o&&!r.has(e)&&void 0!==n[e]?n[e]:t(e,i)},set:function(e,t){if("string"==typeof e)h(e,t);else for(var s in e)h(s,e[s]);return this},render:function(e){return void 0===e&&(e=!1),(l||!0===e)&&(s(n,i,a),l=!1,a.length=0),this}};return c}},Q=/([a-z])([A-Z])/g,K=function(e){return e.replace(Q,"$1-$2").toLowerCase()},ee=new Map,te=new Map,se=["Webkit","Moz","O","ms",""],ie=se.length,re="undefined"!=typeof document,ne=function(e,t){return te.set(e,K(t))},oe=function(e,t){void 0===t&&(t=!1);var s=t?te:ee;return s.has(e)||(re?function(e){Z=Z||document.createElement("div");for(var t=0;t<ie;t++){var s=se[t],i=""===s,r=i?e:s+e.charAt(0).toUpperCase()+e.slice(1);if(r in Z.style||i){if(i&&"clipPath"===e&&te.has(e))return;ee.set(e,r),ne(e,(i?"":"-")+K(r))}}}(e):function(e){ne(e,e)}(e)),s.get(e)||e},ae=["","X","Y","Z"],le=["translate","scale","rotate","skew","transformPerspective"].reduce((function(e,t){return ae.reduce((function(e,s){return e.push(t+s),e}),e)}),["x","y","z"]),he=le.reduce((function(e,t){return e[t]=!0,e}),{});function ce(e){return!0===he[e]}function de(e,t){return le.indexOf(e)-le.indexOf(t)}var ue=new Set(["originX","originY","originZ"]);function fe(e){return ue.has(e)}var Ee=u(u({},M),{transform:Math.round}),me={color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,borderWidth:V,borderTopWidth:V,borderRightWidth:V,borderBottomWidth:V,borderLeftWidth:V,borderRadius:V,radius:V,borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,width:V,maxWidth:V,height:V,maxHeight:V,size:V,top:V,right:V,bottom:V,left:V,padding:V,paddingTop:V,paddingRight:V,paddingBottom:V,paddingLeft:V,margin:V,marginTop:V,marginRight:V,marginBottom:V,marginLeft:V,rotate:k,rotateX:k,rotateY:k,rotateZ:k,scale:R,scaleX:R,scaleY:R,scaleZ:R,skew:k,skewX:k,skewY:k,distance:V,translateX:V,translateY:V,translateZ:V,x:V,y:V,z:V,perspective:V,opacity:S,originX:D,originY:D,originZ:V,zIndex:Ee,fillOpacity:S,strokeOpacity:S,numOctaves:Ee},pe=function(e){return me[e]},ve=function(e,t){return t&&"number"==typeof e?t.transform(e):e},xe=new Set(["scrollLeft","scrollTop"]),_e=new Set(["scrollLeft","scrollTop","transform"]),be={x:"translateX",y:"translateY",z:"translateZ"};function ge(e){return"function"==typeof e}function Te(e,t,s,i,r,n,o,a){void 0===t&&(t=!0),void 0===s&&(s={}),void 0===i&&(i={}),void 0===r&&(r={}),void 0===n&&(n=[]),void 0===o&&(o=!1),void 0===a&&(a=!0);var l=!0,h=!1,c=!1;for(var d in e){var u=e[d],f=pe(d),E=ve(u,f);ce(d)?(h=!0,i[d]=E,n.push(d),l&&(f.default&&u!==f.default||!f.default&&0!==u)&&(l=!1)):fe(d)?(r[d]=E,c=!0):_e.has(d)&&ge(E)||(s[oe(d,o)]=E)}return(h||"function"==typeof e.transform)&&(s.transform=function(e,t,s,i,r,n){void 0===n&&(n=!0);var o="",a=!1;s.sort(de);for(var l=s.length,h=0;h<l;h++){var c=s[h];o+=(be[c]||c)+"("+t[c]+") ",a="z"===c||a}return!a&&r?o+="translateZ(0)":o=o.trim(),ge(e.transform)?o=e.transform(t,i?"":o):n&&i&&(o="none"),o}(e,i,n,l,t,a)),c&&(s.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),s}function ye(e){var t=void 0===e?{}:e,s=t.enableHardwareAcceleration,i=void 0===s||s,r=t.isDashCase,n=void 0===r||r,o=t.allowTransformNone,a=void 0===o||o,l={},h={},c={},d=[];return function(e){return d.length=0,Te(e,i,l,h,c,d,n,a),l}}var we=J({onRead:function(e,t){var s=t.element,i=t.preparseOutput,r=pe(e);if(ce(e))return r&&r.default||0;if(xe.has(e))return s[e];var n=window.getComputedStyle(s,null).getPropertyValue(oe(e,!0))||0;return i&&r&&r.test(n)&&r.parse?r.parse(n):n},onRender:function(e,t,s){var i=t.element,r=t.buildStyles,n=t.hasCSSVariable;if(Object.assign(i.style,r(e)),n)for(var o=s.length,a=0;a<o;a++){var l=s[a];l.startsWith("--")&&i.style.setProperty(l,e[l])}-1!==s.indexOf("scrollLeft")&&(i.scrollLeft=e.scrollLeft),-1!==s.indexOf("scrollTop")&&(i.scrollTop=e.scrollTop)},uncachedValues:xe});var Be=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Le=function(e,t){return V.transform(e*t)},Ce={x:0,y:0,width:0,height:0};function Ne(e,t,s){return"string"==typeof e?e:V.transform(t+s*e)}var $e={enableHardwareAcceleration:!1,isDashCase:!1};function Oe(e,t,s,i,r,n){void 0===t&&(t=Ce),void 0===i&&(i=ye($e)),void 0===r&&(r={style:{}}),void 0===n&&(n=!0);var o=e.attrX,a=e.attrY,l=e.originX,h=e.originY,c=e.pathLength,d=e.pathSpacing,u=void 0===d?1:d,E=e.pathOffset,m=void 0===E?0:E,p=i(f(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var v in p){if("transform"===v)r.style.transform=p[v];else r[n&&!Be.has(v)?K(v):v]=p[v]}return(void 0!==l||void 0!==h||p.transform)&&(r.style.transformOrigin=function(e,t,s){return Ne(t,e.x,e.width)+" "+Ne(s,e.y,e.height)}(t,void 0!==l?l:.5,void 0!==h?h:.5)),void 0!==o&&(r.x=o),void 0!==a&&(r.y=a),void 0!==s&&void 0!==c&&(r[n?"stroke-dashoffset":"strokeDashoffset"]=Le(-m,s),r[n?"stroke-dasharray":"strokeDasharray"]=Le(c,s)+" "+Le(u,s)),r}function ze(e,t,s){void 0===s&&(s=!0);var i={style:{}},r=ye($e);return function(n){return Oe(n,e,t,r,i,s)}}var Me=J({onRead:function(e,t){var s=t.element;if(ce(e=Be.has(e)?e:K(e))){var i=pe(e);return i&&i.default||0}return s.getAttribute(e)},onRender:function(e,t){var s=t.element,i=(0,t.buildAttrs)(e);for(var r in i)"style"===r?Object.assign(s.style,i.style):s.setAttribute(r,i[r])}}),Se=J({useCache:!1,onRead:function(e){return"scrollTop"===e?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,s=void 0===t?0:t,i=e.scrollLeft,r=void 0===i?0:i;return window.scrollTo(r,s)}}),Re=new WeakMap,Ae=function(e,t){var s,i,r,n;return e===window?s=Se(e):!function(e){return e instanceof HTMLElement||"function"==typeof e.click}(e)?function(e){return e instanceof SVGElement||"ownerSVGElement"in e}(e)&&(r=function(e){try{return function(e){return"function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}(e)}catch(t){return{x:0,y:0,width:0,height:0}}}(i=e),n=function(e){return"path"===e.tagName}(i)&&i.getTotalLength?i.getTotalLength():void 0,s=Me({element:i,buildAttrs:ze(r,n)})):s=function(e,t){void 0===t&&(t={});var s=t.enableHardwareAcceleration,i=t.allowTransformNone,r=f(t,["enableHardwareAcceleration","allowTransformNone"]);return we(u({element:e,buildStyles:ye({enableHardwareAcceleration:s,allowTransformNone:i}),preparseOutput:!0},r))}(e,t),Re.set(e,s),s};function ke(e,t){return function(e,t){return Re.has(e)?Re.get(e):Ae(e,t)}("string"==typeof e?document.querySelector(e):e,t)}var Xe=function(e,t,s,i){var r=s?s.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;l<n.length;l++){var h=n[l];if(!a(h))return!1;var c=e[h],d=t[h];if(!1===(r=s?s.call(i,c,d,h):void 0)||void 0===r&&c!==d)return!1}return!0};const Ve="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",De=Ve.length,Ie=Array(20),He=()=>{for(let e=0;e<20;e++)Ie[e]=Ve.charAt(Math.random()*De);return Ie.join("")};class We{constructor(){this.disposers=new Map}add(e,t=He()){return this.flush(t),this.disposers.set(t,e()),t}addDisposer(e,t=He()){return this.flush(t),this.disposers.set(t,e),t}addEventListener(e,t,s,i,r=He()){return this.add((()=>(e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i))),r),r}setTimeout(e,t,s=He()){return this.add((()=>{const i=window.setTimeout((()=>{this.remove(s),e()}),t);return()=>window.clearTimeout(i)}),s)}setInterval(e,t,s=He()){return this.add((()=>{const s=window.setInterval(e,t);return()=>window.clearInterval(s)}),s)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);if(t)try{t()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach((e=>{try{e()}catch(t){console.error(t)}})),this.disposers.clear()}}var je=Object.defineProperty,Ge=("undefined"!=typeof require&&require,(e,t,s)=>{return n=s,(r="symbol"!=typeof t?t+"":t)in(i=e)?je(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,s;var i,r,n});class Pe{constructor(e,t){Ge(this,"_value"),Ge(this,"_beforeDestroys"),Ge(this,"_subscribers"),this._value=e,t&&(this.compare=t)}get value(){return this._value}setValue(e,t){if(!this.compare(e,this._value)){const s=this._value;this._value=e,this._subscribers&&this._subscribers.forEach((i=>i(e,s,t)))}}reaction(e){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),()=>{this._subscribers&&this._subscribers.delete(e)}}subscribe(e,t){const s=this.reaction(e);return e(this._value,void 0,t),s}derive(e,t,s){const i=new Pe(e(this.value,void 0,s),t),r=this.reaction(((t,s,r)=>{i.setValue(e(t,s,r))}));return i.addBeforeDestroy(r),i}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach((e=>e())),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(e){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(e),()=>{this._beforeDestroys&&this._beforeDestroys.delete(e)}}compare(e,t){return e===t}}function Ze(e,t){Object.keys(t).forEach((s=>{!function(e,t,s){var i;Object.defineProperties(e,{[t]:{get:()=>s.value},[`_${t}$`]:{value:s},[`set${i=t,i[0].toUpperCase()+i.slice(1)}`]:{value:(e,t)=>s.setValue(e,t)}})}(e,s,t[s])}))}function Fe(e){const t=t=>{const s=e.addDisposer((()=>{t.destroy()}));return t.addBeforeDestroy((()=>{e.remove(s)})),t};return{bindSideEffect:t,combine:(e,s,i,r)=>t(function(e,t,s,i){let r=e.map((e=>e.value));const n=new Pe(t(r,void 0,i),s);return e.forEach(((e,s)=>{const i=e.reaction(((e,i,o)=>{const a=r.slice();a[s]=e;const l=r;r=a,n.setValue(t(a,l,o),o)}));n.addBeforeDestroy(i)})),n}(e,s,i,r)),createVal:(e,s)=>t(new Pe(e,s))}}var Ye,qe,Ue,Je,Qe;exports.TELE_BOX_COLOR_SCHEME=void 0,(Ye=exports.TELE_BOX_COLOR_SCHEME||(exports.TELE_BOX_COLOR_SCHEME={})).Light="light",Ye.Dark="dark",Ye.Auto="auto",exports.TELE_BOX_STATE=void 0,(qe=exports.TELE_BOX_STATE||(exports.TELE_BOX_STATE={})).Normal="normal",qe.Minimized="minimized",qe.Maximized="maximized",exports.TELE_BOX_EVENT=void 0,(Ue=exports.TELE_BOX_EVENT||(exports.TELE_BOX_EVENT={})).DarkMode="dark_mode",Ue.PrefersColorScheme="prefers_color_scheme",Ue.Close="close",Ue.Focus="focus",Ue.Blur="blur",Ue.Move="move",Ue.Resize="resize",Ue.IntrinsicMove="intrinsic_move",Ue.IntrinsicResize="intrinsic_resize",Ue.VisualResize="visual_resize",Ue.State="state",Ue.Minimized="minimized",Ue.Maximized="maximized",Ue.Readonly="readonly",Ue.Destroyed="destroyed",exports.TELE_BOX_DELEGATE_EVENT=void 0,(Je=exports.TELE_BOX_DELEGATE_EVENT||(exports.TELE_BOX_DELEGATE_EVENT={})).Close="close",Je.Maximize="maximize",Je.Minimize="minimize",exports.TELE_BOX_RESIZE_HANDLE=void 0,(Qe=exports.TELE_BOX_RESIZE_HANDLE||(exports.TELE_BOX_RESIZE_HANDLE={})).North="n",Qe.South="s",Qe.West="w",Qe.East="e",Qe.NorthWest="nw",Qe.NorthEast="ne",Qe.SouthEast="se",Qe.SouthWest="sw";function Ke(e,t,s){return Math.min(Math.max(e,t),s)}function et(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function tt(e){return e.touches?e.touches[0]:e}function st(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let it=1;function rt(){return"New Box "+it++}function nt(e){return Boolean(e)}function ot(e){return!e}class at{constructor({readonly:e=!1,title:t,buttons:s,onEvent:i,onDragStart:r,namespace:n="telebox",state:o=exports.TELE_BOX_STATE.Normal}={}){this.$btns=[],this.sideEffect=new We,this.lastTitleBarClick=0,this.handleTitleBarClick=e=>{var t;if(this.readonly)return;if(null!=e.button&&0!==e.button)return;if(null==(t=e.target.dataset)?void 0:t.teleTitleBarNoDblClick)return;et(e);const s=Date.now();s-this.lastTitleBarClick<=500?this.onEvent&&this.onEvent({type:exports.TELE_BOX_DELEGATE_EVENT.Maximize}):this.onDragStart&&this.onDragStart(e),this.lastTitleBarClick=s},this.readonly=e,this.onEvent=i,this.onDragStart=r,this.namespace=n,this.title=t,this.state=o,this.buttons=s||[{type:exports.TELE_BOX_DELEGATE_EVENT.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:exports.TELE_BOX_DELEGATE_EVENT.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:e=>e===exports.TELE_BOX_STATE.Maximized},{type:exports.TELE_BOX_DELEGATE_EVENT.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]}setTitle(e){this.title=e,this.$title&&(this.$title.textContent=e,this.$title.title=e)}setState(e){this.state!==e&&(this.state=e,this.buttons.forEach(((t,s)=>{t.isActive&&this.$btns[s].classList.toggle("is-active",t.isActive(e))})))}setReadonly(e){this.readonly!==e&&(this.readonly=e)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar"),this.$titleBar.dataset.teleBoxHandle="dh",this.sideEffect.addEventListener(this.$titleBar,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(this.$titleBar,"touchstart",this.handleTitleBarClick,{passive:!0}),this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle="dh",this.title&&(this.$title.textContent=this.title,this.$title.title=this.title);const e=document.createElement("div");e.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach((({iconClassName:t,isActive:s},i)=>{const r=String(i),n=document.createElement("button");n.className=`${this.wrapClassName("titlebar-btn")} ${t}`,n.dataset.teleTitleBarBtnIndex=r,n.dataset.teleTitleBarNoDblClick="true",s&&n.classList.toggle("is-active",s(this.state)),this.$btns.push(n),e.appendChild(n)})),this.sideEffect.addEventListener(e,"click",(e=>{var t;if(this.readonly)return;const s=e.target,i=Number(null==(t=s.dataset)?void 0:t.teleTitleBarBtnIndex);if(!Number.isNaN(i)&&i<this.buttons.length){et(e);const t=this.buttons[i];this.onEvent&&this.onEvent({type:t.type,value:t.value})}})),this.$titleBar.appendChild(this.$title),this.$titleBar.appendChild(e)}return this.$titleBar}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class lt{constructor({id:e=st(),title:t=rt(),prefersColorScheme:s=exports.TELE_BOX_COLOR_SCHEME.Light,darkMode:i,visible:r=!0,width:n=.5,height:o=.5,minWidth:a=0,minHeight:l=0,x:h=.1,y:c=.1,minimized:u=!1,maximized:f=!1,readonly:E=!1,resizable:m=!0,draggable:p=!0,fence:v=!0,fixRatio:x=!1,focus:_=!1,zIndex:b=100,namespace:g="telebox",titleBar:T,content:y,footer:w,styles:B,containerRect:L={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:C}={}){this._renderSideEffect=new We,this.handleTrackStart=e=>{var t;return null==(t=this._handleTrackStart)?void 0:t.call(this,e)},this._sideEffect=new We,this._valSideEffectBinder=Fe(this._sideEffect);const{combine:N,createVal:$}=this._valSideEffectBinder;this.id=e,this.namespace=g,this.events=new d,this._delegateEvents=new d;const O=$(s);O.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.PrefersColorScheme,e)}));const z=$(Boolean(i));null==i&&O.subscribe(((e,t,s)=>{this._sideEffect.add((()=>{if("auto"===e){const e=window.matchMedia("(prefers-color-scheme: dark)");if(e){z.setValue(e.matches,s);const t=e=>{z.setValue(e.matches,s)};return e.addListener(t),()=>e.removeListener(t)}return ht}return z.setValue("dark"===e,s),ht}),"prefers-color-scheme")})),z.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.DarkMode,e)}));const M=$(L,Xe),S=$(C,Xe),R=$(t),A=$(r);A.reaction(((e,t,s)=>{s||e||this.events.emit(exports.TELE_BOX_EVENT.Close)}));const k=$(E);k.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.Readonly,e)}));const X=$(m),V=$(p),D=$(v),I=$(x),H=$(b),W=$(_);W.reaction(((e,t,s)=>{s||this.events.emit(e?exports.TELE_BOX_EVENT.Focus:exports.TELE_BOX_EVENT.Blur)}));const j=$(u);j.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.Minimized,e)}));const G=$(f);G.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.Maximized,e)}));const P=N([j,G],(([e,t])=>e?exports.TELE_BOX_STATE.Minimized:t?exports.TELE_BOX_STATE.Maximized:exports.TELE_BOX_STATE.Normal));P.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.State,e)}));const Z=$({width:Ke(a,0,1),height:Ke(l,0,1)},Xe),F=$({width:Ke(n,Z.value.width,1),height:Ke(o,Z.value.height,1)},Xe);Z.reaction(((e,t,s)=>{F.setValue({width:Ke(n,e.width,1),height:Ke(o,e.height,1)},s)})),F.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.IntrinsicResize,e)}));const Y=N([F,G],(([e,t])=>t?{width:1,height:1}:e),Xe);Y.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.Resize,e)}));const q=N([Y,j,M,S],(([e,t,s,i])=>t&&i?{width:i.width/e.width/s.width,height:i.height/e.height/s.height}:e),Xe);q.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.VisualResize,e)}));const U=$({x:Ke(h,0,1),y:Ke(c,0,1)},Xe);U.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.IntrinsicMove,e)}));const J=N([U,F,M,S,j,G],(([e,t,s,i,r,n])=>r&&i?n?{x:(i.x+i.width/2)/s.width-.5,y:(i.y+i.height/2)/s.height-.5}:{x:(i.x+i.width/2)/s.width-t.width/2,y:(i.y+i.height/2)/s.height-t.height/2}:n?{x:0,y:0}:e),Xe);J.reaction(((e,t,s)=>{s||this.events.emit(exports.TELE_BOX_EVENT.Move,e)})),this.titleBar=T||new at({readonly:k.value,title:R.value,namespace:this.namespace,onDragStart:e=>{var t;return null==(t=this._handleTrackStart)?void 0:t.call(this,e)},onEvent:e=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(e.type);else switch(e.type){case exports.TELE_BOX_DELEGATE_EVENT.Maximize:G.setValue(!G.value);break;case exports.TELE_BOX_DELEGATE_EVENT.Minimize:j.setValue(!0);break;case exports.TELE_BOX_DELEGATE_EVENT.Close:A.setValue(!1);break;default:console.error("Unsupported titleBar event:",e)}}}),k.reaction((e=>{this.titleBar.setReadonly(e)}));const Q=$(y),K=$(w),ee=$(B);Ze(this,{prefersColorScheme:O,darkMode:z,containerRect:M,collectorRect:S,title:R,visible:A,readonly:k,resizable:X,draggable:V,fence:D,fixRatio:I,focus:W,zIndex:H,minimized:j,maximized:G,$userContent:Q,$userFooter:K,$userStyles:ee}),this._state$=P,this._minSize$=Z,this._size$=Y,this._intrinsicSize$=F,this._visualSize$=q,this._coord$=J,this._intrinsicCoord$=U,this.fixRatio&&this.transform(J.value.x,J.value.y,Y.value.width,Y.value.height,!0),this.$box=this.render()}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(e,t=!1){switch(e){case exports.TELE_BOX_STATE.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case exports.TELE_BOX_STATE.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,t=!1){return this._minSize$.setValue({width:e,height:this.minHeight},t),this}setMinHeight(e,t=!1){return this._minSize$.setValue({width:this.minWidth,height:e},t),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(e,t,s=!1){return this._intrinsicSize$.setValue({width:e,height:t},s),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(e,t,s=!1){return this._intrinsicCoord$.setValue({x:e,y:t},s),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(e,t,s,i,r=!1){if(this.fixRatio){const e=this.intrinsicHeight/this.intrinsicWidth*s;t!==this.intrinsicY&&(t-=e-i),i=e}return t<0&&(t=0,i>this.intrinsicHeight&&(i=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:s>=this.minWidth?e:this.intrinsicX,y:i>=this.minHeight?t:this.intrinsicY},r),this._intrinsicSize$.setValue({width:Ke(s,this.minWidth,1),height:Ke(i,this.minHeight,1)},r),this}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(e){return this.set$userContent(e),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(e){return this.set$userFooter(e),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(e){let t;return"string"==typeof e?(t=document.createElement("style"),t.textContent=e):t=e,this.set$userStyles(t),this}unmountStyles(){return this.set$userStyles(void 0),this}render(e){if(e){if(e===this.$box)return this.$box;this.$box=e}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));const t=(e,t,s,i=nt)=>this._renderSideEffect.add((()=>{const r=this.wrapClassName(s);return t.subscribe((t=>{e.classList.toggle(r,i(t))}))}));t(this.$box,this._readonly$,"readonly"),t(this.$box,this._draggable$,"no-drag",ot),t(this.$box,this._resizable$,"no-resize",ot),t(this.$box,this._focus$,"blur",ot),t(this.$box,this._darkMode$,"color-scheme-dark"),t(this.$box,this._darkMode$,"color-scheme-light",ot),this._renderSideEffect.add((()=>{const e=this.wrapClassName("minimized"),t=this.wrapClassName("maximized"),s="box-maximized-timer";return this._state$.subscribe((i=>{this.$box.classList.toggle(e,i===exports.TELE_BOX_STATE.Minimized),i===exports.TELE_BOX_STATE.Maximized?(this._renderSideEffect.flush(s),this.$box.classList.toggle(t,!0)):this._renderSideEffect.setTimeout((()=>{this.$box.classList.toggle(t,!1)}),0,s)}))})),this._renderSideEffect.add((()=>this._visible$.subscribe((e=>{this.$box.style.display=e?"block":"none"})))),this._renderSideEffect.add((()=>this._zIndex$.subscribe((e=>{this.$box.style.zIndex=String(e)}))));const s=ke(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";const i=this.x*this.containerRect.width+this.containerRect.x,r=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${i-10}px,${r-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$],(([e,t,s,i,r])=>{const n=t.width*i.width,o=t.height*i.height;return{width:n,height:o,x:e.x*i.width,y:e.y*i.height,scaleX:s&&r?r.width/n:1,scaleY:s&&r?r.height/o:1}}),Xe).subscribe((e=>{s.set(e)})),s.set({x:i,y:r});const n=document.createElement("div");n.className=this.wrapClassName("box-main"),this.$box.appendChild(n);const o=document.createElement("div");o.className=this.wrapClassName("titlebar-wrap"),o.appendChild(this.titleBar.render()),this.$titleBar=o;const a=document.createElement("div");a.className=this.wrapClassName("content-wrap");const l=document.createElement("div");l.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=l,this._renderSideEffect.add((()=>{let e;return this._$userStyles$.subscribe((t=>{e&&e.remove(),e=t,t&&l.appendChild(t)}))})),this._renderSideEffect.add((()=>{let e;return this._$userContent$.subscribe((t=>{e&&e.remove(),e=t,t&&l.appendChild(t)}))})),a.appendChild(l);const h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add((()=>{let e;return this._$userFooter$.subscribe((t=>{e&&e.remove(),e=t,t&&h.appendChild(t)}))})),n.appendChild(o),n.appendChild(a),n.appendChild(h),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(exports.TELE_BOX_RESIZE_HANDLE).forEach((t=>{const s=document.createElement("div");s.className=this.wrapClassName(t)+" "+this.wrapClassName("resize-handle"),s.dataset.teleBoxHandle=t,e.appendChild(s)})),this.$box.appendChild(e);const t="handle-tracking-listener",s=this.wrapClassName("transforming");let i,r,n=0,o=0,a=0,l=0,h=0,c=0;const d=e=>{if(this.state!==exports.TELE_BOX_STATE.Normal)return;et(e);let{pageX:t,pageY:s}=tt(e);s<0&&(s=0);const i=(t-h)/this.containerRect.width,d=(s-c)/this.containerRect.height;switch(r){case exports.TELE_BOX_RESIZE_HANDLE.North:this.transform(this.x,o+d,this.width,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.South:this.transform(this.x,this.y,this.width,l+d);break;case exports.TELE_BOX_RESIZE_HANDLE.West:this.transform(n+i,this.y,a-i,this.height);break;case exports.TELE_BOX_RESIZE_HANDLE.East:this.transform(this.x,this.y,a+i,this.height);break;case exports.TELE_BOX_RESIZE_HANDLE.NorthWest:this.transform(n+i,o+d,a-i,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.NorthEast:this.transform(this.x,o+d,a+i,l-d);break;case exports.TELE_BOX_RESIZE_HANDLE.SouthEast:this.transform(this.x,this.y,a+i,l+d);break;case exports.TELE_BOX_RESIZE_HANDLE.SouthWest:this.transform(n+i,this.y,a-i,l+d);break;default:if(this.fence)this.move(Ke(n+i,0,1-this.width),Ke(o+d,0,1-this.height));else{const e=20/this.containerRect.width,t=20/this.containerRect.height;this.move(Ke(n+i,e-this.width,1-e),Ke(o+d,0,1-t))}}},u=e=>{r=void 0,i&&(et(e),this.$box.classList.toggle(s,!1),this._sideEffect.flush(t),i.remove())},f=e=>{var f;if(this.readonly)return;if(null!=e.button&&0!==e.button)return;if(!this.draggable||r||this.state!==exports.TELE_BOX_STATE.Normal)return;const E=e.target;if(null==(f=E.dataset)?void 0:f.teleBoxHandle){et(e),n=this.x,o=this.y,a=this.width,l=this.height,({pageX:h,pageY:c}=tt(e)),r=E.dataset.teleBoxHandle,i||(i=document.createElement("div"));const f=r?this.wrapClassName(`cursor-${r}`):"";i.className=this.wrapClassName("track-mask"+(f?` ${f}`:"")),this.$box.appendChild(i),this.$box.classList.add(s),this._sideEffect.add((()=>(window.addEventListener("mousemove",d),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("mouseup",u),window.addEventListener("touchend",u,{passive:!1}),window.addEventListener("touchcancel",u,{passive:!1}),()=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d),window.removeEventListener("mouseup",u),window.removeEventListener("touchend",u),window.removeEventListener("touchcancel",u)})),t)}};this._handleTrackStart=f,this._sideEffect.addEventListener(e,"mousedown",f,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(e,"touchstart",f,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(exports.TELE_BOX_EVENT.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}function ht(){}const ct=(e,t)=>{const s=a.useRef(!0);a.useEffect((()=>{if(!s.current)return e();s.current=!1}),t)};var dt;class ut{constructor({visible:e=!0,readonly:t=!1,darkMode:s=!1,namespace:i="telebox",styles:r={},onClick:n}={}){this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=e,this._readonly=t,this._darkMode=s,this.namespace=i,this.styles=r,this.onClick=n}get visible(){return this._visible}get readonly(){return this._readonly}get darkMode(){return this._darkMode}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}setVisible(e){return this._visible!==e&&(this._visible=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),e)),this}setReadonly(e){return this._readonly!==e&&(this._readonly=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),e)),this}setDarkMode(e){return this._darkMode!==e&&(this._darkMode=e,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!e))),this}setStyles(e){if(Object.assign(this.styles,e),this.$collector){const t=this.$collector;Object.keys(e).forEach((s=>{const i=e[s];null!=i&&(t.style[s]=i)}))}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage="url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K')",this.$collector.addEventListener("click",this.handleCollectorClick),this._visible&&this.$collector.classList.add(this.wrapClassName("collector-visible")),this._readonly&&this.$collector.classList.add(this.wrapClassName("collector-readonly")),this.$collector.classList.add(this.wrapClassName(this._darkMode?"color-scheme-dark":"color-scheme-light")),this.setStyles(this.styles)),this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(e){return`${this.namespace}-${e}`}}exports.TELE_BOX_MANAGER_EVENT=void 0,(dt=exports.TELE_BOX_MANAGER_EVENT||(exports.TELE_BOX_MANAGER_EVENT={})).Focused="focused",dt.Created="created",dt.Removed="removed",dt.State="state",dt.Maximized="maximized",dt.Minimized="minimized",dt.Move="move",dt.Resize="resize",dt.IntrinsicMove="intrinsic_move",dt.IntrinsicResize="intrinsic_resize",dt.VisualResize="visual_resize",dt.PrefersColorScheme="prefers_color_scheme",dt.DarkMode="dark_mode";class ft extends at{constructor(e){super(e),this.boxes=e.boxes,this.focusedBox=e.focusedBox,this.containerRect=e.containerRect,this.darkMode=e.darkMode}focusBox(e){var t;if(e||(e=this.boxes[this.boxes.length-1]),!this.focusedBox||this.focusedBox!==e){if(this.$titles&&this.state===exports.TELE_BOX_STATE.Maximized){const{children:s}=this.$titles.firstElementChild;for(let i=s.length-1;i>=0;i-=1){const r=s[i],n=null==(t=r.dataset)?void 0:t.teleBoxID;n&&(e&&n===e.id?r.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&n===this.focusedBox.id&&r.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}setContainerRect(e){if(this.containerRect=e,this.$titleBar){const{x:t,y:s,width:i}=e;this.$titleBar.style.transform=`translate(${t}px, ${s}px)`,this.$titleBar.style.width=i+"px"}}setBoxes(e){this.boxes=e,this.updateTitles()}setState(e){super.setState(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),e===exports.TELE_BOX_STATE.Maximized),this.updateTitles()}setReadonly(e){super.setReadonly(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}setDarkMode(e){e!==this.darkMode&&(this.darkMode=e,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!e)))}render(){const e=super.render(),{x:t,y:s,width:i}=this.containerRect;return e.style.transform=`translate(${t}px, ${s}px)`,e.style.width=i+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===exports.TELE_BOX_STATE.Maximized),e.classList.toggle(this.wrapClassName("readonly"),this.readonly),e.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light")),this.updateTitles(),e}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&this.state===exports.TELE_BOX_STATE.Maximized&&(1===this.boxes.length?this.$title&&(this.$title.textContent=this.boxes[0].title,this.$titleBar.replaceChild(this.$title,this.$titleBar.firstElementChild)):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",(e=>{e.currentTarget.scrollBy({left:e.deltaY>0?250:-250,behavior:"smooth"})}),{passive:!1});const e=document.createElement("div");return e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e),this.boxes.forEach((t=>{const s=document.createElement("button");s.className=this.wrapClassName("titles-tab"),s.textContent=t.title,s.dataset.teleBoxID=t.id,s.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&t.id===this.focusedBox.id&&s.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(s)})),this.$titles}}exports.DefaultTitleBar=at,exports.TeleBox=lt,exports.TeleBoxCollector=ut,exports.TeleBoxDragHandleType="dh",exports.TeleBoxManager=class{constructor({root:e=document.body,prefersColorScheme:t=exports.TELE_BOX_COLOR_SCHEME.Light,minimized:s=!1,maximized:i=!1,fence:r=!0,containerRect:n={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:o,namespace:a="telebox",zIndex:l=100,readonly:h=!1}={}){this.events=new d,this.boxes=[],this._sideEffect=new We;const{combine:c,createVal:u}=Fe(this._sideEffect);this.root=e,this.namespace=a,this.zIndex=l;const f=window.matchMedia("(prefers-color-scheme: dark)"),E=u(!1);f&&(E.setValue(f.matches),this._sideEffect.add((()=>{const e=e=>{E.setValue(e.matches)};return f.addListener(e),()=>f.removeListener(e)})));const m=u(t);m.reaction(((e,t,s)=>{this.boxes.forEach((t=>t.setPrefersColorScheme(e,s))),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.PrefersColorScheme,e)})),this._darkMode$=c([E,m],(([e,t])=>"auto"===t?e:"dark"===t)),this._darkMode$.reaction(((e,t,s)=>{this.boxes.forEach((t=>t.setDarkMode(e,s))),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.DarkMode,e)}));const p=u(h);p.reaction(((e,t,s)=>{this.boxes.forEach((t=>t.setReadonly(e,s)))}));const v=u(s),x=u(i);x.reaction(((e,t,s)=>{this.boxes.forEach((t=>t.setMaximized(e,s))),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Maximized,e)}));const _=c([v,x],(([e,t])=>e?exports.TELE_BOX_STATE.Minimized:t?exports.TELE_BOX_STATE.Maximized:exports.TELE_BOX_STATE.Normal));_.reaction(((e,t,s)=>{this.maxTitleBar.setState(e),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.State,e)}));const b=u(r);b.subscribe(((e,t,s)=>{this.boxes.forEach((t=>t.setFence(e,s)))}));const g=u(n,Xe);g.reaction(((e,t,s)=>{this.boxes.forEach((t=>t.setContainerRect(e,s))),this.maxTitleBar.setContainerRect(e)}));const T=u(null===o?null:o||new ut({visible:s,readonly:h,namespace:a}).mount(e));T.subscribe((e=>{e&&(e.setVisible(v.value),e.setReadonly(p.value),e.setDarkMode(this._darkMode$.value),this._sideEffect.add((()=>(e.onClick=()=>{p.value||v.setValue(!1)},()=>e.destroy())),"collect-onClick"))})),p.subscribe((e=>{var t;return null==(t=T.value)?void 0:t.setReadonly(e)})),this._darkMode$.subscribe((e=>{var t;null==(t=T.value)||t.setDarkMode(e)})),v.subscribe(((e,t,s)=>{var i,r;if(null==(i=T.value)||i.setVisible(e),e&&(null==(r=T.value)?void 0:r.$collector)){const{x:e,y:t,width:s,height:i}=T.value.$collector.getBoundingClientRect(),r=this.root.getBoundingClientRect();this.boxes.forEach((n=>{n.setCollectorRect({x:e-r.x,y:t-r.y,width:s,height:i},!0)}))}this.boxes.forEach((t=>t.setMinimized(e,s))),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Minimized,e)}));const y=e=>{var t;if(p.value)return;const s=e.target;if(s.tagName)for(let i=s;i;i=i.parentElement){const e=null==(t=i.dataset)?void 0:t.teleBoxID;if(e){const t=this.boxes.find((t=>t.id===e));if(t)return void this.focusBox({focus:!0,box:t})}}};this._sideEffect.addEventListener(window,"mousedown",y,!0),this._sideEffect.addEventListener(window,"touchstart",y,!0),this.maxTitleBar=new ft({darkMode:this.darkMode,readonly:p.value,namespace:this.namespace,state:_.value,boxes:this.boxes,focusedBox:this._focusedBox,containerRect:g.value,onEvent:e=>{var t;switch(e.type){case exports.TELE_BOX_DELEGATE_EVENT.Maximize:x.setValue(!x.value);break;case exports.TELE_BOX_DELEGATE_EVENT.Minimize:v.setValue(!0);break;case exports.TELE_BOX_EVENT.Close:{const e=null!=(t=this._focusedBox)?t:this.boxes[this.boxes.length-1];e&&this.remove(e.id);break}}}}),p.subscribe((e=>this.maxTitleBar.setReadonly(e))),this._darkMode$.subscribe((e=>{this.maxTitleBar.setDarkMode(e)}));Ze(this,{prefersColorScheme:m,containerRect:g,collector:T,readonly:p,fence:b,minimized:v,maximized:x}),this._state$=_,this.root.appendChild(this.maxTitleBar.render())}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(e,t=!1){switch(e){case exports.TELE_BOX_STATE.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case exports.TELE_BOX_STATE.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}create(e){const t=new lt(this.wrapCreateConfig(e));return t.mount(this.root),this.boxes.push(t),t.focus&&this.focusBox({focus:!0,box:t,increaseZIndex:!1}),this.maxTitleBar.setBoxes(this.boxes),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Maximize,(()=>{this.setMaximized(!this.maximized)})),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Minimize,(()=>{this.setMinimized(!0)})),t._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Close,(()=>{this.focusBox({focus:!1,box:t}),this.remove(t.id)})),t.events.on(exports.TELE_BOX_EVENT.Move,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Move,t)})),t.events.on(exports.TELE_BOX_EVENT.Resize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Resize,t)})),t.events.on(exports.TELE_BOX_EVENT.IntrinsicMove,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicMove,t)})),t.events.on(exports.TELE_BOX_EVENT.IntrinsicResize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.IntrinsicResize,t)})),t.events.on(exports.TELE_BOX_EVENT.VisualResize,(()=>{this.events.emit(exports.TELE_BOX_MANAGER_EVENT.VisualResize,t)})),this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Created,t),t}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,t,s=!1){const i=this.boxes.find((t=>t.id===e));if(i)return this.updateBox(i,t,s)}updateAll(e,t=!1){this.boxes.forEach((s=>{this.updateBox(s,e,t)}))}remove(e,t=!1){const s=this.boxes.findIndex((t=>t.id===e));if(s>=0){const e=this.boxes.splice(s,1);this.maxTitleBar.setBoxes(this.boxes);const i=e[0];return this.focusBox({focus:!1,box:i}),i.destroy(),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed,e)),i}}removeAll(e=!1){if(this._focusedBox){const t=this._focusedBox;this._focusedBox=void 0,e||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,void 0,t)}const t=this.boxes.splice(0,this.boxes.length);return this.maxTitleBar.setBoxes(this.boxes),t.forEach((e=>e.destroy())),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Removed,t)),t}destroy(e=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this._focusedBox=void 0,this.removeAll(e),Object.keys(this).forEach((e=>{const t=this[e];t instanceof Pe&&t.destroy()}))}wrapClassName(e){return`${this.namespace}-${e}`}teleBoxMatcher(e){const t=Object.keys(e);return s=>t.every((t=>e[t]===s[t]))}updateBox(e,t,s=!1){null==t.x&&null==t.y||e.move(null==t.x?e.intrinsicX:t.x,null==t.y?e.intrinsicY:t.y,s),null==t.width&&null==t.height||e.resize(null==t.width?e.intrinsicWidth:t.width,null==t.height?e.intrinsicHeight:t.height,s),null!=t.title&&(e.setTitle(t.title),this.maxTitleBar.updateTitles()),null!=t.visible&&e.setVisible(t.visible,s),null!=t.minHeight&&e.setMinHeight(t.minHeight,s),null!=t.minWidth&&e.setMinWidth(t.minWidth,s),null!=t.resizable&&e.setResizable(t.resizable),null!=t.draggable&&e.setDraggable(t.draggable),null!=t.fixRatio&&e.setFixRatio(t.fixRatio,s),null!=t.focus&&this.focusBox({focus:t.focus,box:e,skipUpdate:s}),null!=t.content&&e.mountContent(t.content),null!=t.footer&&e.mountFooter(t.footer)}focusBox({focus:e,box:t,skipUpdate:s=!1,increaseZIndex:i=!0}){if(t.setFocus(e,s),t.focus){if(this._focusedBox!==t){const e=this._focusedBox;this._focusedBox&&this._focusedBox.setFocus(!1,s),this._focusedBox=t,i&&t.setZIndex(++this.zIndex),s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,t,e)}}else this._focusedBox===t&&(this._focusedBox=void 0,s||this.events.emit(exports.TELE_BOX_MANAGER_EVENT.Focused,void 0,t));this.maxTitleBar.focusBox(this._focusedBox)}getInitialPosition(e,t){const s=this.boxes.length>0&&this.boxes.reduce(((e,t)=>e.zIndex>t.zIndex?e:t));let i=20,r=20;return s&&(i=s.intrinsicX*this.containerRect.width+20,r=s.intrinsicY*this.containerRect.height+20,(i>this.containerRect.width-e*this.containerRect.width||r>this.containerRect.height-t*this.containerRect.height)&&(i=20,r=20)),{x:i/this.containerRect.width,y:r/this.containerRect.height}}wrapCreateConfig(e={}){let{x:a,y:l}=e;const{width:h=.5,height:c=.5}=e;if(null==a||null==l){const e=this.getInitialPosition(h,c);null==a&&(a=e.x),null==l&&(l=e.y)}return d=((e,t)=>{for(var s in t||(t={}))r.call(t,s)&&o(e,s,t[s]);if(i)for(var s of i(t))n.call(t,s)&&o(e,s,t[s]);return e})({},e),u={x:a,y:l,width:h,height:c,darkMode:this.darkMode,prefersColorScheme:this.prefersColorScheme,maximized:this.maximized,minimized:this.minimized,fence:this.fence,zIndex:this.zIndex,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly},t(d,s(u));var d,u}},exports.TeleBoxReact=e=>{const[t]=a.useState((()=>new lt(e)));return ct((()=>{null!=e.prefersColorScheme&&t.setPrefersColorScheme(e.prefersColorScheme)}),[t,e.prefersColorScheme]),ct((()=>{null!=e.minWidth&&t.setMinWidth(e.minWidth)}),[t,e.minWidth]),ct((()=>{null!=e.minHeight&&t.setMinHeight(e.minHeight)}),[t,e.minHeight]),ct((()=>{var s,i;t.resize(null!=(s=e.width)?s:t.width,null!=(i=e.height)?i:t.height,!0)}),[t,e.width,e.height]),ct((()=>{var s,i;t.move(null!=(s=e.x)?s:t.x,null!=(i=e.y)?i:t.y,!0)}),[t,e.x,e.y]),ct((()=>{null!=e.title&&t.setTitle(e.title)}),[t,e.title]),ct((()=>{null!=e.visible&&t.setVisible(e.visible)}),[t,e.visible]),ct((()=>{null!=e.minimized&&t.setMinimized(e.minimized,!0)}),[t,e.minimized]),ct((()=>{null!=e.maximized&&t.setMaximized(e.maximized,!0)}),[t,e.maximized]),ct((()=>{null!=e.state&&t.setState(e.state,!0)}),[t,e.state]),ct((()=>{null!=e.draggable&&t.setDraggable(e.draggable)}),[t,e.draggable]),ct((()=>{null!=e.resizable&&t.setResizable(e.resizable)}),[t,e.resizable]),ct((()=>{null!=e.fence&&t.setFence(e.fence)}),[t,e.fence]),ct((()=>{null!=e.containerRect&&t.setContainerRect(e.containerRect)}),[t,e.containerRect]),ct((()=>{null!=e.fixRatio&&t.setFixRatio(e.fixRatio)}),[t,e.fixRatio]),a.useEffect((()=>{if(e.onResize)return t.events.on(exports.TELE_BOX_EVENT.Resize,e.onResize),()=>{t.events.off(exports.TELE_BOX_EVENT.Resize,e.onResize)}}),[t,e.onResize]),a.useEffect((()=>{if(e.onMove)return t.events.on(exports.TELE_BOX_EVENT.Move,e.onMove),()=>{t.events.off(exports.TELE_BOX_EVENT.Move,e.onMove)}}),[t,e.onMove]),a.useEffect((()=>{if(e.onClose)return t.events.on(exports.TELE_BOX_EVENT.Close,e.onClose),()=>{t.events.off(exports.TELE_BOX_EVENT.Close,e.onClose)}}),[t,e.onClose]),a.useEffect((()=>{if(e.onFocus)return t.events.on(exports.TELE_BOX_EVENT.Focus,e.onFocus),()=>{t.events.off(exports.TELE_BOX_EVENT.Focus,e.onFocus)}}),[t,e.onFocus]),a.useEffect((()=>{if(e.onBlur)return t.events.on(exports.TELE_BOX_EVENT.Blur,e.onBlur),()=>{t.events.off(exports.TELE_BOX_EVENT.Blur,e.onBlur)}}),[t,e.onBlur]),a.useEffect((()=>{if(e.onStateChanged)return t.events.on(exports.TELE_BOX_EVENT.State,e.onStateChanged),()=>{t.events.off(exports.TELE_BOX_EVENT.State,e.onStateChanged)}}),[t,e.onStateChanged]),h.default.createElement("div",{ref:e=>e&&t.render(e),className:t.wrapClassName("box")})};
|
|
16
16
|
//# sourceMappingURL=telebox-insider.cjs.js.map
|