polymer-neon-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-resizable-behavior/README.md +16 -0
- data/app/assets/components/iron-resizable-behavior/bower.json +26 -0
- data/app/assets/components/iron-resizable-behavior/demo/index.html +29 -0
- data/app/assets/components/iron-resizable-behavior/demo/src/x-app.html +114 -0
- data/app/assets/components/iron-resizable-behavior/index.html +25 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-resizable-behavior/test/basic.html +263 -0
- data/app/assets/components/iron-resizable-behavior/test/index.html +31 -0
- data/app/assets/components/iron-resizable-behavior/test/test-elements.html +143 -0
- data/app/assets/components/iron-selector/README.md +50 -0
- data/app/assets/components/iron-selector/bower.json +31 -0
- data/app/assets/components/iron-selector/demo/index.html +66 -0
- data/app/assets/components/iron-selector/index.html +28 -0
- data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
- data/app/assets/components/iron-selector/iron-selectable.html +307 -0
- data/app/assets/components/iron-selector/iron-selection.html +115 -0
- data/app/assets/components/iron-selector/iron-selector.html +71 -0
- data/app/assets/components/iron-selector/test/activate-event.html +138 -0
- data/app/assets/components/iron-selector/test/basic.html +150 -0
- data/app/assets/components/iron-selector/test/content-element.html +43 -0
- data/app/assets/components/iron-selector/test/content.html +168 -0
- data/app/assets/components/iron-selector/test/index.html +36 -0
- data/app/assets/components/iron-selector/test/multi.html +135 -0
- data/app/assets/components/iron-selector/test/next-previous.html +134 -0
- data/app/assets/components/iron-selector/test/selected-attribute.html +72 -0
- data/app/assets/components/iron-selector/test/template-repeat.html +110 -0
- data/app/assets/components/neon-animation/README.md +304 -0
- data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
- data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
- data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
- data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
- data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
- data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
- data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
- data/app/assets/components/neon-animation/bower.json +51 -0
- data/app/assets/components/neon-animation/demo/declarative/index.html +108 -0
- data/app/assets/components/neon-animation/demo/doc/basic.html +47 -0
- data/app/assets/components/neon-animation/demo/doc/my-animatable.html +73 -0
- data/app/assets/components/neon-animation/demo/doc/my-dialog.html +97 -0
- data/app/assets/components/neon-animation/demo/doc/types.html +53 -0
- data/app/assets/components/neon-animation/demo/dropdown/animated-dropdown.html +97 -0
- data/app/assets/components/neon-animation/demo/dropdown/index.html +54 -0
- data/app/assets/components/neon-animation/demo/grid/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/grid/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/grid/index.html +70 -0
- data/app/assets/components/neon-animation/demo/index.html +6 -0
- data/app/assets/components/neon-animation/demo/list/full-view.html +122 -0
- data/app/assets/components/neon-animation/demo/list/index.html +29 -0
- data/app/assets/components/neon-animation/demo/list/list-demo.html +112 -0
- data/app/assets/components/neon-animation/demo/list/list-view.html +127 -0
- data/app/assets/components/neon-animation/demo/load/animated-grid.html +147 -0
- data/app/assets/components/neon-animation/demo/load/full-page.html +86 -0
- data/app/assets/components/neon-animation/demo/load/index.html +45 -0
- data/app/assets/components/neon-animation/demo/reprojection/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/reprojection/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/reprojection/index.html +66 -0
- data/app/assets/components/neon-animation/demo/reprojection/reprojected-pages.html +42 -0
- data/app/assets/components/neon-animation/demo/shared.css +40 -0
- data/app/assets/components/neon-animation/demo/tiles/circles-page.html +110 -0
- data/app/assets/components/neon-animation/demo/tiles/index.html +77 -0
- data/app/assets/components/neon-animation/demo/tiles/squares-page.html +104 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/index.html +30 -0
- data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
- data/app/assets/components/neon-animation/neon-animatable.html +54 -0
- data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
- data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
- data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
- data/app/assets/components/neon-animation/neon-animation.html +17 -0
- data/app/assets/components/neon-animation/neon-animations.html +25 -0
- data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
- data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
- data/app/assets/components/neon-animation/web-animations.html +11 -0
- data/app/assets/components/neon-elements/README.md +19 -0
- data/app/assets/components/neon-elements/bower.json +26 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/web-animations-js/COPYING +202 -0
- data/app/assets/components/web-animations-js/History.md +108 -0
- data/app/assets/components/web-animations-js/README.md +161 -0
- data/app/assets/components/web-animations-js/bower.json +31 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations.html +50 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.gz +0 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.map +1 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-neon-rails.rb +2 -0
- data/lib/polymer-neon-rails/engine.rb +4 -0
- data/lib/polymer-neon-rails/version.rb +3 -0
- metadata +264 -0
@@ -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.3
|
11
|
+
"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.prototype={set:function(t,r){var n=t[this.name];return n&&n[0]===t?n[1]=r:e(t,this.name,{value:[t,r],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=r}(),function(e){function t(e){_.push(e),b||(b=!0,h(n))}function r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function n(){b=!1;var e=_;_=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var r=e.takeRecords();o(e),r.length&&(e.callback_(r,e),t=!0)}),t&&n()}function o(e){e.nodes_.forEach(function(t){var r=v.get(t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var r=e;r;r=r.parentNode){var n=v.get(r);if(n)for(var o=0;o<n.length;o++){var i=n[o],a=i.options;if(r===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++E}function s(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 d(e){var t=new s(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 s(e,t)}function c(e){return N?N:(N=d(y),N.oldValue=e,N)}function l(){y=N=void 0}function f(e){return e===N||e===y}function p(e,t){return e===t?e:N&&f(e)?N:null}function m(e,t,r){this.observer=e,this.target=t,this.options=r,this.transientObservedNodes=[]}var h,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))h=setTimeout;else if(window.setImmediate)h=window.setImmediate;else{var w=[],g=String(Math.random());window.addEventListener("message",function(e){if(e.data===g){var t=w;w=[],t.forEach(function(e){e()})}}),h=function(e){w.push(e),window.postMessage(g,"*")}}var b=!1,_=[],E=0;a.prototype={observe:function(e,t){if(e=r(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 n=v.get(e);n||v.set(e,n=[]);for(var o,i=0;i<n.length;i++)if(n[i].observer===this){o=n[i],o.removeListeners(),o.options=t;break}o||(o=new m(this,e,t),n.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),r=0;r<t.length;r++){var n=t[r];if(n.observer===this){n.removeListeners(),t.splice(r,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var y,N;m.prototype={enqueue:function(e){var r=this.observer.records_,n=r.length;if(r.length>0){var o=r[n-1],i=p(o,e);if(i)return void(r[n-1]=i)}else t(this.observer);r[n]=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),r=0;r<t.length;r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e.relatedNode.namespaceURI,n=e.target,o=new u("attributes",n);o.attributeName=t,o.attributeNamespace=r;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(n,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(r)?void 0:e.attributeOldValue?c(a):o});break;case"DOMCharacterDataModified":var n=e.target,o=u("characterData",n),a=e.prevValue;i(n,function(e){return e.characterData?e.characterDataOldValue?c(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,d,f=e.target;"DOMNodeInserted"===e.type?(s=[f],d=[]):(s=[],d=[f]);var p=f.previousSibling,m=f.nextSibling,o=u("childList",e.target.parentNode);o.addedNodes=s,o.removedNodes=d,o.previousSibling=p,o.nextSibling=m,i(e.relatedNode,function(e){return e.childList?o:void 0})}l()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a)}(this),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,r=[],n=function(e){r.push(e)},o=function(){r.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=o,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(e){function t(e,t){r(e,function(e){return t(e)?!0:void n(e,t)}),n(e,t)}function r(e,t,n){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)t(o,n)!==!0&&r(o,t,n),o=o.nextElementSibling;return null}function n(e,r){for(var n=e.shadowRoot;n;)t(n,r),n=n.olderShadowRoot}function o(e,t){i(e,t,[])}function i(e,t,r){if(e=wrap(e),!(r.indexOf(e)>=0)){r.push(e);for(var n,o=e.querySelectorAll("link[rel="+a+"]"),s=0,d=o.length;d>s&&(n=o[s]);s++)n["import"]&&i(n["import"],t,r);t(e)}}var a=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=o,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e){return r(e)||n(e)}function r(t){return e.upgrade(t)?!0:void s(t)}function n(e){_(e,function(e){return r(e)?!0:void 0})}function o(e){s(e),f(e)&&_(e,function(e){s(e)})}function i(e){M.push(e),N||(N=!0,setTimeout(a))}function a(){N=!1;for(var e,t=M,r=0,n=t.length;n>r&&(e=t[r]);r++)e();M=[]}function s(e){y?i(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&f(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function u(e){c(e),_(e,function(e){c(e)})}function c(e){y?i(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!f(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,r=wrap(document);t;){if(t==r)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function p(e){if(e.shadowRoot&&!e.shadowRoot.__watched){b.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)v(t),t=t.olderShadowRoot}}function m(e){if(b.dom){var r=e[0];if(r&&"childList"===r.type&&r.addedNodes&&r.addedNodes){for(var n=r.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var o=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,o||"")}e.forEach(function(e){"childList"===e.type&&(O(e.addedNodes,function(e){e.localName&&t(e)}),O(e.removedNodes,function(e){e.localName&&u(e)}))}),b.dom&&console.groupEnd()}function h(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(m(t.takeRecords()),a())}function v(e){if(!e.__observer){var t=new MutationObserver(m);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function w(e){e=wrap(e),b.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),v(e),b.dom&&console.groupEnd()}function g(e){E(e,w)}var b=e.flags,_=e.forSubtree,E=e.forDocumentTree,y=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=y;var N=!1,M=[],O=Array.prototype.forEach.call.bind(Array.prototype.forEach),L=Element.prototype.createShadowRoot;L&&(Element.prototype.createShadowRoot=function(){var e=L.call(this);return CustomElements.watchShadow(this),e}),e.watchShadow=p,e.upgradeDocumentTree=g,e.upgradeSubtree=n,e.upgradeAll=t,e.attachedNode=o,e.takeRecords=h}),window.CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is"),o=e.getRegisteredDefinition(n||t.localName);if(o){if(n&&o.tag==t.localName)return r(t,o);if(!n&&!o["extends"])return r(t,o)}}}function r(t,r){return a.upgrade&&console.group("upgrade:",t.localName),r.is&&t.setAttribute("is",r.is),n(t,r),t.__upgraded__=!0,i(t),e.attachedNode(t),e.upgradeSubtree(t),a.upgrade&&console.groupEnd(),t}function n(e,t){Object.__proto__?e.__proto__=t.prototype:(o(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function o(e,t,r){for(var n={},o=t;o!==r&&o!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)n[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),n[i]=1);o=Object.getPrototypeOf(o)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=r,e.implementPrototype=n}),window.CustomElements.addModule(function(e){function t(t,n){var d=n||{};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(o(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 d.prototype||(d.prototype=Object.create(HTMLElement.prototype)),d.__name=t.toLowerCase(),d.lifecycle=d.lifecycle||{},d.ancestry=i(d["extends"]),a(d),s(d),r(d.prototype),c(d.__name,d),d.ctor=l(d),d.ctor.prototype=d.prototype,d.prototype.constructor=d.ctor,e.ready&&w(document),d.ctor}function r(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,r){n.call(this,e,r,t)};var r=e.removeAttribute;e.removeAttribute=function(e){n.call(this,e,null,r)},e.setAttribute._polyfilled=!0}}function n(e,t,r){e=e.toLowerCase();var n=this.getAttribute(e);r.apply(this,arguments);var o=this.getAttribute(e);this.attributeChangedCallback&&o!==n&&this.attributeChangedCallback(e,n,o)}function o(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,r=e["extends"],n=0;t=e.ancestry[n];n++)r=t.is&&t.tag;e.tag=r||e.__name,r&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var r=document.createElement(e.tag),n=Object.getPrototypeOf(r);n===e.prototype&&(t=n)}for(var o,i=e.prototype;i&&i!==t;)o=Object.getPrototypeOf(i),i.__proto__=o,i=o;e["native"]=t}}function d(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 d(e)}}function f(e,t,r){return e===M?p(t,r):L(e,t)}function p(e,t){e&&(e=e.toLowerCase()),t&&(t=t.toLowerCase());var r=u(t||e);if(r){if(e==r.tag&&t==r.is)return new r.ctor;if(!t&&!r.is)return new r.ctor}var n;return t?(n=p(e),n.setAttribute("is",t),n):(n=O(e),e.indexOf("-")>=0&&_(n,HTMLElement),n)}function m(e,t){var r=e[t];e[t]=function(){var e=r.apply(this,arguments);return g(e),e}}var h,v=e.isIE11OrOlder,w=e.upgradeDocumentTree,g=e.upgradeAll,b=e.upgradeWithDefinition,_=e.implementPrototype,E=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),L=document.createElementNS.bind(document);h=Object.__proto__||E?function(e,t){return e instanceof t}:function(e,t){for(var r=e;r;){if(r===t.prototype)return!0;r=r.__proto__}return!1},m(Node.prototype,"cloneNode"),m(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 r=document.createDocumentFragment();return r.appendChild(t),r}return t}}(),document.registerElement=t,document.createElement=p,document.createElementNS=f,e.registry=N,e["instanceof"]=h,e.reservedTagList=y,e.getRegisteredDefinition=u,document.register=document.registerElement}),function(e){function t(){a(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){a(wrap(e["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var r=e.useNative,n=e.initializeModules,o=/Trident/.test(navigator.userAgent);if(r){var i=function(){};e.watchShadow=i,e.upgrade=i,e.upgradeAll=i,e.upgradeDocumentTree=i,e.upgradeSubtree=i,e.takeRecords=i,e["instanceof"]=function(e,t){return e instanceof t}}else n();var a=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),o&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),r},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t();e.isIE11OrOlder=o}(window.CustomElements);
|
@@ -0,0 +1,1078 @@
|
|
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.HTMLImports = window.HTMLImports || {
|
347
|
+
flags: {}
|
348
|
+
};
|
349
|
+
|
350
|
+
(function(scope) {
|
351
|
+
var IMPORT_LINK_TYPE = "import";
|
352
|
+
var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
|
353
|
+
var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
|
354
|
+
var wrap = function(node) {
|
355
|
+
return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
|
356
|
+
};
|
357
|
+
var rootDocument = wrap(document);
|
358
|
+
var currentScriptDescriptor = {
|
359
|
+
get: function() {
|
360
|
+
var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
|
361
|
+
return wrap(script);
|
362
|
+
},
|
363
|
+
configurable: true
|
364
|
+
};
|
365
|
+
Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
|
366
|
+
Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
|
367
|
+
var isIE = /Trident|Edge/.test(navigator.userAgent);
|
368
|
+
function whenReady(callback, doc) {
|
369
|
+
doc = doc || rootDocument;
|
370
|
+
whenDocumentReady(function() {
|
371
|
+
watchImportsLoad(callback, doc);
|
372
|
+
}, doc);
|
373
|
+
}
|
374
|
+
var requiredReadyState = isIE ? "complete" : "interactive";
|
375
|
+
var READY_EVENT = "readystatechange";
|
376
|
+
function isDocumentReady(doc) {
|
377
|
+
return doc.readyState === "complete" || doc.readyState === requiredReadyState;
|
378
|
+
}
|
379
|
+
function whenDocumentReady(callback, doc) {
|
380
|
+
if (!isDocumentReady(doc)) {
|
381
|
+
var checkReady = function() {
|
382
|
+
if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
|
383
|
+
doc.removeEventListener(READY_EVENT, checkReady);
|
384
|
+
whenDocumentReady(callback, doc);
|
385
|
+
}
|
386
|
+
};
|
387
|
+
doc.addEventListener(READY_EVENT, checkReady);
|
388
|
+
} else if (callback) {
|
389
|
+
callback();
|
390
|
+
}
|
391
|
+
}
|
392
|
+
function markTargetLoaded(event) {
|
393
|
+
event.target.__loaded = true;
|
394
|
+
}
|
395
|
+
function watchImportsLoad(callback, doc) {
|
396
|
+
var imports = doc.querySelectorAll("link[rel=import]");
|
397
|
+
var parsedCount = 0, importCount = imports.length, newImports = [], errorImports = [];
|
398
|
+
function checkDone() {
|
399
|
+
if (parsedCount == importCount && callback) {
|
400
|
+
callback({
|
401
|
+
allImports: imports,
|
402
|
+
loadedImports: newImports,
|
403
|
+
errorImports: errorImports
|
404
|
+
});
|
405
|
+
}
|
406
|
+
}
|
407
|
+
function loadedImport(e) {
|
408
|
+
markTargetLoaded(e);
|
409
|
+
newImports.push(this);
|
410
|
+
parsedCount++;
|
411
|
+
checkDone();
|
412
|
+
}
|
413
|
+
function errorLoadingImport(e) {
|
414
|
+
errorImports.push(this);
|
415
|
+
parsedCount++;
|
416
|
+
checkDone();
|
417
|
+
}
|
418
|
+
if (importCount) {
|
419
|
+
for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
|
420
|
+
if (isImportLoaded(imp)) {
|
421
|
+
parsedCount++;
|
422
|
+
checkDone();
|
423
|
+
} else {
|
424
|
+
imp.addEventListener("load", loadedImport);
|
425
|
+
imp.addEventListener("error", errorLoadingImport);
|
426
|
+
}
|
427
|
+
}
|
428
|
+
} else {
|
429
|
+
checkDone();
|
430
|
+
}
|
431
|
+
}
|
432
|
+
function isImportLoaded(link) {
|
433
|
+
return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
|
434
|
+
}
|
435
|
+
if (useNative) {
|
436
|
+
new MutationObserver(function(mxns) {
|
437
|
+
for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
|
438
|
+
if (m.addedNodes) {
|
439
|
+
handleImports(m.addedNodes);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
}).observe(document.head, {
|
443
|
+
childList: true
|
444
|
+
});
|
445
|
+
function handleImports(nodes) {
|
446
|
+
for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
|
447
|
+
if (isImport(n)) {
|
448
|
+
handleImport(n);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
}
|
452
|
+
function isImport(element) {
|
453
|
+
return element.localName === "link" && element.rel === "import";
|
454
|
+
}
|
455
|
+
function handleImport(element) {
|
456
|
+
var loaded = element.import;
|
457
|
+
if (loaded) {
|
458
|
+
markTargetLoaded({
|
459
|
+
target: element
|
460
|
+
});
|
461
|
+
} else {
|
462
|
+
element.addEventListener("load", markTargetLoaded);
|
463
|
+
element.addEventListener("error", markTargetLoaded);
|
464
|
+
}
|
465
|
+
}
|
466
|
+
(function() {
|
467
|
+
if (document.readyState === "loading") {
|
468
|
+
var imports = document.querySelectorAll("link[rel=import]");
|
469
|
+
for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
|
470
|
+
handleImport(imp);
|
471
|
+
}
|
472
|
+
}
|
473
|
+
})();
|
474
|
+
}
|
475
|
+
whenReady(function(detail) {
|
476
|
+
HTMLImports.ready = true;
|
477
|
+
HTMLImports.readyTime = new Date().getTime();
|
478
|
+
var evt = rootDocument.createEvent("CustomEvent");
|
479
|
+
evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
|
480
|
+
rootDocument.dispatchEvent(evt);
|
481
|
+
});
|
482
|
+
scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
|
483
|
+
scope.useNative = useNative;
|
484
|
+
scope.rootDocument = rootDocument;
|
485
|
+
scope.whenReady = whenReady;
|
486
|
+
scope.isIE = isIE;
|
487
|
+
})(window.HTMLImports);
|
488
|
+
|
489
|
+
(function(scope) {
|
490
|
+
var modules = [];
|
491
|
+
var addModule = function(module) {
|
492
|
+
modules.push(module);
|
493
|
+
};
|
494
|
+
var initializeModules = function() {
|
495
|
+
modules.forEach(function(module) {
|
496
|
+
module(scope);
|
497
|
+
});
|
498
|
+
};
|
499
|
+
scope.addModule = addModule;
|
500
|
+
scope.initializeModules = initializeModules;
|
501
|
+
})(window.HTMLImports);
|
502
|
+
|
503
|
+
window.HTMLImports.addModule(function(scope) {
|
504
|
+
var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
|
505
|
+
var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
|
506
|
+
var path = {
|
507
|
+
resolveUrlsInStyle: function(style, linkUrl) {
|
508
|
+
var doc = style.ownerDocument;
|
509
|
+
var resolver = doc.createElement("a");
|
510
|
+
style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver);
|
511
|
+
return style;
|
512
|
+
},
|
513
|
+
resolveUrlsInCssText: function(cssText, linkUrl, urlObj) {
|
514
|
+
var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP);
|
515
|
+
r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP);
|
516
|
+
return r;
|
517
|
+
},
|
518
|
+
replaceUrls: function(text, urlObj, linkUrl, regexp) {
|
519
|
+
return text.replace(regexp, function(m, pre, url, post) {
|
520
|
+
var urlPath = url.replace(/["']/g, "");
|
521
|
+
if (linkUrl) {
|
522
|
+
urlPath = new URL(urlPath, linkUrl).href;
|
523
|
+
}
|
524
|
+
urlObj.href = urlPath;
|
525
|
+
urlPath = urlObj.href;
|
526
|
+
return pre + "'" + urlPath + "'" + post;
|
527
|
+
});
|
528
|
+
}
|
529
|
+
};
|
530
|
+
scope.path = path;
|
531
|
+
});
|
532
|
+
|
533
|
+
window.HTMLImports.addModule(function(scope) {
|
534
|
+
var xhr = {
|
535
|
+
async: true,
|
536
|
+
ok: function(request) {
|
537
|
+
return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
|
538
|
+
},
|
539
|
+
load: function(url, next, nextContext) {
|
540
|
+
var request = new XMLHttpRequest();
|
541
|
+
if (scope.flags.debug || scope.flags.bust) {
|
542
|
+
url += "?" + Math.random();
|
543
|
+
}
|
544
|
+
request.open("GET", url, xhr.async);
|
545
|
+
request.addEventListener("readystatechange", function(e) {
|
546
|
+
if (request.readyState === 4) {
|
547
|
+
var locationHeader = request.getResponseHeader("Location");
|
548
|
+
var redirectedUrl = null;
|
549
|
+
if (locationHeader) {
|
550
|
+
var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
|
551
|
+
}
|
552
|
+
next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
|
553
|
+
}
|
554
|
+
});
|
555
|
+
request.send();
|
556
|
+
return request;
|
557
|
+
},
|
558
|
+
loadDocument: function(url, next, nextContext) {
|
559
|
+
this.load(url, next, nextContext).responseType = "document";
|
560
|
+
}
|
561
|
+
};
|
562
|
+
scope.xhr = xhr;
|
563
|
+
});
|
564
|
+
|
565
|
+
window.HTMLImports.addModule(function(scope) {
|
566
|
+
var xhr = scope.xhr;
|
567
|
+
var flags = scope.flags;
|
568
|
+
var Loader = function(onLoad, onComplete) {
|
569
|
+
this.cache = {};
|
570
|
+
this.onload = onLoad;
|
571
|
+
this.oncomplete = onComplete;
|
572
|
+
this.inflight = 0;
|
573
|
+
this.pending = {};
|
574
|
+
};
|
575
|
+
Loader.prototype = {
|
576
|
+
addNodes: function(nodes) {
|
577
|
+
this.inflight += nodes.length;
|
578
|
+
for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
|
579
|
+
this.require(n);
|
580
|
+
}
|
581
|
+
this.checkDone();
|
582
|
+
},
|
583
|
+
addNode: function(node) {
|
584
|
+
this.inflight++;
|
585
|
+
this.require(node);
|
586
|
+
this.checkDone();
|
587
|
+
},
|
588
|
+
require: function(elt) {
|
589
|
+
var url = elt.src || elt.href;
|
590
|
+
elt.__nodeUrl = url;
|
591
|
+
if (!this.dedupe(url, elt)) {
|
592
|
+
this.fetch(url, elt);
|
593
|
+
}
|
594
|
+
},
|
595
|
+
dedupe: function(url, elt) {
|
596
|
+
if (this.pending[url]) {
|
597
|
+
this.pending[url].push(elt);
|
598
|
+
return true;
|
599
|
+
}
|
600
|
+
var resource;
|
601
|
+
if (this.cache[url]) {
|
602
|
+
this.onload(url, elt, this.cache[url]);
|
603
|
+
this.tail();
|
604
|
+
return true;
|
605
|
+
}
|
606
|
+
this.pending[url] = [ elt ];
|
607
|
+
return false;
|
608
|
+
},
|
609
|
+
fetch: function(url, elt) {
|
610
|
+
flags.load && console.log("fetch", url, elt);
|
611
|
+
if (!url) {
|
612
|
+
setTimeout(function() {
|
613
|
+
this.receive(url, elt, {
|
614
|
+
error: "href must be specified"
|
615
|
+
}, null);
|
616
|
+
}.bind(this), 0);
|
617
|
+
} else if (url.match(/^data:/)) {
|
618
|
+
var pieces = url.split(",");
|
619
|
+
var header = pieces[0];
|
620
|
+
var body = pieces[1];
|
621
|
+
if (header.indexOf(";base64") > -1) {
|
622
|
+
body = atob(body);
|
623
|
+
} else {
|
624
|
+
body = decodeURIComponent(body);
|
625
|
+
}
|
626
|
+
setTimeout(function() {
|
627
|
+
this.receive(url, elt, null, body);
|
628
|
+
}.bind(this), 0);
|
629
|
+
} else {
|
630
|
+
var receiveXhr = function(err, resource, redirectedUrl) {
|
631
|
+
this.receive(url, elt, err, resource, redirectedUrl);
|
632
|
+
}.bind(this);
|
633
|
+
xhr.load(url, receiveXhr);
|
634
|
+
}
|
635
|
+
},
|
636
|
+
receive: function(url, elt, err, resource, redirectedUrl) {
|
637
|
+
this.cache[url] = resource;
|
638
|
+
var $p = this.pending[url];
|
639
|
+
for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
|
640
|
+
this.onload(url, p, resource, err, redirectedUrl);
|
641
|
+
this.tail();
|
642
|
+
}
|
643
|
+
this.pending[url] = null;
|
644
|
+
},
|
645
|
+
tail: function() {
|
646
|
+
--this.inflight;
|
647
|
+
this.checkDone();
|
648
|
+
},
|
649
|
+
checkDone: function() {
|
650
|
+
if (!this.inflight) {
|
651
|
+
this.oncomplete();
|
652
|
+
}
|
653
|
+
}
|
654
|
+
};
|
655
|
+
scope.Loader = Loader;
|
656
|
+
});
|
657
|
+
|
658
|
+
window.HTMLImports.addModule(function(scope) {
|
659
|
+
var Observer = function(addCallback) {
|
660
|
+
this.addCallback = addCallback;
|
661
|
+
this.mo = new MutationObserver(this.handler.bind(this));
|
662
|
+
};
|
663
|
+
Observer.prototype = {
|
664
|
+
handler: function(mutations) {
|
665
|
+
for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
|
666
|
+
if (m.type === "childList" && m.addedNodes.length) {
|
667
|
+
this.addedNodes(m.addedNodes);
|
668
|
+
}
|
669
|
+
}
|
670
|
+
},
|
671
|
+
addedNodes: function(nodes) {
|
672
|
+
if (this.addCallback) {
|
673
|
+
this.addCallback(nodes);
|
674
|
+
}
|
675
|
+
for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
|
676
|
+
if (n.children && n.children.length) {
|
677
|
+
this.addedNodes(n.children);
|
678
|
+
}
|
679
|
+
}
|
680
|
+
},
|
681
|
+
observe: function(root) {
|
682
|
+
this.mo.observe(root, {
|
683
|
+
childList: true,
|
684
|
+
subtree: true
|
685
|
+
});
|
686
|
+
}
|
687
|
+
};
|
688
|
+
scope.Observer = Observer;
|
689
|
+
});
|
690
|
+
|
691
|
+
window.HTMLImports.addModule(function(scope) {
|
692
|
+
var path = scope.path;
|
693
|
+
var rootDocument = scope.rootDocument;
|
694
|
+
var flags = scope.flags;
|
695
|
+
var isIE = scope.isIE;
|
696
|
+
var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
|
697
|
+
var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
|
698
|
+
var importParser = {
|
699
|
+
documentSelectors: IMPORT_SELECTOR,
|
700
|
+
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
701
|
+
map: {
|
702
|
+
link: "parseLink",
|
703
|
+
script: "parseScript",
|
704
|
+
style: "parseStyle"
|
705
|
+
},
|
706
|
+
dynamicElements: [],
|
707
|
+
parseNext: function() {
|
708
|
+
var next = this.nextToParse();
|
709
|
+
if (next) {
|
710
|
+
this.parse(next);
|
711
|
+
}
|
712
|
+
},
|
713
|
+
parse: function(elt) {
|
714
|
+
if (this.isParsed(elt)) {
|
715
|
+
flags.parse && console.log("[%s] is already parsed", elt.localName);
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
var fn = this[this.map[elt.localName]];
|
719
|
+
if (fn) {
|
720
|
+
this.markParsing(elt);
|
721
|
+
fn.call(this, elt);
|
722
|
+
}
|
723
|
+
},
|
724
|
+
parseDynamic: function(elt, quiet) {
|
725
|
+
this.dynamicElements.push(elt);
|
726
|
+
if (!quiet) {
|
727
|
+
this.parseNext();
|
728
|
+
}
|
729
|
+
},
|
730
|
+
markParsing: function(elt) {
|
731
|
+
flags.parse && console.log("parsing", elt);
|
732
|
+
this.parsingElement = elt;
|
733
|
+
},
|
734
|
+
markParsingComplete: function(elt) {
|
735
|
+
elt.__importParsed = true;
|
736
|
+
this.markDynamicParsingComplete(elt);
|
737
|
+
if (elt.__importElement) {
|
738
|
+
elt.__importElement.__importParsed = true;
|
739
|
+
this.markDynamicParsingComplete(elt.__importElement);
|
740
|
+
}
|
741
|
+
this.parsingElement = null;
|
742
|
+
flags.parse && console.log("completed", elt);
|
743
|
+
},
|
744
|
+
markDynamicParsingComplete: function(elt) {
|
745
|
+
var i = this.dynamicElements.indexOf(elt);
|
746
|
+
if (i >= 0) {
|
747
|
+
this.dynamicElements.splice(i, 1);
|
748
|
+
}
|
749
|
+
},
|
750
|
+
parseImport: function(elt) {
|
751
|
+
if (HTMLImports.__importsParsingHook) {
|
752
|
+
HTMLImports.__importsParsingHook(elt);
|
753
|
+
}
|
754
|
+
if (elt.import) {
|
755
|
+
elt.import.__importParsed = true;
|
756
|
+
}
|
757
|
+
this.markParsingComplete(elt);
|
758
|
+
if (elt.__resource && !elt.__error) {
|
759
|
+
elt.dispatchEvent(new CustomEvent("load", {
|
760
|
+
bubbles: false
|
761
|
+
}));
|
762
|
+
} else {
|
763
|
+
elt.dispatchEvent(new CustomEvent("error", {
|
764
|
+
bubbles: false
|
765
|
+
}));
|
766
|
+
}
|
767
|
+
if (elt.__pending) {
|
768
|
+
var fn;
|
769
|
+
while (elt.__pending.length) {
|
770
|
+
fn = elt.__pending.shift();
|
771
|
+
if (fn) {
|
772
|
+
fn({
|
773
|
+
target: elt
|
774
|
+
});
|
775
|
+
}
|
776
|
+
}
|
777
|
+
}
|
778
|
+
this.parseNext();
|
779
|
+
},
|
780
|
+
parseLink: function(linkElt) {
|
781
|
+
if (nodeIsImport(linkElt)) {
|
782
|
+
this.parseImport(linkElt);
|
783
|
+
} else {
|
784
|
+
linkElt.href = linkElt.href;
|
785
|
+
this.parseGeneric(linkElt);
|
786
|
+
}
|
787
|
+
},
|
788
|
+
parseStyle: function(elt) {
|
789
|
+
var src = elt;
|
790
|
+
elt = cloneStyle(elt);
|
791
|
+
src.__appliedElement = elt;
|
792
|
+
elt.__importElement = src;
|
793
|
+
this.parseGeneric(elt);
|
794
|
+
},
|
795
|
+
parseGeneric: function(elt) {
|
796
|
+
this.trackElement(elt);
|
797
|
+
this.addElementToDocument(elt);
|
798
|
+
},
|
799
|
+
rootImportForElement: function(elt) {
|
800
|
+
var n = elt;
|
801
|
+
while (n.ownerDocument.__importLink) {
|
802
|
+
n = n.ownerDocument.__importLink;
|
803
|
+
}
|
804
|
+
return n;
|
805
|
+
},
|
806
|
+
addElementToDocument: function(elt) {
|
807
|
+
var port = this.rootImportForElement(elt.__importElement || elt);
|
808
|
+
port.parentNode.insertBefore(elt, port);
|
809
|
+
},
|
810
|
+
trackElement: function(elt, callback) {
|
811
|
+
var self = this;
|
812
|
+
var done = function(e) {
|
813
|
+
if (callback) {
|
814
|
+
callback(e);
|
815
|
+
}
|
816
|
+
self.markParsingComplete(elt);
|
817
|
+
self.parseNext();
|
818
|
+
};
|
819
|
+
elt.addEventListener("load", done);
|
820
|
+
elt.addEventListener("error", done);
|
821
|
+
if (isIE && elt.localName === "style") {
|
822
|
+
var fakeLoad = false;
|
823
|
+
if (elt.textContent.indexOf("@import") == -1) {
|
824
|
+
fakeLoad = true;
|
825
|
+
} else if (elt.sheet) {
|
826
|
+
fakeLoad = true;
|
827
|
+
var csr = elt.sheet.cssRules;
|
828
|
+
var len = csr ? csr.length : 0;
|
829
|
+
for (var i = 0, r; i < len && (r = csr[i]); i++) {
|
830
|
+
if (r.type === CSSRule.IMPORT_RULE) {
|
831
|
+
fakeLoad = fakeLoad && Boolean(r.styleSheet);
|
832
|
+
}
|
833
|
+
}
|
834
|
+
}
|
835
|
+
if (fakeLoad) {
|
836
|
+
setTimeout(function() {
|
837
|
+
elt.dispatchEvent(new CustomEvent("load", {
|
838
|
+
bubbles: false
|
839
|
+
}));
|
840
|
+
});
|
841
|
+
}
|
842
|
+
}
|
843
|
+
},
|
844
|
+
parseScript: function(scriptElt) {
|
845
|
+
var script = document.createElement("script");
|
846
|
+
script.__importElement = scriptElt;
|
847
|
+
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
|
848
|
+
scope.currentScript = scriptElt;
|
849
|
+
this.trackElement(script, function(e) {
|
850
|
+
script.parentNode.removeChild(script);
|
851
|
+
scope.currentScript = null;
|
852
|
+
});
|
853
|
+
this.addElementToDocument(script);
|
854
|
+
},
|
855
|
+
nextToParse: function() {
|
856
|
+
this._mayParse = [];
|
857
|
+
return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
|
858
|
+
},
|
859
|
+
nextToParseInDoc: function(doc, link) {
|
860
|
+
if (doc && this._mayParse.indexOf(doc) < 0) {
|
861
|
+
this._mayParse.push(doc);
|
862
|
+
var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
|
863
|
+
for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
|
864
|
+
if (!this.isParsed(n)) {
|
865
|
+
if (this.hasResource(n)) {
|
866
|
+
return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
|
867
|
+
} else {
|
868
|
+
return;
|
869
|
+
}
|
870
|
+
}
|
871
|
+
}
|
872
|
+
}
|
873
|
+
return link;
|
874
|
+
},
|
875
|
+
nextToParseDynamic: function() {
|
876
|
+
return this.dynamicElements[0];
|
877
|
+
},
|
878
|
+
parseSelectorsForNode: function(node) {
|
879
|
+
var doc = node.ownerDocument || node;
|
880
|
+
return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
|
881
|
+
},
|
882
|
+
isParsed: function(node) {
|
883
|
+
return node.__importParsed;
|
884
|
+
},
|
885
|
+
needsDynamicParsing: function(elt) {
|
886
|
+
return this.dynamicElements.indexOf(elt) >= 0;
|
887
|
+
},
|
888
|
+
hasResource: function(node) {
|
889
|
+
if (nodeIsImport(node) && node.import === undefined) {
|
890
|
+
return false;
|
891
|
+
}
|
892
|
+
return true;
|
893
|
+
}
|
894
|
+
};
|
895
|
+
function nodeIsImport(elt) {
|
896
|
+
return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
|
897
|
+
}
|
898
|
+
function generateScriptDataUrl(script) {
|
899
|
+
var scriptContent = generateScriptContent(script);
|
900
|
+
return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
|
901
|
+
}
|
902
|
+
function generateScriptContent(script) {
|
903
|
+
return script.textContent + generateSourceMapHint(script);
|
904
|
+
}
|
905
|
+
function generateSourceMapHint(script) {
|
906
|
+
var owner = script.ownerDocument;
|
907
|
+
owner.__importedScripts = owner.__importedScripts || 0;
|
908
|
+
var moniker = script.ownerDocument.baseURI;
|
909
|
+
var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
|
910
|
+
owner.__importedScripts++;
|
911
|
+
return "\n//# sourceURL=" + moniker + num + ".js\n";
|
912
|
+
}
|
913
|
+
function cloneStyle(style) {
|
914
|
+
var clone = style.ownerDocument.createElement("style");
|
915
|
+
clone.textContent = style.textContent;
|
916
|
+
path.resolveUrlsInStyle(clone);
|
917
|
+
return clone;
|
918
|
+
}
|
919
|
+
scope.parser = importParser;
|
920
|
+
scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
|
921
|
+
});
|
922
|
+
|
923
|
+
window.HTMLImports.addModule(function(scope) {
|
924
|
+
var flags = scope.flags;
|
925
|
+
var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
|
926
|
+
var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
|
927
|
+
var rootDocument = scope.rootDocument;
|
928
|
+
var Loader = scope.Loader;
|
929
|
+
var Observer = scope.Observer;
|
930
|
+
var parser = scope.parser;
|
931
|
+
var importer = {
|
932
|
+
documents: {},
|
933
|
+
documentPreloadSelectors: IMPORT_SELECTOR,
|
934
|
+
importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
|
935
|
+
loadNode: function(node) {
|
936
|
+
importLoader.addNode(node);
|
937
|
+
},
|
938
|
+
loadSubtree: function(parent) {
|
939
|
+
var nodes = this.marshalNodes(parent);
|
940
|
+
importLoader.addNodes(nodes);
|
941
|
+
},
|
942
|
+
marshalNodes: function(parent) {
|
943
|
+
return parent.querySelectorAll(this.loadSelectorsForNode(parent));
|
944
|
+
},
|
945
|
+
loadSelectorsForNode: function(node) {
|
946
|
+
var doc = node.ownerDocument || node;
|
947
|
+
return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
|
948
|
+
},
|
949
|
+
loaded: function(url, elt, resource, err, redirectedUrl) {
|
950
|
+
flags.load && console.log("loaded", url, elt);
|
951
|
+
elt.__resource = resource;
|
952
|
+
elt.__error = err;
|
953
|
+
if (isImportLink(elt)) {
|
954
|
+
var doc = this.documents[url];
|
955
|
+
if (doc === undefined) {
|
956
|
+
doc = err ? null : makeDocument(resource, redirectedUrl || url);
|
957
|
+
if (doc) {
|
958
|
+
doc.__importLink = elt;
|
959
|
+
this.bootDocument(doc);
|
960
|
+
}
|
961
|
+
this.documents[url] = doc;
|
962
|
+
}
|
963
|
+
elt.import = doc;
|
964
|
+
}
|
965
|
+
parser.parseNext();
|
966
|
+
},
|
967
|
+
bootDocument: function(doc) {
|
968
|
+
this.loadSubtree(doc);
|
969
|
+
this.observer.observe(doc);
|
970
|
+
parser.parseNext();
|
971
|
+
},
|
972
|
+
loadedAll: function() {
|
973
|
+
parser.parseNext();
|
974
|
+
}
|
975
|
+
};
|
976
|
+
var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
|
977
|
+
importer.observer = new Observer();
|
978
|
+
function isImportLink(elt) {
|
979
|
+
return isLinkRel(elt, IMPORT_LINK_TYPE);
|
980
|
+
}
|
981
|
+
function isLinkRel(elt, rel) {
|
982
|
+
return elt.localName === "link" && elt.getAttribute("rel") === rel;
|
983
|
+
}
|
984
|
+
function hasBaseURIAccessor(doc) {
|
985
|
+
return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
|
986
|
+
}
|
987
|
+
function makeDocument(resource, url) {
|
988
|
+
var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
|
989
|
+
doc._URL = url;
|
990
|
+
var base = doc.createElement("base");
|
991
|
+
base.setAttribute("href", url);
|
992
|
+
if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
|
993
|
+
Object.defineProperty(doc, "baseURI", {
|
994
|
+
value: url
|
995
|
+
});
|
996
|
+
}
|
997
|
+
var meta = doc.createElement("meta");
|
998
|
+
meta.setAttribute("charset", "utf-8");
|
999
|
+
doc.head.appendChild(meta);
|
1000
|
+
doc.head.appendChild(base);
|
1001
|
+
doc.body.innerHTML = resource;
|
1002
|
+
if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
|
1003
|
+
HTMLTemplateElement.bootstrap(doc);
|
1004
|
+
}
|
1005
|
+
return doc;
|
1006
|
+
}
|
1007
|
+
if (!document.baseURI) {
|
1008
|
+
var baseURIDescriptor = {
|
1009
|
+
get: function() {
|
1010
|
+
var base = document.querySelector("base");
|
1011
|
+
return base ? base.href : window.location.href;
|
1012
|
+
},
|
1013
|
+
configurable: true
|
1014
|
+
};
|
1015
|
+
Object.defineProperty(document, "baseURI", baseURIDescriptor);
|
1016
|
+
Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
|
1017
|
+
}
|
1018
|
+
scope.importer = importer;
|
1019
|
+
scope.importLoader = importLoader;
|
1020
|
+
});
|
1021
|
+
|
1022
|
+
window.HTMLImports.addModule(function(scope) {
|
1023
|
+
var parser = scope.parser;
|
1024
|
+
var importer = scope.importer;
|
1025
|
+
var dynamic = {
|
1026
|
+
added: function(nodes) {
|
1027
|
+
var owner, parsed, loading;
|
1028
|
+
for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
|
1029
|
+
if (!owner) {
|
1030
|
+
owner = n.ownerDocument;
|
1031
|
+
parsed = parser.isParsed(owner);
|
1032
|
+
}
|
1033
|
+
loading = this.shouldLoadNode(n);
|
1034
|
+
if (loading) {
|
1035
|
+
importer.loadNode(n);
|
1036
|
+
}
|
1037
|
+
if (this.shouldParseNode(n) && parsed) {
|
1038
|
+
parser.parseDynamic(n, loading);
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
},
|
1042
|
+
shouldLoadNode: function(node) {
|
1043
|
+
return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
|
1044
|
+
},
|
1045
|
+
shouldParseNode: function(node) {
|
1046
|
+
return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
|
1047
|
+
}
|
1048
|
+
};
|
1049
|
+
importer.observer.addCallback = dynamic.added.bind(dynamic);
|
1050
|
+
var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
|
1051
|
+
});
|
1052
|
+
|
1053
|
+
(function(scope) {
|
1054
|
+
var initializeModules = scope.initializeModules;
|
1055
|
+
var isIE = scope.isIE;
|
1056
|
+
if (scope.useNative) {
|
1057
|
+
return;
|
1058
|
+
}
|
1059
|
+
if (isIE && typeof window.CustomEvent !== "function") {
|
1060
|
+
window.CustomEvent = function(inType, params) {
|
1061
|
+
params = params || {};
|
1062
|
+
var e = document.createEvent("CustomEvent");
|
1063
|
+
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
1064
|
+
return e;
|
1065
|
+
};
|
1066
|
+
window.CustomEvent.prototype = window.Event.prototype;
|
1067
|
+
}
|
1068
|
+
initializeModules();
|
1069
|
+
var rootDocument = scope.rootDocument;
|
1070
|
+
function bootstrap() {
|
1071
|
+
HTMLImports.importer.bootDocument(rootDocument);
|
1072
|
+
}
|
1073
|
+
if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
|
1074
|
+
bootstrap();
|
1075
|
+
} else {
|
1076
|
+
document.addEventListener("DOMContentLoaded", bootstrap);
|
1077
|
+
}
|
1078
|
+
})(window.HTMLImports);
|