native-fn 1.0.42 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native.cjs +372 -11
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +372 -11
- package/dist/native.umd.js +372 -11
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +317 -151
- package/dist/plugin/app/index.d.ts +5 -1
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +317 -151
- package/dist/plugin/app/index.umd.js +317 -151
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/constants/platform.d.ts +3 -13
- package/dist/plugin/app/src/plugin/app/types/app.d.ts +4 -0
- package/dist/plugin/app/src/types/platform.d.ts +17 -0
- package/dist/plugin/app/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/camera/index.cjs +253 -86
- package/dist/plugin/camera/index.min.cjs +1 -1
- package/dist/plugin/camera/index.min.mjs +1 -1
- package/dist/plugin/camera/index.mjs +253 -86
- package/dist/plugin/camera/index.umd.js +253 -86
- package/dist/plugin/camera/index.umd.min.js +1 -1
- package/dist/plugin/camera/src/constants/platform.d.ts +3 -13
- package/dist/plugin/camera/src/plugin/app/types/app.d.ts +4 -0
- package/dist/plugin/camera/src/types/platform.d.ts +17 -0
- package/dist/plugin/camera/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/clipboard/index.cjs +6 -0
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +6 -0
- package/dist/plugin/clipboard/index.umd.js +6 -0
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/constants/platform.d.ts +3 -13
- package/dist/plugin/clipboard/src/plugin/app/types/app.d.ts +4 -0
- package/dist/plugin/clipboard/src/types/platform.d.ts +17 -0
- package/dist/plugin/clipboard/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/fullscreen/index.cjs +246 -82
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +246 -82
- package/dist/plugin/fullscreen/index.umd.js +246 -82
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/constants/platform.d.ts +3 -13
- package/dist/plugin/fullscreen/src/plugin/app/types/app.d.ts +4 -0
- package/dist/plugin/fullscreen/src/types/platform.d.ts +17 -0
- package/dist/plugin/fullscreen/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/theme/index.cjs +257 -91
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +257 -91
- package/dist/plugin/theme/index.umd.js +257 -91
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/constants/platform.d.ts +3 -13
- package/dist/plugin/theme/src/plugin/app/types/app.d.ts +4 -0
- package/dist/plugin/theme/src/types/platform.d.ts +17 -0
- package/dist/plugin/theme/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/src/constants/platform.d.ts +3 -13
- package/dist/src/plugin/app/types/app.d.ts +4 -0
- package/dist/src/types/platform.d.ts +17 -0
- package/dist/src/utils/create-hidden-element.d.ts +1 -1
- package/package.json +1 -8
|
@@ -4,7 +4,28 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Theme = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function dynamicImport(moduleName) {
|
|
8
|
+
if ('require' in globalThis && typeof globalThis.require === 'function') {
|
|
9
|
+
try {
|
|
10
|
+
return Promise.resolve(globalThis.require(moduleName));
|
|
11
|
+
}
|
|
12
|
+
catch (_) {
|
|
13
|
+
return Promise.resolve(null);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return import(moduleName)
|
|
18
|
+
.then(function (module) {
|
|
19
|
+
return (module.default || module);
|
|
20
|
+
})
|
|
21
|
+
.catch(function () {
|
|
22
|
+
return Promise.resolve(null);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
catch (_) {
|
|
26
|
+
return Promise.resolve(null);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
8
29
|
|
|
9
30
|
var OS;
|
|
10
31
|
(function (OS) {
|
|
@@ -45,42 +66,22 @@
|
|
|
45
66
|
Browsers["IE"] = "IE";
|
|
46
67
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
47
68
|
})(Browsers || (Browsers = {}));
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'ARM': 'RT'
|
|
65
|
-
}[string];
|
|
66
|
-
if (mapped !== undefined)
|
|
67
|
-
return mapped;
|
|
68
|
-
return string;
|
|
69
|
-
}
|
|
70
|
-
function resolveUnderscoreVersion(string) {
|
|
71
|
-
if (string === undefined)
|
|
72
|
-
return '';
|
|
73
|
-
return string.replace(/_/g, '.');
|
|
74
|
-
}
|
|
75
|
-
function resolveVersion(string, resolver) {
|
|
76
|
-
if (typeof resolver === 'function')
|
|
77
|
-
return resolver(string);
|
|
78
|
-
if (typeof resolver === 'string')
|
|
79
|
-
return resolver;
|
|
80
|
-
if (string === undefined)
|
|
81
|
-
return '';
|
|
82
|
-
return string;
|
|
83
|
-
}
|
|
69
|
+
var Platform = {
|
|
70
|
+
device: Devices.Unknown,
|
|
71
|
+
os: OS.Unknown,
|
|
72
|
+
osVersion: '',
|
|
73
|
+
engine: Engines.Unknown,
|
|
74
|
+
engineVersion: '',
|
|
75
|
+
browser: Browsers.Unknown,
|
|
76
|
+
browserVersion: '',
|
|
77
|
+
renderer: getRenderer(),
|
|
78
|
+
userAgent: navigator.userAgent,
|
|
79
|
+
isWebview: false,
|
|
80
|
+
isMobile: false,
|
|
81
|
+
isDesktop: false,
|
|
82
|
+
isStandalone: false,
|
|
83
|
+
isNodeJS: getIsNode(),
|
|
84
|
+
};
|
|
84
85
|
var OS_RESOLVER_MAP = [
|
|
85
86
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
86
87
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -139,35 +140,115 @@
|
|
|
139
140
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
140
141
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
141
142
|
];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
function resolveWindowsVersion(string) {
|
|
144
|
+
if (string === undefined)
|
|
145
|
+
return '';
|
|
146
|
+
var mapped = {
|
|
147
|
+
'4.90': 'ME',
|
|
148
|
+
'NT3.51': 'NT 3.11',
|
|
149
|
+
'NT4.0': 'NT 4.0',
|
|
150
|
+
'NT 5.0': '2000',
|
|
151
|
+
'NT 5.1': 'XP',
|
|
152
|
+
'NT 5.2': 'XP',
|
|
153
|
+
'NT 6.0': 'Vista',
|
|
154
|
+
'NT 6.1': '7',
|
|
155
|
+
'NT 6.2': '8',
|
|
156
|
+
'NT 6.3': '8.1',
|
|
157
|
+
'NT 6.4': '10',
|
|
158
|
+
'NT 10.0': '10',
|
|
159
|
+
'ARM': 'RT'
|
|
160
|
+
}[string];
|
|
161
|
+
if (mapped !== undefined)
|
|
162
|
+
return mapped;
|
|
163
|
+
return string;
|
|
164
|
+
}
|
|
165
|
+
function resolveUnderscoreVersion(string) {
|
|
166
|
+
if (string === undefined)
|
|
167
|
+
return '';
|
|
168
|
+
return string.replace(/_/g, '.');
|
|
169
|
+
}
|
|
170
|
+
function resolveVersion(string, resolver) {
|
|
171
|
+
if (typeof resolver === 'function')
|
|
172
|
+
return resolver(string);
|
|
173
|
+
if (typeof resolver === 'string')
|
|
174
|
+
return resolver;
|
|
175
|
+
if (string === undefined)
|
|
176
|
+
return '';
|
|
177
|
+
return string;
|
|
178
|
+
}
|
|
179
|
+
function normalizeBrand(entry) {
|
|
180
|
+
if (entry === null || entry === undefined)
|
|
181
|
+
return { brand: '', version: '' };
|
|
182
|
+
if (typeof entry === 'string')
|
|
183
|
+
return { brand: entry, version: '' };
|
|
184
|
+
return { brand: entry.brand, version: entry.version };
|
|
185
|
+
}
|
|
186
|
+
function getRenderer() {
|
|
187
|
+
if (typeof globalThis.document === 'undefined')
|
|
188
|
+
return '';
|
|
189
|
+
var canvas = globalThis.document.createElement('canvas');
|
|
190
|
+
if (typeof canvas.getContext !== 'function')
|
|
191
|
+
return '';
|
|
192
|
+
var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
|
|
193
|
+
if (context === null)
|
|
194
|
+
return '';
|
|
195
|
+
if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
|
|
196
|
+
var extension = context.getExtension('WEBGL_debug_renderer_info');
|
|
197
|
+
if (extension === null)
|
|
198
|
+
return context.getParameter(context.RENDERER);
|
|
199
|
+
else
|
|
200
|
+
return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return '';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function getIsStandalone(os) {
|
|
207
|
+
if (!('matchMedia' in globalThis))
|
|
208
|
+
return false;
|
|
209
|
+
if (os === OS.iOS)
|
|
210
|
+
return 'standalone' in navigator && !!navigator.standalone;
|
|
211
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
212
|
+
}
|
|
213
|
+
function getIsWebview() {
|
|
214
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
215
|
+
}
|
|
216
|
+
function getIsNode() {
|
|
217
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
218
|
+
}
|
|
219
|
+
function getNodeOSVersion(string) {
|
|
220
|
+
var parts = string.split('.');
|
|
221
|
+
return {
|
|
222
|
+
major: parseInt(parts[0] || '0'),
|
|
223
|
+
minor: parseInt(parts[1] || '0'),
|
|
224
|
+
build: parseInt(parts[2] || '0')
|
|
225
|
+
};
|
|
226
|
+
}
|
|
147
227
|
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
148
228
|
var map = OS_RESOLVER_MAP[i];
|
|
149
229
|
var regexp = map[0];
|
|
150
230
|
var os = map[1];
|
|
151
231
|
var resolver = map[2];
|
|
152
|
-
var matched =
|
|
232
|
+
var matched = Platform.userAgent.match(regexp);
|
|
153
233
|
if (matched !== null) {
|
|
154
|
-
|
|
155
|
-
resolveVersion(matched[1], resolver);
|
|
234
|
+
Platform.os = os;
|
|
235
|
+
Platform.osVersion = resolveVersion(matched[1], resolver);
|
|
156
236
|
if (os === OS.iOS || os === OS.Android)
|
|
157
|
-
|
|
237
|
+
Platform.device = Devices.Mobile;
|
|
158
238
|
else if (os === OS.Windows || os === OS.MacOS)
|
|
159
|
-
|
|
239
|
+
Platform.device = Devices.Desktop;
|
|
160
240
|
break;
|
|
161
241
|
}
|
|
162
242
|
}
|
|
163
243
|
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
164
244
|
var map = ENGINE_RESOLVER_MAP[i];
|
|
165
245
|
var regexp = map[0];
|
|
166
|
-
map[1];
|
|
246
|
+
var engine = map[1];
|
|
167
247
|
var resolver = map[2];
|
|
168
|
-
var matched =
|
|
248
|
+
var matched = Platform.userAgent.match(regexp);
|
|
169
249
|
if (matched !== null) {
|
|
170
|
-
|
|
250
|
+
Platform.engine = engine;
|
|
251
|
+
Platform.engineVersion = resolveVersion(matched[1], resolver);
|
|
171
252
|
break;
|
|
172
253
|
}
|
|
173
254
|
}
|
|
@@ -176,42 +257,123 @@
|
|
|
176
257
|
var regexp = map[0];
|
|
177
258
|
var browser = map[1];
|
|
178
259
|
var resolver = map[2];
|
|
179
|
-
var matched =
|
|
260
|
+
var matched = Platform.userAgent.match(regexp);
|
|
180
261
|
if (matched !== null) {
|
|
181
|
-
|
|
182
|
-
|
|
262
|
+
Platform.browser = browser;
|
|
263
|
+
Platform.browserVersion = resolveVersion(matched[1], resolver);
|
|
183
264
|
break;
|
|
184
265
|
}
|
|
185
266
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
267
|
+
if (Platform.isNodeJS) {
|
|
268
|
+
dynamicImport('os')
|
|
269
|
+
.then(function (os) {
|
|
270
|
+
if (os === null)
|
|
271
|
+
return;
|
|
272
|
+
var platform = os.platform();
|
|
273
|
+
var release = os.release();
|
|
274
|
+
var version = getNodeOSVersion(release);
|
|
275
|
+
switch (platform) {
|
|
276
|
+
case 'win32':
|
|
277
|
+
Platform.os = OS.Windows;
|
|
278
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
279
|
+
Platform.osVersion = '11';
|
|
280
|
+
else if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
281
|
+
Platform.osVersion = '10';
|
|
282
|
+
else if (version.major === 6 && version.minor === 3)
|
|
283
|
+
Platform.osVersion = '8.1';
|
|
284
|
+
else if (version.major === 6 && version.minor === 2)
|
|
285
|
+
Platform.osVersion = '8';
|
|
286
|
+
else if (version.major === 6 && version.minor === 1)
|
|
287
|
+
Platform.osVersion = '7';
|
|
288
|
+
else if (version.major === 6 && version.minor === 0)
|
|
289
|
+
Platform.osVersion = 'Vista';
|
|
290
|
+
else if (version.major === 5 && version.minor === 1)
|
|
291
|
+
Platform.osVersion = 'XP';
|
|
292
|
+
else if (version.major === 5 && version.minor === 2)
|
|
293
|
+
Platform.osVersion = 'XP';
|
|
294
|
+
else if (version.major === 5 && version.minor === 0)
|
|
295
|
+
Platform.osVersion = '2000';
|
|
296
|
+
else if (version.major === 4 && version.minor === 90)
|
|
297
|
+
Platform.osVersion = 'ME';
|
|
298
|
+
else if (version.major === 4 && version.minor === 0)
|
|
299
|
+
Platform.osVersion = 'NT 4.0';
|
|
300
|
+
else if (version.major === 3 && version.minor === 51)
|
|
301
|
+
Platform.osVersion = 'NT 3.11';
|
|
302
|
+
else
|
|
303
|
+
Platform.osVersion = release;
|
|
304
|
+
break;
|
|
305
|
+
case 'darwin':
|
|
306
|
+
Platform.os = OS.MacOS;
|
|
307
|
+
if (version.major >= 24)
|
|
308
|
+
Platform.osVersion = '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
309
|
+
else if (version.major === 23)
|
|
310
|
+
Platform.osVersion = '14.' + version.minor + '.' + version.build;
|
|
311
|
+
else if (version.major === 22)
|
|
312
|
+
Platform.osVersion = '13.' + version.minor + '.' + version.build;
|
|
313
|
+
else if (version.major === 21)
|
|
314
|
+
Platform.osVersion = '12.' + version.minor + '.' + version.build;
|
|
315
|
+
else if (version.major === 20)
|
|
316
|
+
Platform.osVersion = '11.' + version.minor + '.' + version.build;
|
|
317
|
+
else if (version.major === 19)
|
|
318
|
+
Platform.osVersion = '10.15.' + version.minor;
|
|
319
|
+
else if (version.major === 18)
|
|
320
|
+
Platform.osVersion = '10.14.' + version.minor;
|
|
321
|
+
else if (version.major === 17)
|
|
322
|
+
Platform.osVersion = '10.13.' + version.minor;
|
|
323
|
+
else if (version.major === 16)
|
|
324
|
+
Platform.osVersion = '10.12.' + version.minor;
|
|
325
|
+
else if (version.major === 15)
|
|
326
|
+
Platform.osVersion = '10.11.' + version.minor;
|
|
327
|
+
else if (version.major === 14)
|
|
328
|
+
Platform.osVersion = '10.10.' + version.minor;
|
|
329
|
+
else if (version.major === 13)
|
|
330
|
+
Platform.osVersion = '10.9.' + version.minor;
|
|
331
|
+
else if (version.major >= 5 && version.major <= 12)
|
|
332
|
+
Platform.osVersion = '10.' + (version.major - 4) + '.' + version.minor;
|
|
333
|
+
else
|
|
334
|
+
Platform.osVersion = release;
|
|
335
|
+
break;
|
|
336
|
+
case 'android':
|
|
337
|
+
Platform.os = OS.Android;
|
|
338
|
+
Platform.osVersion = release;
|
|
339
|
+
break;
|
|
340
|
+
case 'linux':
|
|
341
|
+
if (/android/i.test(release)) {
|
|
342
|
+
Platform.os = OS.Android;
|
|
343
|
+
Platform.osVersion = release;
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
350
|
+
navigator
|
|
351
|
+
.userAgentData
|
|
352
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
353
|
+
.then(function (result) {
|
|
354
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
355
|
+
var platformVersion = result.platformVersion;
|
|
356
|
+
for (var i = 0; i < brands.length; i++) {
|
|
357
|
+
var brand = normalizeBrand(brands[i]);
|
|
358
|
+
var brandName = brand.brand;
|
|
359
|
+
var brandVersion = brand.version;
|
|
360
|
+
if (/not.a.brand/i.test(brandName))
|
|
361
|
+
continue;
|
|
362
|
+
if (brandName === "Chromium")
|
|
363
|
+
Platform.engineVersion = brandVersion;
|
|
364
|
+
}
|
|
365
|
+
if (typeof platformVersion === 'string') {
|
|
366
|
+
if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
|
|
367
|
+
Platform.osVersion = '11';
|
|
368
|
+
else
|
|
369
|
+
Platform.osVersion = platformVersion;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
Platform.isMobile = Platform.device === Devices.Mobile;
|
|
374
|
+
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
375
|
+
Platform.isWebview = getIsWebview();
|
|
376
|
+
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
215
377
|
|
|
216
378
|
function compareVersion(lhs, rhs) {
|
|
217
379
|
var pa = lhs.split('.');
|
|
@@ -244,11 +406,11 @@
|
|
|
244
406
|
})(Appearances || (Appearances = {}));
|
|
245
407
|
var MEDIA_QUERY_LIST = globalThis.matchMedia('(prefers-color-scheme: dark)');
|
|
246
408
|
var SUPPORT_PREFERS_COLOR_SCHEME = MEDIA_QUERY_LIST.media !== 'not all';
|
|
247
|
-
var IS_FULL_SUPPORT_THEME_COLOR =
|
|
409
|
+
var IS_FULL_SUPPORT_THEME_COLOR = Platform.browser !== Browsers.Chrome || (Platform.isMobile && compareVersion(Platform.browserVersion, '92') >= 0);
|
|
248
410
|
var CONTEXT = globalThis.document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
249
411
|
var SVG_PIXEL_DATA_URL = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+';
|
|
250
|
-
var IS_IE_MOBILE = /iemobile/i.test(
|
|
251
|
-
var IS_WINDOWS_PHONE = /windows phone/i.test(
|
|
412
|
+
var IS_IE_MOBILE = /iemobile/i.test(Platform.userAgent);
|
|
413
|
+
var IS_WINDOWS_PHONE = /windows phone/i.test(Platform.userAgent);
|
|
252
414
|
var ENTRIES = [];
|
|
253
415
|
|
|
254
416
|
/******************************************************************************
|
|
@@ -598,6 +760,8 @@
|
|
|
598
760
|
|
|
599
761
|
function createHiddenElement(tagName, focusable) {
|
|
600
762
|
if (focusable === void 0) { focusable = true; }
|
|
763
|
+
if (typeof globalThis.document === 'undefined')
|
|
764
|
+
return undefined;
|
|
601
765
|
var element = globalThis.document.createElement(tagName);
|
|
602
766
|
if ('width' in element)
|
|
603
767
|
element.width = '0';
|
|
@@ -668,6 +832,8 @@
|
|
|
668
832
|
}
|
|
669
833
|
}
|
|
670
834
|
var div = createHiddenElement('div');
|
|
835
|
+
if (div === undefined)
|
|
836
|
+
throw new UnsupportedColorError('Failed to parse color values from: \"' + color + '\".');
|
|
671
837
|
div.style.color = color;
|
|
672
838
|
globalThis.document.body.appendChild(div);
|
|
673
839
|
try {
|
|
@@ -737,8 +903,8 @@
|
|
|
737
903
|
return themeColorMetaGroup[appearance] = meta;
|
|
738
904
|
}
|
|
739
905
|
function estimateDefaultThemeColor() {
|
|
740
|
-
if (
|
|
741
|
-
if (
|
|
906
|
+
if (Platform.browser === Browsers.Safari) {
|
|
907
|
+
if (Platform.isStandalone) {
|
|
742
908
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
743
909
|
return '#ffffffff';
|
|
744
910
|
else
|
|
@@ -746,7 +912,7 @@
|
|
|
746
912
|
}
|
|
747
913
|
return rgbaToHex(parseColor(globalThis.getComputedStyle(globalThis.document.body).backgroundColor));
|
|
748
914
|
}
|
|
749
|
-
if (
|
|
915
|
+
if (Platform.browser === Browsers.Chrome) {
|
|
750
916
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
751
917
|
return '#28292cff';
|
|
752
918
|
else
|
|
@@ -856,7 +1022,7 @@
|
|
|
856
1022
|
if (index !== -1)
|
|
857
1023
|
ENTRIES.splice(index, 1);
|
|
858
1024
|
if (ENTRIES.length === 0) {
|
|
859
|
-
if (
|
|
1025
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
860
1026
|
stopPolling();
|
|
861
1027
|
else
|
|
862
1028
|
removeListener(entry.capture);
|
|
@@ -1016,7 +1182,7 @@
|
|
|
1016
1182
|
themeColorMetaGroup[appearance] = undefined;
|
|
1017
1183
|
}
|
|
1018
1184
|
function detectAppearance() {
|
|
1019
|
-
if (
|
|
1185
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1020
1186
|
return detectFromEngine();
|
|
1021
1187
|
else
|
|
1022
1188
|
return Promise.resolve(detectFromMediaQuery());
|
|
@@ -1036,7 +1202,7 @@
|
|
|
1036
1202
|
if (index === -1) {
|
|
1037
1203
|
ENTRIES.push(entry);
|
|
1038
1204
|
if (ENTRIES.length === 1) {
|
|
1039
|
-
if (
|
|
1205
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1040
1206
|
startPolling();
|
|
1041
1207
|
else
|
|
1042
1208
|
addListener(entry.capture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Theme=t()}(this,(function(){"use strict";var e,t,n,r,o=navigator.userAgent;function i(e){if(void 0===e)return"";var t={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==t?t:e}function a(e){return void 0===e?"":e.replace(/_/g,".")}function l(e,t){return"function"==typeof t?t(e):"string"==typeof t?t:void 0===e?"":e}!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(e||(e={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(t||(t={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(r||(r={}));var s=[[/windows nt (6\.[23]); arm/i,e.Windows,i],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,e.Windows,i],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,e.Windows,i],[/windows nt ?([\d.)]*)(?!.+xbox)/i,e.Windows,i],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,e.Windows,i],[/windows ce\/?([\d.]*)/i,e.Windows,i],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,e.iOS,a],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,e.iOS,a],[/cfnetwork\/.+darwin/i,e.iOS,a],[/mac os x ?([\w. ]*)/i,e.MacOS,a],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,e.MacOS,a],[/droid ([\w.]+)\b.+(android[- ]x86)/i,e.Android],[/android\w*[-\/.; ]?([\d.]*)/i,e.Android]],u=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],c=[[/\b(?:crmo|crios)\/([\w.]+)/i,r.Chrome],[/webview.+edge\/([\w.]+)/i,r.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,r.Edge],[/opera mini\/([-\w.]+)/i,r.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,r.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,r.Opera],[/opios[\/ ]+([\w.]+)/i,r.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,r.Opera],[/\bopr\/([\w.]+)/i,r.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,r.IE],[/(?:ms|\()ie ([\w.]+)/i,r.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,r.IE],[/\bfocus\/([\w.]+)/i,r.Firefox],[/\bopt\/([\w.]+)/i,r.Opera],[/coast\/([\w.]+)/i,r.Opera],[/fxios\/([\w.-]+)/i,r.Firefox],[/samsungbrowser\/([\w.]+)/i,r.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,r.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,r.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,r.Chrome],[/chrome\/([\w.]+) mobile/i,r.Chrome],[/chrome\/v?([\w.]+)/i,r.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,r.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,r.Safari],[/version\/([\w.,]+) .*safari/i,r.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,r.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,r.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,r.Firefox],[/firefox\/([\w.]+)/i,r.Firefox]],d=t.Unknown,f=e.Unknown;n.Unknown;for(var p=r.Unknown,m="",h=0;h<s.length;h++){var v=(w=s[h])[0],b=w[1],g=w[2];if(null!==(y=o.match(v))){f=b,l(y[1],g),b===e.iOS||b===e.Android?d=t.Mobile:b!==e.Windows&&b!==e.MacOS||(d=t.Desktop);break}}for(h=0;h<u.length;h++){v=(w=u[h])[0];w[1];g=w[2];if(null!==(y=o.match(v))){l(y[1],g);break}}for(h=0;h<c.length;h++){v=(w=c[h])[0];var w,y,S=w[1];g=w[2];if(null!==(y=o.match(v))){p=S,m=l(y[1],g);break}}!function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var t=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===t)return"";if(t instanceof WebGLRenderingContext||"getParameter"in t&&"function"==typeof t.getParameter){var n=t.getExtension("WEBGL_debug_renderer_info");return null===n?t.getParameter(t.RENDERER):t.getParameter(n.UNMASKED_RENDERER_WEBGL)}}();var T=d===t.Mobile;t.Desktop;var k,x="matchMedia"in globalThis&&(f===e.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches);!function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(k||(k={}));var E=globalThis.matchMedia("(prefers-color-scheme: dark)"),M="not all"!==E.media,C=p!==r.Chrome||T&&function(e,t){for(var n=e.split("."),r=t.split("."),o=Math.max(n.length,r.length),i=0;i<o;i++){var a=void 0,l=void 0;if((a=i<n.length?parseInt(n[i],10):0)>(l=i<r.length?parseInt(r[i],10):0))return 1;if(a<l)return-1}return 0}(m,"92")>=0,I=globalThis.document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),L=/iemobile/i.test(o),F=/windows phone/i.test(o),N=[];function A(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function O(e,t){function n(r){if(!(this instanceof n))return new n(r);var o=new t(r||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(o,n.prototype):o.__proto__=n.prototype,o.name=e,void 0!==r&&(o.message=r),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(o,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(o,n);else if(t.captureStackTrace&&"function"==typeof t.captureStackTrace)t.captureStackTrace(o,n);else try{var i=new t;i.stack&&(o.stack=i.stack)}catch(e){}return o}void 0===t&&(t=Error),n.prototype=Object.create(t.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(n.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(t){try{n.prototype.name=e}catch(e){}}try{Object.defineProperty(n,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return n}"function"==typeof SuppressedError&&SuppressedError;var j=O("EasingError"),P=O("CubicBezierSyntaxError",j),U=O("LinearSyntaxError",j),W=O("StepSyntaxError",j),D=O("UnsupportedEasingFunctionError",j),z={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function R(e,t,n){return e<t?t:e>n?n:e}function H(e){var t=function(e){var t=e.match(/cubic-bezier\((.*)\)/);if(null===t)throw new P("Invalid cubic-bezier syntax");var n=t[1].trim().split(","),r=[];if(4!==n.length)throw new P("Cubic-bezier must have exactly 4 numeric values");for(var o=0;o<4;o++){var i=parseFloat(n[o]);if(isNaN(i))throw new P("Cubic-bezier must have exactly 4 numeric values");if(o%2==0&&(i<0||i>1))throw new P("x1 and x2 must be between 0 and 1");r.push(i)}return{x1:r[0],y1:r[1],x2:r[2],y2:r[3]}}(e),n=t.x1,r=t.x2,o=t.y1,i=t.y2;return function(e){if(0===(e=R(e,0,1))||1===e)return e;var t=function(e,t,o){if(void 0===t&&(t=1e-6),void 0===o&&(o=50),e<=0)return 0;if(e>=1)return 1;for(var i=e,a=0;a<o;a++){var l=3*(1-i)*(1-i)*i*n+3*(1-i)*i*i*r+i*i*i,s=3*(1-i)*(1-i)*n+6*(1-i)*i*(r-n)+3*i*i*(1-r);if(Math.abs(s)<t)break;var u=i-(l-e)/s;if(Math.abs(u-i)<t){i=u;break}i=Math.max(0,Math.min(1,u))}return i}(e);return 3*(1-t)*(1-t)*t*o+3*(1-t)*t*t*i+t*t*t}}function B(e){var t=function(e){var t,n,r=e.match(/linear\((.*)\)/);if(null===r)throw new U("Invalid linear syntax");var o=r[1].trim();if(""===o)throw new U("Linear function must have at least one point");for(var i=o.split(","),a=[],l=0;l<i.length;l++){var s=i[l].trim(),u=s.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===u){var c=s.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===c){var d=s.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new U('Invalid linear point format: "'+s+'"');a.push({position:1===i.length?0:l/(i.length-1),value:parseFloat(d[1])})}else a.push({position:parseFloat(c[2])/100,value:parseFloat(c[1])})}else{var f=parseFloat(u[1]),p=u[2].trim().split(/\s+/);try{for(var m=(t=void 0,A(p)),h=m.next();!h.done;h=m.next()){var v=h.value;a.push({value:f,position:parseFloat(v)/100})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}}}if(0===a.length)throw new U("No valid points found in linear function");return a.sort((function(e,t){return e.position-t.position})),a[0].position>0&&a.unshift({position:0,value:0}),a[a.length-1].position<1&&a.push({position:1,value:1}),a}(e);return function(e){if((e=R(e,0,1))<=t[0].position)return t[0].value;if(e>=t[t.length-1].position)return t[t.length-1].value;for(var n=0;n<t.length-1;n++){var r=t[n],o=t[n+1];if(e>=r.position&&e<=o.position){if(r.position===o.position)return o.value;var i=(e-r.position)/(o.position-r.position);return r.value+(o.value-r.value)*i}}return t[t.length-1].value}}function _(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=z[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return H(e);if(function(e){return/linear\(/.test(e)}(e))return B(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var t=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===t)throw new W("Invalid steps syntax");var n=parseInt(t[1],10),r=t[2];if(n<=0)throw new W("Steps count must be a positive integer");if("jump-none"===r&&n<2)throw new W("jump-none requires at least 2 steps");return function(e){switch(e=R(e,0,1),r){case"start":case"jump-start":return 0===e?1/n:1===e?1:Math.ceil(e*n)/n;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*n)/n;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(n+1))/(n+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(n-1))/(n-1);default:throw new W('Unsupported step position: "'+r+'"')}}}(e);throw new D('Unsupported easing function: "'+e+'"')}var q=O("UnsupportedColorError");function G(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new q('Unsupported color: "'+e+'".');if(null!==I)try{I.clearRect(0,0,1,1),I.fillStyle=e,I.fillRect(0,0,1,1);var t=I.getImageData(0,0,1,1).data;return{red:t[0],green:t[1],blue:t[2],alpha:parseFloat((t[3]/255).toFixed(2))}}catch(e){}var n=function(e,t){void 0===t&&(t=!0);var n=globalThis.document.createElement(e);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),t?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}("div");n.style.color=e,globalThis.document.body.appendChild(n);try{var r=globalThis.getComputedStyle(n).color,o=r.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),i=r.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),a=o||i;if(null===a)throw new q('Unsupported color: "'+e+'".');var l=parseInt(a[1],10),s=parseInt(a[2],10),u=parseInt(a[3],10),c=1;if(void 0!==a[4]){var d=a[4];c="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(l)||isNaN(s)||isNaN(u)||isNaN(c))throw new q('Failed to parse color values from: "'+e+'".');return{red:l,green:s,blue:u,alpha:c}}finally{globalThis.document.body.removeChild(n)}}var K,Z={},$=null,X=null,V=null,Q=null,J={setThemeColor:function(e,t){void 0===t&&(t={duration:0,easingFunction:"linear",appearance:"default"});var n=t.duration,r=_(t.easingFunction),o=t.appearance;null!==$&&(globalThis.cancelAnimationFrame($),$=null,null!==X&&(X(se()),X=null));var i=se();void 0===i&&(i=void 0!==t.defaultColor?t.defaultColor:ne()===k.Dark?"#181818ff":"#dcdcdcff");var a=G(i),l=G(e);return new Promise((function(e){X=e;var t=null;$=globalThis.requestAnimationFrame((function i(s){null===t&&(t=s);var u,c=s-t;u=0===n?1:Math.min(c/n,1);var d=r(u),f={red:Math.round(a.red+(l.red-a.red)*d),green:Math.round(a.green+(l.green-a.green)*d),blue:Math.round(a.blue+(l.blue-a.blue)*d),alpha:+(a.alpha+(l.alpha-a.alpha)*d).toFixed(2)};(function(e){void 0===e&&(e="default");var t;t=!C||!M||L||F?"default":e;var n=Z[t];if(void 0!==n)return n;n=globalThis.document.createElement("meta"),L?n.setAttribute("name","msapplication-navbutton-color"):F?n.setAttribute("name","msapplication-TileColor"):n.setAttribute("name","theme-color");"default"!==e&&n.setAttribute("media","(prefers-color-scheme: "+t+")");return globalThis.document.head.prepend(n),Z[e]=n})(o).setAttribute("content",ee(f)),u<1?$=globalThis.requestAnimationFrame(i):($=null,null!==X&&(e(se()),$=null))}))}))},getThemeColor:se,removeThemeColor:function(e){void 0===e&&(e="default");var t=Z[e];void 0!==t&&t.remove();Z[e]=void 0},detectAppearance:function(){return p===r.SamsungInternet?te():Promise.resolve(ne())},onAppearanceChange:function(e,t){void 0===t&&(t=!1);var n={fn:e,capture:!1,once:!1};"boolean"==typeof t&&(t={capture:t});void 0!==t.capture&&(n.capture=t.capture);void 0!==t.once&&(n.once=t.once);void 0!==t.signal&&(n.signal=t.signal);var o=ae(n);-1===o?(N.push(n),1===N.length&&(p===r.SamsungInternet?(te().then((function(e){V=e})),Q=globalThis.setInterval((function(){te().then((function(e){e!==V&&(V=e,oe(e))}))}),2e3)):(i=n.capture,V=ne(),"function"==typeof E.addEventListener?E.addEventListener("change",re,i):"function"==typeof E.addListener&&E.addListener(re))),this.detectAppearance().then(oe)):N[o].once&&!n.once&&(N[o].once=!1);var i;void 0!==n.signal&&(n.signal.aborted?ie(n):n.signal.addEventListener("abort",(function e(){void 0!==n.signal&&n.signal.removeEventListener("abort",e),ie(n)})));return function(){ie(n)}}};function Y(e){var t=e.toString(16);switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}}function ee(e){return"#"+Y(e.red)+Y(e.green)+Y(e.blue)+Y(Math.round(255*e.alpha))}function te(){return new Promise((function(e){var t=new Image;t.onload=function(){if(null===I)return e(k.Light);I.drawImage(t,0,0);var n=I.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?e(k.Dark):e(k.Light)},t.onerror=function(){e(k.Unknown)},t.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function ne(){return M?E.matches?k.Dark:k.Light:k.Unknown}function re(e){var t;(t=e.matches?k.Dark:k.Light)!==V&&oe(V=t)}function oe(e){for(var t=0;t<N.length;t++){var n=N[t];n.fn(e),n.once&&ie(n)}}function ie(e){var t,n=ae(e);-1!==n&&N.splice(n,1),0===N.length&&(p===r.SamsungInternet?(V=null,null!==Q&&(clearInterval(Q),Q=null)):(t=e.capture,V=null,"function"==typeof E.removeEventListener?E.removeEventListener("change",re,t):"function"==typeof E.removeListener&&E.removeListener(re)))}function ae(e){for(var t=0;t<N.length;t++)if(N[t].fn===e.fn&&N[t].capture===e.capture)return t;return-1}function le(){var e;Z={},e=L?'meta[name="msapplication-navbutton-color"]':F?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var t=globalThis.document.querySelectorAll(e);if(C&&M&&!L&&!F)for(var n=0;n<t.length;n++){var r=t.item(n),o=r.getAttribute("media");if("(prefers-color-scheme: dark)"===o&&void 0===Z.dark?Z.dark=r:"(prefers-color-scheme: light)"===o&&void 0===Z.light?Z.light=r:null===o&&void 0===Z.default&&(Z.default=r),void 0!==Z.dark&&void 0!==Z.light&&void 0!==Z.default)return}else Z.default=t[0]}function se(){var e=function(){if(L)return globalThis.document.querySelector('meta[name="msapplication-navbutton-color"]');if(F)return globalThis.document.querySelector('meta[name="msapplication-TileColor"]');if(!C||!M)return globalThis.document.querySelector('meta[name="theme-color"]');var e,t=globalThis.document.querySelectorAll('meta[name="theme-color"]');e=ne()===k.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<t.length;n++){var r=t.item(n);if(r.hasAttribute("content")){var o=r.getAttribute("media");if(null===o||o===e)return r}}return null}();return null!==e?e.getAttribute("content"):p===r.Safari?x?ne()===k.Dark?"#ffffffff":"#000000ff":ee(G(globalThis.getComputedStyle(globalThis.document.body).backgroundColor)):p===r.Chrome?ne()===k.Dark?"#28292cff":"#ffffffff":void 0}return K=new MutationObserver((function(e){for(var t=0;t<e.length;t++){for(var n=e[t],r=n.addedNodes,o=n.removedNodes,i=0;i<r.length;i++)if(r[i]instanceof HTMLMetaElement)return le();for(i=0;i<o.length;i++)if(o[i]instanceof HTMLMetaElement)return le()}})),"function"==typeof E.addEventListener?E.addEventListener("change",le):"function"==typeof E.addListener&&E.addListener(le),K.observe(globalThis.document.head,{childList:!0}),le(),{installed:!1,name:"Theme",module:J,Constants:{Appearances:k},Errors:{EasingError:j,UnsupportedEasingFunctionError:D,StepSyntaxError:W,LinearSyntaxError:U,CubicBezierSyntaxError:P,UnsupportedColorError:q}}}));
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).Theme=r()}(this,(function(){"use strict";var e,r,n,t;!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(e||(e={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(r||(r={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(t||(t={}));var o,i={device:r.Unknown,os:e.Unknown,osVersion:"",engine:n.Unknown,engineVersion:"",browser:t.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var r=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===r)return"";if(r instanceof WebGLRenderingContext||"getParameter"in r&&"function"==typeof r.getParameter){var n=r.getExtension("WEBGL_debug_renderer_info");return null===n?r.getParameter(r.RENDERER):r.getParameter(n.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:navigator.userAgent,isWebview:!1,isMobile:!1,isDesktop:!1,isStandalone:!1,isNodeJS:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node},a=[[/windows nt (6\.[23]); arm/i,e.Windows,u],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,e.Windows,u],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,e.Windows,u],[/windows nt ?([\d.)]*)(?!.+xbox)/i,e.Windows,u],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,e.Windows,u],[/windows ce\/?([\d.]*)/i,e.Windows,u],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,e.iOS,c],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,e.iOS,c],[/cfnetwork\/.+darwin/i,e.iOS,c],[/mac os x ?([\w. ]*)/i,e.MacOS,c],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,e.MacOS,c],[/droid ([\w.]+)\b.+(android[- ]x86)/i,e.Android],[/android\w*[-\/.; ]?([\d.]*)/i,e.Android]],s=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],l=[[/\b(?:crmo|crios)\/([\w.]+)/i,t.Chrome],[/webview.+edge\/([\w.]+)/i,t.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,t.Edge],[/opera mini\/([-\w.]+)/i,t.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,t.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,t.Opera],[/opios[\/ ]+([\w.]+)/i,t.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,t.Opera],[/\bopr\/([\w.]+)/i,t.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,t.IE],[/(?:ms|\()ie ([\w.]+)/i,t.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,t.IE],[/\bfocus\/([\w.]+)/i,t.Firefox],[/\bopt\/([\w.]+)/i,t.Opera],[/coast\/([\w.]+)/i,t.Opera],[/fxios\/([\w.-]+)/i,t.Firefox],[/samsungbrowser\/([\w.]+)/i,t.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,t.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,t.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,t.Chrome],[/chrome\/([\w.]+) mobile/i,t.Chrome],[/chrome\/v?([\w.]+)/i,t.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/version\/([\w.,]+) .*safari/i,t.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,t.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,t.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,t.Firefox],[/firefox\/([\w.]+)/i,t.Firefox]];function u(e){if(void 0===e)return"";var r={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==r?r:e}function c(e){return void 0===e?"":e.replace(/_/g,".")}function d(e,r){return"function"==typeof r?r(e):"string"==typeof r?r:void 0===e?"":e}for(var f=0;f<a.length;f++){var m=(b=a[f])[0],p=b[1],h=b[2];if(null!==(g=i.userAgent.match(m))){i.os=p,i.osVersion=d(g[1],h),p===e.iOS||p===e.Android?i.device=r.Mobile:p!==e.Windows&&p!==e.MacOS||(i.device=r.Desktop);break}}for(f=0;f<s.length;f++){m=(b=s[f])[0];var v=b[1];h=b[2];if(null!==(g=i.userAgent.match(m))){i.engine=v,i.engineVersion=d(g[1],h);break}}for(f=0;f<l.length;f++){m=(b=l[f])[0];var b,g,w=b[1];h=b[2];if(null!==(g=i.userAgent.match(m))){i.browser=w,i.browserVersion=d(g[1],h);break}}i.isNodeJS&&function(e){if("require"in globalThis&&"function"==typeof globalThis.require)try{return Promise.resolve(globalThis.require(e))}catch(e){return Promise.resolve(null)}try{return import(e).then((function(e){return e.default||e})).catch((function(){return Promise.resolve(null)}))}catch(e){return Promise.resolve(null)}}("os").then((function(r){if(null!==r){var n,t=r.platform(),o=r.release(),a=(n=o.split("."),{major:parseInt(n[0]||"0"),minor:parseInt(n[1]||"0"),build:parseInt(n[2]||"0")});switch(t){case"win32":i.os=e.Windows,i.osVersion=10===a.major&&0===a.minor&&a.build>=22e3?"11":10===a.major&&0===a.minor&&a.build<22e3?"10":6===a.major&&3===a.minor?"8.1":6===a.major&&2===a.minor?"8":6===a.major&&1===a.minor?"7":6===a.major&&0===a.minor?"Vista":5===a.major&&1===a.minor||5===a.major&&2===a.minor?"XP":5===a.major&&0===a.minor?"2000":4===a.major&&90===a.minor?"ME":4===a.major&&0===a.minor?"NT 4.0":3===a.major&&51===a.minor?"NT 3.11":o;break;case"darwin":i.os=e.MacOS,i.osVersion=a.major>=24?a.major-9+"."+a.minor+"."+a.build:23===a.major?"14."+a.minor+"."+a.build:22===a.major?"13."+a.minor+"."+a.build:21===a.major?"12."+a.minor+"."+a.build:20===a.major?"11."+a.minor+"."+a.build:19===a.major?"10.15."+a.minor:18===a.major?"10.14."+a.minor:17===a.major?"10.13."+a.minor:16===a.major?"10.12."+a.minor:15===a.major?"10.11."+a.minor:14===a.major?"10.10."+a.minor:13===a.major?"10.9."+a.minor:a.major>=5&&a.major<=12?"10."+(a.major-4)+"."+a.minor:o;break;case"android":i.os=e.Android,i.osVersion=o;break;case"linux":/android/i.test(o)&&(i.os=e.Android,i.osVersion=o)}}})),void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(r){for(var n,t=r.fullVersionList||r.brands||[],o=r.platformVersion,a=0;a<t.length;a++){var s=null==(n=t[a])?{brand:"",version:""}:"string"==typeof n?{brand:n,version:""}:{brand:n.brand,version:n.version},l=s.brand,u=s.version;/not.a.brand/i.test(l)||"Chromium"===l&&(i.engineVersion=u)}"string"==typeof o&&(i.os===e.Windows&&parseInt(o.replace(/[^\d.]/g,"").split(".")[0],10)>=13?i.osVersion="11":i.osVersion=o)})),i.isMobile=i.device===r.Mobile,i.isDesktop=i.device===r.Desktop,i.isWebview=/; ?wv|applewebkit(?!.*safari)/i.test(i.userAgent),i.isStandalone=function(r){return"matchMedia"in globalThis&&(r===e.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(i.os),function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(o||(o={}));var y=globalThis.matchMedia("(prefers-color-scheme: dark)"),T="not all"!==y.media,S=i.browser!==t.Chrome||i.isMobile&&function(e,r){for(var n=e.split("."),t=r.split("."),o=Math.max(n.length,t.length),i=0;i<o;i++){var a=void 0,s=void 0;if((a=i<n.length?parseInt(n[i],10):0)>(s=i<t.length?parseInt(t[i],10):0))return 1;if(a<s)return-1}return 0}(i.browserVersion,"92")>=0,k=globalThis.document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),x=/iemobile/i.test(i.userAgent),E=/windows phone/i.test(i.userAgent),j=[];function M(e){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&e[r],t=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function A(e,r){function n(t){if(!(this instanceof n))return new n(t);var o=new r(t||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(o,n.prototype):o.__proto__=n.prototype,o.name=e,void 0!==t&&(o.message=t),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(o,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(o,n);else if(r.captureStackTrace&&"function"==typeof r.captureStackTrace)r.captureStackTrace(o,n);else try{var i=new r;i.stack&&(o.stack=i.stack)}catch(e){}return o}void 0===r&&(r=Error),n.prototype=Object.create(r.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(n.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(r){try{n.prototype.name=e}catch(e){}}try{Object.defineProperty(n,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return n}"function"==typeof SuppressedError&&SuppressedError;var I=A("EasingError"),C=A("CubicBezierSyntaxError",I),N=A("LinearSyntaxError",I),F=A("StepSyntaxError",I),L=A("UnsupportedEasingFunctionError",I),O={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function P(e,r,n){return e<r?r:e>n?n:e}function W(e){var r=function(e){var r=e.match(/cubic-bezier\((.*)\)/);if(null===r)throw new C("Invalid cubic-bezier syntax");var n=r[1].trim().split(","),t=[];if(4!==n.length)throw new C("Cubic-bezier must have exactly 4 numeric values");for(var o=0;o<4;o++){var i=parseFloat(n[o]);if(isNaN(i))throw new C("Cubic-bezier must have exactly 4 numeric values");if(o%2==0&&(i<0||i>1))throw new C("x1 and x2 must be between 0 and 1");t.push(i)}return{x1:t[0],y1:t[1],x2:t[2],y2:t[3]}}(e),n=r.x1,t=r.x2,o=r.y1,i=r.y2;return function(e){if(0===(e=P(e,0,1))||1===e)return e;var r=function(e,r,o){if(void 0===r&&(r=1e-6),void 0===o&&(o=50),e<=0)return 0;if(e>=1)return 1;for(var i=e,a=0;a<o;a++){var s=3*(1-i)*(1-i)*i*n+3*(1-i)*i*i*t+i*i*i,l=3*(1-i)*(1-i)*n+6*(1-i)*i*(t-n)+3*i*i*(1-t);if(Math.abs(l)<r)break;var u=i-(s-e)/l;if(Math.abs(u-i)<r){i=u;break}i=Math.max(0,Math.min(1,u))}return i}(e);return 3*(1-r)*(1-r)*r*o+3*(1-r)*r*r*i+r*r*r}}function D(e){var r=function(e){var r,n,t=e.match(/linear\((.*)\)/);if(null===t)throw new N("Invalid linear syntax");var o=t[1].trim();if(""===o)throw new N("Linear function must have at least one point");for(var i=o.split(","),a=[],s=0;s<i.length;s++){var l=i[s].trim(),u=l.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===u){var c=l.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===c){var d=l.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new N('Invalid linear point format: "'+l+'"');a.push({position:1===i.length?0:s/(i.length-1),value:parseFloat(d[1])})}else a.push({position:parseFloat(c[2])/100,value:parseFloat(c[1])})}else{var f=parseFloat(u[1]),m=u[2].trim().split(/\s+/);try{for(var p=(r=void 0,M(m)),h=p.next();!h.done;h=p.next()){var v=h.value;a.push({value:f,position:parseFloat(v)/100})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}}if(0===a.length)throw new N("No valid points found in linear function");return a.sort((function(e,r){return e.position-r.position})),a[0].position>0&&a.unshift({position:0,value:0}),a[a.length-1].position<1&&a.push({position:1,value:1}),a}(e);return function(e){if((e=P(e,0,1))<=r[0].position)return r[0].value;if(e>=r[r.length-1].position)return r[r.length-1].value;for(var n=0;n<r.length-1;n++){var t=r[n],o=r[n+1];if(e>=t.position&&e<=o.position){if(t.position===o.position)return o.value;var i=(e-t.position)/(o.position-t.position);return t.value+(o.value-t.value)*i}}return r[r.length-1].value}}function U(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=O[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return W(e);if(function(e){return/linear\(/.test(e)}(e))return D(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var r=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===r)throw new F("Invalid steps syntax");var n=parseInt(r[1],10),t=r[2];if(n<=0)throw new F("Steps count must be a positive integer");if("jump-none"===t&&n<2)throw new F("jump-none requires at least 2 steps");return function(e){switch(e=P(e,0,1),t){case"start":case"jump-start":return 0===e?1/n:1===e?1:Math.ceil(e*n)/n;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*n)/n;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(n+1))/(n+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(n-1))/(n-1);default:throw new F('Unsupported step position: "'+t+'"')}}}(e);throw new L('Unsupported easing function: "'+e+'"')}var V=A("UnsupportedColorError");function z(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new V('Unsupported color: "'+e+'".');if(null!==k)try{k.clearRect(0,0,1,1),k.fillStyle=e,k.fillRect(0,0,1,1);var r=k.getImageData(0,0,1,1).data;return{red:r[0],green:r[1],blue:r[2],alpha:parseFloat((r[3]/255).toFixed(2))}}catch(e){}var n=function(e,r){if(void 0===r&&(r=!0),void 0!==globalThis.document){var n=globalThis.document.createElement(e);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),r?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}}("div");if(void 0===n)throw new V('Failed to parse color values from: "'+e+'".');n.style.color=e,globalThis.document.body.appendChild(n);try{var t=globalThis.getComputedStyle(n).color,o=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),i=t.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),a=o||i;if(null===a)throw new V('Unsupported color: "'+e+'".');var s=parseInt(a[1],10),l=parseInt(a[2],10),u=parseInt(a[3],10),c=1;if(void 0!==a[4]){var d=a[4];c="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(s)||isNaN(l)||isNaN(u)||isNaN(c))throw new V('Failed to parse color values from: "'+e+'".');return{red:s,green:l,blue:u,alpha:c}}finally{globalThis.document.body.removeChild(n)}}var R,H={},q=null,B=null,_=null,G=null,K={setThemeColor:function(e,r){void 0===r&&(r={duration:0,easingFunction:"linear",appearance:"default"});var n=r.duration,t=U(r.easingFunction),i=r.appearance;null!==q&&(globalThis.cancelAnimationFrame(q),q=null,null!==B&&(B(te()),B=null));var a=te();void 0===a&&(a=void 0!==r.defaultColor?r.defaultColor:J()===o.Dark?"#181818ff":"#dcdcdcff");var s=z(a),l=z(e);return new Promise((function(e){B=e;var r=null;q=globalThis.requestAnimationFrame((function o(a){null===r&&(r=a);var u,c=a-r;u=0===n?1:Math.min(c/n,1);var d=t(u),f={red:Math.round(s.red+(l.red-s.red)*d),green:Math.round(s.green+(l.green-s.green)*d),blue:Math.round(s.blue+(l.blue-s.blue)*d),alpha:+(s.alpha+(l.alpha-s.alpha)*d).toFixed(2)};(function(e){void 0===e&&(e="default");var r;r=!S||!T||x||E?"default":e;var n=H[r];if(void 0!==n)return n;n=globalThis.document.createElement("meta"),x?n.setAttribute("name","msapplication-navbutton-color"):E?n.setAttribute("name","msapplication-TileColor"):n.setAttribute("name","theme-color");"default"!==e&&n.setAttribute("media","(prefers-color-scheme: "+r+")");return globalThis.document.head.prepend(n),H[e]=n})(i).setAttribute("content",$(f)),u<1?q=globalThis.requestAnimationFrame(o):(q=null,null!==B&&(e(te()),q=null))}))}))},getThemeColor:te,removeThemeColor:function(e){void 0===e&&(e="default");var r=H[e];void 0!==r&&r.remove();H[e]=void 0},detectAppearance:function(){return i.browser===t.SamsungInternet?X():Promise.resolve(J())},onAppearanceChange:function(e,r){void 0===r&&(r=!1);var n={fn:e,capture:!1,once:!1};"boolean"==typeof r&&(r={capture:r});void 0!==r.capture&&(n.capture=r.capture);void 0!==r.once&&(n.once=r.once);void 0!==r.signal&&(n.signal=r.signal);var o=re(n);-1===o?(j.push(n),1===j.length&&(i.browser===t.SamsungInternet?(X().then((function(e){_=e})),G=globalThis.setInterval((function(){X().then((function(e){e!==_&&(_=e,Y(e))}))}),2e3)):(a=n.capture,_=J(),"function"==typeof y.addEventListener?y.addEventListener("change",Q,a):"function"==typeof y.addListener&&y.addListener(Q))),this.detectAppearance().then(Y)):j[o].once&&!n.once&&(j[o].once=!1);var a;void 0!==n.signal&&(n.signal.aborted?ee(n):n.signal.addEventListener("abort",(function e(){void 0!==n.signal&&n.signal.removeEventListener("abort",e),ee(n)})));return function(){ee(n)}}};function Z(e){var r=e.toString(16);switch(r.length){case 0:return"00";case 1:return"0"+r;default:return r}}function $(e){return"#"+Z(e.red)+Z(e.green)+Z(e.blue)+Z(Math.round(255*e.alpha))}function X(){return new Promise((function(e){var r=new Image;r.onload=function(){if(null===k)return e(o.Light);k.drawImage(r,0,0);var n=k.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?e(o.Dark):e(o.Light)},r.onerror=function(){e(o.Unknown)},r.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function J(){return T?y.matches?o.Dark:o.Light:o.Unknown}function Q(e){var r;(r=e.matches?o.Dark:o.Light)!==_&&Y(_=r)}function Y(e){for(var r=0;r<j.length;r++){var n=j[r];n.fn(e),n.once&&ee(n)}}function ee(e){var r,n=re(e);-1!==n&&j.splice(n,1),0===j.length&&(i.browser===t.SamsungInternet?(_=null,null!==G&&(clearInterval(G),G=null)):(r=e.capture,_=null,"function"==typeof y.removeEventListener?y.removeEventListener("change",Q,r):"function"==typeof y.removeListener&&y.removeListener(Q)))}function re(e){for(var r=0;r<j.length;r++)if(j[r].fn===e.fn&&j[r].capture===e.capture)return r;return-1}function ne(){var e;H={},e=x?'meta[name="msapplication-navbutton-color"]':E?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var r=globalThis.document.querySelectorAll(e);if(S&&T&&!x&&!E)for(var n=0;n<r.length;n++){var t=r.item(n),o=t.getAttribute("media");if("(prefers-color-scheme: dark)"===o&&void 0===H.dark?H.dark=t:"(prefers-color-scheme: light)"===o&&void 0===H.light?H.light=t:null===o&&void 0===H.default&&(H.default=t),void 0!==H.dark&&void 0!==H.light&&void 0!==H.default)return}else H.default=r[0]}function te(){var e=function(){if(x)return globalThis.document.querySelector('meta[name="msapplication-navbutton-color"]');if(E)return globalThis.document.querySelector('meta[name="msapplication-TileColor"]');if(!S||!T)return globalThis.document.querySelector('meta[name="theme-color"]');var e,r=globalThis.document.querySelectorAll('meta[name="theme-color"]');e=J()===o.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<r.length;n++){var t=r.item(n);if(t.hasAttribute("content")){var i=t.getAttribute("media");if(null===i||i===e)return t}}return null}();return null!==e?e.getAttribute("content"):i.browser===t.Safari?i.isStandalone?J()===o.Dark?"#ffffffff":"#000000ff":$(z(globalThis.getComputedStyle(globalThis.document.body).backgroundColor)):i.browser===t.Chrome?J()===o.Dark?"#28292cff":"#ffffffff":void 0}return R=new MutationObserver((function(e){for(var r=0;r<e.length;r++){for(var n=e[r],t=n.addedNodes,o=n.removedNodes,i=0;i<t.length;i++)if(t[i]instanceof HTMLMetaElement)return ne();for(i=0;i<o.length;i++)if(o[i]instanceof HTMLMetaElement)return ne()}})),"function"==typeof y.addEventListener?y.addEventListener("change",ne):"function"==typeof y.addListener&&y.addListener(ne),R.observe(globalThis.document.head,{childList:!0}),ne(),{installed:!1,name:"Theme",module:K,Constants:{Appearances:o},Errors:{EasingError:I,UnsupportedEasingFunctionError:L,StepSyntaxError:F,LinearSyntaxError:N,CubicBezierSyntaxError:C,UnsupportedColorError:V}}}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PlatformInstance } from "../types/platform";
|
|
1
2
|
declare global {
|
|
2
3
|
interface Navigator {
|
|
3
4
|
userAgentData?: UserAgentData;
|
|
@@ -51,16 +52,5 @@ export declare enum Browsers {
|
|
|
51
52
|
IE = "IE",
|
|
52
53
|
SamsungInternet = "SamsungInternet"
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
export declare let OS_VERSION: string;
|
|
57
|
-
export declare let ENGINE_NAME: Engines;
|
|
58
|
-
export declare let ENGINE_VERSION: string;
|
|
59
|
-
export declare let BROWSER_NAME: Browsers;
|
|
60
|
-
export declare let BROWSER_VERSION: string;
|
|
61
|
-
export declare const RENDERER: string;
|
|
62
|
-
export declare const IS_WEBVIEW: boolean;
|
|
63
|
-
export declare const IS_MOBILE: boolean;
|
|
64
|
-
export declare const IS_DESKTOP: boolean;
|
|
65
|
-
export declare const IS_STANDALONE: boolean;
|
|
66
|
-
export {};
|
|
55
|
+
declare const Platform: PlatformInstance;
|
|
56
|
+
export default Platform;
|
|
@@ -20,6 +20,10 @@ export declare interface MacOSAppInfo extends AppInfo {
|
|
|
20
20
|
bundleId?: string;
|
|
21
21
|
trackId?: string;
|
|
22
22
|
}
|
|
23
|
+
export declare interface StoreInfo {
|
|
24
|
+
appStore?: string;
|
|
25
|
+
webStore?: string;
|
|
26
|
+
}
|
|
23
27
|
export declare interface AppOpenOptions {
|
|
24
28
|
[OS.Android]?: AndroidAppInfo;
|
|
25
29
|
[OS.iOS]?: IOSAppInfo;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Browsers, Devices, Engines, OS } from "../constants/platform";
|
|
2
|
+
export declare interface PlatformInstance {
|
|
3
|
+
os: OS;
|
|
4
|
+
device: Devices;
|
|
5
|
+
engine: Engines;
|
|
6
|
+
browser: Browsers;
|
|
7
|
+
osVersion: string;
|
|
8
|
+
engineVersion: string;
|
|
9
|
+
browserVersion: string;
|
|
10
|
+
renderer: string;
|
|
11
|
+
userAgent: string;
|
|
12
|
+
isWebview: boolean;
|
|
13
|
+
isStandalone: boolean;
|
|
14
|
+
isMobile: boolean;
|
|
15
|
+
isDesktop: boolean;
|
|
16
|
+
isNodeJS: boolean;
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K];
|
|
1
|
+
export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K] | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PlatformInstance } from "../types/platform";
|
|
1
2
|
declare global {
|
|
2
3
|
interface Navigator {
|
|
3
4
|
userAgentData?: UserAgentData;
|
|
@@ -51,16 +52,5 @@ export declare enum Browsers {
|
|
|
51
52
|
IE = "IE",
|
|
52
53
|
SamsungInternet = "SamsungInternet"
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
export declare let OS_VERSION: string;
|
|
57
|
-
export declare let ENGINE_NAME: Engines;
|
|
58
|
-
export declare let ENGINE_VERSION: string;
|
|
59
|
-
export declare let BROWSER_NAME: Browsers;
|
|
60
|
-
export declare let BROWSER_VERSION: string;
|
|
61
|
-
export declare const RENDERER: string;
|
|
62
|
-
export declare const IS_WEBVIEW: boolean;
|
|
63
|
-
export declare const IS_MOBILE: boolean;
|
|
64
|
-
export declare const IS_DESKTOP: boolean;
|
|
65
|
-
export declare const IS_STANDALONE: boolean;
|
|
66
|
-
export {};
|
|
55
|
+
declare const Platform: PlatformInstance;
|
|
56
|
+
export default Platform;
|