@widget-js/core 0.1.24 → 0.1.26
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/ApiConstants.js +3 -0
- package/dist/cjs/api/AppApi.js +11 -0
- package/dist/cjs/api/Channel.js +4 -0
- package/dist/cjs/api/DeviceApi.js +16 -0
- package/dist/cjs/api/GlobalShortcutApi.js +29 -0
- package/dist/cjs/api/HostedWidgetApi.js +68 -0
- package/dist/cjs/api/KeyboardApi.js +16 -0
- package/dist/cjs/api/WidgetApi.js +8 -36
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/model/HostedWidget.js +2 -1
- package/dist/cjs/model/Widget.js +13 -5
- package/dist/esm/api/ApiConstants.js +3 -0
- package/dist/esm/api/AppApi.js +11 -0
- package/dist/esm/api/Channel.js +4 -0
- package/dist/esm/api/DeviceApi.js +12 -0
- package/dist/esm/api/GlobalShortcutApi.js +25 -0
- package/dist/esm/api/HostedWidgetApi.js +64 -0
- package/dist/esm/api/KeyboardApi.js +12 -0
- package/dist/esm/api/WidgetApi.js +8 -36
- package/dist/esm/index.js +4 -0
- package/dist/esm/model/HostedWidget.js +1 -1
- package/dist/esm/model/Widget.js +13 -5
- package/dist/types/api/ApiConstants.d.ts +3 -0
- package/dist/types/api/AppApi.d.ts +6 -1
- package/dist/types/api/Channel.d.ts +5 -1
- package/dist/types/api/DeviceApi.d.ts +11 -0
- package/dist/types/api/GlobalShortcutApi.d.ts +14 -0
- package/dist/types/api/HostedWidgetApi.d.ts +42 -0
- package/dist/types/api/KeyboardApi.d.ts +7 -0
- package/dist/types/api/WidgetApi.d.ts +0 -21
- package/dist/types/index.d.ts +4 -0
- package/dist/types/model/HostedWidget.d.ts +3 -1
- package/dist/types/model/Widget.d.ts +16 -13
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
|
@@ -6,3 +6,6 @@ class ApiConstants {
|
|
|
6
6
|
exports.ApiConstants = ApiConstants;
|
|
7
7
|
ApiConstants.CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
8
8
|
ApiConstants.CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
|
|
9
|
+
ApiConstants.CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
|
|
10
|
+
ApiConstants.CONFIG_GRID_SIZE = "cn.widgetjs.config.grid.size";
|
|
11
|
+
ApiConstants.SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
|
package/dist/cjs/api/AppApi.js
CHANGED
|
@@ -17,12 +17,22 @@ class AppApi {
|
|
|
17
17
|
if (typeof defaultValue == "boolean") {
|
|
18
18
|
return value === "true";
|
|
19
19
|
}
|
|
20
|
+
if (typeof defaultValue == "number") {
|
|
21
|
+
return Number(value);
|
|
22
|
+
}
|
|
20
23
|
return value;
|
|
21
24
|
}
|
|
22
25
|
static openAddWidgetWindow() {
|
|
23
26
|
var _a;
|
|
24
27
|
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.APP, this.OPEN_ADD_WIDGET_WINDOW);
|
|
25
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 获取应用版本号,格式为 x.y.z
|
|
31
|
+
*/
|
|
32
|
+
static async getVersion() {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.APP, this.GET_VERSION);
|
|
35
|
+
}
|
|
26
36
|
static openSettingWindow() {
|
|
27
37
|
var _a;
|
|
28
38
|
(_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.APP, this.OPEN_SETTING_WINDOW);
|
|
@@ -33,3 +43,4 @@ AppApi.SET_CONFIG = "SET_CONFIG";
|
|
|
33
43
|
AppApi.GET_CONFIG = "GET_CONFIG";
|
|
34
44
|
AppApi.OPEN_ADD_WIDGET_WINDOW = "open-add-widget-window";
|
|
35
45
|
AppApi.OPEN_SETTING_WINDOW = "open-setting-window";
|
|
46
|
+
AppApi.GET_VERSION = "get-version";
|
package/dist/cjs/api/Channel.js
CHANGED
|
@@ -7,9 +7,13 @@ var Channel;
|
|
|
7
7
|
Channel["BROWSER_WINDOW"] = "channel::cn.widgetjs.core.browser_window";
|
|
8
8
|
Channel["BROADCAST"] = "channel::cn.widgetjs.core.broadcast";
|
|
9
9
|
Channel["WIDGET"] = "channel::cn.widgetjs.core.widget";
|
|
10
|
+
Channel["HOSTED_WIDGET"] = "channel::cn.widgetjs.core.hosted_widget";
|
|
10
11
|
Channel["APP"] = "channel::cn.widgetjs.core.app";
|
|
11
12
|
Channel["MOUSE_EVENT"] = "channel::cn.widgetjs.core.mouse_event";
|
|
12
13
|
Channel["KEYBOARD_EVENT"] = "channel::cn.widgetjs.core.keyboard_event";
|
|
13
14
|
Channel["DIALOG"] = "channel::cn.widgetjs.core.dialog";
|
|
14
15
|
Channel["CLIPBOARD"] = "channel::cn.widgetjs.core.clipboard";
|
|
16
|
+
Channel["DEVICE"] = "channel::cn.widgetjs.core.device";
|
|
17
|
+
Channel["KEYBOARD"] = "channel::cn.widgetjs.core.keyboard";
|
|
18
|
+
Channel["SHORTCUT"] = "channel::cn.widgetjs.core.shortcut";
|
|
15
19
|
})(Channel = exports.Channel || (exports.Channel = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceApi = void 0;
|
|
4
|
+
const ElectronUtils_1 = require("../utils/ElectronUtils");
|
|
5
|
+
const Channel_1 = require("./Channel");
|
|
6
|
+
class DeviceApi {
|
|
7
|
+
/**
|
|
8
|
+
* 获取当前鼠标位置
|
|
9
|
+
*/
|
|
10
|
+
static async getCursorScreenPoint() {
|
|
11
|
+
var _a;
|
|
12
|
+
return await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.DEVICE, this.GET_CURSOR_SCREEN_POINT));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DeviceApi = DeviceApi;
|
|
16
|
+
DeviceApi.GET_CURSOR_SCREEN_POINT = "get-cursor-screen-point";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GlobalShortcutApi = void 0;
|
|
4
|
+
const ElectronUtils_1 = require("../utils/ElectronUtils");
|
|
5
|
+
const Channel_1 = require("./Channel");
|
|
6
|
+
class GlobalShortcutApi {
|
|
7
|
+
/**
|
|
8
|
+
* 注册全局快捷键
|
|
9
|
+
*/
|
|
10
|
+
static async register(key) {
|
|
11
|
+
var _a;
|
|
12
|
+
return await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.SHORTCUT, this.REGISTER, key));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 取消注册全局快捷键
|
|
16
|
+
*/
|
|
17
|
+
static async unregister(key) {
|
|
18
|
+
var _a;
|
|
19
|
+
return await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.SHORTCUT, this.UNREGISTER, key));
|
|
20
|
+
}
|
|
21
|
+
static async isRegistered(key) {
|
|
22
|
+
var _a;
|
|
23
|
+
return await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.SHORTCUT, this.IS_REGISTERED, key));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.GlobalShortcutApi = GlobalShortcutApi;
|
|
27
|
+
GlobalShortcutApi.REGISTER = "register";
|
|
28
|
+
GlobalShortcutApi.IS_REGISTERED = "is-registered";
|
|
29
|
+
GlobalShortcutApi.UNREGISTER = "unregister";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HostedWidgetApi = void 0;
|
|
4
|
+
const ElectronUtils_1 = require("../utils/ElectronUtils");
|
|
5
|
+
const Channel_1 = require("./Channel");
|
|
6
|
+
class HostedWidgetApi {
|
|
7
|
+
/**
|
|
8
|
+
* 移除组件
|
|
9
|
+
* @param id
|
|
10
|
+
*/
|
|
11
|
+
static async removeHostedWidget(id) {
|
|
12
|
+
var _a;
|
|
13
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.REMOVE_HOSTED_WIDGET, id);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 通过组件名移除已添加的组件
|
|
17
|
+
* @param name 组件名
|
|
18
|
+
*/
|
|
19
|
+
static async removeHostedWidgetByName(name) {
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.REMOVE_HOSTED_WIDGET_BY_NAME, name);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取已添加的组件
|
|
25
|
+
* @param name 组件名,可以不传
|
|
26
|
+
*/
|
|
27
|
+
static async getHostedWidgets(name) {
|
|
28
|
+
var _a;
|
|
29
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.GET_HOSTED_WIDGETS, name);
|
|
30
|
+
}
|
|
31
|
+
static async getHostedWidget(id) {
|
|
32
|
+
var _a;
|
|
33
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.GET_HOSTED_WIDGET, id);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Opens the dev tools for a widget with the specified ID.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} widgetId - The ID of the widget to open the dev tools for.
|
|
39
|
+
* @return {Promise} A Promise that resolves when the dev tools are opened.
|
|
40
|
+
*/
|
|
41
|
+
static async openDevTools(widgetId) {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.OPEN_DEV_TOOLS, widgetId);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 注册激活、呼出、置顶组件快捷键
|
|
47
|
+
* @param widgetId 组件id
|
|
48
|
+
* @param shortcut 如果传空或者不传,则会取消快捷键。更多快捷键配置,请查看Accelerator用法
|
|
49
|
+
* https://www.electronjs.org/docs/latest/api/accelerator
|
|
50
|
+
*/
|
|
51
|
+
static async registerActiveShortcut(widgetId, shortcut) {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.REGISTER_ACTIVE_SHORTCUT, widgetId, shortcut);
|
|
54
|
+
}
|
|
55
|
+
static async setProxy(widgetId, proxy) {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.HOSTED_WIDGET, this.SET_PROXY, widgetId, proxy);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.HostedWidgetApi = HostedWidgetApi;
|
|
61
|
+
HostedWidgetApi.REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
62
|
+
HostedWidgetApi.REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
63
|
+
HostedWidgetApi.GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
64
|
+
HostedWidgetApi.GET_HOSTED_WIDGET = "get-hosted-widget";
|
|
65
|
+
HostedWidgetApi.OPEN_DEV_TOOLS = "open-dev-tools";
|
|
66
|
+
HostedWidgetApi.REGISTER_ACTIVE_SHORTCUT = "register-active-shortcut";
|
|
67
|
+
HostedWidgetApi.SET_PROXY = "SET_PROXY";
|
|
68
|
+
HostedWidgetApi.UPDATE = "UPDATE";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyboardApi = void 0;
|
|
4
|
+
const ElectronUtils_1 = require("../utils/ElectronUtils");
|
|
5
|
+
const Channel_1 = require("./Channel");
|
|
6
|
+
class KeyboardApi {
|
|
7
|
+
/**
|
|
8
|
+
* 模拟Ctrl+C
|
|
9
|
+
*/
|
|
10
|
+
static async sendCtrlC() {
|
|
11
|
+
var _a;
|
|
12
|
+
return await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.KEYBOARD, this.SEND_CTRL_C));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.KeyboardApi = KeyboardApi;
|
|
16
|
+
KeyboardApi.SEND_CTRL_C = "SEND_CTRL_C";
|
|
@@ -53,55 +53,31 @@ class WidgetApi {
|
|
|
53
53
|
var _a;
|
|
54
54
|
return WidgetPackage_1.WidgetPackage.parseObject(await ((_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.WIDGET, this.GET_WIDGET_PACKAGE, name)));
|
|
55
55
|
}
|
|
56
|
-
/**
|
|
57
|
-
* 移除组件
|
|
58
|
-
* @param id
|
|
59
|
-
*/
|
|
60
|
-
static async removeHostedWidget(id) {
|
|
61
|
-
var _a;
|
|
62
|
-
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.WIDGET, this.REMOVE_HOSTED_WIDGET, id);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 通过组件名移除已添加的组件
|
|
66
|
-
* @param name 组件名
|
|
67
|
-
*/
|
|
68
|
-
static async removeHostedWidgetByName(name) {
|
|
69
|
-
var _a;
|
|
70
|
-
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.WIDGET, this.REMOVE_HOSTED_WIDGET_BY_NAME, name);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* 获取已添加的组件
|
|
74
|
-
* @param name 组件名,可以不传
|
|
75
|
-
*/
|
|
76
|
-
static async getHostedWidgets(name) {
|
|
77
|
-
var _a;
|
|
78
|
-
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.WIDGET, this.GET_HOSTED_WIDGETS, name);
|
|
79
|
-
}
|
|
80
|
-
static async openDevTools(widgetId) {
|
|
81
|
-
var _a;
|
|
82
|
-
return (_a = ElectronUtils_1.ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel_1.Channel.WIDGET, this.OPEN_DEV_TOOLS, widgetId);
|
|
83
|
-
}
|
|
84
56
|
/**
|
|
85
57
|
* 获取组件配置地址
|
|
86
58
|
* @param widgetName
|
|
87
59
|
*/
|
|
88
60
|
static async getWidgetConfigUrl(widgetName, widgetParams) {
|
|
89
61
|
const widget = await this.getWidget(widgetName);
|
|
90
|
-
if (!widget
|
|
62
|
+
if (!widget)
|
|
63
|
+
return null;
|
|
64
|
+
const configRoute = widget.getConfigRoute();
|
|
65
|
+
if (!configRoute)
|
|
91
66
|
return null;
|
|
92
67
|
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
93
68
|
if (!widgetPackage)
|
|
94
69
|
return null;
|
|
95
|
-
return UrlUtils_1.UrlUtils.getWidgetUrl(
|
|
70
|
+
return UrlUtils_1.UrlUtils.getWidgetUrl(configRoute.url, widgetPackage, widgetParams);
|
|
96
71
|
}
|
|
97
72
|
static async getWidgetUrl(widgetName, widgetParams) {
|
|
98
73
|
const widget = await this.getWidget(widgetName);
|
|
99
|
-
if (!widget
|
|
74
|
+
if (!widget)
|
|
100
75
|
return null;
|
|
76
|
+
const indexRoute = widget.getIndexRoute();
|
|
101
77
|
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
102
78
|
if (!widgetPackage)
|
|
103
79
|
return null;
|
|
104
|
-
return UrlUtils_1.UrlUtils.getWidgetUrl(
|
|
80
|
+
return UrlUtils_1.UrlUtils.getWidgetUrl(indexRoute.url, widgetPackage, widgetParams);
|
|
105
81
|
}
|
|
106
82
|
static async getWidgetPackageIndexUrl(packageName, hash) {
|
|
107
83
|
const widgetPackage = await this.getWidgetPackage(packageName);
|
|
@@ -154,8 +130,4 @@ WidgetApi.GET_WIDGETS = "get-widgets";
|
|
|
154
130
|
WidgetApi.GET_WIDGET = "get-widget";
|
|
155
131
|
WidgetApi.GET_WIDGET_PACKAGE = "get-widget-package";
|
|
156
132
|
WidgetApi.GET_WIDGET_PACKAGES = "get-widget-packages";
|
|
157
|
-
WidgetApi.REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
158
|
-
WidgetApi.REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
159
|
-
WidgetApi.GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
160
|
-
WidgetApi.OPEN_DEV_TOOLS = "open-dev-tools";
|
|
161
133
|
WidgetApi.stores = new Map();
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,7 +29,11 @@ __exportStar(require("./model/WidgetPackage"), exports);
|
|
|
29
29
|
__exportStar(require("./api/ElectronApi"), exports);
|
|
30
30
|
__exportStar(require("./repository/WidgetDataRepository"), exports);
|
|
31
31
|
__exportStar(require("./api/BrowserWindowApi"), exports);
|
|
32
|
+
__exportStar(require("./api/GlobalShortcutApi"), exports);
|
|
32
33
|
__exportStar(require("./api/NotificationApi"), exports);
|
|
34
|
+
__exportStar(require("./api/HostedWidgetApi"), exports);
|
|
35
|
+
__exportStar(require("./api/KeyboardApi"), exports);
|
|
36
|
+
__exportStar(require("./api/DeviceApi"), exports);
|
|
33
37
|
__exportStar(require("./api/Channel"), exports);
|
|
34
38
|
__exportStar(require("./api/ClipboardApi"), exports);
|
|
35
39
|
__exportStar(require("./api/WidgetApi"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HostedWidget = void 0;
|
|
3
4
|
const HostedMode_1 = require("./HostedMode");
|
|
4
5
|
class HostedWidget {
|
|
5
6
|
constructor() {
|
|
@@ -10,4 +11,4 @@ class HostedWidget {
|
|
|
10
11
|
return (this.hostedMode & HostedMode_1.HostedMode.OVERLAP) > 0;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
exports.
|
|
14
|
+
exports.HostedWidget = HostedWidget;
|
package/dist/cjs/model/Widget.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.WidgetKeyword = exports.Widget = void 0;
|
|
|
4
4
|
const HostedMode_1 = require("./HostedMode");
|
|
5
5
|
class Widget {
|
|
6
6
|
constructor(options) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8
8
|
/**
|
|
9
9
|
* 组件默认语言
|
|
10
10
|
*/
|
|
@@ -21,13 +21,21 @@ class Widget {
|
|
|
21
21
|
this.minWidth = (_c = options.minWidth) !== null && _c !== void 0 ? _c : options.width;
|
|
22
22
|
this.minHeight = (_d = options.minHeight) !== null && _d !== void 0 ? _d : options.height;
|
|
23
23
|
this.backgroundThrottling = (_e = options.backgroundThrottling) !== null && _e !== void 0 ? _e : true;
|
|
24
|
-
this.url = options.url;
|
|
25
24
|
this.packageName = options.packageName;
|
|
26
25
|
this.previewImage = options.previewImage;
|
|
27
|
-
this.
|
|
26
|
+
this.shortcut = options.shortcut;
|
|
28
27
|
this.refreshWhenResided = (_f = options.refreshWhenResided) !== null && _f !== void 0 ? _f : false;
|
|
29
|
-
this.
|
|
30
|
-
this.supportHostedMode = (
|
|
28
|
+
this.hideWhenBlur = options.hideWhenBlur == null ? false : options.hideWhenBlur;
|
|
29
|
+
this.supportHostedMode = (_g = options.supportHostedMode) !== null && _g !== void 0 ? _g : HostedMode_1.HostedMode.NORMAL | HostedMode_1.HostedMode.OVERLAP;
|
|
30
|
+
this.routes = options.routes;
|
|
31
|
+
}
|
|
32
|
+
getIndexRoute() {
|
|
33
|
+
const result = this.routes.find((it) => it.name.toLowerCase() == 'index');
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
getConfigRoute() {
|
|
37
|
+
const result = this.routes.find((it) => it.name.toLowerCase() == 'config');
|
|
38
|
+
return result;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* 获取组件标题
|
|
@@ -2,3 +2,6 @@ export class ApiConstants {
|
|
|
2
2
|
}
|
|
3
3
|
ApiConstants.CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
4
4
|
ApiConstants.CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
|
|
5
|
+
ApiConstants.CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
|
|
6
|
+
ApiConstants.CONFIG_GRID_SIZE = "cn.widgetjs.config.grid.size";
|
|
7
|
+
ApiConstants.SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
|
package/dist/esm/api/AppApi.js
CHANGED
|
@@ -14,12 +14,22 @@ export class AppApi {
|
|
|
14
14
|
if (typeof defaultValue == "boolean") {
|
|
15
15
|
return value === "true";
|
|
16
16
|
}
|
|
17
|
+
if (typeof defaultValue == "number") {
|
|
18
|
+
return Number(value);
|
|
19
|
+
}
|
|
17
20
|
return value;
|
|
18
21
|
}
|
|
19
22
|
static openAddWidgetWindow() {
|
|
20
23
|
var _a;
|
|
21
24
|
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.APP, this.OPEN_ADD_WIDGET_WINDOW);
|
|
22
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* 获取应用版本号,格式为 x.y.z
|
|
28
|
+
*/
|
|
29
|
+
static async getVersion() {
|
|
30
|
+
var _a;
|
|
31
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.APP, this.GET_VERSION);
|
|
32
|
+
}
|
|
23
33
|
static openSettingWindow() {
|
|
24
34
|
var _a;
|
|
25
35
|
(_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.APP, this.OPEN_SETTING_WINDOW);
|
|
@@ -29,3 +39,4 @@ AppApi.SET_CONFIG = "SET_CONFIG";
|
|
|
29
39
|
AppApi.GET_CONFIG = "GET_CONFIG";
|
|
30
40
|
AppApi.OPEN_ADD_WIDGET_WINDOW = "open-add-widget-window";
|
|
31
41
|
AppApi.OPEN_SETTING_WINDOW = "open-setting-window";
|
|
42
|
+
AppApi.GET_VERSION = "get-version";
|
package/dist/esm/api/Channel.js
CHANGED
|
@@ -4,9 +4,13 @@ export var Channel;
|
|
|
4
4
|
Channel["BROWSER_WINDOW"] = "channel::cn.widgetjs.core.browser_window";
|
|
5
5
|
Channel["BROADCAST"] = "channel::cn.widgetjs.core.broadcast";
|
|
6
6
|
Channel["WIDGET"] = "channel::cn.widgetjs.core.widget";
|
|
7
|
+
Channel["HOSTED_WIDGET"] = "channel::cn.widgetjs.core.hosted_widget";
|
|
7
8
|
Channel["APP"] = "channel::cn.widgetjs.core.app";
|
|
8
9
|
Channel["MOUSE_EVENT"] = "channel::cn.widgetjs.core.mouse_event";
|
|
9
10
|
Channel["KEYBOARD_EVENT"] = "channel::cn.widgetjs.core.keyboard_event";
|
|
10
11
|
Channel["DIALOG"] = "channel::cn.widgetjs.core.dialog";
|
|
11
12
|
Channel["CLIPBOARD"] = "channel::cn.widgetjs.core.clipboard";
|
|
13
|
+
Channel["DEVICE"] = "channel::cn.widgetjs.core.device";
|
|
14
|
+
Channel["KEYBOARD"] = "channel::cn.widgetjs.core.keyboard";
|
|
15
|
+
Channel["SHORTCUT"] = "channel::cn.widgetjs.core.shortcut";
|
|
12
16
|
})(Channel || (Channel = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElectronUtils } from "../utils/ElectronUtils";
|
|
2
|
+
import { Channel } from "./Channel";
|
|
3
|
+
export class DeviceApi {
|
|
4
|
+
/**
|
|
5
|
+
* 获取当前鼠标位置
|
|
6
|
+
*/
|
|
7
|
+
static async getCursorScreenPoint() {
|
|
8
|
+
var _a;
|
|
9
|
+
return await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.DEVICE, this.GET_CURSOR_SCREEN_POINT));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
DeviceApi.GET_CURSOR_SCREEN_POINT = "get-cursor-screen-point";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ElectronUtils } from "../utils/ElectronUtils";
|
|
2
|
+
import { Channel } from "./Channel";
|
|
3
|
+
export class GlobalShortcutApi {
|
|
4
|
+
/**
|
|
5
|
+
* 注册全局快捷键
|
|
6
|
+
*/
|
|
7
|
+
static async register(key) {
|
|
8
|
+
var _a;
|
|
9
|
+
return await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.SHORTCUT, this.REGISTER, key));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 取消注册全局快捷键
|
|
13
|
+
*/
|
|
14
|
+
static async unregister(key) {
|
|
15
|
+
var _a;
|
|
16
|
+
return await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.SHORTCUT, this.UNREGISTER, key));
|
|
17
|
+
}
|
|
18
|
+
static async isRegistered(key) {
|
|
19
|
+
var _a;
|
|
20
|
+
return await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.SHORTCUT, this.IS_REGISTERED, key));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
GlobalShortcutApi.REGISTER = "register";
|
|
24
|
+
GlobalShortcutApi.IS_REGISTERED = "is-registered";
|
|
25
|
+
GlobalShortcutApi.UNREGISTER = "unregister";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ElectronUtils } from "../utils/ElectronUtils";
|
|
2
|
+
import { Channel } from "./Channel";
|
|
3
|
+
export class HostedWidgetApi {
|
|
4
|
+
/**
|
|
5
|
+
* 移除组件
|
|
6
|
+
* @param id
|
|
7
|
+
*/
|
|
8
|
+
static async removeHostedWidget(id) {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.REMOVE_HOSTED_WIDGET, id);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 通过组件名移除已添加的组件
|
|
14
|
+
* @param name 组件名
|
|
15
|
+
*/
|
|
16
|
+
static async removeHostedWidgetByName(name) {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.REMOVE_HOSTED_WIDGET_BY_NAME, name);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 获取已添加的组件
|
|
22
|
+
* @param name 组件名,可以不传
|
|
23
|
+
*/
|
|
24
|
+
static async getHostedWidgets(name) {
|
|
25
|
+
var _a;
|
|
26
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.GET_HOSTED_WIDGETS, name);
|
|
27
|
+
}
|
|
28
|
+
static async getHostedWidget(id) {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.GET_HOSTED_WIDGET, id);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Opens the dev tools for a widget with the specified ID.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} widgetId - The ID of the widget to open the dev tools for.
|
|
36
|
+
* @return {Promise} A Promise that resolves when the dev tools are opened.
|
|
37
|
+
*/
|
|
38
|
+
static async openDevTools(widgetId) {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.OPEN_DEV_TOOLS, widgetId);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 注册激活、呼出、置顶组件快捷键
|
|
44
|
+
* @param widgetId 组件id
|
|
45
|
+
* @param shortcut 如果传空或者不传,则会取消快捷键。更多快捷键配置,请查看Accelerator用法
|
|
46
|
+
* https://www.electronjs.org/docs/latest/api/accelerator
|
|
47
|
+
*/
|
|
48
|
+
static async registerActiveShortcut(widgetId, shortcut) {
|
|
49
|
+
var _a;
|
|
50
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.REGISTER_ACTIVE_SHORTCUT, widgetId, shortcut);
|
|
51
|
+
}
|
|
52
|
+
static async setProxy(widgetId, proxy) {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.HOSTED_WIDGET, this.SET_PROXY, widgetId, proxy);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
HostedWidgetApi.REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
58
|
+
HostedWidgetApi.REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
59
|
+
HostedWidgetApi.GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
60
|
+
HostedWidgetApi.GET_HOSTED_WIDGET = "get-hosted-widget";
|
|
61
|
+
HostedWidgetApi.OPEN_DEV_TOOLS = "open-dev-tools";
|
|
62
|
+
HostedWidgetApi.REGISTER_ACTIVE_SHORTCUT = "register-active-shortcut";
|
|
63
|
+
HostedWidgetApi.SET_PROXY = "SET_PROXY";
|
|
64
|
+
HostedWidgetApi.UPDATE = "UPDATE";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElectronUtils } from "../utils/ElectronUtils";
|
|
2
|
+
import { Channel } from "./Channel";
|
|
3
|
+
export class KeyboardApi {
|
|
4
|
+
/**
|
|
5
|
+
* 模拟Ctrl+C
|
|
6
|
+
*/
|
|
7
|
+
static async sendCtrlC() {
|
|
8
|
+
var _a;
|
|
9
|
+
return await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.KEYBOARD, this.SEND_CTRL_C));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
KeyboardApi.SEND_CTRL_C = "SEND_CTRL_C";
|
|
@@ -47,55 +47,31 @@ export class WidgetApi {
|
|
|
47
47
|
var _a;
|
|
48
48
|
return WidgetPackage.parseObject(await ((_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.WIDGET, this.GET_WIDGET_PACKAGE, name)));
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* 移除组件
|
|
52
|
-
* @param id
|
|
53
|
-
*/
|
|
54
|
-
static async removeHostedWidget(id) {
|
|
55
|
-
var _a;
|
|
56
|
-
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.WIDGET, this.REMOVE_HOSTED_WIDGET, id);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* 通过组件名移除已添加的组件
|
|
60
|
-
* @param name 组件名
|
|
61
|
-
*/
|
|
62
|
-
static async removeHostedWidgetByName(name) {
|
|
63
|
-
var _a;
|
|
64
|
-
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.WIDGET, this.REMOVE_HOSTED_WIDGET_BY_NAME, name);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 获取已添加的组件
|
|
68
|
-
* @param name 组件名,可以不传
|
|
69
|
-
*/
|
|
70
|
-
static async getHostedWidgets(name) {
|
|
71
|
-
var _a;
|
|
72
|
-
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.WIDGET, this.GET_HOSTED_WIDGETS, name);
|
|
73
|
-
}
|
|
74
|
-
static async openDevTools(widgetId) {
|
|
75
|
-
var _a;
|
|
76
|
-
return (_a = ElectronUtils.getAPI()) === null || _a === void 0 ? void 0 : _a.invoke(Channel.WIDGET, this.OPEN_DEV_TOOLS, widgetId);
|
|
77
|
-
}
|
|
78
50
|
/**
|
|
79
51
|
* 获取组件配置地址
|
|
80
52
|
* @param widgetName
|
|
81
53
|
*/
|
|
82
54
|
static async getWidgetConfigUrl(widgetName, widgetParams) {
|
|
83
55
|
const widget = await this.getWidget(widgetName);
|
|
84
|
-
if (!widget
|
|
56
|
+
if (!widget)
|
|
57
|
+
return null;
|
|
58
|
+
const configRoute = widget.getConfigRoute();
|
|
59
|
+
if (!configRoute)
|
|
85
60
|
return null;
|
|
86
61
|
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
87
62
|
if (!widgetPackage)
|
|
88
63
|
return null;
|
|
89
|
-
return UrlUtils.getWidgetUrl(
|
|
64
|
+
return UrlUtils.getWidgetUrl(configRoute.url, widgetPackage, widgetParams);
|
|
90
65
|
}
|
|
91
66
|
static async getWidgetUrl(widgetName, widgetParams) {
|
|
92
67
|
const widget = await this.getWidget(widgetName);
|
|
93
|
-
if (!widget
|
|
68
|
+
if (!widget)
|
|
94
69
|
return null;
|
|
70
|
+
const indexRoute = widget.getIndexRoute();
|
|
95
71
|
const widgetPackage = await this.getWidgetPackage(widget.packageName);
|
|
96
72
|
if (!widgetPackage)
|
|
97
73
|
return null;
|
|
98
|
-
return UrlUtils.getWidgetUrl(
|
|
74
|
+
return UrlUtils.getWidgetUrl(indexRoute.url, widgetPackage, widgetParams);
|
|
99
75
|
}
|
|
100
76
|
static async getWidgetPackageIndexUrl(packageName, hash) {
|
|
101
77
|
const widgetPackage = await this.getWidgetPackage(packageName);
|
|
@@ -147,8 +123,4 @@ WidgetApi.GET_WIDGETS = "get-widgets";
|
|
|
147
123
|
WidgetApi.GET_WIDGET = "get-widget";
|
|
148
124
|
WidgetApi.GET_WIDGET_PACKAGE = "get-widget-package";
|
|
149
125
|
WidgetApi.GET_WIDGET_PACKAGES = "get-widget-packages";
|
|
150
|
-
WidgetApi.REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
151
|
-
WidgetApi.REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
152
|
-
WidgetApi.GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
153
|
-
WidgetApi.OPEN_DEV_TOOLS = "open-dev-tools";
|
|
154
126
|
WidgetApi.stores = new Map();
|
package/dist/esm/index.js
CHANGED
|
@@ -13,7 +13,11 @@ export * from "./model/WidgetPackage";
|
|
|
13
13
|
export * from "./api/ElectronApi";
|
|
14
14
|
export * from "./repository/WidgetDataRepository";
|
|
15
15
|
export * from "./api/BrowserWindowApi";
|
|
16
|
+
export * from "./api/GlobalShortcutApi";
|
|
16
17
|
export * from "./api/NotificationApi";
|
|
18
|
+
export * from "./api/HostedWidgetApi";
|
|
19
|
+
export * from "./api/KeyboardApi";
|
|
20
|
+
export * from "./api/DeviceApi";
|
|
17
21
|
export * from "./api/Channel";
|
|
18
22
|
export * from "./api/ClipboardApi";
|
|
19
23
|
export * from "./api/WidgetApi";
|
package/dist/esm/model/Widget.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HostedMode } from "./HostedMode";
|
|
2
2
|
export class Widget {
|
|
3
3
|
constructor(options) {
|
|
4
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5
5
|
/**
|
|
6
6
|
* 组件默认语言
|
|
7
7
|
*/
|
|
@@ -18,13 +18,21 @@ export class Widget {
|
|
|
18
18
|
this.minWidth = (_c = options.minWidth) !== null && _c !== void 0 ? _c : options.width;
|
|
19
19
|
this.minHeight = (_d = options.minHeight) !== null && _d !== void 0 ? _d : options.height;
|
|
20
20
|
this.backgroundThrottling = (_e = options.backgroundThrottling) !== null && _e !== void 0 ? _e : true;
|
|
21
|
-
this.url = options.url;
|
|
22
21
|
this.packageName = options.packageName;
|
|
23
22
|
this.previewImage = options.previewImage;
|
|
24
|
-
this.
|
|
23
|
+
this.shortcut = options.shortcut;
|
|
25
24
|
this.refreshWhenResided = (_f = options.refreshWhenResided) !== null && _f !== void 0 ? _f : false;
|
|
26
|
-
this.
|
|
27
|
-
this.supportHostedMode = (
|
|
25
|
+
this.hideWhenBlur = options.hideWhenBlur == null ? false : options.hideWhenBlur;
|
|
26
|
+
this.supportHostedMode = (_g = options.supportHostedMode) !== null && _g !== void 0 ? _g : HostedMode.NORMAL | HostedMode.OVERLAP;
|
|
27
|
+
this.routes = options.routes;
|
|
28
|
+
}
|
|
29
|
+
getIndexRoute() {
|
|
30
|
+
const result = this.routes.find((it) => it.name.toLowerCase() == 'index');
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
getConfigRoute() {
|
|
34
|
+
const result = this.routes.find((it) => it.name.toLowerCase() == 'config');
|
|
35
|
+
return result;
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* 获取组件标题
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare class ApiConstants {
|
|
2
2
|
static readonly CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
3
3
|
static readonly CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
|
|
4
|
+
static readonly CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
|
|
5
|
+
static readonly CONFIG_GRID_SIZE = "cn.widgetjs.config.grid.size";
|
|
6
|
+
static readonly SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
|
|
4
7
|
}
|
|
@@ -3,8 +3,13 @@ export declare class AppApi {
|
|
|
3
3
|
static readonly GET_CONFIG = "GET_CONFIG";
|
|
4
4
|
static readonly OPEN_ADD_WIDGET_WINDOW = "open-add-widget-window";
|
|
5
5
|
static readonly OPEN_SETTING_WINDOW = "open-setting-window";
|
|
6
|
+
static readonly GET_VERSION = "get-version";
|
|
6
7
|
static setConfig(key: string, value: string | number | boolean): Promise<void>;
|
|
7
|
-
static getConfig(key: string, defaultValue: string | number | boolean): Promise<
|
|
8
|
+
static getConfig(key: string, defaultValue: string | number | boolean): Promise<string | number | boolean>;
|
|
8
9
|
static openAddWidgetWindow(): void;
|
|
10
|
+
/**
|
|
11
|
+
* 获取应用版本号,格式为 x.y.z
|
|
12
|
+
*/
|
|
13
|
+
static getVersion(): Promise<string>;
|
|
9
14
|
static openSettingWindow(): void;
|
|
10
15
|
}
|
|
@@ -3,9 +3,13 @@ export declare enum Channel {
|
|
|
3
3
|
BROWSER_WINDOW = "channel::cn.widgetjs.core.browser_window",
|
|
4
4
|
BROADCAST = "channel::cn.widgetjs.core.broadcast",
|
|
5
5
|
WIDGET = "channel::cn.widgetjs.core.widget",
|
|
6
|
+
HOSTED_WIDGET = "channel::cn.widgetjs.core.hosted_widget",
|
|
6
7
|
APP = "channel::cn.widgetjs.core.app",
|
|
7
8
|
MOUSE_EVENT = "channel::cn.widgetjs.core.mouse_event",
|
|
8
9
|
KEYBOARD_EVENT = "channel::cn.widgetjs.core.keyboard_event",
|
|
9
10
|
DIALOG = "channel::cn.widgetjs.core.dialog",
|
|
10
|
-
CLIPBOARD = "channel::cn.widgetjs.core.clipboard"
|
|
11
|
+
CLIPBOARD = "channel::cn.widgetjs.core.clipboard",
|
|
12
|
+
DEVICE = "channel::cn.widgetjs.core.device",
|
|
13
|
+
KEYBOARD = "channel::cn.widgetjs.core.keyboard",
|
|
14
|
+
SHORTCUT = "channel::cn.widgetjs.core.shortcut"
|
|
11
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class GlobalShortcutApi {
|
|
2
|
+
static readonly REGISTER = "register";
|
|
3
|
+
static readonly IS_REGISTERED = "is-registered";
|
|
4
|
+
static readonly UNREGISTER = "unregister";
|
|
5
|
+
/**
|
|
6
|
+
* 注册全局快捷键
|
|
7
|
+
*/
|
|
8
|
+
static register(key: string): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* 取消注册全局快捷键
|
|
11
|
+
*/
|
|
12
|
+
static unregister(key: string): Promise<void>;
|
|
13
|
+
static isRegistered(key: string): Promise<boolean>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HostedWidget } from "../model/HostedWidget";
|
|
2
|
+
export declare class HostedWidgetApi {
|
|
3
|
+
static readonly REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
4
|
+
static readonly REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
5
|
+
static readonly GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
6
|
+
static readonly GET_HOSTED_WIDGET = "get-hosted-widget";
|
|
7
|
+
static readonly OPEN_DEV_TOOLS = "open-dev-tools";
|
|
8
|
+
static readonly REGISTER_ACTIVE_SHORTCUT = "register-active-shortcut";
|
|
9
|
+
static readonly SET_PROXY = "SET_PROXY";
|
|
10
|
+
static readonly UPDATE = "UPDATE";
|
|
11
|
+
/**
|
|
12
|
+
* 移除组件
|
|
13
|
+
* @param id
|
|
14
|
+
*/
|
|
15
|
+
static removeHostedWidget(id: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 通过组件名移除已添加的组件
|
|
18
|
+
* @param name 组件名
|
|
19
|
+
*/
|
|
20
|
+
static removeHostedWidgetByName(name: string): Promise<HostedWidget[]>;
|
|
21
|
+
/**
|
|
22
|
+
* 获取已添加的组件
|
|
23
|
+
* @param name 组件名,可以不传
|
|
24
|
+
*/
|
|
25
|
+
static getHostedWidgets(name?: string): Promise<HostedWidget[]>;
|
|
26
|
+
static getHostedWidget(id: string): Promise<HostedWidget>;
|
|
27
|
+
/**
|
|
28
|
+
* Opens the dev tools for a widget with the specified ID.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} widgetId - The ID of the widget to open the dev tools for.
|
|
31
|
+
* @return {Promise} A Promise that resolves when the dev tools are opened.
|
|
32
|
+
*/
|
|
33
|
+
static openDevTools(widgetId: string): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* 注册激活、呼出、置顶组件快捷键
|
|
36
|
+
* @param widgetId 组件id
|
|
37
|
+
* @param shortcut 如果传空或者不传,则会取消快捷键。更多快捷键配置,请查看Accelerator用法
|
|
38
|
+
* https://www.electronjs.org/docs/latest/api/accelerator
|
|
39
|
+
*/
|
|
40
|
+
static registerActiveShortcut(widgetId: string, shortcut?: string): Promise<boolean>;
|
|
41
|
+
static setProxy(widgetId: string, proxy: string): Promise<boolean>;
|
|
42
|
+
}
|
|
@@ -2,7 +2,6 @@ import { Widget } from "../model/Widget";
|
|
|
2
2
|
import { WidgetPackage } from "../model/WidgetPackage";
|
|
3
3
|
import { WidgetParams } from "../model/WidgetParams";
|
|
4
4
|
import { WidgetData } from "../model/WidgetData";
|
|
5
|
-
import HostedWidget from "../model/HostedWidget";
|
|
6
5
|
export interface SaveWidgetOption {
|
|
7
6
|
sendBroadcast?: boolean;
|
|
8
7
|
id?: string;
|
|
@@ -14,10 +13,6 @@ export declare class WidgetApi {
|
|
|
14
13
|
static readonly GET_WIDGET = "get-widget";
|
|
15
14
|
static readonly GET_WIDGET_PACKAGE = "get-widget-package";
|
|
16
15
|
static readonly GET_WIDGET_PACKAGES = "get-widget-packages";
|
|
17
|
-
static readonly REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
18
|
-
static readonly REMOVE_HOSTED_WIDGET_BY_NAME = "remove-hosted-widget-by-name";
|
|
19
|
-
static readonly GET_HOSTED_WIDGETS = "get-hosted-widgets";
|
|
20
|
-
static readonly OPEN_DEV_TOOLS = "open-dev-tools";
|
|
21
16
|
static registerWidgets(widgets: Widget[]): Promise<void>;
|
|
22
17
|
static registerWidgetPackage(widgetPackage: WidgetPackage): Promise<void>;
|
|
23
18
|
static getWidgets(): Promise<Widget[]>;
|
|
@@ -32,22 +27,6 @@ export declare class WidgetApi {
|
|
|
32
27
|
* @param name package name
|
|
33
28
|
*/
|
|
34
29
|
static getWidgetPackage(name: string): Promise<WidgetPackage>;
|
|
35
|
-
/**
|
|
36
|
-
* 移除组件
|
|
37
|
-
* @param id
|
|
38
|
-
*/
|
|
39
|
-
static removeHostedWidget(id: string): Promise<any>;
|
|
40
|
-
/**
|
|
41
|
-
* 通过组件名移除已添加的组件
|
|
42
|
-
* @param name 组件名
|
|
43
|
-
*/
|
|
44
|
-
static removeHostedWidgetByName(name: string): Promise<HostedWidget[]>;
|
|
45
|
-
/**
|
|
46
|
-
* 获取已添加的组件
|
|
47
|
-
* @param name 组件名,可以不传
|
|
48
|
-
*/
|
|
49
|
-
static getHostedWidgets(name?: string): Promise<HostedWidget[]>;
|
|
50
|
-
static openDevTools(widgetId: string): Promise<any>;
|
|
51
30
|
/**
|
|
52
31
|
* 获取组件配置地址
|
|
53
32
|
* @param widgetName
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export * from "./model/WidgetPackage";
|
|
|
13
13
|
export * from "./api/ElectronApi";
|
|
14
14
|
export * from "./repository/WidgetDataRepository";
|
|
15
15
|
export * from "./api/BrowserWindowApi";
|
|
16
|
+
export * from "./api/GlobalShortcutApi";
|
|
16
17
|
export * from "./api/NotificationApi";
|
|
18
|
+
export * from "./api/HostedWidgetApi";
|
|
19
|
+
export * from "./api/KeyboardApi";
|
|
20
|
+
export * from "./api/DeviceApi";
|
|
17
21
|
export * from "./api/Channel";
|
|
18
22
|
export * from "./api/ClipboardApi";
|
|
19
23
|
export * from "./api/WidgetApi";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BrowserWindowStatus from "./BrowserWindowStatus";
|
|
2
|
-
export
|
|
2
|
+
export declare class HostedWidget {
|
|
3
3
|
id: string;
|
|
4
4
|
widgetName: string;
|
|
5
5
|
packageName: string;
|
|
@@ -7,5 +7,7 @@ export default class HostedWidget {
|
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
browserWindowStatus?: BrowserWindowStatus;
|
|
10
|
+
shortcut?: string;
|
|
11
|
+
proxy?: string;
|
|
10
12
|
isOverlap(): boolean;
|
|
11
13
|
}
|
|
@@ -15,19 +15,17 @@ type WidgetOptions = {
|
|
|
15
15
|
maxHeight?: number;
|
|
16
16
|
minWidth?: number;
|
|
17
17
|
minHeight?: number;
|
|
18
|
-
url: string;
|
|
19
|
-
configUrl?: string;
|
|
20
18
|
packageName?: string;
|
|
21
19
|
previewImage?: string;
|
|
22
|
-
extraUrl?: {
|
|
23
|
-
[key: string]: string;
|
|
24
|
-
};
|
|
25
20
|
supportHostedMode?: HostedMode;
|
|
26
21
|
backgroundThrottling?: boolean;
|
|
22
|
+
shortcut?: string;
|
|
27
23
|
/**
|
|
28
24
|
* 组件拉伸后,是否强制刷新组件
|
|
29
25
|
*/
|
|
30
26
|
refreshWhenResided?: boolean;
|
|
27
|
+
hideWhenBlur?: boolean;
|
|
28
|
+
routes: WidgetRoute[];
|
|
31
29
|
};
|
|
32
30
|
export declare class Widget {
|
|
33
31
|
readonly name: string;
|
|
@@ -61,12 +59,9 @@ export declare class Widget {
|
|
|
61
59
|
* 预览图片,可以是GIF
|
|
62
60
|
*/
|
|
63
61
|
readonly previewImage?: string;
|
|
64
|
-
readonly url: string;
|
|
65
62
|
readonly supportHostedMode: number;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*/
|
|
69
|
-
readonly configUrl?: string | null;
|
|
63
|
+
readonly hideWhenBlur: boolean;
|
|
64
|
+
readonly shortcut?: string;
|
|
70
65
|
/**
|
|
71
66
|
* 组件拉伸后,是否强制刷新组件
|
|
72
67
|
*/
|
|
@@ -74,10 +69,10 @@ export declare class Widget {
|
|
|
74
69
|
/**
|
|
75
70
|
* 组件其他页面的url在这注册
|
|
76
71
|
*/
|
|
77
|
-
readonly
|
|
78
|
-
[key: string]: string;
|
|
79
|
-
};
|
|
72
|
+
readonly routes: WidgetRoute[];
|
|
80
73
|
constructor(options: WidgetOptions);
|
|
74
|
+
getIndexRoute(): WidgetRoute;
|
|
75
|
+
getConfigRoute(): WidgetRoute | undefined;
|
|
81
76
|
/**
|
|
82
77
|
* 获取组件标题
|
|
83
78
|
* @param lang 语言环境,不传则获取默认语言
|
|
@@ -103,6 +98,14 @@ export declare class Widget {
|
|
|
103
98
|
isSupportWallpaper(): boolean;
|
|
104
99
|
isSupportScreen(): boolean;
|
|
105
100
|
}
|
|
101
|
+
export interface WidgetRoute {
|
|
102
|
+
name: string;
|
|
103
|
+
url: string;
|
|
104
|
+
meta?: {
|
|
105
|
+
[key: string]: string;
|
|
106
|
+
};
|
|
107
|
+
assistUrl?: string;
|
|
108
|
+
}
|
|
106
109
|
export declare enum WidgetKeyword {
|
|
107
110
|
RECOMMEND = "recommend",
|
|
108
111
|
TOOLS = "tools",
|
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:()=>E,dotCase:()=>I,headerCase:()=>m,noCase:()=>s,paramCase:()=>b,pascalCase:()=>d,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>l,pathCase:()=>A,sentenceCase:()=>w,sentenceCaseTransform:()=>O,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 E(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:_},t))}function I(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function m(e,t){return void 0===t&&(t={}),y(e,r({delimiter:"-"},t))}function b(e,t){return void 0===t&&(t={}),I(e,r({delimiter:"-"},t))}function A(e,t){return void 0===t&&(t={}),I(e,r({delimiter:"/"},t))}function O(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function w(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:O},t))}function P(e,t){return void 0===t&&(t={}),I(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 E(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 I(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function m(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);E(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),I(e)}}))}function A(e){return b(e,!1)}function O(e){return b(e,!0)}function w(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),O(e)})).then((function(){return function(e){E(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,w(e)?O(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 m(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,w(n,t._defaultConfig.version)?O(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;E(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,I(n._dbInfo)}})).catch((function(t){throw(m(e,t)||a.resolve()).catch((function(){})),t}))}})):c.then((function(t){E(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++)I(r[t]._dbInfo)})).catch((function(t){throw(m(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,U="arbf",j="blob",B="si08",k="ui08",L="uic8",G="si16",x="si32",H="ur16",F="ui32",V="fl32",z="fl64",K=M+U.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 X(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 Q={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+=U):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=k:"[object Uint8ClampedArray]"===n?o+=L:"[object Int16Array]"===n?o+=G:"[object Uint16Array]"===n?o+=H:"[object Int32Array]"===n?o+=x:"[object Uint32Array]"===n?o+=F:"[object Float32Array]"===n?o+=V:"[object Float64Array]"===n?o+=z:t(new Error("Failed to get type for BinaryArray"))),t(o+X(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+X(this.result);t(C+j+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(K),r=e.substring(M,K);if(r===j&&D.test(n)){var o=n.match(D);t=o[1],n=n.substring(o[0].length)}var a=J(n);switch(r){case U:return a;case j:return i([a],{type:t});case B:return new Int8Array(a);case k:return new Uint8Array(a);case L:return new Uint8ClampedArray(a);case G:return new Int16Array(a);case H:return new Uint16Array(a);case x:return new Int32Array(a);case F:return new Uint32Array(a);case V:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:J,bufferToString:X};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=Q,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=Q,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(Q);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 moveTop(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.MOVE_TOP))}static async openDevTools(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.OPEN_DEV_TOOLS))}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))}static async existsByUrl(e){var t;return await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.EXISTS_BY_URL,e))}}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.MOVE_TOP="move-top",i.OPEN_DEV_TOOLS="open-dev-tools",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.EXISTS_BY_URL="exists-by-url",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",n.CLIPBOARD="channel::cn.widgetjs.core.clipboard"},989:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClipboardApi=void 0;const r=n(990),o=n(841);class i{static async getSelectedText(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.CLIPBOARD,this.GET_SELECTED_TEXT))}}t.ClipboardApi=i,i.GET_SELECTED_TEXT="get-selected-text"},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 send(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.NOTIFICATION,e)}static async reminder(e,t,n,o,i,a,s,c=5e3){return await this.send(new r.AppNotification({icon:n,message:t,title:e,duration:c,cancelButtonText:o,confirmButtonText:i,cancelBroadcast:a,confirmBroadcast:s,type:"reminder"}))}static async advanceCountdown(e,t,n){return await this.send(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 removeHostedWidgetByName(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.REMOVE_HOSTED_WIDGET_BY_NAME,e)}static async getHostedWidgets(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.GET_HOSTED_WIDGETS,e)}static async openDevTools(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(s.Channel.WIDGET,this.OPEN_DEV_TOOLS,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 getWidgetPackageIndexUrl(e,t){const n=await this.getWidgetPackage(e);return n?n.getIndexUrl(t):null}static async getWidgetPackageUrl(e){const t=await this.getWidgetPackage(e);return t?t.url: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.REMOVE_HOSTED_WIDGET_BY_NAME="remove-hosted-widget-by-name",f.GET_HOSTED_WIDGETS="get-hosted-widgets",f.OPEN_DEV_TOOLS="open-dev-tools",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(726),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(989),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.createdAt=(new Date).toISOString(),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.BACKGROUND=65536]="BACKGROUND",n[n.ALL=69905]="ALL"},726:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(995);t.default=class{constructor(){this.x=0,this.y=0}isOverlap(){return(this.hostedMode&r.HostedMode.OVERLAP)>0}}},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,u;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.backgroundThrottling=null===(a=e.backgroundThrottling)||void 0===a||a,this.url=e.url,this.packageName=e.packageName,this.previewImage=e.previewImage,this.configUrl=e.configUrl,this.refreshWhenResided=null!==(s=e.refreshWhenResided)&&void 0!==s&&s,this.extraUrl=null!==(c=e.extraUrl)&&void 0!==c?c:{},this.supportHostedMode=null!==(u=e.supportHostedMode)&&void 0!==u?u: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}isResizable(){return!(this.minWidth==this.width&&this.maxWidth==this.width&&this.minHeight==this.height&&this.maxHeight==this.height)}isSupportBackground(){return(this.supportHostedMode&r.HostedMode.BACKGROUND)>0}isSupportNormal(){return(this.supportHostedMode&r.HostedMode.NORMAL)>0}isSupportWallpaper(){return(this.supportHostedMode&r.HostedMode.WALLPAPER)>0}isSupportScreen(){return(this.supportHostedMode&r.HostedMode.SCREEN)>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}getIndexUrl(e){return r.UrlUtils.getWidgetPackageIndexUrl(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 fromLocation(e){let t=e.split("?");if(t.length>1){let e=t[1];return this.fromObject((0,r.parseQuery)(e))}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",n.TYPE_EDIT_DESKTOP_WIDGETS="broadcast::cn.widgetjs.core.edit_desktop_widgets"},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.getIndexUrl()+e,r.includes("?")?r+"&"+n.toUrlParams().toString():r+"?"+n.toUrlParams().toString()}static getWidgetPackageIndexUrl(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)})()));
|
|
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={94:(e,t,n)=>{"use strict";n.r(t),n.d(t,{camelCase:()=>h,camelCaseTransform:()=>f,camelCaseTransformMerge:()=>v,capitalCase:()=>_,capitalCaseTransform:()=>g,constantCase:()=>y,dotCase:()=>I,headerCase:()=>A,noCase:()=>s,paramCase:()=>b,pascalCase:()=>d,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>l,pathCase:()=>m,sentenceCase:()=>T,sentenceCaseTransform:()=>O,snakeCase:()=>w});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 _(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:g},t))}function E(e){return e.toUpperCase()}function y(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:E},t))}function I(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function A(e,t){return void 0===t&&(t={}),_(e,r({delimiter:"-"},t))}function b(e,t){return void 0===t&&(t={}),I(e,r({delimiter:"-"},t))}function m(e,t){return void 0===t&&(t={}),I(e,r({delimiter:"/"},t))}function O(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function T(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:O},t))}function w(e,t){return void 0===t&&(t={}),I(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 _(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(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 y(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 I(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function A(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);y(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),I(e)}}))}function m(e){return b(e,!1)}function O(e){return b(e,!0)}function T(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 w(e){return i([_(atob(e.data))],{type:e.type})}function S(e){return e&&e.__local_forage_encoded_blob}function P(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 R(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),O(e)})).then((function(){return function(e){y(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,m(e).then((function(t){return e.db=t,T(e)?O(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 A(e,t),t}))}(e).then((function(){R(e,t,n,r-1)}))})).catch(n);n(o)}}var N={_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=P);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,m(n)})).then((function(e){return n.db=e,T(n,t._defaultConfig.version)?O(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(){R(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=w(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(){R(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=w(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)?E(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){R(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(){R(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(){R(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(){R(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(){R(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(){R(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,r=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db?a.resolve(this._dbInfo.db):m(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}));n=e.storeName?i.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;y(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,I(n._dbInfo)}})).catch((function(t){throw(A(e,t)||a.resolve()).catch((function(){})),t}))}})):i.then((function(t){y(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++)I(r[t]._dbInfo)})).catch((function(t){throw(A(e,t)||a.resolve()).catch((function(){})),t}))}))}else n=a.reject("Invalid arguments");return s(n,t),n}};var D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C="~~local_forage_type~",W=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",U=M.length,j="arbf",k="blob",B="si08",G="ui08",L="uic8",x="si16",H="si32",F="ur16",V="ui32",K="fl32",z="fl64",Y=U+j.length,X=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=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 q={serialize:function(e,t){var n="";if(e&&(n=X.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===X.call(e.buffer))){var r,o=M;e instanceof ArrayBuffer?(r=e,o+=j):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=G:"[object Uint8ClampedArray]"===n?o+=L:"[object Int16Array]"===n?o+=x:"[object Uint16Array]"===n?o+=F:"[object Int32Array]"===n?o+=H:"[object Uint32Array]"===n?o+=V:"[object Float32Array]"===n?o+=K:"[object Float64Array]"===n?o+=z: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=C+e.type+"~"+Q(this.result);t(M+k+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,U)!==M)return JSON.parse(e);var t,n=e.substring(Y),r=e.substring(U,Y);if(r===k&&W.test(n)){var o=n.match(W);t=o[1],n=n.substring(o[0].length)}var a=J(n);switch(r){case j:return a;case k:return i([a],{type:t});case B:return new Int8Array(a);case G:return new Uint8Array(a);case L:return new Uint8ClampedArray(a);case x:return new Int16Array(a);case F:return new Uint16Array(a);case H:return new Int32Array(a);case V:return new Uint32Array(a);case K:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:J,bufferToString:Q};function Z(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function $(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):Z(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function ee(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){$(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(ee.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}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){Z(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=q,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){$(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){$(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 ee.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){$(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){$(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){$(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){$(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){$(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(function(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)}))}))}(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=q,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:N,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(q);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}(),_e=new ge;t.exports=_e},{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",n.CONFIG_DEBUG_MODE="cn.widgetjs.config.debug",n.CONFIG_GRID_SIZE="cn.widgetjs.config.grid.size",n.SHORTCUT_PIN_DESKTOP_WIDGETS="cn.widgetjs.config.shortcut.pin_desktop_widgets"},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:"number"==typeof t?Number(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 async getVersion(){var e;return null===(e=r.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(o.Channel.APP,this.GET_VERSION)}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",i.GET_VERSION="get-version"},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 moveTop(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.MOVE_TOP))}static async openDevTools(){var e;await(null===(e=o.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(r.Channel.BROWSER_WINDOW,this.OPEN_DEV_TOOLS))}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))}static async existsByUrl(e){var t;return await(null===(t=o.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(r.Channel.BROWSER_WINDOW,this.EXISTS_BY_URL,e))}}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.MOVE_TOP="move-top",i.OPEN_DEV_TOOLS="open-dev-tools",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.EXISTS_BY_URL="exists-by-url",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.HOSTED_WIDGET="channel::cn.widgetjs.core.hosted_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",n.CLIPBOARD="channel::cn.widgetjs.core.clipboard",n.DEVICE="channel::cn.widgetjs.core.device",n.KEYBOARD="channel::cn.widgetjs.core.keyboard",n.SHORTCUT="channel::cn.widgetjs.core.shortcut"},989:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClipboardApi=void 0;const r=n(990),o=n(841);class i{static async getSelectedText(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.CLIPBOARD,this.GET_SELECTED_TEXT))}}t.ClipboardApi=i,i.GET_SELECTED_TEXT="get-selected-text"},394:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceApi=void 0;const r=n(990),o=n(841);class i{static async getCursorScreenPoint(){var e;return await(null===(e=r.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(o.Channel.DEVICE,this.GET_CURSOR_SCREEN_POINT))}}t.DeviceApi=i,i.GET_CURSOR_SCREEN_POINT="get-cursor-screen-point"},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))}}},671:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalShortcutApi=void 0;const r=n(990),o=n(841);class i{static async register(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.SHORTCUT,this.REGISTER,e))}static async unregister(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.SHORTCUT,this.UNREGISTER,e))}static async isRegistered(e){var t;return await(null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.SHORTCUT,this.IS_REGISTERED,e))}}t.GlobalShortcutApi=i,i.REGISTER="register",i.IS_REGISTERED="is-registered",i.UNREGISTER="unregister"},766:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidgetApi=void 0;const r=n(990),o=n(841);class i{static async removeHostedWidget(e){var t;return null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.HOSTED_WIDGET,this.REMOVE_HOSTED_WIDGET,e)}static async removeHostedWidgetByName(e){var t;return null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.HOSTED_WIDGET,this.REMOVE_HOSTED_WIDGET_BY_NAME,e)}static async getHostedWidgets(e){var t;return null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.HOSTED_WIDGET,this.GET_HOSTED_WIDGETS,e)}static async getHostedWidget(e){var t;return null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.HOSTED_WIDGET,this.GET_HOSTED_WIDGET,e)}static async openDevTools(e){var t;return null===(t=r.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.HOSTED_WIDGET,this.OPEN_DEV_TOOLS,e)}static async registerActiveShortcut(e,t){var n;return null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.HOSTED_WIDGET,this.REGISTER_ACTIVE_SHORTCUT,e,t)}static async setProxy(e,t){var n;return null===(n=r.ElectronUtils.getAPI())||void 0===n?void 0:n.invoke(o.Channel.HOSTED_WIDGET,this.SET_PROXY,e,t)}}t.HostedWidgetApi=i,i.REMOVE_HOSTED_WIDGET="remove-hosted-widget",i.REMOVE_HOSTED_WIDGET_BY_NAME="remove-hosted-widget-by-name",i.GET_HOSTED_WIDGETS="get-hosted-widgets",i.GET_HOSTED_WIDGET="get-hosted-widget",i.OPEN_DEV_TOOLS="open-dev-tools",i.REGISTER_ACTIVE_SHORTCUT="register-active-shortcut",i.SET_PROXY="SET_PROXY",i.UPDATE="UPDATE"},846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardApi=void 0;const r=n(990),o=n(841);class i{static async sendCtrlC(){var e;return await(null===(e=r.ElectronUtils.getAPI())||void 0===e?void 0:e.invoke(o.Channel.KEYBOARD,this.SEND_CTRL_C))}}t.KeyboardApi=i,i.SEND_CTRL_C="SEND_CTRL_C"},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 send(e){var t;return null===(t=i.ElectronUtils.getAPI())||void 0===t?void 0:t.invoke(o.Channel.NOTIFICATION,e)}static async reminder(e,t,n,o,i,a,s,c=5e3){return await this.send(new r.AppNotification({icon:n,message:t,title:e,duration:c,cancelButtonText:o,confirmButtonText:i,cancelBroadcast:a,confirmBroadcast:s,type:"reminder"}))}static async advanceCountdown(e,t,n){return await this.send(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 getWidgetConfigUrl(e,t){const n=await this.getWidget(e);if(!n)return null;const r=n.getConfigRoute();if(!r)return null;const o=await this.getWidgetPackage(n.packageName);return o?c.UrlUtils.getWidgetUrl(r.url,o,t):null}static async getWidgetUrl(e,t){const n=await this.getWidget(e);if(!n)return null;const r=n.getIndexRoute(),o=await this.getWidgetPackage(n.packageName);return o?c.UrlUtils.getWidgetUrl(r.url,o,t):null}static async getWidgetPackageIndexUrl(e,t){const n=await this.getWidgetPackage(e);return n?n.getIndexUrl(t):null}static async getWidgetPackageUrl(e){const t=await this.getWidgetPackage(e);return t?t.url: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.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(726),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(671),t),o(n(717),t),o(n(766),t),o(n(846),t),o(n(394),t),o(n(841),t),o(n(989),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.createdAt=(new Date).toISOString(),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.BACKGROUND=65536]="BACKGROUND",n[n.ALL=69905]="ALL"},726:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidget=void 0;const r=n(995);t.HostedWidget=class{constructor(){this.x=0,this.y=0}isOverlap(){return(this.hostedMode&r.HostedMode.OVERLAP)>0}}},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.backgroundThrottling=null===(a=e.backgroundThrottling)||void 0===a||a,this.packageName=e.packageName,this.previewImage=e.previewImage,this.shortcut=e.shortcut,this.refreshWhenResided=null!==(s=e.refreshWhenResided)&&void 0!==s&&s,this.hideWhenBlur=null!=e.hideWhenBlur&&e.hideWhenBlur,this.supportHostedMode=null!==(c=e.supportHostedMode)&&void 0!==c?c:r.HostedMode.NORMAL|r.HostedMode.OVERLAP,this.routes=e.routes}getIndexRoute(){return this.routes.find((e=>"index"==e.name.toLowerCase()))}getConfigRoute(){return this.routes.find((e=>"config"==e.name.toLowerCase()))}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}isResizable(){return!(this.minWidth==this.width&&this.maxWidth==this.width&&this.minHeight==this.height&&this.maxHeight==this.height)}isSupportBackground(){return(this.supportHostedMode&r.HostedMode.BACKGROUND)>0}isSupportNormal(){return(this.supportHostedMode&r.HostedMode.NORMAL)>0}isSupportWallpaper(){return(this.supportHostedMode&r.HostedMode.WALLPAPER)>0}isSupportScreen(){return(this.supportHostedMode&r.HostedMode.SCREEN)>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}getIndexUrl(e){return r.UrlUtils.getWidgetPackageIndexUrl(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(94);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 fromLocation(e){let t=e.split("?");if(t.length>1){let e=t[1];return this.fromObject((0,r.parseQuery)(e))}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",n.TYPE_EDIT_DESKTOP_WIDGETS="broadcast::cn.widgetjs.core.edit_desktop_widgets"},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 _(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=_,t.encodeParam=function(e){return null==e?"":_(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.getIndexUrl()+e,r.includes("?")?r+"&"+n.toUrlParams().toString():r+"?"+n.toUrlParams().toString()}static getWidgetPackageIndexUrl(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)})()));
|