@widget-js/core 0.1.15 → 0.1.16
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/cjs/api/BrowserWindowApi.js +13 -0
- package/dist/cjs/api/Channel.js +2 -0
- package/dist/cjs/api/NotificationApi.js +48 -15
- package/dist/cjs/api/WidgetApi.js +15 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/model/AppNotification.js +32 -0
- package/dist/cjs/model/WidgetPackage.js +3 -5
- package/dist/cjs/model/WidgetParams.js +6 -2
- package/dist/cjs/model/event/AppKeyboardEvent.js +2 -0
- package/dist/cjs/model/event/AppMouseEvent.js +2 -0
- package/dist/cjs/utils/UrlUtils.js +15 -0
- package/dist/esm/api/BrowserWindowApi.js +13 -0
- package/dist/esm/api/Channel.js +2 -0
- package/dist/esm/api/NotificationApi.js +48 -15
- package/dist/esm/api/WidgetApi.js +15 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/model/AppNotification.js +28 -0
- package/dist/esm/model/WidgetPackage.js +3 -5
- package/dist/esm/model/WidgetParams.js +6 -2
- package/dist/esm/model/event/AppKeyboardEvent.js +1 -0
- package/dist/esm/model/event/AppMouseEvent.js +1 -0
- package/dist/esm/utils/UrlUtils.js +15 -0
- package/dist/types/api/BrowserWindowApi.d.ts +7 -0
- package/dist/types/api/Channel.d.ts +2 -0
- package/dist/types/api/NotificationApi.d.ts +15 -3
- package/dist/types/api/WidgetApi.d.ts +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/model/AppNotification.d.ts +49 -0
- package/dist/types/model/WidgetPackage.d.ts +1 -1
- package/dist/types/model/event/AppKeyboardEvent.d.ts +16 -0
- package/dist/types/model/event/AppMouseEvent.d.ts +14 -0
- package/dist/types/utils/UrlUtils.d.ts +1 -0
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/model/Notification.js +0 -16
- package/dist/esm/model/Notification.js +0 -12
- package/dist/types/model/Notification.d.ts +0 -18
|
@@ -8,6 +8,18 @@ class BrowserWindowApi {
|
|
|
8
8
|
var _a;
|
|
9
9
|
await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.BROWSER_WINDOW, this.IGNORE_MOUSE_EVENT, ignore));
|
|
10
10
|
}
|
|
11
|
+
static async show() {
|
|
12
|
+
var _a;
|
|
13
|
+
await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, true));
|
|
14
|
+
}
|
|
15
|
+
static async hide() {
|
|
16
|
+
var _a;
|
|
17
|
+
await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, false));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
* @param show
|
|
22
|
+
*/
|
|
11
23
|
static async setWindowVisibility(show) {
|
|
12
24
|
var _a;
|
|
13
25
|
await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, show));
|
|
@@ -76,3 +88,4 @@ BrowserWindowApi.FOCUS = "focus";
|
|
|
76
88
|
BrowserWindowApi.SET_RESIZABLE = "set-resizable";
|
|
77
89
|
BrowserWindowApi.GET_BOUNDS = "get-bounds";
|
|
78
90
|
BrowserWindowApi.SET_BOUNDS = "set-bounds";
|
|
91
|
+
BrowserWindowApi.SHOW = "show";
|
package/dist/cjs/api/Channel.js
CHANGED
|
@@ -8,5 +8,7 @@ var Channel;
|
|
|
8
8
|
Channel["BROADCAST"] = "channel::cn.widgetjs.core.broadcast";
|
|
9
9
|
Channel["WIDGET"] = "channel::cn.widgetjs.core.widget";
|
|
10
10
|
Channel["APP"] = "channel::cn.widgetjs.core.app";
|
|
11
|
+
Channel["MOUSE_EVENT"] = "channel::cn.widgetjs.core.mouse_event";
|
|
12
|
+
Channel["KEYBOARD_EVENT"] = "channel::cn.widgetjs.core.keyboard_event";
|
|
11
13
|
Channel["DIALOG"] = "channel::cn.widgetjs.core.dialog";
|
|
12
14
|
})(Channel = exports.Channel || (exports.Channel = {}));
|
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotificationApi = void 0;
|
|
4
|
-
const
|
|
4
|
+
const AppNotification_1 = require("../model/AppNotification");
|
|
5
5
|
const Channel_1 = require("./Channel");
|
|
6
6
|
const ElectronUtils_1 = require("../utils/ElectronUtils");
|
|
7
7
|
class NotificationApi {
|
|
8
|
-
static async
|
|
8
|
+
// static async url(url: string, duration: number = -1) {
|
|
9
|
+
// ElectronUtils.getAPI()?.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
10
|
+
// url, message: "",
|
|
11
|
+
// duration,
|
|
12
|
+
// type: "url",
|
|
13
|
+
// }));
|
|
14
|
+
// }
|
|
15
|
+
/**
|
|
16
|
+
* 来电
|
|
17
|
+
* @param avatar 头像地址
|
|
18
|
+
* @param audio 音频地址
|
|
19
|
+
* @param title 标题文件
|
|
20
|
+
* @param message 初始消息
|
|
21
|
+
* @param lyric 歌词字符串
|
|
22
|
+
*/
|
|
23
|
+
static async call(avatar, audio, title, message, lyric) {
|
|
9
24
|
var _a;
|
|
10
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
11
|
-
|
|
25
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
26
|
+
avatar,
|
|
27
|
+
audio,
|
|
28
|
+
message,
|
|
29
|
+
title,
|
|
30
|
+
duration: -1,
|
|
31
|
+
lyric,
|
|
12
32
|
type: "call",
|
|
13
|
-
message: "下班提醒",
|
|
14
|
-
duration: duration
|
|
15
33
|
}));
|
|
16
34
|
}
|
|
17
35
|
static async advanceCountdown(message, targetTime, title) {
|
|
18
36
|
var _a;
|
|
19
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
37
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
20
38
|
title,
|
|
21
39
|
message,
|
|
22
40
|
targetTime,
|
|
@@ -25,18 +43,21 @@ class NotificationApi {
|
|
|
25
43
|
}
|
|
26
44
|
static async countdown(message, targetTime) {
|
|
27
45
|
var _a;
|
|
28
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
46
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
29
47
|
message,
|
|
30
48
|
targetTime,
|
|
49
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
50
|
+
duration: -1,
|
|
31
51
|
type: "countdown"
|
|
32
52
|
}));
|
|
33
53
|
}
|
|
34
54
|
static async success(message, duration = 5000) {
|
|
35
55
|
var _a;
|
|
36
56
|
if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
|
|
37
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
57
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
38
58
|
message,
|
|
39
59
|
type: "success",
|
|
60
|
+
icon: "check_circle_line",
|
|
40
61
|
duration
|
|
41
62
|
}));
|
|
42
63
|
}
|
|
@@ -47,9 +68,10 @@ class NotificationApi {
|
|
|
47
68
|
static async error(message, duration = 5000) {
|
|
48
69
|
var _a;
|
|
49
70
|
if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
|
|
50
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
71
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
51
72
|
message,
|
|
52
73
|
type: "error",
|
|
74
|
+
icon: "close_circle_line",
|
|
53
75
|
duration
|
|
54
76
|
}));
|
|
55
77
|
}
|
|
@@ -60,9 +82,10 @@ class NotificationApi {
|
|
|
60
82
|
static async warning(message, duration = 5000) {
|
|
61
83
|
var _a;
|
|
62
84
|
if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
|
|
63
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
85
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
64
86
|
message,
|
|
65
87
|
type: "warning",
|
|
88
|
+
icon: "warning_line",
|
|
66
89
|
duration
|
|
67
90
|
}));
|
|
68
91
|
}
|
|
@@ -70,17 +93,27 @@ class NotificationApi {
|
|
|
70
93
|
this.callback("warning", message, duration);
|
|
71
94
|
}
|
|
72
95
|
}
|
|
73
|
-
static async
|
|
96
|
+
static async info(message, duration = 5000) {
|
|
74
97
|
var _a;
|
|
75
98
|
if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
|
|
76
|
-
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new
|
|
99
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, new AppNotification_1.AppNotification({
|
|
77
100
|
message,
|
|
78
|
-
type: "
|
|
101
|
+
type: "info",
|
|
102
|
+
icon: "information_line",
|
|
79
103
|
duration
|
|
80
104
|
}));
|
|
81
105
|
}
|
|
82
106
|
else {
|
|
83
|
-
this.callback("
|
|
107
|
+
this.callback("info", message, duration);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 隐藏通知
|
|
112
|
+
*/
|
|
113
|
+
static async hide() {
|
|
114
|
+
var _a;
|
|
115
|
+
if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
|
|
116
|
+
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.NOTIFICATION, null);
|
|
84
117
|
}
|
|
85
118
|
}
|
|
86
119
|
static setDebugNotification(callback) {
|
|
@@ -74,6 +74,21 @@ class WidgetApi {
|
|
|
74
74
|
return null;
|
|
75
75
|
return UrlUtils_1.UrlUtils.getWidgetUrl(widget.configUrl, widgetPackage, widgetParams);
|
|
76
76
|
}
|
|
77
|
+
static async getWidgetUrl(widgetName, widgetParams) {
|
|
78
|
+
const widget = await this.getWidget(widgetName);
|
|
79
|
+
if (!widget || widget.configUrl == null)
|
|
80
|
+
return null;
|
|
81
|
+
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
82
|
+
if (!widgetPackage)
|
|
83
|
+
return null;
|
|
84
|
+
return UrlUtils_1.UrlUtils.getWidgetUrl(widget.url, widgetPackage, widgetParams);
|
|
85
|
+
}
|
|
86
|
+
static async getWidgetPackageUrl(packageName, hash) {
|
|
87
|
+
const widgetPackage = await this.getWidgetPackage(packageName);
|
|
88
|
+
if (!widgetPackage)
|
|
89
|
+
return null;
|
|
90
|
+
return widgetPackage.getFullUrl(hash);
|
|
91
|
+
}
|
|
77
92
|
/**
|
|
78
93
|
* 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
|
|
79
94
|
* @param data
|
package/dist/cjs/index.js
CHANGED
|
@@ -19,9 +19,11 @@ __exportStar(require("./model/event/BroadcastEvent"), exports);
|
|
|
19
19
|
__exportStar(require("./model/event/WebSocketEvent"), exports);
|
|
20
20
|
__exportStar(require("./model/WidgetData"), exports);
|
|
21
21
|
__exportStar(require("./model/WidgetParams"), exports);
|
|
22
|
-
__exportStar(require("./model/
|
|
22
|
+
__exportStar(require("./model/AppNotification"), exports);
|
|
23
23
|
__exportStar(require("./model/HostedMode"), exports);
|
|
24
24
|
__exportStar(require("./model/interface/Rectangle"), exports);
|
|
25
|
+
__exportStar(require("./model/event/AppKeyboardEvent"), exports);
|
|
26
|
+
__exportStar(require("./model/event/AppMouseEvent"), exports);
|
|
25
27
|
__exportStar(require("./model/WidgetPackage"), exports);
|
|
26
28
|
__exportStar(require("./api/ElectronApi"), exports);
|
|
27
29
|
__exportStar(require("./repository/WidgetDataRepository"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppNotification = exports.NotificationSize = void 0;
|
|
4
|
+
var NotificationSize;
|
|
5
|
+
(function (NotificationSize) {
|
|
6
|
+
NotificationSize["SMALL"] = "small";
|
|
7
|
+
NotificationSize["NORMAL"] = "normal";
|
|
8
|
+
NotificationSize["LARGE"] = "large";
|
|
9
|
+
})(NotificationSize = exports.NotificationSize || (exports.NotificationSize = {}));
|
|
10
|
+
class AppNotification {
|
|
11
|
+
constructor(option) {
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
|
+
this.type = "info";
|
|
14
|
+
this.type = (_a = option.type) !== null && _a !== void 0 ? _a : "info";
|
|
15
|
+
this.title = option.title;
|
|
16
|
+
this.message = option.message;
|
|
17
|
+
this.targetTime = option.targetTime;
|
|
18
|
+
this.duration = (_b = option.duration) !== null && _b !== void 0 ? _b : 5000;
|
|
19
|
+
this.icon = option.icon;
|
|
20
|
+
this.color = (_c = option.color) !== null && _c !== void 0 ? _c : "#5D8AC8";
|
|
21
|
+
this.confirmButtonText = option.confirmButtonText;
|
|
22
|
+
this.cancelButtonText = option.cancelButtonText;
|
|
23
|
+
this.cancelBroadcast = option.cancelBroadcast;
|
|
24
|
+
this.confirmBroadcast = option.confirmBroadcast;
|
|
25
|
+
this.size = (_d = option.size) !== null && _d !== void 0 ? _d : NotificationSize.NORMAL;
|
|
26
|
+
this.audio = option.audio;
|
|
27
|
+
this.avatar = option.avatar;
|
|
28
|
+
this.lyric = option.lyric;
|
|
29
|
+
this.backgroundColor = (_e = option.backgroundColor) !== null && _e !== void 0 ? _e : '#000000';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.AppNotification = AppNotification;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WidgetPackage = void 0;
|
|
4
|
+
const UrlUtils_1 = require("../utils/UrlUtils");
|
|
4
5
|
class WidgetPackage {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -22,11 +23,8 @@ class WidgetPackage {
|
|
|
22
23
|
* 如果url是http链接,直接返回链接
|
|
23
24
|
* 如果是本地组件:file://链接,则返回 url+entry,e.g. file://C:\users\neo\desktop\index.html#
|
|
24
25
|
*/
|
|
25
|
-
getFullUrl() {
|
|
26
|
-
|
|
27
|
-
return this.url;
|
|
28
|
-
}
|
|
29
|
-
return this.url + (this.entry.startsWith("/") ? this.entry : `/${this.entry}`);
|
|
26
|
+
getFullUrl(hash) {
|
|
27
|
+
return UrlUtils_1.UrlUtils.getWidgetPackageUrl(this.url, this.entry, hash == null ? this.hash : hash);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
exports.WidgetPackage = WidgetPackage;
|
|
@@ -35,8 +35,12 @@ class WidgetParams {
|
|
|
35
35
|
*/
|
|
36
36
|
static fromCurrentLocation() {
|
|
37
37
|
const href = window.location.href;
|
|
38
|
-
let
|
|
39
|
-
|
|
38
|
+
let strings = href.split("?");
|
|
39
|
+
if (strings.length > 1) {
|
|
40
|
+
let queryString = strings[1];
|
|
41
|
+
return this.fromObject((0, query_1.parseQuery)(queryString));
|
|
42
|
+
}
|
|
43
|
+
return new WidgetParams();
|
|
40
44
|
}
|
|
41
45
|
static setValue(widgetEnv, key, value) {
|
|
42
46
|
const keyWithoutPrefix = key.replace(this.PARAM_PREFIX, "");
|
|
@@ -17,5 +17,20 @@ class UrlUtils {
|
|
|
17
17
|
return url + "?" + widgetParams.toUrlParams().toString();
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
static getWidgetPackageUrl(url, entry, hash) {
|
|
21
|
+
const arr = [url];
|
|
22
|
+
if (url.startsWith("http")) {
|
|
23
|
+
if (hash) {
|
|
24
|
+
arr.push(url.endsWith("/") ? "#" : "/#");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
arr.push(entry.startsWith("/") ? entry : `/${entry}`);
|
|
29
|
+
if (hash) {
|
|
30
|
+
arr.push(url.endsWith("#") ? "" : "#");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return arr.join("");
|
|
34
|
+
}
|
|
20
35
|
}
|
|
21
36
|
exports.UrlUtils = UrlUtils;
|
|
@@ -5,6 +5,18 @@ export class BrowserWindowApi {
|
|
|
5
5
|
var _a;
|
|
6
6
|
await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.BROWSER_WINDOW, this.IGNORE_MOUSE_EVENT, ignore));
|
|
7
7
|
}
|
|
8
|
+
static async show() {
|
|
9
|
+
var _a;
|
|
10
|
+
await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, true));
|
|
11
|
+
}
|
|
12
|
+
static async hide() {
|
|
13
|
+
var _a;
|
|
14
|
+
await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, false));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
* @param show
|
|
19
|
+
*/
|
|
8
20
|
static async setWindowVisibility(show) {
|
|
9
21
|
var _a;
|
|
10
22
|
await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.BROWSER_WINDOW, this.WINDOW_VISIBILITY, show));
|
|
@@ -72,3 +84,4 @@ BrowserWindowApi.FOCUS = "focus";
|
|
|
72
84
|
BrowserWindowApi.SET_RESIZABLE = "set-resizable";
|
|
73
85
|
BrowserWindowApi.GET_BOUNDS = "get-bounds";
|
|
74
86
|
BrowserWindowApi.SET_BOUNDS = "set-bounds";
|
|
87
|
+
BrowserWindowApi.SHOW = "show";
|
package/dist/esm/api/Channel.js
CHANGED
|
@@ -5,5 +5,7 @@ export var Channel;
|
|
|
5
5
|
Channel["BROADCAST"] = "channel::cn.widgetjs.core.broadcast";
|
|
6
6
|
Channel["WIDGET"] = "channel::cn.widgetjs.core.widget";
|
|
7
7
|
Channel["APP"] = "channel::cn.widgetjs.core.app";
|
|
8
|
+
Channel["MOUSE_EVENT"] = "channel::cn.widgetjs.core.mouse_event";
|
|
9
|
+
Channel["KEYBOARD_EVENT"] = "channel::cn.widgetjs.core.keyboard_event";
|
|
8
10
|
Channel["DIALOG"] = "channel::cn.widgetjs.core.dialog";
|
|
9
11
|
})(Channel || (Channel = {}));
|
|
@@ -1,19 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppNotification } from "../model/AppNotification";
|
|
2
2
|
import { Channel } from "./Channel";
|
|
3
3
|
import { ElectronUtils } from "../utils/ElectronUtils";
|
|
4
4
|
export class NotificationApi {
|
|
5
|
-
static async
|
|
5
|
+
// static async url(url: string, duration: number = -1) {
|
|
6
|
+
// ElectronUtils.getAPI()?.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
7
|
+
// url, message: "",
|
|
8
|
+
// duration,
|
|
9
|
+
// type: "url",
|
|
10
|
+
// }));
|
|
11
|
+
// }
|
|
12
|
+
/**
|
|
13
|
+
* 来电
|
|
14
|
+
* @param avatar 头像地址
|
|
15
|
+
* @param audio 音频地址
|
|
16
|
+
* @param title 标题文件
|
|
17
|
+
* @param message 初始消息
|
|
18
|
+
* @param lyric 歌词字符串
|
|
19
|
+
*/
|
|
20
|
+
static async call(avatar, audio, title, message, lyric) {
|
|
6
21
|
var _a;
|
|
7
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
8
|
-
|
|
22
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
23
|
+
avatar,
|
|
24
|
+
audio,
|
|
25
|
+
message,
|
|
26
|
+
title,
|
|
27
|
+
duration: -1,
|
|
28
|
+
lyric,
|
|
9
29
|
type: "call",
|
|
10
|
-
message: "下班提醒",
|
|
11
|
-
duration: duration
|
|
12
30
|
}));
|
|
13
31
|
}
|
|
14
32
|
static async advanceCountdown(message, targetTime, title) {
|
|
15
33
|
var _a;
|
|
16
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
34
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
17
35
|
title,
|
|
18
36
|
message,
|
|
19
37
|
targetTime,
|
|
@@ -22,18 +40,21 @@ export class NotificationApi {
|
|
|
22
40
|
}
|
|
23
41
|
static async countdown(message, targetTime) {
|
|
24
42
|
var _a;
|
|
25
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
43
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
26
44
|
message,
|
|
27
45
|
targetTime,
|
|
46
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
47
|
+
duration: -1,
|
|
28
48
|
type: "countdown"
|
|
29
49
|
}));
|
|
30
50
|
}
|
|
31
51
|
static async success(message, duration = 5000) {
|
|
32
52
|
var _a;
|
|
33
53
|
if (ElectronUtils.hasElectronApi()) {
|
|
34
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
54
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
35
55
|
message,
|
|
36
56
|
type: "success",
|
|
57
|
+
icon: "check_circle_line",
|
|
37
58
|
duration
|
|
38
59
|
}));
|
|
39
60
|
}
|
|
@@ -44,9 +65,10 @@ export class NotificationApi {
|
|
|
44
65
|
static async error(message, duration = 5000) {
|
|
45
66
|
var _a;
|
|
46
67
|
if (ElectronUtils.hasElectronApi()) {
|
|
47
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
68
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
48
69
|
message,
|
|
49
70
|
type: "error",
|
|
71
|
+
icon: "close_circle_line",
|
|
50
72
|
duration
|
|
51
73
|
}));
|
|
52
74
|
}
|
|
@@ -57,9 +79,10 @@ export class NotificationApi {
|
|
|
57
79
|
static async warning(message, duration = 5000) {
|
|
58
80
|
var _a;
|
|
59
81
|
if (ElectronUtils.hasElectronApi()) {
|
|
60
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
82
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
61
83
|
message,
|
|
62
84
|
type: "warning",
|
|
85
|
+
icon: "warning_line",
|
|
63
86
|
duration
|
|
64
87
|
}));
|
|
65
88
|
}
|
|
@@ -67,17 +90,27 @@ export class NotificationApi {
|
|
|
67
90
|
this.callback("warning", message, duration);
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
|
-
static async
|
|
93
|
+
static async info(message, duration = 5000) {
|
|
71
94
|
var _a;
|
|
72
95
|
if (ElectronUtils.hasElectronApi()) {
|
|
73
|
-
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new
|
|
96
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
74
97
|
message,
|
|
75
|
-
type: "
|
|
98
|
+
type: "info",
|
|
99
|
+
icon: "information_line",
|
|
76
100
|
duration
|
|
77
101
|
}));
|
|
78
102
|
}
|
|
79
103
|
else {
|
|
80
|
-
this.callback("
|
|
104
|
+
this.callback("info", message, duration);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 隐藏通知
|
|
109
|
+
*/
|
|
110
|
+
static async hide() {
|
|
111
|
+
var _a;
|
|
112
|
+
if (ElectronUtils.hasElectronApi()) {
|
|
113
|
+
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.NOTIFICATION, null);
|
|
81
114
|
}
|
|
82
115
|
}
|
|
83
116
|
static setDebugNotification(callback) {
|
|
@@ -68,6 +68,21 @@ export class WidgetApi {
|
|
|
68
68
|
return null;
|
|
69
69
|
return UrlUtils.getWidgetUrl(widget.configUrl, widgetPackage, widgetParams);
|
|
70
70
|
}
|
|
71
|
+
static async getWidgetUrl(widgetName, widgetParams) {
|
|
72
|
+
const widget = await this.getWidget(widgetName);
|
|
73
|
+
if (!widget || widget.configUrl == null)
|
|
74
|
+
return null;
|
|
75
|
+
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
76
|
+
if (!widgetPackage)
|
|
77
|
+
return null;
|
|
78
|
+
return UrlUtils.getWidgetUrl(widget.url, widgetPackage, widgetParams);
|
|
79
|
+
}
|
|
80
|
+
static async getWidgetPackageUrl(packageName, hash) {
|
|
81
|
+
const widgetPackage = await this.getWidgetPackage(packageName);
|
|
82
|
+
if (!widgetPackage)
|
|
83
|
+
return null;
|
|
84
|
+
return widgetPackage.getFullUrl(hash);
|
|
85
|
+
}
|
|
71
86
|
/**
|
|
72
87
|
* 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
|
|
73
88
|
* @param data
|
package/dist/esm/index.js
CHANGED
|
@@ -3,9 +3,11 @@ export * from "./model/event/BroadcastEvent";
|
|
|
3
3
|
export * from "./model/event/WebSocketEvent";
|
|
4
4
|
export * from "./model/WidgetData";
|
|
5
5
|
export * from "./model/WidgetParams";
|
|
6
|
-
export * from "./model/
|
|
6
|
+
export * from "./model/AppNotification";
|
|
7
7
|
export * from "./model/HostedMode";
|
|
8
8
|
export * from "./model/interface/Rectangle";
|
|
9
|
+
export * from "./model/event/AppKeyboardEvent";
|
|
10
|
+
export * from "./model/event/AppMouseEvent";
|
|
9
11
|
export * from "./model/WidgetPackage";
|
|
10
12
|
export * from "./api/ElectronApi";
|
|
11
13
|
export * from "./repository/WidgetDataRepository";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var NotificationSize;
|
|
2
|
+
(function (NotificationSize) {
|
|
3
|
+
NotificationSize["SMALL"] = "small";
|
|
4
|
+
NotificationSize["NORMAL"] = "normal";
|
|
5
|
+
NotificationSize["LARGE"] = "large";
|
|
6
|
+
})(NotificationSize || (NotificationSize = {}));
|
|
7
|
+
export class AppNotification {
|
|
8
|
+
constructor(option) {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
this.type = "info";
|
|
11
|
+
this.type = (_a = option.type) !== null && _a !== void 0 ? _a : "info";
|
|
12
|
+
this.title = option.title;
|
|
13
|
+
this.message = option.message;
|
|
14
|
+
this.targetTime = option.targetTime;
|
|
15
|
+
this.duration = (_b = option.duration) !== null && _b !== void 0 ? _b : 5000;
|
|
16
|
+
this.icon = option.icon;
|
|
17
|
+
this.color = (_c = option.color) !== null && _c !== void 0 ? _c : "#5D8AC8";
|
|
18
|
+
this.confirmButtonText = option.confirmButtonText;
|
|
19
|
+
this.cancelButtonText = option.cancelButtonText;
|
|
20
|
+
this.cancelBroadcast = option.cancelBroadcast;
|
|
21
|
+
this.confirmBroadcast = option.confirmBroadcast;
|
|
22
|
+
this.size = (_d = option.size) !== null && _d !== void 0 ? _d : NotificationSize.NORMAL;
|
|
23
|
+
this.audio = option.audio;
|
|
24
|
+
this.avatar = option.avatar;
|
|
25
|
+
this.lyric = option.lyric;
|
|
26
|
+
this.backgroundColor = (_e = option.backgroundColor) !== null && _e !== void 0 ? _e : '#000000';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UrlUtils } from "../utils/UrlUtils";
|
|
1
2
|
export class WidgetPackage {
|
|
2
3
|
constructor() {
|
|
3
4
|
/**
|
|
@@ -19,10 +20,7 @@ export class WidgetPackage {
|
|
|
19
20
|
* 如果url是http链接,直接返回链接
|
|
20
21
|
* 如果是本地组件:file://链接,则返回 url+entry,e.g. file://C:\users\neo\desktop\index.html#
|
|
21
22
|
*/
|
|
22
|
-
getFullUrl() {
|
|
23
|
-
|
|
24
|
-
return this.url;
|
|
25
|
-
}
|
|
26
|
-
return this.url + (this.entry.startsWith("/") ? this.entry : `/${this.entry}`);
|
|
23
|
+
getFullUrl(hash) {
|
|
24
|
+
return UrlUtils.getWidgetPackageUrl(this.url, this.entry, hash == null ? this.hash : hash);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
@@ -32,8 +32,12 @@ export class WidgetParams {
|
|
|
32
32
|
*/
|
|
33
33
|
static fromCurrentLocation() {
|
|
34
34
|
const href = window.location.href;
|
|
35
|
-
let
|
|
36
|
-
|
|
35
|
+
let strings = href.split("?");
|
|
36
|
+
if (strings.length > 1) {
|
|
37
|
+
let queryString = strings[1];
|
|
38
|
+
return this.fromObject(parseQuery(queryString));
|
|
39
|
+
}
|
|
40
|
+
return new WidgetParams();
|
|
37
41
|
}
|
|
38
42
|
static setValue(widgetEnv, key, value) {
|
|
39
43
|
const keyWithoutPrefix = key.replace(this.PARAM_PREFIX, "");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,4 +14,19 @@ export class UrlUtils {
|
|
|
14
14
|
return url + "?" + widgetParams.toUrlParams().toString();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
static getWidgetPackageUrl(url, entry, hash) {
|
|
18
|
+
const arr = [url];
|
|
19
|
+
if (url.startsWith("http")) {
|
|
20
|
+
if (hash) {
|
|
21
|
+
arr.push(url.endsWith("/") ? "#" : "/#");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
arr.push(entry.startsWith("/") ? entry : `/${entry}`);
|
|
26
|
+
if (hash) {
|
|
27
|
+
arr.push(url.endsWith("#") ? "" : "#");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return arr.join("");
|
|
31
|
+
}
|
|
17
32
|
}
|
|
@@ -16,7 +16,14 @@ export declare class BrowserWindowApi {
|
|
|
16
16
|
static readonly SET_RESIZABLE = "set-resizable";
|
|
17
17
|
static readonly GET_BOUNDS = "get-bounds";
|
|
18
18
|
static readonly SET_BOUNDS = "set-bounds";
|
|
19
|
+
static readonly SHOW = "show";
|
|
19
20
|
static setIgnoreMouseEvent(ignore: boolean): Promise<void>;
|
|
21
|
+
static show(): Promise<void>;
|
|
22
|
+
static hide(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
* @param show
|
|
26
|
+
*/
|
|
20
27
|
static setWindowVisibility(show: boolean): Promise<void>;
|
|
21
28
|
static setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
|
|
22
29
|
static isAlwaysOnTop(): Promise<boolean>;
|
|
@@ -4,5 +4,7 @@ export declare enum Channel {
|
|
|
4
4
|
BROADCAST = "channel::cn.widgetjs.core.broadcast",
|
|
5
5
|
WIDGET = "channel::cn.widgetjs.core.widget",
|
|
6
6
|
APP = "channel::cn.widgetjs.core.app",
|
|
7
|
+
MOUSE_EVENT = "channel::cn.widgetjs.core.mouse_event",
|
|
8
|
+
KEYBOARD_EVENT = "channel::cn.widgetjs.core.keyboard_event",
|
|
7
9
|
DIALOG = "channel::cn.widgetjs.core.dialog"
|
|
8
10
|
}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import { NotificationType } from "../model/
|
|
1
|
+
import { NotificationType } from "../model/AppNotification";
|
|
2
2
|
type NotificationCallback = (type: NotificationType, message: string, duration: number) => void;
|
|
3
3
|
export declare class NotificationApi {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 来电
|
|
6
|
+
* @param avatar 头像地址
|
|
7
|
+
* @param audio 音频地址
|
|
8
|
+
* @param title 标题文件
|
|
9
|
+
* @param message 初始消息
|
|
10
|
+
* @param lyric 歌词字符串
|
|
11
|
+
*/
|
|
12
|
+
static call(avatar: string, audio: string, title: string, message: string, lyric: string): Promise<void>;
|
|
5
13
|
static advanceCountdown(message: string, targetTime: string, title?: string): Promise<void>;
|
|
6
14
|
static countdown(message: string, targetTime: string): Promise<void>;
|
|
7
15
|
static success(message: string, duration?: number): Promise<void>;
|
|
8
16
|
static error(message: string, duration?: number): Promise<void>;
|
|
9
17
|
static warning(message: string, duration?: number): Promise<void>;
|
|
10
|
-
static
|
|
18
|
+
static info(message: string, duration?: number): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 隐藏通知
|
|
21
|
+
*/
|
|
22
|
+
static hide(): Promise<void>;
|
|
11
23
|
private static callback;
|
|
12
24
|
static setDebugNotification(callback: NotificationCallback): void;
|
|
13
25
|
}
|
|
@@ -38,6 +38,8 @@ export declare class WidgetApi {
|
|
|
38
38
|
* @param widgetName
|
|
39
39
|
*/
|
|
40
40
|
static getWidgetConfigUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
41
|
+
static getWidgetUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
42
|
+
static getWidgetPackageUrl(packageName: string, hash?: boolean): Promise<string | null>;
|
|
41
43
|
/**
|
|
42
44
|
* 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
|
|
43
45
|
* @param data
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export * from "./model/event/BroadcastEvent";
|
|
|
3
3
|
export * from "./model/event/WebSocketEvent";
|
|
4
4
|
export * from "./model/WidgetData";
|
|
5
5
|
export * from "./model/WidgetParams";
|
|
6
|
-
export * from "./model/
|
|
6
|
+
export * from "./model/AppNotification";
|
|
7
7
|
export * from "./model/HostedMode";
|
|
8
8
|
export * from "./model/interface/Rectangle";
|
|
9
|
+
export * from "./model/event/AppKeyboardEvent";
|
|
10
|
+
export * from "./model/event/AppMouseEvent";
|
|
9
11
|
export * from "./model/WidgetPackage";
|
|
10
12
|
export * from "./api/ElectronApi";
|
|
11
13
|
export * from "./repository/WidgetDataRepository";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type NotificationType = "countdown" | "advance-countdown" | "error" | "success" | "warning" | "info" | "reminder" | "url" | "call";
|
|
2
|
+
export declare enum NotificationSize {
|
|
3
|
+
SMALL = "small",
|
|
4
|
+
NORMAL = "normal",
|
|
5
|
+
LARGE = "large"
|
|
6
|
+
}
|
|
7
|
+
export interface NotificationOption {
|
|
8
|
+
type?: NotificationType;
|
|
9
|
+
title?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
targetTime?: string;
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 图片名,目前只支持mingcute图标。
|
|
15
|
+
* https://www.mingcute.com/
|
|
16
|
+
*/
|
|
17
|
+
icon?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
confirmButtonText?: string;
|
|
20
|
+
cancelButtonText?: string;
|
|
21
|
+
cancelBroadcast?: string;
|
|
22
|
+
confirmBroadcast?: string;
|
|
23
|
+
size?: NotificationSize;
|
|
24
|
+
url?: string;
|
|
25
|
+
avatar?: string;
|
|
26
|
+
audio?: string;
|
|
27
|
+
lyric?: string;
|
|
28
|
+
backgroundColor?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class AppNotification {
|
|
31
|
+
type: NotificationType;
|
|
32
|
+
message: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
targetTime?: string;
|
|
35
|
+
duration: number;
|
|
36
|
+
icon?: string;
|
|
37
|
+
color?: string;
|
|
38
|
+
backgroundColor?: string;
|
|
39
|
+
confirmButtonText?: string;
|
|
40
|
+
cancelButtonText?: string;
|
|
41
|
+
cancelBroadcast?: string;
|
|
42
|
+
confirmBroadcast?: string;
|
|
43
|
+
size: NotificationSize;
|
|
44
|
+
url?: string;
|
|
45
|
+
avatar?: string;
|
|
46
|
+
audio?: string;
|
|
47
|
+
lyric?: string;
|
|
48
|
+
constructor(option: NotificationOption);
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AppKeyboardEvent {
|
|
2
|
+
scanCode: number;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
isKeyDown: boolean;
|
|
5
|
+
isKeyUp: boolean;
|
|
6
|
+
isExtendedKey: boolean;
|
|
7
|
+
alt: boolean;
|
|
8
|
+
control: boolean;
|
|
9
|
+
handled: boolean;
|
|
10
|
+
keyCode: number;
|
|
11
|
+
keyValue: number;
|
|
12
|
+
keyData: number;
|
|
13
|
+
modifiers: number;
|
|
14
|
+
shift: boolean;
|
|
15
|
+
suppressKeyPress: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AppMouseEvent {
|
|
2
|
+
handled: boolean;
|
|
3
|
+
wheelScrolled: boolean;
|
|
4
|
+
clicked: boolean;
|
|
5
|
+
isMouseButtonDown: boolean;
|
|
6
|
+
isMouseButtonUp: boolean;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
button: number;
|
|
9
|
+
clicks: number;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
delta: number;
|
|
13
|
+
location: string;
|
|
14
|
+
}
|
|
@@ -2,4 +2,5 @@ import { WidgetPackage } from "../model/WidgetPackage";
|
|
|
2
2
|
import { WidgetParams } from "../model/WidgetParams";
|
|
3
3
|
export declare class UrlUtils {
|
|
4
4
|
static getWidgetUrl(widgetUrl: string, widgetPackage: WidgetPackage, widgetParams: WidgetParams): string;
|
|
5
|
+
static getWidgetPackageUrl(url: string, entry: string, hash: boolean): string;
|
|
5
6
|
}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.exampleTypescriptPackage=t():e.exampleTypescriptPackage=t()}(this,(()=>(()=>{var e={275:(e,t,n)=>{"use strict";n.r(t),n.d(t,{camelCase:()=>h,camelCaseTransform:()=>f,camelCaseTransformMerge:()=>v,capitalCase:()=>y,capitalCaseTransform:()=>g,constantCase:()=>m,dotCase:()=>b,headerCase:()=>I,noCase:()=>s,paramCase:()=>E,pascalCase:()=>d,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>l,pathCase:()=>A,sentenceCase:()=>O,sentenceCaseTransform:()=>w,snakeCase:()=>P});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e){return e.toLowerCase()}Object.create,Object.create;var i=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],a=/[^A-Z0-9]+/gi;function s(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?i:n,s=t.stripRegexp,u=void 0===s?a:s,l=t.transform,d=void 0===l?o:l,f=t.delimiter,v=void 0===f?" ":f,h=c(c(e,r,"$1\0$2"),u,"\0"),p=0,g=h.length;"\0"===h.charAt(p);)p++;for(;"\0"===h.charAt(g-1);)g--;return h.slice(p,g).split("\0").map(d).join(v)}function c(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function u(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>="0"&&n<="9"?"_"+n+r:""+n.toUpperCase()+r}function l(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function d(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"",transform:u},t))}function f(e,t){return 0===t?e.toLowerCase():u(e,t)}function v(e,t){return 0===t?e.toLowerCase():l(e)}function h(e,t){return void 0===t&&(t={}),d(e,r({transform:f},t))}function p(e){return e.charAt(0).toUpperCase()+e.substr(1)}function g(e){return p(e.toLowerCase())}function y(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:g},t))}function _(e){return e.toUpperCase()}function m(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:_},t))}function b(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function I(e,t){return void 0===t&&(t={}),y(e,r({delimiter:"-"},t))}function E(e,t){return void 0===t&&(t={}),b(e,r({delimiter:"-"},t))}function A(e,t){return void 0===t&&(t={}),b(e,r({delimiter:"/"},t))}function w(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function O(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:w},t))}function P(e,t){return void 0===t&&(t={}),b(e,r({delimiter:"_"},t))}},680:(e,t,n)=>{e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var i=void 0,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,r){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(l),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var c=new e.MessageChannel;c.port1.onmessage=l,n=function(){c.port2.postMessage(0)}}var u=[];function l(){var e,t;r=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function l(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)}))}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function v(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h((function(){t(o,r)}));"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==c?d(n,this.state===s?e:t,this.outcome):this.queue.push(new l(n,e,t)),n},l.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){i.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(f,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=s,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},u.reject=function(e){var t=new this(o);return i.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),s=0,c=-1,u=new this(o);++c<n;)l(e[c],c);return u;function l(e,o){t.resolve(e).then((function(e){a[o]=e,++s!==n||r||(r=!0,i.resolve(u,a))}),(function(e){r||(r=!0,i.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,r=e.length,a=!1;if(!r)return this.resolve([]);for(var s=-1,c=new this(o);++s<r;)n=e[s],t.resolve(n).then((function(e){a||(a=!0,i.resolve(c,e))}),(function(e){a||(a=!0,i.reject(c,e))}));return c}},{1:1}],3:[function(e,t,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function l(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",f=void 0,v={},h=Object.prototype.toString,p="readonly",g="readwrite";function y(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function _(e){return"boolean"==typeof f?a.resolve(f):function(e){return new a((function(t){var n=e.transaction(d,g),r=i([""]);n.objectStore(d).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return f=e}))}function m(e){var t=v[e.name],n={};n.promise=new a((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function b(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function I(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function E(e,t){return new a((function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(d)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},n(t),b(e)}}))}function A(e){return E(e,!1)}function w(e){return E(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function P(e){return i([y(atob(e.data))],{type:e.type})}function S(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,n=t._initReady().then((function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function N(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),w(e)})).then((function(){return function(e){m(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,A(e).then((function(t){return e.db=t,O(e)?w(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw I(e,t),t}))}(e).then((function(){N(e,t,n,r-1)}))})).catch(n);n(o)}}var R={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},v[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=T);var i=[];function s(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var u=o.forages[c];u!==t&&i.push(u._initReady().catch(s))}var l=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,A(n)})).then((function(e){return n.db=e,O(n,t._defaultConfig.version)?w(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<l.length;r++){var i=l[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}}))},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;S(r)&&(r=P(r));var o=e(r,n.key,s++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),S(e)&&(e=P(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=new a((function(n,o){var i;r.ready().then((function(){return i=r._dbInfo,"[object Blob]"===h.call(t)?_(i.db).then((function(e){return e?t:(n=t,new a((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){N(r._dbInfo,g,(function(i,a){if(i)return o(i);try{var s=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=c.error?c.error:c.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,g,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,g,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=i.error?i.error:i.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){e<0?t(null):n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),s=!1,c=a.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||s?t(n.key):(s=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=l.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var c=e.name===n.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):A(e).then((function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));r=e.storeName?c.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=v[e.name],i=r.forages;t.close();for(var s=0;s<i.length;s++){var c=i[s];c._dbInfo.db=null,c._dbInfo.version=n}var u=new a((function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}));return u.then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,b(n._dbInfo)}})).catch((function(t){throw(I(e,t)||a.resolve()).catch((function(){})),t}))}})):c.then((function(t){m(e);var n=v[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;var s=new a((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=function(){var e=r.result;e&&e.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<r.length;t++)b(r[t]._dbInfo)})).catch((function(t){throw(I(e,t)||a.resolve()).catch((function(){})),t}))}))}else r=a.reject("Invalid arguments");return s(r,t),r}};var D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",M=W.length,j="arbf",U="blob",k="si08",B="ui08",L="uic8",G="si16",x="si32",F="ur16",H="ui32",z="fl32",K="fl64",V=M+j.length,J=Object.prototype.toString;function Y(e){var t,n,r,o,i,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),l=new Uint8Array(u);for(t=0;t<s;t+=4)n=D.indexOf(e[t]),r=D.indexOf(e[t+1]),o=D.indexOf(e[t+2]),i=D.indexOf(e[t+3]),l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|o>>2,l[c++]=(3&o)<<6|63&i;return u}function Q(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=D[n[t]>>2],r+=D[(3&n[t])<<4|n[t+1]>>4],r+=D[(15&n[t+1])<<2|n[t+2]>>6],r+=D[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var X={serialize:function(e,t){var n="";if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=W;e instanceof ArrayBuffer?(r=e,o+=j):(r=e.buffer,"[object Int8Array]"===n?o+=k:"[object Uint8Array]"===n?o+=B:"[object Uint8ClampedArray]"===n?o+=L:"[object Int16Array]"===n?o+=G:"[object Uint16Array]"===n?o+=F:"[object Int32Array]"===n?o+=x:"[object Uint32Array]"===n?o+=H:"[object Float32Array]"===n?o+=z:"[object Float64Array]"===n?o+=K:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+Q(this.result);t(W+U+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,M)!==W)return JSON.parse(e);var t,n=e.substring(V),r=e.substring(M,V);if(r===U&&C.test(n)){var o=n.match(C);t=o[1],n=n.substring(o[0].length)}var a=Y(n);switch(r){case j:return a;case U:return i([a],{type:t});case k:return new Int8Array(a);case B:return new Uint8Array(a);case L:return new Uint8ClampedArray(a);case G:return new Int16Array(a);case F:return new Uint16Array(a);case x:return new Int32Array(a);case H:return new Uint32Array(a);case z:return new Float32Array(a);case K:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:Y,bufferToString:Q};function q(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Z(e,t,n,r,o,i){e.executeSql(n,r,o,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?i(e,a):q(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function $(e,t,n,r){var o=this;e=u(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var s=t,c=o._dbInfo;c.serializer.serialize(t,(function(t,u){u?a(u):c.db.transaction((function(n){Z(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(s)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i($.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}function ee(e){return new a((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var te={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){q(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var i=r.rows,a=i.length,s=0;s<a;s++){var c=i.item(s),u=c.value;if(u&&(u=o.serializer.deserialize(u)),void 0!==(u=e(u,c.key,s+1)))return void t(u)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){return $.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=l.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return s(r=e.name?new a((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(ee(r))})).then((function(e){return new a((function(t,n){e.db.transaction((function(r){function o(e){return new a((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var i=[],s=0,c=e.storeNames.length;s<c;s++)i.push(o(e.storeNames[s]));a.all(i).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):a.reject("Invalid arguments"),t),r}};function ne(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function re(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var oe={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ne(e,this._defaultConfig),re()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s<i;s++){var c=localStorage.key(s);if(0===c.indexOf(r)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(o),a++)))return u}}}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new a((function(o,i){var a=r._dbInfo;a.serializer.serialize(t,(function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return s(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return s(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}));return s(n,e),n},dropInstance:function(e,t){if(t=l.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return r=e.name?new a((function(t){e.storeName?t(ne(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):a.reject("Invalid arguments"),s(r,t),r}},ie=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;r++}var o,i;return!1},ae=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},se={},ce={},ue={INDEXEDDB:R,WEBSQL:te,LOCALSTORAGE:oe},le=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],de=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(de),ve={description:"",driver:le.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function he(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function pe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(ae(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ge=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,se[o]||this.defineDriver(r)}this._defaultConfig=pe({},ve),this._config=pe({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=fe.concat("_initStorage"),c=0,u=i.length;c<u;c++){var l=i[c];if((!ie(de,l)||e[l])&&"function"!=typeof e[l])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return s(n,arguments[arguments.length-1]),n}},n=0,r=de.length;n<r;n++){var o=de[n];e[o]||(e[o]=t(o))}}();var d=function(n){se[r]&&console.info("Redefining LocalForage driver: "+r),se[r]=e,ce[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=se[e]?a.resolve(se[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;ae(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function s(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return a.resolve()})):a.resolve();return this._driverSet=u.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(s).catch(n)}i();var c=new Error("No available storage method found.");return r._driverSet=a.reject(c),r._driverSet}()}}(o)}))})).catch((function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ce[e]},e.prototype._extend=function(e){pe(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=fe.length;e<t;e++)he(this,fe[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ye=new ge;t.exports=ye},{3:3}]},{},[4])(4)},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiConstants=void 0;class n{}t.ApiConstants=n,n.CONFIG_LAUNCH_AT_STARTUP="CONFIG_LAUNCH_AT_STARTUP",n.CONFIG_WIDGET_TITLE_COLOR="CONFIG_WIDGET_TITLE_COLOR"},445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppApi=void 0;const r=n(990),o=n(841);class i{static async setConfig(e,t){var n;await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.APP,this.SET_CONFIG,e,t))}static async getConfig(e,t){var n;const i=await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.APP,this.GET_CONFIG,e));return null==i?t:"boolean"==typeof t?"true"===i:i}static openAddWidgetWindow(){var e;null===(e=r.ElectronUtils.getAPI())||void 0===e||e.invoke(o.Channel.APP,this.OPEN_ADD_WIDGET_WINDOW)}static openSettingWindow(){var e;null===(e=r.ElectronUtils.getAPI())||void 0===e||e.invoke(o.Channel.APP,this.OPEN_SETTING_WINDOW)}}t.AppApi=i,i.SET_CONFIG="SET_CONFIG",i.GET_CONFIG="GET_CONFIG",i.OPEN_ADD_WIDGET_WINDOW="open-add-widget-window",i.OPEN_SETTING_WINDOW="open-setting-window"},969:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastApi=void 0;const r=n(990),o=n(841),i=n(295);t.BroadcastApi=class{static async sendBroadcastEvent(e){var t;await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.BROADCAST,JSON.stringify(e)))}static async registerBroadcast(e){await i.ElectronApi.addIpcListener(o.Channel.BROADCAST,(t=>{e(JSON.parse(t))}))}static async unregisterBroadcast(){await i.ElectronApi.removeIpcListener(o.Channel.BROADCAST)}}},194:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserWindowApi=void 0;const r=n(841),o=n(990);class i{static async setIgnoreMouseEvent(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.IGNORE_MOUSE_EVENT,e))}static async setWindowVisibility(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.WINDOW_VISIBILITY,e))}static async setAlwaysOnTop(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.ALWAYS_ON_TOP,e))}static async isAlwaysOnTop(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.IS_ALWAYS_ON_TOP))}static async openUrl(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.OPEN_URL,e))}static async setPosition(e,t,n){var i;await(null===(i=o.ElectronUtils.getAPI())||void 0===i?void 0:i.invoke(r.Channel.BROWSER_WINDOW,this.SET_POSITION,e,t,n))}static async getPosition(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.GET_POSITION))}static async blur(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.BLUR))}static async focus(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.FOCUS))}static async setResizable(e){var t;return await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.SET_RESIZABLE,e))}static async getBounds(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.GET_BOUNDS))}static async setBounds(e,t){var n;return await(null===(n=o.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(r.Channel.BROWSER_WINDOW,this.SET_BOUNDS,e,t))}}t.BrowserWindowApi=i,i.IGNORE_MOUSE_EVENT="ignore-mouse-event",i.WINDOW_VISIBILITY="window-visibility",i.ALWAYS_ON_TOP="always-on-top",i.IS_ALWAYS_ON_TOP="is-always-on-top",i.OPEN_URL="open-url",i.SET_POSITION="set-position",i.GET_POSITION="get-position",i.BLUR="blur",i.FOCUS="focus",i.SET_RESIZABLE="set-resizable",i.GET_BOUNDS="get-bounds",i.SET_BOUNDS="set-bounds"},841:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0,(n=t.Channel||(t.Channel={})).NOTIFICATION="channel::cn.widgetjs.core.notification",n.BROWSER_WINDOW="channel::cn.widgetjs.core.browser_window",n.BROADCAST="channel::cn.widgetjs.core.broadcast",n.WIDGET="channel::cn.widgetjs.core.widget",n.APP="channel::cn.widgetjs.core.app",n.DIALOG="channel::cn.widgetjs.core.dialog"},24:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogApi=void 0;const r=n(990),o=n(841);class i{static async pickFile(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.DIALOG,this.PICK_FILE,e))}}t.DialogApi=i,i.PICK_FILE="pick-file"},295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronApi=void 0;const r=n(990);t.ElectronApi=class{static async addIpcListener(e,t){var n;await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.addIpcListener(e,t))}static async removeIpcListener(e){var t;await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.removeIpcListener(e))}}},717:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationApi=void 0;const r=n(771),o=n(841),i=n(990);t.NotificationApi=class{static async call(e=5e3){var t;null===(t=i.ElectronUtils.getAPI())||void 0===t||t.invoke(o.Channel.NOTIFICATION,new r.Notification({title:"章鱼哥",type:"call",message:"下班提醒",duration:e}))}static async advanceCountdown(e,t,n){var a;null===(a=i.ElectronUtils.getAPI())||void 0===a||a.invoke(o.Channel.NOTIFICATION,new r.Notification({title:n,message:e,targetTime:t,type:"advance-countdown"}))}static async countdown(e,t){var n;null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.Notification({message:e,targetTime:t,type:"countdown"}))}static async success(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.Notification({message:e,type:"success",duration:t})):this.callback("success",e,t)}static async error(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.Notification({message:e,type:"error",duration:t})):this.callback("error",e,t)}static async warning(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.Notification({message:e,type:"warning",duration:t})):this.callback("warning",e,t)}static async message(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.Notification({message:e,type:"message",duration:t})):this.callback("message",e,t)}static setDebugNotification(e){this.callback=e}}},737:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetApi=void 0;const o=n(473),i=n(990),a=n(134),s=n(841),c=n(499),u=n(937),l=n(969),d=r(n(680));class f{static async registerWidgets(e){var t;await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REGISTER_WIDGETS,JSON.stringify(e)))}static async registerWidgetPackage(e){var t;await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REGISTER_WIDGET_PACKAGE,JSON.stringify(e)))}static async getWidgets(){var e;const t=await(null===(e=i.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(s.Channel.WIDGET,this.GET_WIDGETS)),n=[];if(t){const e=JSON.parse(t);for(const t in e)n.push(o.Widget.parseObject(e[t]))}return n}static async getWidgetPackages(){var e;return await(null===(e=i.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(s.Channel.WIDGET,this.GET_WIDGET_PACKAGES))}static async getWidget(e){var t;return o.Widget.parseObject(await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.GET_WIDGET,e)))}static async getWidgetPackage(e){var t;return a.WidgetPackage.parseObject(await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.GET_WIDGET_PACKAGE,e)))}static async removeHostedWidget(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REMOVE_HOSTED_WIDGET,e)}static async getWidgetConfigUrl(e,t){const n=await this.getWidget(e);if(!n||null==n.configUrl)return null;const r=await this.getWidgetPackage(n.packageName);return r?c.UrlUtils.getWidgetUrl(n.configUrl,r,t):null}static async saveDataByName(e,t={sendBroadcast:!0}){const n=this.getStore(e.name),r=JSON.stringify(e),o=await n.setItem(e.name,r);if(t.sendBroadcast){const n=new u.BroadcastEvent(u.BroadcastEvent.TYPE_WIDGET_UPDATED,"",{name:e.name,id:t.id,json:r});await l.BroadcastApi.sendBroadcastEvent(n)}return o}static getStore(e){if(this.stores.has(e))return this.stores.get(e);const t=d.default.createInstance({name:e});return this.stores.set(e,t),t}}t.WidgetApi=f,f.REGISTER_WIDGETS="register-widgets",f.REGISTER_WIDGET_PACKAGE="register-widget-package",f.GET_WIDGETS="get-widgets",f.GET_WIDGET="get-widget",f.GET_WIDGET_PACKAGE="get-widget-package",f.GET_WIDGET_PACKAGES="get-widget-packages",f.REMOVE_HOSTED_WIDGET="remove-hosted-widget",f.stores=new Map},755:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(473),t),o(n(937),t),o(n(681),t),o(n(450),t),o(n(758),t),o(n(771),t),o(n(995),t),o(n(386),t),o(n(134),t),o(n(295),t),o(n(630),t),o(n(194),t),o(n(717),t),o(n(841),t),o(n(737),t),o(n(913),t),o(n(969),t),o(n(445),t),o(n(24),t),o(n(990),t),o(n(499),t),o(n(821),t)},995:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.HostedMode=void 0,(n=t.HostedMode||(t.HostedMode={}))[n.NORMAL=1]="NORMAL",n[n.OVERLAP=16]="OVERLAP",n[n.WALLPAPER=256]="WALLPAPER",n[n.SCREEN=4096]="SCREEN",n[n.ALL=4369]="ALL"},771:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Notification=void 0,t.Notification=class{constructor(e){var t,n;this.type="message",this.type=null!==(t=e.type)&&void 0!==t?t:"message",this.title=e.title,this.message=e.message,this.targetTime=e.targetTime,this.duration=null!==(n=e.duration)&&void 0!==n?n:5e3,this.icon=e.icon}}},473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetKeyword=t.Widget=void 0;const r=n(995);class o{constructor(e){var t,n,o,i,a,s,c;this.lang="zh",this.name=e.name,this.title=e.title,this.description=e.description,this.keywords=e.keywords,this.lang=e.lang,this.width=e.width,this.height=e.height,this.maxWidth=null!==(t=e.maxWidth)&&void 0!==t?t:e.width,this.maxHeight=null!==(n=e.maxHeight)&&void 0!==n?n:e.height,this.minWidth=null!==(o=e.minWidth)&&void 0!==o?o:e.width,this.minHeight=null!==(i=e.minHeight)&&void 0!==i?i:e.height,this.url=e.url,this.packageName=e.packageName,this.configUrl=e.configUrl,this.refreshWhenResided=null!==(a=e.refreshWhenResided)&&void 0!==a&&a,this.extraUrl=null!==(s=e.extraUrl)&&void 0!==s?s:{},this.supportHostedMode=null!==(c=e.supportHostedMode)&&void 0!==c?c:r.HostedMode.NORMAL|r.HostedMode.OVERLAP}getTitle(e){var t;return e&&null!==(t=this.title[e])&&void 0!==t?t:this.title[this.lang]}getDescription(e){return e?this.description[e]:this.description[this.lang]}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){return new o({...e})}isSupportOverlap(){return(this.supportHostedMode&r.HostedMode.OVERLAP)>0}isSupportNormal(){return(this.supportHostedMode&r.HostedMode.NORMAL)>0}}var i;t.Widget=o,(i=t.WidgetKeyword||(t.WidgetKeyword={})).RECOMMEND="recommend",i.TOOLS="tools",i.EFFICIENCY="efficiency",i.PICTURE="picture",i.LIFE="life",i.SHORTCUT="shortcut",i.COUNTDOWN="countdown",i.TIMER="timer",i.INFO="info",i.DASHBOARD="dashboard"},450:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetData=void 0,t.WidgetData=class{constructor(e,t){this.id=t,this.name=e}parseJSON(e){Object.assign(this,e)}}},134:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetPackage=void 0;class n{constructor(){this.hash=!0}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new n;return Object.assign(t,e),t}getFullUrl(){return this.url.startsWith("http")?this.url:this.url+(this.entry.startsWith("/")?this.entry:`/${this.entry}`)}}t.WidgetPackage=n},758:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeMode=t.WidgetParams=void 0;const r=n(821),o=n(275);class i{toUrlParams(){const e=new URLSearchParams,t=Object.getOwnPropertyNames(this);for(let n of t){const t=this[n];t&&e.append(i.PARAM_PREFIX+(0,o.snakeCase)(n),t.toString())}return e}getPersistKey(){return`${this.name}-${this.id}`}static fromCurrentLocation(){let e=window.location.href.split("?")[1];return this.fromObject((0,r.parseQuery)(e))}static setValue(e,t,n){const r=t.replace(this.PARAM_PREFIX,"");r==i.PARAM_ID?e.id=n:r==i.PARAM_X?e.x=parseInt(n):r==i.PARAM_Y?e.y=parseInt(n):r==i.PARAM_HEIGHT?e.height=parseInt(n):r==i.PARAM_WIDTH?e.width=parseInt(n):r==i.PARAM_LANG?e.lang=n:r==i.PARAM_THEME?e.theme=n:r==i.PARAM_MODE?e.mode=parseInt(n):r==i.PARAM_RADIUS?e.radius=parseInt(n):r==i.PARAM_WIDTH_PX?e.widthPx=parseInt(n):r==i.PARAM_HEIGHT_PX?e.heightPx=parseInt(n):r==i.PARAM_NAME?e.name=n:r==i.PARAM_TITLE?e.title=n:r==i.PARAM_PREVIEW&&(e.preview="true"===n)}static fromObject(e){const t=new i,n=Object.getOwnPropertyNames(e);for(let r of n){const n=r,o=e[n];this.setValue(t,n,o)}return t}}var a;t.WidgetParams=i,i.PARAM_PREFIX="w_",i.PARAM_ID="id",i.PARAM_WIDTH="width",i.PARAM_HEIGHT="height",i.PARAM_WIDTH_PX="width_px",i.PARAM_HEIGHT_PX="height_px",i.PARAM_X="x",i.PARAM_Y="y",i.PARAM_LANG="lang",i.PARAM_THEME="theme",i.PARAM_MODE="mode",i.PARAM_RADIUS="radius",i.PARAM_NAME="name",i.PARAM_TITLE="title",i.PARAM_PREVIEW="preview",i.PARAMS=[i.PARAM_ID,i.PARAM_WIDTH,i.PARAM_HEIGHT,i.PARAM_X,i.PARAM_Y,i.PARAM_LANG,i.PARAM_THEME,i.PARAM_MODE,i.PARAM_WIDTH_PX,i.PARAM_HEIGHT_PX,i.PARAM_NAME,i.PARAM_TITLE,i.PARAM_PREVIEW],(a=t.ThemeMode||(t.ThemeMode={})).AUTO="auto",a.LIGHT="LIGHT",a.DARK="DARK"},937:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastEvent=void 0;class n{constructor(e,t,n){this.type=e,this.from=t,this.payload=n}}t.BroadcastEvent=n,n.TYPE_WIDGET_UPDATED="broadcast::cn.widgetjs.core.widget_updated",n.TYPE_APP_CONFIG_UPDATED="broadcast::cn.widgetjs.core.app_config_updated",n.TYPE_THEME_CHANGED="broadcast::cn.widgetjs.core.theme_changed"},681:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebSocketEvent=t.WebSocketEventType=void 0,(t.WebSocketEventType||(t.WebSocketEventType={})).RESISTER_WIDGETS="ws::cn.widgetjs.core.resister_widgets",t.WebSocketEvent=class{constructor(e,t){this.type=e,this.payload=t}}},386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},630:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetDataRepository=void 0;const o=r(n(680)),i=n(937),a=n(969);class s{static async save(e){let t=this.getStore(e.name);const n=await t.setItem(this.getKey(e.name,e.id),JSON.stringify(e)),r=new i.BroadcastEvent(i.BroadcastEvent.TYPE_WIDGET_UPDATED,"",e);return await a.BroadcastApi.sendBroadcastEvent(r),n}static getStore(e){if(this.stores.has(e))return this.stores.get(e);const t=o.default.createInstance({name:e});return this.stores.set(e,t),t}static async saveByName(e){const t=this.getStore(e.name),n=JSON.stringify(e),r=await t.setItem(e.name,n),o=new i.BroadcastEvent(i.BroadcastEvent.TYPE_WIDGET_UPDATED,"",{name:e.name,json:n});return await a.BroadcastApi.sendBroadcastEvent(o),r}static async findByName(e,t){let n=this.getStore(e),r=await n.getItem(e);if(r){const n=new t(e);return n.parseJSON(JSON.parse(r)),n}}static async find(e,t,n){let r=this.getStore(e),o=await r.getItem(this.getKey(e,t));if(o){const r=new n(e,t);return r.parseJSON(JSON.parse(o)),r}}static getKey(e,t){return`${e}@${t}`}}t.WidgetDataRepository=s,s.stores=new Map},733:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encodeParam=t.encodePath=t.encodeQueryKey=t.encodeQueryValue=t.encodeHash=t.PLUS_RE=void 0;const n=/#/g,r=/&/g,o=/\//g,i=/=/g,a=/\?/g;t.PLUS_RE=/\+/g;const s=/%5B/g,c=/%5D/g,u=/%5E/g,l=/%60/g,d=/%7B/g,f=/%7C/g,v=/%7D/g,h=/%20/g;function p(e){return encodeURI(""+e).replace(f,"|").replace(s,"[").replace(c,"]")}function g(e){return p(e).replace(t.PLUS_RE,"%2B").replace(h,"+").replace(n,"%23").replace(r,"%26").replace(l,"`").replace(d,"{").replace(v,"}").replace(u,"^")}function y(e){return p(e).replace(n,"%23").replace(a,"%3F")}t.encodeHash=function(e){return p(e).replace(d,"{").replace(v,"}").replace(u,"^")},t.encodeQueryValue=g,t.encodeQueryKey=function(e){return g(e).replace(i,"%3D")},t.encodePath=y,t.encodeParam=function(e){return null==e?"":y(e).replace(o,"%2F")},t.decode=function(e){try{return decodeURIComponent(""+e)}catch(e){}return""+e}},821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringifyQuery=t.parseQuery=void 0;const r=n(733),o=Array.isArray;t.parseQuery=function(e){const t={};if(""===e||"?"===e)return t;const n=("?"===e[0]?e.slice(1):e).split("&");for(let e=0;e<n.length;++e){const i=n[e].replace(r.PLUS_RE," "),a=i.indexOf("="),s=(0,r.decode)(a<0?i:i.slice(0,a)),c=a<0?null:(0,r.decode)(i.slice(a+1));if(s in t){let e=t[s];o(e)||(e=t[s]=[e]),e.push(c)}else t[s]=c}return t},t.stringifyQuery=function(e){let t="";for(let n in e){const i=e[n];(n=(0,r.encodeQueryKey)(n),null!=i)?(o(i)?i.map((e=>e&&(0,r.encodeQueryValue)(e))):[i&&(0,r.encodeQueryValue)(i)]).forEach((e=>{void 0!==e&&(t+=(t.length?"&":"")+n,null!=e&&(t+="="+e))})):void 0!==i&&(t+=(t.length?"&":"")+n)}return t}},990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronUtils=void 0,t.ElectronUtils=class{static hasElectronApi(){return null!=this.getAPI()}static getAPI(){return Reflect.has(window,"electronAPI")?window.electronAPI:Reflect.has(window.parent,"electronAPI")?window.parent.electronAPI:null}}},499:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UrlUtils=void 0,t.UrlUtils=class{static getWidgetUrl(e,t,n){let r="";return r=e.startsWith("http")?e:t.getFullUrl()+e,r.includes("?")?r+"&"+n.toUrlParams().toString():r+"?"+n.toUrlParams().toString()}}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(755)})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.exampleTypescriptPackage=t():e.exampleTypescriptPackage=t()}(this,(()=>(()=>{var e={275:(e,t,n)=>{"use strict";n.r(t),n.d(t,{camelCase:()=>h,camelCaseTransform:()=>f,camelCaseTransformMerge:()=>v,capitalCase:()=>y,capitalCaseTransform:()=>g,constantCase:()=>I,dotCase:()=>m,headerCase:()=>E,noCase:()=>s,paramCase:()=>b,pascalCase:()=>d,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>l,pathCase:()=>A,sentenceCase:()=>O,sentenceCaseTransform:()=>w,snakeCase:()=>P});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e){return e.toLowerCase()}Object.create,Object.create;var i=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],a=/[^A-Z0-9]+/gi;function s(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?i:n,s=t.stripRegexp,u=void 0===s?a:s,l=t.transform,d=void 0===l?o:l,f=t.delimiter,v=void 0===f?" ":f,h=c(c(e,r,"$1\0$2"),u,"\0"),p=0,g=h.length;"\0"===h.charAt(p);)p++;for(;"\0"===h.charAt(g-1);)g--;return h.slice(p,g).split("\0").map(d).join(v)}function c(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function u(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>="0"&&n<="9"?"_"+n+r:""+n.toUpperCase()+r}function l(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function d(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"",transform:u},t))}function f(e,t){return 0===t?e.toLowerCase():u(e,t)}function v(e,t){return 0===t?e.toLowerCase():l(e)}function h(e,t){return void 0===t&&(t={}),d(e,r({transform:f},t))}function p(e){return e.charAt(0).toUpperCase()+e.substr(1)}function g(e){return p(e.toLowerCase())}function y(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:g},t))}function _(e){return e.toUpperCase()}function I(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:_},t))}function m(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function E(e,t){return void 0===t&&(t={}),y(e,r({delimiter:"-"},t))}function b(e,t){return void 0===t&&(t={}),m(e,r({delimiter:"-"},t))}function A(e,t){return void 0===t&&(t={}),m(e,r({delimiter:"/"},t))}function w(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function O(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:w},t))}function P(e,t){return void 0===t&&(t={}),m(e,r({delimiter:"_"},t))}},680:(e,t,n)=>{e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var i=void 0,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,r){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(l),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var c=new e.MessageChannel;c.port1.onmessage=l,n=function(){c.port2.postMessage(0)}}var u=[];function l(){var e,t;r=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function l(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)}))}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function v(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h((function(){t(o,r)}));"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==c?d(n,this.state===s?e:t,this.outcome):this.queue.push(new l(n,e,t)),n},l.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){i.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(f,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=s,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},u.reject=function(e){var t=new this(o);return i.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),s=0,c=-1,u=new this(o);++c<n;)l(e[c],c);return u;function l(e,o){t.resolve(e).then((function(e){a[o]=e,++s!==n||r||(r=!0,i.resolve(u,a))}),(function(e){r||(r=!0,i.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,r=e.length,a=!1;if(!r)return this.resolve([]);for(var s=-1,c=new this(o);++s<r;)n=e[s],t.resolve(n).then((function(e){a||(a=!0,i.resolve(c,e))}),(function(e){a||(a=!0,i.reject(c,e))}));return c}},{1:1}],3:[function(e,t,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function l(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",f=void 0,v={},h=Object.prototype.toString,p="readonly",g="readwrite";function y(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function _(e){return"boolean"==typeof f?a.resolve(f):function(e){return new a((function(t){var n=e.transaction(d,g),r=i([""]);n.objectStore(d).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return f=e}))}function I(e){var t=v[e.name],n={};n.promise=new a((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function m(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function E(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function b(e,t){return new a((function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);I(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(d)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},n(t),m(e)}}))}function A(e){return b(e,!1)}function w(e){return b(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function P(e){return i([y(atob(e.data))],{type:e.type})}function S(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,n=t._initReady().then((function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function N(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),w(e)})).then((function(){return function(e){I(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,A(e).then((function(t){return e.db=t,O(e)?w(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw E(e,t),t}))}(e).then((function(){N(e,t,n,r-1)}))})).catch(n);n(o)}}var R={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},v[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=T);var i=[];function s(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var u=o.forages[c];u!==t&&i.push(u._initReady().catch(s))}var l=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,A(n)})).then((function(e){return n.db=e,O(n,t._defaultConfig.version)?w(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<l.length;r++){var i=l[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}}))},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;S(r)&&(r=P(r));var o=e(r,n.key,s++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),S(e)&&(e=P(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=new a((function(n,o){var i;r.ready().then((function(){return i=r._dbInfo,"[object Blob]"===h.call(t)?_(i.db).then((function(e){return e?t:(n=t,new a((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){N(r._dbInfo,g,(function(i,a){if(i)return o(i);try{var s=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=c.error?c.error:c.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){N(n._dbInfo,g,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,g,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=i.error?i.error:i.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){e<0?t(null):n.ready().then((function(){N(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),s=!1,c=a.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||s?t(n.key):(s=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){N(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=l.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var c=e.name===n.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):A(e).then((function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));r=e.storeName?c.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;I(e);var r=v[e.name],i=r.forages;t.close();for(var s=0;s<i.length;s++){var c=i[s];c._dbInfo.db=null,c._dbInfo.version=n}var u=new a((function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}));return u.then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,m(n._dbInfo)}})).catch((function(t){throw(E(e,t)||a.resolve()).catch((function(){})),t}))}})):c.then((function(t){I(e);var n=v[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;var s=new a((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=function(){var e=r.result;e&&e.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<r.length;t++)m(r[t]._dbInfo)})).catch((function(t){throw(E(e,t)||a.resolve()).catch((function(){})),t}))}))}else r=a.reject("Invalid arguments");return s(r,t),r}};var W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=/^~~local_forage_type~([^~]+)~/,C="__lfsc__:",M=C.length,j="arbf",U="blob",k="si08",B="ui08",L="uic8",G="si16",x="si32",F="ur16",H="ui32",z="fl32",K="fl64",V=M+j.length,Y=Object.prototype.toString;function J(e){var t,n,r,o,i,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),l=new Uint8Array(u);for(t=0;t<s;t+=4)n=W.indexOf(e[t]),r=W.indexOf(e[t+1]),o=W.indexOf(e[t+2]),i=W.indexOf(e[t+3]),l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|o>>2,l[c++]=(3&o)<<6|63&i;return u}function Q(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=W[n[t]>>2],r+=W[(3&n[t])<<4|n[t+1]>>4],r+=W[(15&n[t+1])<<2|n[t+2]>>6],r+=W[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var X={serialize:function(e,t){var n="";if(e&&(n=Y.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===Y.call(e.buffer))){var r,o=C;e instanceof ArrayBuffer?(r=e,o+=j):(r=e.buffer,"[object Int8Array]"===n?o+=k:"[object Uint8Array]"===n?o+=B:"[object Uint8ClampedArray]"===n?o+=L:"[object Int16Array]"===n?o+=G:"[object Uint16Array]"===n?o+=F:"[object Int32Array]"===n?o+=x:"[object Uint32Array]"===n?o+=H:"[object Float32Array]"===n?o+=z:"[object Float64Array]"===n?o+=K:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+Q(this.result);t(C+U+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,M)!==C)return JSON.parse(e);var t,n=e.substring(V),r=e.substring(M,V);if(r===U&&D.test(n)){var o=n.match(D);t=o[1],n=n.substring(o[0].length)}var a=J(n);switch(r){case j:return a;case U:return i([a],{type:t});case k:return new Int8Array(a);case B:return new Uint8Array(a);case L:return new Uint8ClampedArray(a);case G:return new Int16Array(a);case F:return new Uint16Array(a);case x:return new Int32Array(a);case H:return new Uint32Array(a);case z:return new Float32Array(a);case K:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:J,bufferToString:Q};function q(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Z(e,t,n,r,o,i){e.executeSql(n,r,o,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?i(e,a):q(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function $(e,t,n,r){var o=this;e=u(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var s=t,c=o._dbInfo;c.serializer.serialize(t,(function(t,u){u?a(u):c.db.transaction((function(n){Z(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(s)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i($.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}function ee(e){return new a((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var te={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){q(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var i=r.rows,a=i.length,s=0;s<a;s++){var c=i.item(s),u=c.value;if(u&&(u=o.serializer.deserialize(u)),void 0!==(u=e(u,c.key,s+1)))return void t(u)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){return $.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=l.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return s(r=e.name?new a((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(ee(r))})).then((function(e){return new a((function(t,n){e.db.transaction((function(r){function o(e){return new a((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var i=[],s=0,c=e.storeNames.length;s<c;s++)i.push(o(e.storeNames[s]));a.all(i).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):a.reject("Invalid arguments"),t),r}};function ne(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function re(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var oe={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ne(e,this._defaultConfig),re()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s<i;s++){var c=localStorage.key(s);if(0===c.indexOf(r)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(o),a++)))return u}}}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new a((function(o,i){var a=r._dbInfo;a.serializer.serialize(t,(function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return s(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return s(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}));return s(n,e),n},dropInstance:function(e,t){if(t=l.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return r=e.name?new a((function(t){e.storeName?t(ne(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):a.reject("Invalid arguments"),s(r,t),r}},ie=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;r++}var o,i;return!1},ae=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},se={},ce={},ue={INDEXEDDB:R,WEBSQL:te,LOCALSTORAGE:oe},le=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],de=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(de),ve={description:"",driver:le.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function he(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function pe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(ae(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ge=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,se[o]||this.defineDriver(r)}this._defaultConfig=pe({},ve),this._config=pe({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=fe.concat("_initStorage"),c=0,u=i.length;c<u;c++){var l=i[c];if((!ie(de,l)||e[l])&&"function"!=typeof e[l])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return s(n,arguments[arguments.length-1]),n}},n=0,r=de.length;n<r;n++){var o=de[n];e[o]||(e[o]=t(o))}}();var d=function(n){se[r]&&console.info("Redefining LocalForage driver: "+r),se[r]=e,ce[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=se[e]?a.resolve(se[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;ae(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function s(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return a.resolve()})):a.resolve();return this._driverSet=u.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(s).catch(n)}i();var c=new Error("No available storage method found.");return r._driverSet=a.reject(c),r._driverSet}()}}(o)}))})).catch((function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ce[e]},e.prototype._extend=function(e){pe(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=fe.length;e<t;e++)he(this,fe[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ye=new ge;t.exports=ye},{3:3}]},{},[4])(4)},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiConstants=void 0;class n{}t.ApiConstants=n,n.CONFIG_LAUNCH_AT_STARTUP="CONFIG_LAUNCH_AT_STARTUP",n.CONFIG_WIDGET_TITLE_COLOR="CONFIG_WIDGET_TITLE_COLOR"},445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppApi=void 0;const r=n(990),o=n(841);class i{static async setConfig(e,t){var n;await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.APP,this.SET_CONFIG,e,t))}static async getConfig(e,t){var n;const i=await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.APP,this.GET_CONFIG,e));return null==i?t:"boolean"==typeof t?"true"===i:i}static openAddWidgetWindow(){var e;null===(e=r.ElectronUtils.getAPI())||void 0===e||e.invoke(o.Channel.APP,this.OPEN_ADD_WIDGET_WINDOW)}static openSettingWindow(){var e;null===(e=r.ElectronUtils.getAPI())||void 0===e||e.invoke(o.Channel.APP,this.OPEN_SETTING_WINDOW)}}t.AppApi=i,i.SET_CONFIG="SET_CONFIG",i.GET_CONFIG="GET_CONFIG",i.OPEN_ADD_WIDGET_WINDOW="open-add-widget-window",i.OPEN_SETTING_WINDOW="open-setting-window"},969:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastApi=void 0;const r=n(990),o=n(841),i=n(295);t.BroadcastApi=class{static async sendBroadcastEvent(e){var t;await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.BROADCAST,JSON.stringify(e)))}static async registerBroadcast(e){await i.ElectronApi.addIpcListener(o.Channel.BROADCAST,(t=>{e(JSON.parse(t))}))}static async unregisterBroadcast(){await i.ElectronApi.removeIpcListener(o.Channel.BROADCAST)}}},194:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserWindowApi=void 0;const r=n(841),o=n(990);class i{static async setIgnoreMouseEvent(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.IGNORE_MOUSE_EVENT,e))}static async show(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.WINDOW_VISIBILITY,!0))}static async hide(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.WINDOW_VISIBILITY,!1))}static async setWindowVisibility(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.WINDOW_VISIBILITY,e))}static async setAlwaysOnTop(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.ALWAYS_ON_TOP,e))}static async isAlwaysOnTop(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.IS_ALWAYS_ON_TOP))}static async openUrl(e){var t;await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.OPEN_URL,e))}static async setPosition(e,t,n){var i;await(null===(i=o.ElectronUtils.getAPI())||void 0===i?void 0:i.invoke(r.Channel.BROWSER_WINDOW,this.SET_POSITION,e,t,n))}static async getPosition(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.GET_POSITION))}static async blur(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.BLUR))}static async focus(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.FOCUS))}static async setResizable(e){var t;return await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.SET_RESIZABLE,e))}static async getBounds(){var e;return await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.GET_BOUNDS))}static async setBounds(e,t){var n;return await(null===(n=o.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(r.Channel.BROWSER_WINDOW,this.SET_BOUNDS,e,t))}}t.BrowserWindowApi=i,i.IGNORE_MOUSE_EVENT="ignore-mouse-event",i.WINDOW_VISIBILITY="window-visibility",i.ALWAYS_ON_TOP="always-on-top",i.IS_ALWAYS_ON_TOP="is-always-on-top",i.OPEN_URL="open-url",i.SET_POSITION="set-position",i.GET_POSITION="get-position",i.BLUR="blur",i.FOCUS="focus",i.SET_RESIZABLE="set-resizable",i.GET_BOUNDS="get-bounds",i.SET_BOUNDS="set-bounds",i.SHOW="show"},841:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0,(n=t.Channel||(t.Channel={})).NOTIFICATION="channel::cn.widgetjs.core.notification",n.BROWSER_WINDOW="channel::cn.widgetjs.core.browser_window",n.BROADCAST="channel::cn.widgetjs.core.broadcast",n.WIDGET="channel::cn.widgetjs.core.widget",n.APP="channel::cn.widgetjs.core.app",n.MOUSE_EVENT="channel::cn.widgetjs.core.mouse_event",n.KEYBOARD_EVENT="channel::cn.widgetjs.core.keyboard_event",n.DIALOG="channel::cn.widgetjs.core.dialog"},24:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogApi=void 0;const r=n(990),o=n(841);class i{static async pickFile(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.DIALOG,this.PICK_FILE,e))}}t.DialogApi=i,i.PICK_FILE="pick-file"},295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronApi=void 0;const r=n(990);t.ElectronApi=class{static async addIpcListener(e,t){var n;await(null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.addIpcListener(e,t))}static async removeIpcListener(e){var t;await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.removeIpcListener(e))}}},717:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationApi=void 0;const r=n(31),o=n(841),i=n(990);t.NotificationApi=class{static async call(e,t,n,a,s){var c;null===(c=i.ElectronUtils.getAPI())||void 0===c||c.invoke(o.Channel.NOTIFICATION,new r.AppNotification({avatar:e,audio:t,message:a,title:n,duration:-1,lyric:s,type:"call"}))}static async advanceCountdown(e,t,n){var a;null===(a=i.ElectronUtils.getAPI())||void 0===a||a.invoke(o.Channel.NOTIFICATION,new r.AppNotification({title:n,message:e,targetTime:t,type:"advance-countdown"}))}static async countdown(e,t){var n;null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.AppNotification({message:e,targetTime:t,backgroundColor:"rgba(0,0,0,0.5)",duration:-1,type:"countdown"}))}static async success(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.AppNotification({message:e,type:"success",icon:"check_circle_line",duration:t})):this.callback("success",e,t)}static async error(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.AppNotification({message:e,type:"error",icon:"close_circle_line",duration:t})):this.callback("error",e,t)}static async warning(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.AppNotification({message:e,type:"warning",icon:"warning_line",duration:t})):this.callback("warning",e,t)}static async info(e,t=5e3){var n;i.ElectronUtils.hasElectronApi()?null===(n=i.ElectronUtils.getAPI())||void 0===n||n.invoke(o.Channel.NOTIFICATION,new r.AppNotification({message:e,type:"info",icon:"information_line",duration:t})):this.callback("info",e,t)}static async hide(){var e;i.ElectronUtils.hasElectronApi()&&(null===(e=i.ElectronUtils.getAPI())||void 0===e||e.invoke(o.Channel.NOTIFICATION,null))}static setDebugNotification(e){this.callback=e}}},737:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetApi=void 0;const o=n(473),i=n(990),a=n(134),s=n(841),c=n(499),u=n(937),l=n(969),d=r(n(680));class f{static async registerWidgets(e){var t;await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REGISTER_WIDGETS,JSON.stringify(e)))}static async registerWidgetPackage(e){var t;await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REGISTER_WIDGET_PACKAGE,JSON.stringify(e)))}static async getWidgets(){var e;const t=await(null===(e=i.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(s.Channel.WIDGET,this.GET_WIDGETS)),n=[];if(t){const e=JSON.parse(t);for(const t in e)n.push(o.Widget.parseObject(e[t]))}return n}static async getWidgetPackages(){var e;return await(null===(e=i.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(s.Channel.WIDGET,this.GET_WIDGET_PACKAGES))}static async getWidget(e){var t;return o.Widget.parseObject(await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.GET_WIDGET,e)))}static async getWidgetPackage(e){var t;return a.WidgetPackage.parseObject(await(null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.GET_WIDGET_PACKAGE,e)))}static async removeHostedWidget(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REMOVE_HOSTED_WIDGET,e)}static async getWidgetConfigUrl(e,t){const n=await this.getWidget(e);if(!n||null==n.configUrl)return null;const r=await this.getWidgetPackage(n.packageName);return r?c.UrlUtils.getWidgetUrl(n.configUrl,r,t):null}static async getWidgetUrl(e,t){const n=await this.getWidget(e);if(!n||null==n.configUrl)return null;const r=await this.getWidgetPackage(n.packageName);return r?c.UrlUtils.getWidgetUrl(n.url,r,t):null}static async getWidgetPackageUrl(e,t){const n=await this.getWidgetPackage(e);return n?n.getFullUrl(t):null}static async saveDataByName(e,t={sendBroadcast:!0}){const n=this.getStore(e.name),r=JSON.stringify(e),o=await n.setItem(e.name,r);if(t.sendBroadcast){const n=new u.BroadcastEvent(u.BroadcastEvent.TYPE_WIDGET_UPDATED,"",{name:e.name,id:t.id,json:r});await l.BroadcastApi.sendBroadcastEvent(n)}return o}static getStore(e){if(this.stores.has(e))return this.stores.get(e);const t=d.default.createInstance({name:e});return this.stores.set(e,t),t}}t.WidgetApi=f,f.REGISTER_WIDGETS="register-widgets",f.REGISTER_WIDGET_PACKAGE="register-widget-package",f.GET_WIDGETS="get-widgets",f.GET_WIDGET="get-widget",f.GET_WIDGET_PACKAGE="get-widget-package",f.GET_WIDGET_PACKAGES="get-widget-packages",f.REMOVE_HOSTED_WIDGET="remove-hosted-widget",f.stores=new Map},755:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(473),t),o(n(937),t),o(n(681),t),o(n(450),t),o(n(758),t),o(n(31),t),o(n(995),t),o(n(386),t),o(n(790),t),o(n(442),t),o(n(134),t),o(n(295),t),o(n(630),t),o(n(194),t),o(n(717),t),o(n(841),t),o(n(737),t),o(n(913),t),o(n(969),t),o(n(445),t),o(n(24),t),o(n(990),t),o(n(499),t),o(n(821),t)},31:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.AppNotification=t.NotificationSize=void 0,function(e){e.SMALL="small",e.NORMAL="normal",e.LARGE="large"}(n=t.NotificationSize||(t.NotificationSize={})),t.AppNotification=class{constructor(e){var t,r,o,i,a;this.type="info",this.type=null!==(t=e.type)&&void 0!==t?t:"info",this.title=e.title,this.message=e.message,this.targetTime=e.targetTime,this.duration=null!==(r=e.duration)&&void 0!==r?r:5e3,this.icon=e.icon,this.color=null!==(o=e.color)&&void 0!==o?o:"#5D8AC8",this.confirmButtonText=e.confirmButtonText,this.cancelButtonText=e.cancelButtonText,this.cancelBroadcast=e.cancelBroadcast,this.confirmBroadcast=e.confirmBroadcast,this.size=null!==(i=e.size)&&void 0!==i?i:n.NORMAL,this.audio=e.audio,this.avatar=e.avatar,this.lyric=e.lyric,this.backgroundColor=null!==(a=e.backgroundColor)&&void 0!==a?a:"#000000"}}},995:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.HostedMode=void 0,(n=t.HostedMode||(t.HostedMode={}))[n.NORMAL=1]="NORMAL",n[n.OVERLAP=16]="OVERLAP",n[n.WALLPAPER=256]="WALLPAPER",n[n.SCREEN=4096]="SCREEN",n[n.ALL=4369]="ALL"},473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetKeyword=t.Widget=void 0;const r=n(995);class o{constructor(e){var t,n,o,i,a,s,c;this.lang="zh",this.name=e.name,this.title=e.title,this.description=e.description,this.keywords=e.keywords,this.lang=e.lang,this.width=e.width,this.height=e.height,this.maxWidth=null!==(t=e.maxWidth)&&void 0!==t?t:e.width,this.maxHeight=null!==(n=e.maxHeight)&&void 0!==n?n:e.height,this.minWidth=null!==(o=e.minWidth)&&void 0!==o?o:e.width,this.minHeight=null!==(i=e.minHeight)&&void 0!==i?i:e.height,this.url=e.url,this.packageName=e.packageName,this.configUrl=e.configUrl,this.refreshWhenResided=null!==(a=e.refreshWhenResided)&&void 0!==a&&a,this.extraUrl=null!==(s=e.extraUrl)&&void 0!==s?s:{},this.supportHostedMode=null!==(c=e.supportHostedMode)&&void 0!==c?c:r.HostedMode.NORMAL|r.HostedMode.OVERLAP}getTitle(e){var t;return e&&null!==(t=this.title[e])&&void 0!==t?t:this.title[this.lang]}getDescription(e){return e?this.description[e]:this.description[this.lang]}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){return new o({...e})}isSupportOverlap(){return(this.supportHostedMode&r.HostedMode.OVERLAP)>0}isSupportNormal(){return(this.supportHostedMode&r.HostedMode.NORMAL)>0}}var i;t.Widget=o,(i=t.WidgetKeyword||(t.WidgetKeyword={})).RECOMMEND="recommend",i.TOOLS="tools",i.EFFICIENCY="efficiency",i.PICTURE="picture",i.LIFE="life",i.SHORTCUT="shortcut",i.COUNTDOWN="countdown",i.TIMER="timer",i.INFO="info",i.DASHBOARD="dashboard"},450:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetData=void 0,t.WidgetData=class{constructor(e,t){this.id=t,this.name=e}parseJSON(e){Object.assign(this,e)}}},134:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetPackage=void 0;const r=n(499);class o{constructor(){this.hash=!0}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new o;return Object.assign(t,e),t}getFullUrl(e){return r.UrlUtils.getWidgetPackageUrl(this.url,this.entry,null==e?this.hash:e)}}t.WidgetPackage=o},758:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeMode=t.WidgetParams=void 0;const r=n(821),o=n(275);class i{toUrlParams(){const e=new URLSearchParams,t=Object.getOwnPropertyNames(this);for(let n of t){const t=this[n];t&&e.append(i.PARAM_PREFIX+(0,o.snakeCase)(n),t.toString())}return e}getPersistKey(){return`${this.name}-${this.id}`}static fromCurrentLocation(){let e=window.location.href.split("?");if(e.length>1){let t=e[1];return this.fromObject((0,r.parseQuery)(t))}return new i}static setValue(e,t,n){const r=t.replace(this.PARAM_PREFIX,"");r==i.PARAM_ID?e.id=n:r==i.PARAM_X?e.x=parseInt(n):r==i.PARAM_Y?e.y=parseInt(n):r==i.PARAM_HEIGHT?e.height=parseInt(n):r==i.PARAM_WIDTH?e.width=parseInt(n):r==i.PARAM_LANG?e.lang=n:r==i.PARAM_THEME?e.theme=n:r==i.PARAM_MODE?e.mode=parseInt(n):r==i.PARAM_RADIUS?e.radius=parseInt(n):r==i.PARAM_WIDTH_PX?e.widthPx=parseInt(n):r==i.PARAM_HEIGHT_PX?e.heightPx=parseInt(n):r==i.PARAM_NAME?e.name=n:r==i.PARAM_TITLE?e.title=n:r==i.PARAM_PREVIEW&&(e.preview="true"===n)}static fromObject(e){const t=new i,n=Object.getOwnPropertyNames(e);for(let r of n){const n=r,o=e[n];this.setValue(t,n,o)}return t}}var a;t.WidgetParams=i,i.PARAM_PREFIX="w_",i.PARAM_ID="id",i.PARAM_WIDTH="width",i.PARAM_HEIGHT="height",i.PARAM_WIDTH_PX="width_px",i.PARAM_HEIGHT_PX="height_px",i.PARAM_X="x",i.PARAM_Y="y",i.PARAM_LANG="lang",i.PARAM_THEME="theme",i.PARAM_MODE="mode",i.PARAM_RADIUS="radius",i.PARAM_NAME="name",i.PARAM_TITLE="title",i.PARAM_PREVIEW="preview",i.PARAMS=[i.PARAM_ID,i.PARAM_WIDTH,i.PARAM_HEIGHT,i.PARAM_X,i.PARAM_Y,i.PARAM_LANG,i.PARAM_THEME,i.PARAM_MODE,i.PARAM_WIDTH_PX,i.PARAM_HEIGHT_PX,i.PARAM_NAME,i.PARAM_TITLE,i.PARAM_PREVIEW],(a=t.ThemeMode||(t.ThemeMode={})).AUTO="auto",a.LIGHT="LIGHT",a.DARK="DARK"},790:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},442:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},937:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastEvent=void 0;class n{constructor(e,t,n){this.type=e,this.from=t,this.payload=n}}t.BroadcastEvent=n,n.TYPE_WIDGET_UPDATED="broadcast::cn.widgetjs.core.widget_updated",n.TYPE_APP_CONFIG_UPDATED="broadcast::cn.widgetjs.core.app_config_updated",n.TYPE_THEME_CHANGED="broadcast::cn.widgetjs.core.theme_changed"},681:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebSocketEvent=t.WebSocketEventType=void 0,(t.WebSocketEventType||(t.WebSocketEventType={})).RESISTER_WIDGETS="ws::cn.widgetjs.core.resister_widgets",t.WebSocketEvent=class{constructor(e,t){this.type=e,this.payload=t}}},386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},630:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetDataRepository=void 0;const o=r(n(680)),i=n(937),a=n(969);class s{static async save(e){let t=this.getStore(e.name);const n=await t.setItem(this.getKey(e.name,e.id),JSON.stringify(e)),r=new i.BroadcastEvent(i.BroadcastEvent.TYPE_WIDGET_UPDATED,"",e);return await a.BroadcastApi.sendBroadcastEvent(r),n}static getStore(e){if(this.stores.has(e))return this.stores.get(e);const t=o.default.createInstance({name:e});return this.stores.set(e,t),t}static async saveByName(e){const t=this.getStore(e.name),n=JSON.stringify(e),r=await t.setItem(e.name,n),o=new i.BroadcastEvent(i.BroadcastEvent.TYPE_WIDGET_UPDATED,"",{name:e.name,json:n});return await a.BroadcastApi.sendBroadcastEvent(o),r}static async findByName(e,t){let n=this.getStore(e),r=await n.getItem(e);if(r){const n=new t(e);return n.parseJSON(JSON.parse(r)),n}}static async find(e,t,n){let r=this.getStore(e),o=await r.getItem(this.getKey(e,t));if(o){const r=new n(e,t);return r.parseJSON(JSON.parse(o)),r}}static getKey(e,t){return`${e}@${t}`}}t.WidgetDataRepository=s,s.stores=new Map},733:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encodeParam=t.encodePath=t.encodeQueryKey=t.encodeQueryValue=t.encodeHash=t.PLUS_RE=void 0;const n=/#/g,r=/&/g,o=/\//g,i=/=/g,a=/\?/g;t.PLUS_RE=/\+/g;const s=/%5B/g,c=/%5D/g,u=/%5E/g,l=/%60/g,d=/%7B/g,f=/%7C/g,v=/%7D/g,h=/%20/g;function p(e){return encodeURI(""+e).replace(f,"|").replace(s,"[").replace(c,"]")}function g(e){return p(e).replace(t.PLUS_RE,"%2B").replace(h,"+").replace(n,"%23").replace(r,"%26").replace(l,"`").replace(d,"{").replace(v,"}").replace(u,"^")}function y(e){return p(e).replace(n,"%23").replace(a,"%3F")}t.encodeHash=function(e){return p(e).replace(d,"{").replace(v,"}").replace(u,"^")},t.encodeQueryValue=g,t.encodeQueryKey=function(e){return g(e).replace(i,"%3D")},t.encodePath=y,t.encodeParam=function(e){return null==e?"":y(e).replace(o,"%2F")},t.decode=function(e){try{return decodeURIComponent(""+e)}catch(e){}return""+e}},821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringifyQuery=t.parseQuery=void 0;const r=n(733),o=Array.isArray;t.parseQuery=function(e){const t={};if(""===e||"?"===e)return t;const n=("?"===e[0]?e.slice(1):e).split("&");for(let e=0;e<n.length;++e){const i=n[e].replace(r.PLUS_RE," "),a=i.indexOf("="),s=(0,r.decode)(a<0?i:i.slice(0,a)),c=a<0?null:(0,r.decode)(i.slice(a+1));if(s in t){let e=t[s];o(e)||(e=t[s]=[e]),e.push(c)}else t[s]=c}return t},t.stringifyQuery=function(e){let t="";for(let n in e){const i=e[n];(n=(0,r.encodeQueryKey)(n),null!=i)?(o(i)?i.map((e=>e&&(0,r.encodeQueryValue)(e))):[i&&(0,r.encodeQueryValue)(i)]).forEach((e=>{void 0!==e&&(t+=(t.length?"&":"")+n,null!=e&&(t+="="+e))})):void 0!==i&&(t+=(t.length?"&":"")+n)}return t}},990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronUtils=void 0,t.ElectronUtils=class{static hasElectronApi(){return null!=this.getAPI()}static getAPI(){return Reflect.has(window,"electronAPI")?window.electronAPI:Reflect.has(window.parent,"electronAPI")?window.parent.electronAPI:null}}},499:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UrlUtils=void 0,t.UrlUtils=class{static getWidgetUrl(e,t,n){let r="";return r=e.startsWith("http")?e:t.getFullUrl()+e,r.includes("?")?r+"&"+n.toUrlParams().toString():r+"?"+n.toUrlParams().toString()}static getWidgetPackageUrl(e,t,n){const r=[e];return e.startsWith("http")?n&&r.push(e.endsWith("/")?"#":"/#"):(r.push(t.startsWith("/")?t:`/${t}`),n&&r.push(e.endsWith("#")?"":"#")),r.join("")}}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(755)})()));
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Notification = void 0;
|
|
4
|
-
class Notification {
|
|
5
|
-
constructor(option) {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
this.type = "message";
|
|
8
|
-
this.type = (_a = option.type) !== null && _a !== void 0 ? _a : "message";
|
|
9
|
-
this.title = option.title;
|
|
10
|
-
this.message = option.message;
|
|
11
|
-
this.targetTime = option.targetTime;
|
|
12
|
-
this.duration = (_b = option.duration) !== null && _b !== void 0 ? _b : 5000;
|
|
13
|
-
this.icon = option.icon;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.Notification = Notification;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export class Notification {
|
|
2
|
-
constructor(option) {
|
|
3
|
-
var _a, _b;
|
|
4
|
-
this.type = "message";
|
|
5
|
-
this.type = (_a = option.type) !== null && _a !== void 0 ? _a : "message";
|
|
6
|
-
this.title = option.title;
|
|
7
|
-
this.message = option.message;
|
|
8
|
-
this.targetTime = option.targetTime;
|
|
9
|
-
this.duration = (_b = option.duration) !== null && _b !== void 0 ? _b : 5000;
|
|
10
|
-
this.icon = option.icon;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type NotificationType = "call" | "message" | "countdown" | "advance-countdown" | "error" | "success" | "warning" | "info" | "custom";
|
|
2
|
-
export interface NotificationOption {
|
|
3
|
-
type?: NotificationType;
|
|
4
|
-
title?: string;
|
|
5
|
-
message: string;
|
|
6
|
-
targetTime?: string;
|
|
7
|
-
duration?: number;
|
|
8
|
-
icon?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class Notification {
|
|
11
|
-
type: NotificationType;
|
|
12
|
-
message: string;
|
|
13
|
-
title?: string;
|
|
14
|
-
targetTime?: string;
|
|
15
|
-
duration: number;
|
|
16
|
-
icon?: string;
|
|
17
|
-
constructor(option: NotificationOption);
|
|
18
|
-
}
|