polymer-core-rails 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/app/assets/components/context-free-parser/context-free-parser.js +27 -4
  4. data/app/assets/components/core-a11y-keys/core-a11y-keys.html +4 -4
  5. data/app/assets/components/core-ajax/core-ajax.html +38 -10
  6. data/app/assets/components/core-ajax/core-xhr.html +1 -1
  7. data/app/assets/components/core-animated-pages/core-animated-pages.html +25 -2
  8. data/app/assets/components/core-animation/web-animations.html +1 -1
  9. data/app/assets/components/core-collapse/core-collapse.html +1 -1
  10. data/app/assets/components/core-doc-viewer/elements/core-doc-page.css +26 -1
  11. data/app/assets/components/core-doc-viewer/elements/core-doc-page.html +39 -4
  12. data/app/assets/components/core-doc-viewer/elements/core-doc-toc.css +3 -3
  13. data/app/assets/components/core-drawer-panel/core-drawer-panel.css +14 -6
  14. data/app/assets/components/core-drawer-panel/core-drawer-panel.html +32 -8
  15. data/app/assets/components/core-dropdown/core-dropdown.html +8 -2
  16. data/app/assets/components/core-elements/core-elements.html +1 -0
  17. data/app/assets/components/core-icon/core-icon.html +0 -2
  18. data/app/assets/components/core-icons/av-icons.html +2 -9
  19. data/app/assets/components/core-icons/communication-icons.html +39 -42
  20. data/app/assets/components/core-icons/core-icons.html +231 -235
  21. data/app/assets/components/core-icons/device-icons.html +75 -90
  22. data/app/assets/components/core-icons/editor-icons.html +52 -52
  23. data/app/assets/components/core-icons/hardware-icons.html +40 -41
  24. data/app/assets/components/core-icons/image-icons.html +133 -137
  25. data/app/assets/components/core-icons/maps-icons.html +55 -57
  26. data/app/assets/components/core-icons/notification-icons.html +34 -34
  27. data/app/assets/components/core-icons/social-icons.html +23 -37
  28. data/app/assets/components/core-image/core-image.html +3 -3
  29. data/app/assets/components/core-list/core-list.html +50 -27
  30. data/app/assets/components/core-localstorage/core-localstorage.html +4 -5
  31. data/app/assets/components/core-menu/core-menu.html +8 -3
  32. data/app/assets/components/core-menu/core-submenu.html +2 -2
  33. data/app/assets/components/core-overlay/core-key-helper.html +3 -0
  34. data/app/assets/components/core-overlay/core-overlay-layer.html +3 -0
  35. data/app/assets/components/core-overlay/core-overlay.html +20 -4
  36. data/app/assets/components/core-resizable/core-resizable.html +248 -0
  37. data/app/assets/components/core-scroll-header-panel/core-scroll-header-panel.html +14 -3
  38. data/app/assets/components/core-scroll-threshold/core-scroll-threshold.html +222 -0
  39. data/app/assets/components/core-scroll-threshold/metadata.html +24 -0
  40. data/app/assets/components/core-selection/core-selection.html +1 -1
  41. data/app/assets/components/core-selector/core-selector.html +26 -26
  42. data/app/assets/components/core-splitter/core-splitter.html +17 -2
  43. data/app/assets/components/core-style/core-style.html +1 -1
  44. data/app/assets/components/core-toolbar/core-toolbar.html +1 -1
  45. data/app/assets/components/core-tooltip/core-tooltip.css +2 -2
  46. data/app/assets/components/core-tooltip/core-tooltip.html +16 -5
  47. data/app/assets/components/core-tooltip/metadata.html +1 -1
  48. data/app/assets/components/google-code-prettify/styles/doxy.css +1 -1
  49. data/app/assets/components/marked/lib/marked.js +11 -5
  50. data/app/assets/components/marked/marked.min.js +6 -0
  51. data/app/assets/components/paper-button/paper-button-base.html +56 -12
  52. data/app/assets/components/paper-button/paper-button.html +22 -5
  53. data/app/assets/components/paper-fab/paper-fab.html +2 -2
  54. data/app/assets/components/paper-ripple/paper-ripple.html +2 -1
  55. data/app/assets/components/paper-shadow/paper-shadow.css +10 -10
  56. data/app/assets/components/paper-shadow/paper-shadow.html +8 -1
  57. data/app/assets/components/sampler-scaffold/sampler-scaffold.css +1 -1
  58. data/app/assets/components/{web-animations-next → web-animations-js}/src/animation-constructor.js +10 -5
  59. data/app/assets/components/{web-animations-next → web-animations-js}/src/animation-node.js +1 -1
  60. data/app/assets/components/{web-animations-next → web-animations-js}/src/animation.js +2 -2
  61. data/app/assets/components/{web-animations-next → web-animations-js}/src/apply-preserving-inline-style.js +2 -3
  62. data/app/assets/components/{web-animations-next → web-animations-js}/src/apply.js +1 -1
  63. data/app/assets/components/{web-animations-next → web-animations-js}/src/box-handler.js +1 -1
  64. data/app/assets/components/{web-animations-next → web-animations-js}/src/color-handler.js +2 -2
  65. data/app/assets/components/{web-animations-next → web-animations-js}/src/deprecation.js +0 -0
  66. data/app/assets/components/{web-animations-next → web-animations-js}/src/dev.js +0 -0
  67. data/app/assets/components/{web-animations-next → web-animations-js}/src/dimension-handler.js +1 -1
  68. data/app/assets/components/{web-animations-next → web-animations-js}/src/effect-callback.js +2 -2
  69. data/app/assets/components/{web-animations-next → web-animations-js}/src/effect.js +1 -1
  70. data/app/assets/components/{web-animations-next → web-animations-js}/src/element-animatable.js +1 -1
  71. data/app/assets/components/{web-animations-next → web-animations-js}/src/font-weight-handler.js +1 -1
  72. data/app/assets/components/{web-animations-next → web-animations-js}/src/group-constructors.js +2 -1
  73. data/app/assets/components/{web-animations-next → web-animations-js}/src/handler-utils.js +1 -1
  74. data/app/assets/components/{web-animations-next → web-animations-js}/src/interpolation.js +1 -1
  75. data/app/assets/components/{web-animations-next → web-animations-js}/src/matrix-decomposition.js +1 -1
  76. data/app/assets/components/{web-animations-next → web-animations-js}/src/matrix-interpolation.js +1 -1
  77. data/app/assets/components/{web-animations-next → web-animations-js}/src/normalize-keyframes.js +1 -1
  78. data/app/assets/components/{web-animations-next → web-animations-js}/src/number-handler.js +1 -1
  79. data/app/assets/components/{web-animations-next → web-animations-js}/src/player.js +1 -1
  80. data/app/assets/components/{web-animations-next → web-animations-js}/src/position-handler.js +1 -1
  81. data/app/assets/components/{web-animations-next → web-animations-js}/src/property-interpolation.js +1 -1
  82. data/app/assets/components/{web-animations-next → web-animations-js}/src/property-names.js +1 -1
  83. data/app/assets/components/{web-animations-next → web-animations-js}/src/scope.js +2 -2
  84. data/app/assets/components/{web-animations-next → web-animations-js}/src/shadow-handler.js +1 -1
  85. data/app/assets/components/{web-animations-next → web-animations-js}/src/shape-handler.js +1 -1
  86. data/app/assets/components/{web-animations-next → web-animations-js}/src/tick.js +1 -1
  87. data/app/assets/components/{web-animations-next → web-animations-js}/src/timeline.js +7 -7
  88. data/app/assets/components/{web-animations-next → web-animations-js}/src/timing-utilities.js +0 -0
  89. data/app/assets/components/{web-animations-next → web-animations-js}/src/transform-handler.js +1 -1
  90. data/app/assets/components/{web-animations-next → web-animations-js}/src/visibility-handler.js +1 -1
  91. data/app/assets/components/{web-animations-next/src/maxifill-player.js → web-animations-js/src/web-animations-next-player.js} +1 -1
  92. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations-next-lite.dev.html +1 -1
  93. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations-next-lite.dev.js +0 -0
  94. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  95. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations-next.dev.html +1 -1
  96. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations-next.dev.js +0 -0
  97. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  98. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations.dev.html +0 -0
  99. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations.dev.js +0 -0
  100. data/app/assets/components/{web-animations-next → web-animations-js}/web-animations.html +1 -3
  101. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  102. data/app/assets/components/webcomponentsjs/CustomElements.js +634 -0
  103. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  104. data/app/assets/components/webcomponentsjs/HTMLImports.js +764 -0
  105. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  106. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4277 -0
  107. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +13 -0
  108. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +1728 -0
  109. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +11 -0
  110. data/app/assets/components/webcomponentsjs/webcomponents.js +6114 -0
  111. data/app/assets/components/webcomponentsjs/webcomponents.min.js +14 -0
  112. data/lib/polymer-core-rails/version.rb +1 -1
  113. metadata +60 -76
  114. data/app/assets/components/context-free-parser/package.json +0 -16
  115. data/app/assets/components/core-ajax/demo-progress.html +0 -65
  116. data/app/assets/components/core-dropdown/metadata.html +0 -62
  117. data/app/assets/components/core-icons/png-icons.html +0 -19
  118. data/app/assets/components/core-overlay/tests/html/core-overlay-basic.html +0 -127
  119. data/app/assets/components/core-overlay/tests/html/core-overlay-positioning-margin.html +0 -153
  120. data/app/assets/components/core-overlay/tests/html/core-overlay-positioning.html +0 -167
  121. data/app/assets/components/core-overlay/tests/html/core-overlay-scroll.html +0 -130
  122. data/app/assets/components/core-overlay/tests/js/htmltests.js +0 -6
  123. data/app/assets/components/core-overlay/tests/runner.html +0 -14
  124. data/app/assets/components/core-overlay/tests/tests.json +0 -6
  125. data/app/assets/components/core-popup-menu/core-popup-menu.css +0 -28
  126. data/app/assets/components/core-popup-menu/core-popup-menu.html +0 -198
  127. data/app/assets/components/core-popup-menu/core-popup-overlay.html +0 -111
  128. data/app/assets/components/core-popup-menu/metadata.html +0 -62
  129. data/app/assets/components/core-shared-lib/tests/html/core-shared-lib.html +0 -47
  130. data/app/assets/components/core-shared-lib/tests/js/htmltests.js +0 -3
  131. data/app/assets/components/core-shared-lib/tests/runner.html +0 -14
  132. data/app/assets/components/core-shared-lib/tests/tests.json +0 -6
  133. data/app/assets/components/marked/LICENSE +0 -19
  134. data/app/assets/components/marked/Makefile +0 -12
  135. data/app/assets/components/marked/package.json +0 -22
  136. data/app/assets/components/platform/platform.js +0 -16
  137. data/app/assets/components/web-animations-js/web-animations.js +0 -5529
  138. data/app/assets/components/web-animations-next/Gruntfile.js +0 -279
  139. data/app/assets/components/web-animations-next/History.md +0 -76
  140. data/app/assets/components/web-animations-next/package.json +0 -33
  141. data/app/assets/components/web-animations-next/target-config.js +0 -124
  142. data/app/assets/components/web-animations-next/target-loader.js +0 -13
  143. data/app/assets/components/web-animations-next/templates/boilerplate +0 -13
  144. data/app/assets/components/web-animations-next/templates/runner.html +0 -26
  145. data/app/assets/components/web-animations-next/templates/web-animations.html +0 -18
  146. data/app/assets/components/web-animations-next/templates/web-animations.js +0 -21
@@ -0,0 +1,1728 @@
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.5.5
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) {
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(global) {
55
+ var registrationsTable = new WeakMap();
56
+ var setImmediate;
57
+ if (/Trident|Edge/.test(navigator.userAgent)) {
58
+ setImmediate = setTimeout;
59
+ } else if (window.setImmediate) {
60
+ setImmediate = window.setImmediate;
61
+ } else {
62
+ var setImmediateQueue = [];
63
+ var sentinel = String(Math.random());
64
+ window.addEventListener("message", function(e) {
65
+ if (e.data === sentinel) {
66
+ var queue = setImmediateQueue;
67
+ setImmediateQueue = [];
68
+ queue.forEach(function(func) {
69
+ func();
70
+ });
71
+ }
72
+ });
73
+ setImmediate = function(func) {
74
+ setImmediateQueue.push(func);
75
+ window.postMessage(sentinel, "*");
76
+ };
77
+ }
78
+ var isScheduled = false;
79
+ var scheduledObservers = [];
80
+ function scheduleCallback(observer) {
81
+ scheduledObservers.push(observer);
82
+ if (!isScheduled) {
83
+ isScheduled = true;
84
+ setImmediate(dispatchCallbacks);
85
+ }
86
+ }
87
+ function wrapIfNeeded(node) {
88
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
89
+ }
90
+ function dispatchCallbacks() {
91
+ isScheduled = false;
92
+ var observers = scheduledObservers;
93
+ scheduledObservers = [];
94
+ observers.sort(function(o1, o2) {
95
+ return o1.uid_ - o2.uid_;
96
+ });
97
+ var anyNonEmpty = false;
98
+ observers.forEach(function(observer) {
99
+ var queue = observer.takeRecords();
100
+ removeTransientObserversFor(observer);
101
+ if (queue.length) {
102
+ observer.callback_(queue, observer);
103
+ anyNonEmpty = true;
104
+ }
105
+ });
106
+ if (anyNonEmpty) dispatchCallbacks();
107
+ }
108
+ function removeTransientObserversFor(observer) {
109
+ observer.nodes_.forEach(function(node) {
110
+ var registrations = registrationsTable.get(node);
111
+ if (!registrations) return;
112
+ registrations.forEach(function(registration) {
113
+ if (registration.observer === observer) registration.removeTransientObservers();
114
+ });
115
+ });
116
+ }
117
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
118
+ for (var node = target; node; node = node.parentNode) {
119
+ var registrations = registrationsTable.get(node);
120
+ if (registrations) {
121
+ for (var j = 0; j < registrations.length; j++) {
122
+ var registration = registrations[j];
123
+ var options = registration.options;
124
+ if (node !== target && !options.subtree) continue;
125
+ var record = callback(options);
126
+ if (record) registration.enqueue(record);
127
+ }
128
+ }
129
+ }
130
+ }
131
+ var uidCounter = 0;
132
+ function JsMutationObserver(callback) {
133
+ this.callback_ = callback;
134
+ this.nodes_ = [];
135
+ this.records_ = [];
136
+ this.uid_ = ++uidCounter;
137
+ }
138
+ JsMutationObserver.prototype = {
139
+ observe: function(target, options) {
140
+ target = wrapIfNeeded(target);
141
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
142
+ throw new SyntaxError();
143
+ }
144
+ var registrations = registrationsTable.get(target);
145
+ if (!registrations) registrationsTable.set(target, registrations = []);
146
+ var registration;
147
+ for (var i = 0; i < registrations.length; i++) {
148
+ if (registrations[i].observer === this) {
149
+ registration = registrations[i];
150
+ registration.removeListeners();
151
+ registration.options = options;
152
+ break;
153
+ }
154
+ }
155
+ if (!registration) {
156
+ registration = new Registration(this, target, options);
157
+ registrations.push(registration);
158
+ this.nodes_.push(target);
159
+ }
160
+ registration.addListeners();
161
+ },
162
+ disconnect: function() {
163
+ this.nodes_.forEach(function(node) {
164
+ var registrations = registrationsTable.get(node);
165
+ for (var i = 0; i < registrations.length; i++) {
166
+ var registration = registrations[i];
167
+ if (registration.observer === this) {
168
+ registration.removeListeners();
169
+ registrations.splice(i, 1);
170
+ break;
171
+ }
172
+ }
173
+ }, this);
174
+ this.records_ = [];
175
+ },
176
+ takeRecords: function() {
177
+ var copyOfRecords = this.records_;
178
+ this.records_ = [];
179
+ return copyOfRecords;
180
+ }
181
+ };
182
+ function MutationRecord(type, target) {
183
+ this.type = type;
184
+ this.target = target;
185
+ this.addedNodes = [];
186
+ this.removedNodes = [];
187
+ this.previousSibling = null;
188
+ this.nextSibling = null;
189
+ this.attributeName = null;
190
+ this.attributeNamespace = null;
191
+ this.oldValue = null;
192
+ }
193
+ function copyMutationRecord(original) {
194
+ var record = new MutationRecord(original.type, original.target);
195
+ record.addedNodes = original.addedNodes.slice();
196
+ record.removedNodes = original.removedNodes.slice();
197
+ record.previousSibling = original.previousSibling;
198
+ record.nextSibling = original.nextSibling;
199
+ record.attributeName = original.attributeName;
200
+ record.attributeNamespace = original.attributeNamespace;
201
+ record.oldValue = original.oldValue;
202
+ return record;
203
+ }
204
+ var currentRecord, recordWithOldValue;
205
+ function getRecord(type, target) {
206
+ return currentRecord = new MutationRecord(type, target);
207
+ }
208
+ function getRecordWithOldValue(oldValue) {
209
+ if (recordWithOldValue) return recordWithOldValue;
210
+ recordWithOldValue = copyMutationRecord(currentRecord);
211
+ recordWithOldValue.oldValue = oldValue;
212
+ return recordWithOldValue;
213
+ }
214
+ function clearRecords() {
215
+ currentRecord = recordWithOldValue = undefined;
216
+ }
217
+ function recordRepresentsCurrentMutation(record) {
218
+ return record === recordWithOldValue || record === currentRecord;
219
+ }
220
+ function selectRecord(lastRecord, newRecord) {
221
+ if (lastRecord === newRecord) return lastRecord;
222
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
223
+ return null;
224
+ }
225
+ function Registration(observer, target, options) {
226
+ this.observer = observer;
227
+ this.target = target;
228
+ this.options = options;
229
+ this.transientObservedNodes = [];
230
+ }
231
+ Registration.prototype = {
232
+ enqueue: function(record) {
233
+ var records = this.observer.records_;
234
+ var length = records.length;
235
+ if (records.length > 0) {
236
+ var lastRecord = records[length - 1];
237
+ var recordToReplaceLast = selectRecord(lastRecord, record);
238
+ if (recordToReplaceLast) {
239
+ records[length - 1] = recordToReplaceLast;
240
+ return;
241
+ }
242
+ } else {
243
+ scheduleCallback(this.observer);
244
+ }
245
+ records[length] = record;
246
+ },
247
+ addListeners: function() {
248
+ this.addListeners_(this.target);
249
+ },
250
+ addListeners_: function(node) {
251
+ var options = this.options;
252
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
253
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
254
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
255
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
256
+ },
257
+ removeListeners: function() {
258
+ this.removeListeners_(this.target);
259
+ },
260
+ removeListeners_: function(node) {
261
+ var options = this.options;
262
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
263
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
264
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
265
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
266
+ },
267
+ addTransientObserver: function(node) {
268
+ if (node === this.target) return;
269
+ this.addListeners_(node);
270
+ this.transientObservedNodes.push(node);
271
+ var registrations = registrationsTable.get(node);
272
+ if (!registrations) registrationsTable.set(node, registrations = []);
273
+ registrations.push(this);
274
+ },
275
+ removeTransientObservers: function() {
276
+ var transientObservedNodes = this.transientObservedNodes;
277
+ this.transientObservedNodes = [];
278
+ transientObservedNodes.forEach(function(node) {
279
+ this.removeListeners_(node);
280
+ var registrations = registrationsTable.get(node);
281
+ for (var i = 0; i < registrations.length; i++) {
282
+ if (registrations[i] === this) {
283
+ registrations.splice(i, 1);
284
+ break;
285
+ }
286
+ }
287
+ }, this);
288
+ },
289
+ handleEvent: function(e) {
290
+ e.stopImmediatePropagation();
291
+ switch (e.type) {
292
+ case "DOMAttrModified":
293
+ var name = e.attrName;
294
+ var namespace = e.relatedNode.namespaceURI;
295
+ var target = e.target;
296
+ var record = new getRecord("attributes", target);
297
+ record.attributeName = name;
298
+ record.attributeNamespace = namespace;
299
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
300
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
301
+ if (!options.attributes) return;
302
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
303
+ return;
304
+ }
305
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
306
+ return record;
307
+ });
308
+ break;
309
+
310
+ case "DOMCharacterDataModified":
311
+ var target = e.target;
312
+ var record = getRecord("characterData", target);
313
+ var oldValue = e.prevValue;
314
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
315
+ if (!options.characterData) return;
316
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
317
+ return record;
318
+ });
319
+ break;
320
+
321
+ case "DOMNodeRemoved":
322
+ this.addTransientObserver(e.target);
323
+
324
+ case "DOMNodeInserted":
325
+ var changedNode = e.target;
326
+ var addedNodes, removedNodes;
327
+ if (e.type === "DOMNodeInserted") {
328
+ addedNodes = [ changedNode ];
329
+ removedNodes = [];
330
+ } else {
331
+ addedNodes = [];
332
+ removedNodes = [ changedNode ];
333
+ }
334
+ var previousSibling = changedNode.previousSibling;
335
+ var nextSibling = changedNode.nextSibling;
336
+ var record = getRecord("childList", e.target.parentNode);
337
+ record.addedNodes = addedNodes;
338
+ record.removedNodes = removedNodes;
339
+ record.previousSibling = previousSibling;
340
+ record.nextSibling = nextSibling;
341
+ forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
342
+ if (!options.childList) return;
343
+ return record;
344
+ });
345
+ }
346
+ clearRecords();
347
+ }
348
+ };
349
+ global.JsMutationObserver = JsMutationObserver;
350
+ if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
351
+ })(this);
352
+
353
+ if (typeof WeakMap === "undefined") {
354
+ (function() {
355
+ var defineProperty = Object.defineProperty;
356
+ var counter = Date.now() % 1e9;
357
+ var WeakMap = function() {
358
+ this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
359
+ };
360
+ WeakMap.prototype = {
361
+ set: function(key, value) {
362
+ var entry = key[this.name];
363
+ if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
364
+ value: [ key, value ],
365
+ writable: true
366
+ });
367
+ return this;
368
+ },
369
+ get: function(key) {
370
+ var entry;
371
+ return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
372
+ },
373
+ "delete": function(key) {
374
+ var entry = key[this.name];
375
+ if (!entry || entry[0] !== key) return false;
376
+ entry[0] = entry[1] = undefined;
377
+ return true;
378
+ },
379
+ has: function(key) {
380
+ var entry = key[this.name];
381
+ if (!entry) return false;
382
+ return entry[0] === key;
383
+ }
384
+ };
385
+ window.WeakMap = WeakMap;
386
+ })();
387
+ }
388
+
389
+ window.HTMLImports = window.HTMLImports || {
390
+ flags: {}
391
+ };
392
+
393
+ (function(scope) {
394
+ var IMPORT_LINK_TYPE = "import";
395
+ var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
396
+ var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
397
+ var wrap = function(node) {
398
+ return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
399
+ };
400
+ var rootDocument = wrap(document);
401
+ var currentScriptDescriptor = {
402
+ get: function() {
403
+ var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
404
+ return wrap(script);
405
+ },
406
+ configurable: true
407
+ };
408
+ Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
409
+ Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
410
+ var isIE = /Trident|Edge/.test(navigator.userAgent);
411
+ function whenReady(callback, doc) {
412
+ doc = doc || rootDocument;
413
+ whenDocumentReady(function() {
414
+ watchImportsLoad(callback, doc);
415
+ }, doc);
416
+ }
417
+ var requiredReadyState = isIE ? "complete" : "interactive";
418
+ var READY_EVENT = "readystatechange";
419
+ function isDocumentReady(doc) {
420
+ return doc.readyState === "complete" || doc.readyState === requiredReadyState;
421
+ }
422
+ function whenDocumentReady(callback, doc) {
423
+ if (!isDocumentReady(doc)) {
424
+ var checkReady = function() {
425
+ if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
426
+ doc.removeEventListener(READY_EVENT, checkReady);
427
+ whenDocumentReady(callback, doc);
428
+ }
429
+ };
430
+ doc.addEventListener(READY_EVENT, checkReady);
431
+ } else if (callback) {
432
+ callback();
433
+ }
434
+ }
435
+ function markTargetLoaded(event) {
436
+ event.target.__loaded = true;
437
+ }
438
+ function watchImportsLoad(callback, doc) {
439
+ var imports = doc.querySelectorAll("link[rel=import]");
440
+ var loaded = 0, l = imports.length;
441
+ function checkDone(d) {
442
+ if (loaded == l && callback) {
443
+ callback();
444
+ }
445
+ }
446
+ function loadedImport(e) {
447
+ markTargetLoaded(e);
448
+ loaded++;
449
+ checkDone();
450
+ }
451
+ if (l) {
452
+ for (var i = 0, imp; i < l && (imp = imports[i]); i++) {
453
+ if (isImportLoaded(imp)) {
454
+ loadedImport.call(imp, {
455
+ target: imp
456
+ });
457
+ } else {
458
+ imp.addEventListener("load", loadedImport);
459
+ imp.addEventListener("error", loadedImport);
460
+ }
461
+ }
462
+ } else {
463
+ checkDone();
464
+ }
465
+ }
466
+ function isImportLoaded(link) {
467
+ return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
468
+ }
469
+ if (useNative) {
470
+ new MutationObserver(function(mxns) {
471
+ for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
472
+ if (m.addedNodes) {
473
+ handleImports(m.addedNodes);
474
+ }
475
+ }
476
+ }).observe(document.head, {
477
+ childList: true
478
+ });
479
+ function handleImports(nodes) {
480
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
481
+ if (isImport(n)) {
482
+ handleImport(n);
483
+ }
484
+ }
485
+ }
486
+ function isImport(element) {
487
+ return element.localName === "link" && element.rel === "import";
488
+ }
489
+ function handleImport(element) {
490
+ var loaded = element.import;
491
+ if (loaded) {
492
+ markTargetLoaded({
493
+ target: element
494
+ });
495
+ } else {
496
+ element.addEventListener("load", markTargetLoaded);
497
+ element.addEventListener("error", markTargetLoaded);
498
+ }
499
+ }
500
+ (function() {
501
+ if (document.readyState === "loading") {
502
+ var imports = document.querySelectorAll("link[rel=import]");
503
+ for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
504
+ handleImport(imp);
505
+ }
506
+ }
507
+ })();
508
+ }
509
+ whenReady(function() {
510
+ HTMLImports.ready = true;
511
+ HTMLImports.readyTime = new Date().getTime();
512
+ var evt = rootDocument.createEvent("CustomEvent");
513
+ evt.initCustomEvent("HTMLImportsLoaded", true, true, {});
514
+ rootDocument.dispatchEvent(evt);
515
+ });
516
+ scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
517
+ scope.useNative = useNative;
518
+ scope.rootDocument = rootDocument;
519
+ scope.whenReady = whenReady;
520
+ scope.isIE = isIE;
521
+ })(HTMLImports);
522
+
523
+ (function(scope) {
524
+ var modules = [];
525
+ var addModule = function(module) {
526
+ modules.push(module);
527
+ };
528
+ var initializeModules = function() {
529
+ modules.forEach(function(module) {
530
+ module(scope);
531
+ });
532
+ };
533
+ scope.addModule = addModule;
534
+ scope.initializeModules = initializeModules;
535
+ })(HTMLImports);
536
+
537
+ HTMLImports.addModule(function(scope) {
538
+ var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
539
+ var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
540
+ var path = {
541
+ resolveUrlsInStyle: function(style) {
542
+ var doc = style.ownerDocument;
543
+ var resolver = doc.createElement("a");
544
+ style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
545
+ return style;
546
+ },
547
+ resolveUrlsInCssText: function(cssText, urlObj) {
548
+ var r = this.replaceUrls(cssText, urlObj, CSS_URL_REGEXP);
549
+ r = this.replaceUrls(r, urlObj, CSS_IMPORT_REGEXP);
550
+ return r;
551
+ },
552
+ replaceUrls: function(text, urlObj, regexp) {
553
+ return text.replace(regexp, function(m, pre, url, post) {
554
+ var urlPath = url.replace(/["']/g, "");
555
+ urlObj.href = urlPath;
556
+ urlPath = urlObj.href;
557
+ return pre + "'" + urlPath + "'" + post;
558
+ });
559
+ }
560
+ };
561
+ scope.path = path;
562
+ });
563
+
564
+ HTMLImports.addModule(function(scope) {
565
+ var xhr = {
566
+ async: true,
567
+ ok: function(request) {
568
+ return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
569
+ },
570
+ load: function(url, next, nextContext) {
571
+ var request = new XMLHttpRequest();
572
+ if (scope.flags.debug || scope.flags.bust) {
573
+ url += "?" + Math.random();
574
+ }
575
+ request.open("GET", url, xhr.async);
576
+ request.addEventListener("readystatechange", function(e) {
577
+ if (request.readyState === 4) {
578
+ var locationHeader = request.getResponseHeader("Location");
579
+ var redirectedUrl = null;
580
+ if (locationHeader) {
581
+ var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
582
+ }
583
+ next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
584
+ }
585
+ });
586
+ request.send();
587
+ return request;
588
+ },
589
+ loadDocument: function(url, next, nextContext) {
590
+ this.load(url, next, nextContext).responseType = "document";
591
+ }
592
+ };
593
+ scope.xhr = xhr;
594
+ });
595
+
596
+ HTMLImports.addModule(function(scope) {
597
+ var xhr = scope.xhr;
598
+ var flags = scope.flags;
599
+ var Loader = function(onLoad, onComplete) {
600
+ this.cache = {};
601
+ this.onload = onLoad;
602
+ this.oncomplete = onComplete;
603
+ this.inflight = 0;
604
+ this.pending = {};
605
+ };
606
+ Loader.prototype = {
607
+ addNodes: function(nodes) {
608
+ this.inflight += nodes.length;
609
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
610
+ this.require(n);
611
+ }
612
+ this.checkDone();
613
+ },
614
+ addNode: function(node) {
615
+ this.inflight++;
616
+ this.require(node);
617
+ this.checkDone();
618
+ },
619
+ require: function(elt) {
620
+ var url = elt.src || elt.href;
621
+ elt.__nodeUrl = url;
622
+ if (!this.dedupe(url, elt)) {
623
+ this.fetch(url, elt);
624
+ }
625
+ },
626
+ dedupe: function(url, elt) {
627
+ if (this.pending[url]) {
628
+ this.pending[url].push(elt);
629
+ return true;
630
+ }
631
+ var resource;
632
+ if (this.cache[url]) {
633
+ this.onload(url, elt, this.cache[url]);
634
+ this.tail();
635
+ return true;
636
+ }
637
+ this.pending[url] = [ elt ];
638
+ return false;
639
+ },
640
+ fetch: function(url, elt) {
641
+ flags.load && console.log("fetch", url, elt);
642
+ if (!url) {
643
+ setTimeout(function() {
644
+ this.receive(url, elt, {
645
+ error: "href must be specified"
646
+ }, null);
647
+ }.bind(this), 0);
648
+ } else if (url.match(/^data:/)) {
649
+ var pieces = url.split(",");
650
+ var header = pieces[0];
651
+ var body = pieces[1];
652
+ if (header.indexOf(";base64") > -1) {
653
+ body = atob(body);
654
+ } else {
655
+ body = decodeURIComponent(body);
656
+ }
657
+ setTimeout(function() {
658
+ this.receive(url, elt, null, body);
659
+ }.bind(this), 0);
660
+ } else {
661
+ var receiveXhr = function(err, resource, redirectedUrl) {
662
+ this.receive(url, elt, err, resource, redirectedUrl);
663
+ }.bind(this);
664
+ xhr.load(url, receiveXhr);
665
+ }
666
+ },
667
+ receive: function(url, elt, err, resource, redirectedUrl) {
668
+ this.cache[url] = resource;
669
+ var $p = this.pending[url];
670
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
671
+ this.onload(url, p, resource, err, redirectedUrl);
672
+ this.tail();
673
+ }
674
+ this.pending[url] = null;
675
+ },
676
+ tail: function() {
677
+ --this.inflight;
678
+ this.checkDone();
679
+ },
680
+ checkDone: function() {
681
+ if (!this.inflight) {
682
+ this.oncomplete();
683
+ }
684
+ }
685
+ };
686
+ scope.Loader = Loader;
687
+ });
688
+
689
+ HTMLImports.addModule(function(scope) {
690
+ var Observer = function(addCallback) {
691
+ this.addCallback = addCallback;
692
+ this.mo = new MutationObserver(this.handler.bind(this));
693
+ };
694
+ Observer.prototype = {
695
+ handler: function(mutations) {
696
+ for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
697
+ if (m.type === "childList" && m.addedNodes.length) {
698
+ this.addedNodes(m.addedNodes);
699
+ }
700
+ }
701
+ },
702
+ addedNodes: function(nodes) {
703
+ if (this.addCallback) {
704
+ this.addCallback(nodes);
705
+ }
706
+ for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
707
+ if (n.children && n.children.length) {
708
+ this.addedNodes(n.children);
709
+ }
710
+ }
711
+ },
712
+ observe: function(root) {
713
+ this.mo.observe(root, {
714
+ childList: true,
715
+ subtree: true
716
+ });
717
+ }
718
+ };
719
+ scope.Observer = Observer;
720
+ });
721
+
722
+ HTMLImports.addModule(function(scope) {
723
+ var path = scope.path;
724
+ var rootDocument = scope.rootDocument;
725
+ var flags = scope.flags;
726
+ var isIE = scope.isIE;
727
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
728
+ var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
729
+ var importParser = {
730
+ documentSelectors: IMPORT_SELECTOR,
731
+ importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
732
+ map: {
733
+ link: "parseLink",
734
+ script: "parseScript",
735
+ style: "parseStyle"
736
+ },
737
+ dynamicElements: [],
738
+ parseNext: function() {
739
+ var next = this.nextToParse();
740
+ if (next) {
741
+ this.parse(next);
742
+ }
743
+ },
744
+ parse: function(elt) {
745
+ if (this.isParsed(elt)) {
746
+ flags.parse && console.log("[%s] is already parsed", elt.localName);
747
+ return;
748
+ }
749
+ var fn = this[this.map[elt.localName]];
750
+ if (fn) {
751
+ this.markParsing(elt);
752
+ fn.call(this, elt);
753
+ }
754
+ },
755
+ parseDynamic: function(elt, quiet) {
756
+ this.dynamicElements.push(elt);
757
+ if (!quiet) {
758
+ this.parseNext();
759
+ }
760
+ },
761
+ markParsing: function(elt) {
762
+ flags.parse && console.log("parsing", elt);
763
+ this.parsingElement = elt;
764
+ },
765
+ markParsingComplete: function(elt) {
766
+ elt.__importParsed = true;
767
+ this.markDynamicParsingComplete(elt);
768
+ if (elt.__importElement) {
769
+ elt.__importElement.__importParsed = true;
770
+ this.markDynamicParsingComplete(elt.__importElement);
771
+ }
772
+ this.parsingElement = null;
773
+ flags.parse && console.log("completed", elt);
774
+ },
775
+ markDynamicParsingComplete: function(elt) {
776
+ var i = this.dynamicElements.indexOf(elt);
777
+ if (i >= 0) {
778
+ this.dynamicElements.splice(i, 1);
779
+ }
780
+ },
781
+ parseImport: function(elt) {
782
+ if (HTMLImports.__importsParsingHook) {
783
+ HTMLImports.__importsParsingHook(elt);
784
+ }
785
+ if (elt.import) {
786
+ elt.import.__importParsed = true;
787
+ }
788
+ this.markParsingComplete(elt);
789
+ if (elt.__resource && !elt.__error) {
790
+ elt.dispatchEvent(new CustomEvent("load", {
791
+ bubbles: false
792
+ }));
793
+ } else {
794
+ elt.dispatchEvent(new CustomEvent("error", {
795
+ bubbles: false
796
+ }));
797
+ }
798
+ if (elt.__pending) {
799
+ var fn;
800
+ while (elt.__pending.length) {
801
+ fn = elt.__pending.shift();
802
+ if (fn) {
803
+ fn({
804
+ target: elt
805
+ });
806
+ }
807
+ }
808
+ }
809
+ this.parseNext();
810
+ },
811
+ parseLink: function(linkElt) {
812
+ if (nodeIsImport(linkElt)) {
813
+ this.parseImport(linkElt);
814
+ } else {
815
+ linkElt.href = linkElt.href;
816
+ this.parseGeneric(linkElt);
817
+ }
818
+ },
819
+ parseStyle: function(elt) {
820
+ var src = elt;
821
+ elt = cloneStyle(elt);
822
+ elt.__importElement = src;
823
+ this.parseGeneric(elt);
824
+ },
825
+ parseGeneric: function(elt) {
826
+ this.trackElement(elt);
827
+ this.addElementToDocument(elt);
828
+ },
829
+ rootImportForElement: function(elt) {
830
+ var n = elt;
831
+ while (n.ownerDocument.__importLink) {
832
+ n = n.ownerDocument.__importLink;
833
+ }
834
+ return n;
835
+ },
836
+ addElementToDocument: function(elt) {
837
+ var port = this.rootImportForElement(elt.__importElement || elt);
838
+ port.parentNode.insertBefore(elt, port);
839
+ },
840
+ trackElement: function(elt, callback) {
841
+ var self = this;
842
+ var done = function(e) {
843
+ if (callback) {
844
+ callback(e);
845
+ }
846
+ self.markParsingComplete(elt);
847
+ self.parseNext();
848
+ };
849
+ elt.addEventListener("load", done);
850
+ elt.addEventListener("error", done);
851
+ if (isIE && elt.localName === "style") {
852
+ var fakeLoad = false;
853
+ if (elt.textContent.indexOf("@import") == -1) {
854
+ fakeLoad = true;
855
+ } else if (elt.sheet) {
856
+ fakeLoad = true;
857
+ var csr = elt.sheet.cssRules;
858
+ var len = csr ? csr.length : 0;
859
+ for (var i = 0, r; i < len && (r = csr[i]); i++) {
860
+ if (r.type === CSSRule.IMPORT_RULE) {
861
+ fakeLoad = fakeLoad && Boolean(r.styleSheet);
862
+ }
863
+ }
864
+ }
865
+ if (fakeLoad) {
866
+ elt.dispatchEvent(new CustomEvent("load", {
867
+ bubbles: false
868
+ }));
869
+ }
870
+ }
871
+ },
872
+ parseScript: function(scriptElt) {
873
+ var script = document.createElement("script");
874
+ script.__importElement = scriptElt;
875
+ script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
876
+ scope.currentScript = scriptElt;
877
+ this.trackElement(script, function(e) {
878
+ script.parentNode.removeChild(script);
879
+ scope.currentScript = null;
880
+ });
881
+ this.addElementToDocument(script);
882
+ },
883
+ nextToParse: function() {
884
+ this._mayParse = [];
885
+ return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
886
+ },
887
+ nextToParseInDoc: function(doc, link) {
888
+ if (doc && this._mayParse.indexOf(doc) < 0) {
889
+ this._mayParse.push(doc);
890
+ var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
891
+ for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
892
+ if (!this.isParsed(n)) {
893
+ if (this.hasResource(n)) {
894
+ return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
895
+ } else {
896
+ return;
897
+ }
898
+ }
899
+ }
900
+ }
901
+ return link;
902
+ },
903
+ nextToParseDynamic: function() {
904
+ return this.dynamicElements[0];
905
+ },
906
+ parseSelectorsForNode: function(node) {
907
+ var doc = node.ownerDocument || node;
908
+ return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
909
+ },
910
+ isParsed: function(node) {
911
+ return node.__importParsed;
912
+ },
913
+ needsDynamicParsing: function(elt) {
914
+ return this.dynamicElements.indexOf(elt) >= 0;
915
+ },
916
+ hasResource: function(node) {
917
+ if (nodeIsImport(node) && node.import === undefined) {
918
+ return false;
919
+ }
920
+ return true;
921
+ }
922
+ };
923
+ function nodeIsImport(elt) {
924
+ return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
925
+ }
926
+ function generateScriptDataUrl(script) {
927
+ var scriptContent = generateScriptContent(script);
928
+ return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
929
+ }
930
+ function generateScriptContent(script) {
931
+ return script.textContent + generateSourceMapHint(script);
932
+ }
933
+ function generateSourceMapHint(script) {
934
+ var owner = script.ownerDocument;
935
+ owner.__importedScripts = owner.__importedScripts || 0;
936
+ var moniker = script.ownerDocument.baseURI;
937
+ var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
938
+ owner.__importedScripts++;
939
+ return "\n//# sourceURL=" + moniker + num + ".js\n";
940
+ }
941
+ function cloneStyle(style) {
942
+ var clone = style.ownerDocument.createElement("style");
943
+ clone.textContent = style.textContent;
944
+ path.resolveUrlsInStyle(clone);
945
+ return clone;
946
+ }
947
+ scope.parser = importParser;
948
+ scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
949
+ });
950
+
951
+ HTMLImports.addModule(function(scope) {
952
+ var flags = scope.flags;
953
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
954
+ var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
955
+ var rootDocument = scope.rootDocument;
956
+ var Loader = scope.Loader;
957
+ var Observer = scope.Observer;
958
+ var parser = scope.parser;
959
+ var importer = {
960
+ documents: {},
961
+ documentPreloadSelectors: IMPORT_SELECTOR,
962
+ importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
963
+ loadNode: function(node) {
964
+ importLoader.addNode(node);
965
+ },
966
+ loadSubtree: function(parent) {
967
+ var nodes = this.marshalNodes(parent);
968
+ importLoader.addNodes(nodes);
969
+ },
970
+ marshalNodes: function(parent) {
971
+ return parent.querySelectorAll(this.loadSelectorsForNode(parent));
972
+ },
973
+ loadSelectorsForNode: function(node) {
974
+ var doc = node.ownerDocument || node;
975
+ return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
976
+ },
977
+ loaded: function(url, elt, resource, err, redirectedUrl) {
978
+ flags.load && console.log("loaded", url, elt);
979
+ elt.__resource = resource;
980
+ elt.__error = err;
981
+ if (isImportLink(elt)) {
982
+ var doc = this.documents[url];
983
+ if (doc === undefined) {
984
+ doc = err ? null : makeDocument(resource, redirectedUrl || url);
985
+ if (doc) {
986
+ doc.__importLink = elt;
987
+ this.bootDocument(doc);
988
+ }
989
+ this.documents[url] = doc;
990
+ }
991
+ elt.import = doc;
992
+ }
993
+ parser.parseNext();
994
+ },
995
+ bootDocument: function(doc) {
996
+ this.loadSubtree(doc);
997
+ this.observer.observe(doc);
998
+ parser.parseNext();
999
+ },
1000
+ loadedAll: function() {
1001
+ parser.parseNext();
1002
+ }
1003
+ };
1004
+ var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
1005
+ importer.observer = new Observer();
1006
+ function isImportLink(elt) {
1007
+ return isLinkRel(elt, IMPORT_LINK_TYPE);
1008
+ }
1009
+ function isLinkRel(elt, rel) {
1010
+ return elt.localName === "link" && elt.getAttribute("rel") === rel;
1011
+ }
1012
+ function hasBaseURIAccessor(doc) {
1013
+ return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
1014
+ }
1015
+ function makeDocument(resource, url) {
1016
+ var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
1017
+ doc._URL = url;
1018
+ var base = doc.createElement("base");
1019
+ base.setAttribute("href", url);
1020
+ if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
1021
+ Object.defineProperty(doc, "baseURI", {
1022
+ value: url
1023
+ });
1024
+ }
1025
+ var meta = doc.createElement("meta");
1026
+ meta.setAttribute("charset", "utf-8");
1027
+ doc.head.appendChild(meta);
1028
+ doc.head.appendChild(base);
1029
+ doc.body.innerHTML = resource;
1030
+ if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
1031
+ HTMLTemplateElement.bootstrap(doc);
1032
+ }
1033
+ return doc;
1034
+ }
1035
+ if (!document.baseURI) {
1036
+ var baseURIDescriptor = {
1037
+ get: function() {
1038
+ var base = document.querySelector("base");
1039
+ return base ? base.href : window.location.href;
1040
+ },
1041
+ configurable: true
1042
+ };
1043
+ Object.defineProperty(document, "baseURI", baseURIDescriptor);
1044
+ Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
1045
+ }
1046
+ scope.importer = importer;
1047
+ scope.importLoader = importLoader;
1048
+ });
1049
+
1050
+ HTMLImports.addModule(function(scope) {
1051
+ var parser = scope.parser;
1052
+ var importer = scope.importer;
1053
+ var dynamic = {
1054
+ added: function(nodes) {
1055
+ var owner, parsed, loading;
1056
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1057
+ if (!owner) {
1058
+ owner = n.ownerDocument;
1059
+ parsed = parser.isParsed(owner);
1060
+ }
1061
+ loading = this.shouldLoadNode(n);
1062
+ if (loading) {
1063
+ importer.loadNode(n);
1064
+ }
1065
+ if (this.shouldParseNode(n) && parsed) {
1066
+ parser.parseDynamic(n, loading);
1067
+ }
1068
+ }
1069
+ },
1070
+ shouldLoadNode: function(node) {
1071
+ return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
1072
+ },
1073
+ shouldParseNode: function(node) {
1074
+ return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
1075
+ }
1076
+ };
1077
+ importer.observer.addCallback = dynamic.added.bind(dynamic);
1078
+ var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
1079
+ });
1080
+
1081
+ (function(scope) {
1082
+ var initializeModules = scope.initializeModules;
1083
+ var isIE = scope.isIE;
1084
+ if (scope.useNative) {
1085
+ return;
1086
+ }
1087
+ if (isIE && typeof window.CustomEvent !== "function") {
1088
+ window.CustomEvent = function(inType, params) {
1089
+ params = params || {};
1090
+ var e = document.createEvent("CustomEvent");
1091
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
1092
+ return e;
1093
+ };
1094
+ window.CustomEvent.prototype = window.Event.prototype;
1095
+ }
1096
+ initializeModules();
1097
+ var rootDocument = scope.rootDocument;
1098
+ function bootstrap() {
1099
+ HTMLImports.importer.bootDocument(rootDocument);
1100
+ }
1101
+ if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
1102
+ bootstrap();
1103
+ } else {
1104
+ document.addEventListener("DOMContentLoaded", bootstrap);
1105
+ }
1106
+ })(HTMLImports);
1107
+
1108
+ window.CustomElements = window.CustomElements || {
1109
+ flags: {}
1110
+ };
1111
+
1112
+ (function(scope) {
1113
+ var flags = scope.flags;
1114
+ var modules = [];
1115
+ var addModule = function(module) {
1116
+ modules.push(module);
1117
+ };
1118
+ var initializeModules = function() {
1119
+ modules.forEach(function(module) {
1120
+ module(scope);
1121
+ });
1122
+ };
1123
+ scope.addModule = addModule;
1124
+ scope.initializeModules = initializeModules;
1125
+ scope.hasNative = Boolean(document.registerElement);
1126
+ scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
1127
+ })(CustomElements);
1128
+
1129
+ CustomElements.addModule(function(scope) {
1130
+ var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
1131
+ function forSubtree(node, cb) {
1132
+ findAllElements(node, function(e) {
1133
+ if (cb(e)) {
1134
+ return true;
1135
+ }
1136
+ forRoots(e, cb);
1137
+ });
1138
+ forRoots(node, cb);
1139
+ }
1140
+ function findAllElements(node, find, data) {
1141
+ var e = node.firstElementChild;
1142
+ if (!e) {
1143
+ e = node.firstChild;
1144
+ while (e && e.nodeType !== Node.ELEMENT_NODE) {
1145
+ e = e.nextSibling;
1146
+ }
1147
+ }
1148
+ while (e) {
1149
+ if (find(e, data) !== true) {
1150
+ findAllElements(e, find, data);
1151
+ }
1152
+ e = e.nextElementSibling;
1153
+ }
1154
+ return null;
1155
+ }
1156
+ function forRoots(node, cb) {
1157
+ var root = node.shadowRoot;
1158
+ while (root) {
1159
+ forSubtree(root, cb);
1160
+ root = root.olderShadowRoot;
1161
+ }
1162
+ }
1163
+ var processingDocuments;
1164
+ function forDocumentTree(doc, cb) {
1165
+ processingDocuments = [];
1166
+ _forDocumentTree(doc, cb);
1167
+ processingDocuments = null;
1168
+ }
1169
+ function _forDocumentTree(doc, cb) {
1170
+ doc = wrap(doc);
1171
+ if (processingDocuments.indexOf(doc) >= 0) {
1172
+ return;
1173
+ }
1174
+ processingDocuments.push(doc);
1175
+ var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
1176
+ for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
1177
+ if (n.import) {
1178
+ _forDocumentTree(n.import, cb);
1179
+ }
1180
+ }
1181
+ cb(doc);
1182
+ }
1183
+ scope.forDocumentTree = forDocumentTree;
1184
+ scope.forSubtree = forSubtree;
1185
+ });
1186
+
1187
+ CustomElements.addModule(function(scope) {
1188
+ var flags = scope.flags;
1189
+ var forSubtree = scope.forSubtree;
1190
+ var forDocumentTree = scope.forDocumentTree;
1191
+ function addedNode(node) {
1192
+ return added(node) || addedSubtree(node);
1193
+ }
1194
+ function added(node) {
1195
+ if (scope.upgrade(node)) {
1196
+ return true;
1197
+ }
1198
+ attached(node);
1199
+ }
1200
+ function addedSubtree(node) {
1201
+ forSubtree(node, function(e) {
1202
+ if (added(e)) {
1203
+ return true;
1204
+ }
1205
+ });
1206
+ }
1207
+ function attachedNode(node) {
1208
+ attached(node);
1209
+ if (inDocument(node)) {
1210
+ forSubtree(node, function(e) {
1211
+ attached(e);
1212
+ });
1213
+ }
1214
+ }
1215
+ var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
1216
+ scope.hasPolyfillMutations = hasPolyfillMutations;
1217
+ var isPendingMutations = false;
1218
+ var pendingMutations = [];
1219
+ function deferMutation(fn) {
1220
+ pendingMutations.push(fn);
1221
+ if (!isPendingMutations) {
1222
+ isPendingMutations = true;
1223
+ setTimeout(takeMutations);
1224
+ }
1225
+ }
1226
+ function takeMutations() {
1227
+ isPendingMutations = false;
1228
+ var $p = pendingMutations;
1229
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
1230
+ p();
1231
+ }
1232
+ pendingMutations = [];
1233
+ }
1234
+ function attached(element) {
1235
+ if (hasPolyfillMutations) {
1236
+ deferMutation(function() {
1237
+ _attached(element);
1238
+ });
1239
+ } else {
1240
+ _attached(element);
1241
+ }
1242
+ }
1243
+ function _attached(element) {
1244
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
1245
+ if (!element.__attached && inDocument(element)) {
1246
+ element.__attached = true;
1247
+ if (element.attachedCallback) {
1248
+ element.attachedCallback();
1249
+ }
1250
+ }
1251
+ }
1252
+ }
1253
+ function detachedNode(node) {
1254
+ detached(node);
1255
+ forSubtree(node, function(e) {
1256
+ detached(e);
1257
+ });
1258
+ }
1259
+ function detached(element) {
1260
+ if (hasPolyfillMutations) {
1261
+ deferMutation(function() {
1262
+ _detached(element);
1263
+ });
1264
+ } else {
1265
+ _detached(element);
1266
+ }
1267
+ }
1268
+ function _detached(element) {
1269
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
1270
+ if (element.__attached && !inDocument(element)) {
1271
+ element.__attached = false;
1272
+ if (element.detachedCallback) {
1273
+ element.detachedCallback();
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+ function inDocument(element) {
1279
+ var p = element;
1280
+ var doc = wrap(document);
1281
+ while (p) {
1282
+ if (p == doc) {
1283
+ return true;
1284
+ }
1285
+ p = p.parentNode || p.host;
1286
+ }
1287
+ }
1288
+ function watchShadow(node) {
1289
+ if (node.shadowRoot && !node.shadowRoot.__watched) {
1290
+ flags.dom && console.log("watching shadow-root for: ", node.localName);
1291
+ var root = node.shadowRoot;
1292
+ while (root) {
1293
+ observe(root);
1294
+ root = root.olderShadowRoot;
1295
+ }
1296
+ }
1297
+ }
1298
+ function handler(mutations) {
1299
+ if (flags.dom) {
1300
+ var mx = mutations[0];
1301
+ if (mx && mx.type === "childList" && mx.addedNodes) {
1302
+ if (mx.addedNodes) {
1303
+ var d = mx.addedNodes[0];
1304
+ while (d && d !== document && !d.host) {
1305
+ d = d.parentNode;
1306
+ }
1307
+ var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
1308
+ u = u.split("/?").shift().split("/").pop();
1309
+ }
1310
+ }
1311
+ console.group("mutations (%d) [%s]", mutations.length, u || "");
1312
+ }
1313
+ mutations.forEach(function(mx) {
1314
+ if (mx.type === "childList") {
1315
+ forEach(mx.addedNodes, function(n) {
1316
+ if (!n.localName) {
1317
+ return;
1318
+ }
1319
+ addedNode(n);
1320
+ });
1321
+ forEach(mx.removedNodes, function(n) {
1322
+ if (!n.localName) {
1323
+ return;
1324
+ }
1325
+ detachedNode(n);
1326
+ });
1327
+ }
1328
+ });
1329
+ flags.dom && console.groupEnd();
1330
+ }
1331
+ function takeRecords(node) {
1332
+ node = wrap(node);
1333
+ if (!node) {
1334
+ node = wrap(document);
1335
+ }
1336
+ while (node.parentNode) {
1337
+ node = node.parentNode;
1338
+ }
1339
+ var observer = node.__observer;
1340
+ if (observer) {
1341
+ handler(observer.takeRecords());
1342
+ takeMutations();
1343
+ }
1344
+ }
1345
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
1346
+ function observe(inRoot) {
1347
+ if (inRoot.__observer) {
1348
+ return;
1349
+ }
1350
+ var observer = new MutationObserver(handler);
1351
+ observer.observe(inRoot, {
1352
+ childList: true,
1353
+ subtree: true
1354
+ });
1355
+ inRoot.__observer = observer;
1356
+ }
1357
+ function upgradeDocument(doc) {
1358
+ doc = wrap(doc);
1359
+ flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
1360
+ addedNode(doc);
1361
+ observe(doc);
1362
+ flags.dom && console.groupEnd();
1363
+ }
1364
+ function upgradeDocumentTree(doc) {
1365
+ forDocumentTree(doc, upgradeDocument);
1366
+ }
1367
+ var originalCreateShadowRoot = Element.prototype.createShadowRoot;
1368
+ if (originalCreateShadowRoot) {
1369
+ Element.prototype.createShadowRoot = function() {
1370
+ var root = originalCreateShadowRoot.call(this);
1371
+ CustomElements.watchShadow(this);
1372
+ return root;
1373
+ };
1374
+ }
1375
+ scope.watchShadow = watchShadow;
1376
+ scope.upgradeDocumentTree = upgradeDocumentTree;
1377
+ scope.upgradeSubtree = addedSubtree;
1378
+ scope.upgradeAll = addedNode;
1379
+ scope.attachedNode = attachedNode;
1380
+ scope.takeRecords = takeRecords;
1381
+ });
1382
+
1383
+ CustomElements.addModule(function(scope) {
1384
+ var flags = scope.flags;
1385
+ function upgrade(node) {
1386
+ if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
1387
+ var is = node.getAttribute("is");
1388
+ var definition = scope.getRegisteredDefinition(is || node.localName);
1389
+ if (definition) {
1390
+ if (is && definition.tag == node.localName) {
1391
+ return upgradeWithDefinition(node, definition);
1392
+ } else if (!is && !definition.extends) {
1393
+ return upgradeWithDefinition(node, definition);
1394
+ }
1395
+ }
1396
+ }
1397
+ }
1398
+ function upgradeWithDefinition(element, definition) {
1399
+ flags.upgrade && console.group("upgrade:", element.localName);
1400
+ if (definition.is) {
1401
+ element.setAttribute("is", definition.is);
1402
+ }
1403
+ implementPrototype(element, definition);
1404
+ element.__upgraded__ = true;
1405
+ created(element);
1406
+ scope.attachedNode(element);
1407
+ scope.upgradeSubtree(element);
1408
+ flags.upgrade && console.groupEnd();
1409
+ return element;
1410
+ }
1411
+ function implementPrototype(element, definition) {
1412
+ if (Object.__proto__) {
1413
+ element.__proto__ = definition.prototype;
1414
+ } else {
1415
+ customMixin(element, definition.prototype, definition.native);
1416
+ element.__proto__ = definition.prototype;
1417
+ }
1418
+ }
1419
+ function customMixin(inTarget, inSrc, inNative) {
1420
+ var used = {};
1421
+ var p = inSrc;
1422
+ while (p !== inNative && p !== HTMLElement.prototype) {
1423
+ var keys = Object.getOwnPropertyNames(p);
1424
+ for (var i = 0, k; k = keys[i]; i++) {
1425
+ if (!used[k]) {
1426
+ Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
1427
+ used[k] = 1;
1428
+ }
1429
+ }
1430
+ p = Object.getPrototypeOf(p);
1431
+ }
1432
+ }
1433
+ function created(element) {
1434
+ if (element.createdCallback) {
1435
+ element.createdCallback();
1436
+ }
1437
+ }
1438
+ scope.upgrade = upgrade;
1439
+ scope.upgradeWithDefinition = upgradeWithDefinition;
1440
+ scope.implementPrototype = implementPrototype;
1441
+ });
1442
+
1443
+ CustomElements.addModule(function(scope) {
1444
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
1445
+ var upgrade = scope.upgrade;
1446
+ var upgradeWithDefinition = scope.upgradeWithDefinition;
1447
+ var implementPrototype = scope.implementPrototype;
1448
+ var useNative = scope.useNative;
1449
+ function register(name, options) {
1450
+ var definition = options || {};
1451
+ if (!name) {
1452
+ throw new Error("document.registerElement: first argument `name` must not be empty");
1453
+ }
1454
+ if (name.indexOf("-") < 0) {
1455
+ throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
1456
+ }
1457
+ if (isReservedTag(name)) {
1458
+ throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
1459
+ }
1460
+ if (getRegisteredDefinition(name)) {
1461
+ throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
1462
+ }
1463
+ if (!definition.prototype) {
1464
+ definition.prototype = Object.create(HTMLElement.prototype);
1465
+ }
1466
+ definition.__name = name.toLowerCase();
1467
+ definition.lifecycle = definition.lifecycle || {};
1468
+ definition.ancestry = ancestry(definition.extends);
1469
+ resolveTagName(definition);
1470
+ resolvePrototypeChain(definition);
1471
+ overrideAttributeApi(definition.prototype);
1472
+ registerDefinition(definition.__name, definition);
1473
+ definition.ctor = generateConstructor(definition);
1474
+ definition.ctor.prototype = definition.prototype;
1475
+ definition.prototype.constructor = definition.ctor;
1476
+ if (scope.ready) {
1477
+ upgradeDocumentTree(document);
1478
+ }
1479
+ return definition.ctor;
1480
+ }
1481
+ function overrideAttributeApi(prototype) {
1482
+ if (prototype.setAttribute._polyfilled) {
1483
+ return;
1484
+ }
1485
+ var setAttribute = prototype.setAttribute;
1486
+ prototype.setAttribute = function(name, value) {
1487
+ changeAttribute.call(this, name, value, setAttribute);
1488
+ };
1489
+ var removeAttribute = prototype.removeAttribute;
1490
+ prototype.removeAttribute = function(name) {
1491
+ changeAttribute.call(this, name, null, removeAttribute);
1492
+ };
1493
+ prototype.setAttribute._polyfilled = true;
1494
+ }
1495
+ function changeAttribute(name, value, operation) {
1496
+ name = name.toLowerCase();
1497
+ var oldValue = this.getAttribute(name);
1498
+ operation.apply(this, arguments);
1499
+ var newValue = this.getAttribute(name);
1500
+ if (this.attributeChangedCallback && newValue !== oldValue) {
1501
+ this.attributeChangedCallback(name, oldValue, newValue);
1502
+ }
1503
+ }
1504
+ function isReservedTag(name) {
1505
+ for (var i = 0; i < reservedTagList.length; i++) {
1506
+ if (name === reservedTagList[i]) {
1507
+ return true;
1508
+ }
1509
+ }
1510
+ }
1511
+ var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
1512
+ function ancestry(extnds) {
1513
+ var extendee = getRegisteredDefinition(extnds);
1514
+ if (extendee) {
1515
+ return ancestry(extendee.extends).concat([ extendee ]);
1516
+ }
1517
+ return [];
1518
+ }
1519
+ function resolveTagName(definition) {
1520
+ var baseTag = definition.extends;
1521
+ for (var i = 0, a; a = definition.ancestry[i]; i++) {
1522
+ baseTag = a.is && a.tag;
1523
+ }
1524
+ definition.tag = baseTag || definition.__name;
1525
+ if (baseTag) {
1526
+ definition.is = definition.__name;
1527
+ }
1528
+ }
1529
+ function resolvePrototypeChain(definition) {
1530
+ if (!Object.__proto__) {
1531
+ var nativePrototype = HTMLElement.prototype;
1532
+ if (definition.is) {
1533
+ var inst = document.createElement(definition.tag);
1534
+ var expectedPrototype = Object.getPrototypeOf(inst);
1535
+ if (expectedPrototype === definition.prototype) {
1536
+ nativePrototype = expectedPrototype;
1537
+ }
1538
+ }
1539
+ var proto = definition.prototype, ancestor;
1540
+ while (proto && proto !== nativePrototype) {
1541
+ ancestor = Object.getPrototypeOf(proto);
1542
+ proto.__proto__ = ancestor;
1543
+ proto = ancestor;
1544
+ }
1545
+ definition.native = nativePrototype;
1546
+ }
1547
+ }
1548
+ function instantiate(definition) {
1549
+ return upgradeWithDefinition(domCreateElement(definition.tag), definition);
1550
+ }
1551
+ var registry = {};
1552
+ function getRegisteredDefinition(name) {
1553
+ if (name) {
1554
+ return registry[name.toLowerCase()];
1555
+ }
1556
+ }
1557
+ function registerDefinition(name, definition) {
1558
+ registry[name] = definition;
1559
+ }
1560
+ function generateConstructor(definition) {
1561
+ return function() {
1562
+ return instantiate(definition);
1563
+ };
1564
+ }
1565
+ var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1566
+ function createElementNS(namespace, tag, typeExtension) {
1567
+ if (namespace === HTML_NAMESPACE) {
1568
+ return createElement(tag, typeExtension);
1569
+ } else {
1570
+ return domCreateElementNS(namespace, tag);
1571
+ }
1572
+ }
1573
+ function createElement(tag, typeExtension) {
1574
+ var definition = getRegisteredDefinition(typeExtension || tag);
1575
+ if (definition) {
1576
+ if (tag == definition.tag && typeExtension == definition.is) {
1577
+ return new definition.ctor();
1578
+ }
1579
+ if (!typeExtension && !definition.is) {
1580
+ return new definition.ctor();
1581
+ }
1582
+ }
1583
+ var element;
1584
+ if (typeExtension) {
1585
+ element = createElement(tag);
1586
+ element.setAttribute("is", typeExtension);
1587
+ return element;
1588
+ }
1589
+ element = domCreateElement(tag);
1590
+ if (tag.indexOf("-") >= 0) {
1591
+ implementPrototype(element, HTMLElement);
1592
+ }
1593
+ return element;
1594
+ }
1595
+ function cloneNode(deep) {
1596
+ var n = domCloneNode.call(this, deep);
1597
+ upgrade(n);
1598
+ return n;
1599
+ }
1600
+ var domCreateElement = document.createElement.bind(document);
1601
+ var domCreateElementNS = document.createElementNS.bind(document);
1602
+ var domCloneNode = Node.prototype.cloneNode;
1603
+ var isInstance;
1604
+ if (!Object.__proto__ && !useNative) {
1605
+ isInstance = function(obj, ctor) {
1606
+ var p = obj;
1607
+ while (p) {
1608
+ if (p === ctor.prototype) {
1609
+ return true;
1610
+ }
1611
+ p = p.__proto__;
1612
+ }
1613
+ return false;
1614
+ };
1615
+ } else {
1616
+ isInstance = function(obj, base) {
1617
+ return obj instanceof base;
1618
+ };
1619
+ }
1620
+ document.registerElement = register;
1621
+ document.createElement = createElement;
1622
+ document.createElementNS = createElementNS;
1623
+ Node.prototype.cloneNode = cloneNode;
1624
+ scope.registry = registry;
1625
+ scope.instanceof = isInstance;
1626
+ scope.reservedTagList = reservedTagList;
1627
+ scope.getRegisteredDefinition = getRegisteredDefinition;
1628
+ document.register = document.registerElement;
1629
+ });
1630
+
1631
+ (function(scope) {
1632
+ var useNative = scope.useNative;
1633
+ var initializeModules = scope.initializeModules;
1634
+ var isIE11OrOlder = /Trident/.test(navigator.userAgent);
1635
+ if (useNative) {
1636
+ var nop = function() {};
1637
+ scope.watchShadow = nop;
1638
+ scope.upgrade = nop;
1639
+ scope.upgradeAll = nop;
1640
+ scope.upgradeDocumentTree = nop;
1641
+ scope.upgradeSubtree = nop;
1642
+ scope.takeRecords = nop;
1643
+ scope.instanceof = function(obj, base) {
1644
+ return obj instanceof base;
1645
+ };
1646
+ } else {
1647
+ initializeModules();
1648
+ }
1649
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
1650
+ if (!window.wrap) {
1651
+ if (window.ShadowDOMPolyfill) {
1652
+ window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
1653
+ window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
1654
+ } else {
1655
+ window.wrap = window.unwrap = function(node) {
1656
+ return node;
1657
+ };
1658
+ }
1659
+ }
1660
+ function bootstrap() {
1661
+ upgradeDocumentTree(wrap(document));
1662
+ if (window.HTMLImports) {
1663
+ HTMLImports.__importsParsingHook = function(elt) {
1664
+ upgradeDocumentTree(wrap(elt.import));
1665
+ };
1666
+ }
1667
+ CustomElements.ready = true;
1668
+ setTimeout(function() {
1669
+ CustomElements.readyTime = Date.now();
1670
+ if (window.HTMLImports) {
1671
+ CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
1672
+ }
1673
+ document.dispatchEvent(new CustomEvent("WebComponentsReady", {
1674
+ bubbles: true
1675
+ }));
1676
+ });
1677
+ }
1678
+ if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
1679
+ window.CustomEvent = function(inType, params) {
1680
+ params = params || {};
1681
+ var e = document.createEvent("CustomEvent");
1682
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
1683
+ return e;
1684
+ };
1685
+ window.CustomEvent.prototype = window.Event.prototype;
1686
+ }
1687
+ if (document.readyState === "complete" || scope.flags.eager) {
1688
+ bootstrap();
1689
+ } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
1690
+ bootstrap();
1691
+ } else {
1692
+ var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
1693
+ window.addEventListener(loadEvent, bootstrap);
1694
+ }
1695
+ })(window.CustomElements);
1696
+
1697
+ if (typeof HTMLTemplateElement === "undefined") {
1698
+ (function() {
1699
+ var TEMPLATE_TAG = "template";
1700
+ HTMLTemplateElement = function() {};
1701
+ HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
1702
+ HTMLTemplateElement.decorate = function(template) {
1703
+ if (!template.content) {
1704
+ template.content = template.ownerDocument.createDocumentFragment();
1705
+ var child;
1706
+ while (child = template.firstChild) {
1707
+ template.content.appendChild(child);
1708
+ }
1709
+ }
1710
+ };
1711
+ HTMLTemplateElement.bootstrap = function(doc) {
1712
+ var templates = doc.querySelectorAll(TEMPLATE_TAG);
1713
+ for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++) {
1714
+ HTMLTemplateElement.decorate(t);
1715
+ }
1716
+ };
1717
+ addEventListener("DOMContentLoaded", function() {
1718
+ HTMLTemplateElement.bootstrap(document);
1719
+ });
1720
+ })();
1721
+ }
1722
+
1723
+ (function(scope) {
1724
+ var style = document.createElement("style");
1725
+ style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
1726
+ var head = document.querySelector("head");
1727
+ head.insertBefore(style, head.firstChild);
1728
+ })(window.WebComponents);