webcomponentsjs-rails 0.7.12

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