polymer-gold-rails 1.0.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +36 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/gold-cc-cvc-input/README.md +24 -0
  5. data/app/assets/components/gold-cc-cvc-input/bower.json +39 -0
  6. data/app/assets/components/gold-cc-cvc-input/cvc_hint.png +0 -0
  7. data/app/assets/components/gold-cc-cvc-input/cvc_hint_amex.png +0 -0
  8. data/app/assets/components/gold-cc-cvc-input/demo/index.html +54 -0
  9. data/app/assets/components/gold-cc-cvc-input/gold-cc-cvc-input.html +195 -0
  10. data/app/assets/components/gold-cc-cvc-input/hero.svg +36 -0
  11. data/app/assets/components/gold-cc-cvc-input/index.html +26 -0
  12. data/app/assets/components/gold-cc-cvc-input/test/basic.html +125 -0
  13. data/app/assets/components/gold-cc-cvc-input/test/index.html +25 -0
  14. data/app/assets/components/gold-cc-expiration-input/README.md +10 -0
  15. data/app/assets/components/gold-cc-expiration-input/bower.json +40 -0
  16. data/app/assets/components/gold-cc-expiration-input/date-input.html +157 -0
  17. data/app/assets/components/gold-cc-expiration-input/date-validator.html +38 -0
  18. data/app/assets/components/gold-cc-expiration-input/demo/index.html +53 -0
  19. data/app/assets/components/gold-cc-expiration-input/gold-cc-expiration-input.html +131 -0
  20. data/app/assets/components/gold-cc-expiration-input/hero.svg +58 -0
  21. data/app/assets/components/gold-cc-expiration-input/index.html +28 -0
  22. data/app/assets/components/gold-cc-expiration-input/test/basic.html +126 -0
  23. data/app/assets/components/gold-cc-expiration-input/test/index.html +25 -0
  24. data/app/assets/components/gold-cc-input/README.md +9 -0
  25. data/app/assets/components/gold-cc-input/bower.json +39 -0
  26. data/app/assets/components/gold-cc-input/cc-validator.js +192 -0
  27. data/app/assets/components/gold-cc-input/demo/index.html +48 -0
  28. data/app/assets/components/gold-cc-input/gold-cc-input.html +215 -0
  29. data/app/assets/components/gold-cc-input/hero.svg +52 -0
  30. data/app/assets/components/gold-cc-input/images/amex.png +0 -0
  31. data/app/assets/components/gold-cc-input/images/diners_club.png +0 -0
  32. data/app/assets/components/gold-cc-input/images/discover.png +0 -0
  33. data/app/assets/components/gold-cc-input/images/jcb.png +0 -0
  34. data/app/assets/components/gold-cc-input/images/mastercard.png +0 -0
  35. data/app/assets/components/gold-cc-input/images/visa.png +0 -0
  36. data/app/assets/components/gold-cc-input/index.html +28 -0
  37. data/app/assets/components/gold-cc-input/test/basic.html +136 -0
  38. data/app/assets/components/gold-cc-input/test/index.html +25 -0
  39. data/app/assets/components/gold-elements/README.md +12 -0
  40. data/app/assets/components/gold-elements/bower.json +42 -0
  41. data/app/assets/components/gold-elements/demo/complex-form.html +127 -0
  42. data/app/assets/components/gold-elements/demo/index.html +94 -0
  43. data/app/assets/components/gold-elements/demo/item-card.html +59 -0
  44. data/app/assets/components/gold-elements/demo/simple-form.css +55 -0
  45. data/app/assets/components/gold-elements/demo/simple-form.html +93 -0
  46. data/app/assets/components/gold-elements/screenshot.png +0 -0
  47. data/app/assets/components/gold-email-input/README.md +8 -0
  48. data/app/assets/components/gold-email-input/bower.json +40 -0
  49. data/app/assets/components/gold-email-input/demo/index.html +46 -0
  50. data/app/assets/components/gold-email-input/email-validator.html +31 -0
  51. data/app/assets/components/gold-email-input/gold-email-input.html +108 -0
  52. data/app/assets/components/gold-email-input/hero.svg +59 -0
  53. data/app/assets/components/gold-email-input/index.html +28 -0
  54. data/app/assets/components/gold-email-input/test/basic.html +97 -0
  55. data/app/assets/components/gold-email-input/test/index.html +25 -0
  56. data/app/assets/components/gold-phone-input/README.md +13 -0
  57. data/app/assets/components/gold-phone-input/bower.json +39 -0
  58. data/app/assets/components/gold-phone-input/demo/index.html +53 -0
  59. data/app/assets/components/gold-phone-input/gold-phone-input.html +197 -0
  60. data/app/assets/components/gold-phone-input/hero.svg +63 -0
  61. data/app/assets/components/gold-phone-input/index.html +28 -0
  62. data/app/assets/components/gold-phone-input/test/basic.html +117 -0
  63. data/app/assets/components/gold-phone-input/test/index.html +25 -0
  64. data/app/assets/components/gold-zip-input/README.md +8 -0
  65. data/app/assets/components/gold-zip-input/bower.json +40 -0
  66. data/app/assets/components/gold-zip-input/demo/index.html +54 -0
  67. data/app/assets/components/gold-zip-input/gold-zip-input.html +113 -0
  68. data/app/assets/components/gold-zip-input/hero.svg +43 -0
  69. data/app/assets/components/gold-zip-input/index.html +28 -0
  70. data/app/assets/components/gold-zip-input/test/basic.html +116 -0
  71. data/app/assets/components/gold-zip-input/test/index.html +25 -0
  72. data/app/assets/components/gold-zip-input/zip-validator.html +32 -0
  73. data/app/assets/components/iron-autogrow-textarea/README.md +24 -0
  74. data/app/assets/components/iron-autogrow-textarea/bower.json +37 -0
  75. data/app/assets/components/iron-autogrow-textarea/demo/index.html +81 -0
  76. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  77. data/app/assets/components/iron-autogrow-textarea/index.html +30 -0
  78. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  79. data/app/assets/components/iron-autogrow-textarea/test/basic.html +94 -0
  80. data/app/assets/components/iron-autogrow-textarea/test/index.html +25 -0
  81. data/app/assets/components/iron-flex-layout/README.md +4 -0
  82. data/app/assets/components/iron-flex-layout/bower.json +21 -0
  83. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  84. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  85. data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
  86. data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
  87. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  88. data/app/assets/components/iron-form-element-behavior/README.md +2 -0
  89. data/app/assets/components/iron-form-element-behavior/bower.json +27 -0
  90. data/app/assets/components/iron-form-element-behavior/demo/index.html +53 -0
  91. data/app/assets/components/iron-form-element-behavior/demo/simple-element.html +27 -0
  92. data/app/assets/components/iron-form-element-behavior/demo/simple-form.html +42 -0
  93. data/app/assets/components/iron-form-element-behavior/index.html +30 -0
  94. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  95. data/app/assets/components/iron-icon/README.md +56 -0
  96. data/app/assets/components/iron-icon/bower.json +29 -0
  97. data/app/assets/components/iron-icon/demo/index.html +28 -0
  98. data/app/assets/components/iron-icon/demo/location.png +0 -0
  99. data/app/assets/components/iron-icon/hero.svg +19 -0
  100. data/app/assets/components/iron-icon/index.html +26 -0
  101. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  102. data/app/assets/components/iron-icon/test/index.html +31 -0
  103. data/app/assets/components/iron-icon/test/iron-icon.html +120 -0
  104. data/app/assets/components/iron-input/README.md +16 -0
  105. data/app/assets/components/iron-input/bower.json +36 -0
  106. data/app/assets/components/iron-input/demo/index.html +87 -0
  107. data/app/assets/components/iron-input/hero.svg +19 -0
  108. data/app/assets/components/iron-input/index.html +30 -0
  109. data/app/assets/components/iron-input/iron-input.html +235 -0
  110. data/app/assets/components/iron-input/test/index.html +24 -0
  111. data/app/assets/components/iron-input/test/iron-input.html +139 -0
  112. data/app/assets/components/iron-input/test/letters-only.html +30 -0
  113. data/app/assets/components/iron-meta/README.md +46 -0
  114. data/app/assets/components/iron-meta/bower.json +28 -0
  115. data/app/assets/components/iron-meta/demo/index.html +45 -0
  116. data/app/assets/components/iron-meta/hero.svg +33 -0
  117. data/app/assets/components/iron-meta/index.html +27 -0
  118. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  119. data/app/assets/components/iron-meta/test/basic.html +48 -0
  120. data/app/assets/components/iron-meta/test/index.html +30 -0
  121. data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
  122. data/app/assets/components/iron-validatable-behavior/README.md +3 -0
  123. data/app/assets/components/iron-validatable-behavior/bower.json +35 -0
  124. data/app/assets/components/iron-validatable-behavior/demo/cats-only.html +46 -0
  125. data/app/assets/components/iron-validatable-behavior/demo/index.html +71 -0
  126. data/app/assets/components/iron-validatable-behavior/demo/validatable-input.html +46 -0
  127. data/app/assets/components/iron-validatable-behavior/index.html +30 -0
  128. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +101 -0
  129. data/app/assets/components/iron-validatable-behavior/test/index.html +35 -0
  130. data/app/assets/components/iron-validatable-behavior/test/iron-validatable-behavior.html +52 -0
  131. data/app/assets/components/iron-validatable-behavior/test/test-validatable.html +28 -0
  132. data/app/assets/components/iron-validator-behavior/README.md +4 -0
  133. data/app/assets/components/iron-validator-behavior/bower.json +34 -0
  134. data/app/assets/components/iron-validator-behavior/demo/cats-only.html +46 -0
  135. data/app/assets/components/iron-validator-behavior/demo/index.html +144 -0
  136. data/app/assets/components/iron-validator-behavior/index.html +30 -0
  137. data/app/assets/components/iron-validator-behavior/iron-validator-behavior.html +61 -0
  138. data/app/assets/components/iron-validator-behavior/test/index.html +34 -0
  139. data/app/assets/components/iron-validator-behavior/test/iron-validator-behavior.html +47 -0
  140. data/app/assets/components/iron-validator-behavior/test/simple-validator.html +26 -0
  141. data/app/assets/components/paper-input/README.md +5 -0
  142. data/app/assets/components/paper-input/all-imports.html +12 -0
  143. data/app/assets/components/paper-input/bower.json +44 -0
  144. data/app/assets/components/paper-input/demo/index.html +96 -0
  145. data/app/assets/components/paper-input/demo/ssn-input.html +94 -0
  146. data/app/assets/components/paper-input/demo/ssn-validator.html +31 -0
  147. data/app/assets/components/paper-input/hero.svg +19 -0
  148. data/app/assets/components/paper-input/index.html +28 -0
  149. data/app/assets/components/paper-input/paper-input-addon-behavior.html +47 -0
  150. data/app/assets/components/paper-input/paper-input-behavior.html +317 -0
  151. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  152. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  153. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  154. data/app/assets/components/paper-input/paper-input.html +126 -0
  155. data/app/assets/components/paper-input/paper-textarea.html +106 -0
  156. data/app/assets/components/paper-input/test/index.html +28 -0
  157. data/app/assets/components/paper-input/test/letters-only.html +30 -0
  158. data/app/assets/components/paper-input/test/paper-input-char-counter.html +112 -0
  159. data/app/assets/components/paper-input/test/paper-input-container.html +237 -0
  160. data/app/assets/components/paper-input/test/paper-input-error.html +60 -0
  161. data/app/assets/components/paper-input/test/paper-input.html +213 -0
  162. data/app/assets/components/paper-input/test/paper-textarea.html +169 -0
  163. data/app/assets/components/paper-styles/README.md +3 -0
  164. data/app/assets/components/paper-styles/bower.json +27 -0
  165. data/app/assets/components/paper-styles/classes/global.html +96 -0
  166. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  167. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  168. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  169. data/app/assets/components/paper-styles/color.html +333 -0
  170. data/app/assets/components/paper-styles/default-theme.html +39 -0
  171. data/app/assets/components/paper-styles/demo-pages.html +72 -0
  172. data/app/assets/components/paper-styles/demo.css +25 -0
  173. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  174. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  175. data/app/assets/components/paper-styles/shadow.html +61 -0
  176. data/app/assets/components/paper-styles/typography.html +240 -0
  177. data/app/assets/components/polymer/LICENSE.txt +27 -0
  178. data/app/assets/components/polymer/bower.json +26 -0
  179. data/app/assets/components/polymer/build.log +27 -0
  180. data/app/assets/components/polymer/polymer-micro.html +523 -0
  181. data/app/assets/components/polymer/polymer-mini.html +1368 -0
  182. data/app/assets/components/polymer/polymer.html +3768 -0
  183. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  184. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  185. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  186. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  187. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  188. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  189. data/app/assets/components/webcomponentsjs/README.md +125 -0
  190. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  191. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  192. data/app/assets/components/webcomponentsjs/bower.json +14 -0
  193. data/app/assets/components/webcomponentsjs/build.log +33 -0
  194. data/app/assets/components/webcomponentsjs/package.json +31 -0
  195. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  196. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  197. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  198. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  199. data/lib/polymer-gold-rails.rb +2 -0
  200. data/lib/polymer-gold-rails/enigne.rb +4 -0
  201. data/lib/polymer-gold-rails/version.rb +3 -0
  202. metadata +312 -0
@@ -0,0 +1,956 @@
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.7.3
11
+ if (typeof WeakMap === "undefined") {
12
+ (function() {
13
+ var defineProperty = Object.defineProperty;
14
+ var counter = Date.now() % 1e9;
15
+ var WeakMap = function() {
16
+ this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
17
+ };
18
+ WeakMap.prototype = {
19
+ set: function(key, value) {
20
+ var entry = key[this.name];
21
+ if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
22
+ value: [ key, value ],
23
+ writable: true
24
+ });
25
+ return this;
26
+ },
27
+ get: function(key) {
28
+ var entry;
29
+ return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
30
+ },
31
+ "delete": function(key) {
32
+ var entry = key[this.name];
33
+ if (!entry || entry[0] !== key) return false;
34
+ entry[0] = entry[1] = undefined;
35
+ return true;
36
+ },
37
+ has: function(key) {
38
+ var entry = key[this.name];
39
+ if (!entry) return false;
40
+ return entry[0] === key;
41
+ }
42
+ };
43
+ window.WeakMap = WeakMap;
44
+ })();
45
+ }
46
+
47
+ (function(global) {
48
+ var registrationsTable = new WeakMap();
49
+ var setImmediate;
50
+ if (/Trident|Edge/.test(navigator.userAgent)) {
51
+ setImmediate = setTimeout;
52
+ } else if (window.setImmediate) {
53
+ setImmediate = window.setImmediate;
54
+ } else {
55
+ var setImmediateQueue = [];
56
+ var sentinel = String(Math.random());
57
+ window.addEventListener("message", function(e) {
58
+ if (e.data === sentinel) {
59
+ var queue = setImmediateQueue;
60
+ setImmediateQueue = [];
61
+ queue.forEach(function(func) {
62
+ func();
63
+ });
64
+ }
65
+ });
66
+ setImmediate = function(func) {
67
+ setImmediateQueue.push(func);
68
+ window.postMessage(sentinel, "*");
69
+ };
70
+ }
71
+ var isScheduled = false;
72
+ var scheduledObservers = [];
73
+ function scheduleCallback(observer) {
74
+ scheduledObservers.push(observer);
75
+ if (!isScheduled) {
76
+ isScheduled = true;
77
+ setImmediate(dispatchCallbacks);
78
+ }
79
+ }
80
+ function wrapIfNeeded(node) {
81
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
82
+ }
83
+ function dispatchCallbacks() {
84
+ isScheduled = false;
85
+ var observers = scheduledObservers;
86
+ scheduledObservers = [];
87
+ observers.sort(function(o1, o2) {
88
+ return o1.uid_ - o2.uid_;
89
+ });
90
+ var anyNonEmpty = false;
91
+ observers.forEach(function(observer) {
92
+ var queue = observer.takeRecords();
93
+ removeTransientObserversFor(observer);
94
+ if (queue.length) {
95
+ observer.callback_(queue, observer);
96
+ anyNonEmpty = true;
97
+ }
98
+ });
99
+ if (anyNonEmpty) dispatchCallbacks();
100
+ }
101
+ function removeTransientObserversFor(observer) {
102
+ observer.nodes_.forEach(function(node) {
103
+ var registrations = registrationsTable.get(node);
104
+ if (!registrations) return;
105
+ registrations.forEach(function(registration) {
106
+ if (registration.observer === observer) registration.removeTransientObservers();
107
+ });
108
+ });
109
+ }
110
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
111
+ for (var node = target; node; node = node.parentNode) {
112
+ var registrations = registrationsTable.get(node);
113
+ if (registrations) {
114
+ for (var j = 0; j < registrations.length; j++) {
115
+ var registration = registrations[j];
116
+ var options = registration.options;
117
+ if (node !== target && !options.subtree) continue;
118
+ var record = callback(options);
119
+ if (record) registration.enqueue(record);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ var uidCounter = 0;
125
+ function JsMutationObserver(callback) {
126
+ this.callback_ = callback;
127
+ this.nodes_ = [];
128
+ this.records_ = [];
129
+ this.uid_ = ++uidCounter;
130
+ }
131
+ JsMutationObserver.prototype = {
132
+ observe: function(target, options) {
133
+ target = wrapIfNeeded(target);
134
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
135
+ throw new SyntaxError();
136
+ }
137
+ var registrations = registrationsTable.get(target);
138
+ if (!registrations) registrationsTable.set(target, registrations = []);
139
+ var registration;
140
+ for (var i = 0; i < registrations.length; i++) {
141
+ if (registrations[i].observer === this) {
142
+ registration = registrations[i];
143
+ registration.removeListeners();
144
+ registration.options = options;
145
+ break;
146
+ }
147
+ }
148
+ if (!registration) {
149
+ registration = new Registration(this, target, options);
150
+ registrations.push(registration);
151
+ this.nodes_.push(target);
152
+ }
153
+ registration.addListeners();
154
+ },
155
+ disconnect: function() {
156
+ this.nodes_.forEach(function(node) {
157
+ var registrations = registrationsTable.get(node);
158
+ for (var i = 0; i < registrations.length; i++) {
159
+ var registration = registrations[i];
160
+ if (registration.observer === this) {
161
+ registration.removeListeners();
162
+ registrations.splice(i, 1);
163
+ break;
164
+ }
165
+ }
166
+ }, this);
167
+ this.records_ = [];
168
+ },
169
+ takeRecords: function() {
170
+ var copyOfRecords = this.records_;
171
+ this.records_ = [];
172
+ return copyOfRecords;
173
+ }
174
+ };
175
+ function MutationRecord(type, target) {
176
+ this.type = type;
177
+ this.target = target;
178
+ this.addedNodes = [];
179
+ this.removedNodes = [];
180
+ this.previousSibling = null;
181
+ this.nextSibling = null;
182
+ this.attributeName = null;
183
+ this.attributeNamespace = null;
184
+ this.oldValue = null;
185
+ }
186
+ function copyMutationRecord(original) {
187
+ var record = new MutationRecord(original.type, original.target);
188
+ record.addedNodes = original.addedNodes.slice();
189
+ record.removedNodes = original.removedNodes.slice();
190
+ record.previousSibling = original.previousSibling;
191
+ record.nextSibling = original.nextSibling;
192
+ record.attributeName = original.attributeName;
193
+ record.attributeNamespace = original.attributeNamespace;
194
+ record.oldValue = original.oldValue;
195
+ return record;
196
+ }
197
+ var currentRecord, recordWithOldValue;
198
+ function getRecord(type, target) {
199
+ return currentRecord = new MutationRecord(type, target);
200
+ }
201
+ function getRecordWithOldValue(oldValue) {
202
+ if (recordWithOldValue) return recordWithOldValue;
203
+ recordWithOldValue = copyMutationRecord(currentRecord);
204
+ recordWithOldValue.oldValue = oldValue;
205
+ return recordWithOldValue;
206
+ }
207
+ function clearRecords() {
208
+ currentRecord = recordWithOldValue = undefined;
209
+ }
210
+ function recordRepresentsCurrentMutation(record) {
211
+ return record === recordWithOldValue || record === currentRecord;
212
+ }
213
+ function selectRecord(lastRecord, newRecord) {
214
+ if (lastRecord === newRecord) return lastRecord;
215
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
216
+ return null;
217
+ }
218
+ function Registration(observer, target, options) {
219
+ this.observer = observer;
220
+ this.target = target;
221
+ this.options = options;
222
+ this.transientObservedNodes = [];
223
+ }
224
+ Registration.prototype = {
225
+ enqueue: function(record) {
226
+ var records = this.observer.records_;
227
+ var length = records.length;
228
+ if (records.length > 0) {
229
+ var lastRecord = records[length - 1];
230
+ var recordToReplaceLast = selectRecord(lastRecord, record);
231
+ if (recordToReplaceLast) {
232
+ records[length - 1] = recordToReplaceLast;
233
+ return;
234
+ }
235
+ } else {
236
+ scheduleCallback(this.observer);
237
+ }
238
+ records[length] = record;
239
+ },
240
+ addListeners: function() {
241
+ this.addListeners_(this.target);
242
+ },
243
+ addListeners_: function(node) {
244
+ var options = this.options;
245
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
246
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
247
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
248
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
249
+ },
250
+ removeListeners: function() {
251
+ this.removeListeners_(this.target);
252
+ },
253
+ removeListeners_: function(node) {
254
+ var options = this.options;
255
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
256
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
257
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
258
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
259
+ },
260
+ addTransientObserver: function(node) {
261
+ if (node === this.target) return;
262
+ this.addListeners_(node);
263
+ this.transientObservedNodes.push(node);
264
+ var registrations = registrationsTable.get(node);
265
+ if (!registrations) registrationsTable.set(node, registrations = []);
266
+ registrations.push(this);
267
+ },
268
+ removeTransientObservers: function() {
269
+ var transientObservedNodes = this.transientObservedNodes;
270
+ this.transientObservedNodes = [];
271
+ transientObservedNodes.forEach(function(node) {
272
+ this.removeListeners_(node);
273
+ var registrations = registrationsTable.get(node);
274
+ for (var i = 0; i < registrations.length; i++) {
275
+ if (registrations[i] === this) {
276
+ registrations.splice(i, 1);
277
+ break;
278
+ }
279
+ }
280
+ }, this);
281
+ },
282
+ handleEvent: function(e) {
283
+ e.stopImmediatePropagation();
284
+ switch (e.type) {
285
+ case "DOMAttrModified":
286
+ var name = e.attrName;
287
+ var namespace = e.relatedNode.namespaceURI;
288
+ var target = e.target;
289
+ var record = new getRecord("attributes", target);
290
+ record.attributeName = name;
291
+ record.attributeNamespace = namespace;
292
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
293
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
294
+ if (!options.attributes) return;
295
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
296
+ return;
297
+ }
298
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
299
+ return record;
300
+ });
301
+ break;
302
+
303
+ case "DOMCharacterDataModified":
304
+ var target = e.target;
305
+ var record = getRecord("characterData", target);
306
+ var oldValue = e.prevValue;
307
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
308
+ if (!options.characterData) return;
309
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
310
+ return record;
311
+ });
312
+ break;
313
+
314
+ case "DOMNodeRemoved":
315
+ this.addTransientObserver(e.target);
316
+
317
+ case "DOMNodeInserted":
318
+ var changedNode = e.target;
319
+ var addedNodes, removedNodes;
320
+ if (e.type === "DOMNodeInserted") {
321
+ addedNodes = [ changedNode ];
322
+ removedNodes = [];
323
+ } else {
324
+ addedNodes = [];
325
+ removedNodes = [ changedNode ];
326
+ }
327
+ var previousSibling = changedNode.previousSibling;
328
+ var nextSibling = changedNode.nextSibling;
329
+ var record = getRecord("childList", e.target.parentNode);
330
+ record.addedNodes = addedNodes;
331
+ record.removedNodes = removedNodes;
332
+ record.previousSibling = previousSibling;
333
+ record.nextSibling = nextSibling;
334
+ forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
335
+ if (!options.childList) return;
336
+ return record;
337
+ });
338
+ }
339
+ clearRecords();
340
+ }
341
+ };
342
+ global.JsMutationObserver = JsMutationObserver;
343
+ if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
344
+ })(this);
345
+
346
+ window.CustomElements = window.CustomElements || {
347
+ flags: {}
348
+ };
349
+
350
+ (function(scope) {
351
+ var flags = scope.flags;
352
+ var modules = [];
353
+ var addModule = function(module) {
354
+ modules.push(module);
355
+ };
356
+ var initializeModules = function() {
357
+ modules.forEach(function(module) {
358
+ module(scope);
359
+ });
360
+ };
361
+ scope.addModule = addModule;
362
+ scope.initializeModules = initializeModules;
363
+ scope.hasNative = Boolean(document.registerElement);
364
+ scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
365
+ })(window.CustomElements);
366
+
367
+ window.CustomElements.addModule(function(scope) {
368
+ var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
369
+ function forSubtree(node, cb) {
370
+ findAllElements(node, function(e) {
371
+ if (cb(e)) {
372
+ return true;
373
+ }
374
+ forRoots(e, cb);
375
+ });
376
+ forRoots(node, cb);
377
+ }
378
+ function findAllElements(node, find, data) {
379
+ var e = node.firstElementChild;
380
+ if (!e) {
381
+ e = node.firstChild;
382
+ while (e && e.nodeType !== Node.ELEMENT_NODE) {
383
+ e = e.nextSibling;
384
+ }
385
+ }
386
+ while (e) {
387
+ if (find(e, data) !== true) {
388
+ findAllElements(e, find, data);
389
+ }
390
+ e = e.nextElementSibling;
391
+ }
392
+ return null;
393
+ }
394
+ function forRoots(node, cb) {
395
+ var root = node.shadowRoot;
396
+ while (root) {
397
+ forSubtree(root, cb);
398
+ root = root.olderShadowRoot;
399
+ }
400
+ }
401
+ function forDocumentTree(doc, cb) {
402
+ _forDocumentTree(doc, cb, []);
403
+ }
404
+ function _forDocumentTree(doc, cb, processingDocuments) {
405
+ doc = wrap(doc);
406
+ if (processingDocuments.indexOf(doc) >= 0) {
407
+ return;
408
+ }
409
+ processingDocuments.push(doc);
410
+ var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
411
+ for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
412
+ if (n.import) {
413
+ _forDocumentTree(n.import, cb, processingDocuments);
414
+ }
415
+ }
416
+ cb(doc);
417
+ }
418
+ scope.forDocumentTree = forDocumentTree;
419
+ scope.forSubtree = forSubtree;
420
+ });
421
+
422
+ window.CustomElements.addModule(function(scope) {
423
+ var flags = scope.flags;
424
+ var forSubtree = scope.forSubtree;
425
+ var forDocumentTree = scope.forDocumentTree;
426
+ function addedNode(node) {
427
+ return added(node) || addedSubtree(node);
428
+ }
429
+ function added(node) {
430
+ if (scope.upgrade(node)) {
431
+ return true;
432
+ }
433
+ attached(node);
434
+ }
435
+ function addedSubtree(node) {
436
+ forSubtree(node, function(e) {
437
+ if (added(e)) {
438
+ return true;
439
+ }
440
+ });
441
+ }
442
+ function attachedNode(node) {
443
+ attached(node);
444
+ if (inDocument(node)) {
445
+ forSubtree(node, function(e) {
446
+ attached(e);
447
+ });
448
+ }
449
+ }
450
+ var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
451
+ scope.hasPolyfillMutations = hasPolyfillMutations;
452
+ var isPendingMutations = false;
453
+ var pendingMutations = [];
454
+ function deferMutation(fn) {
455
+ pendingMutations.push(fn);
456
+ if (!isPendingMutations) {
457
+ isPendingMutations = true;
458
+ setTimeout(takeMutations);
459
+ }
460
+ }
461
+ function takeMutations() {
462
+ isPendingMutations = false;
463
+ var $p = pendingMutations;
464
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
465
+ p();
466
+ }
467
+ pendingMutations = [];
468
+ }
469
+ function attached(element) {
470
+ if (hasPolyfillMutations) {
471
+ deferMutation(function() {
472
+ _attached(element);
473
+ });
474
+ } else {
475
+ _attached(element);
476
+ }
477
+ }
478
+ function _attached(element) {
479
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
480
+ if (!element.__attached && inDocument(element)) {
481
+ element.__attached = true;
482
+ if (element.attachedCallback) {
483
+ element.attachedCallback();
484
+ }
485
+ }
486
+ }
487
+ }
488
+ function detachedNode(node) {
489
+ detached(node);
490
+ forSubtree(node, function(e) {
491
+ detached(e);
492
+ });
493
+ }
494
+ function detached(element) {
495
+ if (hasPolyfillMutations) {
496
+ deferMutation(function() {
497
+ _detached(element);
498
+ });
499
+ } else {
500
+ _detached(element);
501
+ }
502
+ }
503
+ function _detached(element) {
504
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
505
+ if (element.__attached && !inDocument(element)) {
506
+ element.__attached = false;
507
+ if (element.detachedCallback) {
508
+ element.detachedCallback();
509
+ }
510
+ }
511
+ }
512
+ }
513
+ function inDocument(element) {
514
+ var p = element;
515
+ var doc = wrap(document);
516
+ while (p) {
517
+ if (p == doc) {
518
+ return true;
519
+ }
520
+ p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host;
521
+ }
522
+ }
523
+ function watchShadow(node) {
524
+ if (node.shadowRoot && !node.shadowRoot.__watched) {
525
+ flags.dom && console.log("watching shadow-root for: ", node.localName);
526
+ var root = node.shadowRoot;
527
+ while (root) {
528
+ observe(root);
529
+ root = root.olderShadowRoot;
530
+ }
531
+ }
532
+ }
533
+ function handler(mutations) {
534
+ if (flags.dom) {
535
+ var mx = mutations[0];
536
+ if (mx && mx.type === "childList" && mx.addedNodes) {
537
+ if (mx.addedNodes) {
538
+ var d = mx.addedNodes[0];
539
+ while (d && d !== document && !d.host) {
540
+ d = d.parentNode;
541
+ }
542
+ var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
543
+ u = u.split("/?").shift().split("/").pop();
544
+ }
545
+ }
546
+ console.group("mutations (%d) [%s]", mutations.length, u || "");
547
+ }
548
+ mutations.forEach(function(mx) {
549
+ if (mx.type === "childList") {
550
+ forEach(mx.addedNodes, function(n) {
551
+ if (!n.localName) {
552
+ return;
553
+ }
554
+ addedNode(n);
555
+ });
556
+ forEach(mx.removedNodes, function(n) {
557
+ if (!n.localName) {
558
+ return;
559
+ }
560
+ detachedNode(n);
561
+ });
562
+ }
563
+ });
564
+ flags.dom && console.groupEnd();
565
+ }
566
+ function takeRecords(node) {
567
+ node = wrap(node);
568
+ if (!node) {
569
+ node = wrap(document);
570
+ }
571
+ while (node.parentNode) {
572
+ node = node.parentNode;
573
+ }
574
+ var observer = node.__observer;
575
+ if (observer) {
576
+ handler(observer.takeRecords());
577
+ takeMutations();
578
+ }
579
+ }
580
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
581
+ function observe(inRoot) {
582
+ if (inRoot.__observer) {
583
+ return;
584
+ }
585
+ var observer = new MutationObserver(handler);
586
+ observer.observe(inRoot, {
587
+ childList: true,
588
+ subtree: true
589
+ });
590
+ inRoot.__observer = observer;
591
+ }
592
+ function upgradeDocument(doc) {
593
+ doc = wrap(doc);
594
+ flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
595
+ addedNode(doc);
596
+ observe(doc);
597
+ flags.dom && console.groupEnd();
598
+ }
599
+ function upgradeDocumentTree(doc) {
600
+ forDocumentTree(doc, upgradeDocument);
601
+ }
602
+ var originalCreateShadowRoot = Element.prototype.createShadowRoot;
603
+ if (originalCreateShadowRoot) {
604
+ Element.prototype.createShadowRoot = function() {
605
+ var root = originalCreateShadowRoot.call(this);
606
+ CustomElements.watchShadow(this);
607
+ return root;
608
+ };
609
+ }
610
+ scope.watchShadow = watchShadow;
611
+ scope.upgradeDocumentTree = upgradeDocumentTree;
612
+ scope.upgradeSubtree = addedSubtree;
613
+ scope.upgradeAll = addedNode;
614
+ scope.attachedNode = attachedNode;
615
+ scope.takeRecords = takeRecords;
616
+ });
617
+
618
+ window.CustomElements.addModule(function(scope) {
619
+ var flags = scope.flags;
620
+ function upgrade(node) {
621
+ if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
622
+ var is = node.getAttribute("is");
623
+ var definition = scope.getRegisteredDefinition(is || node.localName);
624
+ if (definition) {
625
+ if (is && definition.tag == node.localName) {
626
+ return upgradeWithDefinition(node, definition);
627
+ } else if (!is && !definition.extends) {
628
+ return upgradeWithDefinition(node, definition);
629
+ }
630
+ }
631
+ }
632
+ }
633
+ function upgradeWithDefinition(element, definition) {
634
+ flags.upgrade && console.group("upgrade:", element.localName);
635
+ if (definition.is) {
636
+ element.setAttribute("is", definition.is);
637
+ }
638
+ implementPrototype(element, definition);
639
+ element.__upgraded__ = true;
640
+ created(element);
641
+ scope.attachedNode(element);
642
+ scope.upgradeSubtree(element);
643
+ flags.upgrade && console.groupEnd();
644
+ return element;
645
+ }
646
+ function implementPrototype(element, definition) {
647
+ if (Object.__proto__) {
648
+ element.__proto__ = definition.prototype;
649
+ } else {
650
+ customMixin(element, definition.prototype, definition.native);
651
+ element.__proto__ = definition.prototype;
652
+ }
653
+ }
654
+ function customMixin(inTarget, inSrc, inNative) {
655
+ var used = {};
656
+ var p = inSrc;
657
+ while (p !== inNative && p !== HTMLElement.prototype) {
658
+ var keys = Object.getOwnPropertyNames(p);
659
+ for (var i = 0, k; k = keys[i]; i++) {
660
+ if (!used[k]) {
661
+ Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
662
+ used[k] = 1;
663
+ }
664
+ }
665
+ p = Object.getPrototypeOf(p);
666
+ }
667
+ }
668
+ function created(element) {
669
+ if (element.createdCallback) {
670
+ element.createdCallback();
671
+ }
672
+ }
673
+ scope.upgrade = upgrade;
674
+ scope.upgradeWithDefinition = upgradeWithDefinition;
675
+ scope.implementPrototype = implementPrototype;
676
+ });
677
+
678
+ window.CustomElements.addModule(function(scope) {
679
+ var isIE11OrOlder = scope.isIE11OrOlder;
680
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
681
+ var upgradeAll = scope.upgradeAll;
682
+ var upgradeWithDefinition = scope.upgradeWithDefinition;
683
+ var implementPrototype = scope.implementPrototype;
684
+ var useNative = scope.useNative;
685
+ function register(name, options) {
686
+ var definition = options || {};
687
+ if (!name) {
688
+ throw new Error("document.registerElement: first argument `name` must not be empty");
689
+ }
690
+ if (name.indexOf("-") < 0) {
691
+ throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
692
+ }
693
+ if (isReservedTag(name)) {
694
+ throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
695
+ }
696
+ if (getRegisteredDefinition(name)) {
697
+ throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
698
+ }
699
+ if (!definition.prototype) {
700
+ definition.prototype = Object.create(HTMLElement.prototype);
701
+ }
702
+ definition.__name = name.toLowerCase();
703
+ definition.lifecycle = definition.lifecycle || {};
704
+ definition.ancestry = ancestry(definition.extends);
705
+ resolveTagName(definition);
706
+ resolvePrototypeChain(definition);
707
+ overrideAttributeApi(definition.prototype);
708
+ registerDefinition(definition.__name, definition);
709
+ definition.ctor = generateConstructor(definition);
710
+ definition.ctor.prototype = definition.prototype;
711
+ definition.prototype.constructor = definition.ctor;
712
+ if (scope.ready) {
713
+ upgradeDocumentTree(document);
714
+ }
715
+ return definition.ctor;
716
+ }
717
+ function overrideAttributeApi(prototype) {
718
+ if (prototype.setAttribute._polyfilled) {
719
+ return;
720
+ }
721
+ var setAttribute = prototype.setAttribute;
722
+ prototype.setAttribute = function(name, value) {
723
+ changeAttribute.call(this, name, value, setAttribute);
724
+ };
725
+ var removeAttribute = prototype.removeAttribute;
726
+ prototype.removeAttribute = function(name) {
727
+ changeAttribute.call(this, name, null, removeAttribute);
728
+ };
729
+ prototype.setAttribute._polyfilled = true;
730
+ }
731
+ function changeAttribute(name, value, operation) {
732
+ name = name.toLowerCase();
733
+ var oldValue = this.getAttribute(name);
734
+ operation.apply(this, arguments);
735
+ var newValue = this.getAttribute(name);
736
+ if (this.attributeChangedCallback && newValue !== oldValue) {
737
+ this.attributeChangedCallback(name, oldValue, newValue);
738
+ }
739
+ }
740
+ function isReservedTag(name) {
741
+ for (var i = 0; i < reservedTagList.length; i++) {
742
+ if (name === reservedTagList[i]) {
743
+ return true;
744
+ }
745
+ }
746
+ }
747
+ var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
748
+ function ancestry(extnds) {
749
+ var extendee = getRegisteredDefinition(extnds);
750
+ if (extendee) {
751
+ return ancestry(extendee.extends).concat([ extendee ]);
752
+ }
753
+ return [];
754
+ }
755
+ function resolveTagName(definition) {
756
+ var baseTag = definition.extends;
757
+ for (var i = 0, a; a = definition.ancestry[i]; i++) {
758
+ baseTag = a.is && a.tag;
759
+ }
760
+ definition.tag = baseTag || definition.__name;
761
+ if (baseTag) {
762
+ definition.is = definition.__name;
763
+ }
764
+ }
765
+ function resolvePrototypeChain(definition) {
766
+ if (!Object.__proto__) {
767
+ var nativePrototype = HTMLElement.prototype;
768
+ if (definition.is) {
769
+ var inst = document.createElement(definition.tag);
770
+ var expectedPrototype = Object.getPrototypeOf(inst);
771
+ if (expectedPrototype === definition.prototype) {
772
+ nativePrototype = expectedPrototype;
773
+ }
774
+ }
775
+ var proto = definition.prototype, ancestor;
776
+ while (proto && proto !== nativePrototype) {
777
+ ancestor = Object.getPrototypeOf(proto);
778
+ proto.__proto__ = ancestor;
779
+ proto = ancestor;
780
+ }
781
+ definition.native = nativePrototype;
782
+ }
783
+ }
784
+ function instantiate(definition) {
785
+ return upgradeWithDefinition(domCreateElement(definition.tag), definition);
786
+ }
787
+ var registry = {};
788
+ function getRegisteredDefinition(name) {
789
+ if (name) {
790
+ return registry[name.toLowerCase()];
791
+ }
792
+ }
793
+ function registerDefinition(name, definition) {
794
+ registry[name] = definition;
795
+ }
796
+ function generateConstructor(definition) {
797
+ return function() {
798
+ return instantiate(definition);
799
+ };
800
+ }
801
+ var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
802
+ function createElementNS(namespace, tag, typeExtension) {
803
+ if (namespace === HTML_NAMESPACE) {
804
+ return createElement(tag, typeExtension);
805
+ } else {
806
+ return domCreateElementNS(namespace, tag);
807
+ }
808
+ }
809
+ function createElement(tag, typeExtension) {
810
+ if (tag) {
811
+ tag = tag.toLowerCase();
812
+ }
813
+ if (typeExtension) {
814
+ typeExtension = typeExtension.toLowerCase();
815
+ }
816
+ var definition = getRegisteredDefinition(typeExtension || tag);
817
+ if (definition) {
818
+ if (tag == definition.tag && typeExtension == definition.is) {
819
+ return new definition.ctor();
820
+ }
821
+ if (!typeExtension && !definition.is) {
822
+ return new definition.ctor();
823
+ }
824
+ }
825
+ var element;
826
+ if (typeExtension) {
827
+ element = createElement(tag);
828
+ element.setAttribute("is", typeExtension);
829
+ return element;
830
+ }
831
+ element = domCreateElement(tag);
832
+ if (tag.indexOf("-") >= 0) {
833
+ implementPrototype(element, HTMLElement);
834
+ }
835
+ return element;
836
+ }
837
+ var domCreateElement = document.createElement.bind(document);
838
+ var domCreateElementNS = document.createElementNS.bind(document);
839
+ var isInstance;
840
+ if (!Object.__proto__ && !useNative) {
841
+ isInstance = function(obj, ctor) {
842
+ var p = obj;
843
+ while (p) {
844
+ if (p === ctor.prototype) {
845
+ return true;
846
+ }
847
+ p = p.__proto__;
848
+ }
849
+ return false;
850
+ };
851
+ } else {
852
+ isInstance = function(obj, base) {
853
+ return obj instanceof base;
854
+ };
855
+ }
856
+ function wrapDomMethodToForceUpgrade(obj, methodName) {
857
+ var orig = obj[methodName];
858
+ obj[methodName] = function() {
859
+ var n = orig.apply(this, arguments);
860
+ upgradeAll(n);
861
+ return n;
862
+ };
863
+ }
864
+ wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
865
+ wrapDomMethodToForceUpgrade(document, "importNode");
866
+ if (isIE11OrOlder) {
867
+ (function() {
868
+ var importNode = document.importNode;
869
+ document.importNode = function() {
870
+ var n = importNode.apply(document, arguments);
871
+ if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) {
872
+ var f = document.createDocumentFragment();
873
+ f.appendChild(n);
874
+ return f;
875
+ } else {
876
+ return n;
877
+ }
878
+ };
879
+ })();
880
+ }
881
+ document.registerElement = register;
882
+ document.createElement = createElement;
883
+ document.createElementNS = createElementNS;
884
+ scope.registry = registry;
885
+ scope.instanceof = isInstance;
886
+ scope.reservedTagList = reservedTagList;
887
+ scope.getRegisteredDefinition = getRegisteredDefinition;
888
+ document.register = document.registerElement;
889
+ });
890
+
891
+ (function(scope) {
892
+ var useNative = scope.useNative;
893
+ var initializeModules = scope.initializeModules;
894
+ var isIE11OrOlder = /Trident/.test(navigator.userAgent);
895
+ if (useNative) {
896
+ var nop = function() {};
897
+ scope.watchShadow = nop;
898
+ scope.upgrade = nop;
899
+ scope.upgradeAll = nop;
900
+ scope.upgradeDocumentTree = nop;
901
+ scope.upgradeSubtree = nop;
902
+ scope.takeRecords = nop;
903
+ scope.instanceof = function(obj, base) {
904
+ return obj instanceof base;
905
+ };
906
+ } else {
907
+ initializeModules();
908
+ }
909
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
910
+ if (!window.wrap) {
911
+ if (window.ShadowDOMPolyfill) {
912
+ window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
913
+ window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
914
+ } else {
915
+ window.wrap = window.unwrap = function(node) {
916
+ return node;
917
+ };
918
+ }
919
+ }
920
+ function bootstrap() {
921
+ upgradeDocumentTree(wrap(document));
922
+ if (window.HTMLImports) {
923
+ HTMLImports.__importsParsingHook = function(elt) {
924
+ upgradeDocumentTree(wrap(elt.import));
925
+ };
926
+ }
927
+ CustomElements.ready = true;
928
+ setTimeout(function() {
929
+ CustomElements.readyTime = Date.now();
930
+ if (window.HTMLImports) {
931
+ CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
932
+ }
933
+ document.dispatchEvent(new CustomEvent("WebComponentsReady", {
934
+ bubbles: true
935
+ }));
936
+ });
937
+ }
938
+ if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
939
+ window.CustomEvent = function(inType, params) {
940
+ params = params || {};
941
+ var e = document.createEvent("CustomEvent");
942
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
943
+ return e;
944
+ };
945
+ window.CustomEvent.prototype = window.Event.prototype;
946
+ }
947
+ if (document.readyState === "complete" || scope.flags.eager) {
948
+ bootstrap();
949
+ } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
950
+ bootstrap();
951
+ } else {
952
+ var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
953
+ window.addEventListener(loadEvent, bootstrap);
954
+ }
955
+ scope.isIE11OrOlder = isIE11OrOlder;
956
+ })(window.CustomElements);