@eva/plugin-a11y 1.2.7-fix.1 → 1.2.7-fix.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.
@@ -1,3715 +1,729 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('pixi.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', 'pixi.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.a11y = {}), global.EVA, global.PIXI));
5
- }(this, (function (exports, eva_js, pixi_js) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics$2 = function(d, b) {
24
- extendStatics$2 = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics$2(d, b);
28
- };
29
-
30
- function __extends$2(d, b) {
31
- extendStatics$2(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign$1 = function() {
37
- __assign$1 = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign$1.apply(this, arguments);
45
- };
46
-
47
- function __decorate$1(decorators, target, key, desc) {
48
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
50
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
51
- return c > 3 && r && Object.defineProperty(target, key, r), r;
52
- }
53
-
54
- function __awaiter(thisArg, _arguments, P, generator) {
55
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
56
- return new (P || (P = Promise))(function (resolve, reject) {
57
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
58
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
59
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
60
- step((generator = generator.apply(thisArg, _arguments || [])).next());
61
- });
62
- }
63
-
64
- function __generator(thisArg, body) {
65
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
66
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
67
- function verb(n) { return function (v) { return step([n, v]); }; }
68
- function step(op) {
69
- if (f) throw new TypeError("Generator is already executing.");
70
- while (_) try {
71
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
72
- if (y = 0, t) op = [op[0] & 2, t.value];
73
- switch (op[0]) {
74
- case 0: case 1: t = op; break;
75
- case 4: _.label++; return { value: op[1], done: false };
76
- case 5: _.label++; y = op[1]; op = [0]; continue;
77
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
78
- default:
79
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
80
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
81
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
82
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
83
- if (t[2]) _.ops.pop();
84
- _.trys.pop(); continue;
85
- }
86
- op = body.call(thisArg, _);
87
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
88
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
89
- }
90
- }
91
-
92
- function __values$1(o) {
93
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
94
- if (m) return m.call(o);
95
- if (o && typeof o.length === "number") return {
96
- next: function () {
97
- if (o && i >= o.length) o = void 0;
98
- return { value: o && o[i++], done: !o };
99
- }
100
- };
101
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
102
- }
103
-
104
- /*! *****************************************************************************
105
- Copyright (c) Microsoft Corporation. All rights reserved.
106
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
107
- this file except in compliance with the License. You may obtain a copy of the
108
- License at http://www.apache.org/licenses/LICENSE-2.0
109
-
110
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
111
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
112
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
113
- MERCHANTABLITY OR NON-INFRINGEMENT.
114
-
115
- See the Apache Version 2.0 License for specific language governing permissions
116
- and limitations under the License.
117
- ***************************************************************************** */
118
- /* global Reflect, Promise */
119
-
120
- var extendStatics$1 = function(d, b) {
121
- extendStatics$1 = Object.setPrototypeOf ||
122
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
123
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
124
- return extendStatics$1(d, b);
125
- };
126
-
127
- function __extends$1(d, b) {
128
- extendStatics$1(d, b);
129
- function __() { this.constructor = d; }
130
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
131
- }
132
-
133
- var Application = (function (_super) {
134
- __extends$1(Application, _super);
135
- function Application(params) {
136
- var _this = this;
137
- params.autoStart = false;
138
- _this = _super.call(this, params) || this;
139
- return _this;
140
- }
141
- return Application;
142
- }(pixi_js.Application));
143
- var Application$1 = Application;
144
-
145
- var Container = (function (_super) {
146
- __extends$1(Container, _super);
147
- function Container() {
148
- return _super !== null && _super.apply(this, arguments) || this;
149
- }
150
- return Container;
151
- }(pixi_js.Container));
152
- var Container$1 = Container;
153
-
154
- ((function (_super) {
155
- __extends$1(Graphics, _super);
156
- function Graphics() {
157
- return _super !== null && _super.apply(this, arguments) || this;
158
- }
159
- return Graphics;
160
- })(pixi_js.Graphics));
161
-
162
- ((function (_super) {
163
- __extends$1(NinePatch, _super);
164
- function NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight) {
165
- var _this = this;
166
- var texture;
167
- if (img === 'string') {
168
- texture = pixi_js.Texture.fromFrame(img);
169
- }
170
- else {
171
- texture = pixi_js.Texture.from(img);
172
- }
173
- _this = _super.call(this, texture, leftWidth, topHeight, rightWidth, bottomHeight) || this;
174
- return _this;
175
- }
176
- return NinePatch;
177
- })(pixi_js.mesh.NineSlicePlane));
178
-
179
- ((function () {
180
- function Sprite(image) {
181
- this._image = null;
182
- this._image = image;
183
- if (image) {
184
- if (image instanceof HTMLImageElement) {
185
- this.sprite = pixi_js.Sprite.from(image);
186
- }
187
- else if (image instanceof pixi_js.Texture) {
188
- this.sprite = new pixi_js.Sprite(image);
189
- }
190
- }
191
- else {
192
- this.sprite = new pixi_js.Sprite();
193
- }
194
- }
195
- Object.defineProperty(Sprite.prototype, "image", {
196
- get: function () {
197
- return this._image;
198
- },
199
- set: function (val) {
200
- if (this._image === val) {
201
- return;
202
- }
203
- if (val instanceof HTMLImageElement) {
204
- this.sprite.texture && this.sprite.texture.destroy(false);
205
- this.sprite.texture = pixi_js.Texture.from(val);
206
- }
207
- else if (val instanceof pixi_js.Texture) {
208
- this.sprite.texture = val;
209
- }
210
- this._image = val;
211
- },
212
- enumerable: false,
213
- configurable: true
214
- });
215
- return Sprite;
216
- })());
217
-
218
- ((function () {
219
- function SpriteAnimation(_a) {
220
- var frames = _a.frames;
221
- this.animatedSprite = new pixi_js.extras.AnimatedSprite(frames);
222
- }
223
- SpriteAnimation.prototype.play = function () {
224
- this.animatedSprite.play();
225
- };
226
- SpriteAnimation.prototype.stop = function () {
227
- this.animatedSprite.stop();
228
- };
229
- SpriteAnimation.prototype.gotoAndPlay = function (frameNumber) {
230
- this.animatedSprite.gotoAndPlay(frameNumber);
231
- };
232
- SpriteAnimation.prototype.gotoAndStop = function (frameNumber) {
233
- this.animatedSprite.gotoAndStop(frameNumber);
234
- };
235
- Object.defineProperty(SpriteAnimation.prototype, "speed", {
236
- get: function () {
237
- return this.animatedSprite.animationSpeed;
238
- },
239
- set: function (val) {
240
- this.animatedSprite.animationSpeed = val;
241
- },
242
- enumerable: false,
243
- configurable: true
244
- });
245
- return SpriteAnimation;
246
- })());
247
-
248
- ((function (_super) {
249
- __extends$1(Text, _super);
250
- function Text(text, style) {
251
- return _super.call(this, text, style) || this;
252
- }
253
- return Text;
254
- })(pixi_js.Text));
255
-
256
- var PIXITilingSprite = pixi_js.extras.TilingSprite;
257
- ((function () {
258
- function TilingSprite(image) {
259
- this._image = null;
260
- this._image = image;
261
- if (image) {
262
- if (image instanceof HTMLImageElement) {
263
- this.tilingSprite = new PIXITilingSprite(pixi_js.Texture.from(image));
264
- }
265
- else if (image instanceof pixi_js.Texture) {
266
- this.tilingSprite = new PIXITilingSprite(image);
267
- }
268
- }
269
- else {
270
- this.tilingSprite = new PIXITilingSprite(pixi_js.Texture.EMPTY);
271
- }
272
- }
273
- Object.defineProperty(TilingSprite.prototype, "image", {
274
- get: function () {
275
- return this._image;
276
- },
277
- set: function (val) {
278
- if (this._image === val) {
279
- return;
280
- }
281
- if (val instanceof HTMLImageElement) {
282
- this.tilingSprite.texture = pixi_js.Texture.from(val);
283
- }
284
- else if (val instanceof pixi_js.Texture) {
285
- this.tilingSprite.texture = val;
286
- }
287
- this._image = val;
288
- },
289
- enumerable: false,
290
- configurable: true
291
- });
292
- return TilingSprite;
293
- })());
294
-
295
- /**
296
- * Removes all key-value entries from the list cache.
297
- *
298
- * @private
299
- * @name clear
300
- * @memberOf ListCache
301
- */
302
- function listCacheClear() {
303
- this.__data__ = [];
304
- this.size = 0;
305
- }
306
-
307
- /**
308
- * Performs a
309
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
310
- * comparison between two values to determine if they are equivalent.
311
- *
312
- * @static
313
- * @memberOf _
314
- * @since 4.0.0
315
- * @category Lang
316
- * @param {*} value The value to compare.
317
- * @param {*} other The other value to compare.
318
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
319
- * @example
320
- *
321
- * var object = { 'a': 1 };
322
- * var other = { 'a': 1 };
323
- *
324
- * _.eq(object, object);
325
- * // => true
326
- *
327
- * _.eq(object, other);
328
- * // => false
329
- *
330
- * _.eq('a', 'a');
331
- * // => true
332
- *
333
- * _.eq('a', Object('a'));
334
- * // => false
335
- *
336
- * _.eq(NaN, NaN);
337
- * // => true
338
- */
339
- function eq(value, other) {
340
- return value === other || (value !== value && other !== other);
341
- }
342
-
343
- /**
344
- * Gets the index at which the `key` is found in `array` of key-value pairs.
345
- *
346
- * @private
347
- * @param {Array} array The array to inspect.
348
- * @param {*} key The key to search for.
349
- * @returns {number} Returns the index of the matched value, else `-1`.
350
- */
351
- function assocIndexOf(array, key) {
352
- var length = array.length;
353
- while (length--) {
354
- if (eq(array[length][0], key)) {
355
- return length;
356
- }
357
- }
358
- return -1;
359
- }
360
-
361
- /** Used for built-in method references. */
362
- var arrayProto = Array.prototype;
363
-
364
- /** Built-in value references. */
365
- var splice = arrayProto.splice;
366
-
367
- /**
368
- * Removes `key` and its value from the list cache.
369
- *
370
- * @private
371
- * @name delete
372
- * @memberOf ListCache
373
- * @param {string} key The key of the value to remove.
374
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
375
- */
376
- function listCacheDelete(key) {
377
- var data = this.__data__,
378
- index = assocIndexOf(data, key);
379
-
380
- if (index < 0) {
381
- return false;
382
- }
383
- var lastIndex = data.length - 1;
384
- if (index == lastIndex) {
385
- data.pop();
386
- } else {
387
- splice.call(data, index, 1);
388
- }
389
- --this.size;
390
- return true;
391
- }
392
-
393
- /**
394
- * Gets the list cache value for `key`.
395
- *
396
- * @private
397
- * @name get
398
- * @memberOf ListCache
399
- * @param {string} key The key of the value to get.
400
- * @returns {*} Returns the entry value.
401
- */
402
- function listCacheGet(key) {
403
- var data = this.__data__,
404
- index = assocIndexOf(data, key);
405
-
406
- return index < 0 ? undefined : data[index][1];
407
- }
408
-
409
- /**
410
- * Checks if a list cache value for `key` exists.
411
- *
412
- * @private
413
- * @name has
414
- * @memberOf ListCache
415
- * @param {string} key The key of the entry to check.
416
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
417
- */
418
- function listCacheHas(key) {
419
- return assocIndexOf(this.__data__, key) > -1;
420
- }
421
-
422
- /**
423
- * Sets the list cache `key` to `value`.
424
- *
425
- * @private
426
- * @name set
427
- * @memberOf ListCache
428
- * @param {string} key The key of the value to set.
429
- * @param {*} value The value to set.
430
- * @returns {Object} Returns the list cache instance.
431
- */
432
- function listCacheSet(key, value) {
433
- var data = this.__data__,
434
- index = assocIndexOf(data, key);
435
-
436
- if (index < 0) {
437
- ++this.size;
438
- data.push([key, value]);
439
- } else {
440
- data[index][1] = value;
441
- }
442
- return this;
443
- }
444
-
445
- /**
446
- * Creates an list cache object.
447
- *
448
- * @private
449
- * @constructor
450
- * @param {Array} [entries] The key-value pairs to cache.
451
- */
452
- function ListCache(entries) {
453
- var index = -1,
454
- length = entries == null ? 0 : entries.length;
455
-
456
- this.clear();
457
- while (++index < length) {
458
- var entry = entries[index];
459
- this.set(entry[0], entry[1]);
460
- }
461
- }
462
-
463
- // Add methods to `ListCache`.
464
- ListCache.prototype.clear = listCacheClear;
465
- ListCache.prototype['delete'] = listCacheDelete;
466
- ListCache.prototype.get = listCacheGet;
467
- ListCache.prototype.has = listCacheHas;
468
- ListCache.prototype.set = listCacheSet;
469
-
470
- /**
471
- * Removes all key-value entries from the stack.
472
- *
473
- * @private
474
- * @name clear
475
- * @memberOf Stack
476
- */
477
- function stackClear() {
478
- this.__data__ = new ListCache;
479
- this.size = 0;
480
- }
481
-
482
- /**
483
- * Removes `key` and its value from the stack.
484
- *
485
- * @private
486
- * @name delete
487
- * @memberOf Stack
488
- * @param {string} key The key of the value to remove.
489
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
490
- */
491
- function stackDelete(key) {
492
- var data = this.__data__,
493
- result = data['delete'](key);
494
-
495
- this.size = data.size;
496
- return result;
497
- }
498
-
499
- /**
500
- * Gets the stack value for `key`.
501
- *
502
- * @private
503
- * @name get
504
- * @memberOf Stack
505
- * @param {string} key The key of the value to get.
506
- * @returns {*} Returns the entry value.
507
- */
508
- function stackGet(key) {
509
- return this.__data__.get(key);
510
- }
511
-
512
- /**
513
- * Checks if a stack value for `key` exists.
514
- *
515
- * @private
516
- * @name has
517
- * @memberOf Stack
518
- * @param {string} key The key of the entry to check.
519
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
520
- */
521
- function stackHas(key) {
522
- return this.__data__.has(key);
523
- }
524
-
525
- /** Detect free variable `global` from Node.js. */
526
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
527
-
528
- var freeGlobal$1 = freeGlobal;
529
-
530
- /** Detect free variable `self`. */
531
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
532
-
533
- /** Used as a reference to the global object. */
534
- var root = freeGlobal$1 || freeSelf || Function('return this')();
535
-
536
- var root$1 = root;
537
-
538
- /** Built-in value references. */
539
- var Symbol$1 = root$1.Symbol;
540
-
541
- var Symbol$2 = Symbol$1;
542
-
543
- /** Used for built-in method references. */
544
- var objectProto$b = Object.prototype;
545
-
546
- /** Used to check objects for own properties. */
547
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
548
-
549
- /**
550
- * Used to resolve the
551
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
552
- * of values.
553
- */
554
- var nativeObjectToString$1 = objectProto$b.toString;
555
-
556
- /** Built-in value references. */
557
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
558
-
559
- /**
560
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
561
- *
562
- * @private
563
- * @param {*} value The value to query.
564
- * @returns {string} Returns the raw `toStringTag`.
565
- */
566
- function getRawTag(value) {
567
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
568
- tag = value[symToStringTag$1];
569
-
570
- try {
571
- value[symToStringTag$1] = undefined;
572
- var unmasked = true;
573
- } catch (e) {}
574
-
575
- var result = nativeObjectToString$1.call(value);
576
- if (unmasked) {
577
- if (isOwn) {
578
- value[symToStringTag$1] = tag;
579
- } else {
580
- delete value[symToStringTag$1];
581
- }
582
- }
583
- return result;
584
- }
585
-
586
- /** Used for built-in method references. */
587
- var objectProto$a = Object.prototype;
588
-
589
- /**
590
- * Used to resolve the
591
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
592
- * of values.
593
- */
594
- var nativeObjectToString = objectProto$a.toString;
595
-
596
- /**
597
- * Converts `value` to a string using `Object.prototype.toString`.
598
- *
599
- * @private
600
- * @param {*} value The value to convert.
601
- * @returns {string} Returns the converted string.
602
- */
603
- function objectToString(value) {
604
- return nativeObjectToString.call(value);
605
- }
606
-
607
- /** `Object#toString` result references. */
608
- var nullTag = '[object Null]',
609
- undefinedTag = '[object Undefined]';
610
-
611
- /** Built-in value references. */
612
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
613
-
614
- /**
615
- * The base implementation of `getTag` without fallbacks for buggy environments.
616
- *
617
- * @private
618
- * @param {*} value The value to query.
619
- * @returns {string} Returns the `toStringTag`.
620
- */
621
- function baseGetTag(value) {
622
- if (value == null) {
623
- return value === undefined ? undefinedTag : nullTag;
624
- }
625
- return (symToStringTag && symToStringTag in Object(value))
626
- ? getRawTag(value)
627
- : objectToString(value);
628
- }
629
-
630
- /**
631
- * Checks if `value` is the
632
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
633
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
634
- *
635
- * @static
636
- * @memberOf _
637
- * @since 0.1.0
638
- * @category Lang
639
- * @param {*} value The value to check.
640
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
641
- * @example
642
- *
643
- * _.isObject({});
644
- * // => true
645
- *
646
- * _.isObject([1, 2, 3]);
647
- * // => true
648
- *
649
- * _.isObject(_.noop);
650
- * // => true
651
- *
652
- * _.isObject(null);
653
- * // => false
654
- */
655
- function isObject(value) {
656
- var type = typeof value;
657
- return value != null && (type == 'object' || type == 'function');
658
- }
659
-
660
- /** `Object#toString` result references. */
661
- var asyncTag = '[object AsyncFunction]',
662
- funcTag$1 = '[object Function]',
663
- genTag = '[object GeneratorFunction]',
664
- proxyTag = '[object Proxy]';
665
-
666
- /**
667
- * Checks if `value` is classified as a `Function` object.
668
- *
669
- * @static
670
- * @memberOf _
671
- * @since 0.1.0
672
- * @category Lang
673
- * @param {*} value The value to check.
674
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
675
- * @example
676
- *
677
- * _.isFunction(_);
678
- * // => true
679
- *
680
- * _.isFunction(/abc/);
681
- * // => false
682
- */
683
- function isFunction(value) {
684
- if (!isObject(value)) {
685
- return false;
686
- }
687
- // The use of `Object#toString` avoids issues with the `typeof` operator
688
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
689
- var tag = baseGetTag(value);
690
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
691
- }
692
-
693
- /** Used to detect overreaching core-js shims. */
694
- var coreJsData = root$1['__core-js_shared__'];
695
-
696
- var coreJsData$1 = coreJsData;
697
-
698
- /** Used to detect methods masquerading as native. */
699
- var maskSrcKey = (function() {
700
- var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
701
- return uid ? ('Symbol(src)_1.' + uid) : '';
702
- }());
703
-
704
- /**
705
- * Checks if `func` has its source masked.
706
- *
707
- * @private
708
- * @param {Function} func The function to check.
709
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
710
- */
711
- function isMasked(func) {
712
- return !!maskSrcKey && (maskSrcKey in func);
713
- }
714
-
715
- /** Used for built-in method references. */
716
- var funcProto$1 = Function.prototype;
717
-
718
- /** Used to resolve the decompiled source of functions. */
719
- var funcToString$1 = funcProto$1.toString;
720
-
721
- /**
722
- * Converts `func` to its source code.
723
- *
724
- * @private
725
- * @param {Function} func The function to convert.
726
- * @returns {string} Returns the source code.
727
- */
728
- function toSource(func) {
729
- if (func != null) {
730
- try {
731
- return funcToString$1.call(func);
732
- } catch (e) {}
733
- try {
734
- return (func + '');
735
- } catch (e) {}
736
- }
737
- return '';
738
- }
739
-
740
- /**
741
- * Used to match `RegExp`
742
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
743
- */
744
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
745
-
746
- /** Used to detect host constructors (Safari). */
747
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
748
-
749
- /** Used for built-in method references. */
750
- var funcProto = Function.prototype,
751
- objectProto$9 = Object.prototype;
752
-
753
- /** Used to resolve the decompiled source of functions. */
754
- var funcToString = funcProto.toString;
755
-
756
- /** Used to check objects for own properties. */
757
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
758
-
759
- /** Used to detect if a method is native. */
760
- var reIsNative = RegExp('^' +
761
- funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
762
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
763
- );
764
-
765
- /**
766
- * The base implementation of `_.isNative` without bad shim checks.
767
- *
768
- * @private
769
- * @param {*} value The value to check.
770
- * @returns {boolean} Returns `true` if `value` is a native function,
771
- * else `false`.
772
- */
773
- function baseIsNative(value) {
774
- if (!isObject(value) || isMasked(value)) {
775
- return false;
776
- }
777
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
778
- return pattern.test(toSource(value));
779
- }
780
-
781
- /**
782
- * Gets the value at `key` of `object`.
783
- *
784
- * @private
785
- * @param {Object} [object] The object to query.
786
- * @param {string} key The key of the property to get.
787
- * @returns {*} Returns the property value.
788
- */
789
- function getValue(object, key) {
790
- return object == null ? undefined : object[key];
791
- }
792
-
793
- /**
794
- * Gets the native function at `key` of `object`.
795
- *
796
- * @private
797
- * @param {Object} object The object to query.
798
- * @param {string} key The key of the method to get.
799
- * @returns {*} Returns the function if it's native, else `undefined`.
800
- */
801
- function getNative(object, key) {
802
- var value = getValue(object, key);
803
- return baseIsNative(value) ? value : undefined;
804
- }
805
-
806
- /* Built-in method references that are verified to be native. */
807
- var Map$1 = getNative(root$1, 'Map');
808
-
809
- var Map$2 = Map$1;
810
-
811
- /* Built-in method references that are verified to be native. */
812
- var nativeCreate = getNative(Object, 'create');
813
-
814
- var nativeCreate$1 = nativeCreate;
815
-
816
- /**
817
- * Removes all key-value entries from the hash.
818
- *
819
- * @private
820
- * @name clear
821
- * @memberOf Hash
822
- */
823
- function hashClear() {
824
- this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
825
- this.size = 0;
826
- }
827
-
828
- /**
829
- * Removes `key` and its value from the hash.
830
- *
831
- * @private
832
- * @name delete
833
- * @memberOf Hash
834
- * @param {Object} hash The hash to modify.
835
- * @param {string} key The key of the value to remove.
836
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
837
- */
838
- function hashDelete(key) {
839
- var result = this.has(key) && delete this.__data__[key];
840
- this.size -= result ? 1 : 0;
841
- return result;
842
- }
843
-
844
- /** Used to stand-in for `undefined` hash values. */
845
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
846
-
847
- /** Used for built-in method references. */
848
- var objectProto$8 = Object.prototype;
849
-
850
- /** Used to check objects for own properties. */
851
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
852
-
853
- /**
854
- * Gets the hash value for `key`.
855
- *
856
- * @private
857
- * @name get
858
- * @memberOf Hash
859
- * @param {string} key The key of the value to get.
860
- * @returns {*} Returns the entry value.
861
- */
862
- function hashGet(key) {
863
- var data = this.__data__;
864
- if (nativeCreate$1) {
865
- var result = data[key];
866
- return result === HASH_UNDEFINED$2 ? undefined : result;
867
- }
868
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
869
- }
870
-
871
- /** Used for built-in method references. */
872
- var objectProto$7 = Object.prototype;
873
-
874
- /** Used to check objects for own properties. */
875
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
876
-
877
- /**
878
- * Checks if a hash value for `key` exists.
879
- *
880
- * @private
881
- * @name has
882
- * @memberOf Hash
883
- * @param {string} key The key of the entry to check.
884
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
885
- */
886
- function hashHas(key) {
887
- var data = this.__data__;
888
- return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
889
- }
890
-
891
- /** Used to stand-in for `undefined` hash values. */
892
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
893
-
894
- /**
895
- * Sets the hash `key` to `value`.
896
- *
897
- * @private
898
- * @name set
899
- * @memberOf Hash
900
- * @param {string} key The key of the value to set.
901
- * @param {*} value The value to set.
902
- * @returns {Object} Returns the hash instance.
903
- */
904
- function hashSet(key, value) {
905
- var data = this.__data__;
906
- this.size += this.has(key) ? 0 : 1;
907
- data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED$1 : value;
908
- return this;
909
- }
910
-
911
- /**
912
- * Creates a hash object.
913
- *
914
- * @private
915
- * @constructor
916
- * @param {Array} [entries] The key-value pairs to cache.
917
- */
918
- function Hash(entries) {
919
- var index = -1,
920
- length = entries == null ? 0 : entries.length;
921
-
922
- this.clear();
923
- while (++index < length) {
924
- var entry = entries[index];
925
- this.set(entry[0], entry[1]);
926
- }
927
- }
928
-
929
- // Add methods to `Hash`.
930
- Hash.prototype.clear = hashClear;
931
- Hash.prototype['delete'] = hashDelete;
932
- Hash.prototype.get = hashGet;
933
- Hash.prototype.has = hashHas;
934
- Hash.prototype.set = hashSet;
935
-
936
- /**
937
- * Removes all key-value entries from the map.
938
- *
939
- * @private
940
- * @name clear
941
- * @memberOf MapCache
942
- */
943
- function mapCacheClear() {
944
- this.size = 0;
945
- this.__data__ = {
946
- 'hash': new Hash,
947
- 'map': new (Map$2 || ListCache),
948
- 'string': new Hash
949
- };
950
- }
951
-
952
- /**
953
- * Checks if `value` is suitable for use as unique object key.
954
- *
955
- * @private
956
- * @param {*} value The value to check.
957
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
958
- */
959
- function isKeyable(value) {
960
- var type = typeof value;
961
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
962
- ? (value !== '__proto__')
963
- : (value === null);
964
- }
965
-
966
- /**
967
- * Gets the data for `map`.
968
- *
969
- * @private
970
- * @param {Object} map The map to query.
971
- * @param {string} key The reference key.
972
- * @returns {*} Returns the map data.
973
- */
974
- function getMapData(map, key) {
975
- var data = map.__data__;
976
- return isKeyable(key)
977
- ? data[typeof key == 'string' ? 'string' : 'hash']
978
- : data.map;
979
- }
980
-
981
- /**
982
- * Removes `key` and its value from the map.
983
- *
984
- * @private
985
- * @name delete
986
- * @memberOf MapCache
987
- * @param {string} key The key of the value to remove.
988
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
989
- */
990
- function mapCacheDelete(key) {
991
- var result = getMapData(this, key)['delete'](key);
992
- this.size -= result ? 1 : 0;
993
- return result;
994
- }
995
-
996
- /**
997
- * Gets the map value for `key`.
998
- *
999
- * @private
1000
- * @name get
1001
- * @memberOf MapCache
1002
- * @param {string} key The key of the value to get.
1003
- * @returns {*} Returns the entry value.
1004
- */
1005
- function mapCacheGet(key) {
1006
- return getMapData(this, key).get(key);
1007
- }
1008
-
1009
- /**
1010
- * Checks if a map value for `key` exists.
1011
- *
1012
- * @private
1013
- * @name has
1014
- * @memberOf MapCache
1015
- * @param {string} key The key of the entry to check.
1016
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1017
- */
1018
- function mapCacheHas(key) {
1019
- return getMapData(this, key).has(key);
1020
- }
1021
-
1022
- /**
1023
- * Sets the map `key` to `value`.
1024
- *
1025
- * @private
1026
- * @name set
1027
- * @memberOf MapCache
1028
- * @param {string} key The key of the value to set.
1029
- * @param {*} value The value to set.
1030
- * @returns {Object} Returns the map cache instance.
1031
- */
1032
- function mapCacheSet(key, value) {
1033
- var data = getMapData(this, key),
1034
- size = data.size;
1035
-
1036
- data.set(key, value);
1037
- this.size += data.size == size ? 0 : 1;
1038
- return this;
1039
- }
1040
-
1041
- /**
1042
- * Creates a map cache object to store key-value pairs.
1043
- *
1044
- * @private
1045
- * @constructor
1046
- * @param {Array} [entries] The key-value pairs to cache.
1047
- */
1048
- function MapCache(entries) {
1049
- var index = -1,
1050
- length = entries == null ? 0 : entries.length;
1051
-
1052
- this.clear();
1053
- while (++index < length) {
1054
- var entry = entries[index];
1055
- this.set(entry[0], entry[1]);
1056
- }
1057
- }
1058
-
1059
- // Add methods to `MapCache`.
1060
- MapCache.prototype.clear = mapCacheClear;
1061
- MapCache.prototype['delete'] = mapCacheDelete;
1062
- MapCache.prototype.get = mapCacheGet;
1063
- MapCache.prototype.has = mapCacheHas;
1064
- MapCache.prototype.set = mapCacheSet;
1065
-
1066
- /** Used as the size to enable large array optimizations. */
1067
- var LARGE_ARRAY_SIZE = 200;
1068
-
1069
- /**
1070
- * Sets the stack `key` to `value`.
1071
- *
1072
- * @private
1073
- * @name set
1074
- * @memberOf Stack
1075
- * @param {string} key The key of the value to set.
1076
- * @param {*} value The value to set.
1077
- * @returns {Object} Returns the stack cache instance.
1078
- */
1079
- function stackSet(key, value) {
1080
- var data = this.__data__;
1081
- if (data instanceof ListCache) {
1082
- var pairs = data.__data__;
1083
- if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1084
- pairs.push([key, value]);
1085
- this.size = ++data.size;
1086
- return this;
1087
- }
1088
- data = this.__data__ = new MapCache(pairs);
1089
- }
1090
- data.set(key, value);
1091
- this.size = data.size;
1092
- return this;
1093
- }
1094
-
1095
- /**
1096
- * Creates a stack cache object to store key-value pairs.
1097
- *
1098
- * @private
1099
- * @constructor
1100
- * @param {Array} [entries] The key-value pairs to cache.
1101
- */
1102
- function Stack(entries) {
1103
- var data = this.__data__ = new ListCache(entries);
1104
- this.size = data.size;
1105
- }
1106
-
1107
- // Add methods to `Stack`.
1108
- Stack.prototype.clear = stackClear;
1109
- Stack.prototype['delete'] = stackDelete;
1110
- Stack.prototype.get = stackGet;
1111
- Stack.prototype.has = stackHas;
1112
- Stack.prototype.set = stackSet;
1113
-
1114
- /** Used to stand-in for `undefined` hash values. */
1115
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1116
-
1117
- /**
1118
- * Adds `value` to the array cache.
1119
- *
1120
- * @private
1121
- * @name add
1122
- * @memberOf SetCache
1123
- * @alias push
1124
- * @param {*} value The value to cache.
1125
- * @returns {Object} Returns the cache instance.
1126
- */
1127
- function setCacheAdd(value) {
1128
- this.__data__.set(value, HASH_UNDEFINED);
1129
- return this;
1130
- }
1131
-
1132
- /**
1133
- * Checks if `value` is in the array cache.
1134
- *
1135
- * @private
1136
- * @name has
1137
- * @memberOf SetCache
1138
- * @param {*} value The value to search for.
1139
- * @returns {number} Returns `true` if `value` is found, else `false`.
1140
- */
1141
- function setCacheHas(value) {
1142
- return this.__data__.has(value);
1143
- }
1144
-
1145
- /**
1146
- *
1147
- * Creates an array cache object to store unique values.
1148
- *
1149
- * @private
1150
- * @constructor
1151
- * @param {Array} [values] The values to cache.
1152
- */
1153
- function SetCache(values) {
1154
- var index = -1,
1155
- length = values == null ? 0 : values.length;
1156
-
1157
- this.__data__ = new MapCache;
1158
- while (++index < length) {
1159
- this.add(values[index]);
1160
- }
1161
- }
1162
-
1163
- // Add methods to `SetCache`.
1164
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1165
- SetCache.prototype.has = setCacheHas;
1166
-
1167
- /**
1168
- * A specialized version of `_.some` for arrays without support for iteratee
1169
- * shorthands.
1170
- *
1171
- * @private
1172
- * @param {Array} [array] The array to iterate over.
1173
- * @param {Function} predicate The function invoked per iteration.
1174
- * @returns {boolean} Returns `true` if any element passes the predicate check,
1175
- * else `false`.
1176
- */
1177
- function arraySome(array, predicate) {
1178
- var index = -1,
1179
- length = array == null ? 0 : array.length;
1180
-
1181
- while (++index < length) {
1182
- if (predicate(array[index], index, array)) {
1183
- return true;
1184
- }
1185
- }
1186
- return false;
1187
- }
1188
-
1189
- /**
1190
- * Checks if a `cache` value for `key` exists.
1191
- *
1192
- * @private
1193
- * @param {Object} cache The cache to query.
1194
- * @param {string} key The key of the entry to check.
1195
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1196
- */
1197
- function cacheHas(cache, key) {
1198
- return cache.has(key);
1199
- }
1200
-
1201
- /** Used to compose bitmasks for value comparisons. */
1202
- var COMPARE_PARTIAL_FLAG$3 = 1,
1203
- COMPARE_UNORDERED_FLAG$1 = 2;
1204
-
1205
- /**
1206
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1207
- * partial deep comparisons.
1208
- *
1209
- * @private
1210
- * @param {Array} array The array to compare.
1211
- * @param {Array} other The other array to compare.
1212
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1213
- * @param {Function} customizer The function to customize comparisons.
1214
- * @param {Function} equalFunc The function to determine equivalents of values.
1215
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1216
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1217
- */
1218
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1219
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
1220
- arrLength = array.length,
1221
- othLength = other.length;
1222
-
1223
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1224
- return false;
1225
- }
1226
- // Check that cyclic values are equal.
1227
- var arrStacked = stack.get(array);
1228
- var othStacked = stack.get(other);
1229
- if (arrStacked && othStacked) {
1230
- return arrStacked == other && othStacked == array;
1231
- }
1232
- var index = -1,
1233
- result = true,
1234
- seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
1235
-
1236
- stack.set(array, other);
1237
- stack.set(other, array);
1238
-
1239
- // Ignore non-index properties.
1240
- while (++index < arrLength) {
1241
- var arrValue = array[index],
1242
- othValue = other[index];
1243
-
1244
- if (customizer) {
1245
- var compared = isPartial
1246
- ? customizer(othValue, arrValue, index, other, array, stack)
1247
- : customizer(arrValue, othValue, index, array, other, stack);
1248
- }
1249
- if (compared !== undefined) {
1250
- if (compared) {
1251
- continue;
1252
- }
1253
- result = false;
1254
- break;
1255
- }
1256
- // Recursively compare arrays (susceptible to call stack limits).
1257
- if (seen) {
1258
- if (!arraySome(other, function(othValue, othIndex) {
1259
- if (!cacheHas(seen, othIndex) &&
1260
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1261
- return seen.push(othIndex);
1262
- }
1263
- })) {
1264
- result = false;
1265
- break;
1266
- }
1267
- } else if (!(
1268
- arrValue === othValue ||
1269
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1270
- )) {
1271
- result = false;
1272
- break;
1273
- }
1274
- }
1275
- stack['delete'](array);
1276
- stack['delete'](other);
1277
- return result;
1278
- }
1279
-
1280
- /** Built-in value references. */
1281
- var Uint8Array = root$1.Uint8Array;
1282
-
1283
- var Uint8Array$1 = Uint8Array;
1284
-
1285
- /**
1286
- * Converts `map` to its key-value pairs.
1287
- *
1288
- * @private
1289
- * @param {Object} map The map to convert.
1290
- * @returns {Array} Returns the key-value pairs.
1291
- */
1292
- function mapToArray(map) {
1293
- var index = -1,
1294
- result = Array(map.size);
1295
-
1296
- map.forEach(function(value, key) {
1297
- result[++index] = [key, value];
1298
- });
1299
- return result;
1300
- }
1301
-
1302
- /**
1303
- * Converts `set` to an array of its values.
1304
- *
1305
- * @private
1306
- * @param {Object} set The set to convert.
1307
- * @returns {Array} Returns the values.
1308
- */
1309
- function setToArray(set) {
1310
- var index = -1,
1311
- result = Array(set.size);
1312
-
1313
- set.forEach(function(value) {
1314
- result[++index] = value;
1315
- });
1316
- return result;
1317
- }
1318
-
1319
- /** Used to compose bitmasks for value comparisons. */
1320
- var COMPARE_PARTIAL_FLAG$2 = 1,
1321
- COMPARE_UNORDERED_FLAG = 2;
1322
-
1323
- /** `Object#toString` result references. */
1324
- var boolTag$1 = '[object Boolean]',
1325
- dateTag$1 = '[object Date]',
1326
- errorTag$1 = '[object Error]',
1327
- mapTag$2 = '[object Map]',
1328
- numberTag$1 = '[object Number]',
1329
- regexpTag$1 = '[object RegExp]',
1330
- setTag$2 = '[object Set]',
1331
- stringTag$1 = '[object String]',
1332
- symbolTag = '[object Symbol]';
1333
-
1334
- var arrayBufferTag$1 = '[object ArrayBuffer]',
1335
- dataViewTag$2 = '[object DataView]';
1336
-
1337
- /** Used to convert symbols to primitives and strings. */
1338
- var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
1339
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1340
-
1341
- /**
1342
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1343
- * the same `toStringTag`.
1344
- *
1345
- * **Note:** This function only supports comparing values with tags of
1346
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1347
- *
1348
- * @private
1349
- * @param {Object} object The object to compare.
1350
- * @param {Object} other The other object to compare.
1351
- * @param {string} tag The `toStringTag` of the objects to compare.
1352
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1353
- * @param {Function} customizer The function to customize comparisons.
1354
- * @param {Function} equalFunc The function to determine equivalents of values.
1355
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1356
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1357
- */
1358
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1359
- switch (tag) {
1360
- case dataViewTag$2:
1361
- if ((object.byteLength != other.byteLength) ||
1362
- (object.byteOffset != other.byteOffset)) {
1363
- return false;
1364
- }
1365
- object = object.buffer;
1366
- other = other.buffer;
1367
-
1368
- case arrayBufferTag$1:
1369
- if ((object.byteLength != other.byteLength) ||
1370
- !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
1371
- return false;
1372
- }
1373
- return true;
1374
-
1375
- case boolTag$1:
1376
- case dateTag$1:
1377
- case numberTag$1:
1378
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1379
- // Invalid dates are coerced to `NaN`.
1380
- return eq(+object, +other);
1381
-
1382
- case errorTag$1:
1383
- return object.name == other.name && object.message == other.message;
1384
-
1385
- case regexpTag$1:
1386
- case stringTag$1:
1387
- // Coerce regexes to strings and treat strings, primitives and objects,
1388
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1389
- // for more details.
1390
- return object == (other + '');
1391
-
1392
- case mapTag$2:
1393
- var convert = mapToArray;
1394
-
1395
- case setTag$2:
1396
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1397
- convert || (convert = setToArray);
1398
-
1399
- if (object.size != other.size && !isPartial) {
1400
- return false;
1401
- }
1402
- // Assume cyclic values are equal.
1403
- var stacked = stack.get(object);
1404
- if (stacked) {
1405
- return stacked == other;
1406
- }
1407
- bitmask |= COMPARE_UNORDERED_FLAG;
1408
-
1409
- // Recursively compare objects (susceptible to call stack limits).
1410
- stack.set(object, other);
1411
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1412
- stack['delete'](object);
1413
- return result;
1414
-
1415
- case symbolTag:
1416
- if (symbolValueOf) {
1417
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1418
- }
1419
- }
1420
- return false;
1421
- }
1422
-
1423
- /**
1424
- * Appends the elements of `values` to `array`.
1425
- *
1426
- * @private
1427
- * @param {Array} array The array to modify.
1428
- * @param {Array} values The values to append.
1429
- * @returns {Array} Returns `array`.
1430
- */
1431
- function arrayPush(array, values) {
1432
- var index = -1,
1433
- length = values.length,
1434
- offset = array.length;
1435
-
1436
- while (++index < length) {
1437
- array[offset + index] = values[index];
1438
- }
1439
- return array;
1440
- }
1441
-
1442
- /**
1443
- * Checks if `value` is classified as an `Array` object.
1444
- *
1445
- * @static
1446
- * @memberOf _
1447
- * @since 0.1.0
1448
- * @category Lang
1449
- * @param {*} value The value to check.
1450
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1451
- * @example
1452
- *
1453
- * _.isArray([1, 2, 3]);
1454
- * // => true
1455
- *
1456
- * _.isArray(document.body.children);
1457
- * // => false
1458
- *
1459
- * _.isArray('abc');
1460
- * // => false
1461
- *
1462
- * _.isArray(_.noop);
1463
- * // => false
1464
- */
1465
- var isArray = Array.isArray;
1466
-
1467
- var isArray$1 = isArray;
1468
-
1469
- /**
1470
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1471
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1472
- * symbols of `object`.
1473
- *
1474
- * @private
1475
- * @param {Object} object The object to query.
1476
- * @param {Function} keysFunc The function to get the keys of `object`.
1477
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1478
- * @returns {Array} Returns the array of property names and symbols.
1479
- */
1480
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1481
- var result = keysFunc(object);
1482
- return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
1483
- }
1484
-
1485
- /**
1486
- * A specialized version of `_.filter` for arrays without support for
1487
- * iteratee shorthands.
1488
- *
1489
- * @private
1490
- * @param {Array} [array] The array to iterate over.
1491
- * @param {Function} predicate The function invoked per iteration.
1492
- * @returns {Array} Returns the new filtered array.
1493
- */
1494
- function arrayFilter(array, predicate) {
1495
- var index = -1,
1496
- length = array == null ? 0 : array.length,
1497
- resIndex = 0,
1498
- result = [];
1499
-
1500
- while (++index < length) {
1501
- var value = array[index];
1502
- if (predicate(value, index, array)) {
1503
- result[resIndex++] = value;
1504
- }
1505
- }
1506
- return result;
1507
- }
1508
-
1509
- /**
1510
- * This method returns a new empty array.
1511
- *
1512
- * @static
1513
- * @memberOf _
1514
- * @since 4.13.0
1515
- * @category Util
1516
- * @returns {Array} Returns the new empty array.
1517
- * @example
1518
- *
1519
- * var arrays = _.times(2, _.stubArray);
1520
- *
1521
- * console.log(arrays);
1522
- * // => [[], []]
1523
- *
1524
- * console.log(arrays[0] === arrays[1]);
1525
- * // => false
1526
- */
1527
- function stubArray() {
1528
- return [];
1529
- }
1530
-
1531
- /** Used for built-in method references. */
1532
- var objectProto$6 = Object.prototype;
1533
-
1534
- /** Built-in value references. */
1535
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1536
-
1537
- /* Built-in method references for those with the same name as other `lodash` methods. */
1538
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1539
-
1540
- /**
1541
- * Creates an array of the own enumerable symbols of `object`.
1542
- *
1543
- * @private
1544
- * @param {Object} object The object to query.
1545
- * @returns {Array} Returns the array of symbols.
1546
- */
1547
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1548
- if (object == null) {
1549
- return [];
1550
- }
1551
- object = Object(object);
1552
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1553
- return propertyIsEnumerable$1.call(object, symbol);
1554
- });
1555
- };
1556
-
1557
- var getSymbols$1 = getSymbols;
1558
-
1559
- /**
1560
- * The base implementation of `_.times` without support for iteratee shorthands
1561
- * or max array length checks.
1562
- *
1563
- * @private
1564
- * @param {number} n The number of times to invoke `iteratee`.
1565
- * @param {Function} iteratee The function invoked per iteration.
1566
- * @returns {Array} Returns the array of results.
1567
- */
1568
- function baseTimes(n, iteratee) {
1569
- var index = -1,
1570
- result = Array(n);
1571
-
1572
- while (++index < n) {
1573
- result[index] = iteratee(index);
1574
- }
1575
- return result;
1576
- }
1577
-
1578
- /**
1579
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1580
- * and has a `typeof` result of "object".
1581
- *
1582
- * @static
1583
- * @memberOf _
1584
- * @since 4.0.0
1585
- * @category Lang
1586
- * @param {*} value The value to check.
1587
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1588
- * @example
1589
- *
1590
- * _.isObjectLike({});
1591
- * // => true
1592
- *
1593
- * _.isObjectLike([1, 2, 3]);
1594
- * // => true
1595
- *
1596
- * _.isObjectLike(_.noop);
1597
- * // => false
1598
- *
1599
- * _.isObjectLike(null);
1600
- * // => false
1601
- */
1602
- function isObjectLike(value) {
1603
- return value != null && typeof value == 'object';
1604
- }
1605
-
1606
- /** `Object#toString` result references. */
1607
- var argsTag$2 = '[object Arguments]';
1608
-
1609
- /**
1610
- * The base implementation of `_.isArguments`.
1611
- *
1612
- * @private
1613
- * @param {*} value The value to check.
1614
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1615
- */
1616
- function baseIsArguments(value) {
1617
- return isObjectLike(value) && baseGetTag(value) == argsTag$2;
1618
- }
1619
-
1620
- /** Used for built-in method references. */
1621
- var objectProto$5 = Object.prototype;
1622
-
1623
- /** Used to check objects for own properties. */
1624
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1625
-
1626
- /** Built-in value references. */
1627
- var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1628
-
1629
- /**
1630
- * Checks if `value` is likely an `arguments` object.
1631
- *
1632
- * @static
1633
- * @memberOf _
1634
- * @since 0.1.0
1635
- * @category Lang
1636
- * @param {*} value The value to check.
1637
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1638
- * else `false`.
1639
- * @example
1640
- *
1641
- * _.isArguments(function() { return arguments; }());
1642
- * // => true
1643
- *
1644
- * _.isArguments([1, 2, 3]);
1645
- * // => false
1646
- */
1647
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1648
- return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
1649
- !propertyIsEnumerable.call(value, 'callee');
1650
- };
1651
-
1652
- var isArguments$1 = isArguments;
1653
-
1654
- /**
1655
- * This method returns `false`.
1656
- *
1657
- * @static
1658
- * @memberOf _
1659
- * @since 4.13.0
1660
- * @category Util
1661
- * @returns {boolean} Returns `false`.
1662
- * @example
1663
- *
1664
- * _.times(2, _.stubFalse);
1665
- * // => [false, false]
1666
- */
1667
- function stubFalse() {
1668
- return false;
1669
- }
1670
-
1671
- /** Detect free variable `exports`. */
1672
- var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1673
-
1674
- /** Detect free variable `module`. */
1675
- var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1676
-
1677
- /** Detect the popular CommonJS extension `module.exports`. */
1678
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1679
-
1680
- /** Built-in value references. */
1681
- var Buffer = moduleExports$1 ? root$1.Buffer : undefined;
1682
-
1683
- /* Built-in method references for those with the same name as other `lodash` methods. */
1684
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1685
-
1686
- /**
1687
- * Checks if `value` is a buffer.
1688
- *
1689
- * @static
1690
- * @memberOf _
1691
- * @since 4.3.0
1692
- * @category Lang
1693
- * @param {*} value The value to check.
1694
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1695
- * @example
1696
- *
1697
- * _.isBuffer(new Buffer(2));
1698
- * // => true
1699
- *
1700
- * _.isBuffer(new Uint8Array(2));
1701
- * // => false
1702
- */
1703
- var isBuffer = nativeIsBuffer || stubFalse;
1704
-
1705
- var isBuffer$1 = isBuffer;
1706
-
1707
- /** Used as references for various `Number` constants. */
1708
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
1709
-
1710
- /** Used to detect unsigned integer values. */
1711
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1712
-
1713
- /**
1714
- * Checks if `value` is a valid array-like index.
1715
- *
1716
- * @private
1717
- * @param {*} value The value to check.
1718
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1719
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1720
- */
1721
- function isIndex(value, length) {
1722
- var type = typeof value;
1723
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
1724
-
1725
- return !!length &&
1726
- (type == 'number' ||
1727
- (type != 'symbol' && reIsUint.test(value))) &&
1728
- (value > -1 && value % 1 == 0 && value < length);
1729
- }
1730
-
1731
- /** Used as references for various `Number` constants. */
1732
- var MAX_SAFE_INTEGER = 9007199254740991;
1733
-
1734
- /**
1735
- * Checks if `value` is a valid array-like length.
1736
- *
1737
- * **Note:** This method is loosely based on
1738
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1739
- *
1740
- * @static
1741
- * @memberOf _
1742
- * @since 4.0.0
1743
- * @category Lang
1744
- * @param {*} value The value to check.
1745
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1746
- * @example
1747
- *
1748
- * _.isLength(3);
1749
- * // => true
1750
- *
1751
- * _.isLength(Number.MIN_VALUE);
1752
- * // => false
1753
- *
1754
- * _.isLength(Infinity);
1755
- * // => false
1756
- *
1757
- * _.isLength('3');
1758
- * // => false
1759
- */
1760
- function isLength(value) {
1761
- return typeof value == 'number' &&
1762
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1763
- }
1764
-
1765
- /** `Object#toString` result references. */
1766
- var argsTag$1 = '[object Arguments]',
1767
- arrayTag$1 = '[object Array]',
1768
- boolTag = '[object Boolean]',
1769
- dateTag = '[object Date]',
1770
- errorTag = '[object Error]',
1771
- funcTag = '[object Function]',
1772
- mapTag$1 = '[object Map]',
1773
- numberTag = '[object Number]',
1774
- objectTag$2 = '[object Object]',
1775
- regexpTag = '[object RegExp]',
1776
- setTag$1 = '[object Set]',
1777
- stringTag = '[object String]',
1778
- weakMapTag$1 = '[object WeakMap]';
1779
-
1780
- var arrayBufferTag = '[object ArrayBuffer]',
1781
- dataViewTag$1 = '[object DataView]',
1782
- float32Tag = '[object Float32Array]',
1783
- float64Tag = '[object Float64Array]',
1784
- int8Tag = '[object Int8Array]',
1785
- int16Tag = '[object Int16Array]',
1786
- int32Tag = '[object Int32Array]',
1787
- uint8Tag = '[object Uint8Array]',
1788
- uint8ClampedTag = '[object Uint8ClampedArray]',
1789
- uint16Tag = '[object Uint16Array]',
1790
- uint32Tag = '[object Uint32Array]';
1791
-
1792
- /** Used to identify `toStringTag` values of typed arrays. */
1793
- var typedArrayTags = {};
1794
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1795
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1796
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1797
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1798
- typedArrayTags[uint32Tag] = true;
1799
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1800
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1801
- typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
1802
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1803
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
1804
- typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
1805
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
1806
- typedArrayTags[weakMapTag$1] = false;
1807
-
1808
- /**
1809
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1810
- *
1811
- * @private
1812
- * @param {*} value The value to check.
1813
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1814
- */
1815
- function baseIsTypedArray(value) {
1816
- return isObjectLike(value) &&
1817
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1818
- }
1819
-
1820
- /**
1821
- * The base implementation of `_.unary` without support for storing metadata.
1822
- *
1823
- * @private
1824
- * @param {Function} func The function to cap arguments for.
1825
- * @returns {Function} Returns the new capped function.
1826
- */
1827
- function baseUnary(func) {
1828
- return function(value) {
1829
- return func(value);
1830
- };
1831
- }
1832
-
1833
- /** Detect free variable `exports`. */
1834
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1835
-
1836
- /** Detect free variable `module`. */
1837
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1838
-
1839
- /** Detect the popular CommonJS extension `module.exports`. */
1840
- var moduleExports = freeModule && freeModule.exports === freeExports;
1841
-
1842
- /** Detect free variable `process` from Node.js. */
1843
- var freeProcess = moduleExports && freeGlobal$1.process;
1844
-
1845
- /** Used to access faster Node.js helpers. */
1846
- var nodeUtil = (function() {
1847
- try {
1848
- // Use `util.types` for Node.js 10+.
1849
- var types = freeModule && freeModule.require && freeModule.require('util').types;
1850
-
1851
- if (types) {
1852
- return types;
1853
- }
1854
-
1855
- // Legacy `process.binding('util')` for Node.js < 10.
1856
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1857
- } catch (e) {}
1858
- }());
1859
-
1860
- var nodeUtil$1 = nodeUtil;
1861
-
1862
- /* Node.js helper references. */
1863
- var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
1864
-
1865
- /**
1866
- * Checks if `value` is classified as a typed array.
1867
- *
1868
- * @static
1869
- * @memberOf _
1870
- * @since 3.0.0
1871
- * @category Lang
1872
- * @param {*} value The value to check.
1873
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1874
- * @example
1875
- *
1876
- * _.isTypedArray(new Uint8Array);
1877
- * // => true
1878
- *
1879
- * _.isTypedArray([]);
1880
- * // => false
1881
- */
1882
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1883
-
1884
- var isTypedArray$1 = isTypedArray;
1885
-
1886
- /** Used for built-in method references. */
1887
- var objectProto$4 = Object.prototype;
1888
-
1889
- /** Used to check objects for own properties. */
1890
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1891
-
1892
- /**
1893
- * Creates an array of the enumerable property names of the array-like `value`.
1894
- *
1895
- * @private
1896
- * @param {*} value The value to query.
1897
- * @param {boolean} inherited Specify returning inherited property names.
1898
- * @returns {Array} Returns the array of property names.
1899
- */
1900
- function arrayLikeKeys(value, inherited) {
1901
- var isArr = isArray$1(value),
1902
- isArg = !isArr && isArguments$1(value),
1903
- isBuff = !isArr && !isArg && isBuffer$1(value),
1904
- isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
1905
- skipIndexes = isArr || isArg || isBuff || isType,
1906
- result = skipIndexes ? baseTimes(value.length, String) : [],
1907
- length = result.length;
1908
-
1909
- for (var key in value) {
1910
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
1911
- !(skipIndexes && (
1912
- // Safari 9 has enumerable `arguments.length` in strict mode.
1913
- key == 'length' ||
1914
- // Node.js 0.10 has enumerable non-index properties on buffers.
1915
- (isBuff && (key == 'offset' || key == 'parent')) ||
1916
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1917
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1918
- // Skip index properties.
1919
- isIndex(key, length)
1920
- ))) {
1921
- result.push(key);
1922
- }
1923
- }
1924
- return result;
1925
- }
1926
-
1927
- /** Used for built-in method references. */
1928
- var objectProto$3 = Object.prototype;
1929
-
1930
- /**
1931
- * Checks if `value` is likely a prototype object.
1932
- *
1933
- * @private
1934
- * @param {*} value The value to check.
1935
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1936
- */
1937
- function isPrototype(value) {
1938
- var Ctor = value && value.constructor,
1939
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
1940
-
1941
- return value === proto;
1942
- }
1943
-
1944
- /**
1945
- * Creates a unary function that invokes `func` with its argument transformed.
1946
- *
1947
- * @private
1948
- * @param {Function} func The function to wrap.
1949
- * @param {Function} transform The argument transform.
1950
- * @returns {Function} Returns the new function.
1951
- */
1952
- function overArg(func, transform) {
1953
- return function(arg) {
1954
- return func(transform(arg));
1955
- };
1956
- }
1957
-
1958
- /* Built-in method references for those with the same name as other `lodash` methods. */
1959
- var nativeKeys = overArg(Object.keys, Object);
1960
-
1961
- var nativeKeys$1 = nativeKeys;
1962
-
1963
- /** Used for built-in method references. */
1964
- var objectProto$2 = Object.prototype;
1965
-
1966
- /** Used to check objects for own properties. */
1967
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1968
-
1969
- /**
1970
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1971
- *
1972
- * @private
1973
- * @param {Object} object The object to query.
1974
- * @returns {Array} Returns the array of property names.
1975
- */
1976
- function baseKeys(object) {
1977
- if (!isPrototype(object)) {
1978
- return nativeKeys$1(object);
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ window.EVA = window.EVA || {};
3
+ window.EVA.plugin = window.EVA.plugin || {};
4
+ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
5
+ 'use strict';
6
+
7
+ var _extendStatics = function extendStatics(d, b) {
8
+ _extendStatics = Object.setPrototypeOf || {
9
+ __proto__: []
10
+ } instanceof Array && function (d, b) {
11
+ d.__proto__ = b;
12
+ } || function (d, b) {
13
+ for (var p in b) {
14
+ if (b.hasOwnProperty(p)) d[p] = b[p];
1979
15
  }
1980
- var result = [];
1981
- for (var key in Object(object)) {
1982
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
1983
- result.push(key);
16
+ };
17
+ return _extendStatics(d, b);
18
+ };
19
+ function __extends(d, b) {
20
+ _extendStatics(d, b);
21
+ function __() {
22
+ this.constructor = d;
23
+ }
24
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
25
+ }
26
+ var _assign = function __assign() {
27
+ _assign = Object.assign || function __assign(t) {
28
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
29
+ s = arguments[i];
30
+ for (var p in s) {
31
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1984
32
  }
1985
33
  }
1986
- return result;
1987
- }
1988
-
1989
- /**
1990
- * Checks if `value` is array-like. A value is considered array-like if it's
1991
- * not a function and has a `value.length` that's an integer greater than or
1992
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1993
- *
1994
- * @static
1995
- * @memberOf _
1996
- * @since 4.0.0
1997
- * @category Lang
1998
- * @param {*} value The value to check.
1999
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2000
- * @example
2001
- *
2002
- * _.isArrayLike([1, 2, 3]);
2003
- * // => true
2004
- *
2005
- * _.isArrayLike(document.body.children);
2006
- * // => true
2007
- *
2008
- * _.isArrayLike('abc');
2009
- * // => true
2010
- *
2011
- * _.isArrayLike(_.noop);
2012
- * // => false
2013
- */
2014
- function isArrayLike(value) {
2015
- return value != null && isLength(value.length) && !isFunction(value);
2016
- }
2017
-
2018
- /**
2019
- * Creates an array of the own enumerable property names of `object`.
2020
- *
2021
- * **Note:** Non-object values are coerced to objects. See the
2022
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2023
- * for more details.
2024
- *
2025
- * @static
2026
- * @since 0.1.0
2027
- * @memberOf _
2028
- * @category Object
2029
- * @param {Object} object The object to query.
2030
- * @returns {Array} Returns the array of property names.
2031
- * @example
2032
- *
2033
- * function Foo() {
2034
- * this.a = 1;
2035
- * this.b = 2;
2036
- * }
2037
- *
2038
- * Foo.prototype.c = 3;
2039
- *
2040
- * _.keys(new Foo);
2041
- * // => ['a', 'b'] (iteration order is not guaranteed)
2042
- *
2043
- * _.keys('hi');
2044
- * // => ['0', '1']
2045
- */
2046
- function keys(object) {
2047
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2048
- }
2049
-
2050
- /**
2051
- * Creates an array of own enumerable property names and symbols of `object`.
2052
- *
2053
- * @private
2054
- * @param {Object} object The object to query.
2055
- * @returns {Array} Returns the array of property names and symbols.
2056
- */
2057
- function getAllKeys(object) {
2058
- return baseGetAllKeys(object, keys, getSymbols$1);
34
+ return t;
35
+ };
36
+ return _assign.apply(this, arguments);
37
+ };
38
+ function __decorate(decorators, target, key, desc) {
39
+ var c = arguments.length,
40
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
41
+ d;
42
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
43
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
44
+ }
45
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
46
+ }
47
+ function __awaiter(thisArg, _arguments, P, generator) {
48
+ function adopt(value) {
49
+ return value instanceof P ? value : new P(function (resolve) {
50
+ resolve(value);
51
+ });
2059
52
  }
2060
-
2061
- /** Used to compose bitmasks for value comparisons. */
2062
- var COMPARE_PARTIAL_FLAG$1 = 1;
2063
-
2064
- /** Used for built-in method references. */
2065
- var objectProto$1 = Object.prototype;
2066
-
2067
- /** Used to check objects for own properties. */
2068
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2069
-
2070
- /**
2071
- * A specialized version of `baseIsEqualDeep` for objects with support for
2072
- * partial deep comparisons.
2073
- *
2074
- * @private
2075
- * @param {Object} object The object to compare.
2076
- * @param {Object} other The other object to compare.
2077
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2078
- * @param {Function} customizer The function to customize comparisons.
2079
- * @param {Function} equalFunc The function to determine equivalents of values.
2080
- * @param {Object} stack Tracks traversed `object` and `other` objects.
2081
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2082
- */
2083
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
2084
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
2085
- objProps = getAllKeys(object),
2086
- objLength = objProps.length,
2087
- othProps = getAllKeys(other),
2088
- othLength = othProps.length;
2089
-
2090
- if (objLength != othLength && !isPartial) {
2091
- return false;
2092
- }
2093
- var index = objLength;
2094
- while (index--) {
2095
- var key = objProps[index];
2096
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
2097
- return false;
53
+ return new (P || (P = Promise))(function (resolve, reject) {
54
+ function fulfilled(value) {
55
+ try {
56
+ step(generator.next(value));
57
+ } catch (e) {
58
+ reject(e);
2098
59
  }
2099
60
  }
2100
- // Check that cyclic values are equal.
2101
- var objStacked = stack.get(object);
2102
- var othStacked = stack.get(other);
2103
- if (objStacked && othStacked) {
2104
- return objStacked == other && othStacked == object;
2105
- }
2106
- var result = true;
2107
- stack.set(object, other);
2108
- stack.set(other, object);
2109
-
2110
- var skipCtor = isPartial;
2111
- while (++index < objLength) {
2112
- key = objProps[index];
2113
- var objValue = object[key],
2114
- othValue = other[key];
2115
-
2116
- if (customizer) {
2117
- var compared = isPartial
2118
- ? customizer(othValue, objValue, key, other, object, stack)
2119
- : customizer(objValue, othValue, key, object, other, stack);
2120
- }
2121
- // Recursively compare objects (susceptible to call stack limits).
2122
- if (!(compared === undefined
2123
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
2124
- : compared
2125
- )) {
2126
- result = false;
2127
- break;
61
+ function rejected(value) {
62
+ try {
63
+ step(generator["throw"](value));
64
+ } catch (e) {
65
+ reject(e);
2128
66
  }
2129
- skipCtor || (skipCtor = key == 'constructor');
2130
67
  }
2131
- if (result && !skipCtor) {
2132
- var objCtor = object.constructor,
2133
- othCtor = other.constructor;
2134
-
2135
- // Non `Object` object instances with different constructors are not equal.
2136
- if (objCtor != othCtor &&
2137
- ('constructor' in object && 'constructor' in other) &&
2138
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
2139
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
2140
- result = false;
2141
- }
68
+ function step(result) {
69
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2142
70
  }
2143
- stack['delete'](object);
2144
- stack['delete'](other);
2145
- return result;
71
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
72
+ });
73
+ }
74
+ function __generator(thisArg, body) {
75
+ var _ = {
76
+ label: 0,
77
+ sent: function sent() {
78
+ if (t[0] & 1) throw t[1];
79
+ return t[1];
80
+ },
81
+ trys: [],
82
+ ops: []
83
+ },
84
+ f,
85
+ y,
86
+ t,
87
+ g;
88
+ return g = {
89
+ next: verb(0),
90
+ "throw": verb(1),
91
+ "return": verb(2)
92
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
93
+ return this;
94
+ }), g;
95
+ function verb(n) {
96
+ return function (v) {
97
+ return step([n, v]);
98
+ };
2146
99
  }
2147
-
2148
- /* Built-in method references that are verified to be native. */
2149
- var DataView = getNative(root$1, 'DataView');
2150
-
2151
- var DataView$1 = DataView;
2152
-
2153
- /* Built-in method references that are verified to be native. */
2154
- var Promise$1 = getNative(root$1, 'Promise');
2155
-
2156
- var Promise$2 = Promise$1;
2157
-
2158
- /* Built-in method references that are verified to be native. */
2159
- var Set = getNative(root$1, 'Set');
2160
-
2161
- var Set$1 = Set;
2162
-
2163
- /* Built-in method references that are verified to be native. */
2164
- var WeakMap = getNative(root$1, 'WeakMap');
2165
-
2166
- var WeakMap$1 = WeakMap;
2167
-
2168
- /** `Object#toString` result references. */
2169
- var mapTag = '[object Map]',
2170
- objectTag$1 = '[object Object]',
2171
- promiseTag = '[object Promise]',
2172
- setTag = '[object Set]',
2173
- weakMapTag = '[object WeakMap]';
2174
-
2175
- var dataViewTag = '[object DataView]';
2176
-
2177
- /** Used to detect maps, sets, and weakmaps. */
2178
- var dataViewCtorString = toSource(DataView$1),
2179
- mapCtorString = toSource(Map$2),
2180
- promiseCtorString = toSource(Promise$2),
2181
- setCtorString = toSource(Set$1),
2182
- weakMapCtorString = toSource(WeakMap$1);
2183
-
2184
- /**
2185
- * Gets the `toStringTag` of `value`.
2186
- *
2187
- * @private
2188
- * @param {*} value The value to query.
2189
- * @returns {string} Returns the `toStringTag`.
2190
- */
2191
- var getTag = baseGetTag;
2192
-
2193
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2194
- if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag) ||
2195
- (Map$2 && getTag(new Map$2) != mapTag) ||
2196
- (Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||
2197
- (Set$1 && getTag(new Set$1) != setTag) ||
2198
- (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
2199
- getTag = function(value) {
2200
- var result = baseGetTag(value),
2201
- Ctor = result == objectTag$1 ? value.constructor : undefined,
2202
- ctorString = Ctor ? toSource(Ctor) : '';
2203
-
2204
- if (ctorString) {
2205
- switch (ctorString) {
2206
- case dataViewCtorString: return dataViewTag;
2207
- case mapCtorString: return mapTag;
2208
- case promiseCtorString: return promiseTag;
2209
- case setCtorString: return setTag;
2210
- case weakMapCtorString: return weakMapTag;
100
+ function step(op) {
101
+ if (f) throw new TypeError("Generator is already executing.");
102
+ while (_) {
103
+ try {
104
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
105
+ if (y = 0, t) op = [op[0] & 2, t.value];
106
+ switch (op[0]) {
107
+ case 0:
108
+ case 1:
109
+ t = op;
110
+ break;
111
+ case 4:
112
+ _.label++;
113
+ return {
114
+ value: op[1],
115
+ done: false
116
+ };
117
+ case 5:
118
+ _.label++;
119
+ y = op[1];
120
+ op = [0];
121
+ continue;
122
+ case 7:
123
+ op = _.ops.pop();
124
+ _.trys.pop();
125
+ continue;
126
+ default:
127
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
128
+ _ = 0;
129
+ continue;
130
+ }
131
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
132
+ _.label = op[1];
133
+ break;
134
+ }
135
+ if (op[0] === 6 && _.label < t[1]) {
136
+ _.label = t[1];
137
+ t = op;
138
+ break;
139
+ }
140
+ if (t && _.label < t[2]) {
141
+ _.label = t[2];
142
+ _.ops.push(op);
143
+ break;
144
+ }
145
+ if (t[2]) _.ops.pop();
146
+ _.trys.pop();
147
+ continue;
2211
148
  }
149
+ op = body.call(thisArg, _);
150
+ } catch (e) {
151
+ op = [6, e];
152
+ y = 0;
153
+ } finally {
154
+ f = t = 0;
2212
155
  }
2213
- return result;
156
+ }
157
+ if (op[0] & 5) throw op[1];
158
+ return {
159
+ value: op[0] ? op[1] : void 0,
160
+ done: true
2214
161
  };
2215
162
  }
2216
-
2217
- var getTag$1 = getTag;
2218
-
2219
- /** Used to compose bitmasks for value comparisons. */
2220
- var COMPARE_PARTIAL_FLAG = 1;
2221
-
2222
- /** `Object#toString` result references. */
2223
- var argsTag = '[object Arguments]',
2224
- arrayTag = '[object Array]',
2225
- objectTag = '[object Object]';
2226
-
2227
- /** Used for built-in method references. */
2228
- var objectProto = Object.prototype;
2229
-
2230
- /** Used to check objects for own properties. */
2231
- var hasOwnProperty = objectProto.hasOwnProperty;
2232
-
2233
- /**
2234
- * A specialized version of `baseIsEqual` for arrays and objects which performs
2235
- * deep comparisons and tracks traversed objects enabling objects with circular
2236
- * references to be compared.
2237
- *
2238
- * @private
2239
- * @param {Object} object The object to compare.
2240
- * @param {Object} other The other object to compare.
2241
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2242
- * @param {Function} customizer The function to customize comparisons.
2243
- * @param {Function} equalFunc The function to determine equivalents of values.
2244
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2245
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2246
- */
2247
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2248
- var objIsArr = isArray$1(object),
2249
- othIsArr = isArray$1(other),
2250
- objTag = objIsArr ? arrayTag : getTag$1(object),
2251
- othTag = othIsArr ? arrayTag : getTag$1(other);
2252
-
2253
- objTag = objTag == argsTag ? objectTag : objTag;
2254
- othTag = othTag == argsTag ? objectTag : othTag;
2255
-
2256
- var objIsObj = objTag == objectTag,
2257
- othIsObj = othTag == objectTag,
2258
- isSameTag = objTag == othTag;
2259
-
2260
- if (isSameTag && isBuffer$1(object)) {
2261
- if (!isBuffer$1(other)) {
2262
- return false;
2263
- }
2264
- objIsArr = true;
2265
- objIsObj = false;
163
+ }
164
+ function __values(o) {
165
+ var s = typeof Symbol === "function" && Symbol.iterator,
166
+ m = s && o[s],
167
+ i = 0;
168
+ if (m) return m.call(o);
169
+ if (o && typeof o.length === "number") return {
170
+ next: function next() {
171
+ if (o && i >= o.length) o = void 0;
172
+ return {
173
+ value: o && o[i++],
174
+ done: !o
175
+ };
2266
176
  }
2267
- if (isSameTag && !objIsObj) {
2268
- stack || (stack = new Stack);
2269
- return (objIsArr || isTypedArray$1(object))
2270
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
2271
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2272
- }
2273
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2274
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2275
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2276
-
2277
- if (objIsWrapped || othIsWrapped) {
2278
- var objUnwrapped = objIsWrapped ? object.value() : object,
2279
- othUnwrapped = othIsWrapped ? other.value() : other;
2280
-
2281
- stack || (stack = new Stack);
2282
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
177
+ };
178
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
179
+ }
180
+ function getIDEPropsPropertyObj(target, propertyKey) {
181
+ if (!target.constructor.IDEProps) {
182
+ target.constructor.IDEProps = {};
183
+ }
184
+ if (!target.constructor.IDEProps[propertyKey]) {
185
+ target.constructor.IDEProps[propertyKey] = {};
186
+ }
187
+ var propertyObj = target.constructor.IDEProps[propertyKey];
188
+ return propertyObj;
189
+ }
190
+ function type(type) {
191
+ return function (target, propertyKey) {
192
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
193
+ prop.key = propertyKey;
194
+ prop.type = type;
195
+ };
196
+ }
197
+ function step(step) {
198
+ return function (target, propertyKey) {
199
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
200
+ prop.step = step;
201
+ };
202
+ }
203
+ function uuid(len) {
204
+ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
205
+ var uuid = [];
206
+ var radix = chars.length;
207
+ for (var i = 0; i < len; i++) {
208
+ uuid[i] = chars[0 | Math.random() * radix];
209
+ }
210
+ return uuid.join('');
211
+ }
212
+ var setStyle = function setStyle(element, style) {
213
+ var width = style.width,
214
+ height = style.height,
215
+ position = style.position,
216
+ _a = style.left,
217
+ left = _a === void 0 ? 0 : _a,
218
+ _b = style.top,
219
+ top = _b === void 0 ? 0 : _b,
220
+ zIndex = style.zIndex,
221
+ pointerEvents = style.pointerEvents,
222
+ background = style.background;
223
+ element.style.width = width + "px";
224
+ element.style.height = height + "px";
225
+ element.style.position = position;
226
+ element.style.left = "" + left;
227
+ element.style.top = "" + top;
228
+ element.style.zIndex = "" + zIndex;
229
+ element.style.pointerEvents = pointerEvents;
230
+ element.style.background = background;
231
+ element.style.border = 'none';
232
+ element.style.overflow = 'hidden';
233
+ };
234
+ var setTransform = function setTransform(element, transform, ratioX, ratioY) {
235
+ var worldTransform = transform.worldTransform;
236
+ var a = worldTransform.a,
237
+ b = worldTransform.b,
238
+ c = worldTransform.c,
239
+ d = worldTransform.d,
240
+ tx = worldTransform.tx,
241
+ ty = worldTransform.ty;
242
+ var matrix = "matrix(" + a + ", " + b + ", " + c + ", " + d + ", " + tx * ratioX + ", " + ty * ratioY + ")";
243
+ element.style.transform = "" + matrix;
244
+ element.style.webkitTransform = "" + matrix;
245
+ element.style.transformOrigin = 'left top';
246
+ element.style.webkitTransformOrigin = 'left top';
247
+ };
248
+ var A11y = function (_super) {
249
+ __extends(A11y, _super);
250
+ function A11y(param) {
251
+ var _this = _super.call(this) || this;
252
+ _extends(_this, param);
253
+ var _a = param.hint,
254
+ hint = _a === void 0 ? '' : _a,
255
+ event = param.event,
256
+ _b = param.delay,
257
+ delay = _b === void 0 ? 0 : _b,
258
+ _c = param.attr,
259
+ attr = _c === void 0 ? {} : _c,
260
+ _d = param.role,
261
+ role = _d === void 0 ? '' : _d,
262
+ _e = param.props,
263
+ props = _e === void 0 ? {} : _e,
264
+ _f = param.state,
265
+ state = _f === void 0 ? {} : _f;
266
+ _this.hint = hint;
267
+ _this.event = event;
268
+ _this.delay = delay;
269
+ _this.attr = attr;
270
+ _this.role = role;
271
+ _this.props = props;
272
+ _this.state = state;
273
+ _this.a11yId = "_" + uuid(6);
274
+ return _this;
275
+ }
276
+ A11y.componentName = 'A11y';
277
+ __decorate([type('boolean')], A11y.prototype, "interactive", void 0);
278
+ __decorate([type('string')], A11y.prototype, "hint", void 0);
279
+ __decorate([type('number'), step(1)], A11y.prototype, "delay", void 0);
280
+ __decorate([type('string')], A11y.prototype, "role", void 0);
281
+ __decorate([type('string')], A11y.prototype, "a11yId", void 0);
282
+ return A11y;
283
+ }(eva_js.Component);
284
+ var A11y$1 = A11y;
285
+ var POSITION = 'absolute';
286
+ var ZINDEX = 3;
287
+ exports.A11yActivate = void 0;
288
+ (function (A11yActivate) {
289
+ A11yActivate[A11yActivate["ENABLE"] = 0] = "ENABLE";
290
+ A11yActivate[A11yActivate["DISABLE"] = 1] = "DISABLE";
291
+ A11yActivate[A11yActivate["CHECK"] = 2] = "CHECK";
292
+ })(exports.A11yActivate || (exports.A11yActivate = {}));
293
+ var PointerEvents;
294
+ (function (PointerEvents) {
295
+ PointerEvents["NONE"] = "none";
296
+ PointerEvents["AUTO"] = "auto";
297
+ })(PointerEvents || (PointerEvents = {}));
298
+ var MaskBackground;
299
+ (function (MaskBackground) {
300
+ MaskBackground["DEBUG"] = "rgba(255,0,0,0.5)";
301
+ MaskBackground["NONE"] = "transparent";
302
+ })(MaskBackground || (MaskBackground = {}));
303
+ var ElementType;
304
+ (function (ElementType) {
305
+ ElementType["BUTTON"] = "button";
306
+ ElementType["DIV"] = "div";
307
+ })(ElementType || (ElementType = {}));
308
+ var notAttr = ['hint', 'event', 'delay', 'attr', 'role', 'props', 'state', 'a11yId', 'name'];
309
+ var getEventFunc = function getEventFunc(event, gameObject, e) {
310
+ var _this = this;
311
+ ['touchstart', 'touchend', 'tap'].forEach(function (name) {
312
+ event.emit(name, {
313
+ stopPropagation: function stopPropagation() {
314
+ return e.stopPropagation();
315
+ },
316
+ data: {
317
+ position: _this.eventPosition
318
+ },
319
+ gameObject: gameObject
320
+ });
321
+ });
322
+ };
323
+ var A11ySystem = function (_super) {
324
+ __extends(A11ySystem, _super);
325
+ function A11ySystem(opt) {
326
+ var _this = _super.call(this, opt) || this;
327
+ _this.cache = new Map();
328
+ _this.eventCache = new Map();
329
+ _this.zIndex = ZINDEX;
330
+ return _this;
331
+ }
332
+ Object.defineProperty(A11ySystem.prototype, "ratioX", {
333
+ get: function get() {
334
+ if (this._ratioX) {
335
+ return this._ratioX;
336
+ } else {
337
+ var success = this.setRatio();
338
+ if (success) {
339
+ return this._ratioX;
340
+ } else {
341
+ return 0;
342
+ }
2283
343
  }
2284
- }
2285
- if (!isSameTag) {
2286
- return false;
2287
- }
2288
- stack || (stack = new Stack);
2289
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2290
- }
2291
-
2292
- /**
2293
- * The base implementation of `_.isEqual` which supports partial comparisons
2294
- * and tracks traversed objects.
2295
- *
2296
- * @private
2297
- * @param {*} value The value to compare.
2298
- * @param {*} other The other value to compare.
2299
- * @param {boolean} bitmask The bitmask flags.
2300
- * 1 - Unordered comparison
2301
- * 2 - Partial comparison
2302
- * @param {Function} [customizer] The function to customize comparisons.
2303
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2304
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2305
- */
2306
- function baseIsEqual(value, other, bitmask, customizer, stack) {
2307
- if (value === other) {
344
+ },
345
+ enumerable: false,
346
+ configurable: true
347
+ });
348
+ Object.defineProperty(A11ySystem.prototype, "ratioY", {
349
+ get: function get() {
350
+ if (this._ratioY) {
351
+ return this._ratioY;
352
+ } else {
353
+ var success = this.setRatio();
354
+ if (success) {
355
+ return this._ratioY;
356
+ } else {
357
+ return 0;
358
+ }
359
+ }
360
+ },
361
+ enumerable: false,
362
+ configurable: true
363
+ });
364
+ A11ySystem.prototype.init = function (opt) {
365
+ if (opt === void 0) {
366
+ opt = {};
367
+ }
368
+ return __awaiter(this, void 0, void 0, function () {
369
+ var _a, activate, _b, delay, _c, checkA11yOpen, zIndex, _d, _e, div;
370
+ return __generator(this, function (_f) {
371
+ switch (_f.label) {
372
+ case 0:
373
+ _a = opt.activate, activate = _a === void 0 ? exports.A11yActivate.CHECK : _a, _b = opt.delay, delay = _b === void 0 ? 100 : _b, _c = opt.checkA11yOpen, checkA11yOpen = _c === void 0 ? function () {
374
+ return Promise.resolve(false);
375
+ } : _c, zIndex = opt.zIndex;
376
+ this.delay = delay;
377
+ this.zIndex = zIndex || this.zIndex;
378
+ _d = activate;
379
+ switch (_d) {
380
+ case exports.A11yActivate.CHECK:
381
+ return [3, 1];
382
+ case exports.A11yActivate.DISABLE:
383
+ return [3, 5];
384
+ case exports.A11yActivate.ENABLE:
385
+ return [3, 6];
386
+ }
387
+ return [3, 7];
388
+ case 1:
389
+ _f.trys.push([1, 3,, 4]);
390
+ _e = this;
391
+ return [4, checkA11yOpen()];
392
+ case 2:
393
+ _e.activate = _f.sent();
394
+ return [3, 4];
395
+ case 3:
396
+ _f.sent();
397
+ this.activate = false;
398
+ return [3, 4];
399
+ case 4:
400
+ return [3, 7];
401
+ case 5:
402
+ this.activate = false;
403
+ return [3, 7];
404
+ case 6:
405
+ this.activate = true;
406
+ return [3, 7];
407
+ case 7:
408
+ this.debug = opt.debug || false;
409
+ if (this.debug) {
410
+ this.activate = true;
411
+ }
412
+ if (!this.activate) return [2];
413
+ div = document.createElement('div');
414
+ this.div = div;
415
+ if (this.game.canvas.parentNode) {
416
+ this.game.canvas.parentNode.insertBefore(this.div, this.game.canvas);
417
+ }
418
+ return [2];
419
+ }
420
+ });
421
+ });
422
+ };
423
+ A11ySystem.prototype.setRatio = function () {
424
+ var _a = this.getCanvasBoundingClientRect(),
425
+ width = _a.width,
426
+ height = _a.height;
427
+ var _b = this.getRenderRect(),
428
+ renderWidth = _b.renderWidth,
429
+ renderHeight = _b.renderHeight;
430
+ this._ratioX = width / renderWidth;
431
+ this._ratioY = height / renderHeight;
432
+ if (width || height) {
433
+ this.initDiv();
2308
434
  return true;
435
+ } else {
436
+ return false;
2309
437
  }
2310
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
2311
- return value !== value && other !== other;
2312
- }
2313
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
2314
- }
2315
-
2316
- /**
2317
- * Performs a deep comparison between two values to determine if they are
2318
- * equivalent.
2319
- *
2320
- * **Note:** This method supports comparing arrays, array buffers, booleans,
2321
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
2322
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
2323
- * by their own, not inherited, enumerable properties. Functions and DOM
2324
- * nodes are compared by strict equality, i.e. `===`.
2325
- *
2326
- * @static
2327
- * @memberOf _
2328
- * @since 0.1.0
2329
- * @category Lang
2330
- * @param {*} value The value to compare.
2331
- * @param {*} other The other value to compare.
2332
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2333
- * @example
2334
- *
2335
- * var object = { 'a': 1 };
2336
- * var other = { 'a': 1 };
2337
- *
2338
- * _.isEqual(object, other);
2339
- * // => true
2340
- *
2341
- * object === other;
2342
- * // => false
2343
- */
2344
- function isEqual(value, other) {
2345
- return baseIsEqual(value, other);
2346
- }
2347
-
2348
- function createCommonjsModule(fn) {
2349
- var module = { exports: {} };
2350
- return fn(module, module.exports), module.exports;
2351
- }
2352
-
2353
- var eventemitter3 = createCommonjsModule(function (module) {
2354
-
2355
- var has = Object.prototype.hasOwnProperty
2356
- , prefix = '~';
2357
-
2358
- /**
2359
- * Constructor to create a storage for our `EE` objects.
2360
- * An `Events` instance is a plain object whose properties are event names.
2361
- *
2362
- * @constructor
2363
- * @private
2364
- */
2365
- function Events() {}
2366
-
2367
- //
2368
- // We try to not inherit from `Object.prototype`. In some engines creating an
2369
- // instance in this way is faster than calling `Object.create(null)` directly.
2370
- // If `Object.create(null)` is not supported we prefix the event names with a
2371
- // character to make sure that the built-in object properties are not
2372
- // overridden or used as an attack vector.
2373
- //
2374
- if (Object.create) {
2375
- Events.prototype = Object.create(null);
2376
-
2377
- //
2378
- // This hack is needed because the `__proto__` property is still inherited in
2379
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
2380
- //
2381
- if (!new Events().__proto__) prefix = false;
2382
- }
2383
-
2384
- /**
2385
- * Representation of a single event listener.
2386
- *
2387
- * @param {Function} fn The listener function.
2388
- * @param {*} context The context to invoke the listener with.
2389
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
2390
- * @constructor
2391
- * @private
2392
- */
2393
- function EE(fn, context, once) {
2394
- this.fn = fn;
2395
- this.context = context;
2396
- this.once = once || false;
2397
- }
2398
-
2399
- /**
2400
- * Add a listener for a given event.
2401
- *
2402
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
2403
- * @param {(String|Symbol)} event The event name.
2404
- * @param {Function} fn The listener function.
2405
- * @param {*} context The context to invoke the listener with.
2406
- * @param {Boolean} once Specify if the listener is a one-time listener.
2407
- * @returns {EventEmitter}
2408
- * @private
2409
- */
2410
- function addListener(emitter, event, fn, context, once) {
2411
- if (typeof fn !== 'function') {
2412
- throw new TypeError('The listener must be a function');
2413
- }
2414
-
2415
- var listener = new EE(fn, context || emitter, once)
2416
- , evt = prefix ? prefix + event : event;
2417
-
2418
- if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
2419
- else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
2420
- else emitter._events[evt] = [emitter._events[evt], listener];
2421
-
2422
- return emitter;
2423
- }
2424
-
2425
- /**
2426
- * Clear event by name.
2427
- *
2428
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
2429
- * @param {(String|Symbol)} evt The Event name.
2430
- * @private
2431
- */
2432
- function clearEvent(emitter, evt) {
2433
- if (--emitter._eventsCount === 0) emitter._events = new Events();
2434
- else delete emitter._events[evt];
2435
- }
2436
-
2437
- /**
2438
- * Minimal `EventEmitter` interface that is molded against the Node.js
2439
- * `EventEmitter` interface.
2440
- *
2441
- * @constructor
2442
- * @public
2443
- */
2444
- function EventEmitter() {
2445
- this._events = new Events();
2446
- this._eventsCount = 0;
2447
- }
2448
-
2449
- /**
2450
- * Return an array listing the events for which the emitter has registered
2451
- * listeners.
2452
- *
2453
- * @returns {Array}
2454
- * @public
2455
- */
2456
- EventEmitter.prototype.eventNames = function eventNames() {
2457
- var names = []
2458
- , events
2459
- , name;
2460
-
2461
- if (this._eventsCount === 0) return names;
2462
-
2463
- for (name in (events = this._events)) {
2464
- if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
2465
- }
2466
-
2467
- if (Object.getOwnPropertySymbols) {
2468
- return names.concat(Object.getOwnPropertySymbols(events));
2469
- }
2470
-
2471
- return names;
2472
438
  };
2473
-
2474
- /**
2475
- * Return the listeners registered for a given event.
2476
- *
2477
- * @param {(String|Symbol)} event The event name.
2478
- * @returns {Array} The registered listeners.
2479
- * @public
2480
- */
2481
- EventEmitter.prototype.listeners = function listeners(event) {
2482
- var evt = prefix ? prefix + event : event
2483
- , handlers = this._events[evt];
2484
-
2485
- if (!handlers) return [];
2486
- if (handlers.fn) return [handlers.fn];
2487
-
2488
- for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
2489
- ee[i] = handlers[i].fn;
439
+ A11ySystem.prototype.getRenderRect = function () {
440
+ var _a = this.game.getSystem(pluginRenderer.RendererSystem).params,
441
+ params = _a === void 0 ? {
442
+ width: 300,
443
+ height: 300
444
+ } : _a;
445
+ var renderHeight = params.height,
446
+ renderWidth = params.width;
447
+ return {
448
+ renderWidth: renderWidth,
449
+ renderHeight: renderHeight
450
+ };
451
+ };
452
+ A11ySystem.prototype.getCanvasBoundingClientRect = function () {
453
+ var _a = this.game.canvas.getBoundingClientRect(),
454
+ width = _a.width,
455
+ height = _a.height,
456
+ left = _a.left,
457
+ top = _a.top;
458
+ return {
459
+ width: width,
460
+ height: height,
461
+ left: left,
462
+ top: top
463
+ };
464
+ };
465
+ A11ySystem.prototype.initDiv = function () {
466
+ var _this = this;
467
+ var pageXOffset = window.pageXOffset,
468
+ pageYOffset = window.pageYOffset;
469
+ var _a = this.getCanvasBoundingClientRect(),
470
+ width = _a.width,
471
+ height = _a.height,
472
+ left = _a.left,
473
+ top = _a.top;
474
+ var style = {
475
+ width: width,
476
+ height: height,
477
+ left: left + pageXOffset + "px",
478
+ top: top + pageYOffset + "px",
479
+ position: POSITION,
480
+ zIndex: this.zIndex,
481
+ pointerEvents: PointerEvents.NONE,
482
+ background: MaskBackground.NONE
483
+ };
484
+ setStyle(this.div, style);
485
+ this.div.addEventListener('click', function (e) {
486
+ var currentTarget = e.currentTarget;
487
+ var _a = currentTarget.getBoundingClientRect(),
488
+ left = _a.left,
489
+ top = _a.top;
490
+ var x = (e.pageX - left) / _this.ratioX;
491
+ var y = (e.pageY - top) / _this.ratioY;
492
+ _this.eventPosition = {
493
+ x: x,
494
+ y: y
495
+ };
496
+ }, true);
497
+ };
498
+ A11ySystem.prototype.update = function () {
499
+ return __awaiter(this, void 0, void 0, function () {
500
+ var changes, changes_1, changes_1_1, changed;
501
+ var e_1, _a;
502
+ return __generator(this, function (_b) {
503
+ changes = this.componentObserver.clear();
504
+ if (!this.activate) {
505
+ return [2];
506
+ }
507
+ try {
508
+ for (changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
509
+ changed = changes_1_1.value;
510
+ switch (changed.type) {
511
+ case eva_js.OBSERVER_TYPE.ADD:
512
+ changed.componentName === 'Event' && this.addEvent(changed.gameObject);
513
+ changed.componentName === 'A11y' && this.add(changed);
514
+ break;
515
+ case eva_js.OBSERVER_TYPE.CHANGE:
516
+ changed.componentName === 'Transform' && this.transformChange(changed);
517
+ changed.componentName === 'A11y' && this.change(changed);
518
+ break;
519
+ case eva_js.OBSERVER_TYPE.REMOVE:
520
+ changed.componentName === 'Event' && this.removeEvent(changed);
521
+ changed.componentName === 'A11y' && this.remove(changed);
522
+ }
523
+ }
524
+ } catch (e_1_1) {
525
+ e_1 = {
526
+ error: e_1_1
527
+ };
528
+ } finally {
529
+ try {
530
+ if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
531
+ } finally {
532
+ if (e_1) throw e_1.error;
533
+ }
534
+ }
535
+ return [2];
536
+ });
537
+ });
538
+ };
539
+ A11ySystem.prototype.change = function (changed) {
540
+ var component = changed.component;
541
+ if (changed.prop.prop[0] === 'hint') {
542
+ var dom = this.cache.get(component.a11yId);
543
+ dom === null || dom === void 0 ? void 0 : dom.setAttribute('aria-label', component.hint);
544
+ dom && this.setPosition(dom, changed.gameObject.transform);
2490
545
  }
2491
-
2492
- return ee;
2493
546
  };
2494
-
2495
- /**
2496
- * Return the number of listeners listening to a given event.
2497
- *
2498
- * @param {(String|Symbol)} event The event name.
2499
- * @returns {Number} The number of listeners.
2500
- * @public
2501
- */
2502
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
2503
- var evt = prefix ? prefix + event : event
2504
- , listeners = this._events[evt];
2505
-
2506
- if (!listeners) return 0;
2507
- if (listeners.fn) return 1;
2508
- return listeners.length;
547
+ A11ySystem.prototype.remove = function (changed) {
548
+ var component = changed.component;
549
+ if (!component) return;
550
+ var a11yId = component.a11yId;
551
+ var element = this.div.querySelector("#" + a11yId);
552
+ element && this.div.removeChild(element);
553
+ this.cache.delete(a11yId);
2509
554
  };
2510
-
2511
- /**
2512
- * Calls each of the listeners registered for a given event.
2513
- *
2514
- * @param {(String|Symbol)} event The event name.
2515
- * @returns {Boolean} `true` if the event had listeners, else `false`.
2516
- * @public
2517
- */
2518
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
2519
- var evt = prefix ? prefix + event : event;
2520
-
2521
- if (!this._events[evt]) return false;
2522
-
2523
- var listeners = this._events[evt]
2524
- , len = arguments.length
2525
- , args
2526
- , i;
2527
-
2528
- if (listeners.fn) {
2529
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
2530
-
2531
- switch (len) {
2532
- case 1: return listeners.fn.call(listeners.context), true;
2533
- case 2: return listeners.fn.call(listeners.context, a1), true;
2534
- case 3: return listeners.fn.call(listeners.context, a1, a2), true;
2535
- case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
2536
- case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
2537
- case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
555
+ A11ySystem.prototype.add = function (changed) {
556
+ var _this = this;
557
+ if (!this.activate) return;
558
+ var component = changed.component;
559
+ var gameObject = changed.gameObject;
560
+ var delay = component.delay,
561
+ id = component.a11yId;
562
+ var event = component.event;
563
+ if (!gameObject) return;
564
+ var transform = gameObject.transform;
565
+ if (!transform) return;
566
+ var element = document.createElement('div');
567
+ this.cache.set(id, element);
568
+ if (!event) {
569
+ event = gameObject.getComponent('Event');
570
+ }
571
+ setTimeout(function () {
572
+ _this.setPosition(element, transform);
573
+ _this.setA11yAttr(element, component);
574
+ if (event) {
575
+ _this.addEvent(gameObject);
2538
576
  }
2539
-
2540
- for (i = 1, args = new Array(len -1); i < len; i++) {
2541
- args[i - 1] = arguments[i];
577
+ if (gameObject.scene) {
578
+ _this.div.appendChild(element);
2542
579
  }
2543
-
2544
- listeners.fn.apply(listeners.context, args);
580
+ }, delay || this.delay);
581
+ };
582
+ A11ySystem.prototype.transformChange = function (changed) {
583
+ var component = changed.component;
584
+ var gameObject = changed.gameObject;
585
+ var a11yComponent = gameObject.getComponent(A11y$1);
586
+ if (!a11yComponent) return;
587
+ var a11yId = a11yComponent.a11yId;
588
+ if (!component.inScene) {
589
+ var dom = this.div.querySelector("#" + a11yId);
590
+ dom && this.div.removeChild(dom);
2545
591
  } else {
2546
- var length = listeners.length
2547
- , j;
2548
-
2549
- for (i = 0; i < length; i++) {
2550
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
2551
-
2552
- switch (len) {
2553
- case 1: listeners[i].fn.call(listeners[i].context); break;
2554
- case 2: listeners[i].fn.call(listeners[i].context, a1); break;
2555
- case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
2556
- case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
2557
- default:
2558
- if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
2559
- args[j - 1] = arguments[j];
2560
- }
2561
-
2562
- listeners[i].fn.apply(listeners[i].context, args);
2563
- }
592
+ if (this.cache.has(a11yId)) {
593
+ var addDom = this.cache.get(a11yId);
594
+ addDom && this.div.appendChild(addDom);
2564
595
  }
2565
596
  }
2566
-
2567
- return true;
2568
597
  };
2569
-
2570
- /**
2571
- * Add a listener for a given event.
2572
- *
2573
- * @param {(String|Symbol)} event The event name.
2574
- * @param {Function} fn The listener function.
2575
- * @param {*} [context=this] The context to invoke the listener with.
2576
- * @returns {EventEmitter} `this`.
2577
- * @public
2578
- */
2579
- EventEmitter.prototype.on = function on(event, fn, context) {
2580
- return addListener(this, event, fn, context, false);
598
+ A11ySystem.prototype.setEvent = function (element, event, gameObject, id) {
599
+ if (!event) {
600
+ return;
601
+ }
602
+ var func = getEventFunc.bind(this, event, gameObject);
603
+ this.eventCache.set(id, func);
604
+ element.addEventListener('click', func);
2581
605
  };
2582
-
2583
- /**
2584
- * Add a one-time listener for a given event.
2585
- *
2586
- * @param {(String|Symbol)} event The event name.
2587
- * @param {Function} fn The listener function.
2588
- * @param {*} [context=this] The context to invoke the listener with.
2589
- * @returns {EventEmitter} `this`.
2590
- * @public
2591
- */
2592
- EventEmitter.prototype.once = function once(event, fn, context) {
2593
- return addListener(this, event, fn, context, true);
606
+ A11ySystem.prototype.addEvent = function (gameObject) {
607
+ var a11y = gameObject.getComponent(A11y$1);
608
+ if (!a11y) return;
609
+ var event = gameObject.getComponent('Event');
610
+ if (!event) return;
611
+ var element = this.cache.get(a11y.a11yId);
612
+ element && this.setEvent(element, event, gameObject, a11y.a11yId);
2594
613
  };
2595
-
2596
- /**
2597
- * Remove the listeners of a given event.
2598
- *
2599
- * @param {(String|Symbol)} event The event name.
2600
- * @param {Function} fn Only remove the listeners that match this function.
2601
- * @param {*} context Only remove the listeners that have this context.
2602
- * @param {Boolean} once Only remove one-time listeners.
2603
- * @returns {EventEmitter} `this`.
2604
- * @public
2605
- */
2606
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
2607
- var evt = prefix ? prefix + event : event;
2608
-
2609
- if (!this._events[evt]) return this;
2610
- if (!fn) {
2611
- clearEvent(this, evt);
2612
- return this;
614
+ A11ySystem.prototype.removeEvent = function (changed) {
615
+ var gameObject = changed.gameObject;
616
+ var a11y = gameObject.getComponent(A11y$1);
617
+ if (!a11y) return;
618
+ var event = changed.component;
619
+ if (!event) return;
620
+ var a11yId = a11y.a11yId;
621
+ var func = this.eventCache.get(a11yId);
622
+ var element = this.cache.get(a11yId);
623
+ element && element.removeEventListener('click', func);
624
+ };
625
+ A11ySystem.prototype.setA11yAttr = function (element, component) {
626
+ var e_2, _a, e_3, _b, e_4, _c;
627
+ var hint = component.hint,
628
+ _d = component.props,
629
+ props = _d === void 0 ? {} : _d,
630
+ _e = component.state,
631
+ state = _e === void 0 ? {} : _e,
632
+ role = component.role,
633
+ id = component.a11yId;
634
+ var realRole = role || 'text';
635
+ element.setAttribute('role', realRole);
636
+ element.setAttribute('aria-label', hint);
637
+ element.id = id;
638
+ var ariaProps = Object.keys(props);
639
+ try {
640
+ for (var ariaProps_1 = __values(ariaProps), ariaProps_1_1 = ariaProps_1.next(); !ariaProps_1_1.done; ariaProps_1_1 = ariaProps_1.next()) {
641
+ var key = ariaProps_1_1.value;
642
+ element.setAttribute(key, props[key]);
643
+ }
644
+ } catch (e_2_1) {
645
+ e_2 = {
646
+ error: e_2_1
647
+ };
648
+ } finally {
649
+ try {
650
+ if (ariaProps_1_1 && !ariaProps_1_1.done && (_a = ariaProps_1.return)) _a.call(ariaProps_1);
651
+ } finally {
652
+ if (e_2) throw e_2.error;
653
+ }
2613
654
  }
2614
-
2615
- var listeners = this._events[evt];
2616
-
2617
- if (listeners.fn) {
2618
- if (
2619
- listeners.fn === fn &&
2620
- (!once || listeners.once) &&
2621
- (!context || listeners.context === context)
2622
- ) {
2623
- clearEvent(this, evt);
655
+ var ariaState = Object.keys(state);
656
+ try {
657
+ for (var ariaState_1 = __values(ariaState), ariaState_1_1 = ariaState_1.next(); !ariaState_1_1.done; ariaState_1_1 = ariaState_1.next()) {
658
+ var key = ariaState_1_1.value;
659
+ element.setAttribute(key, state[key]);
2624
660
  }
2625
- } else {
2626
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
2627
- if (
2628
- listeners[i].fn !== fn ||
2629
- (once && !listeners[i].once) ||
2630
- (context && listeners[i].context !== context)
2631
- ) {
2632
- events.push(listeners[i]);
661
+ } catch (e_3_1) {
662
+ e_3 = {
663
+ error: e_3_1
664
+ };
665
+ } finally {
666
+ try {
667
+ if (ariaState_1_1 && !ariaState_1_1.done && (_b = ariaState_1.return)) _b.call(ariaState_1);
668
+ } finally {
669
+ if (e_3) throw e_3.error;
670
+ }
671
+ }
672
+ try {
673
+ for (var _f = __values(Object.keys(component)), _g = _f.next(); !_g.done; _g = _f.next()) {
674
+ var key = _g.value;
675
+ if (typeof component[key] === 'string' && notAttr.indexOf(key) === -1 && key.indexOf('_') !== 1) {
676
+ element.setAttribute(key, component[key]);
2633
677
  }
2634
678
  }
2635
-
2636
- //
2637
- // Reset the array, or remove it completely if we have no more listeners.
2638
- //
2639
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
2640
- else clearEvent(this, evt);
679
+ } catch (e_4_1) {
680
+ e_4 = {
681
+ error: e_4_1
682
+ };
683
+ } finally {
684
+ try {
685
+ if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
686
+ } finally {
687
+ if (e_4) throw e_4.error;
688
+ }
2641
689
  }
2642
-
2643
- return this;
2644
690
  };
2645
-
2646
- /**
2647
- * Remove all listeners, or those of the specified event.
2648
- *
2649
- * @param {(String|Symbol)} [event] The event name.
2650
- * @returns {EventEmitter} `this`.
2651
- * @public
2652
- */
2653
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
2654
- var evt;
2655
-
2656
- if (event) {
2657
- evt = prefix ? prefix + event : event;
2658
- if (this._events[evt]) clearEvent(this, evt);
2659
- } else {
2660
- this._events = new Events();
2661
- this._eventsCount = 0;
2662
- }
2663
-
2664
- return this;
691
+ A11ySystem.prototype.setPosition = function (element, transform) {
692
+ var _a = transform.size,
693
+ width = _a.width,
694
+ height = _a.height;
695
+ var style = {
696
+ width: width === 0 ? 1 : width * this.ratioX,
697
+ height: height === 0 ? 1 : height * this.ratioY,
698
+ position: POSITION,
699
+ zIndex: this.zIndex,
700
+ pointerEvents: PointerEvents.AUTO,
701
+ background: this.debug ? MaskBackground.DEBUG : MaskBackground.NONE
702
+ };
703
+ var transformProps = _assign({}, transform);
704
+ setStyle(element, style);
705
+ setTransform(element, transformProps, this.ratioX, this.ratioY);
2665
706
  };
2666
-
2667
- //
2668
- // Alias methods names because people roll like that.
2669
- //
2670
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
2671
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
2672
-
2673
- //
2674
- // Expose the prefix.
2675
- //
2676
- EventEmitter.prefixed = prefix;
2677
-
2678
- //
2679
- // Allow `EventEmitter` to be imported as module namespace.
2680
- //
2681
- EventEmitter.EventEmitter = EventEmitter;
2682
-
2683
- //
2684
- // Expose the module.
2685
- //
2686
- {
2687
- module.exports = EventEmitter;
2688
- }
2689
- });
2690
-
2691
- var EventEmitter = eventemitter3;
2692
-
2693
- /*! *****************************************************************************
2694
- Copyright (c) Microsoft Corporation. All rights reserved.
2695
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
2696
- this file except in compliance with the License. You may obtain a copy of the
2697
- License at http://www.apache.org/licenses/LICENSE-2.0
2698
-
2699
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2700
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
2701
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
2702
- MERCHANTABLITY OR NON-INFRINGEMENT.
2703
-
2704
- See the Apache Version 2.0 License for specific language governing permissions
2705
- and limitations under the License.
2706
- ***************************************************************************** */
2707
- /* global Reflect, Promise */
2708
-
2709
- var extendStatics = function(d, b) {
2710
- extendStatics = Object.setPrototypeOf ||
2711
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2712
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2713
- return extendStatics(d, b);
2714
- };
2715
-
2716
- function __extends(d, b) {
2717
- extendStatics(d, b);
2718
- function __() { this.constructor = d; }
2719
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2720
- }
2721
-
2722
- var __assign = function() {
2723
- __assign = Object.assign || function __assign(t) {
2724
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2725
- s = arguments[i];
2726
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2727
- }
2728
- return t;
2729
- };
2730
- return __assign.apply(this, arguments);
2731
- };
2732
-
2733
- function __decorate(decorators, target, key, desc) {
2734
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2735
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2736
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2737
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2738
- }
2739
-
2740
- function __values(o) {
2741
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
2742
- if (m) return m.call(o);
2743
- return {
2744
- next: function () {
2745
- if (o && i >= o.length) o = void 0;
2746
- return { value: o && o[i++], done: !o };
2747
- }
2748
- };
2749
- }
2750
-
2751
- function __read(o, n) {
2752
- var m = typeof Symbol === "function" && o[Symbol.iterator];
2753
- if (!m) return o;
2754
- var i = m.call(o), r, ar = [], e;
2755
- try {
2756
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2757
- }
2758
- catch (error) { e = { error: error }; }
2759
- finally {
2760
- try {
2761
- if (r && !r.done && (m = i["return"])) m.call(i);
2762
- }
2763
- finally { if (e) throw e.error; }
2764
- }
2765
- return ar;
2766
- }
2767
-
2768
- function __spread() {
2769
- for (var ar = [], i = 0; i < arguments.length; i++)
2770
- ar = ar.concat(__read(arguments[i]));
2771
- return ar;
2772
- }
2773
-
2774
- var RendererManager = (function () {
2775
- function RendererManager(_a) {
2776
- var game = _a.game, rendererSystem = _a.rendererSystem;
2777
- this.renderers = [];
2778
- this.game = game;
2779
- this.rendererSystem = rendererSystem;
2780
- }
2781
- RendererManager.prototype.register = function () {
2782
- var e_1, _a;
2783
- var renderers = [];
2784
- for (var _i = 0; _i < arguments.length; _i++) {
2785
- renderers[_i] = arguments[_i];
2786
- }
2787
- try {
2788
- for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) {
2789
- var renderer = renderers_1_1.value;
2790
- renderer.game = this.game;
2791
- renderer.rendererManager = this.rendererSystem.rendererManager;
2792
- renderer.containerManager = this.rendererSystem.containerManager;
2793
- this.renderers.push(renderer);
2794
- }
2795
- }
2796
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2797
- finally {
2798
- try {
2799
- if (renderers_1_1 && !renderers_1_1.done && (_a = renderers_1.return)) _a.call(renderers_1);
2800
- }
2801
- finally { if (e_1) throw e_1.error; }
2802
- }
2803
- };
2804
- RendererManager.prototype.componentChanged = function (changes) {
2805
- var e_2, _a;
2806
- var _loop_1 = function (changed) {
2807
- var e_3, _a;
2808
- try {
2809
- for (var _b = (e_3 = void 0, __values(this_1.renderers)), _c = _b.next(); !_c.done; _c = _b.next()) {
2810
- var renderer = _c.value;
2811
- var props = renderer.observerInfo[changed.componentName];
2812
- if (props) {
2813
- if ([eva_js.OBSERVER_TYPE.ADD, eva_js.OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {
2814
- try {
2815
- renderer.componentChanged && renderer.componentChanged(changed);
2816
- }
2817
- catch (e) {
2818
- console.error("gameObject: " + changed.gameObject.name + ", " + changed.componentName + " is error.", changed, e);
2819
- }
2820
- continue;
2821
- }
2822
- var index = props.findIndex(function (prop) {
2823
- return isEqual(prop, changed.prop);
2824
- });
2825
- if (index > -1) {
2826
- try {
2827
- renderer.componentChanged && renderer.componentChanged(changed);
2828
- }
2829
- catch (e) {
2830
- console.error("gameObject: " + (changed.gameObject && changed.gameObject.name) + ", " + changed.componentName + " is componentChanged error.", changed, e);
2831
- }
2832
- }
2833
- }
2834
- }
2835
- }
2836
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2837
- finally {
2838
- try {
2839
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2840
- }
2841
- finally { if (e_3) throw e_3.error; }
2842
- }
2843
- };
2844
- var this_1 = this;
2845
- try {
2846
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
2847
- var changed = changes_1_1.value;
2848
- _loop_1(changed);
2849
- }
2850
- }
2851
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2852
- finally {
2853
- try {
2854
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
2855
- }
2856
- finally { if (e_2) throw e_2.error; }
2857
- }
2858
- };
2859
- RendererManager.prototype.update = function (gameObject) {
2860
- var e_4, _a, e_5, _b;
2861
- try {
2862
- for (var _c = __values(gameObject.components), _d = _c.next(); !_d.done; _d = _c.next()) {
2863
- var component = _d.value;
2864
- try {
2865
- for (var _e = (e_5 = void 0, __values(this.renderers)), _f = _e.next(); !_f.done; _f = _e.next()) {
2866
- var renderer = _f.value;
2867
- var cache = [];
2868
- var props = renderer.observerInfo[component.name];
2869
- if (props && cache.indexOf(gameObject) === -1) {
2870
- cache.push(gameObject);
2871
- try {
2872
- renderer.rendererUpdate && renderer.rendererUpdate(gameObject);
2873
- }
2874
- catch (e) {
2875
- console.info("gameObject: " + gameObject.name + ", " + component.name + " is update error", e);
2876
- }
2877
- }
2878
- }
2879
- }
2880
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2881
- finally {
2882
- try {
2883
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2884
- }
2885
- finally { if (e_5) throw e_5.error; }
2886
- }
2887
- }
2888
- }
2889
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2890
- finally {
2891
- try {
2892
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2893
- }
2894
- finally { if (e_4) throw e_4.error; }
2895
- }
2896
- };
2897
- return RendererManager;
2898
- }());
2899
- var RendererManager$1 = RendererManager;
2900
-
2901
- var ContainerManager = (function () {
2902
- function ContainerManager() {
2903
- this.containerMap = {};
2904
- }
2905
- ContainerManager.prototype.addContainer = function (_a) {
2906
- var name = _a.name, container = _a.container;
2907
- this.containerMap[name] = container;
2908
- };
2909
- ContainerManager.prototype.getContainer = function (name) {
2910
- return this.containerMap[name];
2911
- };
2912
- ContainerManager.prototype.removeContainer = function (name) {
2913
- var _a;
2914
- (_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy({ children: true });
2915
- delete this.containerMap[name];
2916
- };
2917
- ContainerManager.prototype.updateTransform = function (_a) {
2918
- var name = _a.name, transform = _a.transform;
2919
- var container = this.containerMap[name];
2920
- if (!container)
2921
- return;
2922
- var anchor = transform.anchor, origin = transform.origin, position = transform.position, rotation = transform.rotation, scale = transform.scale, size = transform.size, skew = transform.skew;
2923
- container.rotation = rotation;
2924
- container.scale = scale;
2925
- container.pivot.x = size.width * origin.x;
2926
- container.pivot.y = size.height * origin.y;
2927
- container.skew = skew;
2928
- var x = position.x;
2929
- var y = position.y;
2930
- if (transform.parent) {
2931
- var parent_1 = transform.parent;
2932
- x = x + parent_1.size.width * anchor.x;
2933
- y = y + parent_1.size.height * anchor.y;
2934
- }
2935
- container.position = { x: x, y: y };
2936
- };
2937
- return ContainerManager;
2938
- }());
2939
- var ContainerManager$1 = ContainerManager;
2940
-
2941
- var Transform = (function (_super) {
2942
- __extends(Transform, _super);
2943
- function Transform(_a) {
2944
- var system = _a.system, containerManager = _a.containerManager;
2945
- var _this = _super.call(this) || this;
2946
- _this.name = 'Transform';
2947
- _this.waitRemoveIds = [];
2948
- _this.waitChangeScenes = [];
2949
- _this.containerManager = containerManager;
2950
- _this.init(system);
2951
- return _this;
2952
- }
2953
- Transform.prototype.init = function (system) {
2954
- var _this = this;
2955
- this.system = system;
2956
- this.on('changeScene', function (_a) {
2957
- var scene = _a.scene, mode = _a.mode, application = _a.application;
2958
- _this.waitChangeScenes.push({ scene: scene, mode: mode, application: application });
2959
- });
2960
- };
2961
- Transform.prototype.update = function () {
2962
- var e_1, _a, e_2, _b;
2963
- try {
2964
- for (var _c = __values(this.waitRemoveIds), _d = _c.next(); !_d.done; _d = _c.next()) {
2965
- var id = _d.value;
2966
- this.containerManager.removeContainer(id);
2967
- }
2968
- }
2969
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2970
- finally {
2971
- try {
2972
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2973
- }
2974
- finally { if (e_1) throw e_1.error; }
2975
- }
2976
- this.waitRemoveIds = [];
2977
- try {
2978
- for (var _e = __values(this.waitChangeScenes), _f = _e.next(); !_f.done; _f = _e.next()) {
2979
- var sceneInfo = _f.value;
2980
- var container = this.containerManager.getContainer(sceneInfo.scene.id);
2981
- if (container) {
2982
- sceneInfo.application.stage.removeChildren();
2983
- sceneInfo.application.stage.addChild(container);
2984
- }
2985
- }
2986
- }
2987
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2988
- finally {
2989
- try {
2990
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2991
- }
2992
- finally { if (e_2) throw e_2.error; }
2993
- }
2994
- this.waitChangeScenes = [];
2995
- };
2996
- Transform.prototype.componentChanged = function (changed) {
2997
- if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
2998
- this.addContainer(changed);
2999
- }
3000
- else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) {
3001
- this.change(changed);
3002
- }
3003
- else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
3004
- this.waitRemoveIds.push(changed.gameObject.id);
3005
- }
3006
- };
3007
- Transform.prototype.addContainer = function (changed) {
3008
- var container = new Container$1();
3009
- container.name = changed.gameObject.name;
3010
- this.containerManager.addContainer({
3011
- name: changed.gameObject.id,
3012
- container: container,
3013
- });
3014
- var transform = changed.component;
3015
- transform.worldTransform = container.transform.worldTransform;
3016
- };
3017
- Transform.prototype.change = function (changed) {
3018
- var transform = changed.component;
3019
- if (transform.parent) {
3020
- var parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id);
3021
- parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id));
3022
- var render = changed.gameObject.transform.parent &&
3023
- changed.gameObject.transform.parent.gameObject.getComponent('Render');
3024
- if (render) {
3025
- render.sortDirty = true;
3026
- }
3027
- }
3028
- else {
3029
- var container = this.containerManager.getContainer(changed.gameObject.id);
3030
- delete transform.worldTransform;
3031
- container.parent && container.parent.removeChild(container);
3032
- }
3033
- };
3034
- Transform.prototype.destroy = function () {
3035
- this.removeAllListeners();
3036
- this.waitRemoveIds = null;
3037
- this.waitChangeScenes = null;
3038
- this.system = null;
3039
- this.containerManager = null;
3040
- };
3041
- Transform = __decorate([
3042
- eva_js.decorators.componentObserver({
3043
- Transform: ['_parent'],
3044
- })
3045
- ], Transform);
3046
- return Transform;
3047
- }(EventEmitter));
3048
- var Transform$1 = Transform;
3049
-
3050
- var RENDERER_TYPE;
3051
- (function (RENDERER_TYPE) {
3052
- RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
3053
- RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL";
3054
- RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS";
3055
- })(RENDERER_TYPE || (RENDERER_TYPE = {}));
3056
- var disableScroll = function (renderer) {
3057
- renderer.plugins.interaction.autoPreventDefault = true;
3058
- renderer.view.style.touchAction = 'none';
3059
- };
3060
- var enableScroll = function (renderer) {
3061
- renderer.plugins.interaction.autoPreventDefault = false;
3062
- renderer.view.style.touchAction = 'auto';
3063
- };
3064
- var Renderer$2 = (function (_super) {
3065
- __extends(Renderer, _super);
3066
- function Renderer() {
3067
- var _this = _super !== null && _super.apply(this, arguments) || this;
3068
- _this.multiApps = [];
3069
- return _this;
3070
- }
3071
- Renderer.prototype.init = function (params) {
3072
- var _this = this;
3073
- this.params = params;
3074
- this.application = this.createApplication(params);
3075
- this.containerManager = new ContainerManager$1();
3076
- this.rendererManager = new RendererManager$1({
3077
- game: this.game,
3078
- rendererSystem: this,
3079
- });
3080
- this.game.canvas = this.application.view;
3081
- this.transform = new Transform$1({
3082
- system: this,
3083
- containerManager: this.containerManager,
3084
- });
3085
- this.game.on('sceneChanged', function (_a) {
3086
- var scene = _a.scene, mode = _a.mode, params = _a.params;
3087
- var application;
3088
- switch (mode) {
3089
- case eva_js.LOAD_SCENE_MODE.SINGLE:
3090
- application = _this.application;
3091
- break;
3092
- case eva_js.LOAD_SCENE_MODE.MULTI_CANVAS:
3093
- application = _this.createMultiApplication({ params: params });
3094
- break;
3095
- }
3096
- scene.canvas = application.view;
3097
- _this.transform.emit('changeScene', {
3098
- scene: scene,
3099
- mode: mode,
3100
- application: application,
3101
- });
3102
- });
3103
- };
3104
- Renderer.prototype.registerObserver = function (observerInfo) {
3105
- var _a;
3106
- var thisObserverInfo = this.constructor.observerInfo;
3107
- for (var key in observerInfo) {
3108
- if (!thisObserverInfo[key]) {
3109
- thisObserverInfo[key] = [];
3110
- }
3111
- (_a = thisObserverInfo[key]).push.apply(_a, __spread(observerInfo[key]));
3112
- }
3113
- };
3114
- Renderer.prototype.createMultiApplication = function (_a) {
3115
- var params = _a.params;
3116
- var app = this.createApplication(params);
3117
- this.multiApps.push(app);
3118
- return app;
3119
- };
3120
- Renderer.prototype.createApplication = function (params) {
3121
- params.view = params.canvas;
3122
- if (params.renderType === RENDERER_TYPE.CANVAS) {
3123
- params.forceCanvas = true;
3124
- }
3125
- pixi_js.ticker.shared.autoStart = false;
3126
- pixi_js.ticker.shared.stop();
3127
- var app = new Application$1(__assign({ sharedTicker: true }, params));
3128
- if (params.preventScroll !== undefined) {
3129
- console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game');
3130
- params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
3131
- }
3132
- if (params.enableScroll !== undefined) {
3133
- params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
3134
- }
3135
- if (params.preventScroll === undefined && params.enableScroll === undefined) {
3136
- enableScroll(app.renderer);
3137
- }
3138
- return app;
3139
- };
3140
- Renderer.prototype.update = function () {
3141
- var e_1, _a, e_2, _b;
3142
- var changes = this.componentObserver.clear();
3143
- try {
3144
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
3145
- var changed = changes_1_1.value;
3146
- this.transform.componentChanged(changed);
3147
- }
3148
- }
3149
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3150
- finally {
3151
- try {
3152
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
3153
- }
3154
- finally { if (e_1) throw e_1.error; }
3155
- }
3156
- try {
3157
- for (var _c = __values(this.game.gameObjects), _d = _c.next(); !_d.done; _d = _c.next()) {
3158
- var gameObject = _d.value;
3159
- this.containerManager.updateTransform({
3160
- name: gameObject.id,
3161
- transform: gameObject.transform,
3162
- });
3163
- this.rendererManager.update(gameObject);
3164
- }
3165
- }
3166
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3167
- finally {
3168
- try {
3169
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
3170
- }
3171
- finally { if (e_2) throw e_2.error; }
3172
- }
3173
- };
3174
- Renderer.prototype.lateUpdate = function (e) {
3175
- this.transform.update();
3176
- this.application.ticker.update(e.time);
3177
- };
3178
- Renderer.prototype.onDestroy = function () {
3179
- var e_3, _a;
3180
- this.application.destroy();
3181
- try {
3182
- for (var _b = __values(this.multiApps), _c = _b.next(); !_c.done; _c = _b.next()) {
3183
- var app = _c.value;
3184
- app && app.destroy();
3185
- }
3186
- }
3187
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
3188
- finally {
3189
- try {
3190
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3191
- }
3192
- finally { if (e_3) throw e_3.error; }
3193
- }
3194
- this.transform.destroy();
3195
- this.transform = null;
3196
- this.params = null;
3197
- this.rendererManager = null;
3198
- this.containerManager = null;
3199
- this.application = null;
3200
- this.game = null;
3201
- this.multiApps = null;
3202
- };
3203
- Renderer.prototype.resize = function (width, height) {
3204
- this.params.width = width;
3205
- this.params.height = height;
3206
- this.application.renderer.resize(width, height);
3207
- };
3208
- Renderer.systemName = 'Renderer';
3209
- Renderer = __decorate([
3210
- eva_js.decorators.componentObserver({
3211
- Transform: ['_parent'],
3212
- })
3213
- ], Renderer);
3214
- return Renderer;
3215
- }(eva_js.System));
3216
- var Renderer$3 = Renderer$2;
3217
-
3218
- ((function (_super) {
3219
- __extends(Renderer, _super);
3220
- function Renderer(params) {
3221
- var _this = _super.call(this, params) || this;
3222
- _this.observerInfo = _this.constructor.observerInfo;
3223
- return _this;
3224
- }
3225
- Renderer.prototype.componentChanged = function (_changed) { };
3226
- Renderer.prototype.rendererUpdate = function (_gameObject) { };
3227
- Renderer.prototype.update = function () {
3228
- var e_1, _a;
3229
- var changes = this.componentObserver.clear();
3230
- try {
3231
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
3232
- var changed = changes_1_1.value;
3233
- this.componentChanged(changed);
3234
- }
3235
- }
3236
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3237
- finally {
3238
- try {
3239
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
3240
- }
3241
- finally { if (e_1) throw e_1.error; }
3242
- }
3243
- };
3244
- return Renderer;
3245
- })(eva_js.System));
3246
-
3247
- function uuid(len) {
3248
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
3249
- var uuid = [];
3250
- var radix = chars.length;
3251
- for (var i = 0; i < len; i++)
3252
- uuid[i] = chars[0 | (Math.random() * radix)];
3253
- return uuid.join('');
3254
- }
3255
- var setStyle = function (element, style) {
3256
- var width = style.width, height = style.height, position = style.position, _a = style.left, left = _a === void 0 ? 0 : _a, _b = style.top, top = _b === void 0 ? 0 : _b, zIndex = style.zIndex, pointerEvents = style.pointerEvents, background = style.background;
3257
- element.style.width = width + "px";
3258
- element.style.height = height + "px";
3259
- element.style.position = position;
3260
- element.style.left = "" + left;
3261
- element.style.top = "" + top;
3262
- element.style.zIndex = "" + zIndex;
3263
- element.style.pointerEvents = pointerEvents;
3264
- element.style.background = background;
3265
- element.style.border = 'none';
3266
- element.style.overflow = 'hidden';
3267
- };
3268
- var setTransform = function (element, transform, ratioX, ratioY) {
3269
- var worldTransform = transform.worldTransform;
3270
- var a = worldTransform.a, b = worldTransform.b, c = worldTransform.c, d = worldTransform.d, tx = worldTransform.tx, ty = worldTransform.ty;
3271
- var matrix = "matrix(" + a + ", " + b + ", " + c + ", " + d + ", " + tx * ratioX + ", " + ty * ratioY + ")";
3272
- element.style.transform = "" + matrix;
3273
- element.style.webkitTransform = "" + matrix;
3274
- element.style.transformOrigin = 'left top';
3275
- element.style.webkitTransformOrigin = 'left top';
707
+ A11ySystem.prototype.onDestroy = function () {
708
+ this.div.parentElement.removeChild(this.div);
709
+ this.cache = null;
710
+ this.eventCache = null;
711
+ this.div = null;
3276
712
  };
3277
-
3278
- var A11y = (function (_super) {
3279
- __extends$2(A11y, _super);
3280
- function A11y(param) {
3281
- var _this = _super.call(this) || this;
3282
- Object.assign(_this, param);
3283
- var _a = param.hint, hint = _a === void 0 ? '' : _a, event = param.event, _b = param.delay, delay = _b === void 0 ? 0 : _b, _c = param.attr, attr = _c === void 0 ? {} : _c, _d = param.role, role = _d === void 0 ? '' : _d, _e = param.props, props = _e === void 0 ? {} : _e, _f = param.state, state = _f === void 0 ? {} : _f;
3284
- _this.hint = hint;
3285
- _this.event = event;
3286
- _this.delay = delay;
3287
- _this.attr = attr;
3288
- _this.role = role;
3289
- _this.props = props;
3290
- _this.state = state;
3291
- _this.a11yId = "_" + uuid(6);
3292
- return _this;
3293
- }
3294
- A11y.componentName = 'A11y';
3295
- __decorate$1([
3296
- eva_js.decorators.IDEProp
3297
- ], A11y.prototype, "interactive", void 0);
3298
- __decorate$1([
3299
- eva_js.decorators.IDEProp
3300
- ], A11y.prototype, "hint", void 0);
3301
- __decorate$1([
3302
- eva_js.decorators.IDEProp
3303
- ], A11y.prototype, "event", void 0);
3304
- __decorate$1([
3305
- eva_js.decorators.IDEProp
3306
- ], A11y.prototype, "delay", void 0);
3307
- __decorate$1([
3308
- eva_js.decorators.IDEProp
3309
- ], A11y.prototype, "role", void 0);
3310
- __decorate$1([
3311
- eva_js.decorators.IDEProp
3312
- ], A11y.prototype, "props", void 0);
3313
- __decorate$1([
3314
- eva_js.decorators.IDEProp
3315
- ], A11y.prototype, "state", void 0);
3316
- __decorate$1([
3317
- eva_js.decorators.IDEProp
3318
- ], A11y.prototype, "attr", void 0);
3319
- __decorate$1([
3320
- eva_js.decorators.IDEProp
3321
- ], A11y.prototype, "a11yId", void 0);
3322
- return A11y;
3323
- }(eva_js.Component));
3324
- var A11y$1 = A11y;
3325
-
3326
- var POSITION = 'absolute';
3327
- var ZINDEX = 3;
3328
- exports.A11yActivate = void 0;
3329
- (function (A11yActivate) {
3330
- A11yActivate[A11yActivate["ENABLE"] = 0] = "ENABLE";
3331
- A11yActivate[A11yActivate["DISABLE"] = 1] = "DISABLE";
3332
- A11yActivate[A11yActivate["CHECK"] = 2] = "CHECK";
3333
- })(exports.A11yActivate || (exports.A11yActivate = {}));
3334
- var PointerEvents;
3335
- (function (PointerEvents) {
3336
- PointerEvents["NONE"] = "none";
3337
- PointerEvents["AUTO"] = "auto";
3338
- })(PointerEvents || (PointerEvents = {}));
3339
- var MaskBackground;
3340
- (function (MaskBackground) {
3341
- MaskBackground["DEBUG"] = "rgba(255,0,0,0.5)";
3342
- MaskBackground["NONE"] = "transparent";
3343
- })(MaskBackground || (MaskBackground = {}));
3344
- var ElementType;
3345
- (function (ElementType) {
3346
- ElementType["BUTTON"] = "button";
3347
- ElementType["DIV"] = "div";
3348
- })(ElementType || (ElementType = {}));
3349
-
3350
- var notAttr = ['hint', 'event', 'delay', 'attr', 'role', 'props', 'state', 'a11yId', 'name'];
3351
- var getEventFunc = function (event, gameObject, e) {
3352
- var _this = this;
3353
- ['touchstart', 'touchend', 'tap'].forEach(function (name) {
3354
- event.emit(name, {
3355
- stopPropagation: function () { return e.stopPropagation(); },
3356
- data: {
3357
- position: _this.eventPosition,
3358
- },
3359
- gameObject: gameObject,
3360
- });
3361
- });
3362
- };
3363
- var A11ySystem = (function (_super) {
3364
- __extends$2(A11ySystem, _super);
3365
- function A11ySystem(opt) {
3366
- var _this = _super.call(this, opt) || this;
3367
- _this.cache = new Map();
3368
- _this.eventCache = new Map();
3369
- return _this;
3370
- }
3371
- Object.defineProperty(A11ySystem.prototype, "ratioX", {
3372
- get: function () {
3373
- if (this._ratioX) {
3374
- return this._ratioX;
3375
- }
3376
- else {
3377
- var success = this.setRatio();
3378
- if (success) {
3379
- return this._ratioX;
3380
- }
3381
- else {
3382
- return 0;
3383
- }
3384
- }
3385
- },
3386
- enumerable: false,
3387
- configurable: true
3388
- });
3389
- Object.defineProperty(A11ySystem.prototype, "ratioY", {
3390
- get: function () {
3391
- if (this._ratioY) {
3392
- return this._ratioY;
3393
- }
3394
- else {
3395
- var success = this.setRatio();
3396
- if (success) {
3397
- return this._ratioY;
3398
- }
3399
- else {
3400
- return 0;
3401
- }
3402
- }
3403
- },
3404
- enumerable: false,
3405
- configurable: true
3406
- });
3407
- A11ySystem.prototype.init = function (opt) {
3408
- if (opt === void 0) { opt = {}; }
3409
- return __awaiter(this, void 0, void 0, function () {
3410
- var _a, activate, _b, delay, _c, checkA11yOpen, _d, _e, div;
3411
- return __generator(this, function (_f) {
3412
- switch (_f.label) {
3413
- case 0:
3414
- _a = opt.activate, activate = _a === void 0 ? exports.A11yActivate.CHECK : _a, _b = opt.delay, delay = _b === void 0 ? 100 : _b, _c = opt.checkA11yOpen, checkA11yOpen = _c === void 0 ? function () { return Promise.resolve(false); } : _c;
3415
- this.delay = delay;
3416
- _d = activate;
3417
- switch (_d) {
3418
- case exports.A11yActivate.CHECK: return [3, 1];
3419
- case exports.A11yActivate.DISABLE: return [3, 5];
3420
- case exports.A11yActivate.ENABLE: return [3, 6];
3421
- }
3422
- return [3, 7];
3423
- case 1:
3424
- _f.trys.push([1, 3, , 4]);
3425
- _e = this;
3426
- return [4, checkA11yOpen()];
3427
- case 2:
3428
- _e.activate = _f.sent();
3429
- return [3, 4];
3430
- case 3:
3431
- _f.sent();
3432
- this.activate = false;
3433
- return [3, 4];
3434
- case 4: return [3, 7];
3435
- case 5:
3436
- this.activate = false;
3437
- return [3, 7];
3438
- case 6:
3439
- this.activate = true;
3440
- return [3, 7];
3441
- case 7:
3442
- this.debug = opt.debug || false;
3443
- if (this.debug) {
3444
- this.activate = true;
3445
- }
3446
- if (!this.activate)
3447
- return [2];
3448
- div = document.createElement('div');
3449
- this.div = div;
3450
- if (this.game.canvas.parentNode) {
3451
- this.game.canvas.parentNode.appendChild(this.div);
3452
- }
3453
- return [2];
3454
- }
3455
- });
3456
- });
3457
- };
3458
- A11ySystem.prototype.setRatio = function () {
3459
- var _a = this.getCanvasBoundingClientRect(), width = _a.width, height = _a.height;
3460
- var _b = this.getRenderRect(), renderWidth = _b.renderWidth, renderHeight = _b.renderHeight;
3461
- this._ratioX = width / renderWidth;
3462
- this._ratioY = height / renderHeight;
3463
- if (width || height) {
3464
- this.initDiv();
3465
- return true;
3466
- }
3467
- else {
3468
- return false;
3469
- }
3470
- };
3471
- A11ySystem.prototype.getRenderRect = function () {
3472
- var params = (this.game.getSystem(Renderer$3) || { width: 300, height: 300 }).params;
3473
- var renderHeight = params.height, renderWidth = params.width;
3474
- return { renderWidth: renderWidth, renderHeight: renderHeight };
3475
- };
3476
- A11ySystem.prototype.getCanvasBoundingClientRect = function () {
3477
- var _a = this.game.canvas.getBoundingClientRect(), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
3478
- return { width: width, height: height, left: left, top: top };
3479
- };
3480
- A11ySystem.prototype.initDiv = function () {
3481
- var _this = this;
3482
- var pageXOffset = window.pageXOffset, pageYOffset = window.pageYOffset;
3483
- var _a = this.getCanvasBoundingClientRect(), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
3484
- var style = {
3485
- width: width,
3486
- height: height,
3487
- left: left + pageXOffset + "px",
3488
- top: top + pageYOffset + "px",
3489
- position: POSITION,
3490
- zIndex: ZINDEX,
3491
- pointerEvents: PointerEvents.NONE,
3492
- background: MaskBackground.NONE,
3493
- };
3494
- setStyle(this.div, style);
3495
- this.div.addEventListener('click', function (e) {
3496
- var currentTarget = e.currentTarget;
3497
- var _a = currentTarget.getBoundingClientRect(), left = _a.left, top = _a.top;
3498
- var x = (e.pageX - left) / _this.ratioX;
3499
- var y = (e.pageY - top) / _this.ratioY;
3500
- _this.eventPosition = { x: x, y: y };
3501
- }, true);
3502
- };
3503
- A11ySystem.prototype.update = function () {
3504
- return __awaiter(this, void 0, void 0, function () {
3505
- var changes, changes_1, changes_1_1, changed;
3506
- var e_1, _a;
3507
- return __generator(this, function (_b) {
3508
- changes = this.componentObserver.clear();
3509
- if (!this.activate) {
3510
- return [2];
3511
- }
3512
- try {
3513
- for (changes_1 = __values$1(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
3514
- changed = changes_1_1.value;
3515
- switch (changed.type) {
3516
- case eva_js.OBSERVER_TYPE.ADD:
3517
- changed.componentName === 'Event' && this.addEvent(changed.gameObject);
3518
- changed.componentName === 'A11y' && this.add(changed);
3519
- break;
3520
- case eva_js.OBSERVER_TYPE.CHANGE:
3521
- changed.componentName === 'Transform' && this.transformChange(changed);
3522
- break;
3523
- case eva_js.OBSERVER_TYPE.REMOVE:
3524
- changed.componentName === 'Event' && this.removeEvent(changed);
3525
- changed.componentName === 'A11y' && this.remove(changed);
3526
- }
3527
- }
3528
- }
3529
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3530
- finally {
3531
- try {
3532
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
3533
- }
3534
- finally { if (e_1) throw e_1.error; }
3535
- }
3536
- return [2];
3537
- });
3538
- });
3539
- };
3540
- A11ySystem.prototype.remove = function (changed) {
3541
- var component = changed.component;
3542
- if (!component)
3543
- return;
3544
- var a11yId = component.a11yId;
3545
- var element = this.div.querySelector("#" + a11yId);
3546
- element && this.div.removeChild(element);
3547
- this.cache.delete(a11yId);
3548
- };
3549
- A11ySystem.prototype.add = function (changed) {
3550
- var _this = this;
3551
- if (!this.activate)
3552
- return;
3553
- var component = changed.component;
3554
- var gameObject = changed.gameObject;
3555
- var delay = component.delay, id = component.a11yId;
3556
- var event = component.event;
3557
- if (!gameObject)
3558
- return;
3559
- var transform = gameObject.transform;
3560
- if (!transform)
3561
- return;
3562
- var element = document.createElement('div');
3563
- this.cache.set(id, element);
3564
- if (!event) {
3565
- event = gameObject.getComponent('Event');
3566
- }
3567
- setTimeout(function () {
3568
- _this.setPosition(element, transform);
3569
- _this.setA11yAttr(element, component);
3570
- if (event) {
3571
- _this.addEvent(gameObject);
3572
- }
3573
- if (gameObject.scene) {
3574
- _this.div.appendChild(element);
3575
- }
3576
- }, delay || this.delay);
3577
- };
3578
- A11ySystem.prototype.transformChange = function (changed) {
3579
- var component = changed.component;
3580
- var gameObject = changed.gameObject;
3581
- var a11yComponent = gameObject.getComponent(A11y$1);
3582
- if (!a11yComponent)
3583
- return;
3584
- var a11yId = a11yComponent.a11yId;
3585
- if (!component.inScene) {
3586
- var dom = this.div.querySelector("#" + a11yId);
3587
- dom && this.div.removeChild(dom);
3588
- }
3589
- else {
3590
- if (this.cache.has(a11yId)) {
3591
- var addDom = this.cache.get(a11yId);
3592
- addDom && this.div.appendChild(addDom);
3593
- }
3594
- }
3595
- };
3596
- A11ySystem.prototype.setEvent = function (element, event, gameObject, id) {
3597
- if (!event) {
3598
- return;
3599
- }
3600
- var func = getEventFunc.bind(this, event, gameObject);
3601
- this.eventCache.set(id, func);
3602
- element.addEventListener('click', func);
3603
- };
3604
- A11ySystem.prototype.addEvent = function (gameObject) {
3605
- var a11y = gameObject.getComponent(A11y$1);
3606
- if (!a11y)
3607
- return;
3608
- var event = gameObject.getComponent('Event');
3609
- if (!event)
3610
- return;
3611
- var element = this.cache.get(a11y.a11yId);
3612
- element && this.setEvent(element, event, gameObject, a11y.a11yId);
3613
- };
3614
- A11ySystem.prototype.removeEvent = function (changed) {
3615
- var gameObject = changed.gameObject;
3616
- var a11y = gameObject.getComponent(A11y$1);
3617
- if (!a11y)
3618
- return;
3619
- var event = changed.component;
3620
- if (!event)
3621
- return;
3622
- var a11yId = a11y.a11yId;
3623
- var func = this.eventCache.get(a11yId);
3624
- var element = this.cache.get(a11yId);
3625
- element && element.removeEventListener('click', func);
3626
- };
3627
- A11ySystem.prototype.setA11yAttr = function (element, component) {
3628
- var e_2, _a, e_3, _b, e_4, _c;
3629
- var hint = component.hint, _d = component.props, props = _d === void 0 ? {} : _d, _e = component.state, state = _e === void 0 ? {} : _e, role = component.role, id = component.a11yId;
3630
- var realRole = role || 'text';
3631
- element.setAttribute('role', realRole);
3632
- element.setAttribute('aria-label', hint);
3633
- element.id = id;
3634
- var ariaProps = Object.keys(props);
3635
- try {
3636
- for (var ariaProps_1 = __values$1(ariaProps), ariaProps_1_1 = ariaProps_1.next(); !ariaProps_1_1.done; ariaProps_1_1 = ariaProps_1.next()) {
3637
- var key = ariaProps_1_1.value;
3638
- element.setAttribute(key, props[key]);
3639
- }
3640
- }
3641
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3642
- finally {
3643
- try {
3644
- if (ariaProps_1_1 && !ariaProps_1_1.done && (_a = ariaProps_1.return)) _a.call(ariaProps_1);
3645
- }
3646
- finally { if (e_2) throw e_2.error; }
3647
- }
3648
- var ariaState = Object.keys(state);
3649
- try {
3650
- for (var ariaState_1 = __values$1(ariaState), ariaState_1_1 = ariaState_1.next(); !ariaState_1_1.done; ariaState_1_1 = ariaState_1.next()) {
3651
- var key = ariaState_1_1.value;
3652
- element.setAttribute(key, state[key]);
3653
- }
3654
- }
3655
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
3656
- finally {
3657
- try {
3658
- if (ariaState_1_1 && !ariaState_1_1.done && (_b = ariaState_1.return)) _b.call(ariaState_1);
3659
- }
3660
- finally { if (e_3) throw e_3.error; }
3661
- }
3662
- try {
3663
- for (var _f = __values$1(Object.keys(component)), _g = _f.next(); !_g.done; _g = _f.next()) {
3664
- var key = _g.value;
3665
- if (typeof component[key] === 'string' && notAttr.indexOf(key) === -1 && key.indexOf('_') !== 1) {
3666
- element.setAttribute(key, component[key]);
3667
- }
3668
- }
3669
- }
3670
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
3671
- finally {
3672
- try {
3673
- if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
3674
- }
3675
- finally { if (e_4) throw e_4.error; }
3676
- }
3677
- };
3678
- A11ySystem.prototype.setPosition = function (element, transform) {
3679
- var _a = transform.size, width = _a.width, height = _a.height;
3680
- var style = {
3681
- width: width === 0 ? 1 : width * this.ratioX,
3682
- height: height === 0 ? 1 : height * this.ratioY,
3683
- position: POSITION,
3684
- zIndex: ZINDEX,
3685
- pointerEvents: PointerEvents.AUTO,
3686
- background: this.debug ? MaskBackground.DEBUG : MaskBackground.NONE,
3687
- };
3688
- var transformProps = __assign$1({}, transform);
3689
- setStyle(element, style);
3690
- setTransform(element, transformProps, this.ratioX, this.ratioY);
3691
- };
3692
- A11ySystem.prototype.onDestroy = function () {
3693
- this.div.parentElement.removeChild(this.div);
3694
- this.cache = null;
3695
- this.eventCache = null;
3696
- };
3697
- A11ySystem.systemName = 'A11ySystem';
3698
- A11ySystem = __decorate$1([
3699
- eva_js.decorators.componentObserver({
3700
- A11y: [],
3701
- Transform: ['inScene'],
3702
- Event: [],
3703
- })
3704
- ], A11ySystem);
3705
- return A11ySystem;
3706
- }(eva_js.System));
3707
- var A11ySystem$1 = A11ySystem;
3708
-
3709
- exports.A11y = A11y$1;
3710
- exports.A11ySystem = A11ySystem$1;
3711
-
3712
- Object.defineProperty(exports, '__esModule', { value: true });
3713
-
3714
- })));
3715
- //# sourceMappingURL=EVA.plugin.a11y.js.map
713
+ A11ySystem.systemName = 'A11ySystem';
714
+ A11ySystem = __decorate([eva_js.decorators.componentObserver({
715
+ A11y: ['hint'],
716
+ Transform: ['inScene'],
717
+ Event: []
718
+ })], A11ySystem);
719
+ return A11ySystem;
720
+ }(eva_js.System);
721
+ var A11ySystem$1 = A11ySystem;
722
+ exports.A11y = A11y$1;
723
+ exports.A11ySystem = A11ySystem$1;
724
+ Object.defineProperty(exports, '__esModule', {
725
+ value: true
726
+ });
727
+ return exports;
728
+ }({}, EVA, EVA.plugin.renderer);
729
+ window.EVA.plugin.a11y = window.EVA.plugin.a11y || _EVA_IIFE_a11y;