@widget-js/core 0.5.5 → 0.5.13

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.
@@ -34,8 +34,8 @@ class BrowserWindowApiImpl extends BaseApi_1.BaseApi {
34
34
  async isAlwaysOnTop() {
35
35
  return await this.invokeMethod('isAlwaysOnTop');
36
36
  }
37
- async openUrl(url) {
38
- await this.invokeMethod('openUrl', url);
37
+ async openUrl(url, option) {
38
+ await this.invokeMethod('openUrl', url, option);
39
39
  }
40
40
  async moveTop() {
41
41
  await this.invokeMethod('moveTop');
@@ -14,6 +14,9 @@ class HostedWidgetApiImpl extends BaseApi_1.BaseApi {
14
14
  async removeHostedWidget(id) {
15
15
  return this.invokeMethod('removeHostedWidget', id);
16
16
  }
17
+ addWidget(widgetName, hostMode) {
18
+ return this.invokeMethod('addWidget', widgetName, hostMode);
19
+ }
17
20
  /**
18
21
  * 通过组件名移除已添加的组件
19
22
  * @param name 组件名
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationApi = void 0;
3
+ exports.NotificationApiEvent = exports.NotificationApi = void 0;
4
4
  const AppNotification_1 = require("../model/AppNotification");
5
5
  const Channel_1 = require("./Channel");
6
- const ElectronUtils_1 = require("../utils/ElectronUtils");
7
6
  const BaseApi_1 = require("./BaseApi");
7
+ var NotificationApiEvent;
8
+ (function (NotificationApiEvent) {
9
+ NotificationApiEvent["CONFIRM"] = "event::cn.widgetjs.core.notification.confirm";
10
+ NotificationApiEvent["CANCEL"] = "event::cn.widgetjs.core.notification.cancel";
11
+ NotificationApiEvent["HIDE"] = "event::cn.widgetjs.core.notification.hide";
12
+ })(NotificationApiEvent || (NotificationApiEvent = {}));
13
+ exports.NotificationApiEvent = NotificationApiEvent;
8
14
  class NotificationApiImpl extends BaseApi_1.BaseApi {
9
15
  // static async url(url: string, duration: number = -1) {
10
16
  // this.invoke(Channel.NOTIFICATION, new AppNotification({
@@ -22,7 +28,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
22
28
  * @param lyric 歌词字符串
23
29
  */
24
30
  async call(avatar, audio, title, message, lyric) {
25
- this.invoke(new AppNotification_1.AppNotification({
31
+ await this.invoke(new AppNotification_1.AppNotification({
26
32
  avatar,
27
33
  audio,
28
34
  message,
@@ -57,7 +63,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
57
63
  }));
58
64
  }
59
65
  async countdown(message, targetTime) {
60
- this.send(new AppNotification_1.AppNotification({
66
+ await this.send(new AppNotification_1.AppNotification({
61
67
  message,
62
68
  targetTime,
63
69
  backgroundColor: 'rgba(0,0,0,0.5)',
@@ -66,7 +72,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
66
72
  }));
67
73
  }
68
74
  async success(message, duration = 5000) {
69
- this.send(new AppNotification_1.AppNotification({
75
+ await this.send(new AppNotification_1.AppNotification({
70
76
  message,
71
77
  type: "success",
72
78
  icon: "check_circle_line",
@@ -74,7 +80,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
74
80
  }));
75
81
  }
76
82
  async error(message, duration = 5000) {
77
- this.send(new AppNotification_1.AppNotification({
83
+ await this.send(new AppNotification_1.AppNotification({
78
84
  message,
79
85
  type: "error",
80
86
  icon: "close_circle_line",
@@ -82,7 +88,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
82
88
  }));
83
89
  }
84
90
  async warning(message, duration = 5000) {
85
- this.send(new AppNotification_1.AppNotification({
91
+ await this.send(new AppNotification_1.AppNotification({
86
92
  message,
87
93
  type: "warning",
88
94
  icon: "warning_line",
@@ -90,7 +96,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
90
96
  }));
91
97
  }
92
98
  async info(message, duration = 5000) {
93
- this.send(new AppNotification_1.AppNotification({
99
+ await this.send(new AppNotification_1.AppNotification({
94
100
  message,
95
101
  type: "info",
96
102
  icon: "information_line",
@@ -101,9 +107,7 @@ class NotificationApiImpl extends BaseApi_1.BaseApi {
101
107
  * 隐藏通知
102
108
  */
103
109
  async hide() {
104
- if (ElectronUtils_1.ElectronUtils.hasElectronApi()) {
105
- this.invokeMethod('hide');
106
- }
110
+ await this.invokeMethod('hide');
107
111
  }
108
112
  getChannel() {
109
113
  return Channel_1.Channel.NOTIFICATION;
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.WidgetApiEvent = exports.WidgetApi = void 0;
7
4
  const Widget_1 = require("../model/Widget");
8
5
  const WidgetPackage_1 = require("../model/WidgetPackage");
9
6
  const Channel_1 = require("./Channel");
10
7
  const UrlUtils_1 = require("../utils/UrlUtils");
11
- const BroadcastEvent_1 = require("../model/event/BroadcastEvent");
12
- const BroadcastApi_1 = require("./BroadcastApi");
13
- const localforage_1 = __importDefault(require("localforage"));
14
8
  const BaseApi_1 = require("./BaseApi");
15
9
  var WidgetApiEvent;
16
10
  (function (WidgetApiEvent) {
17
- WidgetApiEvent["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data0changed";
11
+ WidgetApiEvent["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data-changed";
18
12
  WidgetApiEvent["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
19
13
  })(WidgetApiEvent || (WidgetApiEvent = {}));
20
14
  exports.WidgetApiEvent = WidgetApiEvent;
21
15
  class WidgetApiImpl extends BaseApi_1.BaseApi {
22
- constructor() {
23
- super(...arguments);
24
- this.stores = new Map();
25
- }
26
16
  getChannel() {
27
17
  return Channel_1.Channel.WIDGET;
28
18
  }
@@ -97,43 +87,6 @@ class WidgetApiImpl extends BaseApi_1.BaseApi {
97
87
  return null;
98
88
  return widgetPackage.url;
99
89
  }
100
- /**
101
- * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
102
- * @param data
103
- * @param options
104
- */
105
- async saveDataByName(data, options = { sendBroadcast: true }) {
106
- const store = this.getStore(data.name);
107
- const json = JSON.stringify(data);
108
- const result = await store.setItem(data.name, json);
109
- if (options.sendBroadcast) {
110
- const broadcastEvent = new BroadcastEvent_1.BroadcastEvent({
111
- event: WidgetApiEvent.DATA_CHANGED,
112
- payload: {
113
- name: data.name,
114
- id: options.id,
115
- json
116
- }
117
- });
118
- await BroadcastApi_1.BroadcastApi.send(broadcastEvent);
119
- }
120
- return result;
121
- }
122
- /**
123
- * 获取组件 LocalForage 存储实例
124
- * @param name
125
- */
126
- getStore(name) {
127
- if (this.stores.has(name)) {
128
- return this.stores.get(name);
129
- }
130
- const store = localforage_1.default.createInstance({ name: name });
131
- this.stores.set(name, store);
132
- return store;
133
- }
134
- addWidget(widgetName, hostMode) {
135
- return this.invokeMethod('addWidget', widgetName, hostMode);
136
- }
137
90
  }
138
91
  const WidgetApi = new WidgetApiImpl();
139
92
  exports.WidgetApi = WidgetApi;
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WidgetDataRepository = void 0;
6
+ exports.WidgetDataApi = void 0;
7
7
  const localforage_1 = __importDefault(require("localforage"));
8
8
  const BroadcastEvent_1 = require("../model/event/BroadcastEvent");
9
9
  const BroadcastApi_1 = require("../api/BroadcastApi");
10
10
  const WidgetApi_1 = require("../api/WidgetApi");
11
- class WidgetDataRepository {
11
+ class WidgetDataApi {
12
12
  /**
13
13
  * 保存组件数据
14
14
  * @param data
@@ -38,15 +38,18 @@ class WidgetDataRepository {
38
38
  /**
39
39
  * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
40
40
  * @param data
41
+ * @param options
41
42
  */
42
- static async saveByName(data) {
43
+ static async saveByName(data, options = { sendBroadcast: true }) {
43
44
  const store = this.getStore(data.name);
44
45
  const json = JSON.stringify(data);
45
46
  const result = await store.setItem(data.name, json);
46
- const broadcastEvent = new BroadcastEvent_1.BroadcastEvent({
47
- event: WidgetApi_1.WidgetApiEvent.DATA_CHANGED, payload: { name: data.name, json }
48
- });
49
- await BroadcastApi_1.BroadcastApi.send(broadcastEvent);
47
+ if (options === null || options === void 0 ? void 0 : options.sendBroadcast) {
48
+ const broadcastEvent = new BroadcastEvent_1.BroadcastEvent({
49
+ event: WidgetApi_1.WidgetApiEvent.DATA_CHANGED, payload: { name: data.name, json }
50
+ });
51
+ await BroadcastApi_1.BroadcastApi.send(broadcastEvent);
52
+ }
50
53
  return result;
51
54
  }
52
55
  static async findByName(name, type) {
@@ -73,5 +76,5 @@ class WidgetDataRepository {
73
76
  return `${name}@${id}`;
74
77
  }
75
78
  }
76
- exports.WidgetDataRepository = WidgetDataRepository;
77
- WidgetDataRepository.stores = new Map();
79
+ exports.WidgetDataApi = WidgetDataApi;
80
+ WidgetDataApi.stores = new Map();
package/dist/cjs/index.js CHANGED
@@ -27,7 +27,7 @@ __exportStar(require("./model/event/NativeKeyboardEvent"), exports);
27
27
  __exportStar(require("./model/event/AppMouseEvent"), exports);
28
28
  __exportStar(require("./model/WidgetPackage"), exports);
29
29
  __exportStar(require("./api/ElectronApi"), exports);
30
- __exportStar(require("./repository/WidgetDataRepository"), exports);
30
+ __exportStar(require("./api/WidgetDataApi"), exports);
31
31
  __exportStar(require("./api/BrowserWindowApi"), exports);
32
32
  __exportStar(require("./lang/LanguageCode"), exports);
33
33
  __exportStar(require("./api/NotificationApi"), exports);
@@ -3,34 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTextByLanguageCode = void 0;
4
4
  /**
5
5
  * 根据语言环境获取文本
6
- * @param obj 对象
7
- * @param key 属性名
6
+ * @param langMap 对象
8
7
  * @param {LanguageCode} langCode 语言环境 例如:zh-CN,en-US
8
+ * @param fallbackToBrowser
9
9
  */
10
- function getTextByLanguageCode(obj, langCode) {
10
+ function getTextByLanguageCode(langMap, langCode, fallbackToBrowser = true) {
11
11
  let result;
12
12
  if (langCode) {
13
- if (langCode in obj) {
14
- return obj[langCode];
13
+ if (langCode in langMap) {
14
+ return langMap[langCode];
15
15
  }
16
16
  }
17
17
  // fallback to browser default language
18
- if (result == undefined) {
18
+ if (result == undefined && fallbackToBrowser) {
19
19
  if (typeof navigator != 'undefined' && navigator.languages) {
20
- for (let language of navigator.languages) {
21
- const langCode = language;
22
- result = getTextByLanguageCode(obj, langCode);
23
- if (result != undefined) {
24
- return result;
25
- }
20
+ const langCode = navigator.language;
21
+ result = getTextByLanguageCode(langMap, langCode, false);
22
+ if (result != undefined) {
23
+ return result;
26
24
  }
27
25
  }
28
26
  }
29
27
  // fallback to first language
30
28
  if (result == undefined) {
31
- let langCode = Object.keys(obj);
29
+ let langCode = Object.keys(langMap);
32
30
  if (langCode.length > 0) {
33
- return obj[langCode[0]];
31
+ return langMap[langCode[0]];
34
32
  }
35
33
  }
36
34
  return undefined;
@@ -30,8 +30,8 @@ export class BrowserWindowApiImpl extends BaseApi {
30
30
  async isAlwaysOnTop() {
31
31
  return await this.invokeMethod('isAlwaysOnTop');
32
32
  }
33
- async openUrl(url) {
34
- await this.invokeMethod('openUrl', url);
33
+ async openUrl(url, option) {
34
+ await this.invokeMethod('openUrl', url, option);
35
35
  }
36
36
  async moveTop() {
37
37
  await this.invokeMethod('moveTop');
@@ -11,6 +11,9 @@ export class HostedWidgetApiImpl extends BaseApi {
11
11
  async removeHostedWidget(id) {
12
12
  return this.invokeMethod('removeHostedWidget', id);
13
13
  }
14
+ addWidget(widgetName, hostMode) {
15
+ return this.invokeMethod('addWidget', widgetName, hostMode);
16
+ }
14
17
  /**
15
18
  * 通过组件名移除已添加的组件
16
19
  * @param name 组件名
@@ -1,7 +1,12 @@
1
1
  import { AppNotification } from "../model/AppNotification";
2
2
  import { Channel } from "./Channel";
3
- import { ElectronUtils } from "../utils/ElectronUtils";
4
3
  import { BaseApi } from "./BaseApi";
4
+ var NotificationApiEvent;
5
+ (function (NotificationApiEvent) {
6
+ NotificationApiEvent["CONFIRM"] = "event::cn.widgetjs.core.notification.confirm";
7
+ NotificationApiEvent["CANCEL"] = "event::cn.widgetjs.core.notification.cancel";
8
+ NotificationApiEvent["HIDE"] = "event::cn.widgetjs.core.notification.hide";
9
+ })(NotificationApiEvent || (NotificationApiEvent = {}));
5
10
  class NotificationApiImpl extends BaseApi {
6
11
  // static async url(url: string, duration: number = -1) {
7
12
  // this.invoke(Channel.NOTIFICATION, new AppNotification({
@@ -19,7 +24,7 @@ class NotificationApiImpl extends BaseApi {
19
24
  * @param lyric 歌词字符串
20
25
  */
21
26
  async call(avatar, audio, title, message, lyric) {
22
- this.invoke(new AppNotification({
27
+ await this.invoke(new AppNotification({
23
28
  avatar,
24
29
  audio,
25
30
  message,
@@ -54,7 +59,7 @@ class NotificationApiImpl extends BaseApi {
54
59
  }));
55
60
  }
56
61
  async countdown(message, targetTime) {
57
- this.send(new AppNotification({
62
+ await this.send(new AppNotification({
58
63
  message,
59
64
  targetTime,
60
65
  backgroundColor: 'rgba(0,0,0,0.5)',
@@ -63,7 +68,7 @@ class NotificationApiImpl extends BaseApi {
63
68
  }));
64
69
  }
65
70
  async success(message, duration = 5000) {
66
- this.send(new AppNotification({
71
+ await this.send(new AppNotification({
67
72
  message,
68
73
  type: "success",
69
74
  icon: "check_circle_line",
@@ -71,7 +76,7 @@ class NotificationApiImpl extends BaseApi {
71
76
  }));
72
77
  }
73
78
  async error(message, duration = 5000) {
74
- this.send(new AppNotification({
79
+ await this.send(new AppNotification({
75
80
  message,
76
81
  type: "error",
77
82
  icon: "close_circle_line",
@@ -79,7 +84,7 @@ class NotificationApiImpl extends BaseApi {
79
84
  }));
80
85
  }
81
86
  async warning(message, duration = 5000) {
82
- this.send(new AppNotification({
87
+ await this.send(new AppNotification({
83
88
  message,
84
89
  type: "warning",
85
90
  icon: "warning_line",
@@ -87,7 +92,7 @@ class NotificationApiImpl extends BaseApi {
87
92
  }));
88
93
  }
89
94
  async info(message, duration = 5000) {
90
- this.send(new AppNotification({
95
+ await this.send(new AppNotification({
91
96
  message,
92
97
  type: "info",
93
98
  icon: "information_line",
@@ -98,13 +103,11 @@ class NotificationApiImpl extends BaseApi {
98
103
  * 隐藏通知
99
104
  */
100
105
  async hide() {
101
- if (ElectronUtils.hasElectronApi()) {
102
- this.invokeMethod('hide');
103
- }
106
+ await this.invokeMethod('hide');
104
107
  }
105
108
  getChannel() {
106
109
  return Channel.NOTIFICATION;
107
110
  }
108
111
  }
109
112
  const NotificationApi = new NotificationApiImpl();
110
- export { NotificationApi };
113
+ export { NotificationApi, NotificationApiEvent };
@@ -2,20 +2,13 @@ import { Widget } from "../model/Widget";
2
2
  import { WidgetPackage } from "../model/WidgetPackage";
3
3
  import { Channel } from "./Channel";
4
4
  import { UrlUtils } from "../utils/UrlUtils";
5
- import { BroadcastEvent } from "../model/event/BroadcastEvent";
6
- import { BroadcastApi } from "./BroadcastApi";
7
- import localforage from "localforage";
8
5
  import { BaseApi } from "./BaseApi";
9
6
  var WidgetApiEvent;
10
7
  (function (WidgetApiEvent) {
11
- WidgetApiEvent["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data0changed";
8
+ WidgetApiEvent["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data-changed";
12
9
  WidgetApiEvent["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
13
10
  })(WidgetApiEvent || (WidgetApiEvent = {}));
14
11
  class WidgetApiImpl extends BaseApi {
15
- constructor() {
16
- super(...arguments);
17
- this.stores = new Map();
18
- }
19
12
  getChannel() {
20
13
  return Channel.WIDGET;
21
14
  }
@@ -90,43 +83,6 @@ class WidgetApiImpl extends BaseApi {
90
83
  return null;
91
84
  return widgetPackage.url;
92
85
  }
93
- /**
94
- * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
95
- * @param data
96
- * @param options
97
- */
98
- async saveDataByName(data, options = { sendBroadcast: true }) {
99
- const store = this.getStore(data.name);
100
- const json = JSON.stringify(data);
101
- const result = await store.setItem(data.name, json);
102
- if (options.sendBroadcast) {
103
- const broadcastEvent = new BroadcastEvent({
104
- event: WidgetApiEvent.DATA_CHANGED,
105
- payload: {
106
- name: data.name,
107
- id: options.id,
108
- json
109
- }
110
- });
111
- await BroadcastApi.send(broadcastEvent);
112
- }
113
- return result;
114
- }
115
- /**
116
- * 获取组件 LocalForage 存储实例
117
- * @param name
118
- */
119
- getStore(name) {
120
- if (this.stores.has(name)) {
121
- return this.stores.get(name);
122
- }
123
- const store = localforage.createInstance({ name: name });
124
- this.stores.set(name, store);
125
- return store;
126
- }
127
- addWidget(widgetName, hostMode) {
128
- return this.invokeMethod('addWidget', widgetName, hostMode);
129
- }
130
86
  }
131
87
  const WidgetApi = new WidgetApiImpl();
132
88
  export { WidgetApi, WidgetApiEvent };
@@ -2,7 +2,7 @@ import localforage from "localforage";
2
2
  import { BroadcastEvent } from "../model/event/BroadcastEvent";
3
3
  import { BroadcastApi } from "../api/BroadcastApi";
4
4
  import { WidgetApiEvent } from "../api/WidgetApi";
5
- export class WidgetDataRepository {
5
+ export class WidgetDataApi {
6
6
  /**
7
7
  * 保存组件数据
8
8
  * @param data
@@ -32,15 +32,18 @@ export class WidgetDataRepository {
32
32
  /**
33
33
  * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
34
34
  * @param data
35
+ * @param options
35
36
  */
36
- static async saveByName(data) {
37
+ static async saveByName(data, options = { sendBroadcast: true }) {
37
38
  const store = this.getStore(data.name);
38
39
  const json = JSON.stringify(data);
39
40
  const result = await store.setItem(data.name, json);
40
- const broadcastEvent = new BroadcastEvent({
41
- event: WidgetApiEvent.DATA_CHANGED, payload: { name: data.name, json }
42
- });
43
- await BroadcastApi.send(broadcastEvent);
41
+ if (options === null || options === void 0 ? void 0 : options.sendBroadcast) {
42
+ const broadcastEvent = new BroadcastEvent({
43
+ event: WidgetApiEvent.DATA_CHANGED, payload: { name: data.name, json }
44
+ });
45
+ await BroadcastApi.send(broadcastEvent);
46
+ }
44
47
  return result;
45
48
  }
46
49
  static async findByName(name, type) {
@@ -67,4 +70,4 @@ export class WidgetDataRepository {
67
70
  return `${name}@${id}`;
68
71
  }
69
72
  }
70
- WidgetDataRepository.stores = new Map();
73
+ WidgetDataApi.stores = new Map();
package/dist/esm/index.js CHANGED
@@ -11,7 +11,7 @@ export * from "./model/event/NativeKeyboardEvent";
11
11
  export * from "./model/event/AppMouseEvent";
12
12
  export * from "./model/WidgetPackage";
13
13
  export * from "./api/ElectronApi";
14
- export * from "./repository/WidgetDataRepository";
14
+ export * from "./api/WidgetDataApi";
15
15
  export * from "./api/BrowserWindowApi";
16
16
  export * from "./lang/LanguageCode";
17
17
  export * from "./api/NotificationApi";
@@ -1,33 +1,31 @@
1
1
  /**
2
2
  * 根据语言环境获取文本
3
- * @param obj 对象
4
- * @param key 属性名
3
+ * @param langMap 对象
5
4
  * @param {LanguageCode} langCode 语言环境 例如:zh-CN,en-US
5
+ * @param fallbackToBrowser
6
6
  */
7
- export function getTextByLanguageCode(obj, langCode) {
7
+ export function getTextByLanguageCode(langMap, langCode, fallbackToBrowser = true) {
8
8
  let result;
9
9
  if (langCode) {
10
- if (langCode in obj) {
11
- return obj[langCode];
10
+ if (langCode in langMap) {
11
+ return langMap[langCode];
12
12
  }
13
13
  }
14
14
  // fallback to browser default language
15
- if (result == undefined) {
15
+ if (result == undefined && fallbackToBrowser) {
16
16
  if (typeof navigator != 'undefined' && navigator.languages) {
17
- for (let language of navigator.languages) {
18
- const langCode = language;
19
- result = getTextByLanguageCode(obj, langCode);
20
- if (result != undefined) {
21
- return result;
22
- }
17
+ const langCode = navigator.language;
18
+ result = getTextByLanguageCode(langMap, langCode, false);
19
+ if (result != undefined) {
20
+ return result;
23
21
  }
24
22
  }
25
23
  }
26
24
  // fallback to first language
27
25
  if (result == undefined) {
28
- let langCode = Object.keys(obj);
26
+ let langCode = Object.keys(langMap);
29
27
  if (langCode.length > 0) {
30
- return obj[langCode[0]];
28
+ return langMap[langCode[0]];
31
29
  }
32
30
  }
33
31
  return undefined;
@@ -6,9 +6,9 @@ import { ClipboardApiEvent } from "./ClipboardApi";
6
6
  import { BrowserWindowApiEvent } from "./BrowserWindowApi";
7
7
  type BroadcastEventType = WidgetApiEvent | BrowserWindowApiEvent | ShortcutApiEvent | ClipboardApiEvent | string;
8
8
  interface IBroadcastApi {
9
- send: (event: BroadcastEvent) => Promise<void>;
10
- register: (...event: BroadcastEventType[]) => Promise<void>;
11
- unregister: (...event: BroadcastEventType[]) => Promise<void>;
9
+ send(event: BroadcastEvent): Promise<void>;
10
+ register(...event: BroadcastEventType[]): Promise<void>;
11
+ unregister(...event: BroadcastEventType[]): Promise<void>;
12
12
  }
13
13
  type BroadcastApiMethods = keyof IBroadcastApi;
14
14
  export declare class BroadcastApiImpl extends BaseApi<BroadcastApiMethods> implements IBroadcastApi {
@@ -11,7 +11,7 @@ interface IBrowserWindowApi {
11
11
  stopDraggingWindow(): Promise<void>;
12
12
  setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
13
13
  isAlwaysOnTop(): Promise<boolean>;
14
- openUrl(url: string): Promise<void>;
14
+ openUrl(url: string, option?: OpenUrlOptions): Promise<void>;
15
15
  moveTop(): Promise<void>;
16
16
  openDevTools(): Promise<void>;
17
17
  setPosition(x: number, y: number, animation: boolean): Promise<void>;
@@ -26,6 +26,9 @@ interface IBrowserWindowApi {
26
26
  }
27
27
  type BrowserWindowApiMethods = keyof IBrowserWindowApi;
28
28
  type AlignPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
29
+ interface OpenUrlOptions {
30
+ partition?: string;
31
+ }
29
32
  declare enum BrowserWindowApiEvent {
30
33
  BLUR = "event::cn.widgetjs.core.browser-window.blur",
31
34
  FOCUS = "event::cn.widgetjs.core.browser-window.focus"
@@ -39,7 +42,7 @@ export declare class BrowserWindowApiImpl extends BaseApi<BrowserWindowApiMethod
39
42
  center(): Promise<void>;
40
43
  setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
41
44
  isAlwaysOnTop(): Promise<boolean>;
42
- openUrl(url: string): Promise<void>;
45
+ openUrl(url: string, option?: OpenUrlOptions): Promise<void>;
43
46
  moveTop(): Promise<void>;
44
47
  openDevTools(): Promise<void>;
45
48
  /**
@@ -69,4 +72,4 @@ export declare class BrowserWindowApiImpl extends BaseApi<BrowserWindowApiMethod
69
72
  existsByUrl(url: string): Promise<boolean>;
70
73
  }
71
74
  declare const BrowserWindowApi: BrowserWindowApiImpl;
72
- export { BrowserWindowApi, BrowserWindowApiMethods, BrowserWindowApiEvent };
75
+ export { BrowserWindowApi, BrowserWindowApiMethods, OpenUrlOptions, BrowserWindowApiEvent, AlignPosition };
@@ -1,6 +1,6 @@
1
1
  interface IClipboardApi {
2
- getSelectedText: () => Promise<string | undefined>;
3
- getText: () => Promise<string | undefined>;
2
+ getSelectedText(): Promise<string | undefined>;
3
+ getText(): Promise<string | undefined>;
4
4
  }
5
5
  type ClipboardApiMethods = keyof IClipboardApi;
6
6
  declare enum ClipboardApiEvent {
@@ -1,8 +1,8 @@
1
1
  import { BaseApi } from "./BaseApi";
2
2
  import { Point } from "../model/msic/graphics";
3
3
  interface IDeviceApi {
4
- getCursorScreenPoint: () => Promise<Point>;
5
- isAllKeyReleased: () => Promise<boolean>;
4
+ getCursorScreenPoint(): Promise<Point>;
5
+ isAllKeyReleased(): Promise<boolean>;
6
6
  }
7
7
  type DeviceApiMethods = keyof IDeviceApi;
8
8
  export declare class DeviceApiImpl extends BaseApi<DeviceApiMethods> implements IDeviceApi {
@@ -1,5 +1,5 @@
1
1
  interface IDialogApi {
2
- pickFile: (extensions?: string[]) => Promise<string | undefined>;
2
+ pickFile(extensions?: string[]): Promise<string | undefined>;
3
3
  }
4
4
  type DialogApiMethods = keyof IDialogApi;
5
5
  declare const DialogApi: IDialogApi;
@@ -1,15 +1,18 @@
1
1
  import { HostedWidget } from "../model/HostedWidget";
2
2
  import { WidgetParams } from "../model/WidgetParams";
3
3
  import { BaseApi } from "./BaseApi";
4
+ import { HostedMode } from '../model/HostedMode';
5
+ import { Widget } from '../model/Widget';
4
6
  interface IHostedWidgetApi {
5
- removeHostedWidget: (id: string) => Promise<void>;
6
- removeHostedWidgetByName: (name: string) => Promise<HostedWidget[]>;
7
- getHostedWidgets: () => Promise<HostedWidget[]>;
8
- openDevTools: (id: string) => Promise<void>;
9
- openConfigRoute: (id: string) => Promise<void>;
10
- registerActiveShortcut: (id: string, shortcut: string) => Promise<boolean>;
11
- setProxy: (id: string, proxy: string) => Promise<boolean>;
12
- getHostedWidget: (id: string) => Promise<HostedWidget>;
7
+ removeHostedWidget(id: string): Promise<void>;
8
+ removeHostedWidgetByName(name: string): Promise<HostedWidget[]>;
9
+ getHostedWidgets(): Promise<HostedWidget[]>;
10
+ openDevTools(id: string): Promise<void>;
11
+ openConfigRoute(id: string): Promise<void>;
12
+ registerActiveShortcut(id: string, shortcut: string): Promise<boolean>;
13
+ setProxy(id: string, proxy: string): Promise<boolean>;
14
+ getHostedWidget(id: string): Promise<HostedWidget>;
15
+ addWidget(widgetName: string, hostMode: HostedMode): Promise<Widget[]>;
13
16
  }
14
17
  type HostedWidgetApiMethods = keyof IHostedWidgetApi;
15
18
  export declare class HostedWidgetApiImpl extends BaseApi<HostedWidgetApiMethods> implements IHostedWidgetApi {
@@ -19,6 +22,7 @@ export declare class HostedWidgetApiImpl extends BaseApi<HostedWidgetApiMethods>
19
22
  * @param id
20
23
  */
21
24
  removeHostedWidget(id: string): Promise<any>;
25
+ addWidget(widgetName: string, hostMode: HostedMode): Promise<Widget[]>;
22
26
  /**
23
27
  * 通过组件名移除已添加的组件
24
28
  * @param name 组件名
@@ -1,8 +1,8 @@
1
1
  interface ILogApi {
2
- info: (...data: any[]) => void;
3
- error: (...data: any[]) => void;
4
- warn: (...data: any[]) => void;
5
- log: (...data: any[]) => void;
2
+ info(...data: any[]): void;
3
+ error(...data: any[]): void;
4
+ warn(...data: any[]): void;
5
+ log(...data: any[]): void;
6
6
  }
7
7
  type LogApiMethods = keyof ILogApi;
8
8
  declare const LogApi: ILogApi;
@@ -1,10 +1,15 @@
1
1
  import { AppNotification } from "../model/AppNotification";
2
2
  import { BaseApi } from "./BaseApi";
3
3
  interface INotificationApi {
4
- send: (notification: AppNotification) => Promise<void>;
5
- hide: () => Promise<void>;
4
+ send(notification: AppNotification): Promise<void>;
5
+ hide(): Promise<void>;
6
6
  }
7
7
  type NotificationApiMethods = keyof INotificationApi;
8
+ declare enum NotificationApiEvent {
9
+ CONFIRM = "event::cn.widgetjs.core.notification.confirm",
10
+ CANCEL = "event::cn.widgetjs.core.notification.cancel",
11
+ HIDE = "event::cn.widgetjs.core.notification.hide"
12
+ }
8
13
  declare class NotificationApiImpl extends BaseApi<NotificationApiMethods> implements INotificationApi {
9
14
  /**
10
15
  * 来电
@@ -30,4 +35,4 @@ declare class NotificationApiImpl extends BaseApi<NotificationApiMethods> implem
30
35
  getChannel(): string;
31
36
  }
32
37
  declare const NotificationApi: NotificationApiImpl;
33
- export { NotificationApi, NotificationApiMethods };
38
+ export { NotificationApi, NotificationApiMethods, NotificationApiEvent };
@@ -1,6 +1,6 @@
1
1
  interface IShortcutApi {
2
- register: (shortcut: string) => void;
3
- unregister: (shortcut: string) => void;
2
+ register(shortcut: string): void;
3
+ unregister(shortcut: string): void;
4
4
  }
5
5
  type ShortcutApiMethods = keyof IShortcutApi;
6
6
  declare enum ShortcutApiEvent {
@@ -1,30 +1,22 @@
1
1
  import { Widget } from "../model/Widget";
2
2
  import { WidgetPackage } from "../model/WidgetPackage";
3
3
  import { WidgetParams } from "../model/WidgetParams";
4
- import { WidgetData } from "../model/WidgetData";
5
4
  import { BaseApi } from "./BaseApi";
6
- import { HostedMode } from "../model/HostedMode";
7
- export interface SaveWidgetOption {
8
- sendBroadcast?: boolean;
9
- id?: string;
10
- }
11
5
  interface IWidgetApi {
12
6
  registerWidgets(widgets: Widget[]): Promise<void>;
13
7
  registerWidgetPackage(widgetPackage: WidgetPackage): Promise<void>;
14
8
  getWidgets(): Promise<Widget[]>;
15
- addWidget(widgetName: string, hostMode: HostedMode): Promise<Widget[]>;
16
9
  getWidget(name: string): Promise<Widget>;
17
10
  getWidgetPackage(name: string): Promise<WidgetPackage>;
18
11
  getWidgetPackages(): Promise<WidgetPackage[]>;
19
12
  getWidgetUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
20
13
  getWidgetPackageIndexUrl(packageName: string, hash?: boolean): Promise<string | null>;
21
14
  getWidgetConfigUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
22
- saveDataByName<T extends WidgetData>(data: T, options: SaveWidgetOption): Promise<string>;
23
15
  getWidgetPackageUrl(packageName: string): Promise<string | null>;
24
16
  }
25
17
  type WidgetApiMethods = keyof IWidgetApi;
26
18
  declare enum WidgetApiEvent {
27
- DATA_CHANGED = "event::cn.widgetjs.core.widget.data0changed",
19
+ DATA_CHANGED = "event::cn.widgetjs.core.widget.data-changed",
28
20
  EDIT_DESKTOP_WIDGETS = "event::cn.widgetjs.core.widget.desktop.edit"
29
21
  }
30
22
  declare class WidgetApiImpl extends BaseApi<WidgetApiMethods> implements IWidgetApi {
@@ -51,19 +43,6 @@ declare class WidgetApiImpl extends BaseApi<WidgetApiMethods> implements IWidget
51
43
  getWidgetUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
52
44
  getWidgetPackageIndexUrl(packageName: string, hash?: boolean): Promise<string | null>;
53
45
  getWidgetPackageUrl(packageName: string): Promise<string | null>;
54
- /**
55
- * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
56
- * @param data
57
- * @param options
58
- */
59
- saveDataByName<T extends WidgetData>(data: T, options?: SaveWidgetOption): Promise<string>;
60
- private stores;
61
- /**
62
- * 获取组件 LocalForage 存储实例
63
- * @param name
64
- */
65
- getStore(name: string): LocalForage;
66
- addWidget(widgetName: string, hostMode: HostedMode): Promise<Widget[]>;
67
46
  }
68
47
  declare const WidgetApi: WidgetApiImpl;
69
48
  export { WidgetApi, WidgetApiEvent, WidgetApiMethods };
@@ -1,5 +1,9 @@
1
1
  import { WidgetData } from "../model/WidgetData";
2
- export declare class WidgetDataRepository {
2
+ export interface SaveWidgetOption {
3
+ sendBroadcast?: boolean;
4
+ id?: string;
5
+ }
6
+ export declare class WidgetDataApi {
3
7
  private static stores;
4
8
  /**
5
9
  * 保存组件数据
@@ -14,8 +18,9 @@ export declare class WidgetDataRepository {
14
18
  /**
15
19
  * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
16
20
  * @param data
21
+ * @param options
17
22
  */
18
- static saveByName<T extends WidgetData>(data: T): Promise<string>;
23
+ static saveByName<T extends WidgetData>(data: T, options?: SaveWidgetOption): Promise<string>;
19
24
  static findByName<T extends WidgetData>(name: string, type: {
20
25
  new (name: string, id?: string): T;
21
26
  }): Promise<T | undefined>;
@@ -11,7 +11,7 @@ export * from "./model/event/NativeKeyboardEvent";
11
11
  export * from "./model/event/AppMouseEvent";
12
12
  export * from "./model/WidgetPackage";
13
13
  export * from "./api/ElectronApi";
14
- export * from "./repository/WidgetDataRepository";
14
+ export * from "./api/WidgetDataApi";
15
15
  export * from "./api/BrowserWindowApi";
16
16
  export * from "./lang/LanguageCode";
17
17
  export * from "./api/NotificationApi";
@@ -1,8 +1,8 @@
1
1
  import { LanguageCode, LanguageTextMap } from "../lang/LanguageCode";
2
2
  /**
3
3
  * 根据语言环境获取文本
4
- * @param obj 对象
5
- * @param key 属性名
4
+ * @param langMap 对象
6
5
  * @param {LanguageCode} langCode 语言环境 例如:zh-CN,en-US
6
+ * @param fallbackToBrowser
7
7
  */
8
- export declare function getTextByLanguageCode(obj: LanguageTextMap, langCode?: LanguageCode): string | undefined;
8
+ export declare function getTextByLanguageCode(langMap: LanguageTextMap, langCode?: LanguageCode, fallbackToBrowser?: boolean): string | undefined;
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={94:(e,t,n)=>{"use strict";n.r(t),n.d(t,{camelCase:()=>v,camelCaseTransform:()=>f,camelCaseTransformMerge:()=>h,capitalCase:()=>y,capitalCaseTransform:()=>g,constantCase:()=>b,dotCase:()=>_,headerCase:()=>w,noCase:()=>s,paramCase:()=>A,pascalCase:()=>l,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>d,pathCase:()=>I,sentenceCase:()=>M,sentenceCaseTransform:()=>E,snakeCase:()=>O});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,d=t.transform,l=void 0===d?o:d,f=t.delimiter,h=void 0===f?" ":f,v=c(c(e,r,"$1\0$2"),u,"\0"),p=0,g=v.length;"\0"===v.charAt(p);)p++;for(;"\0"===v.charAt(g-1);)g--;return v.slice(p,g).split("\0").map(l).join(h)}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 d(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function l(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 h(e,t){return 0===t?e.toLowerCase():d(e)}function v(e,t){return void 0===t&&(t={}),l(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 m(e){return e.toUpperCase()}function b(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:m},t))}function _(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function w(e,t){return void 0===t&&(t={}),y(e,r({delimiter:"-"},t))}function A(e,t){return void 0===t&&(t={}),_(e,r({delimiter:"-"},t))}function I(e,t){return void 0===t&&(t={}),_(e,r({delimiter:"/"},t))}function E(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function M(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:E},t))}function O(e,t){return void 0===t&&(t={}),_(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(d),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(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,n=function(){c.port2.postMessage(0)}}var u=[];function d(){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&&h(this,e)}function d(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 l(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 h(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=v((function(){t(o,r)}));"error"===a.status&&r(a.value)}function v(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?l(n,this.state===s?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){i.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=v(f,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)h(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;)d(e[c],c);return u;function d(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 d(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",f=void 0,h={},v=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 m(e){return"boolean"==typeof f?a.resolve(f):function(e){return new a((function(t){var n=e.transaction(l,g),r=i([""]);n.objectStore(l).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 b(e){var t=h[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 _(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var n=h[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function A(e,t){return new a((function(n,r){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);b(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(l)}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),_(e)}}))}function I(e){return A(e,!1)}function E(e){return A(e,!0)}function M(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 O(e){return i([y(atob(e.data))],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function S(e){var t=this,n=t._initReady().then((function(){var e=h[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),E(e)})).then((function(){return function(e){b(e);for(var t=h[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,I(e).then((function(t){return e.db=t,M(e)?E(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 w(e,t),t}))}(e).then((function(){R(e,t,n,r-1)}))})).catch(n);n(o)}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=h[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},h[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=S);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 d=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,I(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?E(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<d.length;r++){var i=d[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;P(r)&&(r=O(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),P(e)&&(e=O(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]"===v.call(t)?m(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=d.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):I(e).then((function(t){var n=h[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;b(e);var r=h[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,_(n._dbInfo)}})).catch((function(t){throw(w(e,t)||a.resolve()).catch((function(){})),t}))}})):i.then((function(t){b(e);var n=h[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++)_(r[t]._dbInfo)})).catch((function(t){throw(w(e,t)||a.resolve()).catch((function(){})),t}))}))}else n=a.reject("Invalid arguments");return s(n,t),n}};var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T=/^~~local_forage_type~([^~]+)~/,j="__lfsc__:",k="arbf",W="blob",D="si08",B="ui08",x="uic8",L="si16",U="si32",H="ur16",F="ui32",G="fl32",z="fl64",K=Object.prototype.toString;function V(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),d=new Uint8Array(u);for(t=0;t<s;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),d[c++]=n<<2|r>>4,d[c++]=(15&r)<<4|o>>2,d[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+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[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 J={serialize:function(e,t){var n="";if(e&&(n=K.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===K.call(e.buffer))){var r,o=j;e instanceof ArrayBuffer?(r=e,o+=k):(r=e.buffer,"[object Int8Array]"===n?o+=D:"[object Uint8Array]"===n?o+=B:"[object Uint8ClampedArray]"===n?o+=x:"[object Int16Array]"===n?o+=L:"[object Uint16Array]"===n?o+=H:"[object Int32Array]"===n?o+=U:"[object Uint32Array]"===n?o+=F:"[object Float32Array]"===n?o+=G:"[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="~~local_forage_type~"+e.type+"~"+Q(this.result);t(j+W+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,9)!==j)return JSON.parse(e);var t,n=e.substring(13),r=e.substring(9,13);if(r===W&&T.test(n)){var o=n.match(T);t=o[1],n=n.substring(o[0].length)}var a=V(n);switch(r){case k:return a;case W:return i([a],{type:t});case D:return new Int8Array(a);case B:return new Uint8Array(a);case x:return new Uint8ClampedArray(a);case L:return new Int16Array(a);case H:return new Uint16Array(a);case U:return new Int32Array(a);case F:return new Uint32Array(a);case G:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:V,bufferToString:Q};function X(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function q(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):X(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function Y(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){q(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(Y.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}var $={_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){X(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=J,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){q(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){q(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 Y.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){q(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){q(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){q(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){q(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){q(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=d.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 Z(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ee(){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 te={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=Z(e,this._defaultConfig),ee()?(this._dbInfo=t,t.serializer=J,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=d.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(Z(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}},ne=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},re=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},oe={},ie={},ae={INDEXEDDB:C,WEBSQL:$,LOCALSTORAGE:te},se=[ae.INDEXEDDB._driver,ae.WEBSQL._driver,ae.LOCALSTORAGE._driver],ce=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),de={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function le(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function fe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(re(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var he=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),ae)if(ae.hasOwnProperty(n)){var r=ae[n],o=r._driver;this[n]=o,oe[o]||this.defineDriver(r)}this._defaultConfig=fe({},de),this._config=fe({},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=ue.concat("_initStorage"),c=0,u=i.length;c<u;c++){var d=i[c];if((!ne(ce,d)||e[d])&&"function"!=typeof e[d])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=ce.length;n<r;n++){var o=ce[n];e[o]||(e[o]=t(o))}}();var l=function(n){oe[r]&&console.info("Redefining LocalForage driver: "+r),oe[r]=e,ie[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!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=oe[e]?a.resolve(oe[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(J);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;re(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!!ie[e]},e.prototype._extend=function(e){fe(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=ue.length;e<t;e++)le(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ve=new he;t.exports=ve},{3:3}]},{},[4])(4)},939:(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"},13:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppApiEvent=t.AppApi=void 0;const r=n(210),o=n(54);var i;!function(e){e.CONFIG_CHANGED="event::cn.widgetjs.core.app.config.changed"}(i||(i={})),t.AppApiEvent=i;class a extends o.BaseApi{getChannel(){return r.Channel.APP}async setConfig(e,t){return await this.invokeMethod("setConfig",e,t)}async getConfig(e,t){const n=await this.invokeMethod("getConfig",e);return null==n?t:"boolean"==typeof t?"true"===n:"number"==typeof t?Number(n):n}async openAddWidgetWindow(){return this.invokeMethod("openAddWidgetWindow")}async getVersion(){return this.invokeMethod("getVersion")}async getPreloadPath(){return this.invokeMethod("getPreloadPath")}async openSettingWindow(){return this.invokeMethod("openSettingWindow")}}const s=new a;t.AppApi=s},54:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApi=void 0;const r=n(186);t.BaseApi=class{async invokeMethod(e,...t){return await r.ElectronUtils.invokeMethod(this.getChannel(),e,...t)}async invoke(...e){return await r.ElectronUtils.invoke(this.getChannel(),...e)}}},386:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastApi=t.BroadcastApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{async send(e){await this.invokeMethod("send",e)}async register(...e){await this.invokeMethod("register",e)}async unregister(...e){await this.invokeMethod("unregister",e)}getChannel(){return r.Channel.BROADCAST}}t.BroadcastApiImpl=i;const a=new i;t.BroadcastApi=a},105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserWindowApiEvent=t.BrowserWindowApi=t.BrowserWindowApiImpl=void 0;const r=n(210),o=n(54);var i;!function(e){e.BLUR="event::cn.widgetjs.core.browser-window.blur",e.FOCUS="event::cn.widgetjs.core.browser-window.focus"}(i||(i={})),t.BrowserWindowApiEvent=i;class a extends o.BaseApi{getChannel(){return r.Channel.BROWSER_WINDOW}async setIgnoreMouseEvent(e){await this.invokeMethod("setIgnoreMouseEvent",e)}async show(){await this.invokeMethod("show",!0)}async showInactive(){await this.invokeMethod("showInactive",!0)}async hide(){await this.invokeMethod("hide",!1)}async center(){await this.invokeMethod("center",!1)}async setAlwaysOnTop(e){await this.invokeMethod("setAlwaysOnTop",e)}async isAlwaysOnTop(){return await this.invokeMethod("isAlwaysOnTop")}async openUrl(e){await this.invokeMethod("openUrl",e)}async moveTop(){await this.invokeMethod("moveTop")}async openDevTools(){await this.invokeMethod("openDevTools")}async setPosition(e,t,n){await this.invokeMethod("setPosition",e,t,n)}async getPosition(){return await this.invokeMethod("getPosition")}async blur(){return await this.invokeMethod("blur")}async focus(){return await this.invokeMethod("focus")}async setResizable(e){return await this.invokeMethod("setResizable",e)}async getBounds(){return await this.invokeMethod("getBounds")}async setBounds(e,t){return await this.invokeMethod("setBounds",e,t)}async alignToScreen(e){return await this.invokeMethod("alignToScreen",e)}async startDraggingWindow(){return await this.invokeMethod("startDraggingWindow")}async stopDraggingWindow(){return await this.invokeMethod("stopDraggingWindow")}async existsByUrl(e){return await this.invokeMethod("existsByUrl",e)}}t.BrowserWindowApiImpl=a;const s=new a;t.BrowserWindowApi=s},210:(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.DIALOG="channel::cn.widgetjs.core.dialog",n.CLIPBOARD="channel::cn.widgetjs.core.clipboard",n.SCREEN="channel::cn.widgetjs.core.screen",n.SHORTCUT="channel::cn.widgetjs.core.shortcut",n.LOG="channel::cn.widgetjs.core.log",n.DEVICE="channel::cn.widgetjs.core.device",n.MOUSE="channel::cn.widgetjs.core.mouse",n.KEYBOARD="channel::cn.widgetjs.core.keyboard"},32:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClipboardApiEvent=t.ClipboardApi=void 0;const r=n(210),o=n(54);var i;!function(e){e.CHANGED="clipboard-changed"}(i||(i={})),t.ClipboardApiEvent=i;class a extends o.BaseApi{async getSelectedText(){return this.invokeMethod("getSelectedText")}async getText(){return this.invokeMethod("getText")}getChannel(){return r.Channel.CLIPBOARD}}const s=new a;t.ClipboardApi=s},786:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceApi=t.DeviceApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{async getCursorScreenPoint(){return this.invokeMethod("getCursorScreenPoint")}async isAllKeyReleased(){return this.invokeMethod("isAllKeyReleased")}getChannel(){return r.Channel.DEVICE}}t.DeviceApiImpl=i;const a=new i;t.DeviceApi=a},326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogApi=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.DIALOG}pickFile(e){return this.invokeMethod("pickFile",e)}}const a=new i;t.DialogApi=a},444:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronApi=void 0;const r=n(186);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))}}},164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidgetApi=t.HostedWidgetApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.HOSTED_WIDGET}async removeHostedWidget(e){return this.invokeMethod("removeHostedWidget",e)}async removeHostedWidgetByName(e){return this.invokeMethod("removeHostedWidgetByName",e)}async getHostedWidgets(e){return this.invokeMethod("getHostedWidgets",e)}async getHostedWidget(e){return this.invokeMethod("getHostedWidget",e)}async openDevTools(e){return this.invokeMethod("openDevTools",e)}async openConfigRoute(e,t){return this.invokeMethod("openConfigRoute",e,t)}async registerActiveShortcut(e,t){return this.invokeMethod("registerActiveShortcut",e,t)}async setProxy(e,t){return this.invokeMethod("setProxy",e,t)}}t.HostedWidgetApiImpl=i;const a=new i;t.HostedWidgetApi=a},190:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogApi=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.LOG}info(...e){console.info(...e),this.invokeMethod("info",...e)}error(...e){console.error(...e),this.invokeMethod("error",...e)}warn(...e){console.warn(...e),this.invokeMethod("warn",...e)}log(...e){console.log(...e),this.invokeMethod("log",...e)}}const a=new i;t.LogApi=a},288:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationApi=void 0;const r=n(451),o=n(210),i=n(186),a=n(54);class s extends a.BaseApi{async call(e,t,n,o,i){this.invoke(new r.AppNotification({avatar:e,audio:t,message:o,title:n,duration:-1,lyric:i,type:"call"}))}async send(e){return this.invokeMethod("send",e)}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"}))}async advanceCountdown(e,t,n){return await this.send(new r.AppNotification({title:n,message:e,targetTime:t,type:"advance-countdown"}))}async countdown(e,t){this.send(new r.AppNotification({message:e,targetTime:t,backgroundColor:"rgba(0,0,0,0.5)",duration:-1,type:"countdown"}))}async success(e,t=5e3){this.send(new r.AppNotification({message:e,type:"success",icon:"check_circle_line",duration:t}))}async error(e,t=5e3){this.send(new r.AppNotification({message:e,type:"error",icon:"close_circle_line",duration:t}))}async warning(e,t=5e3){this.send(new r.AppNotification({message:e,type:"warning",icon:"warning_line",duration:t}))}async info(e,t=5e3){this.send(new r.AppNotification({message:e,type:"info",icon:"information_line",duration:t}))}async hide(){i.ElectronUtils.hasElectronApi()&&this.invokeMethod("hide")}getChannel(){return o.Channel.NOTIFICATION}}const c=new s;t.NotificationApi=c},388:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShortcutApiEvent=t.ShortcutApi=void 0;const r=n(54),o=n(210);var i;!function(e){e.TRIGGERED="channel::cn.widgetjs.core.shortcut.triggered"}(i||(i={})),t.ShortcutApiEvent=i;class a extends r.BaseApi{getChannel(){return o.Channel.SHORTCUT}async register(e){return await this.invokeMethod("register",e)}async unregister(e){return await this.invokeMethod("unregister",e)}}const s=new a;t.ShortcutApi=s},287: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.WidgetApiEvent=t.WidgetApi=void 0;const o=n(713),i=n(611),a=n(210),s=n(889),c=n(833),u=n(386),d=r(n(680)),l=n(54);var f;!function(e){e.DATA_CHANGED="event::cn.widgetjs.core.widget.data0changed",e.EDIT_DESKTOP_WIDGETS="event::cn.widgetjs.core.widget.desktop.edit"}(f||(f={})),t.WidgetApiEvent=f;class h extends l.BaseApi{constructor(){super(...arguments),this.stores=new Map}getChannel(){return a.Channel.WIDGET}async registerWidgets(e){return this.invokeMethod("registerWidgets",JSON.stringify(e))}async registerWidgetPackage(e){return this.invokeMethod("registerWidgetPackage",JSON.stringify(e))}async getWidgets(){const e=await this.invokeMethod("getWidgets"),t=[];if(e)for(const n of e)t.push(o.Widget.parseObject(n));return t}async getWidgetPackages(){return await this.invokeMethod("getWidgetPackages")}async getWidget(e){return o.Widget.parseObject(await this.invokeMethod("getWidget",e))}async getWidgetPackage(e){return i.WidgetPackage.parseObject(await this.invokeMethod("getWidgetPackage",e))}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?s.UrlUtils.getWidgetUrl(r.url,o,t):null}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?s.UrlUtils.getWidgetUrl(r.url,o,t):null}async getWidgetPackageIndexUrl(e,t){const n=await this.getWidgetPackage(e);return n?n.getIndexUrl(t):null}async getWidgetPackageUrl(e){const t=await this.getWidgetPackage(e);return t?t.url:null}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 c.BroadcastEvent({event:f.DATA_CHANGED,payload:{name:e.name,id:t.id,json:r}});await u.BroadcastApi.send(n)}return o}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}addWidget(e,t){return this.invokeMethod("addWidget",e,t)}}const v=new h;t.WidgetApi=v},347: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(713),t),o(n(833),t),o(n(647),t),o(n(905),t),o(n(859),t),o(n(451),t),o(n(538),t),o(n(314),t),o(n(304),t),o(n(511),t),o(n(53),t),o(n(611),t),o(n(444),t),o(n(738),t),o(n(105),t),o(n(319),t),o(n(288),t),o(n(164),t),o(n(786),t),o(n(210),t),o(n(32),t),o(n(287),t),o(n(939),t),o(n(388),t),o(n(386),t),o(n(13),t),o(n(326),t),o(n(186),t),o(n(889),t),o(n(851),t),o(n(190),t),o(n(410),t)},319:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},451:(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"}}},538:(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"},314:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidget=void 0;const r=n(538);t.HostedWidget=class{constructor(){this.x=0,this.y=0}isOverlap(){return(this.hostedMode&r.HostedMode.OVERLAP)>0}}},713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetKeyword=t.Widget=void 0;const r=n(538),o=n(398);class i{constructor(e){var t,n,o,i,a,s,c,u,d;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.movable=null===(t=e.movable)||void 0===t||t,this.permissions=null!==(n=e.permissions)&&void 0!==n?n:[],this.maxWidth=null!==(o=e.maxWidth)&&void 0!==o?o:e.width,this.maxHeight=null!==(i=e.maxHeight)&&void 0!==i?i:e.height,this.minWidth=null!==(a=e.minWidth)&&void 0!==a?a:e.width,this.minHeight=null!==(s=e.minHeight)&&void 0!==s?s:e.height,this.backgroundThrottling=null===(c=e.backgroundThrottling)||void 0===c||c,this.packageName=e.packageName,this.previewImage=e.previewImage,this.shortcut=e.shortcut,this.refreshWhenResided=null!==(u=e.refreshWhenResided)&&void 0!==u&&u,this.hideWhenBlur=null!=e.hideWhenBlur&&e.hideWhenBlur,this.supportHostedMode=null!==(d=e.supportHostedMode)&&void 0!==d?d: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()))}isConfigurable(){return null!=this.getConfigRoute()}getTitle(e){return(0,o.getTextByLanguageCode)(this.title,e)}getDescription(e){return(0,o.getTextByLanguageCode)(this.description,e)}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new i({description:{},height:0,keywords:[],lang:"",name:"",routes:[],title:{},width:0});return Object.assign(t,e),t}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 a;t.Widget=i,(a=t.WidgetKeyword||(t.WidgetKeyword={})).RECOMMEND="recommend",a.TOOLS="tools",a.EFFICIENCY="efficiency",a.PICTURE="picture",a.LIFE="life",a.SHORTCUT="shortcut",a.COUNTDOWN="countdown",a.TIMER="timer",a.INFO="info",a.DASHBOARD="dashboard"},905:(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)}}},611:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetPackage=void 0;const r=n(889),o=n(398);class i{constructor(e){if(this.hash=!0,this.widgets=[],this.name=e.name,this.version=e.version,this.author=e.author,this.homepage=e.homepage,this.title=e.title,this.description=e.description,this.entry=e.entry,this.remoteEntry=e.remoteEntry,this.remotePackage=e.remotePackage,this.hash=e.hash,this.url=e.url,this.devOptions=e.devOptions,e.widgets)for(let t of e.widgets)this.widgets.push(t)}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new i({author:"",description:{"zh-CN":""},entry:"",hash:!1,homepage:"",name:"",title:{"zh-CN":""},url:"",version:""});return Object.assign(t,e),t}getTitle(e){return(0,o.getTextByLanguageCode)(this.title,e)}getDescription(e){return(0,o.getTextByLanguageCode)(this.description,e)}getIndexUrl(e){return r.UrlUtils.getWidgetPackageIndexUrl(this.url,this.entry,null==e?this.hash:e)}}t.WidgetPackage=i},859:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeMode=t.WidgetParams=void 0;const r=n(851),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"},53:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},833:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastEvent=void 0,t.BroadcastEvent=class{constructor(e){this.event=e.event,this.sender=e.sender,this.payload=e.payload}}},511:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},647:(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}}},304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},410:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},738: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(833),a=n(386),s=n(287);class c{static async save(e){let t=this.getStore(e.name),n=JSON.stringify(e);const r=await t.setItem(this.getKey(e.name,e.id),n),o=new i.BroadcastEvent({event:s.WidgetApiEvent.DATA_CHANGED,payload:{name:e.name,json:n}});return await a.BroadcastApi.send(o),r}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({event:s.WidgetApiEvent.DATA_CHANGED,payload:{name:e.name,json:n}});return await a.BroadcastApi.send(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=c,c.stores=new Map},479:(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,d=/%60/g,l=/%7B/g,f=/%7C/g,h=/%7D/g,v=/%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(v,"+").replace(n,"%23").replace(r,"%26").replace(d,"`").replace(l,"{").replace(h,"}").replace(u,"^")}function y(e){return p(e).replace(n,"%23").replace(a,"%3F")}t.encodeHash=function(e){return p(e).replace(l,"{").replace(h,"}").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}},851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringifyQuery=t.parseQuery=void 0;const r=n(479),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}},186:(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}static async invokeMethod(e,t,...n){var r;return null===(r=this.getAPI())||void 0===r?void 0:r.invoke(e,t,...n)}static async invoke(e,...t){var n;return null===(n=this.getAPI())||void 0===n?void 0:n.invoke(e,...t)}}},398:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTextByLanguageCode=void 0,t.getTextByLanguageCode=function e(t,n){let r;if(n&&n in t)return t[n];if(null==r&&"undefined"!=typeof navigator&&navigator.languages)for(let n of navigator.languages)if(r=e(t,n),null!=r)return r;if(null==r){let e=Object.keys(t);if(e.length>0)return t[e[0]]}}},889:(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(347)})()));
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:()=>v,camelCaseTransform:()=>f,camelCaseTransformMerge:()=>h,capitalCase:()=>y,capitalCaseTransform:()=>g,constantCase:()=>b,dotCase:()=>w,headerCase:()=>_,noCase:()=>s,paramCase:()=>A,pascalCase:()=>l,pascalCaseTransform:()=>u,pascalCaseTransformMerge:()=>d,pathCase:()=>I,sentenceCase:()=>M,sentenceCaseTransform:()=>E,snakeCase:()=>O});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,d=t.transform,l=void 0===d?o:d,f=t.delimiter,h=void 0===f?" ":f,v=c(c(e,r,"$1\0$2"),u,"\0"),p=0,g=v.length;"\0"===v.charAt(p);)p++;for(;"\0"===v.charAt(g-1);)g--;return v.slice(p,g).split("\0").map(l).join(h)}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 d(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function l(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 h(e,t){return 0===t?e.toLowerCase():d(e)}function v(e,t){return void 0===t&&(t={}),l(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 m(e){return e.toUpperCase()}function b(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"_",transform:m},t))}function w(e,t){return void 0===t&&(t={}),s(e,r({delimiter:"."},t))}function _(e,t){return void 0===t&&(t={}),y(e,r({delimiter:"-"},t))}function A(e,t){return void 0===t&&(t={}),w(e,r({delimiter:"-"},t))}function I(e,t){return void 0===t&&(t={}),w(e,r({delimiter:"/"},t))}function E(e,t){var n=e.toLowerCase();return 0===t?p(n):n}function M(e,t){return void 0===t&&(t={}),s(e,r({delimiter:" ",transform:E},t))}function O(e,t){return void 0===t&&(t={}),w(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(d),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(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,n=function(){c.port2.postMessage(0)}}var u=[];function d(){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&&h(this,e)}function d(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 l(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 h(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=v((function(){t(o,r)}));"error"===a.status&&r(a.value)}function v(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?l(n,this.state===s?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){i.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=v(f,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)h(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;)d(e[c],c);return u;function d(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 d(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",f=void 0,h={},v=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 m(e){return"boolean"==typeof f?a.resolve(f):function(e){return new a((function(t){var n=e.transaction(l,g),r=i([""]);n.objectStore(l).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 b(e){var t=h[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 w(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var n=h[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function A(e,t){return new a((function(n,r){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);b(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(l)}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),w(e)}}))}function I(e){return A(e,!1)}function E(e){return A(e,!0)}function M(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 O(e){return i([y(atob(e.data))],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function S(e){var t=this,n=t._initReady().then((function(){var e=h[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),E(e)})).then((function(){return function(e){b(e);for(var t=h[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,I(e).then((function(t){return e.db=t,M(e)?E(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw _(e,t),t}))}(e).then((function(){R(e,t,n,r-1)}))})).catch(n);n(o)}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=h[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},h[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=S);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 d=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,I(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?E(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<d.length;r++){var i=d[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;P(r)&&(r=O(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),P(e)&&(e=O(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]"===v.call(t)?m(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=d.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):I(e).then((function(t){var n=h[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;b(e);var r=h[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,w(n._dbInfo)}})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}})):i.then((function(t){b(e);var n=h[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++)w(r[t]._dbInfo)})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}))}else n=a.reject("Invalid arguments");return s(n,t),n}};var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=/^~~local_forage_type~([^~]+)~/,T="__lfsc__:",k="arbf",W="blob",D="si08",B="ui08",x="uic8",L="si16",U="si32",H="ur16",F="ui32",G="fl32",z="fl64",K=Object.prototype.toString;function V(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),d=new Uint8Array(u);for(t=0;t<s;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),d[c++]=n<<2|r>>4,d[c++]=(15&r)<<4|o>>2,d[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+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[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 J={serialize:function(e,t){var n="";if(e&&(n=K.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===K.call(e.buffer))){var r,o=T;e instanceof ArrayBuffer?(r=e,o+=k):(r=e.buffer,"[object Int8Array]"===n?o+=D:"[object Uint8Array]"===n?o+=B:"[object Uint8ClampedArray]"===n?o+=x:"[object Int16Array]"===n?o+=L:"[object Uint16Array]"===n?o+=H:"[object Int32Array]"===n?o+=U:"[object Uint32Array]"===n?o+=F:"[object Float32Array]"===n?o+=G:"[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="~~local_forage_type~"+e.type+"~"+Q(this.result);t(T+W+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,9)!==T)return JSON.parse(e);var t,n=e.substring(13),r=e.substring(9,13);if(r===W&&j.test(n)){var o=n.match(j);t=o[1],n=n.substring(o[0].length)}var a=V(n);switch(r){case k:return a;case W:return i([a],{type:t});case D:return new Int8Array(a);case B:return new Uint8Array(a);case x:return new Uint8ClampedArray(a);case L:return new Int16Array(a);case H:return new Uint16Array(a);case U:return new Int32Array(a);case F:return new Uint32Array(a);case G:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:V,bufferToString:Q};function X(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function q(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):X(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function Y(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){q(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(Y.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}var $={_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){X(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=J,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){q(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){q(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 Y.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){q(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){q(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){q(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){q(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){q(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=d.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 Z(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ee(){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 te={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=Z(e,this._defaultConfig),ee()?(this._dbInfo=t,t.serializer=J,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=d.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(Z(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}},ne=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},re=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},oe={},ie={},ae={INDEXEDDB:C,WEBSQL:$,LOCALSTORAGE:te},se=[ae.INDEXEDDB._driver,ae.WEBSQL._driver,ae.LOCALSTORAGE._driver],ce=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),de={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function le(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function fe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(re(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var he=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),ae)if(ae.hasOwnProperty(n)){var r=ae[n],o=r._driver;this[n]=o,oe[o]||this.defineDriver(r)}this._defaultConfig=fe({},de),this._config=fe({},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=ue.concat("_initStorage"),c=0,u=i.length;c<u;c++){var d=i[c];if((!ne(ce,d)||e[d])&&"function"!=typeof e[d])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=ce.length;n<r;n++){var o=ce[n];e[o]||(e[o]=t(o))}}();var l=function(n){oe[r]&&console.info("Redefining LocalForage driver: "+r),oe[r]=e,ie[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!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=oe[e]?a.resolve(oe[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(J);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;re(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!!ie[e]},e.prototype._extend=function(e){fe(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=ue.length;e<t;e++)le(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ve=new he;t.exports=ve},{3:3}]},{},[4])(4)},939:(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"},13:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppApiEvent=t.AppApi=void 0;const r=n(210),o=n(54);var i;!function(e){e.CONFIG_CHANGED="event::cn.widgetjs.core.app.config.changed"}(i||(i={})),t.AppApiEvent=i;class a extends o.BaseApi{getChannel(){return r.Channel.APP}async setConfig(e,t){return await this.invokeMethod("setConfig",e,t)}async getConfig(e,t){const n=await this.invokeMethod("getConfig",e);return null==n?t:"boolean"==typeof t?"true"===n:"number"==typeof t?Number(n):n}async openAddWidgetWindow(){return this.invokeMethod("openAddWidgetWindow")}async getVersion(){return this.invokeMethod("getVersion")}async getPreloadPath(){return this.invokeMethod("getPreloadPath")}async openSettingWindow(){return this.invokeMethod("openSettingWindow")}}const s=new a;t.AppApi=s},54:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApi=void 0;const r=n(186);t.BaseApi=class{async invokeMethod(e,...t){return await r.ElectronUtils.invokeMethod(this.getChannel(),e,...t)}async invoke(...e){return await r.ElectronUtils.invoke(this.getChannel(),...e)}}},386:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastApi=t.BroadcastApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{async send(e){await this.invokeMethod("send",e)}async register(...e){await this.invokeMethod("register",e)}async unregister(...e){await this.invokeMethod("unregister",e)}getChannel(){return r.Channel.BROADCAST}}t.BroadcastApiImpl=i;const a=new i;t.BroadcastApi=a},105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserWindowApiEvent=t.BrowserWindowApi=t.BrowserWindowApiImpl=void 0;const r=n(210),o=n(54);var i;!function(e){e.BLUR="event::cn.widgetjs.core.browser-window.blur",e.FOCUS="event::cn.widgetjs.core.browser-window.focus"}(i||(i={})),t.BrowserWindowApiEvent=i;class a extends o.BaseApi{getChannel(){return r.Channel.BROWSER_WINDOW}async setIgnoreMouseEvent(e){await this.invokeMethod("setIgnoreMouseEvent",e)}async show(){await this.invokeMethod("show",!0)}async showInactive(){await this.invokeMethod("showInactive",!0)}async hide(){await this.invokeMethod("hide",!1)}async center(){await this.invokeMethod("center",!1)}async setAlwaysOnTop(e){await this.invokeMethod("setAlwaysOnTop",e)}async isAlwaysOnTop(){return await this.invokeMethod("isAlwaysOnTop")}async openUrl(e,t){await this.invokeMethod("openUrl",e,t)}async moveTop(){await this.invokeMethod("moveTop")}async openDevTools(){await this.invokeMethod("openDevTools")}async setPosition(e,t,n){await this.invokeMethod("setPosition",e,t,n)}async getPosition(){return await this.invokeMethod("getPosition")}async blur(){return await this.invokeMethod("blur")}async focus(){return await this.invokeMethod("focus")}async setResizable(e){return await this.invokeMethod("setResizable",e)}async getBounds(){return await this.invokeMethod("getBounds")}async setBounds(e,t){return await this.invokeMethod("setBounds",e,t)}async alignToScreen(e){return await this.invokeMethod("alignToScreen",e)}async startDraggingWindow(){return await this.invokeMethod("startDraggingWindow")}async stopDraggingWindow(){return await this.invokeMethod("stopDraggingWindow")}async existsByUrl(e){return await this.invokeMethod("existsByUrl",e)}}t.BrowserWindowApiImpl=a;const s=new a;t.BrowserWindowApi=s},210:(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.DIALOG="channel::cn.widgetjs.core.dialog",n.CLIPBOARD="channel::cn.widgetjs.core.clipboard",n.SCREEN="channel::cn.widgetjs.core.screen",n.SHORTCUT="channel::cn.widgetjs.core.shortcut",n.LOG="channel::cn.widgetjs.core.log",n.DEVICE="channel::cn.widgetjs.core.device",n.MOUSE="channel::cn.widgetjs.core.mouse",n.KEYBOARD="channel::cn.widgetjs.core.keyboard"},32:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClipboardApiEvent=t.ClipboardApi=void 0;const r=n(210),o=n(54);var i;!function(e){e.CHANGED="clipboard-changed"}(i||(i={})),t.ClipboardApiEvent=i;class a extends o.BaseApi{async getSelectedText(){return this.invokeMethod("getSelectedText")}async getText(){return this.invokeMethod("getText")}getChannel(){return r.Channel.CLIPBOARD}}const s=new a;t.ClipboardApi=s},786:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceApi=t.DeviceApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{async getCursorScreenPoint(){return this.invokeMethod("getCursorScreenPoint")}async isAllKeyReleased(){return this.invokeMethod("isAllKeyReleased")}getChannel(){return r.Channel.DEVICE}}t.DeviceApiImpl=i;const a=new i;t.DeviceApi=a},326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogApi=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.DIALOG}pickFile(e){return this.invokeMethod("pickFile",e)}}const a=new i;t.DialogApi=a},444:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElectronApi=void 0;const r=n(186);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))}}},164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidgetApi=t.HostedWidgetApiImpl=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.HOSTED_WIDGET}async removeHostedWidget(e){return this.invokeMethod("removeHostedWidget",e)}addWidget(e,t){return this.invokeMethod("addWidget",e,t)}async removeHostedWidgetByName(e){return this.invokeMethod("removeHostedWidgetByName",e)}async getHostedWidgets(e){return this.invokeMethod("getHostedWidgets",e)}async getHostedWidget(e){return this.invokeMethod("getHostedWidget",e)}async openDevTools(e){return this.invokeMethod("openDevTools",e)}async openConfigRoute(e,t){return this.invokeMethod("openConfigRoute",e,t)}async registerActiveShortcut(e,t){return this.invokeMethod("registerActiveShortcut",e,t)}async setProxy(e,t){return this.invokeMethod("setProxy",e,t)}}t.HostedWidgetApiImpl=i;const a=new i;t.HostedWidgetApi=a},190:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogApi=void 0;const r=n(210),o=n(54);class i extends o.BaseApi{getChannel(){return r.Channel.LOG}info(...e){console.info(...e),this.invokeMethod("info",...e)}error(...e){console.error(...e),this.invokeMethod("error",...e)}warn(...e){console.warn(...e),this.invokeMethod("warn",...e)}log(...e){console.log(...e),this.invokeMethod("log",...e)}}const a=new i;t.LogApi=a},288:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationApiEvent=t.NotificationApi=void 0;const r=n(451),o=n(210),i=n(54);var a;!function(e){e.CONFIRM="event::cn.widgetjs.core.notification.confirm",e.CANCEL="event::cn.widgetjs.core.notification.cancel",e.HIDE="event::cn.widgetjs.core.notification.hide"}(a||(a={})),t.NotificationApiEvent=a;class s extends i.BaseApi{async call(e,t,n,o,i){await this.invoke(new r.AppNotification({avatar:e,audio:t,message:o,title:n,duration:-1,lyric:i,type:"call"}))}async send(e){return this.invokeMethod("send",e)}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"}))}async advanceCountdown(e,t,n){return await this.send(new r.AppNotification({title:n,message:e,targetTime:t,type:"advance-countdown"}))}async countdown(e,t){await this.send(new r.AppNotification({message:e,targetTime:t,backgroundColor:"rgba(0,0,0,0.5)",duration:-1,type:"countdown"}))}async success(e,t=5e3){await this.send(new r.AppNotification({message:e,type:"success",icon:"check_circle_line",duration:t}))}async error(e,t=5e3){await this.send(new r.AppNotification({message:e,type:"error",icon:"close_circle_line",duration:t}))}async warning(e,t=5e3){await this.send(new r.AppNotification({message:e,type:"warning",icon:"warning_line",duration:t}))}async info(e,t=5e3){await this.send(new r.AppNotification({message:e,type:"info",icon:"information_line",duration:t}))}async hide(){await this.invokeMethod("hide")}getChannel(){return o.Channel.NOTIFICATION}}const c=new s;t.NotificationApi=c},388:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShortcutApiEvent=t.ShortcutApi=void 0;const r=n(54),o=n(210);var i;!function(e){e.TRIGGERED="channel::cn.widgetjs.core.shortcut.triggered"}(i||(i={})),t.ShortcutApiEvent=i;class a extends r.BaseApi{getChannel(){return o.Channel.SHORTCUT}async register(e){return await this.invokeMethod("register",e)}async unregister(e){return await this.invokeMethod("unregister",e)}}const s=new a;t.ShortcutApi=s},287:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetApiEvent=t.WidgetApi=void 0;const r=n(713),o=n(611),i=n(210),a=n(889),s=n(54);var c;!function(e){e.DATA_CHANGED="event::cn.widgetjs.core.widget.data-changed",e.EDIT_DESKTOP_WIDGETS="event::cn.widgetjs.core.widget.desktop.edit"}(c||(c={})),t.WidgetApiEvent=c;class u extends s.BaseApi{getChannel(){return i.Channel.WIDGET}async registerWidgets(e){return this.invokeMethod("registerWidgets",JSON.stringify(e))}async registerWidgetPackage(e){return this.invokeMethod("registerWidgetPackage",JSON.stringify(e))}async getWidgets(){const e=await this.invokeMethod("getWidgets"),t=[];if(e)for(const n of e)t.push(r.Widget.parseObject(n));return t}async getWidgetPackages(){return await this.invokeMethod("getWidgetPackages")}async getWidget(e){return r.Widget.parseObject(await this.invokeMethod("getWidget",e))}async getWidgetPackage(e){return o.WidgetPackage.parseObject(await this.invokeMethod("getWidgetPackage",e))}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?a.UrlUtils.getWidgetUrl(r.url,o,t):null}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?a.UrlUtils.getWidgetUrl(r.url,o,t):null}async getWidgetPackageIndexUrl(e,t){const n=await this.getWidgetPackage(e);return n?n.getIndexUrl(t):null}async getWidgetPackageUrl(e){const t=await this.getWidgetPackage(e);return t?t.url:null}}const d=new u;t.WidgetApi=d},159: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.WidgetDataApi=void 0;const o=r(n(680)),i=n(833),a=n(386),s=n(287);class c{static async save(e){let t=this.getStore(e.name),n=JSON.stringify(e);const r=await t.setItem(this.getKey(e.name,e.id),n),o=new i.BroadcastEvent({event:s.WidgetApiEvent.DATA_CHANGED,payload:{name:e.name,json:n}});return await a.BroadcastApi.send(o),r}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,t={sendBroadcast:!0}){const n=this.getStore(e.name),r=JSON.stringify(e),o=await n.setItem(e.name,r);if(null==t?void 0:t.sendBroadcast){const t=new i.BroadcastEvent({event:s.WidgetApiEvent.DATA_CHANGED,payload:{name:e.name,json:r}});await a.BroadcastApi.send(t)}return o}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.WidgetDataApi=c,c.stores=new Map},347: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(713),t),o(n(833),t),o(n(647),t),o(n(905),t),o(n(859),t),o(n(451),t),o(n(538),t),o(n(314),t),o(n(304),t),o(n(511),t),o(n(53),t),o(n(611),t),o(n(444),t),o(n(159),t),o(n(105),t),o(n(319),t),o(n(288),t),o(n(164),t),o(n(786),t),o(n(210),t),o(n(32),t),o(n(287),t),o(n(939),t),o(n(388),t),o(n(386),t),o(n(13),t),o(n(326),t),o(n(186),t),o(n(889),t),o(n(851),t),o(n(190),t),o(n(410),t)},319:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},451:(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"}}},538:(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"},314:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HostedWidget=void 0;const r=n(538);t.HostedWidget=class{constructor(){this.x=0,this.y=0}isOverlap(){return(this.hostedMode&r.HostedMode.OVERLAP)>0}}},713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetKeyword=t.Widget=void 0;const r=n(538),o=n(398);class i{constructor(e){var t,n,o,i,a,s,c,u,d;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.movable=null===(t=e.movable)||void 0===t||t,this.permissions=null!==(n=e.permissions)&&void 0!==n?n:[],this.maxWidth=null!==(o=e.maxWidth)&&void 0!==o?o:e.width,this.maxHeight=null!==(i=e.maxHeight)&&void 0!==i?i:e.height,this.minWidth=null!==(a=e.minWidth)&&void 0!==a?a:e.width,this.minHeight=null!==(s=e.minHeight)&&void 0!==s?s:e.height,this.backgroundThrottling=null===(c=e.backgroundThrottling)||void 0===c||c,this.packageName=e.packageName,this.previewImage=e.previewImage,this.shortcut=e.shortcut,this.refreshWhenResided=null!==(u=e.refreshWhenResided)&&void 0!==u&&u,this.hideWhenBlur=null!=e.hideWhenBlur&&e.hideWhenBlur,this.supportHostedMode=null!==(d=e.supportHostedMode)&&void 0!==d?d: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()))}isConfigurable(){return null!=this.getConfigRoute()}getTitle(e){return(0,o.getTextByLanguageCode)(this.title,e)}getDescription(e){return(0,o.getTextByLanguageCode)(this.description,e)}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new i({description:{},height:0,keywords:[],lang:"",name:"",routes:[],title:{},width:0});return Object.assign(t,e),t}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 a;t.Widget=i,(a=t.WidgetKeyword||(t.WidgetKeyword={})).RECOMMEND="recommend",a.TOOLS="tools",a.EFFICIENCY="efficiency",a.PICTURE="picture",a.LIFE="life",a.SHORTCUT="shortcut",a.COUNTDOWN="countdown",a.TIMER="timer",a.INFO="info",a.DASHBOARD="dashboard"},905:(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)}}},611:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetPackage=void 0;const r=n(889),o=n(398);class i{constructor(e){if(this.hash=!0,this.widgets=[],this.name=e.name,this.version=e.version,this.author=e.author,this.homepage=e.homepage,this.title=e.title,this.description=e.description,this.entry=e.entry,this.remoteEntry=e.remoteEntry,this.remotePackage=e.remotePackage,this.hash=e.hash,this.url=e.url,this.devOptions=e.devOptions,e.widgets)for(let t of e.widgets)this.widgets.push(t)}static parseJSON(e){const t=JSON.parse(e);return this.parseObject(t)}static parseObject(e){let t=new i({author:"",description:{"zh-CN":""},entry:"",hash:!1,homepage:"",name:"",title:{"zh-CN":""},url:"",version:""});return Object.assign(t,e),t}getTitle(e){return(0,o.getTextByLanguageCode)(this.title,e)}getDescription(e){return(0,o.getTextByLanguageCode)(this.description,e)}getIndexUrl(e){return r.UrlUtils.getWidgetPackageIndexUrl(this.url,this.entry,null==e?this.hash:e)}}t.WidgetPackage=i},859:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeMode=t.WidgetParams=void 0;const r=n(851),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"},53:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},833:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BroadcastEvent=void 0,t.BroadcastEvent=class{constructor(e){this.event=e.event,this.sender=e.sender,this.payload=e.payload}}},511:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},647:(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}}},304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},410:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},479:(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,d=/%60/g,l=/%7B/g,f=/%7C/g,h=/%7D/g,v=/%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(v,"+").replace(n,"%23").replace(r,"%26").replace(d,"`").replace(l,"{").replace(h,"}").replace(u,"^")}function y(e){return p(e).replace(n,"%23").replace(a,"%3F")}t.encodeHash=function(e){return p(e).replace(l,"{").replace(h,"}").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}},851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringifyQuery=t.parseQuery=void 0;const r=n(479),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}},186:(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}static async invokeMethod(e,t,...n){var r;return null===(r=this.getAPI())||void 0===r?void 0:r.invoke(e,t,...n)}static async invoke(e,...t){var n;return null===(n=this.getAPI())||void 0===n?void 0:n.invoke(e,...t)}}},398:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTextByLanguageCode=void 0,t.getTextByLanguageCode=function e(t,n,r=!0){let o;if(n&&n in t)return t[n];if(null==o&&r&&"undefined"!=typeof navigator&&navigator.languages&&(o=e(t,navigator.language,!1),null!=o))return o;if(null==o){let e=Object.keys(t);if(e.length>0)return t[e[0]]}}},889:(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(347)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widget-js/core",
3
- "version": "0.5.5",
3
+ "version": "0.5.13",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"