web-launch-kit 0.0.3 → 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 +668 -252
- 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 +668 -252
- package/dist/launch-kit.mjs.map +1 -1
- package/dist/launch-kit.umd.js +668 -252
- 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 +7 -4
package/dist/launch-kit.umd.js
CHANGED
|
@@ -4,24 +4,37 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LaunchKit = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$
|
|
7
|
+
var version$3 = "0.0.4";
|
|
8
|
+
var packageJSON$3 = {
|
|
9
|
+
version: version$3};
|
|
10
|
+
|
|
11
|
+
var version$2 = "0.0.5";
|
|
8
12
|
var packageJSON$2 = {
|
|
9
13
|
version: version$2};
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function getGlobal$3() {
|
|
16
|
+
if (typeof globalThis !== 'undefined')
|
|
17
|
+
return globalThis;
|
|
18
|
+
if (typeof self !== 'undefined')
|
|
19
|
+
return self;
|
|
20
|
+
if (typeof window !== 'undefined')
|
|
21
|
+
return window;
|
|
22
|
+
if (typeof global !== 'undefined')
|
|
23
|
+
return global;
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
var GLOBAL$5 = getGlobal$3();
|
|
27
|
+
var NAVIGATOR$1 = GLOBAL$5.navigator;
|
|
28
|
+
var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
|
|
29
|
+
var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
|
|
18
30
|
var OS_RESOLVER_MAP = [
|
|
19
|
-
[/windows nt (6\.[23]); arm/i, 'windows',
|
|
20
|
-
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'
|
|
21
|
-
[/
|
|
31
|
+
[/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
|
|
32
|
+
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
|
|
33
|
+
[/win 9x 4\.90/i, 'windows', 'ME'],
|
|
34
|
+
[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
|
|
22
35
|
[/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
|
|
23
36
|
[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
|
|
24
|
-
[/windows ce\/?([\d.]*)/i, 'windows'
|
|
37
|
+
[/windows ce\/?([\d.]*)/i, 'windows'],
|
|
25
38
|
[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
|
|
26
39
|
[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
|
|
27
40
|
[/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
|
|
@@ -50,13 +63,14 @@
|
|
|
50
63
|
[/samsungbrowser\/([\w.]+)/i, 'samsung'],
|
|
51
64
|
[/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
|
|
52
65
|
[/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
|
|
53
|
-
[/ wv\).+
|
|
66
|
+
[/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
|
|
54
67
|
[/chrome\/([\w.]+) mobile/i, 'chrome'],
|
|
55
68
|
[/chrome\/v?([\w.]+)/i, 'chrome'],
|
|
56
69
|
[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
57
70
|
[/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
58
71
|
[/version\/([\w.,]+) .*safari/i, 'safari'],
|
|
59
72
|
[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
|
|
73
|
+
[/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
|
|
60
74
|
[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
|
|
61
75
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
|
|
62
76
|
[/firefox\/([\w.]+)/i, 'firefox'],
|
|
@@ -73,6 +87,18 @@
|
|
|
73
87
|
[/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
|
|
74
88
|
[/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
|
|
75
89
|
];
|
|
90
|
+
var IN_APP_BROWSER_RESOLVER_MAP = [
|
|
91
|
+
[/kakaotalk/i, 'kakaotalk'],
|
|
92
|
+
[/\bline\/[\d.]/i, 'line'],
|
|
93
|
+
[/instagram/i, 'instagram'],
|
|
94
|
+
[/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
|
|
95
|
+
[/naver\(inapp/i, 'naver'],
|
|
96
|
+
[/daumapps/i, 'daum'],
|
|
97
|
+
[/\bband\/[\d.]/i, 'band'],
|
|
98
|
+
[/micromessenger/i, 'wechat'],
|
|
99
|
+
[/twitter for|twitterandroid/i, 'twitter'],
|
|
100
|
+
[/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
|
|
101
|
+
];
|
|
76
102
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
77
103
|
'Google Chrome': 'Chrome',
|
|
78
104
|
'Microsoft Edge': 'Edge',
|
|
@@ -95,19 +121,18 @@
|
|
|
95
121
|
return '';
|
|
96
122
|
var mapped = {
|
|
97
123
|
'4.90': 'ME',
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
'
|
|
109
|
-
|
|
110
|
-
}[string];
|
|
124
|
+
'3.51': 'NT 3.51',
|
|
125
|
+
'4.0': 'NT 4.0',
|
|
126
|
+
'5.0': '2000',
|
|
127
|
+
'5.1': 'XP',
|
|
128
|
+
'5.2': 'XP',
|
|
129
|
+
'6.0': 'Vista',
|
|
130
|
+
'6.1': '7',
|
|
131
|
+
'6.2': '8',
|
|
132
|
+
'6.3': '8.1',
|
|
133
|
+
'6.4': '10',
|
|
134
|
+
'10.0': '10'
|
|
135
|
+
}[string.replace(/[^\d.]/g, '')];
|
|
111
136
|
if (typeof mapped !== 'undefined')
|
|
112
137
|
return mapped;
|
|
113
138
|
return string;
|
|
@@ -126,6 +151,28 @@
|
|
|
126
151
|
return '';
|
|
127
152
|
return string;
|
|
128
153
|
}
|
|
154
|
+
function compareVersion(lhs, rhs) {
|
|
155
|
+
var pa = lhs.split('.');
|
|
156
|
+
var pb = rhs.split('.');
|
|
157
|
+
var length = Math.max(pa.length, pb.length);
|
|
158
|
+
for (var i = 0; i < length; i++) {
|
|
159
|
+
var a = void 0;
|
|
160
|
+
var b = void 0;
|
|
161
|
+
if (i < pa.length)
|
|
162
|
+
a = parseInt(pa[i], 10);
|
|
163
|
+
else
|
|
164
|
+
a = 0;
|
|
165
|
+
if (i < pb.length)
|
|
166
|
+
b = parseInt(pb[i], 10);
|
|
167
|
+
else
|
|
168
|
+
b = 0;
|
|
169
|
+
if (a > b)
|
|
170
|
+
return 1;
|
|
171
|
+
if (a < b)
|
|
172
|
+
return -1;
|
|
173
|
+
}
|
|
174
|
+
return 0;
|
|
175
|
+
}
|
|
129
176
|
function parseOS() {
|
|
130
177
|
var name = 'unknown';
|
|
131
178
|
var version = '';
|
|
@@ -138,7 +185,7 @@
|
|
|
138
185
|
break;
|
|
139
186
|
}
|
|
140
187
|
}
|
|
141
|
-
if (name === 'ios' &&
|
|
188
|
+
if (name === 'ios' && compareVersion(version, '18.6') === 0) {
|
|
142
189
|
var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
|
|
143
190
|
if (execs !== null) {
|
|
144
191
|
var major = parseInt(execs[1].split('.')[0], 10);
|
|
@@ -151,7 +198,7 @@
|
|
|
151
198
|
name = parsedFromHighEntropyValuesOSName;
|
|
152
199
|
if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
|
|
153
200
|
version = parsedFromHighEntropyValuesOSVersion;
|
|
154
|
-
if (name === 'macos' && typeof
|
|
201
|
+
if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
|
|
155
202
|
name = 'ios';
|
|
156
203
|
}
|
|
157
204
|
return {
|
|
@@ -203,6 +250,39 @@
|
|
|
203
250
|
version: version
|
|
204
251
|
};
|
|
205
252
|
}
|
|
253
|
+
function parseInAppBrowser() {
|
|
254
|
+
for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
|
|
255
|
+
if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
|
|
256
|
+
return IN_APP_BROWSER_RESOLVER_MAP[i][1];
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
function parseWebview() {
|
|
261
|
+
if (/; ?wv\)/i.test(currentUserAgent))
|
|
262
|
+
return true;
|
|
263
|
+
if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
|
|
264
|
+
return true;
|
|
265
|
+
if (/\belectron\//i.test(currentUserAgent))
|
|
266
|
+
return true;
|
|
267
|
+
if (/(?:iphone|ipad|ipod)/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
|
|
268
|
+
return true;
|
|
269
|
+
return parseInAppBrowser() !== null;
|
|
270
|
+
}
|
|
271
|
+
function parseDevice() {
|
|
272
|
+
if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
273
|
+
return parsedFromHighEntropyValuesDevice;
|
|
274
|
+
var osName = getParsedCache().os.name;
|
|
275
|
+
if (osName === 'ios') {
|
|
276
|
+
if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
|
|
277
|
+
return 'tablet';
|
|
278
|
+
return 'mobile';
|
|
279
|
+
}
|
|
280
|
+
if (osName === 'android')
|
|
281
|
+
return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
|
|
282
|
+
if (osName === 'windows' || osName === 'macos')
|
|
283
|
+
return 'desktop';
|
|
284
|
+
return 'unknown';
|
|
285
|
+
}
|
|
206
286
|
function getParsedCache() {
|
|
207
287
|
if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
|
|
208
288
|
return parsedCache;
|
|
@@ -230,11 +310,31 @@
|
|
|
230
310
|
return { brand: entry, version: '' };
|
|
231
311
|
return { brand: entry.brand, version: entry.version };
|
|
232
312
|
}
|
|
313
|
+
function resolvedThenable() {
|
|
314
|
+
if (typeof Promise === 'function')
|
|
315
|
+
return Promise.resolve();
|
|
316
|
+
var thenable = {
|
|
317
|
+
then: function (onFulfilled) {
|
|
318
|
+
if (typeof onFulfilled === 'function')
|
|
319
|
+
onFulfilled(undefined);
|
|
320
|
+
return thenable;
|
|
321
|
+
},
|
|
322
|
+
catch: function () {
|
|
323
|
+
return thenable;
|
|
324
|
+
},
|
|
325
|
+
finally: function (onFinally) {
|
|
326
|
+
if (typeof onFinally === 'function')
|
|
327
|
+
onFinally();
|
|
328
|
+
return thenable;
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
return thenable;
|
|
332
|
+
}
|
|
233
333
|
function parseFromHighEntropyValues() {
|
|
234
334
|
if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
|
|
235
|
-
return
|
|
335
|
+
return resolvedThenable();
|
|
236
336
|
return USER_AGENT_DATA
|
|
237
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', '
|
|
337
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
|
|
238
338
|
.then(function (result) {
|
|
239
339
|
try {
|
|
240
340
|
var brands = result.fullVersionList || result.brands || [];
|
|
@@ -287,12 +387,26 @@
|
|
|
287
387
|
else if (/macos|macintel/i.test(platform))
|
|
288
388
|
parsedFromHighEntropyValuesOSName = 'macos';
|
|
289
389
|
}
|
|
290
|
-
|
|
390
|
+
var formFactors = result.formFactors;
|
|
391
|
+
if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
|
|
392
|
+
for (var i = 0; i < formFactors.length; i++) {
|
|
393
|
+
var formFactor = String(formFactors[i]).toLowerCase();
|
|
394
|
+
if (formFactor === 'tablet')
|
|
395
|
+
parsedFromHighEntropyValuesDevice = 'tablet';
|
|
396
|
+
else if (formFactor === 'mobile')
|
|
397
|
+
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
398
|
+
else if (formFactor === 'desktop')
|
|
399
|
+
parsedFromHighEntropyValuesDevice = 'desktop';
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
|
|
291
403
|
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
292
|
-
parsedCache = null;
|
|
293
404
|
}
|
|
294
405
|
catch (_) {
|
|
295
406
|
}
|
|
407
|
+
finally {
|
|
408
|
+
parsedCache = null;
|
|
409
|
+
}
|
|
296
410
|
})
|
|
297
411
|
.catch(function () {
|
|
298
412
|
parsedCache = null;
|
|
@@ -300,15 +414,29 @@
|
|
|
300
414
|
}
|
|
301
415
|
ready = parseFromHighEntropyValues();
|
|
302
416
|
var PlatformKit = {
|
|
303
|
-
version: packageJSON$
|
|
417
|
+
version: packageJSON$2.version,
|
|
304
418
|
get ready() {
|
|
305
419
|
return ready;
|
|
306
420
|
},
|
|
421
|
+
whenReady: function (callback) {
|
|
422
|
+
if (typeof callback !== 'function')
|
|
423
|
+
return;
|
|
424
|
+
ready.then(function () {
|
|
425
|
+
callback();
|
|
426
|
+
});
|
|
427
|
+
},
|
|
307
428
|
set userAgent(userAgent) {
|
|
308
429
|
if (currentUserAgent === userAgent)
|
|
309
430
|
return;
|
|
310
431
|
currentUserAgent = userAgent;
|
|
311
432
|
invalidateCache();
|
|
433
|
+
ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
|
|
434
|
+
},
|
|
435
|
+
reset: function () {
|
|
436
|
+
if (currentUserAgent === USER_AGENT)
|
|
437
|
+
return;
|
|
438
|
+
currentUserAgent = USER_AGENT;
|
|
439
|
+
invalidateCache();
|
|
312
440
|
ready = parseFromHighEntropyValues();
|
|
313
441
|
},
|
|
314
442
|
get userAgent() {
|
|
@@ -324,65 +452,59 @@
|
|
|
324
452
|
return getParsedCache().engine;
|
|
325
453
|
},
|
|
326
454
|
get device() {
|
|
327
|
-
|
|
328
|
-
return parsedFromHighEntropyValuesDevice;
|
|
329
|
-
var osName = getParsedCache().os.name;
|
|
330
|
-
if (osName === 'ios' || osName === 'android')
|
|
331
|
-
return 'mobile';
|
|
332
|
-
if (osName === 'windows' || osName === 'macos')
|
|
333
|
-
return 'desktop';
|
|
334
|
-
return 'unknown';
|
|
455
|
+
return parseDevice();
|
|
335
456
|
},
|
|
336
457
|
get webview() {
|
|
337
|
-
return
|
|
458
|
+
return parseWebview();
|
|
459
|
+
},
|
|
460
|
+
get inAppBrowser() {
|
|
461
|
+
return parseInAppBrowser();
|
|
338
462
|
},
|
|
339
463
|
get node() {
|
|
340
|
-
|
|
464
|
+
var nodeProcess = GLOBAL$5.process;
|
|
465
|
+
return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
|
|
341
466
|
},
|
|
342
467
|
get standalone() {
|
|
343
468
|
var osName = getParsedCache().os.name;
|
|
344
469
|
if (osName === 'ios')
|
|
345
|
-
return
|
|
346
|
-
if (typeof
|
|
470
|
+
return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
|
|
471
|
+
if (typeof GLOBAL$5.matchMedia !== 'function')
|
|
347
472
|
return false;
|
|
348
|
-
|
|
473
|
+
try {
|
|
474
|
+
return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
|
|
475
|
+
}
|
|
476
|
+
catch (_) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
349
479
|
},
|
|
350
480
|
compareVersion: function (lhs, rhs) {
|
|
351
|
-
|
|
352
|
-
var pb = rhs.split('.');
|
|
353
|
-
var length = Math.max(pa.length, pb.length);
|
|
354
|
-
for (var i = 0; i < length; i++) {
|
|
355
|
-
var a = void 0;
|
|
356
|
-
var b = void 0;
|
|
357
|
-
if (i < pa.length)
|
|
358
|
-
a = parseInt(pa[i], 10);
|
|
359
|
-
else
|
|
360
|
-
a = 0;
|
|
361
|
-
if (i < pb.length)
|
|
362
|
-
b = parseInt(pb[i], 10);
|
|
363
|
-
else
|
|
364
|
-
b = 0;
|
|
365
|
-
if (a > b)
|
|
366
|
-
return 1;
|
|
367
|
-
if (a < b)
|
|
368
|
-
return -1;
|
|
369
|
-
}
|
|
370
|
-
return 0;
|
|
481
|
+
return compareVersion(lhs, rhs);
|
|
371
482
|
}
|
|
372
483
|
};
|
|
373
484
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
485
|
+
function getGlobal$2() {
|
|
486
|
+
if (typeof globalThis !== 'undefined')
|
|
487
|
+
return globalThis;
|
|
488
|
+
if (typeof self !== 'undefined')
|
|
489
|
+
return self;
|
|
490
|
+
if (typeof window !== 'undefined')
|
|
491
|
+
return window;
|
|
492
|
+
if (typeof global !== 'undefined')
|
|
493
|
+
return global;
|
|
494
|
+
return {};
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
var version$1 = "0.0.1";
|
|
498
|
+
var packageJSON$1 = {
|
|
499
|
+
version: version$1};
|
|
377
500
|
|
|
501
|
+
var GLOBAL$3 = getGlobal$2();
|
|
378
502
|
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
379
503
|
// https://cordova.apache.org/docs/en/latest/cordova/events/events.html
|
|
380
504
|
var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
|
|
381
505
|
// iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
|
|
382
506
|
var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
|
|
383
507
|
var TYPE_ALIAS_MAP = {
|
|
384
|
-
'focus': ['focus', 'focusin'],
|
|
385
|
-
'blur': ['blur', 'focusout'],
|
|
386
508
|
'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
|
|
387
509
|
'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
|
|
388
510
|
'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
|
|
@@ -430,10 +552,10 @@
|
|
|
430
552
|
}
|
|
431
553
|
function probeHosts(target) {
|
|
432
554
|
var hosts = [target];
|
|
433
|
-
if (typeof
|
|
434
|
-
hosts.push(
|
|
435
|
-
if (target !==
|
|
436
|
-
hosts.push(
|
|
555
|
+
if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
|
|
556
|
+
hosts.push(GLOBAL$3.document);
|
|
557
|
+
if (target !== GLOBAL$3)
|
|
558
|
+
hosts.push(GLOBAL$3);
|
|
437
559
|
return hosts;
|
|
438
560
|
}
|
|
439
561
|
function extractVendorPrefix(name) {
|
|
@@ -444,9 +566,9 @@
|
|
|
444
566
|
return '';
|
|
445
567
|
}
|
|
446
568
|
function testStyleSupport(name, styleProperty) {
|
|
447
|
-
if (typeof
|
|
569
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
448
570
|
return false;
|
|
449
|
-
var style =
|
|
571
|
+
var style = GLOBAL$3.document.documentElement.style;
|
|
450
572
|
if (typeof style === 'undefined' || style === null)
|
|
451
573
|
return false;
|
|
452
574
|
var prefix = extractVendorPrefix(name);
|
|
@@ -458,9 +580,9 @@
|
|
|
458
580
|
return typeof asRecord(style)[property] !== 'undefined';
|
|
459
581
|
}
|
|
460
582
|
function testFullscreenSupport(name) {
|
|
461
|
-
if (typeof
|
|
583
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
462
584
|
return false;
|
|
463
|
-
var element =
|
|
585
|
+
var element = GLOBAL$3.document.documentElement;
|
|
464
586
|
var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
|
|
465
587
|
if (typeof methods === 'undefined')
|
|
466
588
|
return false;
|
|
@@ -486,7 +608,7 @@
|
|
|
486
608
|
return false;
|
|
487
609
|
}
|
|
488
610
|
function resolveEventType(target, type) {
|
|
489
|
-
if (target ===
|
|
611
|
+
if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
|
|
490
612
|
return type;
|
|
491
613
|
if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
|
|
492
614
|
return type;
|
|
@@ -495,10 +617,10 @@
|
|
|
495
617
|
if (isEventTypeSupported(target, candidates[i]))
|
|
496
618
|
return candidates[i];
|
|
497
619
|
}
|
|
620
|
+
var hosts = probeHosts(target);
|
|
498
621
|
for (var i = 1; i < VENDORS.length; i++) {
|
|
499
622
|
for (var j = 0; j < candidates.length; j++) {
|
|
500
623
|
var name_1 = VENDORS[i] + candidates[j];
|
|
501
|
-
var hosts = probeHosts(target);
|
|
502
624
|
for (var k = 0; k < hosts.length; k++) {
|
|
503
625
|
if (hasOnProperty(hosts[k], name_1))
|
|
504
626
|
return name_1;
|
|
@@ -508,6 +630,7 @@
|
|
|
508
630
|
return type;
|
|
509
631
|
}
|
|
510
632
|
|
|
633
|
+
var GLOBAL$2 = getGlobal$2();
|
|
511
634
|
var SUPPORTED = {
|
|
512
635
|
once: false,
|
|
513
636
|
passive: false,
|
|
@@ -518,16 +641,16 @@
|
|
|
518
641
|
var NOOP$1 = function () {
|
|
519
642
|
};
|
|
520
643
|
function resolveProbeTarget() {
|
|
521
|
-
if (typeof
|
|
644
|
+
if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
|
|
522
645
|
try {
|
|
523
|
-
return
|
|
646
|
+
return GLOBAL$2.document.createDocumentFragment();
|
|
524
647
|
}
|
|
525
648
|
catch (_) {
|
|
526
649
|
}
|
|
527
650
|
}
|
|
528
|
-
if (typeof
|
|
651
|
+
if (typeof GLOBAL$2.EventTarget === 'function') {
|
|
529
652
|
try {
|
|
530
|
-
return new
|
|
653
|
+
return new GLOBAL$2.EventTarget();
|
|
531
654
|
}
|
|
532
655
|
catch (_) {
|
|
533
656
|
}
|
|
@@ -598,6 +721,7 @@
|
|
|
598
721
|
return normalized.capture;
|
|
599
722
|
}
|
|
600
723
|
|
|
724
|
+
var GLOBAL$1$1 = getGlobal$2();
|
|
601
725
|
var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
|
602
726
|
var POINTER_PHASE_MAP = {
|
|
603
727
|
'pointerdown': 'start',
|
|
@@ -633,17 +757,17 @@
|
|
|
633
757
|
return -1;
|
|
634
758
|
}
|
|
635
759
|
function scrollOffsetX() {
|
|
636
|
-
if (typeof
|
|
637
|
-
return
|
|
638
|
-
if (typeof
|
|
639
|
-
return
|
|
760
|
+
if (typeof GLOBAL$1$1.pageXOffset === 'number')
|
|
761
|
+
return GLOBAL$1$1.pageXOffset;
|
|
762
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
763
|
+
return GLOBAL$1$1.document.documentElement.scrollLeft;
|
|
640
764
|
return 0;
|
|
641
765
|
}
|
|
642
766
|
function scrollOffsetY() {
|
|
643
|
-
if (typeof
|
|
644
|
-
return
|
|
645
|
-
if (typeof
|
|
646
|
-
return
|
|
767
|
+
if (typeof GLOBAL$1$1.pageYOffset === 'number')
|
|
768
|
+
return GLOBAL$1$1.pageYOffset;
|
|
769
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
770
|
+
return GLOBAL$1$1.document.documentElement.scrollTop;
|
|
647
771
|
return 0;
|
|
648
772
|
}
|
|
649
773
|
function createSyntheticTouch(event, target) {
|
|
@@ -664,12 +788,20 @@
|
|
|
664
788
|
force: typeof event.pressure === 'number' ? event.pressure : 0,
|
|
665
789
|
};
|
|
666
790
|
}
|
|
667
|
-
function defineTouchList(event, property, list) {
|
|
791
|
+
function defineTouchList(event, property, list, patches) {
|
|
792
|
+
var holder = event;
|
|
793
|
+
var had = false;
|
|
794
|
+
try {
|
|
795
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
796
|
+
}
|
|
797
|
+
catch (_) {
|
|
798
|
+
}
|
|
799
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
668
800
|
try {
|
|
669
801
|
Object.defineProperty(event, property, { value: list, configurable: true });
|
|
670
802
|
}
|
|
671
803
|
catch (_) {
|
|
672
|
-
|
|
804
|
+
holder[property] = list;
|
|
673
805
|
}
|
|
674
806
|
}
|
|
675
807
|
function filterByTarget(touches, target) {
|
|
@@ -680,7 +812,7 @@
|
|
|
680
812
|
}
|
|
681
813
|
return filtered;
|
|
682
814
|
}
|
|
683
|
-
function synthesizeTouchEvent(event, resolvedType) {
|
|
815
|
+
function synthesizeTouchEvent(event, resolvedType, patches) {
|
|
684
816
|
var phase = POINTER_PHASE_MAP[resolvedType];
|
|
685
817
|
if (typeof phase === 'undefined')
|
|
686
818
|
return;
|
|
@@ -699,9 +831,9 @@
|
|
|
699
831
|
if (index > -1)
|
|
700
832
|
ACTIVE_TOUCHES.splice(index, 1);
|
|
701
833
|
}
|
|
702
|
-
defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
|
|
703
|
-
defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
|
|
704
|
-
defineTouchList(event, 'changedTouches', createTouchList([touch]));
|
|
834
|
+
defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
|
|
835
|
+
defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
|
|
836
|
+
defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
|
|
705
837
|
}
|
|
706
838
|
|
|
707
839
|
var KEY_CODE_MAP = {
|
|
@@ -808,21 +940,50 @@
|
|
|
808
940
|
226: 'IntlBackslash',
|
|
809
941
|
};
|
|
810
942
|
|
|
943
|
+
var GLOBAL$4 = getGlobal$2();
|
|
811
944
|
var LISTENER_STORE = [];
|
|
812
945
|
var NOOP = function () {
|
|
813
946
|
};
|
|
947
|
+
// Records live on the target itself, so they are collected with it and lookups only scan
|
|
948
|
+
// that target's own listeners. Targets that reject the expando fall back to LISTENER_STORE.
|
|
949
|
+
var STORE_KEY = '__webEventKitListeners__';
|
|
950
|
+
function resolveBucket(target, create) {
|
|
951
|
+
var holder = target;
|
|
952
|
+
try {
|
|
953
|
+
var existing = holder[STORE_KEY];
|
|
954
|
+
if (typeof existing !== 'undefined' && existing !== null)
|
|
955
|
+
return existing;
|
|
956
|
+
if (!create)
|
|
957
|
+
return LISTENER_STORE;
|
|
958
|
+
var bucket = [];
|
|
959
|
+
try {
|
|
960
|
+
Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
|
|
961
|
+
}
|
|
962
|
+
catch (_) {
|
|
963
|
+
holder[STORE_KEY] = bucket;
|
|
964
|
+
}
|
|
965
|
+
if (holder[STORE_KEY] !== bucket)
|
|
966
|
+
return LISTENER_STORE;
|
|
967
|
+
return bucket;
|
|
968
|
+
}
|
|
969
|
+
catch (_) {
|
|
970
|
+
return LISTENER_STORE;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
814
973
|
function findListenerRecord(target, type, callback, capture) {
|
|
815
|
-
|
|
816
|
-
|
|
974
|
+
var bucket = resolveBucket(target, false);
|
|
975
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
976
|
+
var record = bucket[i];
|
|
817
977
|
if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
|
|
818
978
|
return record;
|
|
819
979
|
}
|
|
820
980
|
return undefined;
|
|
821
981
|
}
|
|
822
982
|
function removeListenerRecord(record) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
983
|
+
var bucket = record.bucket;
|
|
984
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
985
|
+
if (bucket[i] === record) {
|
|
986
|
+
bucket.splice(i, 1);
|
|
826
987
|
return;
|
|
827
988
|
}
|
|
828
989
|
}
|
|
@@ -842,6 +1003,35 @@
|
|
|
842
1003
|
if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
|
|
843
1004
|
return callback.handleEvent(event);
|
|
844
1005
|
}
|
|
1006
|
+
// The same Event object is handed to every listener, so any property this kit overrides has
|
|
1007
|
+
// to be put back before the next one runs — otherwise a `pointerdown` listener would observe
|
|
1008
|
+
// the `touchstart` type and synthetic touches written by a listener registered before it.
|
|
1009
|
+
function patchEventProperty(event, property, value, patches) {
|
|
1010
|
+
var holder = event;
|
|
1011
|
+
var had = false;
|
|
1012
|
+
try {
|
|
1013
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
1014
|
+
}
|
|
1015
|
+
catch (_) {
|
|
1016
|
+
}
|
|
1017
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
1018
|
+
defineEventProperty(event, property, value);
|
|
1019
|
+
}
|
|
1020
|
+
function restoreEventProperties(event, patches) {
|
|
1021
|
+
var holder = event;
|
|
1022
|
+
for (var i = patches.length - 1; i >= 0; i--) {
|
|
1023
|
+
var patch = patches[i];
|
|
1024
|
+
try {
|
|
1025
|
+
if (patch.had)
|
|
1026
|
+
defineEventProperty(event, patch.property, patch.previous);
|
|
1027
|
+
else
|
|
1028
|
+
delete holder[patch.property];
|
|
1029
|
+
}
|
|
1030
|
+
catch (_) {
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
patches.length = 0;
|
|
1034
|
+
}
|
|
845
1035
|
function defineEventProperty(event, property, value) {
|
|
846
1036
|
try {
|
|
847
1037
|
Object.defineProperty(event, property, { value: value, configurable: true });
|
|
@@ -874,7 +1064,7 @@
|
|
|
874
1064
|
function createDispatcher(record) {
|
|
875
1065
|
return function (event) {
|
|
876
1066
|
if (typeof event === 'undefined')
|
|
877
|
-
event =
|
|
1067
|
+
event = GLOBAL$4.event; // IE: implicit global event object
|
|
878
1068
|
if (typeof event === 'undefined' || event === null)
|
|
879
1069
|
return;
|
|
880
1070
|
if (record.released)
|
|
@@ -882,14 +1072,20 @@
|
|
|
882
1072
|
fixLegacyEvent(event, record.target);
|
|
883
1073
|
if (record.once)
|
|
884
1074
|
releaseListenerRecord(record);
|
|
1075
|
+
var patches = [];
|
|
885
1076
|
if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
|
|
886
|
-
event
|
|
1077
|
+
patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
|
|
887
1078
|
if (record.resolvedType !== record.type)
|
|
888
|
-
|
|
1079
|
+
patchEventProperty(event, 'type', record.type, patches);
|
|
889
1080
|
if (record.touch)
|
|
890
|
-
synthesizeTouchEvent(event, record.resolvedType);
|
|
1081
|
+
synthesizeTouchEvent(event, record.resolvedType, patches);
|
|
891
1082
|
fixKeyboardEvent(event);
|
|
892
|
-
|
|
1083
|
+
try {
|
|
1084
|
+
invokeCallback(record.callback, record.target, event);
|
|
1085
|
+
}
|
|
1086
|
+
finally {
|
|
1087
|
+
restoreEventProperties(event, patches);
|
|
1088
|
+
}
|
|
893
1089
|
};
|
|
894
1090
|
}
|
|
895
1091
|
function attachNativeListener(record) {
|
|
@@ -923,7 +1119,7 @@
|
|
|
923
1119
|
}
|
|
924
1120
|
if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
|
|
925
1121
|
try {
|
|
926
|
-
record.signal.removeEventListener('abort', record.onAbort);
|
|
1122
|
+
record.signal.removeEventListener('abort', record.onAbort, false);
|
|
927
1123
|
}
|
|
928
1124
|
catch (_) {
|
|
929
1125
|
}
|
|
@@ -936,7 +1132,7 @@
|
|
|
936
1132
|
}
|
|
937
1133
|
catch (_) {
|
|
938
1134
|
}
|
|
939
|
-
var event =
|
|
1135
|
+
var event = GLOBAL$4.document.createEvent('Event');
|
|
940
1136
|
event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
|
|
941
1137
|
return event;
|
|
942
1138
|
}
|
|
@@ -946,12 +1142,12 @@
|
|
|
946
1142
|
}
|
|
947
1143
|
catch (_) {
|
|
948
1144
|
}
|
|
949
|
-
var event =
|
|
1145
|
+
var event = GLOBAL$4.document.createEvent('CustomEvent');
|
|
950
1146
|
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);
|
|
951
1147
|
return event;
|
|
952
1148
|
}
|
|
953
1149
|
var EventKit = {
|
|
954
|
-
version: packageJSON.version,
|
|
1150
|
+
version: packageJSON$1.version,
|
|
955
1151
|
utils: {
|
|
956
1152
|
get supportedOptions() {
|
|
957
1153
|
return {
|
|
@@ -975,15 +1171,16 @@
|
|
|
975
1171
|
return NOOP;
|
|
976
1172
|
var normalized = normalizeListenerOptions(options);
|
|
977
1173
|
var existing = findListenerRecord(target, type, callback, normalized.capture);
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
}
|
|
1174
|
+
// Native `addEventListener` ignores a duplicate registration, so hand back a releaser
|
|
1175
|
+
// that does nothing rather than one that would detach the first caller's listener.
|
|
1176
|
+
if (typeof existing !== 'undefined')
|
|
1177
|
+
return NOOP;
|
|
983
1178
|
if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
|
|
984
1179
|
return NOOP;
|
|
985
1180
|
var resolvedType = resolveEventType(target, type);
|
|
1181
|
+
var bucket = resolveBucket(target, true);
|
|
986
1182
|
var record = {
|
|
1183
|
+
bucket: bucket,
|
|
987
1184
|
target: target,
|
|
988
1185
|
type: type,
|
|
989
1186
|
callback: callback,
|
|
@@ -1000,12 +1197,14 @@
|
|
|
1000
1197
|
record.wrapper = createDispatcher(record);
|
|
1001
1198
|
if (!attachNativeListener(record))
|
|
1002
1199
|
return NOOP;
|
|
1003
|
-
|
|
1200
|
+
bucket.push(record);
|
|
1004
1201
|
if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
|
|
1005
1202
|
record.onAbort = function () {
|
|
1006
1203
|
releaseListenerRecord(record);
|
|
1007
1204
|
};
|
|
1008
|
-
|
|
1205
|
+
// Engines without listener-options coerce `{once: true}` to capture, which would then
|
|
1206
|
+
// fail to match on removal; releaseListenerRecord detaches this anyway.
|
|
1207
|
+
record.signal.addEventListener('abort', record.onAbort, false);
|
|
1009
1208
|
}
|
|
1010
1209
|
return function () {
|
|
1011
1210
|
releaseListenerRecord(record);
|
|
@@ -1030,9 +1229,22 @@
|
|
|
1030
1229
|
},
|
|
1031
1230
|
};
|
|
1032
1231
|
|
|
1232
|
+
function getGlobal$1() {
|
|
1233
|
+
if (typeof globalThis !== 'undefined')
|
|
1234
|
+
return globalThis;
|
|
1235
|
+
if (typeof self !== 'undefined')
|
|
1236
|
+
return self;
|
|
1237
|
+
if (typeof window !== 'undefined')
|
|
1238
|
+
return window;
|
|
1239
|
+
if (typeof global !== 'undefined')
|
|
1240
|
+
return global;
|
|
1241
|
+
return {};
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1033
1244
|
function createHiddenElement(tagName, focusable) {
|
|
1034
1245
|
if (focusable === void 0) { focusable = true; }
|
|
1035
|
-
var
|
|
1246
|
+
var document = getGlobal$1().document;
|
|
1247
|
+
var element = document.createElement(tagName);
|
|
1036
1248
|
if (typeof element.width !== 'undefined')
|
|
1037
1249
|
element.width = '0';
|
|
1038
1250
|
if (typeof element.height !== 'undefined')
|
|
@@ -1083,116 +1295,301 @@
|
|
|
1083
1295
|
return element;
|
|
1084
1296
|
}
|
|
1085
1297
|
|
|
1086
|
-
var
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1298
|
+
var version = "0.0.5";
|
|
1299
|
+
var packageJSON = {
|
|
1300
|
+
version: version};
|
|
1301
|
+
|
|
1302
|
+
var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
|
|
1303
|
+
var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
|
|
1304
|
+
var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
|
|
1305
|
+
var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
|
|
1306
|
+
var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
|
|
1307
|
+
var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
|
|
1308
|
+
var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
|
|
1309
|
+
var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
|
|
1310
|
+
function getGlobal() {
|
|
1311
|
+
if (typeof globalThis !== 'undefined')
|
|
1312
|
+
return globalThis;
|
|
1313
|
+
if (typeof self !== 'undefined')
|
|
1314
|
+
return self;
|
|
1315
|
+
if (typeof window !== 'undefined')
|
|
1316
|
+
return window;
|
|
1317
|
+
if (typeof global !== 'undefined')
|
|
1318
|
+
return global;
|
|
1319
|
+
return {};
|
|
1320
|
+
}
|
|
1321
|
+
function freeze(values) {
|
|
1322
|
+
return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
|
|
1323
|
+
}
|
|
1324
|
+
function contains(values, value) {
|
|
1325
|
+
for (var i = 0; i < values.length; i++) {
|
|
1326
|
+
if (values[i] === value)
|
|
1327
|
+
return true;
|
|
1328
|
+
}
|
|
1329
|
+
return false;
|
|
1330
|
+
}
|
|
1331
|
+
function getIntlLocaleConstructor() {
|
|
1332
|
+
if (typeof Intl === 'undefined')
|
|
1333
|
+
return undefined;
|
|
1334
|
+
var constructor = Intl.Locale;
|
|
1335
|
+
return typeof constructor === 'function' ? constructor : undefined;
|
|
1336
|
+
}
|
|
1337
|
+
function parseTag(raw) {
|
|
1338
|
+
if (raw === null || typeof raw !== 'string')
|
|
1091
1339
|
return null;
|
|
1092
|
-
|
|
1093
|
-
if (
|
|
1094
|
-
return 'en-US';
|
|
1095
|
-
if (locale.indexOf('.') !== -1)
|
|
1096
|
-
return normalizeLocale(locale.split('.')[0]);
|
|
1097
|
-
if (locale.indexOf('@') !== -1)
|
|
1098
|
-
return normalizeLocale(locale.split('@')[0]);
|
|
1099
|
-
var parts = locale.split('-');
|
|
1100
|
-
if (parts.length === 0)
|
|
1340
|
+
var value = raw.replace(/_/g, '-');
|
|
1341
|
+
if (value.length === 0)
|
|
1101
1342
|
return null;
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
1107
|
-
|
|
1343
|
+
if (value === 'C' || value.toLowerCase() === 'posix')
|
|
1344
|
+
value = 'en-US';
|
|
1345
|
+
var dot = value.indexOf('.');
|
|
1346
|
+
if (dot !== -1)
|
|
1347
|
+
value = value.slice(0, dot);
|
|
1348
|
+
var at = value.indexOf('@');
|
|
1349
|
+
if (at !== -1)
|
|
1350
|
+
value = value.slice(0, at);
|
|
1351
|
+
if (value.length === 0)
|
|
1352
|
+
return null;
|
|
1353
|
+
var segments = value.split('-');
|
|
1354
|
+
if (LANGUAGE_PATTERN.test(segments[0]) === false)
|
|
1355
|
+
return null;
|
|
1356
|
+
var language = segments[0].toLowerCase();
|
|
1357
|
+
var index = 1;
|
|
1358
|
+
var script = null;
|
|
1359
|
+
if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
|
|
1360
|
+
script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
|
|
1361
|
+
index++;
|
|
1362
|
+
}
|
|
1363
|
+
var region = null;
|
|
1364
|
+
if (index < segments.length && REGION_PATTERN.test(segments[index])) {
|
|
1365
|
+
region = segments[index].toUpperCase();
|
|
1366
|
+
index++;
|
|
1367
|
+
}
|
|
1368
|
+
var variants = [];
|
|
1369
|
+
while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
|
|
1370
|
+
variants.push(segments[index].toLowerCase());
|
|
1371
|
+
index++;
|
|
1372
|
+
}
|
|
1373
|
+
var extensions = [];
|
|
1374
|
+
while (index < segments.length) {
|
|
1375
|
+
var singleton = segments[index];
|
|
1376
|
+
if (SINGLETON_PATTERN.test(singleton) === false)
|
|
1377
|
+
return null;
|
|
1378
|
+
var isPrivateUse = singleton.toLowerCase() === 'x';
|
|
1379
|
+
var parts = [singleton.toLowerCase()];
|
|
1380
|
+
index++;
|
|
1381
|
+
while (index < segments.length) {
|
|
1382
|
+
var segment = segments[index];
|
|
1383
|
+
if (EXTENSION_PATTERN.test(segment) === false)
|
|
1384
|
+
return null;
|
|
1385
|
+
if (segment.length === 1 && isPrivateUse === false)
|
|
1386
|
+
break;
|
|
1387
|
+
parts.push(segment.toLowerCase());
|
|
1388
|
+
index++;
|
|
1389
|
+
}
|
|
1390
|
+
if (parts.length < 2)
|
|
1391
|
+
return null;
|
|
1392
|
+
extensions.push(parts.join('-'));
|
|
1393
|
+
}
|
|
1394
|
+
var base = [language];
|
|
1395
|
+
if (script !== null)
|
|
1396
|
+
base.push(script);
|
|
1397
|
+
if (region !== null)
|
|
1398
|
+
base.push(region);
|
|
1399
|
+
for (var i = 0; i < variants.length; i++)
|
|
1400
|
+
base.push(variants[i]);
|
|
1401
|
+
var baseName = base.join('-');
|
|
1402
|
+
return {
|
|
1403
|
+
tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
|
|
1404
|
+
baseName: baseName,
|
|
1405
|
+
language: language,
|
|
1406
|
+
script: script,
|
|
1407
|
+
region: region,
|
|
1408
|
+
variants: freeze(variants),
|
|
1409
|
+
extensions: freeze(extensions),
|
|
1410
|
+
};
|
|
1108
1411
|
}
|
|
1412
|
+
function isRTL(subtags) {
|
|
1413
|
+
if (subtags.script !== null)
|
|
1414
|
+
return contains(RTL_SCRIPTS, subtags.script);
|
|
1415
|
+
return contains(RTL_LANGUAGES, subtags.language);
|
|
1416
|
+
}
|
|
1417
|
+
function expandTag(tag) {
|
|
1418
|
+
var parsed = parseTag(tag);
|
|
1419
|
+
if (parsed === null)
|
|
1420
|
+
return freeze([]);
|
|
1421
|
+
var segments = parsed.baseName.split('-');
|
|
1422
|
+
var chain = [];
|
|
1423
|
+
for (var i = segments.length; i > 0; i--)
|
|
1424
|
+
chain.push(segments.slice(0, i).join('-'));
|
|
1425
|
+
return freeze(chain);
|
|
1426
|
+
}
|
|
1427
|
+
function toLookupKey(tag) {
|
|
1428
|
+
var parsed = parseTag(tag);
|
|
1429
|
+
return (parsed === null ? tag : parsed.baseName).toLowerCase();
|
|
1430
|
+
}
|
|
1431
|
+
function lookupTag(supported, preferred, fallback) {
|
|
1432
|
+
if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
|
|
1433
|
+
return fallback;
|
|
1434
|
+
var keys = [];
|
|
1435
|
+
for (var i = 0; i < supported.length; i++)
|
|
1436
|
+
keys.push(toLookupKey(supported[i]));
|
|
1437
|
+
for (var i = 0; i < preferred.length; i++) {
|
|
1438
|
+
var chain = expandTag(preferred[i]);
|
|
1439
|
+
for (var j = 0; j < chain.length; j++) {
|
|
1440
|
+
var candidate = chain[j].toLowerCase();
|
|
1441
|
+
var prefix = candidate + '-';
|
|
1442
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1443
|
+
if (keys[k] === candidate)
|
|
1444
|
+
return supported[k];
|
|
1445
|
+
}
|
|
1446
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1447
|
+
if (keys[k].indexOf(prefix) === 0)
|
|
1448
|
+
return supported[k];
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
return fallback;
|
|
1453
|
+
}
|
|
1454
|
+
function resolveDirection(primary) {
|
|
1455
|
+
if (primary === null)
|
|
1456
|
+
return false;
|
|
1457
|
+
var IntlLocale = getIntlLocaleConstructor();
|
|
1458
|
+
if (typeof IntlLocale !== 'undefined') {
|
|
1459
|
+
try {
|
|
1460
|
+
var intlLocale = new IntlLocale(primary.tag);
|
|
1461
|
+
if (typeof intlLocale.getTextInfo === 'function')
|
|
1462
|
+
return intlLocale.getTextInfo().direction === 'rtl';
|
|
1463
|
+
if (typeof intlLocale.textInfo !== 'undefined')
|
|
1464
|
+
return intlLocale.textInfo.direction === 'rtl';
|
|
1465
|
+
}
|
|
1466
|
+
catch (_) {
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return isRTL(primary);
|
|
1470
|
+
}
|
|
1471
|
+
var subtags = null;
|
|
1109
1472
|
var language = null;
|
|
1110
|
-
var languages = [];
|
|
1473
|
+
var languages = freeze([]);
|
|
1474
|
+
var fallbacks = freeze([]);
|
|
1111
1475
|
var timezone = null;
|
|
1112
1476
|
var offset = 0;
|
|
1113
|
-
var
|
|
1114
|
-
function
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1123
|
-
|
|
1477
|
+
var rtl = false;
|
|
1478
|
+
function resolveLanguages(candidates) {
|
|
1479
|
+
var resolved = [];
|
|
1480
|
+
var primary = null;
|
|
1481
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
1482
|
+
var parsed = parseTag(candidates[i]);
|
|
1483
|
+
if (parsed === null)
|
|
1484
|
+
continue;
|
|
1485
|
+
if (contains(resolved, parsed.baseName))
|
|
1486
|
+
continue;
|
|
1487
|
+
if (primary === null)
|
|
1488
|
+
primary = parsed;
|
|
1489
|
+
resolved.push(parsed.baseName);
|
|
1490
|
+
}
|
|
1491
|
+
subtags = primary;
|
|
1492
|
+
language = primary === null ? null : primary.baseName;
|
|
1493
|
+
languages = freeze(resolved);
|
|
1494
|
+
fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
|
|
1495
|
+
rtl = resolveDirection(primary);
|
|
1496
|
+
}
|
|
1497
|
+
function collectEnvironmentLanguages() {
|
|
1498
|
+
var candidates = [];
|
|
1499
|
+
var navigatorLike = getGlobal().navigator;
|
|
1500
|
+
if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
|
|
1501
|
+
if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
|
|
1502
|
+
for (var i = 0; i < navigatorLike.languages.length; i++)
|
|
1503
|
+
candidates.push(navigatorLike.languages[i]);
|
|
1504
|
+
}
|
|
1505
|
+
candidates.push(navigatorLike.language);
|
|
1506
|
+
candidates.push(navigatorLike.userLanguage);
|
|
1507
|
+
candidates.push(navigatorLike.browserLanguage);
|
|
1508
|
+
candidates.push(navigatorLike.systemLanguage);
|
|
1509
|
+
}
|
|
1510
|
+
if (typeof Intl !== 'undefined') {
|
|
1511
|
+
try {
|
|
1512
|
+
candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
1513
|
+
}
|
|
1514
|
+
catch (_) {
|
|
1515
|
+
}
|
|
1124
1516
|
}
|
|
1517
|
+
return candidates;
|
|
1125
1518
|
}
|
|
1519
|
+
var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
|
|
1520
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
1126
1521
|
if (typeof Intl !== 'undefined') {
|
|
1127
|
-
try {
|
|
1128
|
-
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
1129
|
-
}
|
|
1130
|
-
catch (_) {
|
|
1131
|
-
}
|
|
1132
1522
|
try {
|
|
1133
1523
|
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1134
1524
|
}
|
|
1135
1525
|
catch (_) {
|
|
1136
1526
|
}
|
|
1137
1527
|
}
|
|
1138
|
-
if (typeof globalThis.navigator !== 'undefined') {
|
|
1139
|
-
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
1140
|
-
addLanguages(globalThis.navigator.languages);
|
|
1141
|
-
if (typeof globalThis.navigator.language !== 'undefined')
|
|
1142
|
-
addLanguage(globalThis.navigator.language);
|
|
1143
|
-
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
1144
|
-
addLanguage(globalThis.navigator.userLanguage);
|
|
1145
|
-
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
1146
|
-
addLanguage(globalThis.navigator.browserLanguage);
|
|
1147
|
-
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
1148
|
-
addLanguage(globalThis.navigator.systemLanguage);
|
|
1149
|
-
}
|
|
1150
1528
|
try {
|
|
1151
1529
|
offset = new Date().getTimezoneOffset() * -1;
|
|
1152
1530
|
}
|
|
1153
1531
|
catch (_) {
|
|
1154
1532
|
}
|
|
1155
|
-
if (typeof language === 'string') {
|
|
1156
|
-
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
1157
|
-
try {
|
|
1158
|
-
var intlLocale = new Intl.Locale(language);
|
|
1159
|
-
if (typeof intlLocale.getTextInfo === 'function')
|
|
1160
|
-
isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
|
|
1161
|
-
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
1162
|
-
isRTLResolved = intlLocale.textInfo.direction === 'rtl';
|
|
1163
|
-
}
|
|
1164
|
-
catch (_) {
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
if (typeof isRTLResolved !== 'boolean') {
|
|
1168
|
-
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
|
|
1169
|
-
if (matched !== null) {
|
|
1170
|
-
var lang = matched[1].toLowerCase();
|
|
1171
|
-
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
1172
|
-
if (RTL_LANGUAGES[i] === lang) {
|
|
1173
|
-
isRTLResolved = true;
|
|
1174
|
-
break;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
1533
|
var LocaleKit = {
|
|
1181
|
-
|
|
1534
|
+
version: packageJSON.version,
|
|
1535
|
+
get language() {
|
|
1536
|
+
return language;
|
|
1537
|
+
},
|
|
1538
|
+
get languages() {
|
|
1539
|
+
return languages;
|
|
1540
|
+
},
|
|
1541
|
+
set languages(value) {
|
|
1542
|
+
resolveLanguages(typeof value === 'string' ? [value] : value);
|
|
1543
|
+
},
|
|
1544
|
+
get subtags() {
|
|
1545
|
+
return subtags;
|
|
1546
|
+
},
|
|
1547
|
+
get fallbacks() {
|
|
1548
|
+
return fallbacks;
|
|
1549
|
+
},
|
|
1550
|
+
get timezone() {
|
|
1551
|
+
return timezone;
|
|
1552
|
+
},
|
|
1553
|
+
get offset() {
|
|
1554
|
+
return offset;
|
|
1555
|
+
},
|
|
1556
|
+
get rtl() {
|
|
1557
|
+
return rtl;
|
|
1558
|
+
},
|
|
1559
|
+
reset: function () {
|
|
1560
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
1561
|
+
},
|
|
1562
|
+
parse: function (tag) {
|
|
1563
|
+
return parseTag(tag);
|
|
1564
|
+
},
|
|
1565
|
+
expand: function (tag) {
|
|
1566
|
+
return expandTag(tag);
|
|
1567
|
+
},
|
|
1568
|
+
lookup: function (supported, fallback) {
|
|
1569
|
+
return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
|
|
1570
|
+
},
|
|
1571
|
+
};
|
|
1572
|
+
if (typeof Object.freeze === 'function')
|
|
1573
|
+
Object.freeze(LocaleKit);
|
|
1182
1574
|
|
|
1575
|
+
var GLOBAL$1 = getGlobal$1();
|
|
1576
|
+
var CACHE_PREFIX = 'web-launch-kit:';
|
|
1183
1577
|
var TRACK_ID = 'track-id';
|
|
1184
|
-
var
|
|
1578
|
+
var PRODUCT_ID = 'product-id';
|
|
1185
1579
|
var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
|
|
1580
|
+
function toCacheKey(mode, query) {
|
|
1581
|
+
return CACHE_PREFIX + mode + ':' + query;
|
|
1582
|
+
}
|
|
1186
1583
|
var idCache = (function () {
|
|
1187
1584
|
var supportsLocalStorage;
|
|
1188
1585
|
try {
|
|
1189
|
-
if (typeof
|
|
1586
|
+
if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
|
|
1190
1587
|
supportsLocalStorage = false;
|
|
1191
1588
|
}
|
|
1192
1589
|
else {
|
|
1193
1590
|
var key = '__id_cache_test__';
|
|
1194
|
-
|
|
1195
|
-
|
|
1591
|
+
GLOBAL$1.localStorage.setItem(key, '');
|
|
1592
|
+
GLOBAL$1.localStorage.removeItem(key);
|
|
1196
1593
|
supportsLocalStorage = true;
|
|
1197
1594
|
}
|
|
1198
1595
|
}
|
|
@@ -1203,7 +1600,7 @@
|
|
|
1203
1600
|
return {
|
|
1204
1601
|
get: function (mode, query) {
|
|
1205
1602
|
try {
|
|
1206
|
-
var item =
|
|
1603
|
+
var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
|
|
1207
1604
|
if (item == null)
|
|
1208
1605
|
return undefined;
|
|
1209
1606
|
var split = item.split('|');
|
|
@@ -1211,7 +1608,7 @@
|
|
|
1211
1608
|
return undefined;
|
|
1212
1609
|
var expiry = +split[0];
|
|
1213
1610
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1214
|
-
|
|
1611
|
+
GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
|
|
1215
1612
|
return undefined;
|
|
1216
1613
|
}
|
|
1217
1614
|
return split[1];
|
|
@@ -1222,7 +1619,7 @@
|
|
|
1222
1619
|
},
|
|
1223
1620
|
set: function (mode, query, id) {
|
|
1224
1621
|
try {
|
|
1225
|
-
|
|
1622
|
+
GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
1226
1623
|
}
|
|
1227
1624
|
catch (_) {
|
|
1228
1625
|
return;
|
|
@@ -1230,11 +1627,11 @@
|
|
|
1230
1627
|
}
|
|
1231
1628
|
};
|
|
1232
1629
|
}
|
|
1233
|
-
if (typeof
|
|
1234
|
-
var cache_1 = new Map();
|
|
1630
|
+
if (typeof GLOBAL$1.Map !== 'undefined') {
|
|
1631
|
+
var cache_1 = new GLOBAL$1.Map();
|
|
1235
1632
|
return {
|
|
1236
1633
|
get: function (mode, query) {
|
|
1237
|
-
var item = cache_1.get(mode
|
|
1634
|
+
var item = cache_1.get(toCacheKey(mode, query));
|
|
1238
1635
|
if (typeof item === 'undefined')
|
|
1239
1636
|
return undefined;
|
|
1240
1637
|
var split = item.split('|');
|
|
@@ -1242,20 +1639,20 @@
|
|
|
1242
1639
|
return undefined;
|
|
1243
1640
|
var expiry = +split[0];
|
|
1244
1641
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1245
|
-
cache_1.delete(mode
|
|
1642
|
+
cache_1.delete(toCacheKey(mode, query));
|
|
1246
1643
|
return undefined;
|
|
1247
1644
|
}
|
|
1248
1645
|
return split[1];
|
|
1249
1646
|
},
|
|
1250
1647
|
set: function (mode, query, id) {
|
|
1251
|
-
cache_1.set(mode
|
|
1648
|
+
cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
1252
1649
|
},
|
|
1253
1650
|
};
|
|
1254
1651
|
}
|
|
1255
1652
|
var cache = Object.create(null);
|
|
1256
1653
|
return {
|
|
1257
1654
|
get: function (mode, query) {
|
|
1258
|
-
var item = cache[mode
|
|
1655
|
+
var item = cache[toCacheKey(mode, query)];
|
|
1259
1656
|
if (typeof item === 'undefined')
|
|
1260
1657
|
return undefined;
|
|
1261
1658
|
var split = item.split('|');
|
|
@@ -1264,17 +1661,17 @@
|
|
|
1264
1661
|
var expiry = +split[0];
|
|
1265
1662
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1266
1663
|
try {
|
|
1267
|
-
delete cache[mode
|
|
1664
|
+
delete cache[toCacheKey(mode, query)];
|
|
1268
1665
|
}
|
|
1269
1666
|
catch (_) {
|
|
1270
|
-
cache[mode
|
|
1667
|
+
cache[toCacheKey(mode, query)] = undefined;
|
|
1271
1668
|
}
|
|
1272
1669
|
return undefined;
|
|
1273
1670
|
}
|
|
1274
1671
|
return split[1];
|
|
1275
1672
|
},
|
|
1276
1673
|
set: function (mode, query, id) {
|
|
1277
|
-
cache[mode
|
|
1674
|
+
cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
|
|
1278
1675
|
}
|
|
1279
1676
|
};
|
|
1280
1677
|
})();
|
|
@@ -1288,8 +1685,8 @@
|
|
|
1288
1685
|
}
|
|
1289
1686
|
function requestGet(url, async) {
|
|
1290
1687
|
if (async === void 0) { async = false; }
|
|
1291
|
-
if (typeof
|
|
1292
|
-
return
|
|
1688
|
+
if (typeof GLOBAL$1.fetch === 'function' && async) {
|
|
1689
|
+
return GLOBAL$1.fetch(url)
|
|
1293
1690
|
.then(function (response) {
|
|
1294
1691
|
return response.json();
|
|
1295
1692
|
})
|
|
@@ -1332,10 +1729,10 @@
|
|
|
1332
1729
|
if (locale === candidate)
|
|
1333
1730
|
break;
|
|
1334
1731
|
}
|
|
1335
|
-
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' +
|
|
1732
|
+
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
|
|
1336
1733
|
}
|
|
1337
1734
|
function resolveGetTrackIdURL(bundleId) {
|
|
1338
|
-
return 'https://itunes.apple.com/lookup?bundleId=' +
|
|
1735
|
+
return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
|
|
1339
1736
|
}
|
|
1340
1737
|
function parseGetProductIdResponse(response) {
|
|
1341
1738
|
if (typeof response === 'undefined')
|
|
@@ -1361,14 +1758,14 @@
|
|
|
1361
1758
|
return '' + result.trackId;
|
|
1362
1759
|
}
|
|
1363
1760
|
function getProductId(packageFamilyName) {
|
|
1364
|
-
var cache = idCache.get(
|
|
1761
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1365
1762
|
if (typeof cache !== 'undefined')
|
|
1366
1763
|
return cache;
|
|
1367
1764
|
try {
|
|
1368
1765
|
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
|
|
1369
1766
|
if (typeof productId === 'undefined')
|
|
1370
1767
|
return undefined;
|
|
1371
|
-
idCache.set(
|
|
1768
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
1372
1769
|
return productId;
|
|
1373
1770
|
}
|
|
1374
1771
|
catch (_) {
|
|
@@ -1391,7 +1788,7 @@
|
|
|
1391
1788
|
}
|
|
1392
1789
|
}
|
|
1393
1790
|
function getProductIdAsync(packageFamilyName) {
|
|
1394
|
-
var cache = idCache.get(
|
|
1791
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1395
1792
|
if (typeof cache !== 'undefined')
|
|
1396
1793
|
return Promise.resolve(cache);
|
|
1397
1794
|
try {
|
|
@@ -1400,7 +1797,7 @@
|
|
|
1400
1797
|
.then(function (productId) {
|
|
1401
1798
|
if (typeof productId === 'undefined')
|
|
1402
1799
|
return undefined;
|
|
1403
|
-
idCache.set(
|
|
1800
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
1404
1801
|
return productId;
|
|
1405
1802
|
});
|
|
1406
1803
|
}
|
|
@@ -1428,15 +1825,16 @@
|
|
|
1428
1825
|
}
|
|
1429
1826
|
|
|
1430
1827
|
function getTopmostWindow() {
|
|
1828
|
+
var globalLike = getGlobal$1();
|
|
1431
1829
|
try {
|
|
1432
|
-
if (
|
|
1433
|
-
void
|
|
1434
|
-
return
|
|
1830
|
+
if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
|
|
1831
|
+
void globalLike.top.location.href;
|
|
1832
|
+
return globalLike.top;
|
|
1435
1833
|
}
|
|
1436
1834
|
}
|
|
1437
1835
|
catch (_) {
|
|
1438
1836
|
}
|
|
1439
|
-
return
|
|
1837
|
+
return globalLike;
|
|
1440
1838
|
}
|
|
1441
1839
|
|
|
1442
1840
|
exports.SettingType = void 0;
|
|
@@ -1507,7 +1905,8 @@
|
|
|
1507
1905
|
var WINDOWS_DEFAULT_TIMEOUT = 750;
|
|
1508
1906
|
var MACOS_DEFAULT_TIMEOUT = 750;
|
|
1509
1907
|
var DEFAULT_TIMEOUT = 750;
|
|
1510
|
-
var
|
|
1908
|
+
var GLOBAL = getGlobal$1();
|
|
1909
|
+
var NAVIGATOR = GLOBAL.navigator;
|
|
1511
1910
|
var CLEANUP_INPUT_ELEMENT = null;
|
|
1512
1911
|
function createTypeGuard(tag) {
|
|
1513
1912
|
return function (value) {
|
|
@@ -1567,7 +1966,7 @@
|
|
|
1567
1966
|
return true;
|
|
1568
1967
|
}
|
|
1569
1968
|
function dispatchClickEvent(element, view) {
|
|
1570
|
-
if (view === void 0) { view =
|
|
1969
|
+
if (view === void 0) { view = GLOBAL; }
|
|
1571
1970
|
var fake;
|
|
1572
1971
|
try {
|
|
1573
1972
|
fake = new MouseEvent('click', {
|
|
@@ -1577,7 +1976,7 @@
|
|
|
1577
1976
|
});
|
|
1578
1977
|
}
|
|
1579
1978
|
catch (_) {
|
|
1580
|
-
fake =
|
|
1979
|
+
fake = GLOBAL.document.createEvent('MouseEvents');
|
|
1581
1980
|
fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
1582
1981
|
}
|
|
1583
1982
|
element.dispatchEvent(fake);
|
|
@@ -1605,11 +2004,14 @@
|
|
|
1605
2004
|
focus(top);
|
|
1606
2005
|
if (hasFocus(topDocument))
|
|
1607
2006
|
return true;
|
|
1608
|
-
|
|
1609
|
-
|
|
2007
|
+
var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
|
|
2008
|
+
if (!hadBodyTabIndex)
|
|
2009
|
+
topDocument.body.setAttribute('tabindex', '-1');
|
|
1610
2010
|
focus(topDocument.body);
|
|
1611
2011
|
if (hasFocus(topDocument))
|
|
1612
2012
|
return true;
|
|
2013
|
+
if (!hadBodyTabIndex)
|
|
2014
|
+
topDocument.body.removeAttribute('tabindex');
|
|
1613
2015
|
var input = undefined;
|
|
1614
2016
|
try {
|
|
1615
2017
|
input = createHiddenElement('input');
|
|
@@ -1651,7 +2053,7 @@
|
|
|
1651
2053
|
function resolveFocusEventConfig() {
|
|
1652
2054
|
var top = getTopmostWindow();
|
|
1653
2055
|
var topDocument = top.document;
|
|
1654
|
-
if (typeof
|
|
2056
|
+
if (typeof GLOBAL.cordova !== 'undefined') {
|
|
1655
2057
|
return {
|
|
1656
2058
|
focus: {
|
|
1657
2059
|
target: topDocument,
|
|
@@ -1689,7 +2091,7 @@
|
|
|
1689
2091
|
};
|
|
1690
2092
|
}
|
|
1691
2093
|
}
|
|
1692
|
-
else if (typeof
|
|
2094
|
+
else if (typeof GLOBAL.document.addEventListener === 'function') {
|
|
1693
2095
|
return {
|
|
1694
2096
|
focus: {
|
|
1695
2097
|
target: top,
|
|
@@ -1729,12 +2131,12 @@
|
|
|
1729
2131
|
var anchor = undefined;
|
|
1730
2132
|
var iframe = undefined;
|
|
1731
2133
|
function open() {
|
|
1732
|
-
if (typeof
|
|
1733
|
-
if (typeof
|
|
1734
|
-
|
|
2134
|
+
if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
|
|
2135
|
+
if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
|
|
2136
|
+
GLOBAL.cordova.InAppBrowser.open(url, '_system');
|
|
1735
2137
|
}
|
|
1736
|
-
else {
|
|
1737
|
-
|
|
2138
|
+
else if (typeof GLOBAL.open === 'function') {
|
|
2139
|
+
GLOBAL.open(url, '_system');
|
|
1738
2140
|
}
|
|
1739
2141
|
return;
|
|
1740
2142
|
}
|
|
@@ -1764,7 +2166,7 @@
|
|
|
1764
2166
|
iframe = createHiddenElement('iframe');
|
|
1765
2167
|
iframe.src = url;
|
|
1766
2168
|
topDocument.body.appendChild(iframe);
|
|
1767
|
-
|
|
2169
|
+
setTimeout(function () {
|
|
1768
2170
|
if (typeof iframe !== 'undefined') {
|
|
1769
2171
|
try {
|
|
1770
2172
|
topDocument.body.removeChild(iframe);
|
|
@@ -1828,7 +2230,7 @@
|
|
|
1828
2230
|
timeoutId = undefined;
|
|
1829
2231
|
}
|
|
1830
2232
|
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
1831
|
-
EventKit.remove(config.blur.target, config.blur.type,
|
|
2233
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
1832
2234
|
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
1833
2235
|
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
1834
2236
|
}
|
|
@@ -1841,7 +2243,7 @@
|
|
|
1841
2243
|
else
|
|
1842
2244
|
onfocus();
|
|
1843
2245
|
}
|
|
1844
|
-
timeoutId =
|
|
2246
|
+
timeoutId = setTimeout(function () {
|
|
1845
2247
|
done(false);
|
|
1846
2248
|
}, timeout);
|
|
1847
2249
|
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
@@ -2049,13 +2451,22 @@
|
|
|
2049
2451
|
function isPartnerAppOnly() {
|
|
2050
2452
|
return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
|
|
2051
2453
|
}
|
|
2454
|
+
function canOpenWindowsSetting(version) {
|
|
2455
|
+
if (version.length === 0)
|
|
2456
|
+
return false;
|
|
2457
|
+
if (/^\d/.test(version) === false)
|
|
2458
|
+
return false;
|
|
2459
|
+
if (version === '95' || version === '98' || version === '2000')
|
|
2460
|
+
return false;
|
|
2461
|
+
return PlatformKit.compareVersion(version, '10') >= 0;
|
|
2462
|
+
}
|
|
2052
2463
|
function canOpenSetting() {
|
|
2053
2464
|
var os = PlatformKit.os.name;
|
|
2054
2465
|
var version = PlatformKit.os.version;
|
|
2055
2466
|
return !(os === 'unknown'
|
|
2056
2467
|
|| (os === 'android' && !canOpenIntent())
|
|
2057
2468
|
|| os === 'ios'
|
|
2058
|
-
|| (os === 'windows' && (version
|
|
2469
|
+
|| (os === 'windows' && !canOpenWindowsSetting(version))
|
|
2059
2470
|
|| (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
|
|
2060
2471
|
}
|
|
2061
2472
|
function parseIntentURL(intent) {
|
|
@@ -2084,7 +2495,7 @@
|
|
|
2084
2495
|
if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
|
|
2085
2496
|
var fallback = extras['S.browser_fallback_url'];
|
|
2086
2497
|
try {
|
|
2087
|
-
fallback =
|
|
2498
|
+
fallback = decodeURIComponent(fallback);
|
|
2088
2499
|
}
|
|
2089
2500
|
catch (_) {
|
|
2090
2501
|
}
|
|
@@ -2104,9 +2515,9 @@
|
|
|
2104
2515
|
if (typeof packageName !== 'undefined')
|
|
2105
2516
|
intent += 'package=' + packageName + ';';
|
|
2106
2517
|
if (typeof fallback !== 'undefined' && typeof fallback === 'string')
|
|
2107
|
-
intent += 'S.browser_fallback_url=' +
|
|
2518
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
|
|
2108
2519
|
else if (typeof packageName !== 'undefined')
|
|
2109
|
-
intent += 'S.browser_fallback_url=' +
|
|
2520
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
|
|
2110
2521
|
return intent + 'end';
|
|
2111
2522
|
}
|
|
2112
2523
|
function createAppStoreURL(id, os) {
|
|
@@ -2138,7 +2549,7 @@
|
|
|
2138
2549
|
}
|
|
2139
2550
|
}
|
|
2140
2551
|
function escapeURIComponentString(value) {
|
|
2141
|
-
return
|
|
2552
|
+
return encodeURIComponent(value)
|
|
2142
2553
|
.replace(/[!'()*]/g, function (char) {
|
|
2143
2554
|
return '%' + char.charCodeAt(0).toString(16);
|
|
2144
2555
|
});
|
|
@@ -2207,10 +2618,10 @@
|
|
|
2207
2618
|
return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
|
|
2208
2619
|
}
|
|
2209
2620
|
function canShowDirectoryPicker() {
|
|
2210
|
-
return typeof
|
|
2621
|
+
return typeof GLOBAL.showDirectoryPicker === 'function';
|
|
2211
2622
|
}
|
|
2212
2623
|
function canShowOpenFilePicker() {
|
|
2213
|
-
return typeof
|
|
2624
|
+
return typeof GLOBAL.showOpenFilePicker === 'function';
|
|
2214
2625
|
}
|
|
2215
2626
|
function isFileSystemFileHandle(handle) {
|
|
2216
2627
|
return handle.kind === 'file';
|
|
@@ -2278,7 +2689,7 @@
|
|
|
2278
2689
|
resolve(fileListToArray(module.files));
|
|
2279
2690
|
}
|
|
2280
2691
|
function onfocus() {
|
|
2281
|
-
|
|
2692
|
+
setTimeout(function () {
|
|
2282
2693
|
if (module.value.length > 0)
|
|
2283
2694
|
done(true);
|
|
2284
2695
|
else
|
|
@@ -2308,7 +2719,7 @@
|
|
|
2308
2719
|
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
2309
2720
|
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2310
2721
|
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2311
|
-
|
|
2722
|
+
setTimeout(function () {
|
|
2312
2723
|
EventKit.add(topDocument, 'click', onclick);
|
|
2313
2724
|
}, 100);
|
|
2314
2725
|
CLEANUP_INPUT_ELEMENT = function () {
|
|
@@ -2393,7 +2804,7 @@
|
|
|
2393
2804
|
}
|
|
2394
2805
|
var LaunchKit = {
|
|
2395
2806
|
SettingType: exports.SettingType,
|
|
2396
|
-
version: packageJSON$
|
|
2807
|
+
version: packageJSON$3.version,
|
|
2397
2808
|
utils: {
|
|
2398
2809
|
get canOpenIntent() {
|
|
2399
2810
|
return canOpenIntent();
|
|
@@ -2441,7 +2852,12 @@
|
|
|
2441
2852
|
}
|
|
2442
2853
|
else {
|
|
2443
2854
|
tried[index] = '[function fallback]';
|
|
2444
|
-
|
|
2855
|
+
try {
|
|
2856
|
+
url();
|
|
2857
|
+
}
|
|
2858
|
+
catch (_) {
|
|
2859
|
+
return openURLSequential(index + 1);
|
|
2860
|
+
}
|
|
2445
2861
|
resolve(by);
|
|
2446
2862
|
}
|
|
2447
2863
|
}
|
|
@@ -2614,7 +3030,7 @@
|
|
|
2614
3030
|
option.id = options.id;
|
|
2615
3031
|
if (typeof options.startIn !== 'undefined')
|
|
2616
3032
|
option.startIn = options.startIn;
|
|
2617
|
-
module =
|
|
3033
|
+
module = GLOBAL.showDirectoryPicker(option);
|
|
2618
3034
|
}
|
|
2619
3035
|
else {
|
|
2620
3036
|
var input = createHiddenElement('input');
|
|
@@ -2652,7 +3068,7 @@
|
|
|
2652
3068
|
}
|
|
2653
3069
|
}
|
|
2654
3070
|
}
|
|
2655
|
-
module =
|
|
3071
|
+
module = GLOBAL.showOpenFilePicker(option);
|
|
2656
3072
|
}
|
|
2657
3073
|
else {
|
|
2658
3074
|
var input = createHiddenElement('input');
|