native-fn 1.0.41 → 1.0.43
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 +380 -1
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +380 -1
- package/dist/native.umd.js +380 -1
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +262 -98
- package/dist/plugin/app/index.d.ts +18 -0
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +262 -98
- package/dist/plugin/app/index.umd.js +262 -98
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/constants/platform.d.ts +21 -12
- package/dist/plugin/app/src/types/platform.d.ts +17 -0
- package/dist/plugin/app/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/app/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/app/src/utils/dynamic-import.d.ts +1 -0
- package/dist/plugin/camera/index.cjs +248 -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 +248 -86
- package/dist/plugin/camera/index.umd.js +248 -86
- package/dist/plugin/camera/index.umd.min.js +1 -1
- package/dist/plugin/camera/src/constants/platform.d.ts +21 -12
- package/dist/plugin/camera/src/types/platform.d.ts +17 -0
- package/dist/plugin/camera/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/camera/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/camera/src/utils/dynamic-import.d.ts +1 -0
- package/dist/plugin/clipboard/index.cjs +7 -4
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +7 -4
- package/dist/plugin/clipboard/index.umd.js +7 -4
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/constants/platform.d.ts +21 -12
- package/dist/plugin/clipboard/src/types/platform.d.ts +17 -0
- package/dist/plugin/clipboard/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/clipboard/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/clipboard/src/utils/dynamic-import.d.ts +1 -0
- package/dist/plugin/fullscreen/index.cjs +241 -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 +241 -82
- package/dist/plugin/fullscreen/index.umd.js +241 -82
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/constants/platform.d.ts +21 -12
- package/dist/plugin/fullscreen/src/types/platform.d.ts +17 -0
- package/dist/plugin/fullscreen/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/fullscreen/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/fullscreen/src/utils/dynamic-import.d.ts +1 -0
- package/dist/plugin/platform/index.cjs +7 -7
- package/dist/plugin/platform/index.d.ts +18 -0
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +7 -7
- package/dist/plugin/platform/index.umd.js +7 -7
- package/dist/plugin/platform/index.umd.min.js +1 -1
- package/dist/plugin/platform/src/constants/platform.d.ts +19 -0
- package/dist/plugin/platform/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/platform/src/utils/dynamic-import.d.ts +1 -0
- package/dist/plugin/theme/index.cjs +252 -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 +252 -91
- package/dist/plugin/theme/index.umd.js +252 -91
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/constants/platform.d.ts +21 -12
- package/dist/plugin/theme/src/types/platform.d.ts +17 -0
- package/dist/plugin/theme/src/utils/create-custom-error.d.ts +5 -0
- package/dist/plugin/theme/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/plugin/theme/src/utils/dynamic-import.d.ts +1 -0
- package/dist/src/constants/platform.d.ts +21 -12
- package/dist/src/types/platform.d.ts +17 -0
- package/dist/src/utils/create-custom-error.d.ts +5 -0
- package/dist/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/src/utils/dynamic-import.d.ts +1 -0
- package/package.json +1 -8
|
@@ -4,7 +4,23 @@
|
|
|
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
|
+
return import(moduleName)
|
|
17
|
+
.then(function (module) {
|
|
18
|
+
return (module.default || module);
|
|
19
|
+
})
|
|
20
|
+
.catch(function () {
|
|
21
|
+
return Promise.resolve(null);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
8
24
|
|
|
9
25
|
var OS;
|
|
10
26
|
(function (OS) {
|
|
@@ -45,47 +61,22 @@
|
|
|
45
61
|
Browsers["IE"] = "IE";
|
|
46
62
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
47
63
|
})(Browsers || (Browsers = {}));
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'NT 6.1': '7',
|
|
65
|
-
'NT 6.2': '8',
|
|
66
|
-
'NT 6.3': '8.1',
|
|
67
|
-
'NT 6.4': '10',
|
|
68
|
-
'NT 10.0': '10',
|
|
69
|
-
'ARM': 'RT'
|
|
70
|
-
}[string];
|
|
71
|
-
if (mapped !== undefined)
|
|
72
|
-
return mapped;
|
|
73
|
-
return string;
|
|
74
|
-
}
|
|
75
|
-
function resolveUnderscoreVersion(string) {
|
|
76
|
-
if (string === undefined)
|
|
77
|
-
return '';
|
|
78
|
-
return string.replace(/_/g, '.');
|
|
79
|
-
}
|
|
80
|
-
function resolveVersion(string, resolver) {
|
|
81
|
-
if (typeof resolver === 'function')
|
|
82
|
-
return resolver(string);
|
|
83
|
-
if (typeof resolver === 'string')
|
|
84
|
-
return resolver;
|
|
85
|
-
if (string === undefined)
|
|
86
|
-
return '';
|
|
87
|
-
return string;
|
|
88
|
-
}
|
|
64
|
+
var Platform = {
|
|
65
|
+
device: Devices.Unknown,
|
|
66
|
+
os: OS.Unknown,
|
|
67
|
+
osVersion: '',
|
|
68
|
+
engine: Engines.Unknown,
|
|
69
|
+
engineVersion: '',
|
|
70
|
+
browser: Browsers.Unknown,
|
|
71
|
+
browserVersion: '',
|
|
72
|
+
renderer: getRenderer(),
|
|
73
|
+
userAgent: navigator.userAgent,
|
|
74
|
+
isWebview: false,
|
|
75
|
+
isMobile: false,
|
|
76
|
+
isDesktop: false,
|
|
77
|
+
isStandalone: false,
|
|
78
|
+
isNodeJS: getIsNode(),
|
|
79
|
+
};
|
|
89
80
|
var OS_RESOLVER_MAP = [
|
|
90
81
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
91
82
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -144,30 +135,115 @@
|
|
|
144
135
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
145
136
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
146
137
|
];
|
|
138
|
+
function resolveWindowsVersion(string) {
|
|
139
|
+
if (string === undefined)
|
|
140
|
+
return '';
|
|
141
|
+
var mapped = {
|
|
142
|
+
'4.90': 'ME',
|
|
143
|
+
'NT3.51': 'NT 3.11',
|
|
144
|
+
'NT4.0': 'NT 4.0',
|
|
145
|
+
'NT 5.0': '2000',
|
|
146
|
+
'NT 5.1': 'XP',
|
|
147
|
+
'NT 5.2': 'XP',
|
|
148
|
+
'NT 6.0': 'Vista',
|
|
149
|
+
'NT 6.1': '7',
|
|
150
|
+
'NT 6.2': '8',
|
|
151
|
+
'NT 6.3': '8.1',
|
|
152
|
+
'NT 6.4': '10',
|
|
153
|
+
'NT 10.0': '10',
|
|
154
|
+
'ARM': 'RT'
|
|
155
|
+
}[string];
|
|
156
|
+
if (mapped !== undefined)
|
|
157
|
+
return mapped;
|
|
158
|
+
return string;
|
|
159
|
+
}
|
|
160
|
+
function resolveUnderscoreVersion(string) {
|
|
161
|
+
if (string === undefined)
|
|
162
|
+
return '';
|
|
163
|
+
return string.replace(/_/g, '.');
|
|
164
|
+
}
|
|
165
|
+
function resolveVersion(string, resolver) {
|
|
166
|
+
if (typeof resolver === 'function')
|
|
167
|
+
return resolver(string);
|
|
168
|
+
if (typeof resolver === 'string')
|
|
169
|
+
return resolver;
|
|
170
|
+
if (string === undefined)
|
|
171
|
+
return '';
|
|
172
|
+
return string;
|
|
173
|
+
}
|
|
174
|
+
function normalizeBrand(entry) {
|
|
175
|
+
if (entry === null || entry === undefined)
|
|
176
|
+
return { brand: '', version: '' };
|
|
177
|
+
if (typeof entry === 'string')
|
|
178
|
+
return { brand: entry, version: '' };
|
|
179
|
+
return { brand: entry.brand, version: entry.version };
|
|
180
|
+
}
|
|
181
|
+
function getRenderer() {
|
|
182
|
+
if (typeof globalThis.document === 'undefined')
|
|
183
|
+
return '';
|
|
184
|
+
var canvas = globalThis.document.createElement('canvas');
|
|
185
|
+
if (typeof canvas.getContext !== 'function')
|
|
186
|
+
return '';
|
|
187
|
+
var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
|
|
188
|
+
if (context === null)
|
|
189
|
+
return '';
|
|
190
|
+
if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
|
|
191
|
+
var extension = context.getExtension('WEBGL_debug_renderer_info');
|
|
192
|
+
if (extension === null)
|
|
193
|
+
return context.getParameter(context.RENDERER);
|
|
194
|
+
else
|
|
195
|
+
return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return '';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function getIsStandalone(os) {
|
|
202
|
+
if (!('matchMedia' in globalThis))
|
|
203
|
+
return false;
|
|
204
|
+
if (os === OS.iOS)
|
|
205
|
+
return 'standalone' in navigator && !!navigator.standalone;
|
|
206
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
207
|
+
}
|
|
208
|
+
function getIsWebview() {
|
|
209
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
210
|
+
}
|
|
211
|
+
function getIsNode() {
|
|
212
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
213
|
+
}
|
|
214
|
+
function getNodeOSVersion(string) {
|
|
215
|
+
var parts = string.split('.');
|
|
216
|
+
return {
|
|
217
|
+
major: parseInt(parts[0] || '0'),
|
|
218
|
+
minor: parseInt(parts[1] || '0'),
|
|
219
|
+
build: parseInt(parts[2] || '0')
|
|
220
|
+
};
|
|
221
|
+
}
|
|
147
222
|
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
148
223
|
var map = OS_RESOLVER_MAP[i];
|
|
149
224
|
var regexp = map[0];
|
|
150
225
|
var os = map[1];
|
|
151
226
|
var resolver = map[2];
|
|
152
|
-
var matched =
|
|
227
|
+
var matched = Platform.userAgent.match(regexp);
|
|
153
228
|
if (matched !== null) {
|
|
154
|
-
|
|
155
|
-
resolveVersion(matched[1], resolver);
|
|
229
|
+
Platform.os = os;
|
|
230
|
+
Platform.osVersion = resolveVersion(matched[1], resolver);
|
|
156
231
|
if (os === OS.iOS || os === OS.Android)
|
|
157
|
-
|
|
232
|
+
Platform.device = Devices.Mobile;
|
|
158
233
|
else if (os === OS.Windows || os === OS.MacOS)
|
|
159
|
-
|
|
234
|
+
Platform.device = Devices.Desktop;
|
|
160
235
|
break;
|
|
161
236
|
}
|
|
162
237
|
}
|
|
163
238
|
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
164
239
|
var map = ENGINE_RESOLVER_MAP[i];
|
|
165
240
|
var regexp = map[0];
|
|
166
|
-
map[1];
|
|
241
|
+
var engine = map[1];
|
|
167
242
|
var resolver = map[2];
|
|
168
|
-
var matched =
|
|
243
|
+
var matched = Platform.userAgent.match(regexp);
|
|
169
244
|
if (matched !== null) {
|
|
170
|
-
|
|
245
|
+
Platform.engine = engine;
|
|
246
|
+
Platform.engineVersion = resolveVersion(matched[1], resolver);
|
|
171
247
|
break;
|
|
172
248
|
}
|
|
173
249
|
}
|
|
@@ -176,42 +252,123 @@
|
|
|
176
252
|
var regexp = map[0];
|
|
177
253
|
var browser = map[1];
|
|
178
254
|
var resolver = map[2];
|
|
179
|
-
var matched =
|
|
255
|
+
var matched = Platform.userAgent.match(regexp);
|
|
180
256
|
if (matched !== null) {
|
|
181
|
-
|
|
182
|
-
|
|
257
|
+
Platform.browser = browser;
|
|
258
|
+
Platform.browserVersion = resolveVersion(matched[1], resolver);
|
|
183
259
|
break;
|
|
184
260
|
}
|
|
185
261
|
}
|
|
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
|
-
|
|
262
|
+
if (Platform.isNodeJS) {
|
|
263
|
+
dynamicImport('os')
|
|
264
|
+
.then(function (os) {
|
|
265
|
+
if (os === null)
|
|
266
|
+
return;
|
|
267
|
+
var platform = os.platform();
|
|
268
|
+
var release = os.release();
|
|
269
|
+
var version = getNodeOSVersion(release);
|
|
270
|
+
switch (platform) {
|
|
271
|
+
case 'win32':
|
|
272
|
+
Platform.os = OS.Windows;
|
|
273
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
274
|
+
Platform.osVersion = '11';
|
|
275
|
+
else if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
276
|
+
Platform.osVersion = '10';
|
|
277
|
+
else if (version.major === 6 && version.minor === 3)
|
|
278
|
+
Platform.osVersion = '8.1';
|
|
279
|
+
else if (version.major === 6 && version.minor === 2)
|
|
280
|
+
Platform.osVersion = '8';
|
|
281
|
+
else if (version.major === 6 && version.minor === 1)
|
|
282
|
+
Platform.osVersion = '7';
|
|
283
|
+
else if (version.major === 6 && version.minor === 0)
|
|
284
|
+
Platform.osVersion = 'Vista';
|
|
285
|
+
else if (version.major === 5 && version.minor === 1)
|
|
286
|
+
Platform.osVersion = 'XP';
|
|
287
|
+
else if (version.major === 5 && version.minor === 2)
|
|
288
|
+
Platform.osVersion = 'XP';
|
|
289
|
+
else if (version.major === 5 && version.minor === 0)
|
|
290
|
+
Platform.osVersion = '2000';
|
|
291
|
+
else if (version.major === 4 && version.minor === 90)
|
|
292
|
+
Platform.osVersion = 'ME';
|
|
293
|
+
else if (version.major === 4 && version.minor === 0)
|
|
294
|
+
Platform.osVersion = 'NT 4.0';
|
|
295
|
+
else if (version.major === 3 && version.minor === 51)
|
|
296
|
+
Platform.osVersion = 'NT 3.11';
|
|
297
|
+
else
|
|
298
|
+
Platform.osVersion = release;
|
|
299
|
+
break;
|
|
300
|
+
case 'darwin':
|
|
301
|
+
Platform.os = OS.MacOS;
|
|
302
|
+
if (version.major >= 24)
|
|
303
|
+
Platform.osVersion = '' + (version.major - 9);
|
|
304
|
+
else if (version.major === 23)
|
|
305
|
+
Platform.osVersion = '14';
|
|
306
|
+
else if (version.major === 22)
|
|
307
|
+
Platform.osVersion = '13';
|
|
308
|
+
else if (version.major === 21)
|
|
309
|
+
Platform.osVersion = '12';
|
|
310
|
+
else if (version.major === 20)
|
|
311
|
+
Platform.osVersion = '11';
|
|
312
|
+
else if (version.major === 19)
|
|
313
|
+
Platform.osVersion = '10.15';
|
|
314
|
+
else if (version.major === 18)
|
|
315
|
+
Platform.osVersion = '10.14';
|
|
316
|
+
else if (version.major === 17)
|
|
317
|
+
Platform.osVersion = '10.13';
|
|
318
|
+
else if (version.major === 16)
|
|
319
|
+
Platform.osVersion = '10.12';
|
|
320
|
+
else if (version.major === 15)
|
|
321
|
+
Platform.osVersion = '10.11';
|
|
322
|
+
else if (version.major === 14)
|
|
323
|
+
Platform.osVersion = '10.10';
|
|
324
|
+
else if (version.major === 13)
|
|
325
|
+
Platform.osVersion = '10.9';
|
|
326
|
+
else if (version.major >= 5 && version.major <= 12)
|
|
327
|
+
Platform.osVersion = '10.' + (version.major - 4);
|
|
328
|
+
else
|
|
329
|
+
Platform.osVersion = release;
|
|
330
|
+
break;
|
|
331
|
+
case 'android':
|
|
332
|
+
Platform.os = OS.Android;
|
|
333
|
+
Platform.osVersion = release;
|
|
334
|
+
break;
|
|
335
|
+
case 'linux':
|
|
336
|
+
if (/android/i.test(release)) {
|
|
337
|
+
Platform.os = OS.Android;
|
|
338
|
+
Platform.osVersion = release;
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
345
|
+
navigator
|
|
346
|
+
.userAgentData
|
|
347
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
348
|
+
.then(function (result) {
|
|
349
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
350
|
+
var platformVersion = result.platformVersion;
|
|
351
|
+
for (var i = 0; i < brands.length; i++) {
|
|
352
|
+
var brand = normalizeBrand(brands[i]);
|
|
353
|
+
var brandName = brand.brand;
|
|
354
|
+
var brandVersion = brand.version;
|
|
355
|
+
if (/not.a.brand/i.test(brandName))
|
|
356
|
+
continue;
|
|
357
|
+
if (brandName === "Chromium")
|
|
358
|
+
Platform.engineVersion = brandVersion;
|
|
359
|
+
}
|
|
360
|
+
if (typeof platformVersion === 'string') {
|
|
361
|
+
if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
|
|
362
|
+
Platform.osVersion = '11';
|
|
363
|
+
else
|
|
364
|
+
Platform.osVersion = platformVersion;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
Platform.isMobile = Platform.device === Devices.Mobile;
|
|
369
|
+
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
370
|
+
Platform.isWebview = getIsWebview();
|
|
371
|
+
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
215
372
|
|
|
216
373
|
function compareVersion(lhs, rhs) {
|
|
217
374
|
var pa = lhs.split('.');
|
|
@@ -244,11 +401,11 @@
|
|
|
244
401
|
})(Appearances || (Appearances = {}));
|
|
245
402
|
var MEDIA_QUERY_LIST = globalThis.matchMedia('(prefers-color-scheme: dark)');
|
|
246
403
|
var SUPPORT_PREFERS_COLOR_SCHEME = MEDIA_QUERY_LIST.media !== 'not all';
|
|
247
|
-
var IS_FULL_SUPPORT_THEME_COLOR =
|
|
404
|
+
var IS_FULL_SUPPORT_THEME_COLOR = Platform.browser !== Browsers.Chrome || (Platform.isMobile && compareVersion(Platform.browserVersion, '92') >= 0);
|
|
248
405
|
var CONTEXT = globalThis.document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
249
406
|
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(
|
|
407
|
+
var IS_IE_MOBILE = /iemobile/i.test(Platform.userAgent);
|
|
408
|
+
var IS_WINDOWS_PHONE = /windows phone/i.test(Platform.userAgent);
|
|
252
409
|
var ENTRIES = [];
|
|
253
410
|
|
|
254
411
|
/******************************************************************************
|
|
@@ -598,6 +755,8 @@
|
|
|
598
755
|
|
|
599
756
|
function createHiddenElement(tagName, focusable) {
|
|
600
757
|
if (focusable === void 0) { focusable = true; }
|
|
758
|
+
if (typeof globalThis.document === 'undefined')
|
|
759
|
+
return undefined;
|
|
601
760
|
var element = globalThis.document.createElement(tagName);
|
|
602
761
|
if ('width' in element)
|
|
603
762
|
element.width = '0';
|
|
@@ -668,6 +827,8 @@
|
|
|
668
827
|
}
|
|
669
828
|
}
|
|
670
829
|
var div = createHiddenElement('div');
|
|
830
|
+
if (div === undefined)
|
|
831
|
+
throw new UnsupportedColorError('Failed to parse color values from: \"' + color + '\".');
|
|
671
832
|
div.style.color = color;
|
|
672
833
|
globalThis.document.body.appendChild(div);
|
|
673
834
|
try {
|
|
@@ -737,8 +898,8 @@
|
|
|
737
898
|
return themeColorMetaGroup[appearance] = meta;
|
|
738
899
|
}
|
|
739
900
|
function estimateDefaultThemeColor() {
|
|
740
|
-
if (
|
|
741
|
-
if (
|
|
901
|
+
if (Platform.browser === Browsers.Safari) {
|
|
902
|
+
if (Platform.isStandalone) {
|
|
742
903
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
743
904
|
return '#ffffffff';
|
|
744
905
|
else
|
|
@@ -746,7 +907,7 @@
|
|
|
746
907
|
}
|
|
747
908
|
return rgbaToHex(parseColor(globalThis.getComputedStyle(globalThis.document.body).backgroundColor));
|
|
748
909
|
}
|
|
749
|
-
if (
|
|
910
|
+
if (Platform.browser === Browsers.Chrome) {
|
|
750
911
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
751
912
|
return '#28292cff';
|
|
752
913
|
else
|
|
@@ -856,7 +1017,7 @@
|
|
|
856
1017
|
if (index !== -1)
|
|
857
1018
|
ENTRIES.splice(index, 1);
|
|
858
1019
|
if (ENTRIES.length === 0) {
|
|
859
|
-
if (
|
|
1020
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
860
1021
|
stopPolling();
|
|
861
1022
|
else
|
|
862
1023
|
removeListener(entry.capture);
|
|
@@ -1016,7 +1177,7 @@
|
|
|
1016
1177
|
themeColorMetaGroup[appearance] = undefined;
|
|
1017
1178
|
}
|
|
1018
1179
|
function detectAppearance() {
|
|
1019
|
-
if (
|
|
1180
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1020
1181
|
return detectFromEngine();
|
|
1021
1182
|
else
|
|
1022
1183
|
return Promise.resolve(detectFromMediaQuery());
|
|
@@ -1036,7 +1197,7 @@
|
|
|
1036
1197
|
if (index === -1) {
|
|
1037
1198
|
ENTRIES.push(entry);
|
|
1038
1199
|
if (ENTRIES.length === 1) {
|
|
1039
|
-
if (
|
|
1200
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1040
1201
|
startPolling();
|
|
1041
1202
|
else
|
|
1042
1203
|
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(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 i=t.Unknown,a=e.Unknown;n.Unknown;var l=r.Unknown,s="";function u(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 c(e){return void 0===e?"":e.replace(/_/g,".")}function d(e,t){return"function"==typeof t?t(e):"string"==typeof t?t:void 0===e?"":e}for(var f=[[/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]],p=[[/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]],m=[[/\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]],h=0;h<f.length;h++){var v=(w=f[h])[0],b=w[1],g=w[2];if(null!==(y=o.match(v))){a=b,d(y[1],g),b===e.iOS||b===e.Android?i=t.Mobile:b!==e.Windows&&b!==e.MacOS||(i=t.Desktop);break}}for(h=0;h<p.length;h++){v=(w=p[h])[0];w[1];g=w[2];if(null!==(y=o.match(v))){d(y[1],g);break}}for(h=0;h<m.length;h++){v=(w=m[h])[0];var w,y,S=w[1];g=w[2];if(null!==(y=o.match(v))){l=S,s=d(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=i===t.Mobile;t.Desktop;var k,x="matchMedia"in globalThis&&(a===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=l!==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}(s,"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 l===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&&(l===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&&(l===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"):l===r.Safari?x?ne()===k.Dark?"#ffffffff":"#000000ff":ee(G(globalThis.getComputedStyle(globalThis.document.body).backgroundColor)):l===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 p=(b=a[f])[0],m=b[1],h=b[2];if(null!==(g=i.userAgent.match(p))){i.os=m,i.osVersion=d(g[1],h),m===e.iOS||m===e.Android?i.device=r.Mobile:m!==e.Windows&&m!==e.MacOS||(i.device=r.Desktop);break}}for(f=0;f<s.length;f++){p=(b=s[f])[0];var v=b[1];h=b[2];if(null!==(g=i.userAgent.match(p))){i.engine=v,i.engineVersion=d(g[1],h);break}}for(f=0;f<l.length;f++){p=(b=l[f])[0];var b,g,w=b[1];h=b[2];if(null!==(g=i.userAgent.match(p))){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)}return import(e).then((function(e){return e.default||e})).catch((function(){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):23===a.major?"14":22===a.major?"13":21===a.major?"12":20===a.major?"11":19===a.major?"10.15":18===a.major?"10.14":17===a.major?"10.13":16===a.major?"10.12":15===a.major?"10.11":14===a.major?"10.10":13===a.major?"10.9":a.major>=5&&a.major<=12?"10."+(a.major-4):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]),p=u[2].trim().split(/\s+/);try{for(var m=(r=void 0,M(p)),h=m.next();!h.done;h=m.next()){var v=h.value;a.push({value:f,position:parseFloat(v)/100})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}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,22 @@
|
|
|
1
|
+
import { PlatformInstance } from "../types/platform";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Navigator {
|
|
4
|
+
userAgentData?: UserAgentData;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
interface ModernUserAgentDataBrand {
|
|
8
|
+
brand: string;
|
|
9
|
+
version: string;
|
|
10
|
+
}
|
|
11
|
+
type UserAgentDataBrand = ModernUserAgentDataBrand | string | null | undefined;
|
|
12
|
+
interface UserAgentDataValues {
|
|
13
|
+
brands?: UserAgentDataBrand[];
|
|
14
|
+
fullVersionList?: UserAgentDataBrand[];
|
|
15
|
+
platformVersion?: string | null | undefined;
|
|
16
|
+
}
|
|
17
|
+
interface UserAgentData {
|
|
18
|
+
getHighEntropyValues?(hints: string[]): Promise<UserAgentDataValues>;
|
|
19
|
+
}
|
|
1
20
|
export declare enum OS {
|
|
2
21
|
Unknown = "Unknown",
|
|
3
22
|
Android = "Android",
|
|
@@ -33,15 +52,5 @@ export declare enum Browsers {
|
|
|
33
52
|
IE = "IE",
|
|
34
53
|
SamsungInternet = "SamsungInternet"
|
|
35
54
|
}
|
|
36
|
-
|
|
37
|
-
export
|
|
38
|
-
export declare let OS_VERSION: string;
|
|
39
|
-
export declare let ENGINE_NAME: Engines;
|
|
40
|
-
export declare let ENGINE_VERSION: string;
|
|
41
|
-
export declare let BROWSER_NAME: Browsers;
|
|
42
|
-
export declare let BROWSER_VERSION: string;
|
|
43
|
-
export declare const RENDERER: string;
|
|
44
|
-
export declare const IS_WEBVIEW: boolean;
|
|
45
|
-
export declare const IS_MOBILE: boolean;
|
|
46
|
-
export declare const IS_DESKTOP: boolean;
|
|
47
|
-
export declare const IS_STANDALONE: boolean;
|
|
55
|
+
declare const Platform: PlatformInstance;
|
|
56
|
+
export default Platform;
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function dynamicImport<T = any>(moduleName: string): Promise<T | null>;
|