clickgo 3.16.26 → 3.16.28

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.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +4 -16
  3. package/dist/app/demo/config.json +4 -1
  4. package/dist/app/demo/form/control/arteditor/arteditor.js +7 -18
  5. package/dist/app/demo/form/control/button/button.js +2 -13
  6. package/dist/app/demo/form/control/check/check.js +3 -14
  7. package/dist/app/demo/form/control/content/content.js +3 -14
  8. package/dist/app/demo/form/control/daterange/daterange.js +1 -1
  9. package/dist/app/demo/form/control/delete/delete.js +3 -14
  10. package/dist/app/demo/form/control/dialog/dialog.js +2 -0
  11. package/dist/app/demo/form/control/dialog/dialog.xml +26 -12
  12. package/dist/app/demo/form/control/flow/flow.js +2 -13
  13. package/dist/app/demo/form/control/form/form.js +4 -15
  14. package/dist/app/demo/form/control/iconview/iconview.js +12 -29
  15. package/dist/app/demo/form/control/jodit/jodit.js +7 -18
  16. package/dist/app/demo/form/control/link/link.js +2 -13
  17. package/dist/app/demo/form/control/list/list.js +40 -52
  18. package/dist/app/demo/form/control/list/list.xml +20 -10
  19. package/dist/app/demo/form/control/map/map.js +17 -28
  20. package/dist/app/demo/form/control/menu/menu.js +6 -17
  21. package/dist/app/demo/form/control/mpegts/mpegts.js +1 -1
  22. package/dist/app/demo/form/control/nav/nav.js +6 -17
  23. package/dist/app/demo/form/control/novnc/novnc.js +75 -0
  24. package/dist/app/demo/form/control/novnc/novnc.xml +13 -0
  25. package/dist/app/demo/form/control/panel/panel.js +9 -20
  26. package/dist/app/demo/form/control/panel/test1.js +20 -41
  27. package/dist/app/demo/form/control/pdf/pdf.js +7 -20
  28. package/dist/app/demo/form/control/progress/progress.js +3 -12
  29. package/dist/app/demo/form/control/radio/radio.js +6 -17
  30. package/dist/app/demo/form/control/select/select.js +28 -41
  31. package/dist/app/demo/form/control/switch/switch.js +3 -14
  32. package/dist/app/demo/form/control/tab/tab.js +7 -18
  33. package/dist/app/demo/form/control/table/table.js +8 -23
  34. package/dist/app/demo/form/control/text/text.js +2 -13
  35. package/dist/app/demo/form/control/tuieditor/tuieditor.js +7 -18
  36. package/dist/app/demo/form/control/uploader/uploader.js +20 -31
  37. package/dist/app/demo/form/control/vflow/vflow.js +2 -13
  38. package/dist/app/demo/form/event/form/form.js +11 -22
  39. package/dist/app/demo/form/event/task/task.js +14 -29
  40. package/dist/app/demo/form/main.js +381 -387
  41. package/dist/app/demo/form/main.xml +3 -0
  42. package/dist/app/demo/form/method/acontrol/acontrol.js +2 -13
  43. package/dist/app/demo/form/method/aform/aform.js +41 -60
  44. package/dist/app/demo/form/method/aform/sd.js +3 -14
  45. package/dist/app/demo/form/method/core/core.js +25 -50
  46. package/dist/app/demo/form/method/dom/dom.js +35 -58
  47. package/dist/app/demo/form/method/form/form.js +106 -149
  48. package/dist/app/demo/form/method/fs/fs.js +126 -147
  49. package/dist/app/demo/form/method/native/native.js +44 -72
  50. package/dist/app/demo/form/method/storage/storage.js +9 -27
  51. package/dist/app/demo/form/method/system/system.js +16 -41
  52. package/dist/app/demo/form/method/task/task.js +18 -37
  53. package/dist/app/demo/form/method/theme/theme.js +39 -54
  54. package/dist/app/demo/form/method/tool/tool.js +22 -43
  55. package/dist/app/demo/form/method/tool/tool.xml +1 -1
  56. package/dist/app/demo/form/method/zip/zip.js +18 -29
  57. package/dist/app/demo/form/solution/backpanel/backpanel.js +10 -23
  58. package/dist/app/task/app.js +2 -13
  59. package/dist/app/task/form/bar/bar.js +32 -45
  60. package/dist/clickgo.js +1 -1
  61. package/dist/control/arteditor.cgc +0 -0
  62. package/dist/control/box.cgc +0 -0
  63. package/dist/control/captcha.cgc +0 -0
  64. package/dist/control/common.cgc +0 -0
  65. package/dist/control/desc.cgc +0 -0
  66. package/dist/control/drawer.cgc +0 -0
  67. package/dist/control/echarts.cgc +0 -0
  68. package/dist/control/form.cgc +0 -0
  69. package/dist/control/iconview.cgc +0 -0
  70. package/dist/control/jodit.cgc +0 -0
  71. package/dist/control/map.cgc +0 -0
  72. package/dist/control/monaco.cgc +0 -0
  73. package/dist/control/mpegts.cgc +0 -0
  74. package/dist/control/nav.cgc +0 -0
  75. package/dist/control/novnc.cgc +0 -0
  76. package/dist/control/page.cgc +0 -0
  77. package/dist/control/pdf.cgc +0 -0
  78. package/dist/control/property.cgc +0 -0
  79. package/dist/control/qrcode.cgc +0 -0
  80. package/dist/control/table.cgc +0 -0
  81. package/dist/control/task.cgc +0 -0
  82. package/dist/control/tplink.cgc +0 -0
  83. package/dist/control/tuieditor.cgc +0 -0
  84. package/dist/control/tuiviewer.cgc +0 -0
  85. package/dist/control/xterm.cgc +0 -0
  86. package/dist/index.js +59 -71
  87. package/dist/lib/control.js +213 -235
  88. package/dist/lib/core.js +356 -379
  89. package/dist/lib/dom.js +62 -91
  90. package/dist/lib/form.js +834 -906
  91. package/dist/lib/fs.js +834 -892
  92. package/dist/lib/native.js +32 -63
  93. package/dist/lib/storage.js +21 -33
  94. package/dist/lib/task.js +1054 -1098
  95. package/dist/lib/theme.js +102 -121
  96. package/dist/lib/tool.js +65 -98
  97. package/dist/lib/zip.js +27 -42
  98. package/dist/theme/blue.cgt +0 -0
  99. package/dist/theme/byterun.cgt +0 -0
  100. package/dist/theme/dark.cgt +0 -0
  101. package/dist/theme/light.cgt +0 -0
  102. package/package.json +1 -1
package/dist/lib/theme.js CHANGED
@@ -32,15 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
35
  Object.defineProperty(exports, "__esModule", { value: true });
45
36
  exports.global = void 0;
46
37
  exports.read = read;
@@ -54,131 +45,121 @@ const tool = __importStar(require("./tool"));
54
45
  const task = __importStar(require("./task"));
55
46
  const dom = __importStar(require("./dom"));
56
47
  exports.global = null;
57
- function read(blob) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const z = yield zip.get(blob);
60
- if (!z) {
61
- return false;
62
- }
63
- const configContent = yield z.getContent('config.json');
64
- if (!configContent) {
65
- return false;
66
- }
67
- const config = JSON.parse(configContent);
68
- const files = {};
69
- const list = z.readDir('/', {
70
- 'hasChildren': true
71
- });
72
- for (const file of list) {
73
- const mime = tool.getMimeByPath(file.name);
74
- if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
75
- const fab = yield z.getContent(file.path + file.name, 'string');
76
- if (!fab) {
77
- continue;
78
- }
79
- files[file.path + file.name] = fab.replace(/^\ufeff/, '');
80
- }
81
- else {
82
- const fab = yield z.getContent(file.path + file.name, 'arraybuffer');
83
- if (!fab) {
84
- continue;
85
- }
86
- files[file.path + file.name] = new Blob([fab], {
87
- 'type': mime.mime
88
- });
89
- }
90
- }
91
- return {
92
- 'type': 'theme',
93
- 'config': config,
94
- 'files': files
95
- };
48
+ async function read(blob) {
49
+ const z = await zip.get(blob);
50
+ if (!z) {
51
+ return false;
52
+ }
53
+ const configContent = await z.getContent('config.json');
54
+ if (!configContent) {
55
+ return false;
56
+ }
57
+ const config = JSON.parse(configContent);
58
+ const files = {};
59
+ const list = z.readDir('/', {
60
+ 'hasChildren': true
96
61
  });
97
- }
98
- function load(theme, taskId) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- if (!taskId) {
101
- return false;
102
- }
103
- const t = task.list[taskId];
104
- if (!t) {
105
- return false;
106
- }
107
- const isGlobal = theme ? false : true;
108
- if (t.customTheme && isGlobal) {
109
- return true;
110
- }
111
- if (!theme) {
112
- if (!exports.global) {
113
- return true;
62
+ for (const file of list) {
63
+ const mime = tool.getMimeByPath(file.name);
64
+ if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
65
+ const fab = await z.getContent(file.path + file.name, 'string');
66
+ if (!fab) {
67
+ continue;
114
68
  }
115
- theme = exports.global;
69
+ files[file.path + file.name] = fab.replace(/^\ufeff/, '');
116
70
  }
117
- let style = theme.files[theme.config.style + '.css'];
118
- if (!style) {
119
- return false;
120
- }
121
- style = tool.stylePrepend(style, `cg-theme-task${taskId}-`).style;
122
- style = yield tool.styleUrl2DataUrl(theme.config.style, style, theme.files);
123
- style = style.replace(/\[CGTMP-GLOBAL\] +::selection/g, `#cg-form-list > [data-task-id="${taskId}"] ::selection, #cg-pop-list > [data-task-id="${taskId}"] ::selection`);
124
- style = style.replace(/\[CGTMP-GLOBAL\]/g, `#cg-form-list > [data-task-id="${taskId}"], #cg-pop-list > [data-task-id="${taskId}"]`);
125
- if (!t.customTheme) {
126
- if (!isGlobal) {
127
- t.customTheme = true;
71
+ else {
72
+ const fab = await z.getContent(file.path + file.name, 'arraybuffer');
73
+ if (!fab) {
74
+ continue;
128
75
  }
129
- dom.removeStyle(taskId, 'theme');
130
- }
131
- dom.pushStyle(taskId, style, 'theme', theme.config.name);
132
- return true;
133
- });
134
- }
135
- function remove(name, taskId) {
136
- return __awaiter(this, void 0, void 0, function* () {
137
- if (!taskId) {
138
- return;
139
- }
140
- const t = task.list[taskId];
141
- if (!t) {
142
- return;
143
- }
144
- if (!t.customTheme) {
145
- return;
76
+ files[file.path + file.name] = new Blob([fab], {
77
+ 'type': mime.mime
78
+ });
146
79
  }
147
- dom.removeStyle(taskId, 'theme', name);
148
- if (dom.getStyleCount(taskId, 'theme') === 0) {
149
- t.customTheme = false;
150
- if (exports.global) {
151
- yield load(undefined, taskId);
152
- }
153
- }
154
- });
80
+ }
81
+ return {
82
+ 'type': 'theme',
83
+ 'config': config,
84
+ 'files': files
85
+ };
155
86
  }
156
- function clear(taskId) {
157
- return __awaiter(this, void 0, void 0, function* () {
158
- if (!taskId) {
159
- return;
160
- }
161
- const t = task.list[taskId];
162
- if (!t) {
163
- return;
87
+ async function load(theme, taskId) {
88
+ if (!taskId) {
89
+ return false;
90
+ }
91
+ const t = task.list[taskId];
92
+ if (!t) {
93
+ return false;
94
+ }
95
+ const isGlobal = theme ? false : true;
96
+ if (t.customTheme && isGlobal) {
97
+ return true;
98
+ }
99
+ if (!theme) {
100
+ if (!exports.global) {
101
+ return true;
164
102
  }
165
- if (!t.customTheme) {
166
- return;
103
+ theme = exports.global;
104
+ }
105
+ let style = theme.files[theme.config.style + '.css'];
106
+ if (!style) {
107
+ return false;
108
+ }
109
+ style = tool.stylePrepend(style, `cg-theme-task${taskId}-`).style;
110
+ style = await tool.styleUrl2DataUrl(theme.config.style, style, theme.files);
111
+ style = style.replace(/\[CGTMP-GLOBAL\] +::selection/g, `#cg-form-list > [data-task-id="${taskId}"] ::selection, #cg-pop-list > [data-task-id="${taskId}"] ::selection`);
112
+ style = style.replace(/\[CGTMP-GLOBAL\]/g, `#cg-form-list > [data-task-id="${taskId}"], #cg-pop-list > [data-task-id="${taskId}"]`);
113
+ if (!t.customTheme) {
114
+ if (!isGlobal) {
115
+ t.customTheme = true;
167
116
  }
168
117
  dom.removeStyle(taskId, 'theme');
118
+ }
119
+ dom.pushStyle(taskId, style, 'theme', theme.config.name);
120
+ return true;
121
+ }
122
+ async function remove(name, taskId) {
123
+ if (!taskId) {
124
+ return;
125
+ }
126
+ const t = task.list[taskId];
127
+ if (!t) {
128
+ return;
129
+ }
130
+ if (!t.customTheme) {
131
+ return;
132
+ }
133
+ dom.removeStyle(taskId, 'theme', name);
134
+ if (dom.getStyleCount(taskId, 'theme') === 0) {
169
135
  t.customTheme = false;
170
136
  if (exports.global) {
171
- yield load(undefined, taskId);
137
+ await load(undefined, taskId);
172
138
  }
173
- });
139
+ }
174
140
  }
175
- function setGlobal(theme) {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- exports.global = theme;
178
- for (const taskId in task.list) {
179
- yield load(undefined, parseInt(taskId));
180
- }
181
- });
141
+ async function clear(taskId) {
142
+ if (!taskId) {
143
+ return;
144
+ }
145
+ const t = task.list[taskId];
146
+ if (!t) {
147
+ return;
148
+ }
149
+ if (!t.customTheme) {
150
+ return;
151
+ }
152
+ dom.removeStyle(taskId, 'theme');
153
+ t.customTheme = false;
154
+ if (exports.global) {
155
+ await load(undefined, taskId);
156
+ }
157
+ }
158
+ async function setGlobal(theme) {
159
+ exports.global = theme;
160
+ for (const taskId in task.list) {
161
+ await load(undefined, parseInt(taskId));
162
+ }
182
163
  }
183
164
  function clearGlobal() {
184
165
  if (!exports.global) {
package/dist/lib/tool.js CHANGED
@@ -32,15 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
35
  Object.defineProperty(exports, "__esModule", { value: true });
45
36
  exports.RANDOM_LUNS = exports.RANDOM_V = exports.RANDOM_LUN = exports.RANDOM_LU = exports.RANDOM_LN = exports.RANDOM_UN = exports.RANDOM_L = exports.RANDOM_U = exports.RANDOM_N = void 0;
46
37
  exports.compressor = compressor;
@@ -95,33 +86,30 @@ exports.isEscaped = isEscaped;
95
86
  exports.parseArrayString = parseArrayString;
96
87
  const core = __importStar(require("./core"));
97
88
  let compressorjs = null;
98
- function compressor(file_1) {
99
- return __awaiter(this, arguments, void 0, function* (file, options = {}) {
100
- if (!compressorjs) {
101
- try {
102
- compressorjs = yield core.getModule('compressorjs');
103
- }
104
- catch (_a) {
105
- return false;
106
- }
89
+ async function compressor(file, options = {}) {
90
+ if (!compressorjs) {
91
+ try {
92
+ compressorjs = await core.getModule('compressorjs');
107
93
  }
108
- return new Promise((resolve) => {
109
- new compressorjs(file, {
110
- 'quality': options.quality,
111
- 'maxWidth': options.maxWidth,
112
- 'maxHeight': options.maxHeight,
113
- success: (result) => {
114
- resolve(result);
115
- },
116
- error: () => {
117
- resolve(false);
118
- }
119
- });
94
+ catch {
95
+ return false;
96
+ }
97
+ }
98
+ return new Promise((resolve) => {
99
+ new compressorjs(file, {
100
+ 'quality': options.quality,
101
+ 'maxWidth': options.maxWidth,
102
+ 'maxHeight': options.maxHeight,
103
+ success: (result) => {
104
+ resolve(result);
105
+ },
106
+ error: () => {
107
+ resolve(false);
108
+ }
120
109
  });
121
110
  });
122
111
  }
123
112
  function getClassPrototype(obj, over = [], level = 0) {
124
- var _a;
125
113
  if (level === 0) {
126
114
  return getClassPrototype(Object.getPrototypeOf(obj), over, level + 1);
127
115
  }
@@ -148,7 +136,7 @@ function getClassPrototype(obj, over = [], level = 0) {
148
136
  if (des.value) {
149
137
  rtn.method[item] = des.value;
150
138
  }
151
- else if ((_a = des.get) !== null && _a !== void 0 ? _a : des.set) {
139
+ else if (des.get ?? des.set) {
152
140
  if (!rtn.access[item]) {
153
141
  rtn.access[item] = {};
154
142
  }
@@ -242,7 +230,7 @@ function clone(obj) {
242
230
  }
243
231
  function sleep(ms = 0) {
244
232
  return new Promise(function (resolve) {
245
- if (ms > 30000) {
233
+ if (ms > 30_000) {
246
234
  resolve(false);
247
235
  return;
248
236
  }
@@ -258,15 +246,13 @@ function nextFrame() {
258
246
  });
259
247
  });
260
248
  }
261
- function sleepFrame(count) {
262
- return __awaiter(this, void 0, void 0, function* () {
263
- if (count > 10) {
264
- count = 10;
265
- }
266
- for (let i = 0; i < count; ++i) {
267
- yield nextFrame();
268
- }
269
- });
249
+ async function sleepFrame(count) {
250
+ if (count > 10) {
251
+ count = 10;
252
+ }
253
+ for (let i = 0; i < count; ++i) {
254
+ await nextFrame();
255
+ }
270
256
  }
271
257
  function purify(text) {
272
258
  text = '>' + text + '<';
@@ -291,24 +277,22 @@ function match(str, regs) {
291
277
  }
292
278
  return false;
293
279
  }
294
- function styleUrl2DataUrl(path, style, files) {
295
- return __awaiter(this, void 0, void 0, function* () {
296
- const reg = /url\(["']{0,1}(.+?)["']{0,1}\)/ig;
297
- let match = null;
298
- while ((match = reg.exec(style))) {
299
- let realPath = urlResolve(path, match[1]);
300
- if (realPath.startsWith('/package/')) {
301
- realPath = realPath.slice(8);
302
- }
303
- if (!files[realPath]) {
304
- continue;
305
- }
306
- if (typeof files[realPath] !== 'string') {
307
- style = style.replace(match[0], `url('${yield blob2DataUrl(files[realPath])}')`);
308
- }
280
+ async function styleUrl2DataUrl(path, style, files) {
281
+ const reg = /url\(["']{0,1}(.+?)["']{0,1}\)/ig;
282
+ let match = null;
283
+ while ((match = reg.exec(style))) {
284
+ let realPath = urlResolve(path, match[1]);
285
+ if (realPath.startsWith('/package/')) {
286
+ realPath = realPath.slice(8);
309
287
  }
310
- return style;
311
- });
288
+ if (!files[realPath]) {
289
+ continue;
290
+ }
291
+ if (typeof files[realPath] !== 'string') {
292
+ style = style.replace(match[0], `url('${await blob2DataUrl(files[realPath])}')`);
293
+ }
294
+ }
295
+ return style;
312
296
  }
313
297
  function layoutAddTagClassAndReTagName(layout, retagname) {
314
298
  const list = [];
@@ -505,7 +489,6 @@ function stylePrepend(style, prep = '') {
505
489
  };
506
490
  }
507
491
  function getMimeByPath(path) {
508
- var _a;
509
492
  const lio = path.lastIndexOf('.');
510
493
  const ext = (lio === -1 ? path : path.slice(lio + 1)).toLowerCase();
511
494
  const exts = {
@@ -518,7 +501,7 @@ function getMimeByPath(path) {
518
501
  'gif': 'image/gif',
519
502
  'png': 'image/png'
520
503
  };
521
- const mime = (_a = exts[ext]) !== null && _a !== void 0 ? _a : 'application/octet-stream';
504
+ const mime = exts[ext] ?? 'application/octet-stream';
522
505
  return {
523
506
  'mime': mime,
524
507
  'ext': ext
@@ -582,7 +565,7 @@ function getArray(param) {
582
565
  try {
583
566
  rtn = JSON.parse(param);
584
567
  }
585
- catch (_a) {
568
+ catch {
586
569
  return [];
587
570
  }
588
571
  }
@@ -606,7 +589,6 @@ function formatColor(color) {
606
589
  });
607
590
  }
608
591
  function rgb2hex(r, g, b, a = 1) {
609
- var _a;
610
592
  if (g === undefined || b === undefined) {
611
593
  if (typeof r !== 'string') {
612
594
  return '';
@@ -615,7 +597,7 @@ function rgb2hex(r, g, b, a = 1) {
615
597
  r = Math.round(rgb[0]);
616
598
  g = Math.round(rgb[1]);
617
599
  b = Math.round(rgb[2]);
618
- a = (_a = rgb[3]) !== null && _a !== void 0 ? _a : 1;
600
+ a = rgb[3] ?? 1;
619
601
  }
620
602
  else {
621
603
  if (typeof r === 'string') {
@@ -659,7 +641,6 @@ function hex2rgb(hex) {
659
641
  return rgb;
660
642
  }
661
643
  function rgb2hsl(r, g, b, a = 1, decimal = false) {
662
- var _a;
663
644
  const hsl = {
664
645
  'h': 0,
665
646
  's': 0,
@@ -675,7 +656,7 @@ function rgb2hsl(r, g, b, a = 1, decimal = false) {
675
656
  r = rgb[0];
676
657
  g = rgb[1];
677
658
  b = rgb[2];
678
- a = (_a = rgb[3]) !== null && _a !== void 0 ? _a : 1;
659
+ a = rgb[3] ?? 1;
679
660
  }
680
661
  else {
681
662
  if (typeof r === 'string') {
@@ -729,7 +710,6 @@ function rgb2hsl(r, g, b, a = 1, decimal = false) {
729
710
  return hsl;
730
711
  }
731
712
  function hsl2rgb(h, s, l, a = 1, decimal = false) {
732
- var _a;
733
713
  const rgb = {
734
714
  'r': 0,
735
715
  'g': 0,
@@ -745,7 +725,7 @@ function hsl2rgb(h, s, l, a = 1, decimal = false) {
745
725
  h = hsl[0];
746
726
  s = hsl[1];
747
727
  l = hsl[2];
748
- a = (_a = hsl[3]) !== null && _a !== void 0 ? _a : 1;
728
+ a = hsl[3] ?? 1;
749
729
  }
750
730
  else {
751
731
  if (typeof h === 'string') {
@@ -780,14 +760,12 @@ function hsl2rgb(h, s, l, a = 1, decimal = false) {
780
760
  }
781
761
  function request(url, opt) {
782
762
  return new Promise(function (resove) {
783
- var _a;
784
763
  const xhr = new XMLHttpRequest();
785
764
  if (opt.credentials === false) {
786
765
  xhr.withCredentials = false;
787
766
  }
788
767
  xhr.upload.onloadstart = function (e) {
789
- var _a;
790
- const r = (_a = opt.uploadStart) === null || _a === void 0 ? void 0 : _a.call(opt, e.total);
768
+ const r = opt.uploadStart?.(e.total);
791
769
  if (r && (r instanceof Promise)) {
792
770
  r.catch(function (e1) {
793
771
  console.log(e1);
@@ -795,8 +773,7 @@ function request(url, opt) {
795
773
  }
796
774
  };
797
775
  xhr.upload.onprogress = function (e) {
798
- var _a;
799
- const r = (_a = opt.uploadProgress) === null || _a === void 0 ? void 0 : _a.call(opt, e.loaded, e.total);
776
+ const r = opt.uploadProgress?.(e.loaded, e.total);
800
777
  if (r && (r instanceof Promise)) {
801
778
  r.catch(function (e1) {
802
779
  console.log(e1);
@@ -804,8 +781,7 @@ function request(url, opt) {
804
781
  }
805
782
  };
806
783
  xhr.upload.onloadend = function () {
807
- var _a;
808
- const r = (_a = opt.uploadEnd) === null || _a === void 0 ? void 0 : _a.call(opt);
784
+ const r = opt.uploadEnd?.();
809
785
  if (r && (r instanceof Promise)) {
810
786
  r.catch(function (e) {
811
787
  console.log(e);
@@ -813,8 +789,7 @@ function request(url, opt) {
813
789
  }
814
790
  };
815
791
  xhr.onloadstart = function (e) {
816
- var _a;
817
- const r = (_a = opt.start) === null || _a === void 0 ? void 0 : _a.call(opt, e.total);
792
+ const r = opt.start?.(e.total);
818
793
  if (r && (r instanceof Promise)) {
819
794
  r.catch(function (e1) {
820
795
  console.log(e1);
@@ -822,8 +797,7 @@ function request(url, opt) {
822
797
  }
823
798
  };
824
799
  xhr.onprogress = function (e) {
825
- var _a;
826
- const r = (_a = opt.progress) === null || _a === void 0 ? void 0 : _a.call(opt, e.loaded, e.total);
800
+ const r = opt.progress?.(e.loaded, e.total);
827
801
  if (r && (r instanceof Promise)) {
828
802
  r.catch(function (e1) {
829
803
  console.log(e1);
@@ -831,8 +805,7 @@ function request(url, opt) {
831
805
  }
832
806
  };
833
807
  xhr.onloadend = function () {
834
- var _a;
835
- const r = (_a = opt.end) === null || _a === void 0 ? void 0 : _a.call(opt);
808
+ const r = opt.end?.();
836
809
  if (r && (r instanceof Promise)) {
837
810
  r.catch(function (e) {
838
811
  console.log(e);
@@ -840,17 +813,16 @@ function request(url, opt) {
840
813
  }
841
814
  };
842
815
  xhr.onload = function () {
843
- var _a, _b;
844
816
  let res = this.response;
845
- if ((_a = this.getResponseHeader('content-type')) === null || _a === void 0 ? void 0 : _a.includes('json')) {
817
+ if (this.getResponseHeader('content-type')?.includes('json')) {
846
818
  try {
847
819
  res = JSON.parse(res);
848
820
  }
849
- catch (_c) {
821
+ catch {
850
822
  res = this.response;
851
823
  }
852
824
  }
853
- const r = (_b = opt.load) === null || _b === void 0 ? void 0 : _b.call(opt, res);
825
+ const r = opt.load?.(res);
854
826
  if (r && (r instanceof Promise)) {
855
827
  r.catch(function (e) {
856
828
  console.log(e);
@@ -859,8 +831,7 @@ function request(url, opt) {
859
831
  resove(res);
860
832
  };
861
833
  xhr.onerror = function () {
862
- var _a;
863
- const r = (_a = opt.error) === null || _a === void 0 ? void 0 : _a.call(opt);
834
+ const r = opt.error?.();
864
835
  if (r && (r instanceof Promise)) {
865
836
  r.catch(function (e) {
866
837
  console.log(e);
@@ -879,7 +850,7 @@ function request(url, opt) {
879
850
  xhr.setRequestHeader(k, opt.headers[k]);
880
851
  }
881
852
  }
882
- xhr.open((_a = opt.method) !== null && _a !== void 0 ? _a : 'GET', url, true);
853
+ xhr.open(opt.method ?? 'GET', url, true);
883
854
  xhr.send(opt.body);
884
855
  });
885
856
  }
@@ -892,15 +863,11 @@ function get(url, opt) {
892
863
  function post(url, data, opt) {
893
864
  return loader.post(url, data, opt);
894
865
  }
895
- function getResponseJson(url, opt) {
896
- return __awaiter(this, void 0, void 0, function* () {
897
- return loader.getResponseJson(url, opt);
898
- });
866
+ async function getResponseJson(url, opt) {
867
+ return loader.getResponseJson(url, opt);
899
868
  }
900
- function postResponseJson(url, data, opt) {
901
- return __awaiter(this, void 0, void 0, function* () {
902
- return loader.postResponseJson(url, data, opt);
903
- });
869
+ async function postResponseJson(url, data, opt) {
870
+ return loader.postResponseJson(url, data, opt);
904
871
  }
905
872
  function parseUrl(url) {
906
873
  return loader.parseUrl(url);
@@ -966,8 +933,8 @@ function formatTime(ts, tz) {
966
933
  if (typeof ts === 'number') {
967
934
  ts = new Date(ts);
968
935
  }
969
- const ntz = tz !== null && tz !== void 0 ? tz : -(ts.getTimezoneOffset() / 60);
970
- ts.setTime(ts.getTime() + ntz * 60 * 60000);
936
+ const ntz = tz ?? -(ts.getTimezoneOffset() / 60);
937
+ ts.setTime(ts.getTime() + ntz * 60 * 60_000);
971
938
  rtn.date = ts.getUTCFullYear().toString() + '-' + (ts.getUTCMonth() + 1).toString().padStart(2, '0') + '-' + ts.getUTCDate().toString().padStart(2, '0');
972
939
  rtn.time = ts.getUTCHours().toString().padStart(2, '0') + ':' + ts.getUTCMinutes().toString().padStart(2, '0') + ':' + ts.getUTCSeconds().toString().padStart(2, '0');
973
940
  rtn.zone = 'UTC' + (ntz >= 0 ? '+' : '') + ntz.toString();