Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: pkg/shadow_dom/lib/shadow_dom.min.js

Issue 22403005: [pkg:shadow_dom] workaround issue in ownerDocument (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.debug.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateS hadowRoot||window.__forceShadowDomPolyfill){!function(){Element.prototype.webkit CreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return wi ndow.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})}();var SideTable; "undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable =WeakMap:function(){var a=Object.defineProperty,b=Object.hasOwnProperty,c=(new D ate).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0) +(c++ +"__")},SideTable.prototype={set:function(b,c){a(b,this.name,{value:c,writ able:!0})},get:function(a){return b.call(a,this.name)?a[this.name]:void 0},"dele te":function(a){this.set(a,void 0)}}}();var ShadowDOMPolyfill={};!function(a){"u se strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a, b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.definePropert y(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function d(a,b){return Object.ge tOwnPropertyNames(b).forEach(function(c){switch(c){case"arguments":case"caller": case"length":case"name":case"prototype":case"toString":return}Object.definePrope rty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function e(a){var b=a.__proto_ _||Object.getPrototypeOf(a),c=y.get(b);if(c)return c;var d=e(b),f=m(d);return j( b,f,a),f}function f(a,b){h(a,b,!0)}function g(a,b){h(b,a,!1)}function h(a,b,c){O bject.getOwnPropertyNames(a).forEach(function(d){if(!(d in b)){A&&a.__lookupGett er__(d);var e;try{e=Object.getOwnPropertyDescriptor(a,d)}catch(f){e=B}var g,h;if (c&&"function"==typeof e.value)return b[d]=function(){return this.impl[d].apply( this.impl,arguments)},void 0;g=function(){return this.impl[d]},(e.writable||e.se t)&&(h=function(a){this.impl[d]=a}),Object.defineProperty(b,d,{get:g,set:h,confi gurable:e.configurable,enumerable:e.enumerable})}})}function i(a,b,c){var e=a.pr ototype;j(e,b,c),d(b,a)}function j(a,c,d){var e=c.prototype;b(void 0===y.get(a)) ,y.set(a,c),f(a,e),d&&g(e,d)}function k(a,b){return y.get(b.prototype)===a}funct ion l(a){var b=Object.getPrototypeOf(a),c=e(b),d=m(c);return j(b,d,a),d}function m(a){function b(b){a.call(this,b)}return b.prototype=Object.create(a.prototype) ,b.prototype.constructor=b,b._ShadowDOMPolyfill$isGeneratedWrapper=!0,b}function n(a){return a instanceof z.EventTarget||a instanceof z.Event||a instanceof z.DO MImplementation}function o(a){return a instanceof E||a instanceof D||a instanceo f F||a instanceof C}function p(a){if(null===a)return null;b(o(a));var c=x.get(a) ;if(!c){var d=e(a);c=new d(a),x.set(a,c)}return c}function q(a){return null===a? null:(b(n(a)),a.impl)}function r(a){return a&&n(a)?q(a):a}function s(a){return a &&!n(a)?p(a):a}function t(a,c){null!==c&&(b(o(a)),b(void 0===c||n(c)),x.set(a,c) )}function u(a,b,c){Object.defineProperty(a.prototype,b,{get:c,configurable:!0,e numerable:!0})}function v(a,b){u(a,b,function(){return p(this.impl[b])})}functio n w(a,b){a.forEach(function(a){b.forEach(function(b){a.prototype[b]=function(){v ar a=p(this);return a[b].apply(a,arguments)}})})}var x=new SideTable,y=new SideT able,z=Object.create(null);Object.getOwnPropertyNames(window);var A=/Firefox/.te st(navigator.userAgent),B={get:function(){},set:function(){},configurable:!0,enu merable:!0},C=DOMImplementation,D=Event,E=Node,F=Window;a.assert=b,a.defineGette r=u,a.defineWrapGetter=v,a.forwardMethodsToWrapper=w,a.isWrapper=n,a.isWrapperFo r=k,a.mixin=c,a.registerObject=l,a.registerWrapper=i,a.rewrap=t,a.unwrap=q,a.unw rapIfNeeded=r,a.wrap=p,a.wrapIfNeeded=s,a.wrappers=z}(this.ShadowDOMPolyfill),fu nction(a){"use strict";function b(a){return a instanceof J.ShadowRoot}function c (a){var b=a.localName;return"content"===b||"shadow"===b}function d(a){return!!a. shadowRoot}function e(a){var b;return a.parentNode||(b=a.defaultView)&&I(b)||nul l}function f(f,g,h){if(h.length)return h.shift();if(b(f))return f.insertionParen t||a.getHostForShadowRoot(f);var i=a.eventParentsTable.get(f);if(i){for(var j=1; j<i.length;j++)h[j-1]=i[j];return i[0]}if(g&&c(f)){var k=f.parentNode;if(k&&d(k) )for(var l=a.getShadowTrees(k),m=g.insertionParent,j=0;j<l.length;j++)if(l[j].co ntains(m))return m}return e(f)}function g(a){for(var d=[],e=a,g=[],i=[];e;){var j=null;if(c(e)){j=h(d);var k=d[d.length-1]||e;d.push(k)}else d.length||d.push(e) ;var l=d[d.length-1];g.push({target:l,currentTarget:e}),b(e)&&d.pop(),e=f(e,j,i) }return g}function h(a){for(var b=a.length-1;b>=0;b--)if(!c(a[b]))return a[b];re turn null}function i(d,e){for(var g=[];d;){for(var i=[],k=e,m=void 0;k;){var n=n ull;if(i.length){if(c(k)&&(n=h(i),j(m))){var o=i[i.length-1];i.push(o)}}else i.p ush(k);if(l(k,d))return i[i.length-1];b(k)&&i.pop(),m=k,k=f(k,n,g)}d=b(d)?a.getH ostForShadowRoot(d):d.parentNode}}function j(a){return a.insertionParent}functio n k(a){for(var b;b=a.parentNode;)a=b;return a}function l(a,b){return k(a)===k(b) }function m(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":cas e"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":ca se"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocu ment":case"DOMSubtreeModified":return!0}return!1}function n(b){if(!L.get(b)){L.s et(b,!0),m(b.type)||a.renderAllPending();var c=I(b.target),d=I(b);return o(d,c)} }function o(a,b){var c=g(b);return"load"===a.type&&2===c.length&&c[0].target ins tanceof J.Document&&c.shift(),p(a,c)&&q(a,c)&&r(a,c),P.set(a,u.NONE),N.set(a,nul l),a.defaultPrevented}function p(a,b){for(var c,d=b.length-1;d>0;d--){var e=b[d] .target,f=b[d].currentTarget;if(e!==f&&(c=u.CAPTURING_PHASE,!s(b[d],a,c)))return !1}return!0}function q(a,b){var c=u.AT_TARGET;return s(b[0],a,c)}function r(a,b) {for(var c,d=a.bubbles,e=1;e<b.length;e++){var f=b[e].target,g=b[e].currentTarge t;if(f===g)c=u.AT_TARGET;else{if(!d||R.get(a))continue;c=u.BUBBLING_PHASE}if(!s( b[e],a,c))return}}function s(a,b,c){var d=a.target,e=a.currentTarget,f=K.get(e); if(!f)return!0;if("relatedTarget"in b){var g=H(b),h=I(g.relatedTarget),j=i(e,h); if(j===d)return!0;O.set(b,j)}P.set(b,c);var k=b.type,l=!1;M.set(b,d),N.set(b,e); for(var m=0;m<f.length;m++){var n=f[m];if(n.removed)l=!0;else if(!(n.type!==k||! n.capture&&c===u.CAPTURING_PHASE||n.capture&&c===u.BUBBLING_PHASE))try{if("funct ion"==typeof n.handler?n.handler.call(e,b):n.handler.handleEvent(b),R.get(b))ret urn!1}catch(o){window.onerror?window.onerror(o.message):console.error(o)}}if(l){ var p=f.slice();f.length=0;for(var m=0;m<p.length;m++)p[m].removed||f.push(p[m]) }return!Q.get(b)}function t(a,b,c){this.type=a,this.handler=b,this.capture=Boole an(c)}function u(a,b){return a instanceof S?(this.impl=a,void 0):I(y(S,"Event",a ,b))}function v(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{val ue:H(a.relatedTarget)}}):a}function w(a,b,c){var d=window[a],e=function(b,c){ret urn b instanceof d?(this.impl=b,void 0):I(y(d,a,b,c))};return e.prototype=Object .create(b.prototype),c&&F(e.prototype,c),d&&G(d,e,document.createEvent(a)),e}fun ction x(a,b){return function(){arguments[b]=H(arguments[b]);var c=H(this);c[a].a pply(c,arguments)}}function y(a,b,c,d){if(ab)return new a(c,v(d));var e=H(docume nt.createEvent(b)),f=_[b],g=[c];return Object.keys(f).forEach(function(a){var b= null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=H(b)),g.push(b)}),e["init"+b]. apply(e,g),e}function z(a){return"function"==typeof a?!0:a&&a.handleEvent}functi on A(a){this.impl=a}function B(b){return b instanceof J.ShadowRoot&&(b=a.getHost ForShadowRoot(b)),H(b)}function C(a){E(a,db)}function D(b,c,d,e){a.renderAllPend ing();for(var f=I(eb.call(c.impl,d,e)),h=g(f,this),i=0;i<h.length;i++){var j=h[i ];if(j.currentTarget===b)return j.target}return null}var E=a.forwardMethodsToWra pper,F=a.mixin,G=a.registerWrapper,H=a.unwrap,I=a.wrap,J=a.wrappers;new SideTabl e;var K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new Side Table,P=new SideTable,Q=new SideTable,R=new SideTable;t.prototype={equals:functi on(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capt ure},get removed(){return null===this.handler},remove:function(){this.handler=nu ll}};var S=window.Event;u.prototype={get target(){return M.get(this)},get curren tTarget(){return N.get(this)},get eventPhase(){return P.get(this)},stopPropagati on:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0) ,R.set(this,!0)}},G(S,u,document.createEvent("Event"));var T=w("UIEvent",u),U=w( "CustomEvent",u),V={get relatedTarget(){return O.get(this)||I(H(this).relatedTar get)}},W=F({initMouseEvent:x("initMouseEvent",14)},V),X=F({initFocusEvent:x("ini tFocusEvent",5)},V),Y=w("MouseEvent",T,W),Z=w("FocusEvent",T,X),$=w("MutationEve nt",u,{initMutationEvent:x("initMutationEvent",3),get relatedNode(){return I(thi s.impl.relatedNode)}}),_=Object.create(null),ab=function(){try{new window.MouseE vent("click")}catch(a){return!1}return!0}();if(!ab){var bb=function(a,b,c){if(c) {var d=_[c];b=F(F({},d),b)}_[a]=b};bb("Event",{bubbles:!1,cancelable:!1}),bb("Cu stomEvent",{detail:null},"Event"),bb("UIEvent",{view:null,detail:0},"Event"),bb( "MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shift Key:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),bb("FocusEvent",{relat edTarget:null},"UIEvent")}var cb=window.EventTarget,db=["addEventListener","remo veEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(a){ var b=a.prototype;db.forEach(function(a){Object.defineProperty(b,a+"_",{value:b[ a]})})}),A.prototype={addEventListener:function(a,b,c){if(z(b)){var d=new t(a,b, c),e=K.get(this);if(e){for(var f=0;f<e.length;f++)if(d.equals(e[f]))return}else e=[],K.set(this,e);e.push(d);var g=B(this);g.addEventListener_(a,n,!0)}},removeE ventListener:function(a,b,c){c=Boolean(c);var d=K.get(this);if(d){for(var e=0,f= !1,g=0;g<d.length;g++)d[g].type===a&&d[g].capture===c&&(e++,d[g].handler===b&&(f =!0,d[g].remove()));if(f&&1===e){var h=B(this);h.removeEventListener_(a,n,!0)}}} ,dispatchEvent:function(b){a.renderAllPending();var c=B(this);return c.dispatchE vent_(H(b))}},cb&&G(cb,A);var eb=document.elementFromPoint;a.adjustRelatedTarget =i,a.elementFromPoint=D,a.wrapEventTargetMethods=C,a.wrappers.CustomEvent=U,a.wr appers.Event=u,a.wrappers.EventTarget=A,a.wrappers.FocusEvent=Z,a.wrappers.Mouse Event=Y,a.wrappers.MutationEvent=$,a.wrappers.UIEvent=T}(this.ShadowDOMPolyfill) ,function(a){"use strict";function b(a,b){Object.defineProperty(a,b,{enumerable: !1})}function c(){this.length=0,b(this,"length")}function d(a){if(null==a)return a;for(var b=new c,d=0,e=a.length;e>d;d++)b[d]=f(a[d]);return b.length=e,b}funct ion e(a,b){a.prototype[b]=function(){return d(this.impl[b].apply(this.impl,argum ents))}}var f=a.wrap;c.prototype={item:function(a){return this[a]}},b(c.prototyp e,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(this .ShadowDOMPolyfill),function(a){"use strict";function b(a){j(a instanceof f)}fun ction c(a,b,c,d){if(a.nodeType!==f.DOCUMENT_FRAGMENT_NODE)return a.parentNode&&a .parentNode.removeChild(a),a.parentNode_=b,a.previousSibling_=c,a.nextSibling_=d ,c&&(c.nextSibling_=a),d&&(d.previousSibling_=a),[a];for(var e,g=[];e=a.firstChi ld;)a.removeChild(e),g.push(e),e.parentNode_=b;for(var h=0;h<g.length;h++)g[h].p reviousSibling_=g[h-1]||c,g[h].nextSibling_=g[h+1]||d;return c&&(c.nextSibling_= g[0]),d&&(d.previousSibling_=g[g.length-1]),g}function d(a){if(1===a.length)retu rn m(a[0]);for(var b=m(document.createDocumentFragment()),c=0;c<a.length;c++)b.a ppendChild(m(a[c]));return b}function e(a){for(var b=a.firstChild;b;){j(b.parent Node===a);var c=b.nextSibling,d=m(b),e=d.parentNode;e&&s.call(e,d),b.previousSib ling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}func tion f(a){j(a instanceof o),g.call(this,a),this.parentNode_=void 0,this.firstChi ld_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_ =void 0}var g=a.wrappers.EventTarget,h=a.wrappers.NodeList,i=a.defineWrapGetter, j=a.assert,k=a.mixin,l=a.registerWrapper,m=a.unwrap,n=a.wrap,o=window.Node,p=o.p rototype.appendChild,q=o.prototype.insertBefore,r=o.prototype.replaceChild,s=o.p rototype.removeChild,t=o.prototype.compareDocumentPosition;f.prototype=Object.cr eate(g.prototype),k(f.prototype,{appendChild:function(a){b(a),this.invalidateSha dowRenderer();var e=this.lastChild,f=null,g=c(a,this,e,f);return this.lastChild_ =g[g.length-1],e||(this.firstChild_=g[0]),p.call(this.impl,d(g)),a},insertBefore :function(a,e){if(!e)return this.appendChild(a);b(a),b(e),j(e.parentNode===this) ,this.invalidateShadowRenderer();var f=e.previousSibling,g=e,h=c(a,this,f,g);thi s.firstChild===e&&(this.firstChild_=h[0]);var i=m(e),k=i.parentNode;return k&&q. call(k,d(h),i),a},removeChild:function(a){if(b(a),a.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var c=this.firstChild,d=t his.lastChild,e=a.nextSibling,f=a.previousSibling,g=m(a),h=g.parentNode;return h &&s.call(h,g),c===a&&(this.firstChild_=e),d===a&&(this.lastChild_=f),f&&(f.nextS ibling_=e),e&&(e.previousSibling_=f),a.previousSibling_=a.nextSibling_=a.parentN ode_=null,a},replaceChild:function(a,e){if(b(a),b(e),e.parentNode!==this)throw n ew Error("NotFoundError");this.invalidateShadowRenderer();var f=e.previousSiblin g,g=e.nextSibling;g===a&&(g=a.nextSibling);var h=c(a,this,f,g);this.firstChild== =e&&(this.firstChild_=h[0]),this.lastChild===e&&(this.lastChild_=h[h.length-1]), e.previousSibling_=null,e.nextSibling_=null,e.parentNode_=null;var i=m(e);return i.parentNode&&r.call(i.parentNode,d(h),i),e},hasChildNodes:function(){return nu ll===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.par entNode_:n(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChi ld_?this.firstChild_:n(this.impl.firstChild)},get lastChild(){return void 0!==th is.lastChild_?this.lastChild_:n(this.impl.lastChild)},get nextSibling(){return v oid 0!==this.nextSibling_?this.nextSibling_:n(this.impl.nextSibling)},get previo usSibling(){return void 0!==this.previousSibling_?this.previousSibling_:n(this.i mpl.previousSibling)},get parentElement(){for(var a=this.parentNode;a&&a.nodeTyp e!==f.ELEMENT_NODE;)a=a.parentNode;return a},get textContent(){for(var a="",b=th is.firstChild;b;b=b.nextSibling)a+=b.textContent;return a},set textContent(a){if (e(this),this.invalidateShadowRenderer(),""!==a){var b=this.impl.ownerDocument.c reateTextNode(a);this.appendChild(b)}},get childNodes(){for(var a=new h,b=0,c=th is.firstChild;c;c=c.nextSibling)a[b++]=c;return a.length=b,a},cloneNode:function (a){if(!this.invalidateShadowRenderer())return n(this.impl.cloneNode(a));var b=n (this.impl.cloneNode(!1));if(a)for(var c=this.firstChild;c;c=c.nextSibling)b.app endChild(c.cloneNode(!0));return b},contains:function(a){if(!a)return!1;if(a===t his)return!0;var b=a.parentNode;return b?this.contains(b):!1},compareDocumentPos ition:function(a){return t.call(this.impl,m(a))}}),i(f,"ownerDocument"),l(o,f,do cument.createDocumentFragment()),delete f.prototype.querySelector,delete f.proto type.querySelectorAll,f.prototype=k(Object.create(g.prototype),f.prototype),a.wr appers.Node=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,c){ for(var d,e=a.firstElementChild;e;){if(e.matches(c))return e;if(d=b(e,c))return d;e=e.nextElementSibling}return null}function c(a,b,d){for(var e=a.firstElementC hild;e;)e.matches(b)&&(d[d.length++]=e),c(e,b,d),e=e.nextElementSibling;return d }var d={querySelector:function(a){return b(this,a)},querySelectorAll:function(a) {return c(this,a,new NodeList)}},e={getElementsByTagName:function(a){return this .querySelectorAll(a)},getElementsByClassName:function(a){return this.querySelect orAll("."+a)},getElementsByTagNameNS:function(a,b){if("*"===a)return this.getEle mentsByTagName(b);for(var c=new NodeList,d=this.getElementsByTagName(b),e=0,f=0; e<d.length;e++)d[e].namespaceURI===a&&(c[f++]=d[e]);return c.length=f,c}};a.GetE lementsByInterface=e,a.SelectorsInterface=d}(this.ShadowDOMPolyfill),function(a) {"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibl ing;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousS ibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(th is.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElemen tCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;retur n a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextEleme ntSibling)a[b++]=c;return a.length=b,a}},f={get nextElementSibling(){return b(th is.nextSibling)},get previousElementSibling(){return c(this.nextSibling)}};a.Chi ldNodeInterface=f,a.ParentNodeInterface=e}(this.ShadowDOMPolyfill),function(a){" use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers .Node,e=a.mixin,f=a.registerWrapper,g=window.CharacterData;b.prototype=Object.cr eate(d.prototype),e(b.prototype,{get textContent(){return this.data},set textCon tent(a){this.data=a}}),e(b.prototype,c),f(g,b,document.createTextNode("")),a.wra ppers.CharacterData=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){e.call(this,a)}var c=a.ChildNodeInterface,d=a.GetElementsByInterface,e=a.w rappers.Node,f=a.ParentNodeInterface,g=a.SelectorsInterface;a.addWrapNodeListMet hod;var h=a.mixin,i=a.registerWrapper,j=a.wrappers,k=new SideTable,l=window.Elem ent,m=l.prototype.matches||l.prototype.mozMatchesSelector||l.prototype.msMatches Selector||l.prototype.webkitMatchesSelector;b.prototype=Object.create(e.prototyp e),h(b.prototype,{createShadowRoot:function(){var b=new j.ShadowRoot(this);retur n k.set(this,b),a.getRendererForHost(this),this.invalidateShadowRenderer(!0),b}, get shadowRoot(){return k.get(this)||null},setAttribute:function(a,b){this.impl. setAttribute(a,b),this.invalidateShadowRenderer()},matches:function(a){return m. call(this.impl,a)}}),h(b.prototype,c),h(b.prototype,d),h(b.prototype,f),h(b.prot otype,g),i(l,b),a.wrappers.Element=b}(this.ShadowDOMPolyfill),function(a){"use s trict";function b(a){switch(a){case"&":return"&amp;";case"<":return"&lt;";case'" ':return"&quot;"}}function c(a){return a.replace(p,b)}function d(a){switch(a.nod eType){case Node.ELEMENT_NODE:for(var b,d=a.tagName.toLowerCase(),f="<"+d,g=a.at tributes,h=0;b=g[h];h++)f+=" "+b.name+'="'+c(b.value)+'"';return f+=">",q[d]?f:f +e(a)+"</"+d+">";case Node.TEXT_NODE:return c(a.nodeValue);case Node.COMMENT_NOD E:return"<!--"+c(a.nodeValue)+"-->";default:throw console.error(a),new Error("no t implemented")}}function e(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)b+= d(c);return b}function f(a,b,c){var d=c||"div";a.textContent="";var e=n(a.ownerD ocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild( o(f))}function g(a){j.call(this,a)}function h(b){k(g,b,function(){return a.rende rAllPending(),this.impl[b]})}function i(b){Object.defineProperty(g.prototype,b,{ value:function(){return a.renderAllPending(),this.impl[b].apply(this.impl,argume nts)},configurable:!0,enumerable:!0})}var j=a.wrappers.Element,k=a.defineGetter, l=a.mixin,m=a.registerWrapper,n=a.unwrap,o=a.wrap,p=/&|<|"/g,q={area:!0,base:!0, br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0 ,param:!0,source:!0,track:!0,wbr:!0},r=window.HTMLElement;g.prototype=Object.cre ate(j.prototype),l(g.prototype,{get innerHTML(){return e(this)},set innerHTML(a) {f(this,a,this.tagName)},get outerHTML(){return d(this)},set outerHTML(a){if(thi s.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerH TML=a}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight"," offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","s crollWidth"].forEach(h),["getBoundingClientRect","getClientRects","scrollIntoVie w"].forEach(i),m(r,g,document.createElement("b")),a.wrappers.HTMLElement=g,a.get InnerHTML=e,a.setInnerHTML=f}(this.ShadowDOMPolyfill),function(a){"use strict";f unction b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerW rapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.pr ototype,{get select(){return this.getAttribute("select")},set select(a){this.set Attribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call( this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)} }),f&&e(f,b),a.wrappers.HTMLContentElement=b}(this.ShadowDOMPolyfill),function(a ){"use strict";function b(a){c.call(this,a),this.olderShadowRoot_=null}var c=a.w rappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLShadowElement;b.p rototype=Object.create(c.prototype),d(b.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){c.prototype.invalidat eShadowRenderer.call(this,!0)}}),f&&e(f,b),a.wrappers.HTMLShadowElement=b}(this. ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)retu rn a;var b=l.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastC hild;)b.removeChild(b.lastChild);l.set(a,b)}return b}function c(a){for(var c,d=b (a.ownerDocument),e=d.createDocumentFragment();c=a.firstChild;)e.appendChild(c); return e}function d(a){e.call(this,a)}var e=a.wrappers.HTMLElement,f=a.getInnerH TML,g=a.mixin,h=a.registerWrapper,i=a.setInnerHTML,j=a.wrap,k=new SideTable,l=ne w SideTable,m=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype), g(d.prototype,{get content(){if(m)return j(this.impl.content);var a=k.get(this); return a||(a=c(this),k.set(this,a)),a},get innerHTML(){return f(this.content)},s et innerHTML(a){i(this.content,a),this.invalidateShadowRenderer()}}),m&&h(m,d),a .wrappers.HTMLTemplateElement=d}(this.ShadowDOMPolyfill),function(a){"use strict ";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":r eturn new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HT MLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wra ppers.HTMLTemplateElement;a.mixin;var g=a.registerWrapper,h=window.HTMLUnknownEl ement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElemen t=b}(this.ShadowDOMPolyfill),function(a){"use strict";var b=a.GetElementsByInter face,c=a.ParentNodeInterface,d=a.SelectorsInterface,e=a.mixin,f=a.registerObject ,g=f(document.createDocumentFragment());e(g.prototype,c),e(g.prototype,d),e(g.pr ototype,b);var h=f(document.createTextNode("")),i=f(document.createComment("")); a.wrappers.Comment=i,a.wrappers.DocumentFragment=g,a.wrappers.Text=h}(this.Shado wDOMPolyfill),function(a){"use strict";function b(b){var d=i(b.impl.ownerDocumen t.createDocumentFragment());c.call(this,d),g(d,this);var e=b.shadowRoot;a.nextOl derShadowTreeTable.set(this,e),j.set(this,b)}var c=a.wrappers.DocumentFragment,d =a.elementFromPoint,e=a.getInnerHTML,f=a.mixin,g=a.rewrap,h=a.setInnerHTML,i=a.u nwrap,j=new SideTable;b.prototype=Object.create(c.prototype),f(b.prototype,{get innerHTML(){return e(this)},set innerHTML(a){h(this,a),this.invalidateShadowRend erer()},invalidateShadowRenderer:function(){return j.get(this).invalidateShadowR enderer()},elementFromPoint:function(a,b){return d(this,this.ownerDocument,a,b)} ,getElementById:function(a){return this.querySelector("#"+a)}}),a.wrappers.Shado wRoot=b,a.getHostForShadowRoot=function(a){return j.get(a)}}(this.ShadowDOMPolyf ill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling ,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(a){a.firstCh ild_=a.firstChild,a.lastChild_=a.lastChild}function d(a){F(a instanceof E);for(v ar d=a.firstChild;d;d=d.nextSibling)b(d);c(a)}function e(a){var b=H(a);d(a),b.te xtContent=""}function f(a,c){var e=H(a),f=H(c);f.nodeType===E.DOCUMENT_FRAGMENT_ NODE?d(c):(h(c),b(c)),a.lastChild_=a.lastChild,a.lastChild===a.firstChild&&(a.fi rstChild_=a.firstChild);var g=I(e.lastChild);g&&(g.nextSibling_=g.nextSibling),e .appendChild(f)}function g(a,c){var d=H(a),e=H(c);b(c),c.previousSibling&&(c.pre viousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),a .lastChild===c&&(a.lastChild_=c),a.firstChild===c&&(a.firstChild_=c),d.removeChi ld(e)}function h(a){var b=H(a),c=b.parentNode;c&&g(I(c),a)}function i(a,b){k(b). push(a),L.set(a,b);var c=K.get(a);c||K.set(a,c=[]),c.push(b)}function j(a){J.set (a,[])}function k(a){return J.get(a)}function l(a){for(var b=[],c=0,d=a.firstChi ld;d;d=d.nextSibling)b[c++]=d;return b}function m(a,b,c){for(var d=l(a),e=0;e<d. length;e++){var f=d[e];if(b(f)){if(c(f)===!1)return}else m(f,b,c)}}function n(a, b){var c=!1;return m(a,u,function(a){j(a);for(var d=0;d<b.length;d++){var e=b[d] ;void 0!==e&&p(e,a)&&(i(e,a),b[d]=void 0,c=!0)}}),c?b.filter(function(a){return void 0!==a}):b}function o(a,b){for(var c=0;c<b.length;c++)if(b[c]in a)return b[c ]}function p(a,b){var c=b.getAttribute("select");if(!c)return!0;if(c=c.trim(),!c )return!0;if(a.nodeType!==E.ELEMENT_NODE)return!1;if(!P.test(c))return!1;if(":"= ==c[0]&&!Q.test(c))return!1;try{return a.matches(c)}catch(d){return!1}}function q(){C=null,S.forEach(function(a){a.render()}),S=[]}function r(a){this.host=a,thi s.dirty=!1,this.associateNode(a)}function s(a){var b=N.get(a);return b||(b=new r (a),N.set(a,b)),b}function t(a){return"content"===a.localName}function u(a){retu rn"content"===a.localName}function v(a){return"shadow"===a.localName}function w( a){return"shadow"===a.localName}function x(a){return!!a.shadowRoot}function y(a) {return M.get(a)}function z(a){for(var b=[],c=a.shadowRoot;c;c=M.get(c))b.push(c );return b}function A(a,b){L.set(a,b)}function B(a){new r(a).render()}var C,D=a. wrappers.HTMLContentElement,E=a.wrappers.Node,F=a.assert,G=a.mixin,H=a.unwrap,I= a.wrap,J=new SideTable,K=new SideTable,L=new SideTable,M=new SideTable,N=new Sid eTable,O=new SideTable,P=/^[*.:#[a-zA-Z_|]/,Q=new RegExp("^:("+["link","visited" ,"target","enabled","disabled","checked","indeterminate","nth-child","nth-last-c hild","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type ","last-of-type","only-of-type"].join("|")+")"),R=o(window,["requestAnimationFra me","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),S=[] ;r.prototype={render:function(){if(this.dirty){var a=this.host;this.treeComposit ion();var b=a.shadowRoot;if(b){this.removeAllChildNodes(this.host);var c=l(b);c. forEach(function(c){this.renderNode(a,b,c,!1)},this),this.dirty=!1}}},invalidate :function(){if(!this.dirty){if(this.dirty=!0,S.push(this),C)return;C=window[R](q ,0)}},renderNode:function(a,b,c,d){if(x(c)){this.appendChild(a,c);var e=s(c);e.d irty=!0,e.render()}else t(c)?this.renderInsertionPoint(a,b,c,d):v(c)?this.render ShadowInsertionPoint(a,b,c):this.renderAsAnyDomTree(a,b,c,d)},renderAsAnyDomTree :function(a,b,c,d){if(this.appendChild(a,c),x(c))B(c);else{var e=c,f=l(e);f.forE ach(function(a){this.renderNode(e,b,a,d)},this)}},renderInsertionPoint:function( a,b,c,d){var e=k(c);e.length?(this.removeAllChildNodes(c),e.forEach(function(c){ t(c)&&d?this.renderInsertionPoint(a,b,c,d):this.renderAsAnyDomTree(a,b,c,d)},thi s)):this.renderFallbackContent(a,c),this.remove(c)},renderShadowInsertionPoint:f unction(a,b,c){var d=y(b);if(d){L.set(d,c),c.olderShadowRoot_=d,this.remove(c);v ar e=l(d);e.forEach(function(b){this.renderNode(a,d,b,!0)},this)}else this.rende rFallbackContent(a,c)},renderFallbackContent:function(a,b){var c=l(b);c.forEach( function(b){this.appendChild(a,b)},this)},treeComposition:function(){var a=this. host,b=a.shadowRoot,c=[],d=l(a);d.forEach(function(a){if(t(a)){var b=k(a);b&&b.l ength||(b=l(a)),c.push.apply(c,b)}else c.push(a)});for(var e,f;b;){if(e=void 0,m (b,w,function(a){return e=a,!1}),f=e,c=n(b,c),f){var g=y(b);if(g){b=g,A(b,f);con tinue}break}break}},appendChild:function(a,b){f(a,b),this.associateNode(b)},remo ve:function(a){h(a),this.associateNode(a)},removeAllChildNodes:function(a){e(a)} ,associateNode:function(a){O.set(a,this)}},E.prototype.invalidateShadowRenderer= function(a){var b=O.get(this);if(!b)return!1;var c;return(a||this.shadowRoot||(c =this.parentNode)&&(c.shadowRoot||c instanceof ShadowRoot))&&b.invalidate(),!0}, D.prototype.getDistributedNodes=function(){return q(),k(this)},G(E.prototype,{ge t insertionParent(){return L.get(this)||null}}),a.eventParentsTable=K,a.getRende rerForHost=s,a.getShadowTrees=z,a.nextOlderShadowTreeTable=M,a.renderAllPending= q,a.visual={removeAllChildNodes:e,appendChild:f,removeChild:g}}(this.ShadowDOMPo lyfill),function(a){"use strict";function b(a){h.call(this,a)}function c(a){var c=document[a];b.prototype[a]=function(){return q(c.apply(this.impl,arguments))}} function d(a){this.impl=a}function e(a,b){var c=document.implementation[b];a.pro totype[b]=function(){return q(c.apply(this.impl,arguments))}}function f(a,b){var c=document.implementation[b];a.prototype[b]=function(){return c.apply(this.impl ,arguments)}}var g=a.GetElementsByInterface,h=a.wrappers.Node,i=a.ParentNodeInte rface,j=a.SelectorsInterface,k=a.defineWrapGetter,l=a.elementFromPoint,m=a.forwa rdMethodsToWrapper,n=a.mixin,o=a.registerWrapper,p=a.unwrap,q=a.wrap,r=a.wrapEve ntTargetMethods;a.wrapNodeList;var s=new SideTable;b.prototype=Object.create(h.p rototype),k(b,"documentElement"),k(b,"body"),k(b,"head"),["getElementById","crea teElement","createElementNS","createTextNode","createDocumentFragment","createEv ent","createEventNS"].forEach(c);var t=document.adoptNode,u=document.write;n(b.p rototype,{adoptNode:function(a){return t.call(this.impl,p(a)),a},elementFromPoin t:function(a,b){return l(this,this,a,b)},write:function(a){for(var b=this.queryS electorAll("*"),c=b[b.length-1];c.nextSibling;)c=c.nextSibling;var d=c.parentNod e;d.lastChild_=void 0,c.nextSibling_=void 0,u.call(this.impl,a)}}),m([window.HTM LBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appe ndChild","compareDocumentPosition","getElementsByClassName","getElementsByTagNam e","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","r emoveChild","replaceChild"]),m([window.HTMLDocument||window.Document],["adoptNod e","createDocumentFragment","createElement","createElementNS","createEvent","cre ateEventNS","createTextNode","elementFromPoint","getElementById","write"]),n(b.p rototype,g),n(b.prototype,i),n(b.prototype,j),n(b.prototype,{get implementation( ){var a=s.get(this);return a?a:(a=new d(p(this).implementation),s.set(this,a),a) }}),o(window.Document,b,document.implementation.createHTMLDocument("")),window.H TMLDocument&&o(window.HTMLDocument,b),r([window.HTMLBodyElement,window.HTMLDocum ent||window.Document,window.HTMLHeadElement]),e(d,"createDocumentType"),e(d,"cre ateDocument"),e(d,"createHTMLDocument"),f(d,"hasFeature"),o(window.DOMImplementa tion,d),m([window.DOMImplementation],["createDocumentType","createDocument","cre ateHTMLDocument","hasFeature"]),a.wrappers.Document=b,a.wrappers.DOMImplementati on=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this ,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.un wrapIfNeeded,h=a.wrap,i=window.Window;b.prototype=Object.create(c.prototype);var j=window.getComputedStyle;i.prototype.getComputedStyle=function(a,b){return j.c all(this||window,g(a),b)},["addEventListener","removeEventListener","dispatchEve nt"].forEach(function(a){i.prototype[a]=function(){var b=h(this||window);return b[a].apply(b,arguments)}}),d(b.prototype,{getComputedStyle:function(a,b){return j.call(f(this),g(a),b)}}),e(i,b),a.wrappers.Window=b}(this.ShadowDOMPolyfill),fu nction(a){"use strict";function b(a){this.impl=a}function c(a){return new b(a)}f unction d(a){return a.map(c)}function e(a){var b=this;this.impl=new k(function(c ){a.call(b,d(c),b)})}var f=a.defineGetter,g=a.defineWrapGetter,h=a.registerWrapp er,i=a.unwrapIfNeeded,j=a.wrapNodeList;a.wrappers;var k=window.MutationObserver| |window.WebKitMutationObserver;if(k){var l=window.MutationRecord;b.prototype={ge t addedNodes(){return j(this.impl.addedNodes)},get removedNodes(){return j(this. impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function (a){g(b,a)}),["type","attributeName","attributeNamespace","oldValue"].forEach(fu nction(a){f(b,a,function(){return this.impl[a]})}),l&&h(l,b),window.Node,e.proto type={observe:function(a,b){this.impl.observe(i(a),b) 1 if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateS hadowRoot||window.__forceShadowDomPolyfill){(function(){Element.prototype.webkit CreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return wi ndow.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})})();var SideTable ;"undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTabl e=WeakMap:function(){var e=Object.defineProperty,t=Object.hasOwnProperty,n=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0 )+(n++ +"__")},SideTable.prototype={set:function(t,n){e(t,this.name,{value:n,wri table:!0})},get:function(e){return t.call(e,this.name)?e[this.name]:void 0},"del ete":function(e){this.set(e,void 0)}}}();var ShadowDOMPolyfill={};(function(e){" use strict";function t(e){if(!e)throw new Error("Assertion failed")}function n(e ,t){return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProper ty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(e,t){return Object.g etOwnPropertyNames(t).forEach(function(n){switch(n){case"arguments":case"caller" :case"length":case"name":case"prototype":case"toString":return}Object.defineProp erty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i(e){var t=e.__proto __||Object.getPrototypeOf(e),n=M.get(t);if(n)return n;var r=i(t),o=p(r);return u (t,o,e),o}function o(e,t){l(e,t,!0)}function a(e,t){l(t,e,!1)}function l(e,t,n){ Object.getOwnPropertyNames(e).forEach(function(r){if(!(r in t)){L&&e.__lookupGet ter__(r);var i;try{i=Object.getOwnPropertyDescriptor(e,r)}catch(o){i=C}var a,l;i f(n&&"function"==typeof i.value)return t[r]=function(){return this.impl[r].apply (this.impl,arguments)},void 0;a=function(){return this.impl[r]},(i.writable||i.s et)&&(l=function(e){this.impl[r]=e}),Object.defineProperty(t,r,{get:a,set:l,conf igurable:i.configurable,enumerable:i.enumerable})}})}function s(e,t,n){var i=e.p rototype;u(i,t,n),r(t,e)}function u(e,n,r){var i=n.prototype;t(void 0===M.get(e) ),M.set(e,n),o(e,i),r&&a(i,r)}function c(e,t){return M.get(t.prototype)===e}func tion d(e){var t=Object.getPrototypeOf(e),n=i(t),r=p(n);return u(t,r,e),r}functio n p(e){function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype ),t.prototype.constructor=t,t._ShadowDOMPolyfill$isGeneratedWrapper=!0,t}functio n h(e){return e instanceof N.EventTarget||e instanceof N.Event||e instanceof N.D OMImplementation}function f(e){return e instanceof D||e instanceof O||e instance of _||e instanceof H}function m(e){if(null===e)return null;t(f(e));var n=S.get(e );if(!n){var r=i(e);n=new r(e),S.set(e,n)}return n}function g(e){return null===e ?null:(t(h(e)),e.impl)}function w(e){return e&&h(e)?g(e):e}function v(e){return e&&!h(e)?m(e):e}function E(e,n){null!==n&&(t(f(e)),t(void 0===n||h(n)),S.set(e,n ))}function y(e,t,n){Object.defineProperty(e.prototype,t,{get:n,configurable:!0, enumerable:!0})}function T(e,t){y(e,t,function(){return m(this.impl[t])})}functi on b(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){ var e=m(this);return e[t].apply(e,arguments)}})})}var S=new SideTable,M=new Side Table,N=Object.create(null);Object.getOwnPropertyNames(window);var L=/Firefox/.t est(navigator.userAgent),C={get:function(){},set:function(){},configurable:!0,en umerable:!0},H=DOMImplementation,O=Event,D=Node,_=Window;e.assert=t,e.defineGett er=y,e.defineWrapGetter=T,e.forwardMethodsToWrapper=b,e.isWrapper=h,e.isWrapperF or=c,e.mixin=n,e.registerObject=d,e.registerWrapper=s,e.rewrap=E,e.unwrap=g,e.un wrapIfNeeded=w,e.wrap=m,e.wrapIfNeeded=v,e.wrappers=N})(this.ShadowDOMPolyfill), function(e){"use strict";function t(e){return e instanceof I.ShadowRoot}function n(e){var t=e.localName;return"content"===t||"shadow"===t}function r(e){return!! e.shadowRoot}function i(e){var t;return e.parentNode||(t=e.defaultView)&&R(t)||n ull}function o(o,a,l){if(l.length)return l.shift();if(t(o))return o.insertionPar ent||e.getHostForShadowRoot(o);var s=e.eventParentsTable.get(o);if(s){for(var u= 1;s.length>u;u++)l[u-1]=s[u];return s[0]}if(a&&n(o)){var c=o.parentNode;if(c&&r( c))for(var d=e.getShadowTrees(c),p=a.insertionParent,u=0;d.length>u;u++)if(d[u]. contains(p))return p}return i(o)}function a(e){for(var r=[],i=e,a=[],s=[];i;){va r u=null;if(n(i)){u=l(r);var c=r[r.length-1]||i;r.push(c)}else r.length||r.push( i);var d=r[r.length-1];a.push({target:d,currentTarget:i}),t(i)&&r.pop(),i=o(i,u, s)}return a}function l(e){for(var t=e.length-1;t>=0;t--)if(!n(e[t]))return e[t]; return null}function s(r,i){for(var a=[];r;){for(var s=[],c=i,p=void 0;c;){var h =null;if(s.length){if(n(c)&&(h=l(s),u(p))){var f=s[s.length-1];s.push(f)}}else s .push(c);if(d(c,r))return s[s.length-1];t(c)&&s.pop(),p=c,c=o(c,h,a)}r=t(r)?e.ge tHostForShadowRoot(r):r.parentNode}}function u(e){return e.insertionParent}funct ion c(e){for(var t;t=e.parentNode;)e=t;return e}function d(e,t){return c(e)===c( t)}function p(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":c ase"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted": case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDo cument":case"DOMSubtreeModified":return!0}return!1}function h(t){if(!F.get(t)){F .set(t,!0),p(t.type)||e.renderAllPending();var n=R(t.target),r=R(t);return f(r,n )}}function f(e,t){var n=a(t);return"load"===e.type&&2===n.length&&n[0].target i nstanceof I.Document&&n.shift(),m(e,n)&&g(e,n)&&w(e,n),k.set(e,y.NONE),W.set(e,n ull),e.defaultPrevented}function m(e,t){for(var n,r=t.length-1;r>0;r--){var i=t[ r].target,o=t[r].currentTarget;if(i!==o&&(n=y.CAPTURING_PHASE,!v(t[r],e,n)))retu rn!1}return!0}function g(e,t){var n=y.AT_TARGET;return v(t[0],e,n)}function w(e, t){for(var n,r=e.bubbles,i=1;t.length>i;i++){var o=t[i].target,a=t[i].currentTar get;if(o===a)n=y.AT_TARGET;else{if(!r||q.get(e))continue;n=y.BUBBLING_PHASE}if(! v(t[i],e,n))return}}function v(e,t,n){var r=e.target,i=e.currentTarget,o=A.get(i );if(!o)return!0;if("relatedTarget"in t){var a=x(t),l=R(a.relatedTarget),u=s(i,l );if(u===r)return!0;B.set(t,u)}k.set(t,n);var c=t.type,d=!1;j.set(t,r),W.set(t,i );for(var p=0;o.length>p;p++){var h=o[p];if(h.removed)d=!0;else if(!(h.type!==c| |!h.capture&&n===y.CAPTURING_PHASE||h.capture&&n===y.BUBBLING_PHASE))try{if("fun ction"==typeof h.handler?h.handler.call(i,t):h.handler.handleEvent(t),q.get(t))r eturn!1}catch(f){window.onerror?window.onerror(f.message):console.error(f)}}if(d ){var m=o.slice();o.length=0;for(var p=0;m.length>p;p++)m[p].removed||o.push(m[p ])}return!G.get(t)}function E(e,t,n){this.type=e,this.handler=t,this.capture=Boo lean(n)}function y(e,t){return e instanceof U?(this.impl=e,void 0):R(M(U,"Event" ,e,t))}function T(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{v alue:x(e.relatedTarget)}}):e}function b(e,t,n){var r=window[e],i=function(t,n){r eturn t instanceof r?(this.impl=t,void 0):R(M(r,e,t,n))};return i.prototype=Obje ct.create(t.prototype),n&&_(i.prototype,n),r&&P(r,i,document.createEvent(e)),i}f unction S(e,t){return function(){arguments[t]=x(arguments[t]);var n=x(this);n[e] .apply(n,arguments)}}function M(e,t,n,r){if(et)return new e(n,T(r));var i=x(docu ment.createEvent(t)),o=J[t],a=[n];return Object.keys(o).forEach(function(e){var t=null!=r&&e in r?r[e]:o[e];"relatedTarget"===e&&(t=x(t)),a.push(t)}),i["init"+t ].apply(i,a),i}function N(e){return"function"==typeof e?!0:e&&e.handleEvent}func tion L(e){this.impl=e}function C(t){return t instanceof I.ShadowRoot&&(t=e.getHo stForShadowRoot(t)),x(t)}function H(e){D(e,rt)}function O(t,n,r,i){e.renderAllPe nding();for(var o=R(it.call(n.impl,r,i)),l=a(o,this),s=0;l.length>s;s++){var u=l [s];if(u.currentTarget===t)return u.target}return null}var D=e.forwardMethodsToW rapper,_=e.mixin,P=e.registerWrapper,x=e.unwrap,R=e.wrap,I=e.wrappers;new SideTa ble;var A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new Si deTable,k=new SideTable,G=new SideTable,q=new SideTable;E.prototype={equals:func tion(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.ca pture},get removed(){return null===this.handler},remove:function(){this.handler= null}};var U=window.Event;y.prototype={get target(){return j.get(this)},get curr entTarget(){return W.get(this)},get eventPhase(){return k.get(this)},stopPropaga tion:function(){G.set(this,!0)},stopImmediatePropagation:function(){G.set(this,! 0),q.set(this,!0)}},P(U,y,document.createEvent("Event"));var V=b("UIEvent",y),K= b("CustomEvent",y),$={get relatedTarget(){return B.get(this)||R(x(this).relatedT arget)}},z=_({initMouseEvent:S("initMouseEvent",14)},$),X=_({initFocusEvent:S("i nitFocusEvent",5)},$),Y=b("MouseEvent",V,z),Q=b("FocusEvent",V,X),Z=b("MutationE vent",y,{initMutationEvent:S("initMutationEvent",3),get relatedNode(){return R(t his.impl.relatedNode)}}),J=Object.create(null),et=function(){try{new window.Mous eEvent("click")}catch(e){return!1}return!0}();if(!et){var tt=function(e,t,n){if( n){var r=J[n];t=_(_({},r),t)}J[e]=t};tt("Event",{bubbles:!1,cancelable:!1}),tt(" CustomEvent",{detail:null},"Event"),tt("UIEvent",{view:null,detail:0},"Event"),t t("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shi ftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),tt("FocusEvent",{rel atedTarget:null},"UIEvent")}var nt=window.EventTarget,rt=["addEventListener","re moveEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(e ){var t=e.prototype;rt.forEach(function(e){Object.defineProperty(t,e+"_",{value: t[e]})})}),L.prototype={addEventListener:function(e,t,n){if(N(t)){var r=new E(e, t,n),i=A.get(this);if(i){for(var o=0;i.length>o;o++)if(r.equals(i[o]))return}els e i=[],A.set(this,i);i.push(r);var a=C(this);a.addEventListener_(e,h,!0)}},remov eEventListener:function(e,t,n){n=Boolean(n);var r=A.get(this);if(r){for(var i=0, o=!1,a=0;r.length>a;a++)r[a].type===e&&r[a].capture===n&&(i++,r[a].handler===t&& (o=!0,r[a].remove()));if(o&&1===i){var l=C(this);l.removeEventListener_(e,h,!0)} }},dispatchEvent:function(t){e.renderAllPending();var n=C(this);return n.dispatc hEvent_(x(t))}},nt&&P(nt,L);var it=document.elementFromPoint;e.adjustRelatedTarg et=s,e.elementFromPoint=O,e.wrapEventTargetMethods=H,e.wrappers.CustomEvent=K,e. wrappers.Event=y,e.wrappers.EventTarget=L,e.wrappers.FocusEvent=Q,e.wrappers.Mou seEvent=Y,e.wrappers.MutationEvent=Z,e.wrappers.UIEvent=V}(this.ShadowDOMPolyfil l),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,{enumerabl e:!1})}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)retu rn e;for(var t=new n,r=0,i=e.length;i>r;r++)t[r]=o(e[r]);return t.length=i,t}fun ction i(e,t){e.prototype[t]=function(){return r(this.impl[t].apply(this.impl,arg uments))}}var o=e.wrap;n.prototype={item:function(e){return this[e]}},t(n.protot ype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=i,e.wrapNodeList=r}(th is.ShadowDOMPolyfill),function(e){"use strict";function t(e){s(e instanceof o)}f unction n(e,t,n,r){if(e.nodeType!==o.DOCUMENT_FRAGMENT_NODE)return e.parentNode& &e.parentNode.removeChild(e),e.parentNode_=t,e.previousSibling_=n,e.nextSibling_ =r,n&&(n.nextSibling_=e),r&&(r.previousSibling_=e),[e];for(var i,a=[];i=e.firstC hild;)e.removeChild(i),a.push(i),i.parentNode_=t;for(var l=0;a.length>l;l++)a[l] .previousSibling_=a[l-1]||n,a[l].nextSibling_=a[l+1]||r;return n&&(n.nextSibling _=a[0]),r&&(r.previousSibling_=a[a.length-1]),a}function r(e){if(1===e.length)re turn d(e[0]);for(var t=d(document.createDocumentFragment()),n=0;e.length>n;n++)t .appendChild(d(e[n]));return t}function i(e){for(var t=e.firstChild;t;){s(t.pare ntNode===e);var n=t.nextSibling,r=d(t),i=r.parentNode;i&&w.call(i,r),t.previousS ibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}fu nction o(e){s(e instanceof h),a.call(this,e),this.parentNode_=void 0,this.firstC hild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSiblin g_=void 0}var a=e.wrappers.EventTarget,l=e.wrappers.NodeList;e.defineWrapGetter; var s=e.assert,u=e.mixin,c=e.registerWrapper,d=e.unwrap,p=e.wrap,h=window.Node,f =h.prototype.appendChild,m=h.prototype.insertBefore,g=h.prototype.replaceChild,w =h.prototype.removeChild,v=h.prototype.compareDocumentPosition;o.prototype=Objec t.create(a.prototype),u(o.prototype,{appendChild:function(e){t(e),this.invalidat eShadowRenderer();var i=this.lastChild,o=null,a=n(e,this,i,o);return this.lastCh ild_=a[a.length-1],i||(this.firstChild_=a[0]),f.call(this.impl,r(a)),e},insertBe fore:function(e,i){if(!i)return this.appendChild(e);t(e),t(i),s(i.parentNode===t his),this.invalidateShadowRenderer();var o=i.previousSibling,a=i,l=n(e,this,o,a) ;this.firstChild===i&&(this.firstChild_=l[0]);var u=d(i),c=u.parentNode;return c &&m.call(c,r(l),u),e},removeChild:function(e){if(t(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var n=this.firstChild ,r=this.lastChild,i=e.nextSibling,o=e.previousSibling,a=d(e),l=a.parentNode;retu rn l&&w.call(l,a),n===e&&(this.firstChild_=i),r===e&&(this.lastChild_=o),o&&(o.n extSibling_=i),i&&(i.previousSibling_=o),e.previousSibling_=e.nextSibling_=e.par entNode_=null,e},replaceChild:function(e,i){if(t(e),t(i),i.parentNode!==this)thr ow new Error("NotFoundError");this.invalidateShadowRenderer();var o=i.previousSi bling,a=i.nextSibling;a===e&&(a=e.nextSibling);var l=n(e,this,o,a);this.firstChi ld===i&&(this.firstChild_=l[0]),this.lastChild===i&&(this.lastChild_=l[l.length- 1]),i.previousSibling_=null,i.nextSibling_=null,i.parentNode_=null;var s=d(i);re turn s.parentNode&&g.call(s.parentNode,r(l),s),i},hasChildNodes:function(){retur n null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this .parentNode_:p(this.impl.parentNode)},get firstChild(){return void 0!==this.firs tChild_?this.firstChild_:p(this.impl.firstChild)},get lastChild(){return void 0! ==this.lastChild_?this.lastChild_:p(this.impl.lastChild)},get nextSibling(){retu rn void 0!==this.nextSibling_?this.nextSibling_:p(this.impl.nextSibling)},get pr eviousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:p(th is.impl.previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nod eType!==o.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="", t=this.firstChild;t;t=t.nextSibling)e+=t.textContent;return e},set textContent(e ){if(i(this),this.invalidateShadowRenderer(),""!==e){var t=this.impl.ownerDocume nt.createTextNode(e);this.appendChild(t)}},get childNodes(){for(var e=new l,t=0, n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:func tion(e){if(!this.invalidateShadowRenderer())return p(this.impl.cloneNode(e));var t=p(this.impl.cloneNode(!1));if(e)for(var n=this.firstChild;n;n=n.nextSibling)t .appendChild(n.cloneNode(!0));return t},contains:function(e){if(!e)return!1;if(e ===this)return!0;var t=e.parentNode;return t?this.contains(t):!1},compareDocumen tPosition:function(e){return v.call(this.impl,d(e))},get ownerDocument(){return e.renderAllPending(),p(this.impl.ownerDocument)}}),c(h,o,document.createDocument Fragment()),delete o.prototype.querySelector,delete o.prototype.querySelectorAll ,o.prototype=u(Object.create(a.prototype),o.prototype),e.wrappers.Node=o}(this.S hadowDOMPolyfill),function(e){"use strict";function t(e,n){for(var r,i=e.firstEl ementChild;i;){if(i.matches(n))return i;if(r=t(i,n))return r;i=i.nextElementSibl ing}return null}function n(e,t,r){for(var i=e.firstElementChild;i;)i.matches(t)& &(r[r.length++]=i),n(i,t,r),i=i.nextElementSibling;return r}var r={querySelector :function(e){return t(this,e)},querySelectorAll:function(e){return n(this,e,new NodeList)}},i={getElementsByTagName:function(e){return this.querySelectorAll(e)} ,getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElem entsByTagNameNS:function(e,t){if("*"===e)return this.getElementsByTagName(t);for (var n=new NodeList,r=this.getElementsByTagName(t),i=0,o=0;r.length>i;i++)r[i].n amespaceURI===e&&(n[o++]=r[i]);return n.length=o,n}};e.GetElementsByInterface=i, e.SelectorsInterface=r}(this.ShadowDOMPolyfill),function(e){"use strict";functio n t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r =e.wrappers.NodeList,i={get firstElementChild(){return t(this.firstChild)},get l astElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0, t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){f or(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;re turn e.length=t,e}},o={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.nextSibling)}};e.ChildNodeInterface=o,e.P arentNodeInterface=i}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,i=e.mixin,o=e.r egisterWrapper,a=window.CharacterData;t.prototype=Object.create(r.prototype),i(t .prototype,{get textContent(){return this.data},set textContent(e){this.data=e}} ),i(t.prototype,n),o(a,t,document.createTextNode("")),e.wrappers.CharacterData=t }(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){i.call(this,e)} var n=e.ChildNodeInterface,r=e.GetElementsByInterface,i=e.wrappers.Node,o=e.Pare ntNodeInterface,a=e.SelectorsInterface;e.addWrapNodeListMethod;var l=e.mixin,s=e .registerWrapper,u=e.wrappers,c=new SideTable,d=window.Element,p=d.prototype.mat ches||d.prototype.mozMatchesSelector||d.prototype.msMatchesSelector||d.prototype .webkitMatchesSelector;t.prototype=Object.create(i.prototype),l(t.prototype,{cre ateShadowRoot:function(){var t=new u.ShadowRoot(this);return c.set(this,t),e.get RendererForHost(this),this.invalidateShadowRenderer(!0),t},get shadowRoot(){retu rn c.get(this)||null},setAttribute:function(e,t){this.impl.setAttribute(e,t),thi s.invalidateShadowRenderer()},matches:function(e){return p.call(this.impl,e)}}), l(t.prototype,n),l(t.prototype,r),l(t.prototype,o),l(t.prototype,a),s(d,t),e.wra ppers.Element=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){ switch(e){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}fun ction n(e){return e.replace(m,t)}function r(e){switch(e.nodeType){case Node.ELEM ENT_NODE:for(var t,r=e.tagName.toLowerCase(),o="<"+r,a=e.attributes,l=0;t=a[l];l ++)o+=" "+t.name+'="'+n(t.value)+'"';return o+=">",g[r]?o:o+i(e)+"</"+r+">";case Node.TEXT_NODE:return n(e.nodeValue);case Node.COMMENT_NODE:return"<!--"+n(e.no deValue)+"-->";default:throw console.error(e),new Error("not implemented")}}func tion i(e){for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=r(n);return t}functio n o(e,t,n){var r=n||"div";e.textContent="";var i=h(e.ownerDocument.createElement (r));i.innerHTML=t;for(var o;o=i.firstChild;)e.appendChild(f(o))}function a(e){u .call(this,e)}function l(t){c(a,t,function(){return e.renderAllPending(),this.im pl[t]})}function s(t){Object.defineProperty(a.prototype,t,{value:function(){retu rn e.renderAllPending(),this.impl[t].apply(this.impl,arguments)},configurable:!0 ,enumerable:!0})}var u=e.wrappers.Element,c=e.defineGetter,d=e.mixin,p=e.registe rWrapper,h=e.unwrap,f=e.wrap,m=/&|<|"/g,g={area:!0,base:!0,br:!0,col:!0,command: !0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,t rack:!0,wbr:!0},w=window.HTMLElement;a.prototype=Object.create(u.prototype),d(a. prototype,{get innerHTML(){return i(this)},set innerHTML(e){o(this,e,this.tagNam e)},get outerHTML(){return r(this)},set outerHTML(e){if(this.invalidateShadowRen derer())throw new Error("not implemented");this.impl.outerHTML=e}}),["clientHeig ht","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTo p","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach( l),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(s),p(w,a, document.createElement("b")),e.wrappers.HTMLElement=a,e.getInnerHTML=i,e.setInne rHTML=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(t his,e)}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLC ontentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{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)}}),o&&i(o,t),e.wrappe rs.HTMLContentElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";functi on t(e){n.call(this,e),this.olderShadowRoot_=null}var n=e.wrappers.HTMLElement,r =e.mixin,i=e.registerWrapper,o=window.HTMLShadowElement;t.prototype=Object.creat e(n.prototype),r(t.prototype,{get olderShadowRoot(){return this.olderShadowRoot_ },invalidateShadowRenderer:function(){n.prototype.invalidateShadowRenderer.call( this,!0)}}),o&&i(o,t),e.wrappers.HTMLShadowElement=t}(this.ShadowDOMPolyfill),fu nction(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);i f(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t .lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),i=r .createDocumentFragment();n=e.firstChild;)i.appendChild(n);return i}function r(e ){i.call(this,e)}var i=e.wrappers.HTMLElement,o=e.getInnerHTML,a=e.mixin,l=e.reg isterWrapper,s=e.setInnerHTML,u=e.wrap,c=new SideTable,d=new SideTable,p=window. HTMLTemplateElement;r.prototype=Object.create(i.prototype),a(r.prototype,{get co ntent(){if(p)return u(this.impl.content);var e=c.get(this);return e||(e=n(this), c.set(this,e)),e},get innerHTML(){return o(this.content)},set innerHTML(e){s(thi s.content,e),this.invalidateShadowRenderer()}}),p&&l(p,r),e.wrappers.HTMLTemplat eElement=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switc h(e.localName){case"content":return new n(e);case"shadow":return new i(e);case"t emplate":return new o(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e. wrappers.HTMLElement,i=e.wrappers.HTMLShadowElement,o=e.wrappers.HTMLTemplateEle ment;e.mixin;var a=e.registerWrapper,l=window.HTMLUnknownElement;t.prototype=Obj ect.create(r.prototype),a(l,t),e.wrappers.HTMLUnknownElement=t}(this.ShadowDOMPo lyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeIn terface,r=e.SelectorsInterface,i=e.mixin,o=e.registerObject,a=o(document.createD ocumentFragment());i(a.prototype,n),i(a.prototype,r),i(a.prototype,t);var l=o(do cument.createTextNode("")),s=o(document.createComment(""));e.wrappers.Comment=s, e.wrappers.DocumentFragment=a,e.wrappers.Text=l}(this.ShadowDOMPolyfill),functio n(e){"use strict";function t(t){var r=s(t.impl.ownerDocument.createDocumentFragm ent());n.call(this,r),a(r,this);var i=t.shadowRoot;e.nextOlderShadowTreeTable.se t(this,i),u.set(this,t)}var n=e.wrappers.DocumentFragment,r=e.elementFromPoint,i =e.getInnerHTML,o=e.mixin,a=e.rewrap,l=e.setInnerHTML,s=e.unwrap,u=new SideTable ;t.prototype=Object.create(n.prototype),o(t.prototype,{get innerHTML(){return i( this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},invalidateSha dowRenderer:function(){return u.get(this).invalidateShadowRenderer()},elementFro mPoint:function(e,t){return r(this,this.ownerDocument,e,t)},getElementById:funct ion(e){return this.querySelector("#"+e)}}),e.wrappers.ShadowRoot=t,e.getHostForS hadowRoot=function(e){return u.get(e)}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nex tSibling,e.parentNode_=e.parentNode}function n(e){e.firstChild_=e.firstChild,e.l astChild_=e.lastChild}function r(e){_(e instanceof D);for(var r=e.firstChild;r;r =r.nextSibling)t(r);n(e)}function i(e){var t=x(e);r(e),t.textContent=""}function o(e,n){var i=x(e),o=x(n);o.nodeType===D.DOCUMENT_FRAGMENT_NODE?r(n):(l(n),t(n)) ,e.lastChild_=e.lastChild,e.lastChild===e.firstChild&&(e.firstChild_=e.firstChil d);var a=R(i.lastChild);a&&(a.nextSibling_=a.nextSibling),i.appendChild(o)}funct ion a(e,n){var r=x(e),i=x(n);t(n),n.previousSibling&&(n.previousSibling.nextSibl ing_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),e.lastChild===n&&(e.la stChild_=n),e.firstChild===n&&(e.firstChild_=n),r.removeChild(i)}function l(e){v ar t=x(e),n=t.parentNode;n&&a(R(n),e)}function s(e,t){c(t).push(e),F.set(e,t);va r n=A.get(e);n||A.set(e,n=[]),n.push(t)}function u(e){I.set(e,[])}function c(e){ return I.get(e)}function d(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling) t[n++]=r;return t}function p(e,t,n){for(var r=d(e),i=0;r.length>i;i++){var o=r[i ];if(t(o)){if(n(o)===!1)return}else p(o,t,n)}}function h(e,t){var n=!1;return p( e,y,function(e){u(e);for(var r=0;t.length>r;r++){var i=t[r];void 0!==i&&m(i,e)&& (s(i,e),t[r]=void 0,n=!0)}}),n?t.filter(function(e){return void 0!==e}):t}functi on f(e,t){for(var n=0;t.length>n;n++)if(t[n]in e)return t[n]}function m(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(e.nodeTy pe!==D.ELEMENT_NODE)return!1;if(!k.test(n))return!1;if(":"===n[0]&&!G.test(n))re turn!1;try{return e.matches(n)}catch(r){return!1}}function g(){H=null,U.forEach( function(e){e.render()}),U=[]}function w(e){this.host=e,this.dirty=!1,this.assoc iateNode(e)}function v(e){var t=W.get(e);return t||(t=new w(e),W.set(e,t)),t}fun ction E(e){return"content"===e.localName}function y(e){return"content"===e.local Name}function T(e){return"shadow"===e.localName}function b(e){return"shadow"===e .localName}function S(e){return!!e.shadowRoot}function M(e){return j.get(e)}func tion N(e){for(var t=[],n=e.shadowRoot;n;n=j.get(n))t.push(n);return t}function L (e,t){F.set(e,t)}function C(e){new w(e).render()}var H,O=e.wrappers.HTMLContentE lement,D=e.wrappers.Node,_=e.assert,P=e.mixin,x=e.unwrap,R=e.wrap,I=new SideTabl e,A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTabl e,k=/^[*.:#[a-zA-Z_|]/,G=new RegExp("^:("+["link","visited","target","enabled"," disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type"," nth-last-of-type","first-child","last-child","first-of-type","last-of-type","onl y-of-type"].join("|")+")"),q=f(window,["requestAnimationFrame","mozRequestAnimat ionFrame","webkitRequestAnimationFrame","setTimeout"]),U=[];w.prototype={render: function(){if(this.dirty){var e=this.host;this.treeComposition();var t=e.shadowR oot;if(t){this.removeAllChildNodes(this.host);var n=d(t);n.forEach(function(n){t his.renderNode(e,t,n,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this. dirty){if(this.dirty=!0,U.push(this),H)return;H=window[q](g,0)}},renderNode:func tion(e,t,n,r){if(S(n)){this.appendChild(e,n);var i=v(n);i.dirty=!0,i.render()}el se E(n)?this.renderInsertionPoint(e,t,n,r):T(n)?this.renderShadowInsertionPoint( e,t,n):this.renderAsAnyDomTree(e,t,n,r)},renderAsAnyDomTree:function(e,t,n,r){if (this.appendChild(e,n),S(n))C(n);else{var i=n,o=d(i);o.forEach(function(e){this. renderNode(i,t,e,r)},this)}},renderInsertionPoint:function(e,t,n,r){var i=c(n);i .length?(this.removeAllChildNodes(n),i.forEach(function(n){E(n)&&r?this.renderIn sertionPoint(e,t,n,r):this.renderAsAnyDomTree(e,t,n,r)},this)):this.renderFallba ckContent(e,n),this.remove(n)},renderShadowInsertionPoint:function(e,t,n){var r= M(t);if(r){F.set(r,n),n.olderShadowRoot_=r,this.remove(n);var i=d(r);i.forEach(f unction(t){this.renderNode(e,r,t,!0)},this)}else this.renderFallbackContent(e,n) },renderFallbackContent:function(e,t){var n=d(t);n.forEach(function(t){this.appe ndChild(e,t)},this)},treeComposition:function(){var e=this.host,t=e.shadowRoot,n =[],r=d(e);r.forEach(function(e){if(E(e)){var t=c(e);t&&t.length||(t=d(e)),n.pus h.apply(n,t)}else n.push(e)});for(var i,o;t;){if(i=void 0,p(t,b,function(e){retu rn i=e,!1}),o=i,n=h(t,n),o){var a=M(t);if(a){t=a,L(t,o);continue}break}break}},a ppendChild:function(e,t){o(e,t),this.associateNode(t)},remove:function(e){l(e),t his.associateNode(e)},removeAllChildNodes:function(e){i(e)},associateNode:functi on(e){B.set(e,this)}},D.prototype.invalidateShadowRenderer=function(e){var t=B.g et(this);if(!t)return!1;var n;return(e||this.shadowRoot||(n=this.parentNode)&&(n .shadowRoot||n instanceof ShadowRoot))&&t.invalidate(),!0},O.prototype.getDistri butedNodes=function(){return g(),c(this)},P(D.prototype,{get insertionParent(){r eturn F.get(this)||null}}),e.eventParentsTable=A,e.getRendererForHost=v,e.getSha dowTrees=N,e.nextOlderShadowTreeTable=j,e.renderAllPending=g,e.visual={removeAll ChildNodes:i,appendChild:o,removeChild:a}}(this.ShadowDOMPolyfill),function(e){" use strict";function t(e){l.call(this,e)}function n(e){var n=document[e];t.proto type[e]=function(){return g(n.apply(this.impl,arguments))}}function r(e){this.im pl=e}function i(e,t){var n=document.implementation[t];e.prototype[t]=function(){ return g(n.apply(this.impl,arguments))}}function o(e,t){var n=document.implement ation[t];e.prototype[t]=function(){return n.apply(this.impl,arguments)}}var a=e. GetElementsByInterface,l=e.wrappers.Node,s=e.ParentNodeInterface,u=e.SelectorsIn terface,c=e.defineWrapGetter,d=e.elementFromPoint,p=e.forwardMethodsToWrapper,h= e.mixin,f=e.registerWrapper,m=e.unwrap,g=e.wrap,w=e.wrapEventTargetMethods;e.wra pNodeList;var v=new SideTable;t.prototype=Object.create(l.prototype),c(t,"docume ntElement"),c(t,"body"),c(t,"head"),["getElementById","createElement","createEle mentNS","createTextNode","createDocumentFragment","createEvent","createEventNS"] .forEach(n);var E=document.adoptNode,y=document.write;h(t.prototype,{adoptNode:f unction(e){return E.call(this.impl,m(e)),e},elementFromPoint:function(e,t){retur n d(this,this,e,t)},write:function(e){for(var t=this.querySelectorAll("*"),n=t[t .length-1];n.nextSibling;)n=n.nextSibling;var r=n.parentNode;r.lastChild_=void 0 ,n.nextSibling_=void 0,y.call(this.impl,e)}}),p([window.HTMLBodyElement,window.H TMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocu mentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagN ameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceC hild"]),p([window.HTMLDocument||window.Document],["adoptNode","createDocumentFra gment","createElement","createElementNS","createEvent","createEventNS","createTe xtNode","elementFromPoint","getElementById","write"]),h(t.prototype,a),h(t.proto type,s),h(t.prototype,u),h(t.prototype,{get implementation(){var e=v.get(this);r eturn e?e:(e=new r(m(this).implementation),v.set(this,e),e)}}),f(window.Document ,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&f(window .HTMLDocument,t),w([window.HTMLBodyElement,window.HTMLDocument||window.Document, window.HTMLHeadElement]),i(r,"createDocumentType"),i(r,"createDocument"),i(r,"cr eateHTMLDocument"),o(r,"hasFeature"),f(window.DOMImplementation,r),p([window.DOM Implementation],["createDocumentType","createDocument","createHTMLDocument","has Feature"]),e.wrappers.Document=t,e.wrappers.DOMImplementation=r}(this.ShadowDOMP olyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers. EventTarget,r=e.mixin,i=e.registerWrapper,o=e.unwrap,a=e.unwrapIfNeeded,l=e.wrap ,s=window.Window;t.prototype=Object.create(n.prototype);var u=window.getComputed Style;s.prototype.getComputedStyle=function(e,t){return u.call(this||window,a(e) ,t)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function (e){s.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,argument s)}}),r(t.prototype,{getComputedStyle:function(e,t){return u.call(o(this),a(e),t )}}),i(s,t),e.wrappers.Window=t}(this.ShadowDOMPolyfill),function(e){"use strict ";function t(e){this.impl=e}function n(e){return new t(e)}function r(e){return e .map(n)}function i(e){var t=this;this.impl=new c(function(n){e.call(t,r(n),t)})} var o=e.defineGetter,a=e.defineWrapGetter,l=e.registerWrapper,s=e.unwrapIfNeeded ,u=e.wrapNodeList;e.wrappers;var c=window.MutationObserver||window.WebKitMutatio nObserver;if(c){var d=window.MutationRecord;t.prototype={get addedNodes(){return u(this.impl.addedNodes)},get removedNodes(){return u(this.impl.removedNodes)}}, ["target","previousSibling","nextSibling"].forEach(function(e){a(t,e)}),["type", "attributeName","attributeNamespace","oldValue"].forEach(function(e){o(t,e,funct ion(){return this.impl[e]
2 },disconnect:function(){this.impl.disconnect()},takeRecords:function(){return d( this.impl.takeRecords())}},a.wrappers.MutationObserver=e,a.wrappers.MutationReco rd=b}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a] ,d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}} a.isWrapperFor;var c={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTM LAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement" ,body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl :"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",di v:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font: "HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTML FrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElemen t",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li :"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLL inkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemEl ement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:" HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",opti on:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param :"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQ uoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLS ourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTable CaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTable RowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",text area:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video: "HTMLVideoElement"};Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrapp ers).forEach(function(b){window[b]=a.wrappers[b]}),a.knownElements=c}(this.Shado wDOMPolyfill),function(){var a=window.ShadowDOMPolyfill;a.wrap,Object.defineProp erties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shado wRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.cre ateShadowRoot,window.dartExperimentalFixupGetTag=function(b){function c(a){if(a instanceof d)return"NodeList";if(a instanceof e)return"ShadowRoot";if(a instance of MutationRecord)return"MutationRecord";if(a instanceof MutationObserver)return "MutationObserver";if(f(a)){a=g(a);var c=a.constructor;if(c&&c._ShadowDOMPolyfil l$isGeneratedWrapper){var h=c._ShadowDOMPolyfill$cacheTag_;return h||(h=Object.p rototype.toString.call(a),h=h.substring(8,h.length-1),c._ShadowDOMPolyfill$cache Tag_=h),h}}return b(a)}var d=a.wrappers.NodeList,e=a.wrappers.ShadowRoot,f=a.isW rapper,g=a.unwrap;return c}}()} 2 })}),d&&l(d,t),window.Node,i.prototype={observe:function(e,t){this.impl.observe( s(e),t)},disconnect:function(){this.impl.disconnect()},takeRecords:function(){re turn r(this.impl.takeRecords())}},e.wrappers.MutationObserver=i,e.wrappers.Mutat ionRecord=t}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var i=document.createElement(e),o=i.constructor;window [t]=o}}e.isWrapperFor;var n={a:"HTMLAnchorElement",applet:"HTMLAppletElement",ar ea:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseE lement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElem ent",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElem ent",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement ",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",framese t:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadin gElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElem ent",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link :"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMen uItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElemen t",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElemen t",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement ",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q :"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source :"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HT MLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HT MLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElemen t",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement" ,video:"HTMLVideoElement"};Object.keys(n).forEach(t),Object.getOwnPropertyNames( e.wrappers).forEach(function(t){window[t]=e.wrappers[t]}),e.knownElements=n}(thi s.ShadowDOMPolyfill),function(){var e=window.ShadowDOMPolyfill;e.wrap,Object.def ineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return thi s.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.protot ype.createShadowRoot,window.dartExperimentalFixupGetTag=function(t){function n(e ){if(e instanceof r)return"NodeList";if(e instanceof i)return"ShadowRoot";if(e i nstanceof MutationRecord)return"MutationRecord";if(e instanceof MutationObserver )return"MutationObserver";if(o(e)){e=a(e);var n=e.constructor;if(n&&n._ShadowDOM Polyfill$isGeneratedWrapper){var l=n._ShadowDOMPolyfill$cacheTag_;return l||(l=O bject.prototype.toString.call(e),l=l.substring(8,l.length-1),n._ShadowDOMPolyfil l$cacheTag_=l),l}}return t(e)}var r=e.wrappers.NodeList,i=e.wrappers.ShadowRoot, o=e.isWrapper,a=e.unwrap;return n}}()}
OLDNEW
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.debug.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698