web-launch-kit 0.0.2 → 0.0.4
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/LICENSE +21 -0
- package/README.ko.md +294 -0
- package/README.md +63 -17
- package/dist/index.d.ts +0 -57
- package/dist/launch-kit.cjs +1295 -304
- package/dist/launch-kit.cjs.map +1 -1
- package/dist/launch-kit.min.cjs +1 -1
- package/dist/launch-kit.min.cjs.map +1 -1
- package/dist/launch-kit.min.mjs +1 -1
- package/dist/launch-kit.min.mjs.map +1 -1
- package/dist/launch-kit.mjs +1295 -304
- package/dist/launch-kit.mjs.map +1 -1
- package/dist/launch-kit.umd.js +1295 -304
- package/dist/launch-kit.umd.js.map +1 -1
- package/dist/launch-kit.umd.min.js +1 -1
- package/dist/launch-kit.umd.min.js.map +1 -1
- package/dist/utils/get-global.d.ts +37 -0
- package/dist/utils/get-id.d.ts +0 -12
- package/package.json +8 -4
- package/dist/utils/event-listener-utils.d.ts +0 -8
package/dist/launch-kit.cjs
CHANGED
|
@@ -2,24 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version$
|
|
6
|
-
var packageJSON$
|
|
7
|
-
version: version$
|
|
5
|
+
var version$3 = "0.0.4";
|
|
6
|
+
var packageJSON$3 = {
|
|
7
|
+
version: version$3};
|
|
8
8
|
|
|
9
|
-
var version = "0.0.
|
|
10
|
-
var packageJSON = {
|
|
11
|
-
version: version};
|
|
9
|
+
var version$2 = "0.0.5";
|
|
10
|
+
var packageJSON$2 = {
|
|
11
|
+
version: version$2};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function getGlobal$3() {
|
|
14
|
+
if (typeof globalThis !== 'undefined')
|
|
15
|
+
return globalThis;
|
|
16
|
+
if (typeof self !== 'undefined')
|
|
17
|
+
return self;
|
|
18
|
+
if (typeof window !== 'undefined')
|
|
19
|
+
return window;
|
|
20
|
+
if (typeof global !== 'undefined')
|
|
21
|
+
return global;
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
var GLOBAL$5 = getGlobal$3();
|
|
25
|
+
var NAVIGATOR$1 = GLOBAL$5.navigator;
|
|
26
|
+
var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
|
|
27
|
+
var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
|
|
16
28
|
var OS_RESOLVER_MAP = [
|
|
17
|
-
[/windows nt (6\.[23]); arm/i, 'windows',
|
|
18
|
-
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'
|
|
19
|
-
[/
|
|
29
|
+
[/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
|
|
30
|
+
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
|
|
31
|
+
[/win 9x 4\.90/i, 'windows', 'ME'],
|
|
32
|
+
[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
|
|
20
33
|
[/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
|
|
21
34
|
[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
|
|
22
|
-
[/windows ce\/?([\d.]*)/i, 'windows'
|
|
35
|
+
[/windows ce\/?([\d.]*)/i, 'windows'],
|
|
23
36
|
[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
|
|
24
37
|
[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
|
|
25
38
|
[/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
|
|
@@ -48,13 +61,14 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
48
61
|
[/samsungbrowser\/([\w.]+)/i, 'samsung'],
|
|
49
62
|
[/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
|
|
50
63
|
[/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
|
|
51
|
-
[/ wv\).+
|
|
64
|
+
[/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
|
|
52
65
|
[/chrome\/([\w.]+) mobile/i, 'chrome'],
|
|
53
66
|
[/chrome\/v?([\w.]+)/i, 'chrome'],
|
|
54
67
|
[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
55
68
|
[/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
56
69
|
[/version\/([\w.,]+) .*safari/i, 'safari'],
|
|
57
70
|
[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
|
|
71
|
+
[/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
|
|
58
72
|
[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
|
|
59
73
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
|
|
60
74
|
[/firefox\/([\w.]+)/i, 'firefox'],
|
|
@@ -71,6 +85,18 @@ var ENGINE_RESOLVER_MAP = [
|
|
|
71
85
|
[/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
|
|
72
86
|
[/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
|
|
73
87
|
];
|
|
88
|
+
var IN_APP_BROWSER_RESOLVER_MAP = [
|
|
89
|
+
[/kakaotalk/i, 'kakaotalk'],
|
|
90
|
+
[/\bline\/[\d.]/i, 'line'],
|
|
91
|
+
[/instagram/i, 'instagram'],
|
|
92
|
+
[/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
|
|
93
|
+
[/naver\(inapp/i, 'naver'],
|
|
94
|
+
[/daumapps/i, 'daum'],
|
|
95
|
+
[/\bband\/[\d.]/i, 'band'],
|
|
96
|
+
[/micromessenger/i, 'wechat'],
|
|
97
|
+
[/twitter for|twitterandroid/i, 'twitter'],
|
|
98
|
+
[/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
|
|
99
|
+
];
|
|
74
100
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
75
101
|
'Google Chrome': 'Chrome',
|
|
76
102
|
'Microsoft Edge': 'Edge',
|
|
@@ -93,19 +119,18 @@ function resolveWindowsVersion(string) {
|
|
|
93
119
|
return '';
|
|
94
120
|
var mapped = {
|
|
95
121
|
'4.90': 'ME',
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
|
|
108
|
-
}[string];
|
|
122
|
+
'3.51': 'NT 3.51',
|
|
123
|
+
'4.0': 'NT 4.0',
|
|
124
|
+
'5.0': '2000',
|
|
125
|
+
'5.1': 'XP',
|
|
126
|
+
'5.2': 'XP',
|
|
127
|
+
'6.0': 'Vista',
|
|
128
|
+
'6.1': '7',
|
|
129
|
+
'6.2': '8',
|
|
130
|
+
'6.3': '8.1',
|
|
131
|
+
'6.4': '10',
|
|
132
|
+
'10.0': '10'
|
|
133
|
+
}[string.replace(/[^\d.]/g, '')];
|
|
109
134
|
if (typeof mapped !== 'undefined')
|
|
110
135
|
return mapped;
|
|
111
136
|
return string;
|
|
@@ -124,6 +149,28 @@ function resolveVersion(string, resolver) {
|
|
|
124
149
|
return '';
|
|
125
150
|
return string;
|
|
126
151
|
}
|
|
152
|
+
function compareVersion(lhs, rhs) {
|
|
153
|
+
var pa = lhs.split('.');
|
|
154
|
+
var pb = rhs.split('.');
|
|
155
|
+
var length = Math.max(pa.length, pb.length);
|
|
156
|
+
for (var i = 0; i < length; i++) {
|
|
157
|
+
var a = void 0;
|
|
158
|
+
var b = void 0;
|
|
159
|
+
if (i < pa.length)
|
|
160
|
+
a = parseInt(pa[i], 10);
|
|
161
|
+
else
|
|
162
|
+
a = 0;
|
|
163
|
+
if (i < pb.length)
|
|
164
|
+
b = parseInt(pb[i], 10);
|
|
165
|
+
else
|
|
166
|
+
b = 0;
|
|
167
|
+
if (a > b)
|
|
168
|
+
return 1;
|
|
169
|
+
if (a < b)
|
|
170
|
+
return -1;
|
|
171
|
+
}
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
127
174
|
function parseOS() {
|
|
128
175
|
var name = 'unknown';
|
|
129
176
|
var version = '';
|
|
@@ -136,7 +183,7 @@ function parseOS() {
|
|
|
136
183
|
break;
|
|
137
184
|
}
|
|
138
185
|
}
|
|
139
|
-
if (name === 'ios' &&
|
|
186
|
+
if (name === 'ios' && compareVersion(version, '18.6') === 0) {
|
|
140
187
|
var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
|
|
141
188
|
if (execs !== null) {
|
|
142
189
|
var major = parseInt(execs[1].split('.')[0], 10);
|
|
@@ -149,7 +196,7 @@ function parseOS() {
|
|
|
149
196
|
name = parsedFromHighEntropyValuesOSName;
|
|
150
197
|
if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
|
|
151
198
|
version = parsedFromHighEntropyValuesOSVersion;
|
|
152
|
-
if (name === 'macos' && typeof
|
|
199
|
+
if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
|
|
153
200
|
name = 'ios';
|
|
154
201
|
}
|
|
155
202
|
return {
|
|
@@ -201,6 +248,39 @@ function parseEngine() {
|
|
|
201
248
|
version: version
|
|
202
249
|
};
|
|
203
250
|
}
|
|
251
|
+
function parseInAppBrowser() {
|
|
252
|
+
for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
|
|
253
|
+
if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
|
|
254
|
+
return IN_APP_BROWSER_RESOLVER_MAP[i][1];
|
|
255
|
+
}
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
function parseWebview() {
|
|
259
|
+
if (/; ?wv\)/i.test(currentUserAgent))
|
|
260
|
+
return true;
|
|
261
|
+
if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
|
|
262
|
+
return true;
|
|
263
|
+
if (/\belectron\//i.test(currentUserAgent))
|
|
264
|
+
return true;
|
|
265
|
+
if (/(?:iphone|ipad|ipod)/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
|
|
266
|
+
return true;
|
|
267
|
+
return parseInAppBrowser() !== null;
|
|
268
|
+
}
|
|
269
|
+
function parseDevice() {
|
|
270
|
+
if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
271
|
+
return parsedFromHighEntropyValuesDevice;
|
|
272
|
+
var osName = getParsedCache().os.name;
|
|
273
|
+
if (osName === 'ios') {
|
|
274
|
+
if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
|
|
275
|
+
return 'tablet';
|
|
276
|
+
return 'mobile';
|
|
277
|
+
}
|
|
278
|
+
if (osName === 'android')
|
|
279
|
+
return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
|
|
280
|
+
if (osName === 'windows' || osName === 'macos')
|
|
281
|
+
return 'desktop';
|
|
282
|
+
return 'unknown';
|
|
283
|
+
}
|
|
204
284
|
function getParsedCache() {
|
|
205
285
|
if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
|
|
206
286
|
return parsedCache;
|
|
@@ -228,11 +308,31 @@ function normalizeBrand(entry) {
|
|
|
228
308
|
return { brand: entry, version: '' };
|
|
229
309
|
return { brand: entry.brand, version: entry.version };
|
|
230
310
|
}
|
|
311
|
+
function resolvedThenable() {
|
|
312
|
+
if (typeof Promise === 'function')
|
|
313
|
+
return Promise.resolve();
|
|
314
|
+
var thenable = {
|
|
315
|
+
then: function (onFulfilled) {
|
|
316
|
+
if (typeof onFulfilled === 'function')
|
|
317
|
+
onFulfilled(undefined);
|
|
318
|
+
return thenable;
|
|
319
|
+
},
|
|
320
|
+
catch: function () {
|
|
321
|
+
return thenable;
|
|
322
|
+
},
|
|
323
|
+
finally: function (onFinally) {
|
|
324
|
+
if (typeof onFinally === 'function')
|
|
325
|
+
onFinally();
|
|
326
|
+
return thenable;
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
return thenable;
|
|
330
|
+
}
|
|
231
331
|
function parseFromHighEntropyValues() {
|
|
232
332
|
if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
|
|
233
|
-
return
|
|
333
|
+
return resolvedThenable();
|
|
234
334
|
return USER_AGENT_DATA
|
|
235
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', '
|
|
335
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
|
|
236
336
|
.then(function (result) {
|
|
237
337
|
try {
|
|
238
338
|
var brands = result.fullVersionList || result.brands || [];
|
|
@@ -285,12 +385,26 @@ function parseFromHighEntropyValues() {
|
|
|
285
385
|
else if (/macos|macintel/i.test(platform))
|
|
286
386
|
parsedFromHighEntropyValuesOSName = 'macos';
|
|
287
387
|
}
|
|
288
|
-
|
|
388
|
+
var formFactors = result.formFactors;
|
|
389
|
+
if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
|
|
390
|
+
for (var i = 0; i < formFactors.length; i++) {
|
|
391
|
+
var formFactor = String(formFactors[i]).toLowerCase();
|
|
392
|
+
if (formFactor === 'tablet')
|
|
393
|
+
parsedFromHighEntropyValuesDevice = 'tablet';
|
|
394
|
+
else if (formFactor === 'mobile')
|
|
395
|
+
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
396
|
+
else if (formFactor === 'desktop')
|
|
397
|
+
parsedFromHighEntropyValuesDevice = 'desktop';
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
|
|
289
401
|
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
290
|
-
parsedCache = null;
|
|
291
402
|
}
|
|
292
403
|
catch (_) {
|
|
293
404
|
}
|
|
405
|
+
finally {
|
|
406
|
+
parsedCache = null;
|
|
407
|
+
}
|
|
294
408
|
})
|
|
295
409
|
.catch(function () {
|
|
296
410
|
parsedCache = null;
|
|
@@ -298,15 +412,29 @@ function parseFromHighEntropyValues() {
|
|
|
298
412
|
}
|
|
299
413
|
ready = parseFromHighEntropyValues();
|
|
300
414
|
var PlatformKit = {
|
|
301
|
-
version: packageJSON.version,
|
|
415
|
+
version: packageJSON$2.version,
|
|
302
416
|
get ready() {
|
|
303
417
|
return ready;
|
|
304
418
|
},
|
|
419
|
+
whenReady: function (callback) {
|
|
420
|
+
if (typeof callback !== 'function')
|
|
421
|
+
return;
|
|
422
|
+
ready.then(function () {
|
|
423
|
+
callback();
|
|
424
|
+
});
|
|
425
|
+
},
|
|
305
426
|
set userAgent(userAgent) {
|
|
306
427
|
if (currentUserAgent === userAgent)
|
|
307
428
|
return;
|
|
308
429
|
currentUserAgent = userAgent;
|
|
309
430
|
invalidateCache();
|
|
431
|
+
ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
|
|
432
|
+
},
|
|
433
|
+
reset: function () {
|
|
434
|
+
if (currentUserAgent === USER_AGENT)
|
|
435
|
+
return;
|
|
436
|
+
currentUserAgent = USER_AGENT;
|
|
437
|
+
invalidateCache();
|
|
310
438
|
ready = parseFromHighEntropyValues();
|
|
311
439
|
},
|
|
312
440
|
get userAgent() {
|
|
@@ -322,56 +450,799 @@ var PlatformKit = {
|
|
|
322
450
|
return getParsedCache().engine;
|
|
323
451
|
},
|
|
324
452
|
get device() {
|
|
325
|
-
|
|
326
|
-
return parsedFromHighEntropyValuesDevice;
|
|
327
|
-
var osName = getParsedCache().os.name;
|
|
328
|
-
if (osName === 'ios' || osName === 'android')
|
|
329
|
-
return 'mobile';
|
|
330
|
-
if (osName === 'windows' || osName === 'macos')
|
|
331
|
-
return 'desktop';
|
|
332
|
-
return 'unknown';
|
|
453
|
+
return parseDevice();
|
|
333
454
|
},
|
|
334
455
|
get webview() {
|
|
335
|
-
return
|
|
456
|
+
return parseWebview();
|
|
457
|
+
},
|
|
458
|
+
get inAppBrowser() {
|
|
459
|
+
return parseInAppBrowser();
|
|
336
460
|
},
|
|
337
461
|
get node() {
|
|
338
|
-
|
|
462
|
+
var nodeProcess = GLOBAL$5.process;
|
|
463
|
+
return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
|
|
339
464
|
},
|
|
340
465
|
get standalone() {
|
|
341
466
|
var osName = getParsedCache().os.name;
|
|
342
467
|
if (osName === 'ios')
|
|
343
|
-
return
|
|
344
|
-
if (typeof
|
|
468
|
+
return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
|
|
469
|
+
if (typeof GLOBAL$5.matchMedia !== 'function')
|
|
345
470
|
return false;
|
|
346
|
-
|
|
471
|
+
try {
|
|
472
|
+
return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
|
|
473
|
+
}
|
|
474
|
+
catch (_) {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
347
477
|
},
|
|
348
478
|
compareVersion: function (lhs, rhs) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
479
|
+
return compareVersion(lhs, rhs);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
function getGlobal$2() {
|
|
484
|
+
if (typeof globalThis !== 'undefined')
|
|
485
|
+
return globalThis;
|
|
486
|
+
if (typeof self !== 'undefined')
|
|
487
|
+
return self;
|
|
488
|
+
if (typeof window !== 'undefined')
|
|
489
|
+
return window;
|
|
490
|
+
if (typeof global !== 'undefined')
|
|
491
|
+
return global;
|
|
492
|
+
return {};
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
var version$1 = "0.0.1";
|
|
496
|
+
var packageJSON$1 = {
|
|
497
|
+
version: version$1};
|
|
498
|
+
|
|
499
|
+
var GLOBAL$3 = getGlobal$2();
|
|
500
|
+
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
501
|
+
// https://cordova.apache.org/docs/en/latest/cordova/events/events.html
|
|
502
|
+
var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
|
|
503
|
+
// iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
|
|
504
|
+
var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
|
|
505
|
+
var TYPE_ALIAS_MAP = {
|
|
506
|
+
'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
|
|
507
|
+
'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
|
|
508
|
+
'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
|
|
509
|
+
'pointerdown': ['pointerdown', 'MSPointerDown'],
|
|
510
|
+
'pointermove': ['pointermove', 'MSPointerMove'],
|
|
511
|
+
'pointerup': ['pointerup', 'MSPointerUp'],
|
|
512
|
+
'pointercancel': ['pointercancel', 'MSPointerCancel'],
|
|
513
|
+
'pointerover': ['pointerover', 'MSPointerOver'],
|
|
514
|
+
'pointerout': ['pointerout', 'MSPointerOut'],
|
|
515
|
+
'pointerenter': ['pointerenter', 'MSPointerEnter', 'mouseenter'],
|
|
516
|
+
'pointerleave': ['pointerleave', 'MSPointerLeave', 'mouseleave'],
|
|
517
|
+
'gotpointercapture': ['gotpointercapture', 'MSGotPointerCapture'],
|
|
518
|
+
'lostpointercapture': ['lostpointercapture', 'MSLostPointerCapture'],
|
|
519
|
+
'pointerlockchange': ['pointerlockchange', 'webkitpointerlockchange', 'mozpointerlockchange', 'mspointerlockchange'],
|
|
520
|
+
'pointerlockerror': ['pointerlockerror', 'webkitpointerlockerror', 'mozpointerlockerror', 'mspointerlockerror'],
|
|
521
|
+
'touchstart': ['touchstart', 'pointerdown', 'MSPointerDown'],
|
|
522
|
+
'touchmove': ['touchmove', 'pointermove', 'MSPointerMove'],
|
|
523
|
+
'touchend': ['touchend', 'pointerup', 'MSPointerUp'],
|
|
524
|
+
'touchcancel': ['touchcancel', 'pointercancel', 'MSPointerCancel'],
|
|
525
|
+
'transitionrun': ['transitionrun', 'webkitTransitionRun'],
|
|
526
|
+
'transitionstart': ['transitionstart', 'webkitTransitionStart'],
|
|
527
|
+
'transitionend': ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'otransitionend', 'MSTransitionEnd'],
|
|
528
|
+
'animationstart': ['animationstart', 'webkitAnimationStart', 'oanimationstart', 'MSAnimationStart'],
|
|
529
|
+
'animationiteration': ['animationiteration', 'webkitAnimationIteration', 'oanimationiteration', 'MSAnimationIteration'],
|
|
530
|
+
'animationend': ['animationend', 'webkitAnimationEnd', 'oanimationend', 'MSAnimationEnd'],
|
|
531
|
+
'visibilitychange': ['visibilitychange', 'webkitvisibilitychange', 'mozvisibilitychange', 'msvisibilitychange'],
|
|
532
|
+
};
|
|
533
|
+
var FULLSCREEN_REQUEST_MAP = {
|
|
534
|
+
'': ['requestFullscreen'],
|
|
535
|
+
'webkit': ['webkitRequestFullscreen', 'webkitRequestFullScreen'],
|
|
536
|
+
'moz': ['mozRequestFullScreen', 'mozRequestFullscreen'],
|
|
537
|
+
'ms': ['msRequestFullscreen'],
|
|
538
|
+
'MS': ['msRequestFullscreen'],
|
|
539
|
+
};
|
|
540
|
+
function asRecord(value) {
|
|
541
|
+
return value;
|
|
542
|
+
}
|
|
543
|
+
function hasOnProperty(host, name) {
|
|
544
|
+
if (typeof host === 'undefined' || host === null)
|
|
545
|
+
return false;
|
|
546
|
+
if (typeof asRecord(host)['on' + name] !== 'undefined')
|
|
547
|
+
return true;
|
|
548
|
+
var lower = name.toLowerCase();
|
|
549
|
+
return lower !== name && typeof asRecord(host)['on' + lower] !== 'undefined';
|
|
550
|
+
}
|
|
551
|
+
function probeHosts(target) {
|
|
552
|
+
var hosts = [target];
|
|
553
|
+
if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
|
|
554
|
+
hosts.push(GLOBAL$3.document);
|
|
555
|
+
if (target !== GLOBAL$3)
|
|
556
|
+
hosts.push(GLOBAL$3);
|
|
557
|
+
return hosts;
|
|
558
|
+
}
|
|
559
|
+
function extractVendorPrefix(name) {
|
|
560
|
+
for (var i = 1; i < VENDORS.length; i++) {
|
|
561
|
+
if (name.indexOf(VENDORS[i]) === 0)
|
|
562
|
+
return VENDORS[i];
|
|
563
|
+
}
|
|
564
|
+
return '';
|
|
565
|
+
}
|
|
566
|
+
function testStyleSupport(name, styleProperty) {
|
|
567
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
568
|
+
return false;
|
|
569
|
+
var style = GLOBAL$3.document.documentElement.style;
|
|
570
|
+
if (typeof style === 'undefined' || style === null)
|
|
571
|
+
return false;
|
|
572
|
+
var prefix = extractVendorPrefix(name);
|
|
573
|
+
var property;
|
|
574
|
+
if (prefix === '')
|
|
575
|
+
property = styleProperty;
|
|
576
|
+
else
|
|
577
|
+
property = prefix + styleProperty.charAt(0).toUpperCase() + styleProperty.slice(1);
|
|
578
|
+
return typeof asRecord(style)[property] !== 'undefined';
|
|
579
|
+
}
|
|
580
|
+
function testFullscreenSupport(name) {
|
|
581
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
582
|
+
return false;
|
|
583
|
+
var element = GLOBAL$3.document.documentElement;
|
|
584
|
+
var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
|
|
585
|
+
if (typeof methods === 'undefined')
|
|
586
|
+
return false;
|
|
587
|
+
for (var i = 0; i < methods.length; i++) {
|
|
588
|
+
if (typeof asRecord(element)[methods[i]] === 'function')
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
function isEventTypeSupported(target, name) {
|
|
594
|
+
var hosts = probeHosts(target);
|
|
595
|
+
for (var i = 0; i < hosts.length; i++) {
|
|
596
|
+
if (hasOnProperty(hosts[i], name))
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
var lower = name.toLowerCase();
|
|
600
|
+
if (lower.indexOf('transition') > -1)
|
|
601
|
+
return testStyleSupport(name, 'transition');
|
|
602
|
+
if (lower.indexOf('animation') > -1)
|
|
603
|
+
return testStyleSupport(name, 'animation');
|
|
604
|
+
if (lower.indexOf('fullscreen') > -1)
|
|
605
|
+
return testFullscreenSupport(name);
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
function resolveEventType(target, type) {
|
|
609
|
+
if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
|
|
610
|
+
return type;
|
|
611
|
+
if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
|
|
612
|
+
return type;
|
|
613
|
+
var candidates = typeof TYPE_ALIAS_MAP[type] !== 'undefined' ? TYPE_ALIAS_MAP[type] : [type];
|
|
614
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
615
|
+
if (isEventTypeSupported(target, candidates[i]))
|
|
616
|
+
return candidates[i];
|
|
617
|
+
}
|
|
618
|
+
var hosts = probeHosts(target);
|
|
619
|
+
for (var i = 1; i < VENDORS.length; i++) {
|
|
620
|
+
for (var j = 0; j < candidates.length; j++) {
|
|
621
|
+
var name_1 = VENDORS[i] + candidates[j];
|
|
622
|
+
for (var k = 0; k < hosts.length; k++) {
|
|
623
|
+
if (hasOnProperty(hosts[k], name_1))
|
|
624
|
+
return name_1;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return type;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
var GLOBAL$2 = getGlobal$2();
|
|
632
|
+
var SUPPORTED = {
|
|
633
|
+
once: false,
|
|
634
|
+
passive: false,
|
|
635
|
+
capture: false,
|
|
636
|
+
some: false,
|
|
637
|
+
all: false,
|
|
638
|
+
};
|
|
639
|
+
var NOOP$1 = function () {
|
|
640
|
+
};
|
|
641
|
+
function resolveProbeTarget() {
|
|
642
|
+
if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
|
|
643
|
+
try {
|
|
644
|
+
return GLOBAL$2.document.createDocumentFragment();
|
|
645
|
+
}
|
|
646
|
+
catch (_) {
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if (typeof GLOBAL$2.EventTarget === 'function') {
|
|
650
|
+
try {
|
|
651
|
+
return new GLOBAL$2.EventTarget();
|
|
652
|
+
}
|
|
653
|
+
catch (_) {
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return undefined;
|
|
657
|
+
}
|
|
658
|
+
(function detectSupportedListenerOptions() {
|
|
659
|
+
var probe = resolveProbeTarget();
|
|
660
|
+
if (typeof probe === 'undefined' || typeof probe.addEventListener !== 'function')
|
|
661
|
+
return;
|
|
662
|
+
var options = {};
|
|
663
|
+
try {
|
|
664
|
+
Object.defineProperty(options, 'once', {
|
|
665
|
+
get: function () {
|
|
666
|
+
SUPPORTED.once = true;
|
|
667
|
+
return false;
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
Object.defineProperty(options, 'passive', {
|
|
671
|
+
get: function () {
|
|
672
|
+
SUPPORTED.passive = true;
|
|
673
|
+
return false;
|
|
674
|
+
},
|
|
675
|
+
});
|
|
676
|
+
Object.defineProperty(options, 'capture', {
|
|
677
|
+
get: function () {
|
|
678
|
+
SUPPORTED.capture = true;
|
|
679
|
+
return false;
|
|
680
|
+
},
|
|
681
|
+
});
|
|
682
|
+
probe.addEventListener('test', NOOP$1, options);
|
|
683
|
+
probe.removeEventListener('test', NOOP$1, options);
|
|
684
|
+
}
|
|
685
|
+
catch (_) {
|
|
686
|
+
}
|
|
687
|
+
SUPPORTED.some = SUPPORTED.once || SUPPORTED.passive || SUPPORTED.capture;
|
|
688
|
+
SUPPORTED.all = SUPPORTED.once && SUPPORTED.passive && SUPPORTED.capture;
|
|
689
|
+
})();
|
|
690
|
+
var SUPPORTED_LISTENER_OPTIONS = SUPPORTED;
|
|
691
|
+
function normalizeListenerOptions(options) {
|
|
692
|
+
if (typeof options === 'boolean')
|
|
693
|
+
return { capture: options, once: false, passive: false, signal: undefined };
|
|
694
|
+
if (typeof options === 'object' && options !== null) {
|
|
695
|
+
return {
|
|
696
|
+
capture: options.capture === true,
|
|
697
|
+
once: options.once === true,
|
|
698
|
+
passive: options.passive === true,
|
|
699
|
+
signal: options.signal,
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
capture: Boolean(options),
|
|
704
|
+
once: false,
|
|
705
|
+
passive: false,
|
|
706
|
+
signal: undefined
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function toNativeListenerOptions(normalized) {
|
|
710
|
+
if (SUPPORTED.passive)
|
|
711
|
+
return {
|
|
712
|
+
capture: normalized.capture,
|
|
713
|
+
passive: normalized.passive
|
|
714
|
+
};
|
|
715
|
+
if (SUPPORTED.capture)
|
|
716
|
+
return {
|
|
717
|
+
capture: normalized.capture
|
|
718
|
+
};
|
|
719
|
+
return normalized.capture;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
var GLOBAL$1$1 = getGlobal$2();
|
|
723
|
+
var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
|
724
|
+
var POINTER_PHASE_MAP = {
|
|
725
|
+
'pointerdown': 'start',
|
|
726
|
+
'MSPointerDown': 'start',
|
|
727
|
+
'pointermove': 'move',
|
|
728
|
+
'MSPointerMove': 'move',
|
|
729
|
+
'pointerup': 'end',
|
|
730
|
+
'MSPointerUp': 'end',
|
|
731
|
+
'pointercancel': 'cancel',
|
|
732
|
+
'MSPointerCancel': 'cancel',
|
|
733
|
+
};
|
|
734
|
+
var ACTIVE_TOUCHES = [];
|
|
735
|
+
function isTouchEventType(type) {
|
|
736
|
+
return TOUCH_TYPES.indexOf(type) > -1;
|
|
737
|
+
}
|
|
738
|
+
function isPointerEventType(type) {
|
|
739
|
+
return typeof POINTER_PHASE_MAP[type] !== 'undefined';
|
|
740
|
+
}
|
|
741
|
+
function createTouchList(touches) {
|
|
742
|
+
var list = touches.slice();
|
|
743
|
+
list.item = function (index) {
|
|
744
|
+
if (index >= 0 && index < list.length)
|
|
745
|
+
return list[index];
|
|
746
|
+
return null;
|
|
747
|
+
};
|
|
748
|
+
return list;
|
|
749
|
+
}
|
|
750
|
+
function findTouchIndex(identifier) {
|
|
751
|
+
for (var i = 0; i < ACTIVE_TOUCHES.length; i++) {
|
|
752
|
+
if (ACTIVE_TOUCHES[i].identifier === identifier)
|
|
753
|
+
return i;
|
|
754
|
+
}
|
|
755
|
+
return -1;
|
|
756
|
+
}
|
|
757
|
+
function scrollOffsetX() {
|
|
758
|
+
if (typeof GLOBAL$1$1.pageXOffset === 'number')
|
|
759
|
+
return GLOBAL$1$1.pageXOffset;
|
|
760
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
761
|
+
return GLOBAL$1$1.document.documentElement.scrollLeft;
|
|
762
|
+
return 0;
|
|
763
|
+
}
|
|
764
|
+
function scrollOffsetY() {
|
|
765
|
+
if (typeof GLOBAL$1$1.pageYOffset === 'number')
|
|
766
|
+
return GLOBAL$1$1.pageYOffset;
|
|
767
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
768
|
+
return GLOBAL$1$1.document.documentElement.scrollTop;
|
|
769
|
+
return 0;
|
|
770
|
+
}
|
|
771
|
+
function createSyntheticTouch(event, target) {
|
|
772
|
+
var clientX = typeof event.clientX === 'number' ? event.clientX : 0;
|
|
773
|
+
var clientY = typeof event.clientY === 'number' ? event.clientY : 0;
|
|
774
|
+
return {
|
|
775
|
+
identifier: typeof event.pointerId === 'number' ? event.pointerId : 0,
|
|
776
|
+
target: target,
|
|
777
|
+
screenX: typeof event.screenX === 'number' ? event.screenX : 0,
|
|
778
|
+
screenY: typeof event.screenY === 'number' ? event.screenY : 0,
|
|
779
|
+
clientX: clientX,
|
|
780
|
+
clientY: clientY,
|
|
781
|
+
pageX: typeof event.pageX === 'number' ? event.pageX : clientX + scrollOffsetX(),
|
|
782
|
+
pageY: typeof event.pageY === 'number' ? event.pageY : clientY + scrollOffsetY(),
|
|
783
|
+
radiusX: typeof event.width === 'number' ? event.width / 2 : 0,
|
|
784
|
+
radiusY: typeof event.height === 'number' ? event.height / 2 : 0,
|
|
785
|
+
rotationAngle: typeof event.rotation === 'number' ? event.rotation : 0,
|
|
786
|
+
force: typeof event.pressure === 'number' ? event.pressure : 0,
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function defineTouchList(event, property, list, patches) {
|
|
790
|
+
var holder = event;
|
|
791
|
+
var had = false;
|
|
792
|
+
try {
|
|
793
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
794
|
+
}
|
|
795
|
+
catch (_) {
|
|
796
|
+
}
|
|
797
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
798
|
+
try {
|
|
799
|
+
Object.defineProperty(event, property, { value: list, configurable: true });
|
|
800
|
+
}
|
|
801
|
+
catch (_) {
|
|
802
|
+
holder[property] = list;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function filterByTarget(touches, target) {
|
|
806
|
+
var filtered = [];
|
|
807
|
+
for (var i = 0; i < touches.length; i++) {
|
|
808
|
+
if (touches[i].target === target)
|
|
809
|
+
filtered.push(touches[i]);
|
|
810
|
+
}
|
|
811
|
+
return filtered;
|
|
812
|
+
}
|
|
813
|
+
function synthesizeTouchEvent(event, resolvedType, patches) {
|
|
814
|
+
var phase = POINTER_PHASE_MAP[resolvedType];
|
|
815
|
+
if (typeof phase === 'undefined')
|
|
816
|
+
return;
|
|
817
|
+
var pointerEvent = event;
|
|
818
|
+
var eventTarget = event.target;
|
|
819
|
+
var index = findTouchIndex(typeof pointerEvent.pointerId === 'number' ? pointerEvent.pointerId : 0);
|
|
820
|
+
var originTarget = index > -1 ? ACTIVE_TOUCHES[index].target : eventTarget;
|
|
821
|
+
var touch = createSyntheticTouch(pointerEvent, originTarget);
|
|
822
|
+
if (phase === 'start' || phase === 'move') {
|
|
823
|
+
if (index > -1)
|
|
824
|
+
ACTIVE_TOUCHES[index] = touch;
|
|
825
|
+
else
|
|
826
|
+
ACTIVE_TOUCHES.push(touch);
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
if (index > -1)
|
|
830
|
+
ACTIVE_TOUCHES.splice(index, 1);
|
|
831
|
+
}
|
|
832
|
+
defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
|
|
833
|
+
defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
|
|
834
|
+
defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
var KEY_CODE_MAP = {
|
|
838
|
+
8: 'Backspace',
|
|
839
|
+
9: 'Tab',
|
|
840
|
+
12: 'Numpad5',
|
|
841
|
+
13: 'Enter',
|
|
842
|
+
16: 'ShiftLeft',
|
|
843
|
+
17: 'ControlLeft',
|
|
844
|
+
18: 'AltLeft',
|
|
845
|
+
19: 'Pause',
|
|
846
|
+
20: 'CapsLock',
|
|
847
|
+
27: 'Escape',
|
|
848
|
+
32: 'Space',
|
|
849
|
+
33: 'PageUp',
|
|
850
|
+
34: 'PageDown',
|
|
851
|
+
35: 'End',
|
|
852
|
+
36: 'Home',
|
|
853
|
+
37: 'ArrowLeft',
|
|
854
|
+
38: 'ArrowUp',
|
|
855
|
+
39: 'ArrowRight',
|
|
856
|
+
40: 'ArrowDown',
|
|
857
|
+
45: 'Insert',
|
|
858
|
+
46: 'Delete',
|
|
859
|
+
48: 'Digit0',
|
|
860
|
+
49: 'Digit1',
|
|
861
|
+
50: 'Digit2',
|
|
862
|
+
51: 'Digit3',
|
|
863
|
+
52: 'Digit4',
|
|
864
|
+
53: 'Digit5',
|
|
865
|
+
54: 'Digit6',
|
|
866
|
+
55: 'Digit7',
|
|
867
|
+
56: 'Digit8',
|
|
868
|
+
57: 'Digit9',
|
|
869
|
+
65: 'KeyA',
|
|
870
|
+
66: 'KeyB',
|
|
871
|
+
67: 'KeyC',
|
|
872
|
+
68: 'KeyD',
|
|
873
|
+
69: 'KeyE',
|
|
874
|
+
70: 'KeyF',
|
|
875
|
+
71: 'KeyG',
|
|
876
|
+
72: 'KeyH',
|
|
877
|
+
73: 'KeyI',
|
|
878
|
+
74: 'KeyJ',
|
|
879
|
+
75: 'KeyK',
|
|
880
|
+
76: 'KeyL',
|
|
881
|
+
77: 'KeyM',
|
|
882
|
+
78: 'KeyN',
|
|
883
|
+
79: 'KeyO',
|
|
884
|
+
80: 'KeyP',
|
|
885
|
+
81: 'KeyQ',
|
|
886
|
+
82: 'KeyR',
|
|
887
|
+
83: 'KeyS',
|
|
888
|
+
84: 'KeyT',
|
|
889
|
+
85: 'KeyU',
|
|
890
|
+
86: 'KeyV',
|
|
891
|
+
87: 'KeyW',
|
|
892
|
+
88: 'KeyX',
|
|
893
|
+
89: 'KeyY',
|
|
894
|
+
90: 'KeyZ',
|
|
895
|
+
91: 'MetaLeft',
|
|
896
|
+
92: 'MetaRight',
|
|
897
|
+
93: 'ContextMenu',
|
|
898
|
+
96: 'Numpad0',
|
|
899
|
+
97: 'Numpad1',
|
|
900
|
+
98: 'Numpad2',
|
|
901
|
+
99: 'Numpad3',
|
|
902
|
+
100: 'Numpad4',
|
|
903
|
+
101: 'Numpad5',
|
|
904
|
+
102: 'Numpad6',
|
|
905
|
+
103: 'Numpad7',
|
|
906
|
+
104: 'Numpad8',
|
|
907
|
+
105: 'Numpad9',
|
|
908
|
+
106: 'NumpadMultiply',
|
|
909
|
+
107: 'NumpadAdd',
|
|
910
|
+
109: 'NumpadSubtract',
|
|
911
|
+
110: 'NumpadDecimal',
|
|
912
|
+
111: 'NumpadDivide',
|
|
913
|
+
112: 'F1',
|
|
914
|
+
113: 'F2',
|
|
915
|
+
114: 'F3',
|
|
916
|
+
115: 'F4',
|
|
917
|
+
116: 'F5',
|
|
918
|
+
117: 'F6',
|
|
919
|
+
118: 'F7',
|
|
920
|
+
119: 'F8',
|
|
921
|
+
120: 'F9',
|
|
922
|
+
121: 'F10',
|
|
923
|
+
122: 'F11',
|
|
924
|
+
123: 'F12',
|
|
925
|
+
144: 'NumLock',
|
|
926
|
+
145: 'ScrollLock',
|
|
927
|
+
186: 'Semicolon',
|
|
928
|
+
187: 'Equal',
|
|
929
|
+
188: 'Comma',
|
|
930
|
+
189: 'Minus',
|
|
931
|
+
190: 'Period',
|
|
932
|
+
191: 'Slash',
|
|
933
|
+
192: 'Backquote',
|
|
934
|
+
219: 'BracketLeft',
|
|
935
|
+
220: 'Backslash',
|
|
936
|
+
221: 'BracketRight',
|
|
937
|
+
222: 'Quote',
|
|
938
|
+
226: 'IntlBackslash',
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
var GLOBAL$4 = getGlobal$2();
|
|
942
|
+
var LISTENER_STORE = [];
|
|
943
|
+
var NOOP = function () {
|
|
944
|
+
};
|
|
945
|
+
// Records live on the target itself, so they are collected with it and lookups only scan
|
|
946
|
+
// that target's own listeners. Targets that reject the expando fall back to LISTENER_STORE.
|
|
947
|
+
var STORE_KEY = '__webEventKitListeners__';
|
|
948
|
+
function resolveBucket(target, create) {
|
|
949
|
+
var holder = target;
|
|
950
|
+
try {
|
|
951
|
+
var existing = holder[STORE_KEY];
|
|
952
|
+
if (typeof existing !== 'undefined' && existing !== null)
|
|
953
|
+
return existing;
|
|
954
|
+
if (!create)
|
|
955
|
+
return LISTENER_STORE;
|
|
956
|
+
var bucket = [];
|
|
957
|
+
try {
|
|
958
|
+
Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
|
|
959
|
+
}
|
|
960
|
+
catch (_) {
|
|
961
|
+
holder[STORE_KEY] = bucket;
|
|
962
|
+
}
|
|
963
|
+
if (holder[STORE_KEY] !== bucket)
|
|
964
|
+
return LISTENER_STORE;
|
|
965
|
+
return bucket;
|
|
966
|
+
}
|
|
967
|
+
catch (_) {
|
|
968
|
+
return LISTENER_STORE;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
function findListenerRecord(target, type, callback, capture) {
|
|
972
|
+
var bucket = resolveBucket(target, false);
|
|
973
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
974
|
+
var record = bucket[i];
|
|
975
|
+
if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
|
|
976
|
+
return record;
|
|
977
|
+
}
|
|
978
|
+
return undefined;
|
|
979
|
+
}
|
|
980
|
+
function removeListenerRecord(record) {
|
|
981
|
+
var bucket = record.bucket;
|
|
982
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
983
|
+
if (bucket[i] === record) {
|
|
984
|
+
bucket.splice(i, 1);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
function preventDefaultPolyfill() {
|
|
990
|
+
this.returnValue = false;
|
|
991
|
+
}
|
|
992
|
+
function stopPropagationPolyfill() {
|
|
993
|
+
this.cancelBubble = true;
|
|
994
|
+
}
|
|
995
|
+
function passivePreventDefault() {
|
|
996
|
+
// Per spec, preventDefault() inside a passive listener does nothing.
|
|
997
|
+
}
|
|
998
|
+
function invokeCallback(callback, target, event) {
|
|
999
|
+
if (typeof callback === 'function')
|
|
1000
|
+
return callback.call(target, event);
|
|
1001
|
+
if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
|
|
1002
|
+
return callback.handleEvent(event);
|
|
1003
|
+
}
|
|
1004
|
+
// The same Event object is handed to every listener, so any property this kit overrides has
|
|
1005
|
+
// to be put back before the next one runs — otherwise a `pointerdown` listener would observe
|
|
1006
|
+
// the `touchstart` type and synthetic touches written by a listener registered before it.
|
|
1007
|
+
function patchEventProperty(event, property, value, patches) {
|
|
1008
|
+
var holder = event;
|
|
1009
|
+
var had = false;
|
|
1010
|
+
try {
|
|
1011
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
1012
|
+
}
|
|
1013
|
+
catch (_) {
|
|
1014
|
+
}
|
|
1015
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
1016
|
+
defineEventProperty(event, property, value);
|
|
1017
|
+
}
|
|
1018
|
+
function restoreEventProperties(event, patches) {
|
|
1019
|
+
var holder = event;
|
|
1020
|
+
for (var i = patches.length - 1; i >= 0; i--) {
|
|
1021
|
+
var patch = patches[i];
|
|
1022
|
+
try {
|
|
1023
|
+
if (patch.had)
|
|
1024
|
+
defineEventProperty(event, patch.property, patch.previous);
|
|
361
1025
|
else
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (a < b)
|
|
366
|
-
return -1;
|
|
1026
|
+
delete holder[patch.property];
|
|
1027
|
+
}
|
|
1028
|
+
catch (_) {
|
|
367
1029
|
}
|
|
368
|
-
return 0;
|
|
369
1030
|
}
|
|
1031
|
+
patches.length = 0;
|
|
1032
|
+
}
|
|
1033
|
+
function defineEventProperty(event, property, value) {
|
|
1034
|
+
try {
|
|
1035
|
+
Object.defineProperty(event, property, { value: value, configurable: true });
|
|
1036
|
+
}
|
|
1037
|
+
catch (_) {
|
|
1038
|
+
try {
|
|
1039
|
+
event[property] = value;
|
|
1040
|
+
}
|
|
1041
|
+
catch (__) {
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function fixLegacyEvent(event, target) {
|
|
1046
|
+
if (typeof event.currentTarget === 'undefined' || event.currentTarget === null)
|
|
1047
|
+
defineEventProperty(event, 'currentTarget', target);
|
|
1048
|
+
if ((typeof event.target === 'undefined' || event.target === null) && typeof event.srcElement !== 'undefined')
|
|
1049
|
+
defineEventProperty(event, 'target', event.srcElement);
|
|
1050
|
+
if (typeof event.preventDefault !== 'function')
|
|
1051
|
+
event.preventDefault = preventDefaultPolyfill.bind(event);
|
|
1052
|
+
if (typeof event.stopPropagation !== 'function')
|
|
1053
|
+
event.stopPropagation = stopPropagationPolyfill.bind(event);
|
|
1054
|
+
}
|
|
1055
|
+
function fixKeyboardEvent(event) {
|
|
1056
|
+
if (typeof event.keyCode === 'number' && typeof event.code === 'undefined') {
|
|
1057
|
+
var code = KEY_CODE_MAP[event.keyCode];
|
|
1058
|
+
if (typeof code === 'string')
|
|
1059
|
+
defineEventProperty(event, 'code', code);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
function createDispatcher(record) {
|
|
1063
|
+
return function (event) {
|
|
1064
|
+
if (typeof event === 'undefined')
|
|
1065
|
+
event = GLOBAL$4.event; // IE: implicit global event object
|
|
1066
|
+
if (typeof event === 'undefined' || event === null)
|
|
1067
|
+
return;
|
|
1068
|
+
if (record.released)
|
|
1069
|
+
return;
|
|
1070
|
+
fixLegacyEvent(event, record.target);
|
|
1071
|
+
if (record.once)
|
|
1072
|
+
releaseListenerRecord(record);
|
|
1073
|
+
var patches = [];
|
|
1074
|
+
if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
|
|
1075
|
+
patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
|
|
1076
|
+
if (record.resolvedType !== record.type)
|
|
1077
|
+
patchEventProperty(event, 'type', record.type, patches);
|
|
1078
|
+
if (record.touch)
|
|
1079
|
+
synthesizeTouchEvent(event, record.resolvedType, patches);
|
|
1080
|
+
fixKeyboardEvent(event);
|
|
1081
|
+
try {
|
|
1082
|
+
invokeCallback(record.callback, record.target, event);
|
|
1083
|
+
}
|
|
1084
|
+
finally {
|
|
1085
|
+
restoreEventProperties(event, patches);
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
function attachNativeListener(record) {
|
|
1090
|
+
var target = record.target;
|
|
1091
|
+
if (typeof target.addEventListener === 'function') {
|
|
1092
|
+
target.addEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
|
|
1093
|
+
return true;
|
|
1094
|
+
}
|
|
1095
|
+
if (typeof target.attachEvent === 'function') {
|
|
1096
|
+
target.attachEvent('on' + record.resolvedType, record.wrapper);
|
|
1097
|
+
return true;
|
|
1098
|
+
}
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1101
|
+
function detachNativeListener(record) {
|
|
1102
|
+
var target = record.target;
|
|
1103
|
+
if (typeof target.removeEventListener === 'function')
|
|
1104
|
+
return target.removeEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
|
|
1105
|
+
if (typeof target.detachEvent === 'function')
|
|
1106
|
+
return target.detachEvent('on' + record.resolvedType, record.wrapper);
|
|
1107
|
+
}
|
|
1108
|
+
function releaseListenerRecord(record) {
|
|
1109
|
+
if (record.released)
|
|
1110
|
+
return;
|
|
1111
|
+
record.released = true;
|
|
1112
|
+
removeListenerRecord(record);
|
|
1113
|
+
try {
|
|
1114
|
+
detachNativeListener(record);
|
|
1115
|
+
}
|
|
1116
|
+
catch (_) {
|
|
1117
|
+
}
|
|
1118
|
+
if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
|
|
1119
|
+
try {
|
|
1120
|
+
record.signal.removeEventListener('abort', record.onAbort, false);
|
|
1121
|
+
}
|
|
1122
|
+
catch (_) {
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
record.onAbort = undefined;
|
|
1126
|
+
}
|
|
1127
|
+
function createEventPolyfill(type, init) {
|
|
1128
|
+
try {
|
|
1129
|
+
return new Event(type, init);
|
|
1130
|
+
}
|
|
1131
|
+
catch (_) {
|
|
1132
|
+
}
|
|
1133
|
+
var event = GLOBAL$4.document.createEvent('Event');
|
|
1134
|
+
event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
|
|
1135
|
+
return event;
|
|
1136
|
+
}
|
|
1137
|
+
function createCustomEventPolyfill(type, init) {
|
|
1138
|
+
try {
|
|
1139
|
+
return new CustomEvent(type, init);
|
|
1140
|
+
}
|
|
1141
|
+
catch (_) {
|
|
1142
|
+
}
|
|
1143
|
+
var event = GLOBAL$4.document.createEvent('CustomEvent');
|
|
1144
|
+
event.initCustomEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true, typeof init !== 'undefined' && typeof init.detail !== 'undefined' ? init.detail : null);
|
|
1145
|
+
return event;
|
|
1146
|
+
}
|
|
1147
|
+
var EventKit = {
|
|
1148
|
+
version: packageJSON$1.version,
|
|
1149
|
+
utils: {
|
|
1150
|
+
get supportedOptions() {
|
|
1151
|
+
return {
|
|
1152
|
+
once: SUPPORTED_LISTENER_OPTIONS.once,
|
|
1153
|
+
passive: SUPPORTED_LISTENER_OPTIONS.passive,
|
|
1154
|
+
capture: SUPPORTED_LISTENER_OPTIONS.capture,
|
|
1155
|
+
some: SUPPORTED_LISTENER_OPTIONS.some,
|
|
1156
|
+
all: SUPPORTED_LISTENER_OPTIONS.all,
|
|
1157
|
+
};
|
|
1158
|
+
},
|
|
1159
|
+
resolveType: resolveEventType,
|
|
1160
|
+
createEvent: createEventPolyfill,
|
|
1161
|
+
createCustomEvent: createCustomEventPolyfill,
|
|
1162
|
+
},
|
|
1163
|
+
add: function (target, type, callback, options) {
|
|
1164
|
+
if (typeof target === 'undefined' || target === null)
|
|
1165
|
+
return NOOP;
|
|
1166
|
+
if (typeof type !== 'string' || type.length === 0)
|
|
1167
|
+
return NOOP;
|
|
1168
|
+
if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
|
|
1169
|
+
return NOOP;
|
|
1170
|
+
var normalized = normalizeListenerOptions(options);
|
|
1171
|
+
var existing = findListenerRecord(target, type, callback, normalized.capture);
|
|
1172
|
+
// Native `addEventListener` ignores a duplicate registration, so hand back a releaser
|
|
1173
|
+
// that does nothing rather than one that would detach the first caller's listener.
|
|
1174
|
+
if (typeof existing !== 'undefined')
|
|
1175
|
+
return NOOP;
|
|
1176
|
+
if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
|
|
1177
|
+
return NOOP;
|
|
1178
|
+
var resolvedType = resolveEventType(target, type);
|
|
1179
|
+
var bucket = resolveBucket(target, true);
|
|
1180
|
+
var record = {
|
|
1181
|
+
bucket: bucket,
|
|
1182
|
+
target: target,
|
|
1183
|
+
type: type,
|
|
1184
|
+
callback: callback,
|
|
1185
|
+
wrapper: NOOP,
|
|
1186
|
+
resolvedType: resolvedType,
|
|
1187
|
+
capture: normalized.capture,
|
|
1188
|
+
once: normalized.once,
|
|
1189
|
+
passive: normalized.passive,
|
|
1190
|
+
signal: normalized.signal,
|
|
1191
|
+
onAbort: undefined,
|
|
1192
|
+
touch: isTouchEventType(type) && isPointerEventType(resolvedType),
|
|
1193
|
+
released: false,
|
|
1194
|
+
};
|
|
1195
|
+
record.wrapper = createDispatcher(record);
|
|
1196
|
+
if (!attachNativeListener(record))
|
|
1197
|
+
return NOOP;
|
|
1198
|
+
bucket.push(record);
|
|
1199
|
+
if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
|
|
1200
|
+
record.onAbort = function () {
|
|
1201
|
+
releaseListenerRecord(record);
|
|
1202
|
+
};
|
|
1203
|
+
// Engines without listener-options coerce `{once: true}` to capture, which would then
|
|
1204
|
+
// fail to match on removal; releaseListenerRecord detaches this anyway.
|
|
1205
|
+
record.signal.addEventListener('abort', record.onAbort, false);
|
|
1206
|
+
}
|
|
1207
|
+
return function () {
|
|
1208
|
+
releaseListenerRecord(record);
|
|
1209
|
+
};
|
|
1210
|
+
},
|
|
1211
|
+
remove: function (target, type, callback, options) {
|
|
1212
|
+
if (typeof target === 'undefined' || target === null)
|
|
1213
|
+
return;
|
|
1214
|
+
if (typeof type !== 'string' || type.length === 0)
|
|
1215
|
+
return;
|
|
1216
|
+
if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
|
|
1217
|
+
return;
|
|
1218
|
+
var normalized = normalizeListenerOptions(options);
|
|
1219
|
+
var record = findListenerRecord(target, type, callback, normalized.capture);
|
|
1220
|
+
if (typeof record !== 'undefined')
|
|
1221
|
+
return releaseListenerRecord(record);
|
|
1222
|
+
var resolvedType = resolveEventType(target, type);
|
|
1223
|
+
if (typeof target.removeEventListener === 'function')
|
|
1224
|
+
return target.removeEventListener(resolvedType, callback, toNativeListenerOptions(normalized));
|
|
1225
|
+
if (typeof target.detachEvent === 'function' && typeof callback === 'function')
|
|
1226
|
+
return target.detachEvent('on' + resolvedType, callback);
|
|
1227
|
+
},
|
|
370
1228
|
};
|
|
371
1229
|
|
|
1230
|
+
function getGlobal$1() {
|
|
1231
|
+
if (typeof globalThis !== 'undefined')
|
|
1232
|
+
return globalThis;
|
|
1233
|
+
if (typeof self !== 'undefined')
|
|
1234
|
+
return self;
|
|
1235
|
+
if (typeof window !== 'undefined')
|
|
1236
|
+
return window;
|
|
1237
|
+
if (typeof global !== 'undefined')
|
|
1238
|
+
return global;
|
|
1239
|
+
return {};
|
|
1240
|
+
}
|
|
1241
|
+
|
|
372
1242
|
function createHiddenElement(tagName, focusable) {
|
|
373
1243
|
if (focusable === void 0) { focusable = true; }
|
|
374
|
-
var
|
|
1244
|
+
var document = getGlobal$1().document;
|
|
1245
|
+
var element = document.createElement(tagName);
|
|
375
1246
|
if (typeof element.width !== 'undefined')
|
|
376
1247
|
element.width = '0';
|
|
377
1248
|
if (typeof element.height !== 'undefined')
|
|
@@ -422,116 +1293,301 @@ function createHiddenElement(tagName, focusable) {
|
|
|
422
1293
|
return element;
|
|
423
1294
|
}
|
|
424
1295
|
|
|
425
|
-
var
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
1296
|
+
var version = "0.0.5";
|
|
1297
|
+
var packageJSON = {
|
|
1298
|
+
version: version};
|
|
1299
|
+
|
|
1300
|
+
var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
|
|
1301
|
+
var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
|
|
1302
|
+
var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
|
|
1303
|
+
var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
|
|
1304
|
+
var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
|
|
1305
|
+
var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
|
|
1306
|
+
var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
|
|
1307
|
+
var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
|
|
1308
|
+
function getGlobal() {
|
|
1309
|
+
if (typeof globalThis !== 'undefined')
|
|
1310
|
+
return globalThis;
|
|
1311
|
+
if (typeof self !== 'undefined')
|
|
1312
|
+
return self;
|
|
1313
|
+
if (typeof window !== 'undefined')
|
|
1314
|
+
return window;
|
|
1315
|
+
if (typeof global !== 'undefined')
|
|
1316
|
+
return global;
|
|
1317
|
+
return {};
|
|
1318
|
+
}
|
|
1319
|
+
function freeze(values) {
|
|
1320
|
+
return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
|
|
1321
|
+
}
|
|
1322
|
+
function contains(values, value) {
|
|
1323
|
+
for (var i = 0; i < values.length; i++) {
|
|
1324
|
+
if (values[i] === value)
|
|
1325
|
+
return true;
|
|
1326
|
+
}
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1329
|
+
function getIntlLocaleConstructor() {
|
|
1330
|
+
if (typeof Intl === 'undefined')
|
|
1331
|
+
return undefined;
|
|
1332
|
+
var constructor = Intl.Locale;
|
|
1333
|
+
return typeof constructor === 'function' ? constructor : undefined;
|
|
1334
|
+
}
|
|
1335
|
+
function parseTag(raw) {
|
|
1336
|
+
if (raw === null || typeof raw !== 'string')
|
|
1337
|
+
return null;
|
|
1338
|
+
var value = raw.replace(/_/g, '-');
|
|
1339
|
+
if (value.length === 0)
|
|
430
1340
|
return null;
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (
|
|
1341
|
+
if (value === 'C' || value.toLowerCase() === 'posix')
|
|
1342
|
+
value = 'en-US';
|
|
1343
|
+
var dot = value.indexOf('.');
|
|
1344
|
+
if (dot !== -1)
|
|
1345
|
+
value = value.slice(0, dot);
|
|
1346
|
+
var at = value.indexOf('@');
|
|
1347
|
+
if (at !== -1)
|
|
1348
|
+
value = value.slice(0, at);
|
|
1349
|
+
if (value.length === 0)
|
|
440
1350
|
return null;
|
|
441
|
-
|
|
442
|
-
if (
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1351
|
+
var segments = value.split('-');
|
|
1352
|
+
if (LANGUAGE_PATTERN.test(segments[0]) === false)
|
|
1353
|
+
return null;
|
|
1354
|
+
var language = segments[0].toLowerCase();
|
|
1355
|
+
var index = 1;
|
|
1356
|
+
var script = null;
|
|
1357
|
+
if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
|
|
1358
|
+
script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
|
|
1359
|
+
index++;
|
|
1360
|
+
}
|
|
1361
|
+
var region = null;
|
|
1362
|
+
if (index < segments.length && REGION_PATTERN.test(segments[index])) {
|
|
1363
|
+
region = segments[index].toUpperCase();
|
|
1364
|
+
index++;
|
|
1365
|
+
}
|
|
1366
|
+
var variants = [];
|
|
1367
|
+
while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
|
|
1368
|
+
variants.push(segments[index].toLowerCase());
|
|
1369
|
+
index++;
|
|
1370
|
+
}
|
|
1371
|
+
var extensions = [];
|
|
1372
|
+
while (index < segments.length) {
|
|
1373
|
+
var singleton = segments[index];
|
|
1374
|
+
if (SINGLETON_PATTERN.test(singleton) === false)
|
|
1375
|
+
return null;
|
|
1376
|
+
var isPrivateUse = singleton.toLowerCase() === 'x';
|
|
1377
|
+
var parts = [singleton.toLowerCase()];
|
|
1378
|
+
index++;
|
|
1379
|
+
while (index < segments.length) {
|
|
1380
|
+
var segment = segments[index];
|
|
1381
|
+
if (EXTENSION_PATTERN.test(segment) === false)
|
|
1382
|
+
return null;
|
|
1383
|
+
if (segment.length === 1 && isPrivateUse === false)
|
|
1384
|
+
break;
|
|
1385
|
+
parts.push(segment.toLowerCase());
|
|
1386
|
+
index++;
|
|
1387
|
+
}
|
|
1388
|
+
if (parts.length < 2)
|
|
1389
|
+
return null;
|
|
1390
|
+
extensions.push(parts.join('-'));
|
|
1391
|
+
}
|
|
1392
|
+
var base = [language];
|
|
1393
|
+
if (script !== null)
|
|
1394
|
+
base.push(script);
|
|
1395
|
+
if (region !== null)
|
|
1396
|
+
base.push(region);
|
|
1397
|
+
for (var i = 0; i < variants.length; i++)
|
|
1398
|
+
base.push(variants[i]);
|
|
1399
|
+
var baseName = base.join('-');
|
|
1400
|
+
return {
|
|
1401
|
+
tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
|
|
1402
|
+
baseName: baseName,
|
|
1403
|
+
language: language,
|
|
1404
|
+
script: script,
|
|
1405
|
+
region: region,
|
|
1406
|
+
variants: freeze(variants),
|
|
1407
|
+
extensions: freeze(extensions),
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
function isRTL(subtags) {
|
|
1411
|
+
if (subtags.script !== null)
|
|
1412
|
+
return contains(RTL_SCRIPTS, subtags.script);
|
|
1413
|
+
return contains(RTL_LANGUAGES, subtags.language);
|
|
1414
|
+
}
|
|
1415
|
+
function expandTag(tag) {
|
|
1416
|
+
var parsed = parseTag(tag);
|
|
1417
|
+
if (parsed === null)
|
|
1418
|
+
return freeze([]);
|
|
1419
|
+
var segments = parsed.baseName.split('-');
|
|
1420
|
+
var chain = [];
|
|
1421
|
+
for (var i = segments.length; i > 0; i--)
|
|
1422
|
+
chain.push(segments.slice(0, i).join('-'));
|
|
1423
|
+
return freeze(chain);
|
|
1424
|
+
}
|
|
1425
|
+
function toLookupKey(tag) {
|
|
1426
|
+
var parsed = parseTag(tag);
|
|
1427
|
+
return (parsed === null ? tag : parsed.baseName).toLowerCase();
|
|
1428
|
+
}
|
|
1429
|
+
function lookupTag(supported, preferred, fallback) {
|
|
1430
|
+
if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
|
|
1431
|
+
return fallback;
|
|
1432
|
+
var keys = [];
|
|
1433
|
+
for (var i = 0; i < supported.length; i++)
|
|
1434
|
+
keys.push(toLookupKey(supported[i]));
|
|
1435
|
+
for (var i = 0; i < preferred.length; i++) {
|
|
1436
|
+
var chain = expandTag(preferred[i]);
|
|
1437
|
+
for (var j = 0; j < chain.length; j++) {
|
|
1438
|
+
var candidate = chain[j].toLowerCase();
|
|
1439
|
+
var prefix = candidate + '-';
|
|
1440
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1441
|
+
if (keys[k] === candidate)
|
|
1442
|
+
return supported[k];
|
|
1443
|
+
}
|
|
1444
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1445
|
+
if (keys[k].indexOf(prefix) === 0)
|
|
1446
|
+
return supported[k];
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return fallback;
|
|
1451
|
+
}
|
|
1452
|
+
function resolveDirection(primary) {
|
|
1453
|
+
if (primary === null)
|
|
1454
|
+
return false;
|
|
1455
|
+
var IntlLocale = getIntlLocaleConstructor();
|
|
1456
|
+
if (typeof IntlLocale !== 'undefined') {
|
|
1457
|
+
try {
|
|
1458
|
+
var intlLocale = new IntlLocale(primary.tag);
|
|
1459
|
+
if (typeof intlLocale.getTextInfo === 'function')
|
|
1460
|
+
return intlLocale.getTextInfo().direction === 'rtl';
|
|
1461
|
+
if (typeof intlLocale.textInfo !== 'undefined')
|
|
1462
|
+
return intlLocale.textInfo.direction === 'rtl';
|
|
1463
|
+
}
|
|
1464
|
+
catch (_) {
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return isRTL(primary);
|
|
447
1468
|
}
|
|
1469
|
+
var subtags = null;
|
|
448
1470
|
var language = null;
|
|
449
|
-
var languages = [];
|
|
1471
|
+
var languages = freeze([]);
|
|
1472
|
+
var fallbacks = freeze([]);
|
|
450
1473
|
var timezone = null;
|
|
451
1474
|
var offset = 0;
|
|
452
|
-
var
|
|
453
|
-
function
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
|
|
1475
|
+
var rtl = false;
|
|
1476
|
+
function resolveLanguages(candidates) {
|
|
1477
|
+
var resolved = [];
|
|
1478
|
+
var primary = null;
|
|
1479
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
1480
|
+
var parsed = parseTag(candidates[i]);
|
|
1481
|
+
if (parsed === null)
|
|
1482
|
+
continue;
|
|
1483
|
+
if (contains(resolved, parsed.baseName))
|
|
1484
|
+
continue;
|
|
1485
|
+
if (primary === null)
|
|
1486
|
+
primary = parsed;
|
|
1487
|
+
resolved.push(parsed.baseName);
|
|
1488
|
+
}
|
|
1489
|
+
subtags = primary;
|
|
1490
|
+
language = primary === null ? null : primary.baseName;
|
|
1491
|
+
languages = freeze(resolved);
|
|
1492
|
+
fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
|
|
1493
|
+
rtl = resolveDirection(primary);
|
|
1494
|
+
}
|
|
1495
|
+
function collectEnvironmentLanguages() {
|
|
1496
|
+
var candidates = [];
|
|
1497
|
+
var navigatorLike = getGlobal().navigator;
|
|
1498
|
+
if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
|
|
1499
|
+
if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
|
|
1500
|
+
for (var i = 0; i < navigatorLike.languages.length; i++)
|
|
1501
|
+
candidates.push(navigatorLike.languages[i]);
|
|
1502
|
+
}
|
|
1503
|
+
candidates.push(navigatorLike.language);
|
|
1504
|
+
candidates.push(navigatorLike.userLanguage);
|
|
1505
|
+
candidates.push(navigatorLike.browserLanguage);
|
|
1506
|
+
candidates.push(navigatorLike.systemLanguage);
|
|
1507
|
+
}
|
|
1508
|
+
if (typeof Intl !== 'undefined') {
|
|
1509
|
+
try {
|
|
1510
|
+
candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
1511
|
+
}
|
|
1512
|
+
catch (_) {
|
|
1513
|
+
}
|
|
463
1514
|
}
|
|
1515
|
+
return candidates;
|
|
464
1516
|
}
|
|
1517
|
+
var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
|
|
1518
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
465
1519
|
if (typeof Intl !== 'undefined') {
|
|
466
|
-
try {
|
|
467
|
-
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
468
|
-
}
|
|
469
|
-
catch (_) {
|
|
470
|
-
}
|
|
471
1520
|
try {
|
|
472
1521
|
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
473
1522
|
}
|
|
474
1523
|
catch (_) {
|
|
475
1524
|
}
|
|
476
1525
|
}
|
|
477
|
-
if (typeof globalThis.navigator !== 'undefined') {
|
|
478
|
-
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
479
|
-
addLanguages(globalThis.navigator.languages);
|
|
480
|
-
if (typeof globalThis.navigator.language !== 'undefined')
|
|
481
|
-
addLanguage(globalThis.navigator.language);
|
|
482
|
-
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
483
|
-
addLanguage(globalThis.navigator.userLanguage);
|
|
484
|
-
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
485
|
-
addLanguage(globalThis.navigator.browserLanguage);
|
|
486
|
-
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
487
|
-
addLanguage(globalThis.navigator.systemLanguage);
|
|
488
|
-
}
|
|
489
1526
|
try {
|
|
490
1527
|
offset = new Date().getTimezoneOffset() * -1;
|
|
491
1528
|
}
|
|
492
1529
|
catch (_) {
|
|
493
1530
|
}
|
|
494
|
-
if (typeof language === 'string') {
|
|
495
|
-
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
496
|
-
try {
|
|
497
|
-
var intlLocale = new Intl.Locale(language);
|
|
498
|
-
if (typeof intlLocale.getTextInfo === 'function')
|
|
499
|
-
isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
|
|
500
|
-
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
501
|
-
isRTLResolved = intlLocale.textInfo.direction === 'rtl';
|
|
502
|
-
}
|
|
503
|
-
catch (_) {
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
if (typeof isRTLResolved !== 'boolean') {
|
|
507
|
-
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
|
|
508
|
-
if (matched !== null) {
|
|
509
|
-
var lang = matched[1].toLowerCase();
|
|
510
|
-
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
511
|
-
if (RTL_LANGUAGES[i] === lang) {
|
|
512
|
-
isRTLResolved = true;
|
|
513
|
-
break;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
1531
|
var LocaleKit = {
|
|
520
|
-
|
|
1532
|
+
version: packageJSON.version,
|
|
1533
|
+
get language() {
|
|
1534
|
+
return language;
|
|
1535
|
+
},
|
|
1536
|
+
get languages() {
|
|
1537
|
+
return languages;
|
|
1538
|
+
},
|
|
1539
|
+
set languages(value) {
|
|
1540
|
+
resolveLanguages(typeof value === 'string' ? [value] : value);
|
|
1541
|
+
},
|
|
1542
|
+
get subtags() {
|
|
1543
|
+
return subtags;
|
|
1544
|
+
},
|
|
1545
|
+
get fallbacks() {
|
|
1546
|
+
return fallbacks;
|
|
1547
|
+
},
|
|
1548
|
+
get timezone() {
|
|
1549
|
+
return timezone;
|
|
1550
|
+
},
|
|
1551
|
+
get offset() {
|
|
1552
|
+
return offset;
|
|
1553
|
+
},
|
|
1554
|
+
get rtl() {
|
|
1555
|
+
return rtl;
|
|
1556
|
+
},
|
|
1557
|
+
reset: function () {
|
|
1558
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
1559
|
+
},
|
|
1560
|
+
parse: function (tag) {
|
|
1561
|
+
return parseTag(tag);
|
|
1562
|
+
},
|
|
1563
|
+
expand: function (tag) {
|
|
1564
|
+
return expandTag(tag);
|
|
1565
|
+
},
|
|
1566
|
+
lookup: function (supported, fallback) {
|
|
1567
|
+
return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
|
|
1568
|
+
},
|
|
1569
|
+
};
|
|
1570
|
+
if (typeof Object.freeze === 'function')
|
|
1571
|
+
Object.freeze(LocaleKit);
|
|
521
1572
|
|
|
1573
|
+
var GLOBAL$1 = getGlobal$1();
|
|
1574
|
+
var CACHE_PREFIX = 'web-launch-kit:';
|
|
522
1575
|
var TRACK_ID = 'track-id';
|
|
523
|
-
var
|
|
1576
|
+
var PRODUCT_ID = 'product-id';
|
|
524
1577
|
var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
|
|
1578
|
+
function toCacheKey(mode, query) {
|
|
1579
|
+
return CACHE_PREFIX + mode + ':' + query;
|
|
1580
|
+
}
|
|
525
1581
|
var idCache = (function () {
|
|
526
1582
|
var supportsLocalStorage;
|
|
527
1583
|
try {
|
|
528
|
-
if (typeof
|
|
1584
|
+
if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
|
|
529
1585
|
supportsLocalStorage = false;
|
|
530
1586
|
}
|
|
531
1587
|
else {
|
|
532
1588
|
var key = '__id_cache_test__';
|
|
533
|
-
|
|
534
|
-
|
|
1589
|
+
GLOBAL$1.localStorage.setItem(key, '');
|
|
1590
|
+
GLOBAL$1.localStorage.removeItem(key);
|
|
535
1591
|
supportsLocalStorage = true;
|
|
536
1592
|
}
|
|
537
1593
|
}
|
|
@@ -542,7 +1598,7 @@ var idCache = (function () {
|
|
|
542
1598
|
return {
|
|
543
1599
|
get: function (mode, query) {
|
|
544
1600
|
try {
|
|
545
|
-
var item =
|
|
1601
|
+
var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
|
|
546
1602
|
if (item == null)
|
|
547
1603
|
return undefined;
|
|
548
1604
|
var split = item.split('|');
|
|
@@ -550,7 +1606,7 @@ var idCache = (function () {
|
|
|
550
1606
|
return undefined;
|
|
551
1607
|
var expiry = +split[0];
|
|
552
1608
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
553
|
-
|
|
1609
|
+
GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
|
|
554
1610
|
return undefined;
|
|
555
1611
|
}
|
|
556
1612
|
return split[1];
|
|
@@ -561,7 +1617,7 @@ var idCache = (function () {
|
|
|
561
1617
|
},
|
|
562
1618
|
set: function (mode, query, id) {
|
|
563
1619
|
try {
|
|
564
|
-
|
|
1620
|
+
GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
565
1621
|
}
|
|
566
1622
|
catch (_) {
|
|
567
1623
|
return;
|
|
@@ -569,11 +1625,11 @@ var idCache = (function () {
|
|
|
569
1625
|
}
|
|
570
1626
|
};
|
|
571
1627
|
}
|
|
572
|
-
if (typeof
|
|
573
|
-
var cache_1 = new Map();
|
|
1628
|
+
if (typeof GLOBAL$1.Map !== 'undefined') {
|
|
1629
|
+
var cache_1 = new GLOBAL$1.Map();
|
|
574
1630
|
return {
|
|
575
1631
|
get: function (mode, query) {
|
|
576
|
-
var item = cache_1.get(mode
|
|
1632
|
+
var item = cache_1.get(toCacheKey(mode, query));
|
|
577
1633
|
if (typeof item === 'undefined')
|
|
578
1634
|
return undefined;
|
|
579
1635
|
var split = item.split('|');
|
|
@@ -581,20 +1637,20 @@ var idCache = (function () {
|
|
|
581
1637
|
return undefined;
|
|
582
1638
|
var expiry = +split[0];
|
|
583
1639
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
584
|
-
cache_1.delete(mode
|
|
1640
|
+
cache_1.delete(toCacheKey(mode, query));
|
|
585
1641
|
return undefined;
|
|
586
1642
|
}
|
|
587
1643
|
return split[1];
|
|
588
1644
|
},
|
|
589
1645
|
set: function (mode, query, id) {
|
|
590
|
-
cache_1.set(mode
|
|
1646
|
+
cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
591
1647
|
},
|
|
592
1648
|
};
|
|
593
1649
|
}
|
|
594
1650
|
var cache = Object.create(null);
|
|
595
1651
|
return {
|
|
596
1652
|
get: function (mode, query) {
|
|
597
|
-
var item = cache[mode
|
|
1653
|
+
var item = cache[toCacheKey(mode, query)];
|
|
598
1654
|
if (typeof item === 'undefined')
|
|
599
1655
|
return undefined;
|
|
600
1656
|
var split = item.split('|');
|
|
@@ -603,17 +1659,17 @@ var idCache = (function () {
|
|
|
603
1659
|
var expiry = +split[0];
|
|
604
1660
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
605
1661
|
try {
|
|
606
|
-
delete cache[mode
|
|
1662
|
+
delete cache[toCacheKey(mode, query)];
|
|
607
1663
|
}
|
|
608
1664
|
catch (_) {
|
|
609
|
-
cache[mode
|
|
1665
|
+
cache[toCacheKey(mode, query)] = undefined;
|
|
610
1666
|
}
|
|
611
1667
|
return undefined;
|
|
612
1668
|
}
|
|
613
1669
|
return split[1];
|
|
614
1670
|
},
|
|
615
1671
|
set: function (mode, query, id) {
|
|
616
|
-
cache[mode
|
|
1672
|
+
cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
|
|
617
1673
|
}
|
|
618
1674
|
};
|
|
619
1675
|
})();
|
|
@@ -627,8 +1683,8 @@ function getNow() {
|
|
|
627
1683
|
}
|
|
628
1684
|
function requestGet(url, async) {
|
|
629
1685
|
if (async === void 0) { async = false; }
|
|
630
|
-
if (typeof
|
|
631
|
-
return
|
|
1686
|
+
if (typeof GLOBAL$1.fetch === 'function' && async) {
|
|
1687
|
+
return GLOBAL$1.fetch(url)
|
|
632
1688
|
.then(function (response) {
|
|
633
1689
|
return response.json();
|
|
634
1690
|
})
|
|
@@ -671,10 +1727,10 @@ function resolveGetProductIdURL(packageFamilyName) {
|
|
|
671
1727
|
if (locale === candidate)
|
|
672
1728
|
break;
|
|
673
1729
|
}
|
|
674
|
-
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' +
|
|
1730
|
+
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
|
|
675
1731
|
}
|
|
676
1732
|
function resolveGetTrackIdURL(bundleId) {
|
|
677
|
-
return 'https://itunes.apple.com/lookup?bundleId=' +
|
|
1733
|
+
return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
|
|
678
1734
|
}
|
|
679
1735
|
function parseGetProductIdResponse(response) {
|
|
680
1736
|
if (typeof response === 'undefined')
|
|
@@ -700,14 +1756,14 @@ function parseGetTrackIdResponse(response) {
|
|
|
700
1756
|
return '' + result.trackId;
|
|
701
1757
|
}
|
|
702
1758
|
function getProductId(packageFamilyName) {
|
|
703
|
-
var cache = idCache.get(
|
|
1759
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
704
1760
|
if (typeof cache !== 'undefined')
|
|
705
1761
|
return cache;
|
|
706
1762
|
try {
|
|
707
1763
|
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
|
|
708
1764
|
if (typeof productId === 'undefined')
|
|
709
1765
|
return undefined;
|
|
710
|
-
idCache.set(
|
|
1766
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
711
1767
|
return productId;
|
|
712
1768
|
}
|
|
713
1769
|
catch (_) {
|
|
@@ -730,7 +1786,7 @@ function getTrackId(bundleId) {
|
|
|
730
1786
|
}
|
|
731
1787
|
}
|
|
732
1788
|
function getProductIdAsync(packageFamilyName) {
|
|
733
|
-
var cache = idCache.get(
|
|
1789
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
734
1790
|
if (typeof cache !== 'undefined')
|
|
735
1791
|
return Promise.resolve(cache);
|
|
736
1792
|
try {
|
|
@@ -739,7 +1795,7 @@ function getProductIdAsync(packageFamilyName) {
|
|
|
739
1795
|
.then(function (productId) {
|
|
740
1796
|
if (typeof productId === 'undefined')
|
|
741
1797
|
return undefined;
|
|
742
|
-
idCache.set(
|
|
1798
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
743
1799
|
return productId;
|
|
744
1800
|
});
|
|
745
1801
|
}
|
|
@@ -767,110 +1823,16 @@ function getTrackIdAsync(bundleId) {
|
|
|
767
1823
|
}
|
|
768
1824
|
|
|
769
1825
|
function getTopmostWindow() {
|
|
1826
|
+
var globalLike = getGlobal$1();
|
|
770
1827
|
try {
|
|
771
|
-
if (
|
|
772
|
-
void
|
|
773
|
-
return
|
|
1828
|
+
if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
|
|
1829
|
+
void globalLike.top.location.href;
|
|
1830
|
+
return globalLike.top;
|
|
774
1831
|
}
|
|
775
1832
|
}
|
|
776
1833
|
catch (_) {
|
|
777
1834
|
}
|
|
778
|
-
return
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
var IE_WRAPPER_STORE = [];
|
|
782
|
-
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
783
|
-
var LEGACY_TYPE_MAP = {
|
|
784
|
-
'focus': ['focus', 'focusin'],
|
|
785
|
-
'blur': ['blur', 'focusout'],
|
|
786
|
-
};
|
|
787
|
-
function resolveVendor(target, type) {
|
|
788
|
-
var types;
|
|
789
|
-
var legacy = LEGACY_TYPE_MAP[type];
|
|
790
|
-
if (typeof legacy !== 'undefined')
|
|
791
|
-
types = legacy;
|
|
792
|
-
else
|
|
793
|
-
types = [type];
|
|
794
|
-
for (var i = 0; i < VENDORS.length; i++) {
|
|
795
|
-
for (var j = 0; j < types.length; j++) {
|
|
796
|
-
var name_1 = VENDORS[i] + types[j];
|
|
797
|
-
if (typeof target['on' + name_1] !== 'undefined')
|
|
798
|
-
return name_1;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
return type;
|
|
802
|
-
}
|
|
803
|
-
function findIEWrapper(target, type, callback) {
|
|
804
|
-
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
805
|
-
var wrapper = IE_WRAPPER_STORE[i];
|
|
806
|
-
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
|
|
807
|
-
return wrapper.wrapper;
|
|
808
|
-
}
|
|
809
|
-
return undefined;
|
|
810
|
-
}
|
|
811
|
-
function setIEWrapper(target, type, callback, wrapper) {
|
|
812
|
-
IE_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
|
|
813
|
-
}
|
|
814
|
-
function removeIEWrapper(target, type, callback) {
|
|
815
|
-
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
816
|
-
var wrapper = IE_WRAPPER_STORE[i];
|
|
817
|
-
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
|
|
818
|
-
IE_WRAPPER_STORE.splice(i, 1);
|
|
819
|
-
return wrapper.wrapper;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
return undefined;
|
|
823
|
-
}
|
|
824
|
-
function preventDefaultPolyfill() {
|
|
825
|
-
this.returnValue = false;
|
|
826
|
-
}
|
|
827
|
-
function stopPropagationPolyfill() {
|
|
828
|
-
this.cancelBubble = true;
|
|
829
|
-
}
|
|
830
|
-
function addEvent(target, type, callback) {
|
|
831
|
-
if (typeof target === 'undefined' || typeof type === 'undefined')
|
|
832
|
-
return;
|
|
833
|
-
type = resolveVendor(target, type);
|
|
834
|
-
if (typeof target.addEventListener === 'function') {
|
|
835
|
-
return target.addEventListener(type, callback);
|
|
836
|
-
}
|
|
837
|
-
if (typeof target.attachEvent === 'function') {
|
|
838
|
-
var existing = findIEWrapper(target, type, callback);
|
|
839
|
-
if (typeof existing === 'function')
|
|
840
|
-
return;
|
|
841
|
-
var wrapper = function (event) {
|
|
842
|
-
if (typeof event === 'undefined')
|
|
843
|
-
event = globalThis.event;
|
|
844
|
-
if (typeof event === 'undefined')
|
|
845
|
-
return;
|
|
846
|
-
try {
|
|
847
|
-
Object.defineProperty(event, 'currentTarget', { value: target, configurable: true });
|
|
848
|
-
}
|
|
849
|
-
catch (_) {
|
|
850
|
-
}
|
|
851
|
-
if (typeof event.preventDefault !== 'function')
|
|
852
|
-
event.preventDefault = preventDefaultPolyfill.bind(event);
|
|
853
|
-
if (typeof event.stopPropagation !== 'function')
|
|
854
|
-
event.stopPropagation = stopPropagationPolyfill.bind(event);
|
|
855
|
-
callback.call(target, event);
|
|
856
|
-
};
|
|
857
|
-
setIEWrapper(target, type, callback, wrapper);
|
|
858
|
-
return target.attachEvent('on' + type, wrapper);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
function removeEvent(target, type, callback) {
|
|
862
|
-
if (typeof target === 'undefined' || typeof type === 'undefined')
|
|
863
|
-
return;
|
|
864
|
-
type = resolveVendor(target, type);
|
|
865
|
-
if (typeof target.removeEventListener === 'function') {
|
|
866
|
-
return target.removeEventListener(type, callback);
|
|
867
|
-
}
|
|
868
|
-
if (typeof target.detachEvent === 'function') {
|
|
869
|
-
var wrapper = removeIEWrapper(target, type, callback);
|
|
870
|
-
if (typeof wrapper === 'function')
|
|
871
|
-
target.detachEvent('on' + type, wrapper);
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
1835
|
+
return globalLike;
|
|
874
1836
|
}
|
|
875
1837
|
|
|
876
1838
|
exports.SettingType = void 0;
|
|
@@ -941,7 +1903,8 @@ var IOS_DEFAULT_TIMEOUT = 2000;
|
|
|
941
1903
|
var WINDOWS_DEFAULT_TIMEOUT = 750;
|
|
942
1904
|
var MACOS_DEFAULT_TIMEOUT = 750;
|
|
943
1905
|
var DEFAULT_TIMEOUT = 750;
|
|
944
|
-
var
|
|
1906
|
+
var GLOBAL = getGlobal$1();
|
|
1907
|
+
var NAVIGATOR = GLOBAL.navigator;
|
|
945
1908
|
var CLEANUP_INPUT_ELEMENT = null;
|
|
946
1909
|
function createTypeGuard(tag) {
|
|
947
1910
|
return function (value) {
|
|
@@ -1001,7 +1964,7 @@ function isDocumentHidden() {
|
|
|
1001
1964
|
return true;
|
|
1002
1965
|
}
|
|
1003
1966
|
function dispatchClickEvent(element, view) {
|
|
1004
|
-
if (view === void 0) { view =
|
|
1967
|
+
if (view === void 0) { view = GLOBAL; }
|
|
1005
1968
|
var fake;
|
|
1006
1969
|
try {
|
|
1007
1970
|
fake = new MouseEvent('click', {
|
|
@@ -1011,7 +1974,7 @@ function dispatchClickEvent(element, view) {
|
|
|
1011
1974
|
});
|
|
1012
1975
|
}
|
|
1013
1976
|
catch (_) {
|
|
1014
|
-
fake =
|
|
1977
|
+
fake = GLOBAL.document.createEvent('MouseEvents');
|
|
1015
1978
|
fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
1016
1979
|
}
|
|
1017
1980
|
element.dispatchEvent(fake);
|
|
@@ -1039,11 +2002,14 @@ function restoreFocus() {
|
|
|
1039
2002
|
focus(top);
|
|
1040
2003
|
if (hasFocus(topDocument))
|
|
1041
2004
|
return true;
|
|
1042
|
-
|
|
1043
|
-
|
|
2005
|
+
var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
|
|
2006
|
+
if (!hadBodyTabIndex)
|
|
2007
|
+
topDocument.body.setAttribute('tabindex', '-1');
|
|
1044
2008
|
focus(topDocument.body);
|
|
1045
2009
|
if (hasFocus(topDocument))
|
|
1046
2010
|
return true;
|
|
2011
|
+
if (!hadBodyTabIndex)
|
|
2012
|
+
topDocument.body.removeAttribute('tabindex');
|
|
1047
2013
|
var input = undefined;
|
|
1048
2014
|
try {
|
|
1049
2015
|
input = createHiddenElement('input');
|
|
@@ -1085,7 +2051,7 @@ function stripURL(value) {
|
|
|
1085
2051
|
function resolveFocusEventConfig() {
|
|
1086
2052
|
var top = getTopmostWindow();
|
|
1087
2053
|
var topDocument = top.document;
|
|
1088
|
-
if (typeof
|
|
2054
|
+
if (typeof GLOBAL.cordova !== 'undefined') {
|
|
1089
2055
|
return {
|
|
1090
2056
|
focus: {
|
|
1091
2057
|
target: topDocument,
|
|
@@ -1123,7 +2089,7 @@ function resolveFocusEventConfig() {
|
|
|
1123
2089
|
};
|
|
1124
2090
|
}
|
|
1125
2091
|
}
|
|
1126
|
-
else if (typeof
|
|
2092
|
+
else if (typeof GLOBAL.document.addEventListener === 'function') {
|
|
1127
2093
|
return {
|
|
1128
2094
|
focus: {
|
|
1129
2095
|
target: top,
|
|
@@ -1163,12 +2129,12 @@ function openURL(tried, url, timeout) {
|
|
|
1163
2129
|
var anchor = undefined;
|
|
1164
2130
|
var iframe = undefined;
|
|
1165
2131
|
function open() {
|
|
1166
|
-
if (typeof
|
|
1167
|
-
if (typeof
|
|
1168
|
-
|
|
2132
|
+
if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
|
|
2133
|
+
if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
|
|
2134
|
+
GLOBAL.cordova.InAppBrowser.open(url, '_system');
|
|
1169
2135
|
}
|
|
1170
|
-
else {
|
|
1171
|
-
|
|
2136
|
+
else if (typeof GLOBAL.open === 'function') {
|
|
2137
|
+
GLOBAL.open(url, '_system');
|
|
1172
2138
|
}
|
|
1173
2139
|
return;
|
|
1174
2140
|
}
|
|
@@ -1198,7 +2164,7 @@ function openURL(tried, url, timeout) {
|
|
|
1198
2164
|
iframe = createHiddenElement('iframe');
|
|
1199
2165
|
iframe.src = url;
|
|
1200
2166
|
topDocument.body.appendChild(iframe);
|
|
1201
|
-
|
|
2167
|
+
setTimeout(function () {
|
|
1202
2168
|
if (typeof iframe !== 'undefined') {
|
|
1203
2169
|
try {
|
|
1204
2170
|
topDocument.body.removeChild(iframe);
|
|
@@ -1222,9 +2188,12 @@ function openURL(tried, url, timeout) {
|
|
|
1222
2188
|
timeoutId = undefined;
|
|
1223
2189
|
}
|
|
1224
2190
|
try {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
2191
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2192
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
2193
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2194
|
+
EventKit.remove(config.focus.target, config.focus.type, onfocus);
|
|
2195
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2196
|
+
EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
1228
2197
|
}
|
|
1229
2198
|
catch (_) {
|
|
1230
2199
|
}
|
|
@@ -1258,8 +2227,10 @@ function openURL(tried, url, timeout) {
|
|
|
1258
2227
|
clearTimeout(timeoutId);
|
|
1259
2228
|
timeoutId = undefined;
|
|
1260
2229
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
2230
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2231
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
2232
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2233
|
+
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
1263
2234
|
}
|
|
1264
2235
|
function onfocus() {
|
|
1265
2236
|
done(true);
|
|
@@ -1270,11 +2241,13 @@ function openURL(tried, url, timeout) {
|
|
|
1270
2241
|
else
|
|
1271
2242
|
onfocus();
|
|
1272
2243
|
}
|
|
1273
|
-
timeoutId =
|
|
2244
|
+
timeoutId = setTimeout(function () {
|
|
1274
2245
|
done(false);
|
|
1275
2246
|
}, timeout);
|
|
1276
|
-
|
|
1277
|
-
|
|
2247
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2248
|
+
EventKit.add(config.blur.target, config.blur.type, onblur);
|
|
2249
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2250
|
+
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
1278
2251
|
if (!hasFocus(topDocument))
|
|
1279
2252
|
restoreFocus();
|
|
1280
2253
|
try {
|
|
@@ -1476,13 +2449,22 @@ function isFullyBlockedInAppBrowser() {
|
|
|
1476
2449
|
function isPartnerAppOnly() {
|
|
1477
2450
|
return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
|
|
1478
2451
|
}
|
|
2452
|
+
function canOpenWindowsSetting(version) {
|
|
2453
|
+
if (version.length === 0)
|
|
2454
|
+
return false;
|
|
2455
|
+
if (/^\d/.test(version) === false)
|
|
2456
|
+
return false;
|
|
2457
|
+
if (version === '95' || version === '98' || version === '2000')
|
|
2458
|
+
return false;
|
|
2459
|
+
return PlatformKit.compareVersion(version, '10') >= 0;
|
|
2460
|
+
}
|
|
1479
2461
|
function canOpenSetting() {
|
|
1480
2462
|
var os = PlatformKit.os.name;
|
|
1481
2463
|
var version = PlatformKit.os.version;
|
|
1482
2464
|
return !(os === 'unknown'
|
|
1483
2465
|
|| (os === 'android' && !canOpenIntent())
|
|
1484
2466
|
|| os === 'ios'
|
|
1485
|
-
|| (os === 'windows' && (version
|
|
2467
|
+
|| (os === 'windows' && !canOpenWindowsSetting(version))
|
|
1486
2468
|
|| (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
|
|
1487
2469
|
}
|
|
1488
2470
|
function parseIntentURL(intent) {
|
|
@@ -1511,7 +2493,7 @@ function parseIntentURL(intent) {
|
|
|
1511
2493
|
if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
|
|
1512
2494
|
var fallback = extras['S.browser_fallback_url'];
|
|
1513
2495
|
try {
|
|
1514
|
-
fallback =
|
|
2496
|
+
fallback = decodeURIComponent(fallback);
|
|
1515
2497
|
}
|
|
1516
2498
|
catch (_) {
|
|
1517
2499
|
}
|
|
@@ -1531,9 +2513,9 @@ function createIntentURL(scheme, packageName, fallback) {
|
|
|
1531
2513
|
if (typeof packageName !== 'undefined')
|
|
1532
2514
|
intent += 'package=' + packageName + ';';
|
|
1533
2515
|
if (typeof fallback !== 'undefined' && typeof fallback === 'string')
|
|
1534
|
-
intent += 'S.browser_fallback_url=' +
|
|
2516
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
|
|
1535
2517
|
else if (typeof packageName !== 'undefined')
|
|
1536
|
-
intent += 'S.browser_fallback_url=' +
|
|
2518
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
|
|
1537
2519
|
return intent + 'end';
|
|
1538
2520
|
}
|
|
1539
2521
|
function createAppStoreURL(id, os) {
|
|
@@ -1565,7 +2547,7 @@ function createWebStoreURL(id, os) {
|
|
|
1565
2547
|
}
|
|
1566
2548
|
}
|
|
1567
2549
|
function escapeURIComponentString(value) {
|
|
1568
|
-
return
|
|
2550
|
+
return encodeURIComponent(value)
|
|
1569
2551
|
.replace(/[!'()*]/g, function (char) {
|
|
1570
2552
|
return '%' + char.charCodeAt(0).toString(16);
|
|
1571
2553
|
});
|
|
@@ -1634,10 +2616,10 @@ function isUserActivationActive() {
|
|
|
1634
2616
|
return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
|
|
1635
2617
|
}
|
|
1636
2618
|
function canShowDirectoryPicker() {
|
|
1637
|
-
return typeof
|
|
2619
|
+
return typeof GLOBAL.showDirectoryPicker === 'function';
|
|
1638
2620
|
}
|
|
1639
2621
|
function canShowOpenFilePicker() {
|
|
1640
|
-
return typeof
|
|
2622
|
+
return typeof GLOBAL.showOpenFilePicker === 'function';
|
|
1641
2623
|
}
|
|
1642
2624
|
function isFileSystemFileHandle(handle) {
|
|
1643
2625
|
return handle.kind === 'file';
|
|
@@ -1705,7 +2687,7 @@ function resolveFile(module) {
|
|
|
1705
2687
|
resolve(fileListToArray(module.files));
|
|
1706
2688
|
}
|
|
1707
2689
|
function onfocus() {
|
|
1708
|
-
|
|
2690
|
+
setTimeout(function () {
|
|
1709
2691
|
if (module.value.length > 0)
|
|
1710
2692
|
done(true);
|
|
1711
2693
|
else
|
|
@@ -1731,10 +2713,12 @@ function resolveFile(module) {
|
|
|
1731
2713
|
}
|
|
1732
2714
|
else {
|
|
1733
2715
|
module.onclick = function () {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
2716
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2717
|
+
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
2718
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2719
|
+
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2720
|
+
setTimeout(function () {
|
|
2721
|
+
EventKit.add(topDocument, 'click', onclick);
|
|
1738
2722
|
}, 100);
|
|
1739
2723
|
CLEANUP_INPUT_ELEMENT = function () {
|
|
1740
2724
|
done(false);
|
|
@@ -1744,9 +2728,11 @@ function resolveFile(module) {
|
|
|
1744
2728
|
function cleanup() {
|
|
1745
2729
|
CLEANUP_INPUT_ELEMENT = null;
|
|
1746
2730
|
try {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
2731
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2732
|
+
EventKit.remove(config.focus.target, config.focus.type, onfocus);
|
|
2733
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2734
|
+
EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2735
|
+
EventKit.remove(topDocument, 'click', onclick);
|
|
1750
2736
|
}
|
|
1751
2737
|
catch (_) {
|
|
1752
2738
|
}
|
|
@@ -1816,7 +2802,7 @@ function walk(directory, basePath) {
|
|
|
1816
2802
|
}
|
|
1817
2803
|
var LaunchKit = {
|
|
1818
2804
|
SettingType: exports.SettingType,
|
|
1819
|
-
version: packageJSON$
|
|
2805
|
+
version: packageJSON$3.version,
|
|
1820
2806
|
utils: {
|
|
1821
2807
|
get canOpenIntent() {
|
|
1822
2808
|
return canOpenIntent();
|
|
@@ -1864,7 +2850,12 @@ var LaunchKit = {
|
|
|
1864
2850
|
}
|
|
1865
2851
|
else {
|
|
1866
2852
|
tried[index] = '[function fallback]';
|
|
1867
|
-
|
|
2853
|
+
try {
|
|
2854
|
+
url();
|
|
2855
|
+
}
|
|
2856
|
+
catch (_) {
|
|
2857
|
+
return openURLSequential(index + 1);
|
|
2858
|
+
}
|
|
1868
2859
|
resolve(by);
|
|
1869
2860
|
}
|
|
1870
2861
|
}
|
|
@@ -2037,7 +3028,7 @@ var LaunchKit = {
|
|
|
2037
3028
|
option.id = options.id;
|
|
2038
3029
|
if (typeof options.startIn !== 'undefined')
|
|
2039
3030
|
option.startIn = options.startIn;
|
|
2040
|
-
module =
|
|
3031
|
+
module = GLOBAL.showDirectoryPicker(option);
|
|
2041
3032
|
}
|
|
2042
3033
|
else {
|
|
2043
3034
|
var input = createHiddenElement('input');
|
|
@@ -2075,7 +3066,7 @@ var LaunchKit = {
|
|
|
2075
3066
|
}
|
|
2076
3067
|
}
|
|
2077
3068
|
}
|
|
2078
|
-
module =
|
|
3069
|
+
module = GLOBAL.showOpenFilePicker(option);
|
|
2079
3070
|
}
|
|
2080
3071
|
else {
|
|
2081
3072
|
var input = createHiddenElement('input');
|