-
Notifications
You must be signed in to change notification settings - Fork 4
/
performance.js
2201 lines (2176 loc) · 70.3 KB
/
performance.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env node
(function(){
var shadow$provide = {};
var SHADOW_IMPORT_PATH = __dirname + '/.shadow-cljs/builds/script/dev/out/cljs-runtime';
if (__dirname == '.') { SHADOW_IMPORT_PATH = "/Users/danielneal/development/compound/.shadow-cljs/builds/script/dev/out/cljs-runtime"; }
global.$CLJS = global;
global.shadow$provide = {};
try {require('source-map-support').install();} catch (e) {console.warn('no "source-map-support" (run "npm install source-map-support --save-dev" to get it)');}
global.CLOSURE_NO_DEPS = true;
global.CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":true,"shadow.cljs.devtools.client.env.proc_id":"d39b7f8a-a65a-47cf-b652-78ed7f538e42","goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"script","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"cljs.core._STAR_target_STAR_":"nodejs","shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","goog.TRANSPILE":"never"};
var goog = global.goog = {};
var SHADOW_IMPORTED = global.SHADOW_IMPORTED = {};
var PATH = require("path");
var VM = require("vm");
var FS = require("fs");
var SHADOW_PROVIDE = function(name) {
return goog.exportPath_(name, undefined);
};
var SHADOW_REQUIRE = function(name) {
if (goog.isInModuleLoader_()) {
return goog.module.getInternal_(name);
}
return true;
};
var SHADOW_WRAP = function(js) {
var code = "(function (require, module, __filename, __dirname) {\n";
// this is part of goog/base.js and for some reason the only global var not on goog or goog.global
code += "var COMPILED = false;\n"
code += js;
code += "\n});";
return code;
};
var SHADOW_IMPORT = global.SHADOW_IMPORT = function(src) {
if (CLOSURE_DEFINES["shadow.debug"]) {
console.info("SHADOW load:", src);
}
SHADOW_IMPORTED[src] = true;
// SHADOW_IMPORT_PATH is an absolute path
var filePath = PATH.resolve(SHADOW_IMPORT_PATH, src);
var js = FS.readFileSync(filePath);
var code = SHADOW_WRAP(js);
var fn = VM.runInThisContext(code,
{filename: filePath,
lineOffset: -2, // see SHADOW_WRAP, adds 2 lines
displayErrors: true
});
// the comment is for source-map-support which unfortunately shows the wrong piece of code but the stack is correct
try {
/* ignore this, look at stacktrace */ fn.call(global, require, module, __filename, __dirname);
} catch (e) {
console.error("SHADOW import error", filePath);
throw e;
}
return true;
};
global.SHADOW_NODE_EVAL = function(js, smJson) {
// special case handling for require since it may otherwise not be available
js = "(function cljsEval(require) {\n return " + js + "\n});";
if (smJson) {
js += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,";
js += Buffer.from(smJson).toString('base64');
}
// console.log(js);
var fn = VM.runInThisContext.call(global, js,
{filename: "<eval>",
lineOffset: -1, // wrapper adds one line on top
displayErrors: true});
// console.log("result", fn);
return fn(require);
};
/** @define {boolean} */ var COMPILED = false;
/** @const */ var goog = goog || {};
/**
* @const
* @suppress {newCheckTypes}
*/
goog.global = global;
/** @type {(Object<string,(string|number|boolean)>|undefined)} */ goog.global.CLOSURE_UNCOMPILED_DEFINES;
/** @type {(Object<string,(string|number|boolean)>|undefined)} */ goog.global.CLOSURE_DEFINES;
/**
* @param {?} val
* @return {boolean}
*/
goog.isDef = function(val) {
return val !== void 0;
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isString = function(val) {
return typeof val == "string";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isBoolean = function(val) {
return typeof val == "boolean";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isNumber = function(val) {
return typeof val == "number";
};
/**
* @private
* @param {string} name
* @param {*=} opt_object
* @param {Object=} opt_objectToExportTo
*/
goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
var parts = name.split(".");
var cur = opt_objectToExportTo || goog.global;
if (!(parts[0] in cur) && typeof cur.execScript != "undefined") {
cur.execScript("var " + parts[0]);
}
for (var part; parts.length && (part = parts.shift());) {
if (!parts.length && goog.isDef(opt_object)) {
cur[part] = opt_object;
} else {
if (cur[part] && cur[part] !== Object.prototype[part]) {
cur = cur[part];
} else {
cur = cur[part] = {};
}
}
}
};
/**
* @param {string} name
* @param {(string|number|boolean)} defaultValue
* @return {(string|number|boolean)}
*/
goog.define = function(name, defaultValue) {
var value = defaultValue;
if (!COMPILED) {
var uncompiledDefines = goog.global.CLOSURE_UNCOMPILED_DEFINES;
var defines = goog.global.CLOSURE_DEFINES;
if (uncompiledDefines && /** @type {?} */ (uncompiledDefines).nodeType === undefined && Object.prototype.hasOwnProperty.call(uncompiledDefines, name)) {
value = uncompiledDefines[name];
} else {
if (defines && /** @type {?} */ (defines).nodeType === undefined && Object.prototype.hasOwnProperty.call(defines, name)) {
value = defines[name];
}
}
}
goog.exportPath_(name, value);
return value;
};
/** @define {boolean} */ goog.define("goog.DEBUG", true);
/** @define {string} */ goog.define("goog.LOCALE", "en");
/** @define {boolean} */ goog.define("goog.TRUSTED_SITE", true);
/** @define {boolean} */ goog.define("goog.STRICT_MODE_COMPATIBLE", false);
/** @define {boolean} */ goog.define("goog.DISALLOW_TEST_ONLY_CODE", COMPILED && !goog.DEBUG);
/** @define {boolean} */ goog.define("goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING", false);
/**
* @param {string} name
*/
goog.provide = function(name) {
if (goog.isInModuleLoader_()) {
throw new Error("goog.provide cannot be used within a module.");
}
if (!COMPILED) {
if (goog.isProvided_(name)) {
throw new Error('Namespace "' + name + '" already declared.');
}
}
goog.constructNamespace_(name);
};
/**
* @private
* @param {string} name
* @param {Object=} opt_obj
*/
goog.constructNamespace_ = function(name, opt_obj) {
if (!COMPILED) {
delete goog.implicitNamespaces_[name];
var namespace = name;
while (namespace = namespace.substring(0, namespace.lastIndexOf("."))) {
if (goog.getObjectByName(namespace)) {
break;
}
goog.implicitNamespaces_[namespace] = true;
}
}
goog.exportPath_(name, opt_obj);
};
/**
* @param {?Window=} opt_window
* @return {string}
*/
goog.getScriptNonce = function(opt_window) {
if (opt_window && opt_window != goog.global) {
return goog.getScriptNonce_(opt_window.document);
}
if (goog.cspNonce_ === null) {
goog.cspNonce_ = goog.getScriptNonce_(goog.global.document);
}
return goog.cspNonce_;
};
/** @private @const */ goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;
/** @private @type {?string} */ goog.cspNonce_ = null;
/**
* @private
* @param {!Document} doc
* @return {string}
*/
goog.getScriptNonce_ = function(doc) {
var script = doc.querySelector && doc.querySelector("script[nonce]");
if (script) {
var nonce = script["nonce"] || script.getAttribute("nonce");
if (nonce && goog.NONCE_PATTERN_.test(nonce)) {
return nonce;
}
}
return "";
};
/** @private */ goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
/**
* @param {string} name
* @return {void}
*/
goog.module = function(name) {
if (!goog.isString(name) || !name || name.search(goog.VALID_MODULE_RE_) == -1) {
throw new Error("Invalid module identifier");
}
if (!goog.isInGoogModuleLoader_()) {
throw new Error("Module " + name + " has been loaded incorrectly. Note, " + "modules cannot be loaded as normal scripts. They require some kind of " + "pre-processing step. You're likely trying to load a module via a " + "script tag or as a part of a concatenated bundle without rewriting the " + "module. For more info see: " + "https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");
}
if (goog.moduleLoaderState_.moduleName) {
throw new Error("goog.module may only be called once per module.");
}
goog.moduleLoaderState_.moduleName = name;
if (!COMPILED) {
if (goog.isProvided_(name)) {
throw new Error('Namespace "' + name + '" already declared.');
}
delete goog.implicitNamespaces_[name];
}
};
/**
* @param {string} name
* @return {?}
* @suppress {missingProvide}
*/
goog.module.get = function(name) {
return goog.module.getInternal_(name);
};
/**
* @private
* @param {string} name
* @return {?}
*/
goog.module.getInternal_ = function(name) {
if (!COMPILED) {
if (name in goog.loadedModules_) {
return goog.loadedModules_[name].exports;
} else {
if (!goog.implicitNamespaces_[name]) {
var ns = goog.getObjectByName(name);
return ns != null ? ns : null;
}
}
}
return null;
};
/** @enum {string} */ goog.ModuleType = {ES6:"es6", GOOG:"goog"};
/** @private @type {?{moduleName:(string|undefined),declareLegacyNamespace:boolean,type:?goog.ModuleType}} */ goog.moduleLoaderState_ = null;
/**
* @private
* @return {boolean}
*/
goog.isInModuleLoader_ = function() {
return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_();
};
/**
* @private
* @return {boolean}
*/
goog.isInGoogModuleLoader_ = function() {
return !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.GOOG;
};
/**
* @private
* @return {boolean}
*/
goog.isInEs6ModuleLoader_ = function() {
var inLoader = !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.ES6;
if (inLoader) {
return true;
}
var jscomp = goog.global["$jscomp"];
if (jscomp) {
if (typeof jscomp.getCurrentModulePath != "function") {
return false;
}
return !!jscomp.getCurrentModulePath();
}
return false;
};
/**
* @suppress {missingProvide}
*/
goog.module.declareLegacyNamespace = function() {
if (!COMPILED && !goog.isInGoogModuleLoader_()) {
throw new Error("goog.module.declareLegacyNamespace must be called from " + "within a goog.module");
}
if (!COMPILED && !goog.moduleLoaderState_.moduleName) {
throw new Error("goog.module must be called prior to " + "goog.module.declareLegacyNamespace.");
}
goog.moduleLoaderState_.declareLegacyNamespace = true;
};
/**
* @param {string} namespace
* @suppress {missingProvide}
*/
goog.declareModuleId = function(namespace) {
if (!COMPILED) {
if (!goog.isInEs6ModuleLoader_()) {
throw new Error("goog.declareModuleId may only be called from " + "within an ES6 module");
}
if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName) {
throw new Error("goog.declareModuleId may only be called once per module.");
}
if (namespace in goog.loadedModules_) {
throw new Error('Module with namespace "' + namespace + '" already exists.');
}
}
if (goog.moduleLoaderState_) {
goog.moduleLoaderState_.moduleName = namespace;
} else {
var jscomp = goog.global["$jscomp"];
if (!jscomp || typeof jscomp.getCurrentModulePath != "function") {
throw new Error('Module with namespace "' + namespace + '" has been loaded incorrectly.');
}
var exports = jscomp.require(jscomp.getCurrentModulePath());
goog.loadedModules_[namespace] = {exports:exports, type:goog.ModuleType.ES6, moduleId:namespace};
}
};
/**
* @type {function(string):undefined}
* @suppress {missingProvide}
*/
goog.module.declareNamespace = goog.declareModuleId;
/**
* @param {string=} opt_message
*/
goog.setTestOnly = function(opt_message) {
if (goog.DISALLOW_TEST_ONLY_CODE) {
opt_message = opt_message || "";
throw new Error("Importing test-only code into non-debug environment" + (opt_message ? ": " + opt_message : "."));
}
};
/**
* @param {string} name
*/
goog.forwardDeclare = function(name) {
};
goog.forwardDeclare("Document");
goog.forwardDeclare("HTMLScriptElement");
goog.forwardDeclare("XMLHttpRequest");
if (!COMPILED) {
/**
* @private
* @param {string} name
* @return {boolean}
*/
goog.isProvided_ = function(name) {
return name in goog.loadedModules_ || !goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name));
};
/** @private @type {!Object<string,(boolean|undefined)>} */ goog.implicitNamespaces_ = {"goog.module":true};
}
/**
* @param {string} name
* @param {Object=} opt_obj
* @return {?}
*/
goog.getObjectByName = function(name, opt_obj) {
var parts = name.split(".");
var cur = opt_obj || goog.global;
for (var i = 0; i < parts.length; i++) {
cur = cur[parts[i]];
if (!goog.isDefAndNotNull(cur)) {
return null;
}
}
return cur;
};
/**
* @param {!Object} obj
* @param {Object=} opt_global
* @deprecated Properties may be explicitly exported to the global scope, but this should no longer be done in bulk.
*/
goog.globalize = function(obj, opt_global) {
var global = opt_global || goog.global;
for (var x in obj) {
global[x] = obj[x];
}
};
/**
* @param {string} relPath
* @param {!Array<string>} provides
* @param {!Array<string>} requires
* @param {(boolean|!Object<?,string>)=} opt_loadFlags
*/
goog.addDependency = function(relPath, provides, requires, opt_loadFlags) {
if (!COMPILED && goog.DEPENDENCIES_ENABLED) {
goog.debugLoader_.addDependency(relPath, provides, requires, opt_loadFlags);
}
};
/** @define {boolean} */ goog.define("goog.ENABLE_DEBUG_LOADER", true);
/**
* @private
* @param {string} msg
*/
goog.logToConsole_ = function(msg) {
if (goog.global.console) {
goog.global.console["error"](msg);
}
};
/**
* @param {string} namespace
* @return {?}
*/
goog.require = function(namespace) {
if (!COMPILED) {
if (goog.ENABLE_DEBUG_LOADER) {
goog.debugLoader_.requested(namespace);
}
if (goog.isProvided_(namespace)) {
if (goog.isInModuleLoader_()) {
return goog.module.getInternal_(namespace);
}
} else {
if (goog.ENABLE_DEBUG_LOADER) {
var moduleLoaderState = goog.moduleLoaderState_;
goog.moduleLoaderState_ = null;
try {
goog.debugLoader_.load_(namespace);
} finally {
goog.moduleLoaderState_ = moduleLoaderState;
}
}
}
return null;
}
};
/**
* @param {string} namespace
* @return {?}
*/
goog.requireType = function(namespace) {
return {};
};
/** @type {string} */ goog.basePath = "";
/** @type {(string|undefined)} */ goog.global.CLOSURE_BASE_PATH;
/** @type {(boolean|undefined)} */ goog.global.CLOSURE_NO_DEPS;
/** @type {(function(string,string=):boolean|undefined)} */ goog.global.CLOSURE_IMPORT_SCRIPT;
/**
* @return {void}
*/
goog.nullFunction = function() {
};
/** @type {!Function} */ goog.abstractMethod = function() {
throw new Error("unimplemented abstract method");
};
/**
* @param {!Function} ctor
* @suppress {missingProperties}
*/
goog.addSingletonGetter = function(ctor) {
/**
* @type {(undefined|!Object)}
* @suppress {underscore}
*/
ctor.instance_ = undefined;
ctor.getInstance = function() {
if (ctor.instance_) {
return ctor.instance_;
}
if (goog.DEBUG) {
goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;
}
return /** @type {(!Object|undefined)} */ (ctor.instance_) = new ctor;
};
};
/** @private @type {!Array<!Function>} */ goog.instantiatedSingletons_ = [];
/** @define {boolean} */ goog.define("goog.LOAD_MODULE_USING_EVAL", true);
/** @define {boolean} */ goog.define("goog.SEAL_MODULE_EXPORTS", goog.DEBUG);
/** @private @const @type {!Object<string,{exports:?,type:string,moduleId:string}>} */ goog.loadedModules_ = {};
/** @const @type {boolean} */ goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
/** @define {string} */ goog.define("goog.TRANSPILE", "detect");
/** @define {boolean} */ goog.define("goog.ASSUME_ES_MODULES_TRANSPILED", false);
/** @define {string} */ goog.define("goog.TRANSPILE_TO_LANGUAGE", "");
/** @define {string} */ goog.define("goog.TRANSPILER", "transpile.js");
/** @package @type {?boolean} */ goog.hasBadLetScoping = null;
/**
* @package
* @return {boolean}
*/
goog.useSafari10Workaround = function() {
if (goog.hasBadLetScoping == null) {
var hasBadLetScoping;
try {
hasBadLetScoping = !eval('"use strict";' + "let x \x3d 1; function f() { return typeof x; };" + 'f() \x3d\x3d "number";');
} catch (e) {
hasBadLetScoping = false;
}
goog.hasBadLetScoping = hasBadLetScoping;
}
return goog.hasBadLetScoping;
};
/**
* @package
* @param {string} moduleDef
* @return {string}
*/
goog.workaroundSafari10EvalBug = function(moduleDef) {
return "(function(){" + moduleDef + "\n" + ";" + "})();\n";
};
/**
* @param {(function(?):?|string)} moduleDef
*/
goog.loadModule = function(moduleDef) {
var previousState = goog.moduleLoaderState_;
try {
goog.moduleLoaderState_ = {moduleName:"", declareLegacyNamespace:false, type:goog.ModuleType.GOOG};
var exports;
if (goog.isFunction(moduleDef)) {
exports = moduleDef.call(undefined, {});
} else {
if (goog.isString(moduleDef)) {
if (goog.useSafari10Workaround()) {
moduleDef = goog.workaroundSafari10EvalBug(moduleDef);
}
exports = goog.loadModuleFromSource_.call(undefined, moduleDef);
} else {
throw new Error("Invalid module definition");
}
}
var moduleName = goog.moduleLoaderState_.moduleName;
if (goog.isString(moduleName) && moduleName) {
if (goog.moduleLoaderState_.declareLegacyNamespace) {
goog.constructNamespace_(moduleName, exports);
} else {
if (goog.SEAL_MODULE_EXPORTS && Object.seal && typeof exports == "object" && exports != null) {
Object.seal(exports);
}
}
var data = {exports:exports, type:goog.ModuleType.GOOG, moduleId:goog.moduleLoaderState_.moduleName};
goog.loadedModules_[moduleName] = data;
} else {
throw new Error('Invalid module name "' + moduleName + '"');
}
} finally {
goog.moduleLoaderState_ = previousState;
}
};
/** @private @const */ goog.loadModuleFromSource_ = /** @type {function(string):?} */ (function() {
var exports = {};
eval(arguments[0]);
return exports;
});
/**
* @private
* @param {string} path
* @return {string}
*/
goog.normalizePath_ = function(path) {
var components = path.split("/");
var i = 0;
while (i < components.length) {
if (components[i] == ".") {
components.splice(i, 1);
} else {
if (i && components[i] == ".." && components[i - 1] && components[i - 1] != "..") {
components.splice(--i, 2);
} else {
i++;
}
}
}
return components.join("/");
};
/** @type {(function(string):string|undefined)} */ goog.global.CLOSURE_LOAD_FILE_SYNC;
/**
* @private
* @param {string} src
* @return {?string}
*/
goog.loadFileSync_ = function(src) {
if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
return goog.global.CLOSURE_LOAD_FILE_SYNC(src);
} else {
try {
/** @type {XMLHttpRequest} */ var xhr = new goog.global["XMLHttpRequest"];
xhr.open("get", src, false);
xhr.send();
return xhr.status == 0 || xhr.status == 200 ? xhr.responseText : null;
} catch (err) {
return null;
}
}
};
/**
* @private
* @param {string} code
* @param {string} path
* @param {string} target
* @return {string}
*/
goog.transpile_ = function(code, path, target) {
var jscomp = goog.global["$jscomp"];
if (!jscomp) {
goog.global["$jscomp"] = jscomp = {};
}
var transpile = jscomp.transpile;
if (!transpile) {
var transpilerPath = goog.basePath + goog.TRANSPILER;
var transpilerCode = goog.loadFileSync_(transpilerPath);
if (transpilerCode) {
(function() {
eval(transpilerCode + "\n//# sourceURL\x3d" + transpilerPath);
}).call(goog.global);
if (goog.global["$gwtExport"] && goog.global["$gwtExport"]["$jscomp"] && !goog.global["$gwtExport"]["$jscomp"]["transpile"]) {
throw new Error('The transpiler did not properly export the "transpile" ' + "method. $gwtExport: " + JSON.stringify(goog.global["$gwtExport"]));
}
goog.global["$jscomp"].transpile = goog.global["$gwtExport"]["$jscomp"]["transpile"];
jscomp = goog.global["$jscomp"];
transpile = jscomp.transpile;
}
}
if (!transpile) {
var suffix = " requires transpilation but no transpiler was found.";
transpile = jscomp.transpile = function(code, path) {
goog.logToConsole_(path + suffix);
return code;
};
}
return transpile(code, path, target);
};
/**
* @param {?} value
* @return {string}
*/
goog.typeOf = function(value) {
var s = typeof value;
if (s == "object") {
if (value) {
if (value instanceof Array) {
return "array";
} else {
if (value instanceof Object) {
return s;
}
}
var className = Object.prototype.toString.call(/** @type {!Object} */ (value));
if (className == "[object Window]") {
return "object";
}
if (className == "[object Array]" || typeof value.length == "number" && typeof value.splice != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("splice")) {
return "array";
}
if (className == "[object Function]" || typeof value.call != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("call")) {
return "function";
}
} else {
return "null";
}
} else {
if (s == "function" && typeof value.call == "undefined") {
return "object";
}
}
return s;
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isNull = function(val) {
return val === null;
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isDefAndNotNull = function(val) {
return val != null;
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isArray = function(val) {
return goog.typeOf(val) == "array";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isArrayLike = function(val) {
var type = goog.typeOf(val);
return type == "array" || type == "object" && typeof val.length == "number";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isDateLike = function(val) {
return goog.isObject(val) && typeof val.getFullYear == "function";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isFunction = function(val) {
return goog.typeOf(val) == "function";
};
/**
* @param {?} val
* @return {boolean}
*/
goog.isObject = function(val) {
var type = typeof val;
return type == "object" && val != null || type == "function";
};
/**
* @param {Object} obj
* @return {number}
*/
goog.getUid = function(obj) {
return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);
};
/**
* @param {!Object} obj
* @return {boolean}
*/
goog.hasUid = function(obj) {
return !!obj[goog.UID_PROPERTY_];
};
/**
* @param {Object} obj
*/
goog.removeUid = function(obj) {
if (obj !== null && "removeAttribute" in obj) {
obj.removeAttribute(goog.UID_PROPERTY_);
}
try {
delete obj[goog.UID_PROPERTY_];
} catch (ex) {
}
};
/** @private @type {string} */ goog.UID_PROPERTY_ = "closure_uid_" + (Math.random() * 1e9 >>> 0);
/** @private @type {number} */ goog.uidCounter_ = 0;
/**
* @param {Object} obj
* @return {number}
* @deprecated Use goog.getUid instead.
*/
goog.getHashCode = goog.getUid;
/**
* @param {Object} obj
* @deprecated Use goog.removeUid instead.
*/
goog.removeHashCode = goog.removeUid;
/**
* @param {*} obj
* @return {*}
* @deprecated goog.cloneObject is unsafe. Prefer the goog.object methods.
*/
goog.cloneObject = function(obj) {
var type = goog.typeOf(obj);
if (type == "object" || type == "array") {
if (typeof obj.clone === "function") {
return obj.clone();
}
var clone = type == "array" ? [] : {};
for (var key in obj) {
clone[key] = goog.cloneObject(obj[key]);
}
return clone;
}
return obj;
};
/**
* @private
* @param {?function(this:T,...)} fn
* @param {T} selfObj
* @param {...*} var_args
* @return {!Function}
* @template T
*/
goog.bindNative_ = function(fn, selfObj, var_args) {
return (/** @type {!Function} */ (fn.call.apply(fn.bind, arguments)));
};
/**
* @private
* @param {?function(this:T,...)} fn
* @param {T} selfObj
* @param {...*} var_args
* @return {!Function}
* @template T
*/
goog.bindJs_ = function(fn, selfObj, var_args) {
if (!fn) {
throw new Error;
}
if (arguments.length > 2) {
var boundArgs = Array.prototype.slice.call(arguments, 2);
return function() {
var newArgs = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(newArgs, boundArgs);
return fn.apply(selfObj, newArgs);
};
} else {
return function() {
return fn.apply(selfObj, arguments);
};
}
};
/**
* @param {?function(this:T,...)} fn
* @param {T} selfObj
* @param {...*} var_args
* @return {!Function}
* @template T
* @suppress {deprecated}
*/
goog.bind = function(fn, selfObj, var_args) {
if (Function.prototype.bind && Function.prototype.bind.toString().indexOf("native code") != -1) {
goog.bind = goog.bindNative_;
} else {
goog.bind = goog.bindJs_;
}
return goog.bind.apply(null, arguments);
};
/**
* @param {Function} fn
* @param {...*} var_args
* @return {!Function}
*/
goog.partial = function(fn, var_args) {
var args = Array.prototype.slice.call(arguments, 1);
return function() {
var newArgs = args.slice();
newArgs.push.apply(newArgs, arguments);
return fn.apply(/** @type {?} */ (this), newArgs);
};
};
/**
* @param {Object} target
* @param {Object} source
*/
goog.mixin = function(target, source) {
for (var x in source) {
target[x] = source[x];
}
};
/**
* @return {number}
*/
goog.now = goog.TRUSTED_SITE && Date.now || function() {
return +new Date;
};
/**
* @param {string} script
*/
goog.globalEval = function(script) {
if (goog.global.execScript) {
goog.global.execScript(script, "JavaScript");
} else {
if (goog.global.eval) {
if (goog.evalWorksForGlobals_ == null) {
try {
goog.global.eval("var _evalTest_ \x3d 1;");
} catch (ignore) {
}
if (typeof goog.global["_evalTest_"] != "undefined") {
try {
delete goog.global["_evalTest_"];
} catch (ignore$0) {
}
goog.evalWorksForGlobals_ = true;
} else {
goog.evalWorksForGlobals_ = false;
}
}
if (goog.evalWorksForGlobals_) {
goog.global.eval(script);
} else {
/** @type {!Document} */ var doc = goog.global.document;
var scriptElt = /** @type {!HTMLScriptElement} */ (doc.createElement("SCRIPT"));
scriptElt.type = "text/javascript";
scriptElt.defer = false;
scriptElt.appendChild(doc.createTextNode(script));
doc.head.appendChild(scriptElt);
doc.head.removeChild(scriptElt);
}
} else {
throw new Error("goog.globalEval not available");
}
}
};
/** @private @type {?boolean} */ goog.evalWorksForGlobals_ = null;
/** @private @type {(!Object<string,string>|undefined)} */ goog.cssNameMapping_;
/** @private @type {(string|undefined)} */ goog.cssNameMappingStyle_;
/** @type {(function(string):string|undefined)} */ goog.global.CLOSURE_CSS_NAME_MAP_FN;
/**
* @param {string} className
* @param {string=} opt_modifier
* @return {string}
*/
goog.getCssName = function(className, opt_modifier) {
if (String(className).charAt(0) == ".") {
throw new Error('className passed in goog.getCssName must not start with ".".' + " You passed: " + className);
}
var getMapping = function(cssName) {
return goog.cssNameMapping_[cssName] || cssName;
};
var renameByParts = function(cssName) {
var parts = cssName.split("-");
var mapped = [];
for (var i = 0; i < parts.length; i++) {
mapped.push(getMapping(parts[i]));
}
return mapped.join("-");
};
var rename;
if (goog.cssNameMapping_) {
rename = goog.cssNameMappingStyle_ == "BY_WHOLE" ? getMapping : renameByParts;
} else {
rename = function(a) {
return a;
};
}
var result = opt_modifier ? className + "-" + rename(opt_modifier) : rename(className);
if (goog.global.CLOSURE_CSS_NAME_MAP_FN) {
return goog.global.CLOSURE_CSS_NAME_MAP_FN(result);
}
return result;
};
/**
* @param {!Object} mapping
* @param {string=} opt_style
*/
goog.setCssNameMapping = function(mapping, opt_style) {
goog.cssNameMapping_ = mapping;
goog.cssNameMappingStyle_ = opt_style;
};
/** @type {(!Object<string,string>|undefined)} */ goog.global.CLOSURE_CSS_NAME_MAPPING;
if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {
goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;
}
/**
* @param {string} str
* @param {Object<string,string>=} opt_values
* @return {string}
*/
goog.getMsg = function(str, opt_values) {
if (opt_values) {
str = str.replace(/\{\$([^}]+)}/g, function(match, key) {
return opt_values != null && key in opt_values ? opt_values[key] : match;
});
}
return str;
};
/**
* @param {string} a
* @param {string} b
* @return {string}
*/
goog.getMsgWithFallback = function(a, b) {
return a;