polymer-rails 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/polymer/LICENSE.txt +27 -0
  3. data/app/assets/javascripts/polymer/bower.json +27 -0
  4. data/app/assets/javascripts/polymer/build.log +27 -0
  5. data/app/assets/javascripts/polymer/polymer-micro.html +598 -597
  6. data/app/assets/javascripts/polymer/polymer-mini.html +1859 -1527
  7. data/app/assets/javascripts/polymer/polymer.html +4467 -4284
  8. data/app/assets/javascripts/webcomponentsjs/CustomElements.js +1041 -0
  9. data/app/assets/javascripts/webcomponentsjs/CustomElements.min.js +11 -0
  10. data/app/assets/javascripts/webcomponentsjs/HTMLImports.js +1155 -0
  11. data/app/assets/javascripts/webcomponentsjs/HTMLImports.min.js +11 -0
  12. data/app/assets/javascripts/webcomponentsjs/MutationObserver.js +350 -0
  13. data/app/assets/javascripts/webcomponentsjs/MutationObserver.min.js +11 -0
  14. data/app/assets/javascripts/webcomponentsjs/README.md +125 -0
  15. data/app/assets/javascripts/webcomponentsjs/ShadowDOM.js +4452 -0
  16. data/app/assets/javascripts/webcomponentsjs/ShadowDOM.min.js +13 -0
  17. data/app/assets/javascripts/webcomponentsjs/bower.json +21 -0
  18. data/app/assets/javascripts/webcomponentsjs/build.log +398 -0
  19. data/app/assets/javascripts/webcomponentsjs/package.json +28 -0
  20. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +169 -151
  21. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.min.js +12 -0
  22. data/app/assets/javascripts/webcomponentsjs/webcomponents.js +108 -70
  23. data/app/assets/javascripts/webcomponentsjs/webcomponents.min.js +14 -0
  24. data/lib/polymer-rails/version.rb +1 -1
  25. metadata +22 -5
@@ -0,0 +1,11 @@
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.17
11
+ "undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){E.push(e),b||(b=!0,w(o))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function o(){b=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r<o.length;r++){var i=o[r],a=i.options;if(n===e||a.subtree){var d=t(a);d&&i.enqueue(d)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++_}function d(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function s(e){var t=new d(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function u(e,t){return y=new d(e,t)}function c(e){return N?N:(N=s(y),N.oldValue=e,N)}function l(){y=N=void 0}function f(e){return e===N||e===y}function m(e,t){return e===t?e:N&&f(e)?N:null}function p(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var w,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))w=setTimeout;else if(window.setImmediate)w=window.setImmediate;else{var h=[],g=String(Math.random());window.addEventListener("message",function(e){if(e.data===g){var t=h;h=[],t.forEach(function(e){e()})}}),w=function(e){h.push(e),window.postMessage(g,"*")}}var b=!1,E=[],_=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var o=v.get(e);o||v.set(e,o=[]);for(var r,i=0;i<o.length;i++)if(o[i].observer===this){r=o[i],r.removeListeners(),r.options=t;break}r||(r=new p(this,e,t),o.push(r),this.nodes_.push(e)),r.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n++){var o=t[n];if(o.observer===this){o.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var y,N;p.prototype={enqueue:function(e){var n=this.observer.records_,o=n.length;if(n.length>0){var r=n[o-1],i=m(r,e);if(i)return void(n[o-1]=i)}else t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,o=e.target,r=new u("attributes",o);r.attributeName=t,r.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(o,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?c(a):r});break;case"DOMCharacterDataModified":var o=e.target,r=u("characterData",o),a=e.prevValue;i(o,function(e){return e.characterData?e.characterDataOldValue?c(a):r:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var d,s,f=e.target;"DOMNodeInserted"===e.type?(d=[f],s=[]):(d=[],s=[f]);var m=f.previousSibling,p=f.nextSibling,r=u("childList",e.target.parentNode);r.addedNodes=d,r.removedNodes=s,r.previousSibling=m,r.nextSibling=p,i(e.relatedNode,function(e){return e.childList?r:void 0})}l()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a,a._isPolyfilled=!0)}}(self),function(e){"use strict";if(!window.performance){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(function(){t(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}}());var n=function(){var e=document.createEvent("Event");return e.initEvent("foo",!0,!0),e.preventDefault(),e.defaultPrevented}();if(!n){var o=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(o.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}))}}var r=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||r&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),!window.Event||r&&"function"!=typeof window.Event){var i=window.Event;window.Event=function(e,t){t=t||{};var n=document.createEvent("Event");return n.initEvent(e,Boolean(t.bubbles),Boolean(t.cancelable)),n},window.Event.prototype=i.prototype}}(window.WebComponents),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],o=function(e){n.push(e)},r=function(){n.forEach(function(t){t(e)})};e.addModule=o,e.initializeModules=r,e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void o(e,t)}),o(e,t)}function n(e,t,o){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)t(r,o)!==!0&&n(r,t,o),r=r.nextElementSibling;return null}function o(e,n){for(var o=e.shadowRoot;o;)t(o,n),o=o.olderShadowRoot}function r(e,t){i(e,t,[])}function i(e,t,n){if(e=window.wrap(e),!(n.indexOf(e)>=0)){n.push(e);for(var o,r=e.querySelectorAll("link[rel="+a+"]"),d=0,s=r.length;s>d&&(o=r[d]);d++)o["import"]&&i(o["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e,t){return n(e,t)||o(e,t)}function n(t,n){return e.upgrade(t,n)?!0:void(n&&a(t))}function o(e,t){E(e,function(e){return n(e,t)?!0:void 0})}function r(e){M.push(e),N||(N=!0,setTimeout(i))}function i(){N=!1;for(var e,t=M,n=0,o=t.length;o>n&&(e=t[n]);n++)e();M=[]}function a(e){y?r(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function s(e){u(e),E(e,function(e){u(e)})}function u(e){y?r(function(){c(e)}):c(e)}function c(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function l(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function f(e){if(e.shadowRoot&&!e.shadowRoot.__watched){b.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)w(t),t=t.olderShadowRoot}}function m(e,n){if(b.dom){var o=n[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var r=o.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var i=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,i||"")}var a=l(e);n.forEach(function(e){"childList"===e.type&&(O(e.addedNodes,function(e){e.localName&&t(e,a)}),O(e.removedNodes,function(e){e.localName&&s(e)}))}),b.dom&&console.groupEnd()}function p(e){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(m(e,t.takeRecords()),i())}function w(e){if(!e.__observer){var t=new MutationObserver(m.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function v(e){e=window.wrap(e),b.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),w(e),b.dom&&console.groupEnd()}function h(e){_(e,v)}function g(e){HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(e),t(e)}var b=e.flags,E=e.forSubtree,_=e.forDocumentTree,y=window.MutationObserver._isPolyfilled&&b["throttle-attached"];e.hasPolyfillMutations=y,e.hasThrottledAttached=y;var N=!1,M=[],O=Array.prototype.forEach.call.bind(Array.prototype.forEach),D=Element.prototype.createShadowRoot;D&&(Element.prototype.createShadowRoot=function(){var e=D.call(this);return window.CustomElements.watchShadow(this),e}),e.watchShadow=f,e.upgradeDocumentTree=h,e.upgradeDocument=v,e.upgradeSubtree=o,e.upgradeAll=g,e.attached=a,e.takeRecords=p}),window.CustomElements.addModule(function(e){function t(t,o){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.getAttribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinition(r);if(i&&(r&&i.tag==t.localName||!r&&!i["extends"]))return n(t,i,o)}}function n(t,n,r){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),r&&e.attached(t),e.upgradeSubtree(t,r),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(r),d=0;i=a[d];d++)o[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=o}),window.CustomElements.addModule(function(e){function t(t,o){var s=o||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(u(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return s.prototype||(s.prototype=Object.create(HTMLElement.prototype)),s.__name=t.toLowerCase(),s.lifecycle=s.lifecycle||{},s.ancestry=i(s["extends"]),a(s),d(s),n(s.prototype),c(s.__name,s),s.ctor=l(s),s.ctor.prototype=s.prototype,s.prototype.constructor=s.ctor,e.ready&&h(document),s.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&this.attributeChangedCallback(e,o,r)}function r(e){for(var t=0;t<y.length;t++)if(e===y[t])return!0}function i(e){var t=u(e);return t?i(t["extends"]).concat([t]):[]}function a(e){for(var t,n=e["extends"],o=0;t=e.ancestry[o];o++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function d(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var o,r=e.prototype,i=!1;r;)r==t&&(i=!0),o=Object.getPrototypeOf(r),o&&(r.__proto__=o),r=o;i||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e["native"]=t}}function s(e){return b(O(e.tag),e)}function u(e){return e?N[e.toLowerCase()]:void 0}function c(e,t){N[e]=t}function l(e){return function(){return s(e)}}function f(e,t,n){return e===M?m(t,n):D(e,t)}function m(e,t){e&&(e=e.toLowerCase()),t&&(t=t.toLowerCase());var n=u(t||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var o;return t?(o=m(e),o.setAttribute("is",t),o):(o=O(e),e.indexOf("-")>=0&&E(o,HTMLElement),o)}function p(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return g(e),e}}var w,v=e.isIE,h=e.upgradeDocumentTree,g=e.upgradeAll,b=e.upgradeWithDefinition,E=e.implementPrototype,_=e.useNative,y=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],N={},M="http://www.w3.org/1999/xhtml",O=document.createElement.bind(document),D=document.createElementNS.bind(document);w=Object.__proto__||_?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},p(Node.prototype,"cloneNode"),p(document,"importNode"),v&&!function(){var e=document.importNode;document.importNode=function(){var t=e.apply(document,arguments);if(t.nodeType==t.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.appendChild(t),n}return t}}(),document.registerElement=t,document.createElement=m,document.createElementNS=f,e.registry=N,e["instanceof"]=w,e.reservedTagList=y,e.getRegisteredDefinition=u,document.register=document.registerElement}),function(e){function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=window.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=e.useNative,o=e.initializeModules;e.isIE;if(n){var r=function(){};e.watchShadow=r,e.upgrade=r,e.upgradeAll=r,e.upgradeDocumentTree=r,e.upgradeSubtree=r,e.takeRecords=r,e["instanceof"]=function(e,t){return e instanceof t}}else o();var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var d=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(d,t)}else t()}(window.CustomElements);
@@ -0,0 +1,1155 @@
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.17
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
+ if (global.JsMutationObserver) {
49
+ return;
50
+ }
51
+ var registrationsTable = new WeakMap();
52
+ var setImmediate;
53
+ if (/Trident|Edge/.test(navigator.userAgent)) {
54
+ setImmediate = setTimeout;
55
+ } else if (window.setImmediate) {
56
+ setImmediate = window.setImmediate;
57
+ } else {
58
+ var setImmediateQueue = [];
59
+ var sentinel = String(Math.random());
60
+ window.addEventListener("message", function(e) {
61
+ if (e.data === sentinel) {
62
+ var queue = setImmediateQueue;
63
+ setImmediateQueue = [];
64
+ queue.forEach(function(func) {
65
+ func();
66
+ });
67
+ }
68
+ });
69
+ setImmediate = function(func) {
70
+ setImmediateQueue.push(func);
71
+ window.postMessage(sentinel, "*");
72
+ };
73
+ }
74
+ var isScheduled = false;
75
+ var scheduledObservers = [];
76
+ function scheduleCallback(observer) {
77
+ scheduledObservers.push(observer);
78
+ if (!isScheduled) {
79
+ isScheduled = true;
80
+ setImmediate(dispatchCallbacks);
81
+ }
82
+ }
83
+ function wrapIfNeeded(node) {
84
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
85
+ }
86
+ function dispatchCallbacks() {
87
+ isScheduled = false;
88
+ var observers = scheduledObservers;
89
+ scheduledObservers = [];
90
+ observers.sort(function(o1, o2) {
91
+ return o1.uid_ - o2.uid_;
92
+ });
93
+ var anyNonEmpty = false;
94
+ observers.forEach(function(observer) {
95
+ var queue = observer.takeRecords();
96
+ removeTransientObserversFor(observer);
97
+ if (queue.length) {
98
+ observer.callback_(queue, observer);
99
+ anyNonEmpty = true;
100
+ }
101
+ });
102
+ if (anyNonEmpty) dispatchCallbacks();
103
+ }
104
+ function removeTransientObserversFor(observer) {
105
+ observer.nodes_.forEach(function(node) {
106
+ var registrations = registrationsTable.get(node);
107
+ if (!registrations) return;
108
+ registrations.forEach(function(registration) {
109
+ if (registration.observer === observer) registration.removeTransientObservers();
110
+ });
111
+ });
112
+ }
113
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
114
+ for (var node = target; node; node = node.parentNode) {
115
+ var registrations = registrationsTable.get(node);
116
+ if (registrations) {
117
+ for (var j = 0; j < registrations.length; j++) {
118
+ var registration = registrations[j];
119
+ var options = registration.options;
120
+ if (node !== target && !options.subtree) continue;
121
+ var record = callback(options);
122
+ if (record) registration.enqueue(record);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ var uidCounter = 0;
128
+ function JsMutationObserver(callback) {
129
+ this.callback_ = callback;
130
+ this.nodes_ = [];
131
+ this.records_ = [];
132
+ this.uid_ = ++uidCounter;
133
+ }
134
+ JsMutationObserver.prototype = {
135
+ observe: function(target, options) {
136
+ target = wrapIfNeeded(target);
137
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
138
+ throw new SyntaxError();
139
+ }
140
+ var registrations = registrationsTable.get(target);
141
+ if (!registrations) registrationsTable.set(target, registrations = []);
142
+ var registration;
143
+ for (var i = 0; i < registrations.length; i++) {
144
+ if (registrations[i].observer === this) {
145
+ registration = registrations[i];
146
+ registration.removeListeners();
147
+ registration.options = options;
148
+ break;
149
+ }
150
+ }
151
+ if (!registration) {
152
+ registration = new Registration(this, target, options);
153
+ registrations.push(registration);
154
+ this.nodes_.push(target);
155
+ }
156
+ registration.addListeners();
157
+ },
158
+ disconnect: function() {
159
+ this.nodes_.forEach(function(node) {
160
+ var registrations = registrationsTable.get(node);
161
+ for (var i = 0; i < registrations.length; i++) {
162
+ var registration = registrations[i];
163
+ if (registration.observer === this) {
164
+ registration.removeListeners();
165
+ registrations.splice(i, 1);
166
+ break;
167
+ }
168
+ }
169
+ }, this);
170
+ this.records_ = [];
171
+ },
172
+ takeRecords: function() {
173
+ var copyOfRecords = this.records_;
174
+ this.records_ = [];
175
+ return copyOfRecords;
176
+ }
177
+ };
178
+ function MutationRecord(type, target) {
179
+ this.type = type;
180
+ this.target = target;
181
+ this.addedNodes = [];
182
+ this.removedNodes = [];
183
+ this.previousSibling = null;
184
+ this.nextSibling = null;
185
+ this.attributeName = null;
186
+ this.attributeNamespace = null;
187
+ this.oldValue = null;
188
+ }
189
+ function copyMutationRecord(original) {
190
+ var record = new MutationRecord(original.type, original.target);
191
+ record.addedNodes = original.addedNodes.slice();
192
+ record.removedNodes = original.removedNodes.slice();
193
+ record.previousSibling = original.previousSibling;
194
+ record.nextSibling = original.nextSibling;
195
+ record.attributeName = original.attributeName;
196
+ record.attributeNamespace = original.attributeNamespace;
197
+ record.oldValue = original.oldValue;
198
+ return record;
199
+ }
200
+ var currentRecord, recordWithOldValue;
201
+ function getRecord(type, target) {
202
+ return currentRecord = new MutationRecord(type, target);
203
+ }
204
+ function getRecordWithOldValue(oldValue) {
205
+ if (recordWithOldValue) return recordWithOldValue;
206
+ recordWithOldValue = copyMutationRecord(currentRecord);
207
+ recordWithOldValue.oldValue = oldValue;
208
+ return recordWithOldValue;
209
+ }
210
+ function clearRecords() {
211
+ currentRecord = recordWithOldValue = undefined;
212
+ }
213
+ function recordRepresentsCurrentMutation(record) {
214
+ return record === recordWithOldValue || record === currentRecord;
215
+ }
216
+ function selectRecord(lastRecord, newRecord) {
217
+ if (lastRecord === newRecord) return lastRecord;
218
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
219
+ return null;
220
+ }
221
+ function Registration(observer, target, options) {
222
+ this.observer = observer;
223
+ this.target = target;
224
+ this.options = options;
225
+ this.transientObservedNodes = [];
226
+ }
227
+ Registration.prototype = {
228
+ enqueue: function(record) {
229
+ var records = this.observer.records_;
230
+ var length = records.length;
231
+ if (records.length > 0) {
232
+ var lastRecord = records[length - 1];
233
+ var recordToReplaceLast = selectRecord(lastRecord, record);
234
+ if (recordToReplaceLast) {
235
+ records[length - 1] = recordToReplaceLast;
236
+ return;
237
+ }
238
+ } else {
239
+ scheduleCallback(this.observer);
240
+ }
241
+ records[length] = record;
242
+ },
243
+ addListeners: function() {
244
+ this.addListeners_(this.target);
245
+ },
246
+ addListeners_: function(node) {
247
+ var options = this.options;
248
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
249
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
250
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
251
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
252
+ },
253
+ removeListeners: function() {
254
+ this.removeListeners_(this.target);
255
+ },
256
+ removeListeners_: function(node) {
257
+ var options = this.options;
258
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
259
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
260
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
261
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
262
+ },
263
+ addTransientObserver: function(node) {
264
+ if (node === this.target) return;
265
+ this.addListeners_(node);
266
+ this.transientObservedNodes.push(node);
267
+ var registrations = registrationsTable.get(node);
268
+ if (!registrations) registrationsTable.set(node, registrations = []);
269
+ registrations.push(this);
270
+ },
271
+ removeTransientObservers: function() {
272
+ var transientObservedNodes = this.transientObservedNodes;
273
+ this.transientObservedNodes = [];
274
+ transientObservedNodes.forEach(function(node) {
275
+ this.removeListeners_(node);
276
+ var registrations = registrationsTable.get(node);
277
+ for (var i = 0; i < registrations.length; i++) {
278
+ if (registrations[i] === this) {
279
+ registrations.splice(i, 1);
280
+ break;
281
+ }
282
+ }
283
+ }, this);
284
+ },
285
+ handleEvent: function(e) {
286
+ e.stopImmediatePropagation();
287
+ switch (e.type) {
288
+ case "DOMAttrModified":
289
+ var name = e.attrName;
290
+ var namespace = e.relatedNode.namespaceURI;
291
+ var target = e.target;
292
+ var record = new getRecord("attributes", target);
293
+ record.attributeName = name;
294
+ record.attributeNamespace = namespace;
295
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
296
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
297
+ if (!options.attributes) return;
298
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
299
+ return;
300
+ }
301
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
302
+ return record;
303
+ });
304
+ break;
305
+
306
+ case "DOMCharacterDataModified":
307
+ var target = e.target;
308
+ var record = getRecord("characterData", target);
309
+ var oldValue = e.prevValue;
310
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
311
+ if (!options.characterData) return;
312
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
313
+ return record;
314
+ });
315
+ break;
316
+
317
+ case "DOMNodeRemoved":
318
+ this.addTransientObserver(e.target);
319
+
320
+ case "DOMNodeInserted":
321
+ var changedNode = e.target;
322
+ var addedNodes, removedNodes;
323
+ if (e.type === "DOMNodeInserted") {
324
+ addedNodes = [ changedNode ];
325
+ removedNodes = [];
326
+ } else {
327
+ addedNodes = [];
328
+ removedNodes = [ changedNode ];
329
+ }
330
+ var previousSibling = changedNode.previousSibling;
331
+ var nextSibling = changedNode.nextSibling;
332
+ var record = getRecord("childList", e.target.parentNode);
333
+ record.addedNodes = addedNodes;
334
+ record.removedNodes = removedNodes;
335
+ record.previousSibling = previousSibling;
336
+ record.nextSibling = nextSibling;
337
+ forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
338
+ if (!options.childList) return;
339
+ return record;
340
+ });
341
+ }
342
+ clearRecords();
343
+ }
344
+ };
345
+ global.JsMutationObserver = JsMutationObserver;
346
+ if (!global.MutationObserver) {
347
+ global.MutationObserver = JsMutationObserver;
348
+ JsMutationObserver._isPolyfilled = true;
349
+ }
350
+ })(self);
351
+
352
+ (function(scope) {
353
+ "use strict";
354
+ if (!window.performance) {
355
+ var start = Date.now();
356
+ window.performance = {
357
+ now: function() {
358
+ return Date.now() - start;
359
+ }
360
+ };
361
+ }
362
+ if (!window.requestAnimationFrame) {
363
+ window.requestAnimationFrame = function() {
364
+ var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
365
+ return nativeRaf ? function(callback) {
366
+ return nativeRaf(function() {
367
+ callback(performance.now());
368
+ });
369
+ } : function(callback) {
370
+ return window.setTimeout(callback, 1e3 / 60);
371
+ };
372
+ }();
373
+ }
374
+ if (!window.cancelAnimationFrame) {
375
+ window.cancelAnimationFrame = function() {
376
+ return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
377
+ clearTimeout(id);
378
+ };
379
+ }();
380
+ }
381
+ var workingDefaultPrevented = function() {
382
+ var e = document.createEvent("Event");
383
+ e.initEvent("foo", true, true);
384
+ e.preventDefault();
385
+ return e.defaultPrevented;
386
+ }();
387
+ if (!workingDefaultPrevented) {
388
+ var origPreventDefault = Event.prototype.preventDefault;
389
+ Event.prototype.preventDefault = function() {
390
+ if (!this.cancelable) {
391
+ return;
392
+ }
393
+ origPreventDefault.call(this);
394
+ Object.defineProperty(this, "defaultPrevented", {
395
+ get: function() {
396
+ return true;
397
+ }
398
+ });
399
+ };
400
+ }
401
+ var isIE = /Trident/.test(navigator.userAgent);
402
+ if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
403
+ window.CustomEvent = function(inType, params) {
404
+ params = params || {};
405
+ var e = document.createEvent("CustomEvent");
406
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
407
+ return e;
408
+ };
409
+ window.CustomEvent.prototype = window.Event.prototype;
410
+ }
411
+ if (!window.Event || isIE && typeof window.Event !== "function") {
412
+ var origEvent = window.Event;
413
+ window.Event = function(inType, params) {
414
+ params = params || {};
415
+ var e = document.createEvent("Event");
416
+ e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
417
+ return e;
418
+ };
419
+ window.Event.prototype = origEvent.prototype;
420
+ }
421
+ })(window.WebComponents);
422
+
423
+ window.HTMLImports = window.HTMLImports || {
424
+ flags: {}
425
+ };
426
+
427
+ (function(scope) {
428
+ var IMPORT_LINK_TYPE = "import";
429
+ var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
430
+ var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
431
+ var wrap = function(node) {
432
+ return hasShadowDOMPolyfill ? window.ShadowDOMPolyfill.wrapIfNeeded(node) : node;
433
+ };
434
+ var rootDocument = wrap(document);
435
+ var currentScriptDescriptor = {
436
+ get: function() {
437
+ var script = window.HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
438
+ return wrap(script);
439
+ },
440
+ configurable: true
441
+ };
442
+ Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
443
+ Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
444
+ var isIE = /Trident/.test(navigator.userAgent);
445
+ function whenReady(callback, doc) {
446
+ doc = doc || rootDocument;
447
+ whenDocumentReady(function() {
448
+ watchImportsLoad(callback, doc);
449
+ }, doc);
450
+ }
451
+ var requiredReadyState = isIE ? "complete" : "interactive";
452
+ var READY_EVENT = "readystatechange";
453
+ function isDocumentReady(doc) {
454
+ return doc.readyState === "complete" || doc.readyState === requiredReadyState;
455
+ }
456
+ function whenDocumentReady(callback, doc) {
457
+ if (!isDocumentReady(doc)) {
458
+ var checkReady = function() {
459
+ if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
460
+ doc.removeEventListener(READY_EVENT, checkReady);
461
+ whenDocumentReady(callback, doc);
462
+ }
463
+ };
464
+ doc.addEventListener(READY_EVENT, checkReady);
465
+ } else if (callback) {
466
+ callback();
467
+ }
468
+ }
469
+ function markTargetLoaded(event) {
470
+ event.target.__loaded = true;
471
+ }
472
+ function watchImportsLoad(callback, doc) {
473
+ var imports = doc.querySelectorAll("link[rel=import]");
474
+ var parsedCount = 0, importCount = imports.length, newImports = [], errorImports = [];
475
+ function checkDone() {
476
+ if (parsedCount == importCount && callback) {
477
+ callback({
478
+ allImports: imports,
479
+ loadedImports: newImports,
480
+ errorImports: errorImports
481
+ });
482
+ }
483
+ }
484
+ function loadedImport(e) {
485
+ markTargetLoaded(e);
486
+ newImports.push(this);
487
+ parsedCount++;
488
+ checkDone();
489
+ }
490
+ function errorLoadingImport(e) {
491
+ errorImports.push(this);
492
+ parsedCount++;
493
+ checkDone();
494
+ }
495
+ if (importCount) {
496
+ for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
497
+ if (isImportLoaded(imp)) {
498
+ parsedCount++;
499
+ checkDone();
500
+ } else {
501
+ imp.addEventListener("load", loadedImport);
502
+ imp.addEventListener("error", errorLoadingImport);
503
+ }
504
+ }
505
+ } else {
506
+ checkDone();
507
+ }
508
+ }
509
+ function isImportLoaded(link) {
510
+ return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
511
+ }
512
+ if (useNative) {
513
+ new MutationObserver(function(mxns) {
514
+ for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
515
+ if (m.addedNodes) {
516
+ handleImports(m.addedNodes);
517
+ }
518
+ }
519
+ }).observe(document.head, {
520
+ childList: true
521
+ });
522
+ function handleImports(nodes) {
523
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
524
+ if (isImport(n)) {
525
+ handleImport(n);
526
+ }
527
+ }
528
+ }
529
+ function isImport(element) {
530
+ return element.localName === "link" && element.rel === "import";
531
+ }
532
+ function handleImport(element) {
533
+ var loaded = element.import;
534
+ if (loaded) {
535
+ markTargetLoaded({
536
+ target: element
537
+ });
538
+ } else {
539
+ element.addEventListener("load", markTargetLoaded);
540
+ element.addEventListener("error", markTargetLoaded);
541
+ }
542
+ }
543
+ (function() {
544
+ if (document.readyState === "loading") {
545
+ var imports = document.querySelectorAll("link[rel=import]");
546
+ for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
547
+ handleImport(imp);
548
+ }
549
+ }
550
+ })();
551
+ }
552
+ whenReady(function(detail) {
553
+ window.HTMLImports.ready = true;
554
+ window.HTMLImports.readyTime = new Date().getTime();
555
+ var evt = rootDocument.createEvent("CustomEvent");
556
+ evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
557
+ rootDocument.dispatchEvent(evt);
558
+ });
559
+ scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
560
+ scope.useNative = useNative;
561
+ scope.rootDocument = rootDocument;
562
+ scope.whenReady = whenReady;
563
+ scope.isIE = isIE;
564
+ })(window.HTMLImports);
565
+
566
+ (function(scope) {
567
+ var modules = [];
568
+ var addModule = function(module) {
569
+ modules.push(module);
570
+ };
571
+ var initializeModules = function() {
572
+ modules.forEach(function(module) {
573
+ module(scope);
574
+ });
575
+ };
576
+ scope.addModule = addModule;
577
+ scope.initializeModules = initializeModules;
578
+ })(window.HTMLImports);
579
+
580
+ window.HTMLImports.addModule(function(scope) {
581
+ var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
582
+ var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
583
+ var path = {
584
+ resolveUrlsInStyle: function(style, linkUrl) {
585
+ var doc = style.ownerDocument;
586
+ var resolver = doc.createElement("a");
587
+ style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver);
588
+ return style;
589
+ },
590
+ resolveUrlsInCssText: function(cssText, linkUrl, urlObj) {
591
+ var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP);
592
+ r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP);
593
+ return r;
594
+ },
595
+ replaceUrls: function(text, urlObj, linkUrl, regexp) {
596
+ return text.replace(regexp, function(m, pre, url, post) {
597
+ var urlPath = url.replace(/["']/g, "");
598
+ if (linkUrl) {
599
+ urlPath = new URL(urlPath, linkUrl).href;
600
+ }
601
+ urlObj.href = urlPath;
602
+ urlPath = urlObj.href;
603
+ return pre + "'" + urlPath + "'" + post;
604
+ });
605
+ }
606
+ };
607
+ scope.path = path;
608
+ });
609
+
610
+ window.HTMLImports.addModule(function(scope) {
611
+ var xhr = {
612
+ async: true,
613
+ ok: function(request) {
614
+ return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
615
+ },
616
+ load: function(url, next, nextContext) {
617
+ var request = new XMLHttpRequest();
618
+ if (scope.flags.debug || scope.flags.bust) {
619
+ url += "?" + Math.random();
620
+ }
621
+ request.open("GET", url, xhr.async);
622
+ request.addEventListener("readystatechange", function(e) {
623
+ if (request.readyState === 4) {
624
+ var redirectedUrl = null;
625
+ try {
626
+ var locationHeader = request.getResponseHeader("Location");
627
+ if (locationHeader) {
628
+ redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
629
+ }
630
+ } catch (e) {
631
+ console.error(e.message);
632
+ }
633
+ next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
634
+ }
635
+ });
636
+ request.send();
637
+ return request;
638
+ },
639
+ loadDocument: function(url, next, nextContext) {
640
+ this.load(url, next, nextContext).responseType = "document";
641
+ }
642
+ };
643
+ scope.xhr = xhr;
644
+ });
645
+
646
+ window.HTMLImports.addModule(function(scope) {
647
+ var xhr = scope.xhr;
648
+ var flags = scope.flags;
649
+ var Loader = function(onLoad, onComplete) {
650
+ this.cache = {};
651
+ this.onload = onLoad;
652
+ this.oncomplete = onComplete;
653
+ this.inflight = 0;
654
+ this.pending = {};
655
+ };
656
+ Loader.prototype = {
657
+ addNodes: function(nodes) {
658
+ this.inflight += nodes.length;
659
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
660
+ this.require(n);
661
+ }
662
+ this.checkDone();
663
+ },
664
+ addNode: function(node) {
665
+ this.inflight++;
666
+ this.require(node);
667
+ this.checkDone();
668
+ },
669
+ require: function(elt) {
670
+ var url = elt.src || elt.href;
671
+ elt.__nodeUrl = url;
672
+ if (!this.dedupe(url, elt)) {
673
+ this.fetch(url, elt);
674
+ }
675
+ },
676
+ dedupe: function(url, elt) {
677
+ if (this.pending[url]) {
678
+ this.pending[url].push(elt);
679
+ return true;
680
+ }
681
+ var resource;
682
+ if (this.cache[url]) {
683
+ this.onload(url, elt, this.cache[url]);
684
+ this.tail();
685
+ return true;
686
+ }
687
+ this.pending[url] = [ elt ];
688
+ return false;
689
+ },
690
+ fetch: function(url, elt) {
691
+ flags.load && console.log("fetch", url, elt);
692
+ if (!url) {
693
+ setTimeout(function() {
694
+ this.receive(url, elt, {
695
+ error: "href must be specified"
696
+ }, null);
697
+ }.bind(this), 0);
698
+ } else if (url.match(/^data:/)) {
699
+ var pieces = url.split(",");
700
+ var header = pieces[0];
701
+ var body = pieces[1];
702
+ if (header.indexOf(";base64") > -1) {
703
+ body = atob(body);
704
+ } else {
705
+ body = decodeURIComponent(body);
706
+ }
707
+ setTimeout(function() {
708
+ this.receive(url, elt, null, body);
709
+ }.bind(this), 0);
710
+ } else {
711
+ var receiveXhr = function(err, resource, redirectedUrl) {
712
+ this.receive(url, elt, err, resource, redirectedUrl);
713
+ }.bind(this);
714
+ xhr.load(url, receiveXhr);
715
+ }
716
+ },
717
+ receive: function(url, elt, err, resource, redirectedUrl) {
718
+ this.cache[url] = resource;
719
+ var $p = this.pending[url];
720
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
721
+ this.onload(url, p, resource, err, redirectedUrl);
722
+ this.tail();
723
+ }
724
+ this.pending[url] = null;
725
+ },
726
+ tail: function() {
727
+ --this.inflight;
728
+ this.checkDone();
729
+ },
730
+ checkDone: function() {
731
+ if (!this.inflight) {
732
+ this.oncomplete();
733
+ }
734
+ }
735
+ };
736
+ scope.Loader = Loader;
737
+ });
738
+
739
+ window.HTMLImports.addModule(function(scope) {
740
+ var Observer = function(addCallback) {
741
+ this.addCallback = addCallback;
742
+ this.mo = new MutationObserver(this.handler.bind(this));
743
+ };
744
+ Observer.prototype = {
745
+ handler: function(mutations) {
746
+ for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
747
+ if (m.type === "childList" && m.addedNodes.length) {
748
+ this.addedNodes(m.addedNodes);
749
+ }
750
+ }
751
+ },
752
+ addedNodes: function(nodes) {
753
+ if (this.addCallback) {
754
+ this.addCallback(nodes);
755
+ }
756
+ for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
757
+ if (n.children && n.children.length) {
758
+ this.addedNodes(n.children);
759
+ }
760
+ }
761
+ },
762
+ observe: function(root) {
763
+ this.mo.observe(root, {
764
+ childList: true,
765
+ subtree: true
766
+ });
767
+ }
768
+ };
769
+ scope.Observer = Observer;
770
+ });
771
+
772
+ window.HTMLImports.addModule(function(scope) {
773
+ var path = scope.path;
774
+ var rootDocument = scope.rootDocument;
775
+ var flags = scope.flags;
776
+ var isIE = scope.isIE;
777
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
778
+ var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
779
+ var importParser = {
780
+ documentSelectors: IMPORT_SELECTOR,
781
+ importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
782
+ map: {
783
+ link: "parseLink",
784
+ script: "parseScript",
785
+ style: "parseStyle"
786
+ },
787
+ dynamicElements: [],
788
+ parseNext: function() {
789
+ var next = this.nextToParse();
790
+ if (next) {
791
+ this.parse(next);
792
+ }
793
+ },
794
+ parse: function(elt) {
795
+ if (this.isParsed(elt)) {
796
+ flags.parse && console.log("[%s] is already parsed", elt.localName);
797
+ return;
798
+ }
799
+ var fn = this[this.map[elt.localName]];
800
+ if (fn) {
801
+ this.markParsing(elt);
802
+ fn.call(this, elt);
803
+ }
804
+ },
805
+ parseDynamic: function(elt, quiet) {
806
+ this.dynamicElements.push(elt);
807
+ if (!quiet) {
808
+ this.parseNext();
809
+ }
810
+ },
811
+ markParsing: function(elt) {
812
+ flags.parse && console.log("parsing", elt);
813
+ this.parsingElement = elt;
814
+ },
815
+ markParsingComplete: function(elt) {
816
+ elt.__importParsed = true;
817
+ this.markDynamicParsingComplete(elt);
818
+ if (elt.__importElement) {
819
+ elt.__importElement.__importParsed = true;
820
+ this.markDynamicParsingComplete(elt.__importElement);
821
+ }
822
+ this.parsingElement = null;
823
+ flags.parse && console.log("completed", elt);
824
+ },
825
+ markDynamicParsingComplete: function(elt) {
826
+ var i = this.dynamicElements.indexOf(elt);
827
+ if (i >= 0) {
828
+ this.dynamicElements.splice(i, 1);
829
+ }
830
+ },
831
+ parseImport: function(elt) {
832
+ elt.import = elt.__doc;
833
+ if (window.HTMLImports.__importsParsingHook) {
834
+ window.HTMLImports.__importsParsingHook(elt);
835
+ }
836
+ if (elt.import) {
837
+ elt.import.__importParsed = true;
838
+ }
839
+ this.markParsingComplete(elt);
840
+ if (elt.__resource && !elt.__error) {
841
+ elt.dispatchEvent(new CustomEvent("load", {
842
+ bubbles: false
843
+ }));
844
+ } else {
845
+ elt.dispatchEvent(new CustomEvent("error", {
846
+ bubbles: false
847
+ }));
848
+ }
849
+ if (elt.__pending) {
850
+ var fn;
851
+ while (elt.__pending.length) {
852
+ fn = elt.__pending.shift();
853
+ if (fn) {
854
+ fn({
855
+ target: elt
856
+ });
857
+ }
858
+ }
859
+ }
860
+ this.parseNext();
861
+ },
862
+ parseLink: function(linkElt) {
863
+ if (nodeIsImport(linkElt)) {
864
+ this.parseImport(linkElt);
865
+ } else {
866
+ linkElt.href = linkElt.href;
867
+ this.parseGeneric(linkElt);
868
+ }
869
+ },
870
+ parseStyle: function(elt) {
871
+ var src = elt;
872
+ elt = cloneStyle(elt);
873
+ src.__appliedElement = elt;
874
+ elt.__importElement = src;
875
+ this.parseGeneric(elt);
876
+ },
877
+ parseGeneric: function(elt) {
878
+ this.trackElement(elt);
879
+ this.addElementToDocument(elt);
880
+ },
881
+ rootImportForElement: function(elt) {
882
+ var n = elt;
883
+ while (n.ownerDocument.__importLink) {
884
+ n = n.ownerDocument.__importLink;
885
+ }
886
+ return n;
887
+ },
888
+ addElementToDocument: function(elt) {
889
+ var port = this.rootImportForElement(elt.__importElement || elt);
890
+ port.parentNode.insertBefore(elt, port);
891
+ },
892
+ trackElement: function(elt, callback) {
893
+ var self = this;
894
+ var done = function(e) {
895
+ elt.removeEventListener("load", done);
896
+ elt.removeEventListener("error", done);
897
+ if (callback) {
898
+ callback(e);
899
+ }
900
+ self.markParsingComplete(elt);
901
+ self.parseNext();
902
+ };
903
+ elt.addEventListener("load", done);
904
+ elt.addEventListener("error", done);
905
+ if (isIE && elt.localName === "style") {
906
+ var fakeLoad = false;
907
+ if (elt.textContent.indexOf("@import") == -1) {
908
+ fakeLoad = true;
909
+ } else if (elt.sheet) {
910
+ fakeLoad = true;
911
+ var csr = elt.sheet.cssRules;
912
+ var len = csr ? csr.length : 0;
913
+ for (var i = 0, r; i < len && (r = csr[i]); i++) {
914
+ if (r.type === CSSRule.IMPORT_RULE) {
915
+ fakeLoad = fakeLoad && Boolean(r.styleSheet);
916
+ }
917
+ }
918
+ }
919
+ if (fakeLoad) {
920
+ setTimeout(function() {
921
+ elt.dispatchEvent(new CustomEvent("load", {
922
+ bubbles: false
923
+ }));
924
+ });
925
+ }
926
+ }
927
+ },
928
+ parseScript: function(scriptElt) {
929
+ var script = document.createElement("script");
930
+ script.__importElement = scriptElt;
931
+ script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
932
+ scope.currentScript = scriptElt;
933
+ this.trackElement(script, function(e) {
934
+ if (script.parentNode) {
935
+ script.parentNode.removeChild(script);
936
+ }
937
+ scope.currentScript = null;
938
+ });
939
+ this.addElementToDocument(script);
940
+ },
941
+ nextToParse: function() {
942
+ this._mayParse = [];
943
+ return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
944
+ },
945
+ nextToParseInDoc: function(doc, link) {
946
+ if (doc && this._mayParse.indexOf(doc) < 0) {
947
+ this._mayParse.push(doc);
948
+ var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
949
+ for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
950
+ if (!this.isParsed(n)) {
951
+ if (this.hasResource(n)) {
952
+ return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
953
+ } else {
954
+ return;
955
+ }
956
+ }
957
+ }
958
+ }
959
+ return link;
960
+ },
961
+ nextToParseDynamic: function() {
962
+ return this.dynamicElements[0];
963
+ },
964
+ parseSelectorsForNode: function(node) {
965
+ var doc = node.ownerDocument || node;
966
+ return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
967
+ },
968
+ isParsed: function(node) {
969
+ return node.__importParsed;
970
+ },
971
+ needsDynamicParsing: function(elt) {
972
+ return this.dynamicElements.indexOf(elt) >= 0;
973
+ },
974
+ hasResource: function(node) {
975
+ if (nodeIsImport(node) && node.__doc === undefined) {
976
+ return false;
977
+ }
978
+ return true;
979
+ }
980
+ };
981
+ function nodeIsImport(elt) {
982
+ return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
983
+ }
984
+ function generateScriptDataUrl(script) {
985
+ var scriptContent = generateScriptContent(script);
986
+ return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
987
+ }
988
+ function generateScriptContent(script) {
989
+ return script.textContent + generateSourceMapHint(script);
990
+ }
991
+ function generateSourceMapHint(script) {
992
+ var owner = script.ownerDocument;
993
+ owner.__importedScripts = owner.__importedScripts || 0;
994
+ var moniker = script.ownerDocument.baseURI;
995
+ var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
996
+ owner.__importedScripts++;
997
+ return "\n//# sourceURL=" + moniker + num + ".js\n";
998
+ }
999
+ function cloneStyle(style) {
1000
+ var clone = style.ownerDocument.createElement("style");
1001
+ clone.textContent = style.textContent;
1002
+ path.resolveUrlsInStyle(clone);
1003
+ return clone;
1004
+ }
1005
+ scope.parser = importParser;
1006
+ scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
1007
+ });
1008
+
1009
+ window.HTMLImports.addModule(function(scope) {
1010
+ var flags = scope.flags;
1011
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1012
+ var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
1013
+ var rootDocument = scope.rootDocument;
1014
+ var Loader = scope.Loader;
1015
+ var Observer = scope.Observer;
1016
+ var parser = scope.parser;
1017
+ var importer = {
1018
+ documents: {},
1019
+ documentPreloadSelectors: IMPORT_SELECTOR,
1020
+ importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
1021
+ loadNode: function(node) {
1022
+ importLoader.addNode(node);
1023
+ },
1024
+ loadSubtree: function(parent) {
1025
+ var nodes = this.marshalNodes(parent);
1026
+ importLoader.addNodes(nodes);
1027
+ },
1028
+ marshalNodes: function(parent) {
1029
+ return parent.querySelectorAll(this.loadSelectorsForNode(parent));
1030
+ },
1031
+ loadSelectorsForNode: function(node) {
1032
+ var doc = node.ownerDocument || node;
1033
+ return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
1034
+ },
1035
+ loaded: function(url, elt, resource, err, redirectedUrl) {
1036
+ flags.load && console.log("loaded", url, elt);
1037
+ elt.__resource = resource;
1038
+ elt.__error = err;
1039
+ if (isImportLink(elt)) {
1040
+ var doc = this.documents[url];
1041
+ if (doc === undefined) {
1042
+ doc = err ? null : makeDocument(resource, redirectedUrl || url);
1043
+ if (doc) {
1044
+ doc.__importLink = elt;
1045
+ this.bootDocument(doc);
1046
+ }
1047
+ this.documents[url] = doc;
1048
+ }
1049
+ elt.__doc = doc;
1050
+ }
1051
+ parser.parseNext();
1052
+ },
1053
+ bootDocument: function(doc) {
1054
+ this.loadSubtree(doc);
1055
+ this.observer.observe(doc);
1056
+ parser.parseNext();
1057
+ },
1058
+ loadedAll: function() {
1059
+ parser.parseNext();
1060
+ }
1061
+ };
1062
+ var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
1063
+ importer.observer = new Observer();
1064
+ function isImportLink(elt) {
1065
+ return isLinkRel(elt, IMPORT_LINK_TYPE);
1066
+ }
1067
+ function isLinkRel(elt, rel) {
1068
+ return elt.localName === "link" && elt.getAttribute("rel") === rel;
1069
+ }
1070
+ function hasBaseURIAccessor(doc) {
1071
+ return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
1072
+ }
1073
+ function makeDocument(resource, url) {
1074
+ var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
1075
+ doc._URL = url;
1076
+ var base = doc.createElement("base");
1077
+ base.setAttribute("href", url);
1078
+ if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
1079
+ Object.defineProperty(doc, "baseURI", {
1080
+ value: url
1081
+ });
1082
+ }
1083
+ var meta = doc.createElement("meta");
1084
+ meta.setAttribute("charset", "utf-8");
1085
+ doc.head.appendChild(meta);
1086
+ doc.head.appendChild(base);
1087
+ doc.body.innerHTML = resource;
1088
+ if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
1089
+ HTMLTemplateElement.bootstrap(doc);
1090
+ }
1091
+ return doc;
1092
+ }
1093
+ if (!document.baseURI) {
1094
+ var baseURIDescriptor = {
1095
+ get: function() {
1096
+ var base = document.querySelector("base");
1097
+ return base ? base.href : window.location.href;
1098
+ },
1099
+ configurable: true
1100
+ };
1101
+ Object.defineProperty(document, "baseURI", baseURIDescriptor);
1102
+ Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
1103
+ }
1104
+ scope.importer = importer;
1105
+ scope.importLoader = importLoader;
1106
+ });
1107
+
1108
+ window.HTMLImports.addModule(function(scope) {
1109
+ var parser = scope.parser;
1110
+ var importer = scope.importer;
1111
+ var dynamic = {
1112
+ added: function(nodes) {
1113
+ var owner, parsed, loading;
1114
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1115
+ if (!owner) {
1116
+ owner = n.ownerDocument;
1117
+ parsed = parser.isParsed(owner);
1118
+ }
1119
+ loading = this.shouldLoadNode(n);
1120
+ if (loading) {
1121
+ importer.loadNode(n);
1122
+ }
1123
+ if (this.shouldParseNode(n) && parsed) {
1124
+ parser.parseDynamic(n, loading);
1125
+ }
1126
+ }
1127
+ },
1128
+ shouldLoadNode: function(node) {
1129
+ return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
1130
+ },
1131
+ shouldParseNode: function(node) {
1132
+ return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
1133
+ }
1134
+ };
1135
+ importer.observer.addCallback = dynamic.added.bind(dynamic);
1136
+ var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
1137
+ });
1138
+
1139
+ (function(scope) {
1140
+ var initializeModules = scope.initializeModules;
1141
+ var isIE = scope.isIE;
1142
+ if (scope.useNative) {
1143
+ return;
1144
+ }
1145
+ initializeModules();
1146
+ var rootDocument = scope.rootDocument;
1147
+ function bootstrap() {
1148
+ window.HTMLImports.importer.bootDocument(rootDocument);
1149
+ }
1150
+ if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
1151
+ bootstrap();
1152
+ } else {
1153
+ document.addEventListener("DOMContentLoaded", bootstrap);
1154
+ }
1155
+ })(window.HTMLImports);