polymer-rails 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -3
  3. data/app/assets/javascripts/polymer/polymer-micro.html +36 -0
  4. data/app/assets/javascripts/polymer/polymer-mini.html +45 -0
  5. data/app/assets/javascripts/polymer/polymer.html +59 -11
  6. data/app/assets/javascripts/polymer/src/lib/annotations/annotations.html +262 -0
  7. data/app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html +60 -0
  8. data/app/assets/javascripts/polymer/src/lib/array-observe.html +118 -0
  9. data/app/assets/javascripts/polymer/src/lib/array-splice.html +262 -0
  10. data/app/assets/javascripts/polymer/src/lib/async.html +68 -0
  11. data/app/assets/javascripts/polymer/src/lib/base.html +117 -0
  12. data/app/assets/javascripts/polymer/src/lib/bind/accessors.html +223 -0
  13. data/app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html +28 -0
  14. data/app/assets/javascripts/polymer/src/lib/bind/demo/app.html +29 -0
  15. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html +76 -0
  16. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html +83 -0
  17. data/app/assets/javascripts/polymer/src/lib/bind/effects.html +80 -0
  18. data/app/assets/javascripts/polymer/src/lib/case-map.html +46 -0
  19. data/app/assets/javascripts/polymer/src/lib/collection.html +179 -0
  20. data/app/assets/javascripts/polymer/src/lib/css-parse.html +131 -0
  21. data/app/assets/javascripts/polymer/src/lib/debounce.html +69 -0
  22. data/app/assets/javascripts/polymer/src/lib/dom-api.html +467 -0
  23. data/app/assets/javascripts/polymer/src/lib/dom-module.html +68 -0
  24. data/app/assets/javascripts/polymer/src/lib/event-api.html +92 -0
  25. data/app/assets/javascripts/polymer/src/lib/expr/focus.html +22 -0
  26. data/app/assets/javascripts/polymer/src/lib/expr/gestures.html +1 -0
  27. data/app/assets/javascripts/polymer/src/lib/expr/log.html +21 -0
  28. data/app/assets/javascripts/polymer/src/lib/expr/sinspect.html +235 -0
  29. data/app/assets/javascripts/polymer/src/lib/expr/style-auditor.html +123 -0
  30. data/app/assets/javascripts/polymer/src/lib/expr/style-protector.html +52 -0
  31. data/app/assets/javascripts/polymer/src/lib/gestures.html +284 -0
  32. data/app/assets/javascripts/polymer/src/lib/lang.html +21 -0
  33. data/app/assets/javascripts/polymer/src/lib/module.html +56 -0
  34. data/app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html +78 -0
  35. data/app/assets/javascripts/polymer/src/lib/resolve-url.html +82 -0
  36. data/app/assets/javascripts/polymer/src/lib/settings.html +52 -0
  37. data/app/assets/javascripts/polymer/src/lib/style-defaults.html +32 -0
  38. data/app/assets/javascripts/polymer/src/lib/style-transformer.html +185 -0
  39. data/app/assets/javascripts/polymer/src/lib/style-util.html +77 -0
  40. data/app/assets/javascripts/polymer/src/lib/template/templatizer.html +132 -0
  41. data/app/assets/javascripts/polymer/src/lib/template/x-array-selector.html +178 -0
  42. data/app/assets/javascripts/polymer/src/lib/template/x-autobind.html +80 -0
  43. data/app/assets/javascripts/polymer/src/lib/template/x-if.html +115 -0
  44. data/app/assets/javascripts/polymer/src/lib/template/x-repeat.html +510 -0
  45. data/app/assets/javascripts/polymer/src/lib/template/x-template.html +39 -0
  46. data/app/assets/javascripts/polymer/src/lib/x-style.html +115 -0
  47. data/app/assets/javascripts/polymer/src/micro/attributes.html +180 -0
  48. data/app/assets/javascripts/polymer/src/micro/constructor.html +74 -0
  49. data/app/assets/javascripts/polymer/src/micro/extends.html +79 -0
  50. data/app/assets/javascripts/polymer/src/micro/mixins.html +40 -0
  51. data/app/assets/javascripts/polymer/src/micro/properties.html +96 -0
  52. data/app/assets/javascripts/polymer/src/micro/tag.html +28 -0
  53. data/app/assets/javascripts/polymer/src/mini/ready.html +180 -0
  54. data/app/assets/javascripts/polymer/src/mini/shadow.html +41 -0
  55. data/app/assets/javascripts/polymer/src/mini/shady.html +365 -0
  56. data/app/assets/javascripts/polymer/src/mini/template.html +56 -0
  57. data/app/assets/javascripts/polymer/src/polymer-lib.html +15 -0
  58. data/app/assets/javascripts/polymer/src/standard/annotations.html +198 -0
  59. data/app/assets/javascripts/polymer/src/standard/configure.html +160 -0
  60. data/app/assets/javascripts/polymer/src/standard/effects.html +215 -0
  61. data/app/assets/javascripts/polymer/src/standard/events.html +127 -0
  62. data/app/assets/javascripts/polymer/src/standard/notify-path.html +260 -0
  63. data/app/assets/javascripts/polymer/src/standard/resolveUrl.html +27 -0
  64. data/app/assets/javascripts/polymer/src/standard/styling.html +157 -0
  65. data/app/assets/javascripts/polymer/src/standard/utils.html +158 -0
  66. data/app/assets/javascripts/polymer/src/standard/x-styling.html +300 -0
  67. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +2270 -0
  68. data/lib/generators/polymer/component/templates/component.html.erb +3 -3
  69. data/lib/generators/polymer/install/install_generator.rb +1 -1
  70. data/lib/polymer-rails/version.rb +1 -1
  71. metadata +80 -5
  72. data/app/assets/javascripts/polymer/layout.html +0 -286
  73. data/app/assets/javascripts/polymer/polymer.js +0 -14
  74. data/app/assets/javascripts/polymer/webcomponents.js +0 -14
@@ -0,0 +1,2270 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
10
+ // @version 0.6.1
11
+ window.WebComponents = window.WebComponents || {};
12
+
13
+ (function(scope) {
14
+ var flags = scope.flags || {};
15
+ var file = "webcomponents.js";
16
+ var script = document.querySelector('script[src*="' + file + '"]');
17
+ if (!flags.noOpts) {
18
+ location.search.slice(1).split("&").forEach(function(o) {
19
+ o = o.split("=");
20
+ o[0] && (flags[o[0]] = o[1] || true);
21
+ });
22
+ if (script) {
23
+ for (var i = 0, a; a = script.attributes[i]; i++) {
24
+ if (a.name !== "src") {
25
+ flags[a.name] = a.value || true;
26
+ }
27
+ }
28
+ }
29
+ if (flags.log && flags.log.split) {
30
+ var parts = flags.log.split(",");
31
+ flags.log = {};
32
+ parts.forEach(function(f) {
33
+ flags.log[f] = true;
34
+ });
35
+ } else {
36
+ flags.log = {};
37
+ }
38
+ }
39
+ flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill;
40
+ if (flags.shadow === "native") {
41
+ flags.shadow = false;
42
+ } else {
43
+ flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
44
+ }
45
+ if (flags.register) {
46
+ window.CustomElements = window.CustomElements || {
47
+ flags: {}
48
+ };
49
+ window.CustomElements.flags.register = flags.register;
50
+ }
51
+ scope.flags = flags;
52
+ })(WebComponents);
53
+
54
+ (function(scope) {
55
+ "use strict";
56
+ var hasWorkingUrl = false;
57
+ if (!scope.forceJURL) {
58
+ try {
59
+ var u = new URL("b", "http://a");
60
+ u.pathname = "c%20d";
61
+ hasWorkingUrl = u.href === "http://a/c%20d";
62
+ } catch (e) {}
63
+ }
64
+ if (hasWorkingUrl) return;
65
+ var relative = Object.create(null);
66
+ relative["ftp"] = 21;
67
+ relative["file"] = 0;
68
+ relative["gopher"] = 70;
69
+ relative["http"] = 80;
70
+ relative["https"] = 443;
71
+ relative["ws"] = 80;
72
+ relative["wss"] = 443;
73
+ var relativePathDotMapping = Object.create(null);
74
+ relativePathDotMapping["%2e"] = ".";
75
+ relativePathDotMapping[".%2e"] = "..";
76
+ relativePathDotMapping["%2e."] = "..";
77
+ relativePathDotMapping["%2e%2e"] = "..";
78
+ function isRelativeScheme(scheme) {
79
+ return relative[scheme] !== undefined;
80
+ }
81
+ function invalid() {
82
+ clear.call(this);
83
+ this._isInvalid = true;
84
+ }
85
+ function IDNAToASCII(h) {
86
+ if ("" == h) {
87
+ invalid.call(this);
88
+ }
89
+ return h.toLowerCase();
90
+ }
91
+ function percentEscape(c) {
92
+ var unicode = c.charCodeAt(0);
93
+ if (unicode > 32 && unicode < 127 && [ 34, 35, 60, 62, 63, 96 ].indexOf(unicode) == -1) {
94
+ return c;
95
+ }
96
+ return encodeURIComponent(c);
97
+ }
98
+ function percentEscapeQuery(c) {
99
+ var unicode = c.charCodeAt(0);
100
+ if (unicode > 32 && unicode < 127 && [ 34, 35, 60, 62, 96 ].indexOf(unicode) == -1) {
101
+ return c;
102
+ }
103
+ return encodeURIComponent(c);
104
+ }
105
+ var EOF = undefined, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
106
+ function parse(input, stateOverride, base) {
107
+ function err(message) {
108
+ errors.push(message);
109
+ }
110
+ var state = stateOverride || "scheme start", cursor = 0, buffer = "", seenAt = false, seenBracket = false, errors = [];
111
+ loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {
112
+ var c = input[cursor];
113
+ switch (state) {
114
+ case "scheme start":
115
+ if (c && ALPHA.test(c)) {
116
+ buffer += c.toLowerCase();
117
+ state = "scheme";
118
+ } else if (!stateOverride) {
119
+ buffer = "";
120
+ state = "no scheme";
121
+ continue;
122
+ } else {
123
+ err("Invalid scheme.");
124
+ break loop;
125
+ }
126
+ break;
127
+
128
+ case "scheme":
129
+ if (c && ALPHANUMERIC.test(c)) {
130
+ buffer += c.toLowerCase();
131
+ } else if (":" == c) {
132
+ this._scheme = buffer;
133
+ buffer = "";
134
+ if (stateOverride) {
135
+ break loop;
136
+ }
137
+ if (isRelativeScheme(this._scheme)) {
138
+ this._isRelative = true;
139
+ }
140
+ if ("file" == this._scheme) {
141
+ state = "relative";
142
+ } else if (this._isRelative && base && base._scheme == this._scheme) {
143
+ state = "relative or authority";
144
+ } else if (this._isRelative) {
145
+ state = "authority first slash";
146
+ } else {
147
+ state = "scheme data";
148
+ }
149
+ } else if (!stateOverride) {
150
+ buffer = "";
151
+ cursor = 0;
152
+ state = "no scheme";
153
+ continue;
154
+ } else if (EOF == c) {
155
+ break loop;
156
+ } else {
157
+ err("Code point not allowed in scheme: " + c);
158
+ break loop;
159
+ }
160
+ break;
161
+
162
+ case "scheme data":
163
+ if ("?" == c) {
164
+ query = "?";
165
+ state = "query";
166
+ } else if ("#" == c) {
167
+ this._fragment = "#";
168
+ state = "fragment";
169
+ } else {
170
+ if (EOF != c && " " != c && "\n" != c && "\r" != c) {
171
+ this._schemeData += percentEscape(c);
172
+ }
173
+ }
174
+ break;
175
+
176
+ case "no scheme":
177
+ if (!base || !isRelativeScheme(base._scheme)) {
178
+ err("Missing scheme.");
179
+ invalid.call(this);
180
+ } else {
181
+ state = "relative";
182
+ continue;
183
+ }
184
+ break;
185
+
186
+ case "relative or authority":
187
+ if ("/" == c && "/" == input[cursor + 1]) {
188
+ state = "authority ignore slashes";
189
+ } else {
190
+ err("Expected /, got: " + c);
191
+ state = "relative";
192
+ continue;
193
+ }
194
+ break;
195
+
196
+ case "relative":
197
+ this._isRelative = true;
198
+ if ("file" != this._scheme) this._scheme = base._scheme;
199
+ if (EOF == c) {
200
+ this._host = base._host;
201
+ this._port = base._port;
202
+ this._path = base._path.slice();
203
+ this._query = base._query;
204
+ break loop;
205
+ } else if ("/" == c || "\\" == c) {
206
+ if ("\\" == c) err("\\ is an invalid code point.");
207
+ state = "relative slash";
208
+ } else if ("?" == c) {
209
+ this._host = base._host;
210
+ this._port = base._port;
211
+ this._path = base._path.slice();
212
+ this._query = "?";
213
+ state = "query";
214
+ } else if ("#" == c) {
215
+ this._host = base._host;
216
+ this._port = base._port;
217
+ this._path = base._path.slice();
218
+ this._query = base._query;
219
+ this._fragment = "#";
220
+ state = "fragment";
221
+ } else {
222
+ var nextC = input[cursor + 1];
223
+ var nextNextC = input[cursor + 2];
224
+ if ("file" != this._scheme || !ALPHA.test(c) || nextC != ":" && nextC != "|" || EOF != nextNextC && "/" != nextNextC && "\\" != nextNextC && "?" != nextNextC && "#" != nextNextC) {
225
+ this._host = base._host;
226
+ this._port = base._port;
227
+ this._path = base._path.slice();
228
+ this._path.pop();
229
+ }
230
+ state = "relative path";
231
+ continue;
232
+ }
233
+ break;
234
+
235
+ case "relative slash":
236
+ if ("/" == c || "\\" == c) {
237
+ if ("\\" == c) {
238
+ err("\\ is an invalid code point.");
239
+ }
240
+ if ("file" == this._scheme) {
241
+ state = "file host";
242
+ } else {
243
+ state = "authority ignore slashes";
244
+ }
245
+ } else {
246
+ if ("file" != this._scheme) {
247
+ this._host = base._host;
248
+ this._port = base._port;
249
+ }
250
+ state = "relative path";
251
+ continue;
252
+ }
253
+ break;
254
+
255
+ case "authority first slash":
256
+ if ("/" == c) {
257
+ state = "authority second slash";
258
+ } else {
259
+ err("Expected '/', got: " + c);
260
+ state = "authority ignore slashes";
261
+ continue;
262
+ }
263
+ break;
264
+
265
+ case "authority second slash":
266
+ state = "authority ignore slashes";
267
+ if ("/" != c) {
268
+ err("Expected '/', got: " + c);
269
+ continue;
270
+ }
271
+ break;
272
+
273
+ case "authority ignore slashes":
274
+ if ("/" != c && "\\" != c) {
275
+ state = "authority";
276
+ continue;
277
+ } else {
278
+ err("Expected authority, got: " + c);
279
+ }
280
+ break;
281
+
282
+ case "authority":
283
+ if ("@" == c) {
284
+ if (seenAt) {
285
+ err("@ already seen.");
286
+ buffer += "%40";
287
+ }
288
+ seenAt = true;
289
+ for (var i = 0; i < buffer.length; i++) {
290
+ var cp = buffer[i];
291
+ if (" " == cp || "\n" == cp || "\r" == cp) {
292
+ err("Invalid whitespace in authority.");
293
+ continue;
294
+ }
295
+ if (":" == cp && null === this._password) {
296
+ this._password = "";
297
+ continue;
298
+ }
299
+ var tempC = percentEscape(cp);
300
+ null !== this._password ? this._password += tempC : this._username += tempC;
301
+ }
302
+ buffer = "";
303
+ } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
304
+ cursor -= buffer.length;
305
+ buffer = "";
306
+ state = "host";
307
+ continue;
308
+ } else {
309
+ buffer += c;
310
+ }
311
+ break;
312
+
313
+ case "file host":
314
+ if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
315
+ if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" || buffer[1] == "|")) {
316
+ state = "relative path";
317
+ } else if (buffer.length == 0) {
318
+ state = "relative path start";
319
+ } else {
320
+ this._host = IDNAToASCII.call(this, buffer);
321
+ buffer = "";
322
+ state = "relative path start";
323
+ }
324
+ continue;
325
+ } else if (" " == c || "\n" == c || "\r" == c) {
326
+ err("Invalid whitespace in file host.");
327
+ } else {
328
+ buffer += c;
329
+ }
330
+ break;
331
+
332
+ case "host":
333
+ case "hostname":
334
+ if (":" == c && !seenBracket) {
335
+ this._host = IDNAToASCII.call(this, buffer);
336
+ buffer = "";
337
+ state = "port";
338
+ if ("hostname" == stateOverride) {
339
+ break loop;
340
+ }
341
+ } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
342
+ this._host = IDNAToASCII.call(this, buffer);
343
+ buffer = "";
344
+ state = "relative path start";
345
+ if (stateOverride) {
346
+ break loop;
347
+ }
348
+ continue;
349
+ } else if (" " != c && "\n" != c && "\r" != c) {
350
+ if ("[" == c) {
351
+ seenBracket = true;
352
+ } else if ("]" == c) {
353
+ seenBracket = false;
354
+ }
355
+ buffer += c;
356
+ } else {
357
+ err("Invalid code point in host/hostname: " + c);
358
+ }
359
+ break;
360
+
361
+ case "port":
362
+ if (/[0-9]/.test(c)) {
363
+ buffer += c;
364
+ } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c || stateOverride) {
365
+ if ("" != buffer) {
366
+ var temp = parseInt(buffer, 10);
367
+ if (temp != relative[this._scheme]) {
368
+ this._port = temp + "";
369
+ }
370
+ buffer = "";
371
+ }
372
+ if (stateOverride) {
373
+ break loop;
374
+ }
375
+ state = "relative path start";
376
+ continue;
377
+ } else if (" " == c || "\n" == c || "\r" == c) {
378
+ err("Invalid code point in port: " + c);
379
+ } else {
380
+ invalid.call(this);
381
+ }
382
+ break;
383
+
384
+ case "relative path start":
385
+ if ("\\" == c) err("'\\' not allowed in path.");
386
+ state = "relative path";
387
+ if ("/" != c && "\\" != c) {
388
+ continue;
389
+ }
390
+ break;
391
+
392
+ case "relative path":
393
+ if (EOF == c || "/" == c || "\\" == c || !stateOverride && ("?" == c || "#" == c)) {
394
+ if ("\\" == c) {
395
+ err("\\ not allowed in relative path.");
396
+ }
397
+ var tmp;
398
+ if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
399
+ buffer = tmp;
400
+ }
401
+ if (".." == buffer) {
402
+ this._path.pop();
403
+ if ("/" != c && "\\" != c) {
404
+ this._path.push("");
405
+ }
406
+ } else if ("." == buffer && "/" != c && "\\" != c) {
407
+ this._path.push("");
408
+ } else if ("." != buffer) {
409
+ if ("file" == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == "|") {
410
+ buffer = buffer[0] + ":";
411
+ }
412
+ this._path.push(buffer);
413
+ }
414
+ buffer = "";
415
+ if ("?" == c) {
416
+ this._query = "?";
417
+ state = "query";
418
+ } else if ("#" == c) {
419
+ this._fragment = "#";
420
+ state = "fragment";
421
+ }
422
+ } else if (" " != c && "\n" != c && "\r" != c) {
423
+ buffer += percentEscape(c);
424
+ }
425
+ break;
426
+
427
+ case "query":
428
+ if (!stateOverride && "#" == c) {
429
+ this._fragment = "#";
430
+ state = "fragment";
431
+ } else if (EOF != c && " " != c && "\n" != c && "\r" != c) {
432
+ this._query += percentEscapeQuery(c);
433
+ }
434
+ break;
435
+
436
+ case "fragment":
437
+ if (EOF != c && " " != c && "\n" != c && "\r" != c) {
438
+ this._fragment += c;
439
+ }
440
+ break;
441
+ }
442
+ cursor++;
443
+ }
444
+ }
445
+ function clear() {
446
+ this._scheme = "";
447
+ this._schemeData = "";
448
+ this._username = "";
449
+ this._password = null;
450
+ this._host = "";
451
+ this._port = "";
452
+ this._path = [];
453
+ this._query = "";
454
+ this._fragment = "";
455
+ this._isInvalid = false;
456
+ this._isRelative = false;
457
+ }
458
+ function jURL(url, base) {
459
+ if (base !== undefined && !(base instanceof jURL)) base = new jURL(String(base));
460
+ this._url = url;
461
+ clear.call(this);
462
+ var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, "");
463
+ parse.call(this, input, null, base);
464
+ }
465
+ jURL.prototype = {
466
+ toString: function() {
467
+ return this.href;
468
+ },
469
+ get href() {
470
+ if (this._isInvalid) return this._url;
471
+ var authority = "";
472
+ if ("" != this._username || null != this._password) {
473
+ authority = this._username + (null != this._password ? ":" + this._password : "") + "@";
474
+ }
475
+ return this.protocol + (this._isRelative ? "//" + authority + this.host : "") + this.pathname + this._query + this._fragment;
476
+ },
477
+ set href(href) {
478
+ clear.call(this);
479
+ parse.call(this, href);
480
+ },
481
+ get protocol() {
482
+ return this._scheme + ":";
483
+ },
484
+ set protocol(protocol) {
485
+ if (this._isInvalid) return;
486
+ parse.call(this, protocol + ":", "scheme start");
487
+ },
488
+ get host() {
489
+ return this._isInvalid ? "" : this._port ? this._host + ":" + this._port : this._host;
490
+ },
491
+ set host(host) {
492
+ if (this._isInvalid || !this._isRelative) return;
493
+ parse.call(this, host, "host");
494
+ },
495
+ get hostname() {
496
+ return this._host;
497
+ },
498
+ set hostname(hostname) {
499
+ if (this._isInvalid || !this._isRelative) return;
500
+ parse.call(this, hostname, "hostname");
501
+ },
502
+ get port() {
503
+ return this._port;
504
+ },
505
+ set port(port) {
506
+ if (this._isInvalid || !this._isRelative) return;
507
+ parse.call(this, port, "port");
508
+ },
509
+ get pathname() {
510
+ return this._isInvalid ? "" : this._isRelative ? "/" + this._path.join("/") : this._schemeData;
511
+ },
512
+ set pathname(pathname) {
513
+ if (this._isInvalid || !this._isRelative) return;
514
+ this._path = [];
515
+ parse.call(this, pathname, "relative path start");
516
+ },
517
+ get search() {
518
+ return this._isInvalid || !this._query || "?" == this._query ? "" : this._query;
519
+ },
520
+ set search(search) {
521
+ if (this._isInvalid || !this._isRelative) return;
522
+ this._query = "?";
523
+ if ("?" == search[0]) search = search.slice(1);
524
+ parse.call(this, search, "query");
525
+ },
526
+ get hash() {
527
+ return this._isInvalid || !this._fragment || "#" == this._fragment ? "" : this._fragment;
528
+ },
529
+ set hash(hash) {
530
+ if (this._isInvalid) return;
531
+ this._fragment = "#";
532
+ if ("#" == hash[0]) hash = hash.slice(1);
533
+ parse.call(this, hash, "fragment");
534
+ },
535
+ get origin() {
536
+ var host;
537
+ if (this._isInvalid || !this._scheme) {
538
+ return "";
539
+ }
540
+ switch (this._scheme) {
541
+ case "data":
542
+ case "file":
543
+ case "javascript":
544
+ case "mailto":
545
+ return "null";
546
+ }
547
+ host = this.host;
548
+ if (!host) {
549
+ return "";
550
+ }
551
+ return this._scheme + "://" + host;
552
+ }
553
+ };
554
+ var OriginalURL = scope.URL;
555
+ if (OriginalURL) {
556
+ jURL.createObjectURL = function(blob) {
557
+ return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
558
+ };
559
+ jURL.revokeObjectURL = function(url) {
560
+ OriginalURL.revokeObjectURL(url);
561
+ };
562
+ }
563
+ scope.URL = jURL;
564
+ })(this);
565
+
566
+ if (typeof WeakMap === "undefined") {
567
+ (function() {
568
+ var defineProperty = Object.defineProperty;
569
+ var counter = Date.now() % 1e9;
570
+ var WeakMap = function() {
571
+ this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
572
+ };
573
+ WeakMap.prototype = {
574
+ set: function(key, value) {
575
+ var entry = key[this.name];
576
+ if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
577
+ value: [ key, value ],
578
+ writable: true
579
+ });
580
+ return this;
581
+ },
582
+ get: function(key) {
583
+ var entry;
584
+ return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
585
+ },
586
+ "delete": function(key) {
587
+ var entry = key[this.name];
588
+ if (!entry || entry[0] !== key) return false;
589
+ entry[0] = entry[1] = undefined;
590
+ return true;
591
+ },
592
+ has: function(key) {
593
+ var entry = key[this.name];
594
+ if (!entry) return false;
595
+ return entry[0] === key;
596
+ }
597
+ };
598
+ window.WeakMap = WeakMap;
599
+ })();
600
+ }
601
+
602
+ (function(global) {
603
+ var registrationsTable = new WeakMap();
604
+ var setImmediate;
605
+ if (/Trident|Edge/.test(navigator.userAgent)) {
606
+ setImmediate = setTimeout;
607
+ } else if (window.setImmediate) {
608
+ setImmediate = window.setImmediate;
609
+ } else {
610
+ var setImmediateQueue = [];
611
+ var sentinel = String(Math.random());
612
+ window.addEventListener("message", function(e) {
613
+ if (e.data === sentinel) {
614
+ var queue = setImmediateQueue;
615
+ setImmediateQueue = [];
616
+ queue.forEach(function(func) {
617
+ func();
618
+ });
619
+ }
620
+ });
621
+ setImmediate = function(func) {
622
+ setImmediateQueue.push(func);
623
+ window.postMessage(sentinel, "*");
624
+ };
625
+ }
626
+ var isScheduled = false;
627
+ var scheduledObservers = [];
628
+ function scheduleCallback(observer) {
629
+ scheduledObservers.push(observer);
630
+ if (!isScheduled) {
631
+ isScheduled = true;
632
+ setImmediate(dispatchCallbacks);
633
+ }
634
+ }
635
+ function wrapIfNeeded(node) {
636
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
637
+ }
638
+ function dispatchCallbacks() {
639
+ isScheduled = false;
640
+ var observers = scheduledObservers;
641
+ scheduledObservers = [];
642
+ observers.sort(function(o1, o2) {
643
+ return o1.uid_ - o2.uid_;
644
+ });
645
+ var anyNonEmpty = false;
646
+ observers.forEach(function(observer) {
647
+ var queue = observer.takeRecords();
648
+ removeTransientObserversFor(observer);
649
+ if (queue.length) {
650
+ observer.callback_(queue, observer);
651
+ anyNonEmpty = true;
652
+ }
653
+ });
654
+ if (anyNonEmpty) dispatchCallbacks();
655
+ }
656
+ function removeTransientObserversFor(observer) {
657
+ observer.nodes_.forEach(function(node) {
658
+ var registrations = registrationsTable.get(node);
659
+ if (!registrations) return;
660
+ registrations.forEach(function(registration) {
661
+ if (registration.observer === observer) registration.removeTransientObservers();
662
+ });
663
+ });
664
+ }
665
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
666
+ for (var node = target; node; node = node.parentNode) {
667
+ var registrations = registrationsTable.get(node);
668
+ if (registrations) {
669
+ for (var j = 0; j < registrations.length; j++) {
670
+ var registration = registrations[j];
671
+ var options = registration.options;
672
+ if (node !== target && !options.subtree) continue;
673
+ var record = callback(options);
674
+ if (record) registration.enqueue(record);
675
+ }
676
+ }
677
+ }
678
+ }
679
+ var uidCounter = 0;
680
+ function JsMutationObserver(callback) {
681
+ this.callback_ = callback;
682
+ this.nodes_ = [];
683
+ this.records_ = [];
684
+ this.uid_ = ++uidCounter;
685
+ }
686
+ JsMutationObserver.prototype = {
687
+ observe: function(target, options) {
688
+ target = wrapIfNeeded(target);
689
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
690
+ throw new SyntaxError();
691
+ }
692
+ var registrations = registrationsTable.get(target);
693
+ if (!registrations) registrationsTable.set(target, registrations = []);
694
+ var registration;
695
+ for (var i = 0; i < registrations.length; i++) {
696
+ if (registrations[i].observer === this) {
697
+ registration = registrations[i];
698
+ registration.removeListeners();
699
+ registration.options = options;
700
+ break;
701
+ }
702
+ }
703
+ if (!registration) {
704
+ registration = new Registration(this, target, options);
705
+ registrations.push(registration);
706
+ this.nodes_.push(target);
707
+ }
708
+ registration.addListeners();
709
+ },
710
+ disconnect: function() {
711
+ this.nodes_.forEach(function(node) {
712
+ var registrations = registrationsTable.get(node);
713
+ for (var i = 0; i < registrations.length; i++) {
714
+ var registration = registrations[i];
715
+ if (registration.observer === this) {
716
+ registration.removeListeners();
717
+ registrations.splice(i, 1);
718
+ break;
719
+ }
720
+ }
721
+ }, this);
722
+ this.records_ = [];
723
+ },
724
+ takeRecords: function() {
725
+ var copyOfRecords = this.records_;
726
+ this.records_ = [];
727
+ return copyOfRecords;
728
+ }
729
+ };
730
+ function MutationRecord(type, target) {
731
+ this.type = type;
732
+ this.target = target;
733
+ this.addedNodes = [];
734
+ this.removedNodes = [];
735
+ this.previousSibling = null;
736
+ this.nextSibling = null;
737
+ this.attributeName = null;
738
+ this.attributeNamespace = null;
739
+ this.oldValue = null;
740
+ }
741
+ function copyMutationRecord(original) {
742
+ var record = new MutationRecord(original.type, original.target);
743
+ record.addedNodes = original.addedNodes.slice();
744
+ record.removedNodes = original.removedNodes.slice();
745
+ record.previousSibling = original.previousSibling;
746
+ record.nextSibling = original.nextSibling;
747
+ record.attributeName = original.attributeName;
748
+ record.attributeNamespace = original.attributeNamespace;
749
+ record.oldValue = original.oldValue;
750
+ return record;
751
+ }
752
+ var currentRecord, recordWithOldValue;
753
+ function getRecord(type, target) {
754
+ return currentRecord = new MutationRecord(type, target);
755
+ }
756
+ function getRecordWithOldValue(oldValue) {
757
+ if (recordWithOldValue) return recordWithOldValue;
758
+ recordWithOldValue = copyMutationRecord(currentRecord);
759
+ recordWithOldValue.oldValue = oldValue;
760
+ return recordWithOldValue;
761
+ }
762
+ function clearRecords() {
763
+ currentRecord = recordWithOldValue = undefined;
764
+ }
765
+ function recordRepresentsCurrentMutation(record) {
766
+ return record === recordWithOldValue || record === currentRecord;
767
+ }
768
+ function selectRecord(lastRecord, newRecord) {
769
+ if (lastRecord === newRecord) return lastRecord;
770
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
771
+ return null;
772
+ }
773
+ function Registration(observer, target, options) {
774
+ this.observer = observer;
775
+ this.target = target;
776
+ this.options = options;
777
+ this.transientObservedNodes = [];
778
+ }
779
+ Registration.prototype = {
780
+ enqueue: function(record) {
781
+ var records = this.observer.records_;
782
+ var length = records.length;
783
+ if (records.length > 0) {
784
+ var lastRecord = records[length - 1];
785
+ var recordToReplaceLast = selectRecord(lastRecord, record);
786
+ if (recordToReplaceLast) {
787
+ records[length - 1] = recordToReplaceLast;
788
+ return;
789
+ }
790
+ } else {
791
+ scheduleCallback(this.observer);
792
+ }
793
+ records[length] = record;
794
+ },
795
+ addListeners: function() {
796
+ this.addListeners_(this.target);
797
+ },
798
+ addListeners_: function(node) {
799
+ var options = this.options;
800
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
801
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
802
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
803
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
804
+ },
805
+ removeListeners: function() {
806
+ this.removeListeners_(this.target);
807
+ },
808
+ removeListeners_: function(node) {
809
+ var options = this.options;
810
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
811
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
812
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
813
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
814
+ },
815
+ addTransientObserver: function(node) {
816
+ if (node === this.target) return;
817
+ this.addListeners_(node);
818
+ this.transientObservedNodes.push(node);
819
+ var registrations = registrationsTable.get(node);
820
+ if (!registrations) registrationsTable.set(node, registrations = []);
821
+ registrations.push(this);
822
+ },
823
+ removeTransientObservers: function() {
824
+ var transientObservedNodes = this.transientObservedNodes;
825
+ this.transientObservedNodes = [];
826
+ transientObservedNodes.forEach(function(node) {
827
+ this.removeListeners_(node);
828
+ var registrations = registrationsTable.get(node);
829
+ for (var i = 0; i < registrations.length; i++) {
830
+ if (registrations[i] === this) {
831
+ registrations.splice(i, 1);
832
+ break;
833
+ }
834
+ }
835
+ }, this);
836
+ },
837
+ handleEvent: function(e) {
838
+ e.stopImmediatePropagation();
839
+ switch (e.type) {
840
+ case "DOMAttrModified":
841
+ var name = e.attrName;
842
+ var namespace = e.relatedNode.namespaceURI;
843
+ var target = e.target;
844
+ var record = new getRecord("attributes", target);
845
+ record.attributeName = name;
846
+ record.attributeNamespace = namespace;
847
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
848
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
849
+ if (!options.attributes) return;
850
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
851
+ return;
852
+ }
853
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
854
+ return record;
855
+ });
856
+ break;
857
+
858
+ case "DOMCharacterDataModified":
859
+ var target = e.target;
860
+ var record = getRecord("characterData", target);
861
+ var oldValue = e.prevValue;
862
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
863
+ if (!options.characterData) return;
864
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
865
+ return record;
866
+ });
867
+ break;
868
+
869
+ case "DOMNodeRemoved":
870
+ this.addTransientObserver(e.target);
871
+
872
+ case "DOMNodeInserted":
873
+ var changedNode = e.target;
874
+ var addedNodes, removedNodes;
875
+ if (e.type === "DOMNodeInserted") {
876
+ addedNodes = [ changedNode ];
877
+ removedNodes = [];
878
+ } else {
879
+ addedNodes = [];
880
+ removedNodes = [ changedNode ];
881
+ }
882
+ var previousSibling = changedNode.previousSibling;
883
+ var nextSibling = changedNode.nextSibling;
884
+ var record = getRecord("childList", e.target.parentNode);
885
+ record.addedNodes = addedNodes;
886
+ record.removedNodes = removedNodes;
887
+ record.previousSibling = previousSibling;
888
+ record.nextSibling = nextSibling;
889
+ forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
890
+ if (!options.childList) return;
891
+ return record;
892
+ });
893
+ }
894
+ clearRecords();
895
+ }
896
+ };
897
+ global.JsMutationObserver = JsMutationObserver;
898
+ if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
899
+ })(this);
900
+
901
+ window.HTMLImports = window.HTMLImports || {
902
+ flags: {}
903
+ };
904
+
905
+ (function(scope) {
906
+ var IMPORT_LINK_TYPE = "import";
907
+ var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
908
+ var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
909
+ var wrap = function(node) {
910
+ return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
911
+ };
912
+ var rootDocument = wrap(document);
913
+ var currentScriptDescriptor = {
914
+ get: function() {
915
+ var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
916
+ return wrap(script);
917
+ },
918
+ configurable: true
919
+ };
920
+ Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
921
+ Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
922
+ var isIE = /Trident|Edge/.test(navigator.userAgent);
923
+ function whenReady(callback, doc) {
924
+ doc = doc || rootDocument;
925
+ whenDocumentReady(function() {
926
+ watchImportsLoad(callback, doc);
927
+ }, doc);
928
+ }
929
+ var requiredReadyState = isIE ? "complete" : "interactive";
930
+ var READY_EVENT = "readystatechange";
931
+ function isDocumentReady(doc) {
932
+ return doc.readyState === "complete" || doc.readyState === requiredReadyState;
933
+ }
934
+ function whenDocumentReady(callback, doc) {
935
+ if (!isDocumentReady(doc)) {
936
+ var checkReady = function() {
937
+ if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
938
+ doc.removeEventListener(READY_EVENT, checkReady);
939
+ whenDocumentReady(callback, doc);
940
+ }
941
+ };
942
+ doc.addEventListener(READY_EVENT, checkReady);
943
+ } else if (callback) {
944
+ callback();
945
+ }
946
+ }
947
+ function markTargetLoaded(event) {
948
+ event.target.__loaded = true;
949
+ }
950
+ function watchImportsLoad(callback, doc) {
951
+ var imports = doc.querySelectorAll("link[rel=import]");
952
+ var parsedCount = 0, importCount = imports.length, newImports = [], errorImports = [];
953
+ function checkDone() {
954
+ if (parsedCount == importCount && callback) {
955
+ callback({
956
+ allImports: imports,
957
+ loadedImports: newImports,
958
+ errorImports: errorImports
959
+ });
960
+ }
961
+ }
962
+ function loadedImport(e) {
963
+ markTargetLoaded(e);
964
+ newImports.push(this);
965
+ parsedCount++;
966
+ checkDone();
967
+ }
968
+ function errorLoadingImport(e) {
969
+ errorImports.push(this);
970
+ parsedCount++;
971
+ checkDone();
972
+ }
973
+ if (importCount) {
974
+ for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
975
+ if (isImportLoaded(imp)) {
976
+ parsedCount++;
977
+ checkDone();
978
+ } else {
979
+ imp.addEventListener("load", loadedImport);
980
+ imp.addEventListener("error", errorLoadingImport);
981
+ }
982
+ }
983
+ } else {
984
+ checkDone();
985
+ }
986
+ }
987
+ function isImportLoaded(link) {
988
+ return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
989
+ }
990
+ if (useNative) {
991
+ new MutationObserver(function(mxns) {
992
+ for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
993
+ if (m.addedNodes) {
994
+ handleImports(m.addedNodes);
995
+ }
996
+ }
997
+ }).observe(document.head, {
998
+ childList: true
999
+ });
1000
+ function handleImports(nodes) {
1001
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1002
+ if (isImport(n)) {
1003
+ handleImport(n);
1004
+ }
1005
+ }
1006
+ }
1007
+ function isImport(element) {
1008
+ return element.localName === "link" && element.rel === "import";
1009
+ }
1010
+ function handleImport(element) {
1011
+ var loaded = element.import;
1012
+ if (loaded) {
1013
+ markTargetLoaded({
1014
+ target: element
1015
+ });
1016
+ } else {
1017
+ element.addEventListener("load", markTargetLoaded);
1018
+ element.addEventListener("error", markTargetLoaded);
1019
+ }
1020
+ }
1021
+ (function() {
1022
+ if (document.readyState === "loading") {
1023
+ var imports = document.querySelectorAll("link[rel=import]");
1024
+ for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
1025
+ handleImport(imp);
1026
+ }
1027
+ }
1028
+ })();
1029
+ }
1030
+ whenReady(function(detail) {
1031
+ HTMLImports.ready = true;
1032
+ HTMLImports.readyTime = new Date().getTime();
1033
+ var evt = rootDocument.createEvent("CustomEvent");
1034
+ evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
1035
+ rootDocument.dispatchEvent(evt);
1036
+ });
1037
+ scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
1038
+ scope.useNative = useNative;
1039
+ scope.rootDocument = rootDocument;
1040
+ scope.whenReady = whenReady;
1041
+ scope.isIE = isIE;
1042
+ })(HTMLImports);
1043
+
1044
+ (function(scope) {
1045
+ var modules = [];
1046
+ var addModule = function(module) {
1047
+ modules.push(module);
1048
+ };
1049
+ var initializeModules = function() {
1050
+ modules.forEach(function(module) {
1051
+ module(scope);
1052
+ });
1053
+ };
1054
+ scope.addModule = addModule;
1055
+ scope.initializeModules = initializeModules;
1056
+ })(HTMLImports);
1057
+
1058
+ HTMLImports.addModule(function(scope) {
1059
+ var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
1060
+ var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
1061
+ var path = {
1062
+ resolveUrlsInStyle: function(style, linkUrl) {
1063
+ var doc = style.ownerDocument;
1064
+ var resolver = doc.createElement("a");
1065
+ style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver);
1066
+ return style;
1067
+ },
1068
+ resolveUrlsInCssText: function(cssText, linkUrl, urlObj) {
1069
+ var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP);
1070
+ r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP);
1071
+ return r;
1072
+ },
1073
+ replaceUrls: function(text, urlObj, linkUrl, regexp) {
1074
+ return text.replace(regexp, function(m, pre, url, post) {
1075
+ var urlPath = url.replace(/["']/g, "");
1076
+ if (linkUrl) {
1077
+ urlPath = new URL(urlPath, linkUrl).href;
1078
+ }
1079
+ urlObj.href = urlPath;
1080
+ urlPath = urlObj.href;
1081
+ return pre + "'" + urlPath + "'" + post;
1082
+ });
1083
+ }
1084
+ };
1085
+ scope.path = path;
1086
+ });
1087
+
1088
+ HTMLImports.addModule(function(scope) {
1089
+ var xhr = {
1090
+ async: true,
1091
+ ok: function(request) {
1092
+ return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
1093
+ },
1094
+ load: function(url, next, nextContext) {
1095
+ var request = new XMLHttpRequest();
1096
+ if (scope.flags.debug || scope.flags.bust) {
1097
+ url += "?" + Math.random();
1098
+ }
1099
+ request.open("GET", url, xhr.async);
1100
+ request.addEventListener("readystatechange", function(e) {
1101
+ if (request.readyState === 4) {
1102
+ var locationHeader = request.getResponseHeader("Location");
1103
+ var redirectedUrl = null;
1104
+ if (locationHeader) {
1105
+ var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
1106
+ }
1107
+ next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
1108
+ }
1109
+ });
1110
+ request.send();
1111
+ return request;
1112
+ },
1113
+ loadDocument: function(url, next, nextContext) {
1114
+ this.load(url, next, nextContext).responseType = "document";
1115
+ }
1116
+ };
1117
+ scope.xhr = xhr;
1118
+ });
1119
+
1120
+ HTMLImports.addModule(function(scope) {
1121
+ var xhr = scope.xhr;
1122
+ var flags = scope.flags;
1123
+ var Loader = function(onLoad, onComplete) {
1124
+ this.cache = {};
1125
+ this.onload = onLoad;
1126
+ this.oncomplete = onComplete;
1127
+ this.inflight = 0;
1128
+ this.pending = {};
1129
+ };
1130
+ Loader.prototype = {
1131
+ addNodes: function(nodes) {
1132
+ this.inflight += nodes.length;
1133
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1134
+ this.require(n);
1135
+ }
1136
+ this.checkDone();
1137
+ },
1138
+ addNode: function(node) {
1139
+ this.inflight++;
1140
+ this.require(node);
1141
+ this.checkDone();
1142
+ },
1143
+ require: function(elt) {
1144
+ var url = elt.src || elt.href;
1145
+ elt.__nodeUrl = url;
1146
+ if (!this.dedupe(url, elt)) {
1147
+ this.fetch(url, elt);
1148
+ }
1149
+ },
1150
+ dedupe: function(url, elt) {
1151
+ if (this.pending[url]) {
1152
+ this.pending[url].push(elt);
1153
+ return true;
1154
+ }
1155
+ var resource;
1156
+ if (this.cache[url]) {
1157
+ this.onload(url, elt, this.cache[url]);
1158
+ this.tail();
1159
+ return true;
1160
+ }
1161
+ this.pending[url] = [ elt ];
1162
+ return false;
1163
+ },
1164
+ fetch: function(url, elt) {
1165
+ flags.load && console.log("fetch", url, elt);
1166
+ if (!url) {
1167
+ setTimeout(function() {
1168
+ this.receive(url, elt, {
1169
+ error: "href must be specified"
1170
+ }, null);
1171
+ }.bind(this), 0);
1172
+ } else if (url.match(/^data:/)) {
1173
+ var pieces = url.split(",");
1174
+ var header = pieces[0];
1175
+ var body = pieces[1];
1176
+ if (header.indexOf(";base64") > -1) {
1177
+ body = atob(body);
1178
+ } else {
1179
+ body = decodeURIComponent(body);
1180
+ }
1181
+ setTimeout(function() {
1182
+ this.receive(url, elt, null, body);
1183
+ }.bind(this), 0);
1184
+ } else {
1185
+ var receiveXhr = function(err, resource, redirectedUrl) {
1186
+ this.receive(url, elt, err, resource, redirectedUrl);
1187
+ }.bind(this);
1188
+ xhr.load(url, receiveXhr);
1189
+ }
1190
+ },
1191
+ receive: function(url, elt, err, resource, redirectedUrl) {
1192
+ this.cache[url] = resource;
1193
+ var $p = this.pending[url];
1194
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
1195
+ this.onload(url, p, resource, err, redirectedUrl);
1196
+ this.tail();
1197
+ }
1198
+ this.pending[url] = null;
1199
+ },
1200
+ tail: function() {
1201
+ --this.inflight;
1202
+ this.checkDone();
1203
+ },
1204
+ checkDone: function() {
1205
+ if (!this.inflight) {
1206
+ this.oncomplete();
1207
+ }
1208
+ }
1209
+ };
1210
+ scope.Loader = Loader;
1211
+ });
1212
+
1213
+ HTMLImports.addModule(function(scope) {
1214
+ var Observer = function(addCallback) {
1215
+ this.addCallback = addCallback;
1216
+ this.mo = new MutationObserver(this.handler.bind(this));
1217
+ };
1218
+ Observer.prototype = {
1219
+ handler: function(mutations) {
1220
+ for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
1221
+ if (m.type === "childList" && m.addedNodes.length) {
1222
+ this.addedNodes(m.addedNodes);
1223
+ }
1224
+ }
1225
+ },
1226
+ addedNodes: function(nodes) {
1227
+ if (this.addCallback) {
1228
+ this.addCallback(nodes);
1229
+ }
1230
+ for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
1231
+ if (n.children && n.children.length) {
1232
+ this.addedNodes(n.children);
1233
+ }
1234
+ }
1235
+ },
1236
+ observe: function(root) {
1237
+ this.mo.observe(root, {
1238
+ childList: true,
1239
+ subtree: true
1240
+ });
1241
+ }
1242
+ };
1243
+ scope.Observer = Observer;
1244
+ });
1245
+
1246
+ HTMLImports.addModule(function(scope) {
1247
+ var path = scope.path;
1248
+ var rootDocument = scope.rootDocument;
1249
+ var flags = scope.flags;
1250
+ var isIE = scope.isIE;
1251
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1252
+ var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
1253
+ var importParser = {
1254
+ documentSelectors: IMPORT_SELECTOR,
1255
+ importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
1256
+ map: {
1257
+ link: "parseLink",
1258
+ script: "parseScript",
1259
+ style: "parseStyle"
1260
+ },
1261
+ dynamicElements: [],
1262
+ parseNext: function() {
1263
+ var next = this.nextToParse();
1264
+ if (next) {
1265
+ this.parse(next);
1266
+ }
1267
+ },
1268
+ parse: function(elt) {
1269
+ if (this.isParsed(elt)) {
1270
+ flags.parse && console.log("[%s] is already parsed", elt.localName);
1271
+ return;
1272
+ }
1273
+ var fn = this[this.map[elt.localName]];
1274
+ if (fn) {
1275
+ this.markParsing(elt);
1276
+ fn.call(this, elt);
1277
+ }
1278
+ },
1279
+ parseDynamic: function(elt, quiet) {
1280
+ this.dynamicElements.push(elt);
1281
+ if (!quiet) {
1282
+ this.parseNext();
1283
+ }
1284
+ },
1285
+ markParsing: function(elt) {
1286
+ flags.parse && console.log("parsing", elt);
1287
+ this.parsingElement = elt;
1288
+ },
1289
+ markParsingComplete: function(elt) {
1290
+ elt.__importParsed = true;
1291
+ this.markDynamicParsingComplete(elt);
1292
+ if (elt.__importElement) {
1293
+ elt.__importElement.__importParsed = true;
1294
+ this.markDynamicParsingComplete(elt.__importElement);
1295
+ }
1296
+ this.parsingElement = null;
1297
+ flags.parse && console.log("completed", elt);
1298
+ },
1299
+ markDynamicParsingComplete: function(elt) {
1300
+ var i = this.dynamicElements.indexOf(elt);
1301
+ if (i >= 0) {
1302
+ this.dynamicElements.splice(i, 1);
1303
+ }
1304
+ },
1305
+ parseImport: function(elt) {
1306
+ if (HTMLImports.__importsParsingHook) {
1307
+ HTMLImports.__importsParsingHook(elt);
1308
+ }
1309
+ if (elt.import) {
1310
+ elt.import.__importParsed = true;
1311
+ }
1312
+ this.markParsingComplete(elt);
1313
+ if (elt.__resource && !elt.__error) {
1314
+ elt.dispatchEvent(new CustomEvent("load", {
1315
+ bubbles: false
1316
+ }));
1317
+ } else {
1318
+ elt.dispatchEvent(new CustomEvent("error", {
1319
+ bubbles: false
1320
+ }));
1321
+ }
1322
+ if (elt.__pending) {
1323
+ var fn;
1324
+ while (elt.__pending.length) {
1325
+ fn = elt.__pending.shift();
1326
+ if (fn) {
1327
+ fn({
1328
+ target: elt
1329
+ });
1330
+ }
1331
+ }
1332
+ }
1333
+ this.parseNext();
1334
+ },
1335
+ parseLink: function(linkElt) {
1336
+ if (nodeIsImport(linkElt)) {
1337
+ this.parseImport(linkElt);
1338
+ } else {
1339
+ linkElt.href = linkElt.href;
1340
+ this.parseGeneric(linkElt);
1341
+ }
1342
+ },
1343
+ parseStyle: function(elt) {
1344
+ var src = elt;
1345
+ elt = cloneStyle(elt);
1346
+ src.__appliedElement = elt;
1347
+ elt.__importElement = src;
1348
+ this.parseGeneric(elt);
1349
+ },
1350
+ parseGeneric: function(elt) {
1351
+ this.trackElement(elt);
1352
+ this.addElementToDocument(elt);
1353
+ },
1354
+ rootImportForElement: function(elt) {
1355
+ var n = elt;
1356
+ while (n.ownerDocument.__importLink) {
1357
+ n = n.ownerDocument.__importLink;
1358
+ }
1359
+ return n;
1360
+ },
1361
+ addElementToDocument: function(elt) {
1362
+ var port = this.rootImportForElement(elt.__importElement || elt);
1363
+ port.parentNode.insertBefore(elt, port);
1364
+ },
1365
+ trackElement: function(elt, callback) {
1366
+ var self = this;
1367
+ var done = function(e) {
1368
+ if (callback) {
1369
+ callback(e);
1370
+ }
1371
+ self.markParsingComplete(elt);
1372
+ self.parseNext();
1373
+ };
1374
+ elt.addEventListener("load", done);
1375
+ elt.addEventListener("error", done);
1376
+ if (isIE && elt.localName === "style") {
1377
+ var fakeLoad = false;
1378
+ if (elt.textContent.indexOf("@import") == -1) {
1379
+ fakeLoad = true;
1380
+ } else if (elt.sheet) {
1381
+ fakeLoad = true;
1382
+ var csr = elt.sheet.cssRules;
1383
+ var len = csr ? csr.length : 0;
1384
+ for (var i = 0, r; i < len && (r = csr[i]); i++) {
1385
+ if (r.type === CSSRule.IMPORT_RULE) {
1386
+ fakeLoad = fakeLoad && Boolean(r.styleSheet);
1387
+ }
1388
+ }
1389
+ }
1390
+ if (fakeLoad) {
1391
+ elt.dispatchEvent(new CustomEvent("load", {
1392
+ bubbles: false
1393
+ }));
1394
+ }
1395
+ }
1396
+ },
1397
+ parseScript: function(scriptElt) {
1398
+ var script = document.createElement("script");
1399
+ script.__importElement = scriptElt;
1400
+ script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
1401
+ scope.currentScript = scriptElt;
1402
+ this.trackElement(script, function(e) {
1403
+ script.parentNode.removeChild(script);
1404
+ scope.currentScript = null;
1405
+ });
1406
+ this.addElementToDocument(script);
1407
+ },
1408
+ nextToParse: function() {
1409
+ this._mayParse = [];
1410
+ return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
1411
+ },
1412
+ nextToParseInDoc: function(doc, link) {
1413
+ if (doc && this._mayParse.indexOf(doc) < 0) {
1414
+ this._mayParse.push(doc);
1415
+ var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
1416
+ for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
1417
+ if (!this.isParsed(n)) {
1418
+ if (this.hasResource(n)) {
1419
+ return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
1420
+ } else {
1421
+ return;
1422
+ }
1423
+ }
1424
+ }
1425
+ }
1426
+ return link;
1427
+ },
1428
+ nextToParseDynamic: function() {
1429
+ return this.dynamicElements[0];
1430
+ },
1431
+ parseSelectorsForNode: function(node) {
1432
+ var doc = node.ownerDocument || node;
1433
+ return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
1434
+ },
1435
+ isParsed: function(node) {
1436
+ return node.__importParsed;
1437
+ },
1438
+ needsDynamicParsing: function(elt) {
1439
+ return this.dynamicElements.indexOf(elt) >= 0;
1440
+ },
1441
+ hasResource: function(node) {
1442
+ if (nodeIsImport(node) && node.import === undefined) {
1443
+ return false;
1444
+ }
1445
+ return true;
1446
+ }
1447
+ };
1448
+ function nodeIsImport(elt) {
1449
+ return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
1450
+ }
1451
+ function generateScriptDataUrl(script) {
1452
+ var scriptContent = generateScriptContent(script);
1453
+ return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
1454
+ }
1455
+ function generateScriptContent(script) {
1456
+ return script.textContent + generateSourceMapHint(script);
1457
+ }
1458
+ function generateSourceMapHint(script) {
1459
+ var owner = script.ownerDocument;
1460
+ owner.__importedScripts = owner.__importedScripts || 0;
1461
+ var moniker = script.ownerDocument.baseURI;
1462
+ var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
1463
+ owner.__importedScripts++;
1464
+ return "\n//# sourceURL=" + moniker + num + ".js\n";
1465
+ }
1466
+ function cloneStyle(style) {
1467
+ var clone = style.ownerDocument.createElement("style");
1468
+ clone.textContent = style.textContent;
1469
+ path.resolveUrlsInStyle(clone);
1470
+ return clone;
1471
+ }
1472
+ scope.parser = importParser;
1473
+ scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
1474
+ });
1475
+
1476
+ HTMLImports.addModule(function(scope) {
1477
+ var flags = scope.flags;
1478
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1479
+ var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
1480
+ var rootDocument = scope.rootDocument;
1481
+ var Loader = scope.Loader;
1482
+ var Observer = scope.Observer;
1483
+ var parser = scope.parser;
1484
+ var importer = {
1485
+ documents: {},
1486
+ documentPreloadSelectors: IMPORT_SELECTOR,
1487
+ importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
1488
+ loadNode: function(node) {
1489
+ importLoader.addNode(node);
1490
+ },
1491
+ loadSubtree: function(parent) {
1492
+ var nodes = this.marshalNodes(parent);
1493
+ importLoader.addNodes(nodes);
1494
+ },
1495
+ marshalNodes: function(parent) {
1496
+ return parent.querySelectorAll(this.loadSelectorsForNode(parent));
1497
+ },
1498
+ loadSelectorsForNode: function(node) {
1499
+ var doc = node.ownerDocument || node;
1500
+ return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
1501
+ },
1502
+ loaded: function(url, elt, resource, err, redirectedUrl) {
1503
+ flags.load && console.log("loaded", url, elt);
1504
+ elt.__resource = resource;
1505
+ elt.__error = err;
1506
+ if (isImportLink(elt)) {
1507
+ var doc = this.documents[url];
1508
+ if (doc === undefined) {
1509
+ doc = err ? null : makeDocument(resource, redirectedUrl || url);
1510
+ if (doc) {
1511
+ doc.__importLink = elt;
1512
+ this.bootDocument(doc);
1513
+ }
1514
+ this.documents[url] = doc;
1515
+ }
1516
+ elt.import = doc;
1517
+ }
1518
+ parser.parseNext();
1519
+ },
1520
+ bootDocument: function(doc) {
1521
+ this.loadSubtree(doc);
1522
+ this.observer.observe(doc);
1523
+ parser.parseNext();
1524
+ },
1525
+ loadedAll: function() {
1526
+ parser.parseNext();
1527
+ }
1528
+ };
1529
+ var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
1530
+ importer.observer = new Observer();
1531
+ function isImportLink(elt) {
1532
+ return isLinkRel(elt, IMPORT_LINK_TYPE);
1533
+ }
1534
+ function isLinkRel(elt, rel) {
1535
+ return elt.localName === "link" && elt.getAttribute("rel") === rel;
1536
+ }
1537
+ function hasBaseURIAccessor(doc) {
1538
+ return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
1539
+ }
1540
+ function makeDocument(resource, url) {
1541
+ var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
1542
+ doc._URL = url;
1543
+ var base = doc.createElement("base");
1544
+ base.setAttribute("href", url);
1545
+ if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
1546
+ Object.defineProperty(doc, "baseURI", {
1547
+ value: url
1548
+ });
1549
+ }
1550
+ var meta = doc.createElement("meta");
1551
+ meta.setAttribute("charset", "utf-8");
1552
+ doc.head.appendChild(meta);
1553
+ doc.head.appendChild(base);
1554
+ doc.body.innerHTML = resource;
1555
+ if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
1556
+ HTMLTemplateElement.bootstrap(doc);
1557
+ }
1558
+ return doc;
1559
+ }
1560
+ if (!document.baseURI) {
1561
+ var baseURIDescriptor = {
1562
+ get: function() {
1563
+ var base = document.querySelector("base");
1564
+ return base ? base.href : window.location.href;
1565
+ },
1566
+ configurable: true
1567
+ };
1568
+ Object.defineProperty(document, "baseURI", baseURIDescriptor);
1569
+ Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
1570
+ }
1571
+ scope.importer = importer;
1572
+ scope.importLoader = importLoader;
1573
+ });
1574
+
1575
+ HTMLImports.addModule(function(scope) {
1576
+ var parser = scope.parser;
1577
+ var importer = scope.importer;
1578
+ var dynamic = {
1579
+ added: function(nodes) {
1580
+ var owner, parsed, loading;
1581
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1582
+ if (!owner) {
1583
+ owner = n.ownerDocument;
1584
+ parsed = parser.isParsed(owner);
1585
+ }
1586
+ loading = this.shouldLoadNode(n);
1587
+ if (loading) {
1588
+ importer.loadNode(n);
1589
+ }
1590
+ if (this.shouldParseNode(n) && parsed) {
1591
+ parser.parseDynamic(n, loading);
1592
+ }
1593
+ }
1594
+ },
1595
+ shouldLoadNode: function(node) {
1596
+ return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
1597
+ },
1598
+ shouldParseNode: function(node) {
1599
+ return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
1600
+ }
1601
+ };
1602
+ importer.observer.addCallback = dynamic.added.bind(dynamic);
1603
+ var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
1604
+ });
1605
+
1606
+ (function(scope) {
1607
+ var initializeModules = scope.initializeModules;
1608
+ var isIE = scope.isIE;
1609
+ if (scope.useNative) {
1610
+ return;
1611
+ }
1612
+ if (isIE && typeof window.CustomEvent !== "function") {
1613
+ window.CustomEvent = function(inType, params) {
1614
+ params = params || {};
1615
+ var e = document.createEvent("CustomEvent");
1616
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
1617
+ return e;
1618
+ };
1619
+ window.CustomEvent.prototype = window.Event.prototype;
1620
+ }
1621
+ initializeModules();
1622
+ var rootDocument = scope.rootDocument;
1623
+ function bootstrap() {
1624
+ HTMLImports.importer.bootDocument(rootDocument);
1625
+ }
1626
+ if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
1627
+ bootstrap();
1628
+ } else {
1629
+ document.addEventListener("DOMContentLoaded", bootstrap);
1630
+ }
1631
+ })(HTMLImports);
1632
+
1633
+ window.CustomElements = window.CustomElements || {
1634
+ flags: {}
1635
+ };
1636
+
1637
+ (function(scope) {
1638
+ var flags = scope.flags;
1639
+ var modules = [];
1640
+ var addModule = function(module) {
1641
+ modules.push(module);
1642
+ };
1643
+ var initializeModules = function() {
1644
+ modules.forEach(function(module) {
1645
+ module(scope);
1646
+ });
1647
+ };
1648
+ scope.addModule = addModule;
1649
+ scope.initializeModules = initializeModules;
1650
+ scope.hasNative = Boolean(document.registerElement);
1651
+ scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
1652
+ })(CustomElements);
1653
+
1654
+ CustomElements.addModule(function(scope) {
1655
+ var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
1656
+ function forSubtree(node, cb) {
1657
+ findAllElements(node, function(e) {
1658
+ if (cb(e)) {
1659
+ return true;
1660
+ }
1661
+ forRoots(e, cb);
1662
+ });
1663
+ forRoots(node, cb);
1664
+ }
1665
+ function findAllElements(node, find, data) {
1666
+ var e = node.firstElementChild;
1667
+ if (!e) {
1668
+ e = node.firstChild;
1669
+ while (e && e.nodeType !== Node.ELEMENT_NODE) {
1670
+ e = e.nextSibling;
1671
+ }
1672
+ }
1673
+ while (e) {
1674
+ if (find(e, data) !== true) {
1675
+ findAllElements(e, find, data);
1676
+ }
1677
+ e = e.nextElementSibling;
1678
+ }
1679
+ return null;
1680
+ }
1681
+ function forRoots(node, cb) {
1682
+ var root = node.shadowRoot;
1683
+ while (root) {
1684
+ forSubtree(root, cb);
1685
+ root = root.olderShadowRoot;
1686
+ }
1687
+ }
1688
+ function forDocumentTree(doc, cb) {
1689
+ _forDocumentTree(doc, cb, []);
1690
+ }
1691
+ function _forDocumentTree(doc, cb, processingDocuments) {
1692
+ doc = wrap(doc);
1693
+ if (processingDocuments.indexOf(doc) >= 0) {
1694
+ return;
1695
+ }
1696
+ processingDocuments.push(doc);
1697
+ var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
1698
+ for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
1699
+ if (n.import) {
1700
+ _forDocumentTree(n.import, cb, processingDocuments);
1701
+ }
1702
+ }
1703
+ cb(doc);
1704
+ }
1705
+ scope.forDocumentTree = forDocumentTree;
1706
+ scope.forSubtree = forSubtree;
1707
+ });
1708
+
1709
+ CustomElements.addModule(function(scope) {
1710
+ var flags = scope.flags;
1711
+ var forSubtree = scope.forSubtree;
1712
+ var forDocumentTree = scope.forDocumentTree;
1713
+ function addedNode(node) {
1714
+ return added(node) || addedSubtree(node);
1715
+ }
1716
+ function added(node) {
1717
+ if (scope.upgrade(node)) {
1718
+ return true;
1719
+ }
1720
+ attached(node);
1721
+ }
1722
+ function addedSubtree(node) {
1723
+ forSubtree(node, function(e) {
1724
+ if (added(e)) {
1725
+ return true;
1726
+ }
1727
+ });
1728
+ }
1729
+ function attachedNode(node) {
1730
+ attached(node);
1731
+ if (inDocument(node)) {
1732
+ forSubtree(node, function(e) {
1733
+ attached(e);
1734
+ });
1735
+ }
1736
+ }
1737
+ var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
1738
+ scope.hasPolyfillMutations = hasPolyfillMutations;
1739
+ var isPendingMutations = false;
1740
+ var pendingMutations = [];
1741
+ function deferMutation(fn) {
1742
+ pendingMutations.push(fn);
1743
+ if (!isPendingMutations) {
1744
+ isPendingMutations = true;
1745
+ setTimeout(takeMutations);
1746
+ }
1747
+ }
1748
+ function takeMutations() {
1749
+ isPendingMutations = false;
1750
+ var $p = pendingMutations;
1751
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
1752
+ p();
1753
+ }
1754
+ pendingMutations = [];
1755
+ }
1756
+ function attached(element) {
1757
+ if (hasPolyfillMutations) {
1758
+ deferMutation(function() {
1759
+ _attached(element);
1760
+ });
1761
+ } else {
1762
+ _attached(element);
1763
+ }
1764
+ }
1765
+ function _attached(element) {
1766
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
1767
+ if (!element.__attached && inDocument(element)) {
1768
+ element.__attached = true;
1769
+ if (element.attachedCallback) {
1770
+ element.attachedCallback();
1771
+ }
1772
+ }
1773
+ }
1774
+ }
1775
+ function detachedNode(node) {
1776
+ detached(node);
1777
+ forSubtree(node, function(e) {
1778
+ detached(e);
1779
+ });
1780
+ }
1781
+ function detached(element) {
1782
+ if (hasPolyfillMutations) {
1783
+ deferMutation(function() {
1784
+ _detached(element);
1785
+ });
1786
+ } else {
1787
+ _detached(element);
1788
+ }
1789
+ }
1790
+ function _detached(element) {
1791
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
1792
+ if (element.__attached && !inDocument(element)) {
1793
+ element.__attached = false;
1794
+ if (element.detachedCallback) {
1795
+ element.detachedCallback();
1796
+ }
1797
+ }
1798
+ }
1799
+ }
1800
+ function inDocument(element) {
1801
+ var p = element;
1802
+ var doc = wrap(document);
1803
+ while (p) {
1804
+ if (p == doc) {
1805
+ return true;
1806
+ }
1807
+ p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host;
1808
+ }
1809
+ }
1810
+ function watchShadow(node) {
1811
+ if (node.shadowRoot && !node.shadowRoot.__watched) {
1812
+ flags.dom && console.log("watching shadow-root for: ", node.localName);
1813
+ var root = node.shadowRoot;
1814
+ while (root) {
1815
+ observe(root);
1816
+ root = root.olderShadowRoot;
1817
+ }
1818
+ }
1819
+ }
1820
+ function handler(mutations) {
1821
+ if (flags.dom) {
1822
+ var mx = mutations[0];
1823
+ if (mx && mx.type === "childList" && mx.addedNodes) {
1824
+ if (mx.addedNodes) {
1825
+ var d = mx.addedNodes[0];
1826
+ while (d && d !== document && !d.host) {
1827
+ d = d.parentNode;
1828
+ }
1829
+ var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
1830
+ u = u.split("/?").shift().split("/").pop();
1831
+ }
1832
+ }
1833
+ console.group("mutations (%d) [%s]", mutations.length, u || "");
1834
+ }
1835
+ mutations.forEach(function(mx) {
1836
+ if (mx.type === "childList") {
1837
+ forEach(mx.addedNodes, function(n) {
1838
+ if (!n.localName) {
1839
+ return;
1840
+ }
1841
+ addedNode(n);
1842
+ });
1843
+ forEach(mx.removedNodes, function(n) {
1844
+ if (!n.localName) {
1845
+ return;
1846
+ }
1847
+ detachedNode(n);
1848
+ });
1849
+ }
1850
+ });
1851
+ flags.dom && console.groupEnd();
1852
+ }
1853
+ function takeRecords(node) {
1854
+ node = wrap(node);
1855
+ if (!node) {
1856
+ node = wrap(document);
1857
+ }
1858
+ while (node.parentNode) {
1859
+ node = node.parentNode;
1860
+ }
1861
+ var observer = node.__observer;
1862
+ if (observer) {
1863
+ handler(observer.takeRecords());
1864
+ takeMutations();
1865
+ }
1866
+ }
1867
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
1868
+ function observe(inRoot) {
1869
+ if (inRoot.__observer) {
1870
+ return;
1871
+ }
1872
+ var observer = new MutationObserver(handler);
1873
+ observer.observe(inRoot, {
1874
+ childList: true,
1875
+ subtree: true
1876
+ });
1877
+ inRoot.__observer = observer;
1878
+ }
1879
+ function upgradeDocument(doc) {
1880
+ doc = wrap(doc);
1881
+ flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
1882
+ addedNode(doc);
1883
+ observe(doc);
1884
+ flags.dom && console.groupEnd();
1885
+ }
1886
+ function upgradeDocumentTree(doc) {
1887
+ forDocumentTree(doc, upgradeDocument);
1888
+ }
1889
+ var originalCreateShadowRoot = Element.prototype.createShadowRoot;
1890
+ if (originalCreateShadowRoot) {
1891
+ Element.prototype.createShadowRoot = function() {
1892
+ var root = originalCreateShadowRoot.call(this);
1893
+ CustomElements.watchShadow(this);
1894
+ return root;
1895
+ };
1896
+ }
1897
+ scope.watchShadow = watchShadow;
1898
+ scope.upgradeDocumentTree = upgradeDocumentTree;
1899
+ scope.upgradeSubtree = addedSubtree;
1900
+ scope.upgradeAll = addedNode;
1901
+ scope.attachedNode = attachedNode;
1902
+ scope.takeRecords = takeRecords;
1903
+ });
1904
+
1905
+ CustomElements.addModule(function(scope) {
1906
+ var flags = scope.flags;
1907
+ function upgrade(node) {
1908
+ if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
1909
+ var is = node.getAttribute("is");
1910
+ var definition = scope.getRegisteredDefinition(is || node.localName);
1911
+ if (definition) {
1912
+ if (is && definition.tag == node.localName) {
1913
+ return upgradeWithDefinition(node, definition);
1914
+ } else if (!is && !definition.extends) {
1915
+ return upgradeWithDefinition(node, definition);
1916
+ }
1917
+ }
1918
+ }
1919
+ }
1920
+ function upgradeWithDefinition(element, definition) {
1921
+ flags.upgrade && console.group("upgrade:", element.localName);
1922
+ if (definition.is) {
1923
+ element.setAttribute("is", definition.is);
1924
+ }
1925
+ implementPrototype(element, definition);
1926
+ element.__upgraded__ = true;
1927
+ created(element);
1928
+ scope.attachedNode(element);
1929
+ scope.upgradeSubtree(element);
1930
+ flags.upgrade && console.groupEnd();
1931
+ return element;
1932
+ }
1933
+ function implementPrototype(element, definition) {
1934
+ if (Object.__proto__) {
1935
+ element.__proto__ = definition.prototype;
1936
+ } else {
1937
+ customMixin(element, definition.prototype, definition.native);
1938
+ element.__proto__ = definition.prototype;
1939
+ }
1940
+ }
1941
+ function customMixin(inTarget, inSrc, inNative) {
1942
+ var used = {};
1943
+ var p = inSrc;
1944
+ while (p !== inNative && p !== HTMLElement.prototype) {
1945
+ var keys = Object.getOwnPropertyNames(p);
1946
+ for (var i = 0, k; k = keys[i]; i++) {
1947
+ if (!used[k]) {
1948
+ Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
1949
+ used[k] = 1;
1950
+ }
1951
+ }
1952
+ p = Object.getPrototypeOf(p);
1953
+ }
1954
+ }
1955
+ function created(element) {
1956
+ if (element.createdCallback) {
1957
+ element.createdCallback();
1958
+ }
1959
+ }
1960
+ scope.upgrade = upgrade;
1961
+ scope.upgradeWithDefinition = upgradeWithDefinition;
1962
+ scope.implementPrototype = implementPrototype;
1963
+ });
1964
+
1965
+ CustomElements.addModule(function(scope) {
1966
+ var isIE11OrOlder = scope.isIE11OrOlder;
1967
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
1968
+ var upgradeAll = scope.upgradeAll;
1969
+ var upgradeWithDefinition = scope.upgradeWithDefinition;
1970
+ var implementPrototype = scope.implementPrototype;
1971
+ var useNative = scope.useNative;
1972
+ function register(name, options) {
1973
+ var definition = options || {};
1974
+ if (!name) {
1975
+ throw new Error("document.registerElement: first argument `name` must not be empty");
1976
+ }
1977
+ if (name.indexOf("-") < 0) {
1978
+ throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
1979
+ }
1980
+ if (isReservedTag(name)) {
1981
+ throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
1982
+ }
1983
+ if (getRegisteredDefinition(name)) {
1984
+ throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
1985
+ }
1986
+ if (!definition.prototype) {
1987
+ definition.prototype = Object.create(HTMLElement.prototype);
1988
+ }
1989
+ definition.__name = name.toLowerCase();
1990
+ definition.lifecycle = definition.lifecycle || {};
1991
+ definition.ancestry = ancestry(definition.extends);
1992
+ resolveTagName(definition);
1993
+ resolvePrototypeChain(definition);
1994
+ overrideAttributeApi(definition.prototype);
1995
+ registerDefinition(definition.__name, definition);
1996
+ definition.ctor = generateConstructor(definition);
1997
+ definition.ctor.prototype = definition.prototype;
1998
+ definition.prototype.constructor = definition.ctor;
1999
+ if (scope.ready) {
2000
+ upgradeDocumentTree(document);
2001
+ }
2002
+ return definition.ctor;
2003
+ }
2004
+ function overrideAttributeApi(prototype) {
2005
+ if (prototype.setAttribute._polyfilled) {
2006
+ return;
2007
+ }
2008
+ var setAttribute = prototype.setAttribute;
2009
+ prototype.setAttribute = function(name, value) {
2010
+ changeAttribute.call(this, name, value, setAttribute);
2011
+ };
2012
+ var removeAttribute = prototype.removeAttribute;
2013
+ prototype.removeAttribute = function(name) {
2014
+ changeAttribute.call(this, name, null, removeAttribute);
2015
+ };
2016
+ prototype.setAttribute._polyfilled = true;
2017
+ }
2018
+ function changeAttribute(name, value, operation) {
2019
+ name = name.toLowerCase();
2020
+ var oldValue = this.getAttribute(name);
2021
+ operation.apply(this, arguments);
2022
+ var newValue = this.getAttribute(name);
2023
+ if (this.attributeChangedCallback && newValue !== oldValue) {
2024
+ this.attributeChangedCallback(name, oldValue, newValue);
2025
+ }
2026
+ }
2027
+ function isReservedTag(name) {
2028
+ for (var i = 0; i < reservedTagList.length; i++) {
2029
+ if (name === reservedTagList[i]) {
2030
+ return true;
2031
+ }
2032
+ }
2033
+ }
2034
+ var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
2035
+ function ancestry(extnds) {
2036
+ var extendee = getRegisteredDefinition(extnds);
2037
+ if (extendee) {
2038
+ return ancestry(extendee.extends).concat([ extendee ]);
2039
+ }
2040
+ return [];
2041
+ }
2042
+ function resolveTagName(definition) {
2043
+ var baseTag = definition.extends;
2044
+ for (var i = 0, a; a = definition.ancestry[i]; i++) {
2045
+ baseTag = a.is && a.tag;
2046
+ }
2047
+ definition.tag = baseTag || definition.__name;
2048
+ if (baseTag) {
2049
+ definition.is = definition.__name;
2050
+ }
2051
+ }
2052
+ function resolvePrototypeChain(definition) {
2053
+ if (!Object.__proto__) {
2054
+ var nativePrototype = HTMLElement.prototype;
2055
+ if (definition.is) {
2056
+ var inst = document.createElement(definition.tag);
2057
+ var expectedPrototype = Object.getPrototypeOf(inst);
2058
+ if (expectedPrototype === definition.prototype) {
2059
+ nativePrototype = expectedPrototype;
2060
+ }
2061
+ }
2062
+ var proto = definition.prototype, ancestor;
2063
+ while (proto && proto !== nativePrototype) {
2064
+ ancestor = Object.getPrototypeOf(proto);
2065
+ proto.__proto__ = ancestor;
2066
+ proto = ancestor;
2067
+ }
2068
+ definition.native = nativePrototype;
2069
+ }
2070
+ }
2071
+ function instantiate(definition) {
2072
+ return upgradeWithDefinition(domCreateElement(definition.tag), definition);
2073
+ }
2074
+ var registry = {};
2075
+ function getRegisteredDefinition(name) {
2076
+ if (name) {
2077
+ return registry[name.toLowerCase()];
2078
+ }
2079
+ }
2080
+ function registerDefinition(name, definition) {
2081
+ registry[name] = definition;
2082
+ }
2083
+ function generateConstructor(definition) {
2084
+ return function() {
2085
+ return instantiate(definition);
2086
+ };
2087
+ }
2088
+ var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
2089
+ function createElementNS(namespace, tag, typeExtension) {
2090
+ if (namespace === HTML_NAMESPACE) {
2091
+ return createElement(tag, typeExtension);
2092
+ } else {
2093
+ return domCreateElementNS(namespace, tag);
2094
+ }
2095
+ }
2096
+ function createElement(tag, typeExtension) {
2097
+ var definition = getRegisteredDefinition(typeExtension || tag);
2098
+ if (definition) {
2099
+ if (tag == definition.tag && typeExtension == definition.is) {
2100
+ return new definition.ctor();
2101
+ }
2102
+ if (!typeExtension && !definition.is) {
2103
+ return new definition.ctor();
2104
+ }
2105
+ }
2106
+ var element;
2107
+ if (typeExtension) {
2108
+ element = createElement(tag);
2109
+ element.setAttribute("is", typeExtension);
2110
+ return element;
2111
+ }
2112
+ element = domCreateElement(tag);
2113
+ if (tag.indexOf("-") >= 0) {
2114
+ implementPrototype(element, HTMLElement);
2115
+ }
2116
+ return element;
2117
+ }
2118
+ var domCreateElement = document.createElement.bind(document);
2119
+ var domCreateElementNS = document.createElementNS.bind(document);
2120
+ var isInstance;
2121
+ if (!Object.__proto__ && !useNative) {
2122
+ isInstance = function(obj, ctor) {
2123
+ var p = obj;
2124
+ while (p) {
2125
+ if (p === ctor.prototype) {
2126
+ return true;
2127
+ }
2128
+ p = p.__proto__;
2129
+ }
2130
+ return false;
2131
+ };
2132
+ } else {
2133
+ isInstance = function(obj, base) {
2134
+ return obj instanceof base;
2135
+ };
2136
+ }
2137
+ function wrapDomMethodToForceUpgrade(obj, methodName) {
2138
+ var orig = obj[methodName];
2139
+ obj[methodName] = function() {
2140
+ var n = orig.apply(this, arguments);
2141
+ upgradeAll(n);
2142
+ return n;
2143
+ };
2144
+ }
2145
+ wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
2146
+ wrapDomMethodToForceUpgrade(document, "importNode");
2147
+ if (isIE11OrOlder) {
2148
+ (function() {
2149
+ var importNode = document.importNode;
2150
+ document.importNode = function() {
2151
+ var n = importNode.apply(document, arguments);
2152
+ if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) {
2153
+ var f = document.createDocumentFragment();
2154
+ f.appendChild(n);
2155
+ return f;
2156
+ } else {
2157
+ return n;
2158
+ }
2159
+ };
2160
+ })();
2161
+ }
2162
+ document.registerElement = register;
2163
+ document.createElement = createElement;
2164
+ document.createElementNS = createElementNS;
2165
+ scope.registry = registry;
2166
+ scope.instanceof = isInstance;
2167
+ scope.reservedTagList = reservedTagList;
2168
+ scope.getRegisteredDefinition = getRegisteredDefinition;
2169
+ document.register = document.registerElement;
2170
+ });
2171
+
2172
+ (function(scope) {
2173
+ var useNative = scope.useNative;
2174
+ var initializeModules = scope.initializeModules;
2175
+ var isIE11OrOlder = /Trident/.test(navigator.userAgent);
2176
+ if (useNative) {
2177
+ var nop = function() {};
2178
+ scope.watchShadow = nop;
2179
+ scope.upgrade = nop;
2180
+ scope.upgradeAll = nop;
2181
+ scope.upgradeDocumentTree = nop;
2182
+ scope.upgradeSubtree = nop;
2183
+ scope.takeRecords = nop;
2184
+ scope.instanceof = function(obj, base) {
2185
+ return obj instanceof base;
2186
+ };
2187
+ } else {
2188
+ initializeModules();
2189
+ }
2190
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
2191
+ if (!window.wrap) {
2192
+ if (window.ShadowDOMPolyfill) {
2193
+ window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
2194
+ window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
2195
+ } else {
2196
+ window.wrap = window.unwrap = function(node) {
2197
+ return node;
2198
+ };
2199
+ }
2200
+ }
2201
+ function bootstrap() {
2202
+ upgradeDocumentTree(wrap(document));
2203
+ if (window.HTMLImports) {
2204
+ HTMLImports.__importsParsingHook = function(elt) {
2205
+ upgradeDocumentTree(wrap(elt.import));
2206
+ };
2207
+ }
2208
+ CustomElements.ready = true;
2209
+ setTimeout(function() {
2210
+ CustomElements.readyTime = Date.now();
2211
+ if (window.HTMLImports) {
2212
+ CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
2213
+ }
2214
+ document.dispatchEvent(new CustomEvent("WebComponentsReady", {
2215
+ bubbles: true
2216
+ }));
2217
+ });
2218
+ }
2219
+ if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
2220
+ window.CustomEvent = function(inType, params) {
2221
+ params = params || {};
2222
+ var e = document.createEvent("CustomEvent");
2223
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
2224
+ return e;
2225
+ };
2226
+ window.CustomEvent.prototype = window.Event.prototype;
2227
+ }
2228
+ if (document.readyState === "complete" || scope.flags.eager) {
2229
+ bootstrap();
2230
+ } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
2231
+ bootstrap();
2232
+ } else {
2233
+ var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
2234
+ window.addEventListener(loadEvent, bootstrap);
2235
+ }
2236
+ scope.isIE11OrOlder = isIE11OrOlder;
2237
+ })(window.CustomElements);
2238
+
2239
+ if (typeof HTMLTemplateElement === "undefined") {
2240
+ (function() {
2241
+ var TEMPLATE_TAG = "template";
2242
+ HTMLTemplateElement = function() {};
2243
+ HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
2244
+ HTMLTemplateElement.decorate = function(template) {
2245
+ if (!template.content) {
2246
+ template.content = template.ownerDocument.createDocumentFragment();
2247
+ var child;
2248
+ while (child = template.firstChild) {
2249
+ template.content.appendChild(child);
2250
+ }
2251
+ }
2252
+ };
2253
+ HTMLTemplateElement.bootstrap = function(doc) {
2254
+ var templates = doc.querySelectorAll(TEMPLATE_TAG);
2255
+ for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++) {
2256
+ HTMLTemplateElement.decorate(t);
2257
+ }
2258
+ };
2259
+ addEventListener("DOMContentLoaded", function() {
2260
+ HTMLTemplateElement.bootstrap(document);
2261
+ });
2262
+ })();
2263
+ }
2264
+
2265
+ (function(scope) {
2266
+ var style = document.createElement("style");
2267
+ style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
2268
+ var head = document.querySelector("head");
2269
+ head.insertBefore(style, head.firstChild);
2270
+ })(window.WebComponents);