native-fn 1.0.42 → 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 +362 -6
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +362 -6
- package/dist/native.umd.js +362 -6
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +262 -98
- 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 +3 -13
- 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 +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 +3 -13
- 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/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 +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 +3 -13
- 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 +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 +3 -13
- 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/types/platform.d.ts +17 -0
- package/dist/src/utils/create-hidden-element.d.ts +1 -1
- package/package.json +1 -8
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function dynamicImport(moduleName) {
|
|
4
|
+
if ('require' in globalThis && typeof globalThis.require === 'function') {
|
|
5
|
+
try {
|
|
6
|
+
return Promise.resolve(globalThis.require(moduleName));
|
|
7
|
+
}
|
|
8
|
+
catch (_) {
|
|
9
|
+
return Promise.resolve(null);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return import(moduleName)
|
|
13
|
+
.then(function (module) {
|
|
14
|
+
return (module.default || module);
|
|
15
|
+
})
|
|
16
|
+
.catch(function () {
|
|
17
|
+
return Promise.resolve(null);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
4
20
|
|
|
5
21
|
var OS;
|
|
6
22
|
(function (OS) {
|
|
@@ -41,42 +57,22 @@ var Browsers;
|
|
|
41
57
|
Browsers["IE"] = "IE";
|
|
42
58
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
43
59
|
})(Browsers || (Browsers = {}));
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'ARM': 'RT'
|
|
61
|
-
}[string];
|
|
62
|
-
if (mapped !== undefined)
|
|
63
|
-
return mapped;
|
|
64
|
-
return string;
|
|
65
|
-
}
|
|
66
|
-
function resolveUnderscoreVersion(string) {
|
|
67
|
-
if (string === undefined)
|
|
68
|
-
return '';
|
|
69
|
-
return string.replace(/_/g, '.');
|
|
70
|
-
}
|
|
71
|
-
function resolveVersion(string, resolver) {
|
|
72
|
-
if (typeof resolver === 'function')
|
|
73
|
-
return resolver(string);
|
|
74
|
-
if (typeof resolver === 'string')
|
|
75
|
-
return resolver;
|
|
76
|
-
if (string === undefined)
|
|
77
|
-
return '';
|
|
78
|
-
return string;
|
|
79
|
-
}
|
|
60
|
+
var Platform = {
|
|
61
|
+
device: Devices.Unknown,
|
|
62
|
+
os: OS.Unknown,
|
|
63
|
+
osVersion: '',
|
|
64
|
+
engine: Engines.Unknown,
|
|
65
|
+
engineVersion: '',
|
|
66
|
+
browser: Browsers.Unknown,
|
|
67
|
+
browserVersion: '',
|
|
68
|
+
renderer: getRenderer(),
|
|
69
|
+
userAgent: navigator.userAgent,
|
|
70
|
+
isWebview: false,
|
|
71
|
+
isMobile: false,
|
|
72
|
+
isDesktop: false,
|
|
73
|
+
isStandalone: false,
|
|
74
|
+
isNodeJS: getIsNode(),
|
|
75
|
+
};
|
|
80
76
|
var OS_RESOLVER_MAP = [
|
|
81
77
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
82
78
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -135,35 +131,115 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
135
131
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
136
132
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
137
133
|
];
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
var
|
|
142
|
-
|
|
134
|
+
function resolveWindowsVersion(string) {
|
|
135
|
+
if (string === undefined)
|
|
136
|
+
return '';
|
|
137
|
+
var mapped = {
|
|
138
|
+
'4.90': 'ME',
|
|
139
|
+
'NT3.51': 'NT 3.11',
|
|
140
|
+
'NT4.0': 'NT 4.0',
|
|
141
|
+
'NT 5.0': '2000',
|
|
142
|
+
'NT 5.1': 'XP',
|
|
143
|
+
'NT 5.2': 'XP',
|
|
144
|
+
'NT 6.0': 'Vista',
|
|
145
|
+
'NT 6.1': '7',
|
|
146
|
+
'NT 6.2': '8',
|
|
147
|
+
'NT 6.3': '8.1',
|
|
148
|
+
'NT 6.4': '10',
|
|
149
|
+
'NT 10.0': '10',
|
|
150
|
+
'ARM': 'RT'
|
|
151
|
+
}[string];
|
|
152
|
+
if (mapped !== undefined)
|
|
153
|
+
return mapped;
|
|
154
|
+
return string;
|
|
155
|
+
}
|
|
156
|
+
function resolveUnderscoreVersion(string) {
|
|
157
|
+
if (string === undefined)
|
|
158
|
+
return '';
|
|
159
|
+
return string.replace(/_/g, '.');
|
|
160
|
+
}
|
|
161
|
+
function resolveVersion(string, resolver) {
|
|
162
|
+
if (typeof resolver === 'function')
|
|
163
|
+
return resolver(string);
|
|
164
|
+
if (typeof resolver === 'string')
|
|
165
|
+
return resolver;
|
|
166
|
+
if (string === undefined)
|
|
167
|
+
return '';
|
|
168
|
+
return string;
|
|
169
|
+
}
|
|
170
|
+
function normalizeBrand(entry) {
|
|
171
|
+
if (entry === null || entry === undefined)
|
|
172
|
+
return { brand: '', version: '' };
|
|
173
|
+
if (typeof entry === 'string')
|
|
174
|
+
return { brand: entry, version: '' };
|
|
175
|
+
return { brand: entry.brand, version: entry.version };
|
|
176
|
+
}
|
|
177
|
+
function getRenderer() {
|
|
178
|
+
if (typeof globalThis.document === 'undefined')
|
|
179
|
+
return '';
|
|
180
|
+
var canvas = globalThis.document.createElement('canvas');
|
|
181
|
+
if (typeof canvas.getContext !== 'function')
|
|
182
|
+
return '';
|
|
183
|
+
var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
|
|
184
|
+
if (context === null)
|
|
185
|
+
return '';
|
|
186
|
+
if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
|
|
187
|
+
var extension = context.getExtension('WEBGL_debug_renderer_info');
|
|
188
|
+
if (extension === null)
|
|
189
|
+
return context.getParameter(context.RENDERER);
|
|
190
|
+
else
|
|
191
|
+
return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
return '';
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function getIsStandalone(os) {
|
|
198
|
+
if (!('matchMedia' in globalThis))
|
|
199
|
+
return false;
|
|
200
|
+
if (os === OS.iOS)
|
|
201
|
+
return 'standalone' in navigator && !!navigator.standalone;
|
|
202
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
203
|
+
}
|
|
204
|
+
function getIsWebview() {
|
|
205
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
206
|
+
}
|
|
207
|
+
function getIsNode() {
|
|
208
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
209
|
+
}
|
|
210
|
+
function getNodeOSVersion(string) {
|
|
211
|
+
var parts = string.split('.');
|
|
212
|
+
return {
|
|
213
|
+
major: parseInt(parts[0] || '0'),
|
|
214
|
+
minor: parseInt(parts[1] || '0'),
|
|
215
|
+
build: parseInt(parts[2] || '0')
|
|
216
|
+
};
|
|
217
|
+
}
|
|
143
218
|
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
144
219
|
var map = OS_RESOLVER_MAP[i];
|
|
145
220
|
var regexp = map[0];
|
|
146
221
|
var os = map[1];
|
|
147
222
|
var resolver = map[2];
|
|
148
|
-
var matched =
|
|
223
|
+
var matched = Platform.userAgent.match(regexp);
|
|
149
224
|
if (matched !== null) {
|
|
150
|
-
|
|
151
|
-
resolveVersion(matched[1], resolver);
|
|
225
|
+
Platform.os = os;
|
|
226
|
+
Platform.osVersion = resolveVersion(matched[1], resolver);
|
|
152
227
|
if (os === OS.iOS || os === OS.Android)
|
|
153
|
-
|
|
228
|
+
Platform.device = Devices.Mobile;
|
|
154
229
|
else if (os === OS.Windows || os === OS.MacOS)
|
|
155
|
-
|
|
230
|
+
Platform.device = Devices.Desktop;
|
|
156
231
|
break;
|
|
157
232
|
}
|
|
158
233
|
}
|
|
159
234
|
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
160
235
|
var map = ENGINE_RESOLVER_MAP[i];
|
|
161
236
|
var regexp = map[0];
|
|
162
|
-
map[1];
|
|
237
|
+
var engine = map[1];
|
|
163
238
|
var resolver = map[2];
|
|
164
|
-
var matched =
|
|
239
|
+
var matched = Platform.userAgent.match(regexp);
|
|
165
240
|
if (matched !== null) {
|
|
166
|
-
|
|
241
|
+
Platform.engine = engine;
|
|
242
|
+
Platform.engineVersion = resolveVersion(matched[1], resolver);
|
|
167
243
|
break;
|
|
168
244
|
}
|
|
169
245
|
}
|
|
@@ -172,42 +248,123 @@ for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
|
172
248
|
var regexp = map[0];
|
|
173
249
|
var browser = map[1];
|
|
174
250
|
var resolver = map[2];
|
|
175
|
-
var matched =
|
|
251
|
+
var matched = Platform.userAgent.match(regexp);
|
|
176
252
|
if (matched !== null) {
|
|
177
|
-
|
|
178
|
-
|
|
253
|
+
Platform.browser = browser;
|
|
254
|
+
Platform.browserVersion = resolveVersion(matched[1], resolver);
|
|
179
255
|
break;
|
|
180
256
|
}
|
|
181
257
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
258
|
+
if (Platform.isNodeJS) {
|
|
259
|
+
dynamicImport('os')
|
|
260
|
+
.then(function (os) {
|
|
261
|
+
if (os === null)
|
|
262
|
+
return;
|
|
263
|
+
var platform = os.platform();
|
|
264
|
+
var release = os.release();
|
|
265
|
+
var version = getNodeOSVersion(release);
|
|
266
|
+
switch (platform) {
|
|
267
|
+
case 'win32':
|
|
268
|
+
Platform.os = OS.Windows;
|
|
269
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
270
|
+
Platform.osVersion = '11';
|
|
271
|
+
else if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
272
|
+
Platform.osVersion = '10';
|
|
273
|
+
else if (version.major === 6 && version.minor === 3)
|
|
274
|
+
Platform.osVersion = '8.1';
|
|
275
|
+
else if (version.major === 6 && version.minor === 2)
|
|
276
|
+
Platform.osVersion = '8';
|
|
277
|
+
else if (version.major === 6 && version.minor === 1)
|
|
278
|
+
Platform.osVersion = '7';
|
|
279
|
+
else if (version.major === 6 && version.minor === 0)
|
|
280
|
+
Platform.osVersion = 'Vista';
|
|
281
|
+
else if (version.major === 5 && version.minor === 1)
|
|
282
|
+
Platform.osVersion = 'XP';
|
|
283
|
+
else if (version.major === 5 && version.minor === 2)
|
|
284
|
+
Platform.osVersion = 'XP';
|
|
285
|
+
else if (version.major === 5 && version.minor === 0)
|
|
286
|
+
Platform.osVersion = '2000';
|
|
287
|
+
else if (version.major === 4 && version.minor === 90)
|
|
288
|
+
Platform.osVersion = 'ME';
|
|
289
|
+
else if (version.major === 4 && version.minor === 0)
|
|
290
|
+
Platform.osVersion = 'NT 4.0';
|
|
291
|
+
else if (version.major === 3 && version.minor === 51)
|
|
292
|
+
Platform.osVersion = 'NT 3.11';
|
|
293
|
+
else
|
|
294
|
+
Platform.osVersion = release;
|
|
295
|
+
break;
|
|
296
|
+
case 'darwin':
|
|
297
|
+
Platform.os = OS.MacOS;
|
|
298
|
+
if (version.major >= 24)
|
|
299
|
+
Platform.osVersion = '' + (version.major - 9);
|
|
300
|
+
else if (version.major === 23)
|
|
301
|
+
Platform.osVersion = '14';
|
|
302
|
+
else if (version.major === 22)
|
|
303
|
+
Platform.osVersion = '13';
|
|
304
|
+
else if (version.major === 21)
|
|
305
|
+
Platform.osVersion = '12';
|
|
306
|
+
else if (version.major === 20)
|
|
307
|
+
Platform.osVersion = '11';
|
|
308
|
+
else if (version.major === 19)
|
|
309
|
+
Platform.osVersion = '10.15';
|
|
310
|
+
else if (version.major === 18)
|
|
311
|
+
Platform.osVersion = '10.14';
|
|
312
|
+
else if (version.major === 17)
|
|
313
|
+
Platform.osVersion = '10.13';
|
|
314
|
+
else if (version.major === 16)
|
|
315
|
+
Platform.osVersion = '10.12';
|
|
316
|
+
else if (version.major === 15)
|
|
317
|
+
Platform.osVersion = '10.11';
|
|
318
|
+
else if (version.major === 14)
|
|
319
|
+
Platform.osVersion = '10.10';
|
|
320
|
+
else if (version.major === 13)
|
|
321
|
+
Platform.osVersion = '10.9';
|
|
322
|
+
else if (version.major >= 5 && version.major <= 12)
|
|
323
|
+
Platform.osVersion = '10.' + (version.major - 4);
|
|
324
|
+
else
|
|
325
|
+
Platform.osVersion = release;
|
|
326
|
+
break;
|
|
327
|
+
case 'android':
|
|
328
|
+
Platform.os = OS.Android;
|
|
329
|
+
Platform.osVersion = release;
|
|
330
|
+
break;
|
|
331
|
+
case 'linux':
|
|
332
|
+
if (/android/i.test(release)) {
|
|
333
|
+
Platform.os = OS.Android;
|
|
334
|
+
Platform.osVersion = release;
|
|
335
|
+
}
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
341
|
+
navigator
|
|
342
|
+
.userAgentData
|
|
343
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
344
|
+
.then(function (result) {
|
|
345
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
346
|
+
var platformVersion = result.platformVersion;
|
|
347
|
+
for (var i = 0; i < brands.length; i++) {
|
|
348
|
+
var brand = normalizeBrand(brands[i]);
|
|
349
|
+
var brandName = brand.brand;
|
|
350
|
+
var brandVersion = brand.version;
|
|
351
|
+
if (/not.a.brand/i.test(brandName))
|
|
352
|
+
continue;
|
|
353
|
+
if (brandName === "Chromium")
|
|
354
|
+
Platform.engineVersion = brandVersion;
|
|
355
|
+
}
|
|
356
|
+
if (typeof platformVersion === 'string') {
|
|
357
|
+
if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
|
|
358
|
+
Platform.osVersion = '11';
|
|
359
|
+
else
|
|
360
|
+
Platform.osVersion = platformVersion;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
Platform.isMobile = Platform.device === Devices.Mobile;
|
|
365
|
+
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
366
|
+
Platform.isWebview = getIsWebview();
|
|
367
|
+
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
211
368
|
|
|
212
369
|
function compareVersion(lhs, rhs) {
|
|
213
370
|
var pa = lhs.split('.');
|
|
@@ -240,11 +397,11 @@ var Appearances;
|
|
|
240
397
|
})(Appearances || (Appearances = {}));
|
|
241
398
|
var MEDIA_QUERY_LIST = globalThis.matchMedia('(prefers-color-scheme: dark)');
|
|
242
399
|
var SUPPORT_PREFERS_COLOR_SCHEME = MEDIA_QUERY_LIST.media !== 'not all';
|
|
243
|
-
var IS_FULL_SUPPORT_THEME_COLOR =
|
|
400
|
+
var IS_FULL_SUPPORT_THEME_COLOR = Platform.browser !== Browsers.Chrome || (Platform.isMobile && compareVersion(Platform.browserVersion, '92') >= 0);
|
|
244
401
|
var CONTEXT = globalThis.document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
245
402
|
var SVG_PIXEL_DATA_URL = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+';
|
|
246
|
-
var IS_IE_MOBILE = /iemobile/i.test(
|
|
247
|
-
var IS_WINDOWS_PHONE = /windows phone/i.test(
|
|
403
|
+
var IS_IE_MOBILE = /iemobile/i.test(Platform.userAgent);
|
|
404
|
+
var IS_WINDOWS_PHONE = /windows phone/i.test(Platform.userAgent);
|
|
248
405
|
var ENTRIES = [];
|
|
249
406
|
|
|
250
407
|
/******************************************************************************
|
|
@@ -594,6 +751,8 @@ var UnsupportedColorError = createCustomError('UnsupportedColorError');
|
|
|
594
751
|
|
|
595
752
|
function createHiddenElement(tagName, focusable) {
|
|
596
753
|
if (focusable === void 0) { focusable = true; }
|
|
754
|
+
if (typeof globalThis.document === 'undefined')
|
|
755
|
+
return undefined;
|
|
597
756
|
var element = globalThis.document.createElement(tagName);
|
|
598
757
|
if ('width' in element)
|
|
599
758
|
element.width = '0';
|
|
@@ -664,6 +823,8 @@ function parseColor(color) {
|
|
|
664
823
|
}
|
|
665
824
|
}
|
|
666
825
|
var div = createHiddenElement('div');
|
|
826
|
+
if (div === undefined)
|
|
827
|
+
throw new UnsupportedColorError('Failed to parse color values from: \"' + color + '\".');
|
|
667
828
|
div.style.color = color;
|
|
668
829
|
globalThis.document.body.appendChild(div);
|
|
669
830
|
try {
|
|
@@ -733,8 +894,8 @@ function getThemeColorMeta(appearance) {
|
|
|
733
894
|
return themeColorMetaGroup[appearance] = meta;
|
|
734
895
|
}
|
|
735
896
|
function estimateDefaultThemeColor() {
|
|
736
|
-
if (
|
|
737
|
-
if (
|
|
897
|
+
if (Platform.browser === Browsers.Safari) {
|
|
898
|
+
if (Platform.isStandalone) {
|
|
738
899
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
739
900
|
return '#ffffffff';
|
|
740
901
|
else
|
|
@@ -742,7 +903,7 @@ function estimateDefaultThemeColor() {
|
|
|
742
903
|
}
|
|
743
904
|
return rgbaToHex(parseColor(globalThis.getComputedStyle(globalThis.document.body).backgroundColor));
|
|
744
905
|
}
|
|
745
|
-
if (
|
|
906
|
+
if (Platform.browser === Browsers.Chrome) {
|
|
746
907
|
if (detectFromMediaQuery() === Appearances.Dark)
|
|
747
908
|
return '#28292cff';
|
|
748
909
|
else
|
|
@@ -852,7 +1013,7 @@ function removeEntry(entry) {
|
|
|
852
1013
|
if (index !== -1)
|
|
853
1014
|
ENTRIES.splice(index, 1);
|
|
854
1015
|
if (ENTRIES.length === 0) {
|
|
855
|
-
if (
|
|
1016
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
856
1017
|
stopPolling();
|
|
857
1018
|
else
|
|
858
1019
|
removeListener(entry.capture);
|
|
@@ -1012,7 +1173,7 @@ function removeThemeColor(appearance) {
|
|
|
1012
1173
|
themeColorMetaGroup[appearance] = undefined;
|
|
1013
1174
|
}
|
|
1014
1175
|
function detectAppearance() {
|
|
1015
|
-
if (
|
|
1176
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1016
1177
|
return detectFromEngine();
|
|
1017
1178
|
else
|
|
1018
1179
|
return Promise.resolve(detectFromMediaQuery());
|
|
@@ -1032,7 +1193,7 @@ function onAppearanceChange(listener, options) {
|
|
|
1032
1193
|
if (index === -1) {
|
|
1033
1194
|
ENTRIES.push(entry);
|
|
1034
1195
|
if (ENTRIES.length === 1) {
|
|
1035
|
-
if (
|
|
1196
|
+
if (Platform.browser === Browsers.SamsungInternet)
|
|
1036
1197
|
startPolling();
|
|
1037
1198
|
else
|
|
1038
1199
|
addListener(entry.capture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"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 k=d===t.Mobile;t.Desktop;var T,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"}(T||(T={}));var E=globalThis.matchMedia("(prefers-color-scheme: dark)"),M="not all"!==E.media,C=p!==r.Chrome||k&&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()===T.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(T.Light);I.drawImage(t,0,0);var n=I.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?e(T.Dark):e(T.Light)},t.onerror=function(){e(T.Unknown)},t.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function ne(){return M?E.matches?T.Dark:T.Light:T.Unknown}function re(e){var t;(t=e.matches?T.Dark:T.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()===T.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()===T.Dark?"#ffffffff":"#000000ff":ee(G(globalThis.getComputedStyle(globalThis.document.body).backgroundColor)):p===r.Chrome?ne()===T.Dark?"#28292cff":"#ffffffff":void 0}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();var ue={installed:!1,name:"Theme",module:J,Constants:{Appearances:T},Errors:{EasingError:j,UnsupportedEasingFunctionError:D,StepSyntaxError:W,LinearSyntaxError:U,CubicBezierSyntaxError:P,UnsupportedColorError:q}};module.exports=ue;
|
|
1
|
+
"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)"),S="not all"!==y.media,T=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=!T||!S||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 S?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(T&&S&&!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(!T||!S)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}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();var oe={installed:!1,name:"Theme",module:K,Constants:{Appearances:o},Errors:{EasingError:I,UnsupportedEasingFunctionError:L,StepSyntaxError:F,LinearSyntaxError:N,CubicBezierSyntaxError:C,UnsupportedColorError:V}};module.exports=oe;
|