@webcomponents/shadydom
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -8,4 +8,15 @@ # Changelog | ||
<!-- ## [Unreleased] --> | ||
<!-- ## Unreleased --> | ||
## [1.9.0] - 2021-08-02 | ||
- Add `@this` annotation to new `elementFromPoint` wrappers. | ||
([#464]https://github.com/webcomponents/polyfills/pull/464) | ||
- Adds `element(s)FromPoint` to `document` and `shadowRoot` | ||
([#463]https://github.com/webcomponents/polyfills/pull/463) | ||
- Add TS externs. ([#457](https://github.com/webcomponents/polyfills/pull/457)) | ||
- When `EventTarget.prototype` exists but is not in the prototype chain of | ||
`window`, polyfill installation breaks. | ||
([#416](https://github.com/webcomponents/polyfills/pull/416)) | ||
## [1.8.0] - 2020-10-21 | ||
@@ -12,0 +23,0 @@ |
@@ -9,7 +9,7 @@ /** | ||
* prevent conflicts with other closure-compiler code. | ||
* @type {Object} | ||
* @type {!Object|undefined} | ||
*/ | ||
EventTarget.prototype.__handlers; | ||
/** @type {Object} */ | ||
/** @type {!Object|undefined} */ | ||
Node.prototype.__shady; | ||
@@ -26,3 +26,3 @@ | ||
// blur). | ||
IWrapper.prototype.focus = function() {}; | ||
IWrapper.prototype.focus = function () {}; | ||
@@ -47,3 +47,3 @@ /** @type {!boolean|undefined} */ | ||
*/ | ||
ShadowRoot.prototype._renderSelf = function(){}; | ||
ShadowRoot.prototype._renderSelf = function () {}; | ||
@@ -50,0 +50,0 @@ // Prevent renaming of properties used by Polymer templates with |
{ | ||
"name": "@webcomponents/shadydom", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"description": "Shadow DOM polyfill", | ||
"main": "shadydom.min.js", | ||
"license": "BSD-3-Clause", | ||
"repository": { | ||
@@ -11,6 +14,22 @@ "type": "git", | ||
}, | ||
"author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", | ||
"homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/shadydom", | ||
"bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+shadydom\"", | ||
"homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/shadydom", | ||
"author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", | ||
"license": "BSD-3-Clause", | ||
"main": "shadydom.min.js", | ||
"scripts": { | ||
"build": "gulp", | ||
"build:watch": "chokidar --initial 'src/**/*.js' -c 'npm run build'", | ||
"debug": "rollup -c", | ||
"prepack": "npm run build", | ||
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install" | ||
}, | ||
"files": [ | ||
"CHANGELOG.md", | ||
"externs/**/*.d.ts", | ||
"externs/**/*.js", | ||
"LICENSE.md", | ||
"shadydom.min.js*", | ||
"src/**/*.js", | ||
"README.md" | ||
], | ||
"keywords": [ | ||
@@ -26,21 +45,3 @@ "shady-dom", | ||
], | ||
"scripts": { | ||
"build": "gulp", | ||
"build:watch": "chokidar --initial 'src/**/*.js' -c 'npm run build'", | ||
"debug": "rollup -c", | ||
"lint": "eslint src", | ||
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install", | ||
"prepack": "npm run build" | ||
}, | ||
"files": [ | ||
"shadydom.min.js*", | ||
"src/**/*.js", | ||
"externs/**/*.js", | ||
"LICENSE.md", | ||
"README.md" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "2f9e4c15853a7963e99e886e053f2483459f4407" | ||
"gitHead": "966c28a79fcd46dedc4367be6b93404565ab9cf6" | ||
} |
@@ -24,3 +24,2 @@ # ShadyDOM | ||
</script> | ||
``` | ||
@@ -31,2 +30,3 @@ | ||
For building and testing, first run | ||
``` | ||
@@ -39,3 +39,2 @@ npm install | ||
## Limitations | ||
@@ -47,4 +46,4 @@ | ||
ShadowDOM compatible styling is *not* provided with the ShadyDOM shim. To | ||
shim ShadowDOM styling, use the [shadycss](https://github.com/webcomponents/shadycss) shim. | ||
ShadowDOM compatible styling is _not_ provided with the ShadyDOM shim. To | ||
shim ShadowDOM styling, use the [shadycss](https://github.com/webcomponents/polyfills/tree/master/packages/shadycss) shim. | ||
@@ -51,0 +50,0 @@ On very old versions of Chrome and Safari, in rare cases `ShadyDOM.patch(node)` |
@@ -10,44 +10,58 @@ (function(){/* | ||
*/ | ||
'use strict';var n;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function p(a){if(!(a instanceof Array)){a=ba(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a}var ca="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function q(a,b){return{index:a,s:[],v:b}} | ||
function da(a,b,c,d){var e=0,f=0,g=0,h=0,m=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(g=0;g<m;g++)if(a[g]!==c[g])break a;g=m}if(b==a.length&&d==c.length){h=a.length;for(var l=c.length,k=0;k<m-g&&ea(a[--h],c[--l]);)k++;h=k}e+=g;f+=g;b-=h;d-=h;if(0==b-e&&0==d-f)return[];if(e==b){for(b=q(e,0);f<d;)b.s.push(c[f++]);return[b]}if(f==d)return[q(e,b-e)];m=e;g=f;d=d-g+1;h=b-m+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(h),b[l][0]=l;for(l=0;l<h;l++)b[0][l]=l;for(l=1;l<d;l++)for(k=1;k<h;k++)if(a[m+k-1]===c[g+l-1])b[l][k]= | ||
b[l-1][k-1];else{var r=b[l-1][k]+1,C=b[l][k-1]+1;b[l][k]=r<C?r:C}m=b.length-1;g=b[0].length-1;d=b[m][g];for(a=[];0<m||0<g;)0==m?(a.push(2),g--):0==g?(a.push(3),m--):(h=b[m-1][g-1],l=b[m-1][g],k=b[m][g-1],r=l<k?l<h?l:h:k<h?k:h,r==h?(h==d?a.push(0):(a.push(1),d=h),m--,g--):r==l?(a.push(3),m--,d=l):(a.push(2),g--,d=k));a.reverse();b=void 0;m=[];for(g=0;g<a.length;g++)switch(a[g]){case 0:b&&(m.push(b),b=void 0);e++;f++;break;case 1:b||(b=q(e,0));b.v++;e++;b.s.push(c[f]);f++;break;case 2:b||(b=q(e,0)); | ||
b.v++;e++;break;case 3:b||(b=q(e,0)),b.s.push(c[f]),f++}b&&m.push(b);return m}function ea(a,b){return a===b};function fa(){}fa.prototype.toJSON=function(){return{}};function t(a){a.__shady||(a.__shady=new fa);return a.__shady}function u(a){return a&&a.__shady};var v=window.ShadyDOM||{};v.T=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var ha=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");v.c=!!(ha&&ha.configurable&&ha.get);v.F=v.force||!v.T;v.g=v.noPatch||!1;v.o=v.preferPerformance;v.G="on-demand"===v.g;v.L=navigator.userAgent.match("Trident");function w(a){return(a=u(a))&&void 0!==a.firstChild}function x(a){return a instanceof ShadowRoot}function ia(a){return(a=(a=u(a))&&a.root)&&ja(a)} | ||
var y=Element.prototype,ka=y.matches||y.matchesSelector||y.mozMatchesSelector||y.msMatchesSelector||y.oMatchesSelector||y.webkitMatchesSelector,la=document.createTextNode(""),ma=0,na=[];(new MutationObserver(function(){for(;na.length;)try{na.shift()()}catch(a){throw la.textContent=ma++,a;}})).observe(la,{characterData:!0});function oa(a){na.push(a);la.textContent=ma++}var pa=document.contains?function(a,b){return a.__shady_native_contains(b)}:function(a,b){return a===b||a.documentElement&&a.documentElement.__shady_native_contains(b)}; | ||
function qa(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1}function z(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(e){return a[e]};a.namedItem=function(e){if("length"!==e&&isNaN(e)&&a[e])return a[e];for(var f=ba(a),g=f.next();!g.done;g=f.next())if(g=g.value,(g.getAttribute("id")||g.getAttribute("name"))==e)return g;return null};return a} | ||
function ra(a){var b=[];for(a=a.__shady_native_firstChild;a;a=a.__shady_native_nextSibling)b.push(a);return b}function sa(a){var b=[];for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)b.push(a);return b}function ta(a,b,c){c.configurable=!0;if(c.value)a[b]=c.value;else try{Object.defineProperty(a,b,c)}catch(d){}}function A(a,b,c,d){c=void 0===c?"":c;for(var e in b)d&&0<=d.indexOf(e)||ta(a,c+e,b[e])}function ua(a,b){for(var c in b)c in a&&ta(a,c,b[c])} | ||
function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b}function va(a,b){for(var c=Object.getOwnPropertyNames(b),d=0,e;d<c.length;d++)e=c[d],a[e]=b[e]}function wa(a){return a instanceof Node?a:document.createTextNode(""+a)} | ||
function D(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];if(1===b.length)return wa(b[0]);c=document.createDocumentFragment();b=ba(b);for(var d=b.next();!d.done;d=b.next())c.appendChild(wa(d.value));return c};var E=[],xa;function ya(a){xa||(xa=!0,oa(F));E.push(a)}function F(){xa=!1;for(var a=!!E.length;E.length;)E.shift()();return a}F.list=E;var za=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get shadowRoot(){return this.__shady_shadowRoot}}),Aa=B({get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent= | ||
a},get innerHTML(){return this.__shady_innerHTML},set innerHTML(a){return this.__shady_innerHTML=a}}),Ba=B({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className}, | ||
set className(a){return this.__shady_className=a}});function Ca(a){for(var b in a){var c=a[b];c&&(c.enumerable=!1)}}Ca(za);Ca(Aa);Ca(Ba);var Da=v.c||!0===v.g,Ea=Da?function(){}:function(a){var b=t(a);b.N||(b.N=!0,ua(a,Ba))},Fa=Da?function(){}:function(a){var b=t(a);b.M||(b.M=!0,ua(a,za),window.customElements&&window.customElements.polyfillWrapFlushCallback&&!v.g||ua(a,Aa))};var G="__eventWrappers"+Date.now(),Ga=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Ha=function(){function a(){}var b=!1,c={get capture(){b=!0;return!1}};window.addEventListener("test",a,c);window.removeEventListener("test",a,c);return b}();function Ia(a){if(a&&"object"===typeof a){var b=!!a.capture;var c=!!a.once;var d=!!a.passive;var e=a.i}else b=!!a,d=c=!1;return{K:e,capture:b,once:c,passive:d,J:Ha?a:b}} | ||
var Ja={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0,pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0, | ||
drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},Ka={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0};function La(a){return a instanceof Node?a.__shady_getRootNode():a} | ||
function H(a,b){var c=[],d=a;for(a=La(a);d;)c.push(d),d.__shady_assignedSlot?d=d.__shady_assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d=d.host:d=d.__shady_parentNode;c[c.length-1]===document&&c.push(window);return c}function Ma(a){a.__composedPath||(a.__composedPath=H(a.target,!0));return a.__composedPath}function Na(a,b){if(!x)return a;a=H(a,!0);for(var c=0,d,e=void 0,f,g=void 0;c<b.length;c++)if(d=b[c],f=La(d),f!==e&&(g=a.indexOf(f),e=f),!x(f)||-1<g)return d} | ||
function Oa(a){function b(c,d){c=new a(c,d);c.__composed=d&&!!d.composed;return c}b.__proto__=a;b.prototype=a.prototype;return b}var Pa={focus:!0,blur:!0};function Qa(a){return a.__target!==a.target||a.__relatedTarget!==a.relatedTarget}function Ra(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!Qa(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.__immediatePropagationStopped);d++);} | ||
function Sa(a){var b=a.composedPath(),c=b.map(function(m){return Na(m,b)}),d=a.bubbles;Object.defineProperty(a,"currentTarget",{configurable:!0,enumerable:!0,get:function(){return g}});var e=Event.CAPTURING_PHASE;Object.defineProperty(a,"eventPhase",{configurable:!0,enumerable:!0,get:function(){return e}});for(var f=b.length-1;0<=f;f--){var g=b[f];e=g===c[f]?Event.AT_TARGET:Event.CAPTURING_PHASE;Ra(a,g,"capture");if(a.B)return}for(f=0;f<b.length;f++){g=b[f];var h=g===c[f];if(h||d)if(e=h?Event.AT_TARGET: | ||
Event.BUBBLING_PHASE,Ra(a,g,"bubble"),a.B)return}e=0;g=null}function Ta(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],m=h.type,l=h.capture,k=h.once,r=h.passive;if(b===h.node&&c===m&&d===l&&e===k&&f===r)return g}return-1}function Ua(a){F();return!v.o&&this instanceof Node&&!pa(document,this)?(a.__target||Va(a,this),Sa(a)):this.__shady_native_dispatchEvent(a)} | ||
function Wa(a,b,c){var d=Ia(c),e=d.capture,f=d.once,g=d.passive,h=d.K;d=d.J;if(b){var m=typeof b;if("function"===m||"object"===m)if("object"!==m||b.handleEvent&&"function"===typeof b.handleEvent){if(Ka[a])return this.__shady_native_addEventListener(a,b,d);var l=h||this;if(h=b[G]){if(-1<Ta(h,l,a,e,f,g))return}else b[G]=[];h=function(k){f&&this.__shady_removeEventListener(a,b,c);k.__target||Va(k);if(l!==this){var r=Object.getOwnPropertyDescriptor(k,"currentTarget");Object.defineProperty(k,"currentTarget", | ||
{get:function(){return l},configurable:!0});var C=Object.getOwnPropertyDescriptor(k,"eventPhase");Object.defineProperty(k,"eventPhase",{configurable:!0,enumerable:!0,get:function(){return e?Event.CAPTURING_PHASE:Event.BUBBLING_PHASE}})}k.__previousCurrentTarget=k.currentTarget;if(!x(l)&&"slot"!==l.localName||-1!=k.composedPath().indexOf(l))if(k.composed||-1<k.composedPath().indexOf(l))if(Qa(k)&&k.target===k.relatedTarget)k.eventPhase===Event.BUBBLING_PHASE&&k.stopImmediatePropagation();else if(k.eventPhase=== | ||
Event.CAPTURING_PHASE||k.bubbles||k.target===l||l instanceof Window){var R="function"===m?b.call(l,k):b.handleEvent&&b.handleEvent(k);l!==this&&(r?(Object.defineProperty(k,"currentTarget",r),r=null):delete k.currentTarget,C?(Object.defineProperty(k,"eventPhase",C),C=null):delete k.eventPhase);return R}};b[G].push({node:l,type:a,capture:e,once:f,passive:g,V:h});this.__handlers=this.__handlers||{};this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]};this.__handlers[a][e?"capture":"bubble"].push(h); | ||
Pa[a]||this.__shady_native_addEventListener(a,h,d)}}} | ||
function Xa(a,b,c){if(b){var d=Ia(c);c=d.capture;var e=d.once,f=d.passive,g=d.K;d=d.J;if(Ka[a])return this.__shady_native_removeEventListener(a,b,d);var h=g||this;g=void 0;var m=null;try{m=b[G]}catch(l){}m&&(e=Ta(m,h,a,c,e,f),-1<e&&(g=m.splice(e,1)[0].V,m.length||(b[G]=void 0)));this.__shady_native_removeEventListener(a,g||b,d);g&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][c?"capture":"bubble"],b=a.indexOf(g),-1<b&&a.splice(b,1))}} | ||
function Ya(){for(var a in Pa)window.__shady_native_addEventListener(a,function(b){b.__target||(Va(b),Sa(b))},!0)} | ||
var Za=B({get composed(){void 0===this.__composed&&(Ga?this.__composed="focusin"===this.type||"focusout"===this.type||Ga(this):!1!==this.isTrusted&&(this.__composed=Ja[this.type]));return this.__composed||!1},composedPath:function(){this.__composedPath||(this.__composedPath=H(this.__target,this.composed));return this.__composedPath},get target(){return Na(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.__relatedTarget)return null;this.__relatedTargetComposedPath|| | ||
(this.__relatedTargetComposedPath=H(this.__relatedTarget,!0));return Na(this.currentTarget||this.__previousCurrentTarget,this.__relatedTargetComposedPath)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);this.B=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.B=this.__immediatePropagationStopped=!0}}); | ||
function Va(a,b){b=void 0===b?a.target:b;a.__target=b;a.__relatedTarget=a.relatedTarget;if(v.c){b=Object.getPrototypeOf(a);if(!b.hasOwnProperty("__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Za);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Za)}var $a=Oa(Event),ab=Oa(CustomEvent),bb=Oa(MouseEvent); | ||
function cb(){if(!Ga&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var b=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(b)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}} | ||
var db=Object.getOwnPropertyNames(Element.prototype).filter(function(a){return"on"===a.substring(0,2)}),eb=Object.getOwnPropertyNames(HTMLElement.prototype).filter(function(a){return"on"===a.substring(0,2)});function fb(a){return{set:function(b){var c=t(this),d=a.substring(2);c.h||(c.h={});c.h[a]&&this.removeEventListener(d,c.h[a]);this.__shady_addEventListener(d,b);c.h[a]=b},get:function(){var b=u(this);return b&&b.h&&b.h[a]},configurable:!0}};var gb=B({dispatchEvent:Ua,addEventListener:Wa,removeEventListener:Xa});var hb=window.document,ib=v.o,jb=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),kb=jb&&jb.get;function lb(a){for(var b;b=a.__shady_firstChild;)a.__shady_removeChild(b)}function mb(a){var b=u(a);if(b&&void 0!==b.A)for(b=a.__shady_firstChild;b;b=b.__shady_nextSibling)mb(b);if(a=u(a))a.A=void 0}function nb(a){var b=a;if(a&&"slot"===a.localName){var c=u(a);(c=c&&c.l)&&(b=c.length?c[0]:nb(a.__shady_nextSibling))}return b} | ||
function ob(a,b,c){if(a=(a=u(a))&&a.m){if(b)if(b.nodeType===Node.DOCUMENT_FRAGMENT_NODE)for(var d=0,e=b.childNodes.length;d<e;d++)a.addedNodes.push(b.childNodes[d]);else a.addedNodes.push(b);c&&a.removedNodes.push(c);pb(a)}} | ||
var M=B({get parentNode(){var a=u(this);a=a&&a.parentNode;return void 0!==a?a:this.__shady_native_parentNode},get firstChild(){var a=u(this);a=a&&a.firstChild;return void 0!==a?a:this.__shady_native_firstChild},get lastChild(){var a=u(this);a=a&&a.lastChild;return void 0!==a?a:this.__shady_native_lastChild},get nextSibling(){var a=u(this);a=a&&a.nextSibling;return void 0!==a?a:this.__shady_native_nextSibling},get previousSibling(){var a=u(this);a=a&&a.previousSibling;return void 0!==a?a:this.__shady_native_previousSibling}, | ||
get childNodes(){if(w(this)){var a=u(this);if(!a.childNodes){a.childNodes=[];for(var b=this.__shady_firstChild;b;b=b.__shady_nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c=this.__shady_native_childNodes;c.item=function(d){return c[d]};return c},get parentElement(){var a=u(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:this.__shady_native_parentElement},get isConnected(){if(kb&&kb.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1; | ||
var a=this.ownerDocument;if(null===a||pa(a,this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(x(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(w(this)){for(var a=[],b=this.__shady_firstChild;b;b=b.__shady_nextSibling)b.nodeType!==Node.COMMENT_NODE&&a.push(b.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!w(this)&& | ||
v.c){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&lb(this);this.__shady_native_textContent=a}else lb(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==hb&&a.ownerDocument!==hb)return this.__shady_native_insertBefore(a,b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent."); | ||
if(b){var c=u(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;ob(this,a);var d=[],e=(c=I(this))?c.host.localName:J(this),f=a.__shady_parentNode;if(f){var g=J(a);var h=!!c||!I(a)||ib&&void 0!==this.__noInsertionPoint;f.__shady_removeChild(a,h)}f=!0;var m=(!ib||void 0===a.__noInsertionPoint&&void 0=== | ||
this.__noInsertionPoint)&&!qb(a,e),l=c&&!a.__noInsertionPoint&&(!ib||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(l||m)m&&(g=g||J(a)),rb(a,function(k){l&&"slot"===k.localName&&d.push(k);if(m){var r=g;K()&&(r&&sb(k,r),(r=K())&&r.scopeNode(k,e))}});d.length&&(tb(c),c.f.push.apply(c.f,p(d)),L(c));w(this)&&(ub(a,this,b),h=u(this),h.root?(f=!1,ia(this)&&L(h.root)):c&&"slot"===this.localName&&(f=!1,L(c)));f?(c=x(this)?this.host:this,b?(b=nb(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)): | ||
a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);return a},appendChild:function(a){if(this!=a||!x(a))return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==hb)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);ob(this,null,a);var c=I(a),d=c&&vb(c,a),e=u(this);if(w(this)&&(wb(a,this),ia(this))){L(e.root);var f=!0}if(K()&&!b&&c&&a.nodeType!== | ||
Node.TEXT_NODE){var g=J(a);rb(a,function(h){sb(h,g)})}mb(a);c&&((b="slot"===this.localName)&&(f=!0),(d||b)&&L(c));f||(f=x(this)?this.host:this,(!e.root&&"slot"!==a.localName||f===a.__shady_native_parentNode)&&f.__shady_native_removeChild(a));return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a);var b=this.__shady_native_cloneNode(!1);if(a&&b.nodeType!==Node.ATTRIBUTE_NODE){a= | ||
this.__shady_firstChild;for(var c;a;a=a.__shady_nextSibling)c=a.__shady_cloneNode(!0),b.__shady_appendChild(c)}return b},getRootNode:function(a){if(this&&this.nodeType){var b=t(this),c=b.A;void 0===c&&(x(this)?(c=this,b.A=c):(c=(c=this.__shady_parentNode)?c.__shady_getRootNode(a):this,document.documentElement.__shady_native_contains(this)&&(b.A=c)));return c}},contains:function(a){return qa(this,a)}});var O=B({get assignedSlot(){var a=this.__shady_parentNode;(a=a&&a.__shady_shadowRoot)&&N(a);return(a=u(this))&&a.assignedSlot||null}});function xb(a,b,c){var d=[];yb(a,b,c,d);return d}function yb(a,b,c,d){for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling){var e;if(e=a.nodeType===Node.ELEMENT_NODE){e=a;var f=b,g=c,h=d,m=f(e);m&&h.push(e);g&&g(m)?e=m:(yb(e,f,g,h),e=void 0)}if(e)break}} | ||
var zb={get firstElementChild(){var a=u(this);if(a&&void 0!==a.firstChild){for(a=this.__shady_firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_firstElementChild},get lastElementChild(){var a=u(this);if(a&&void 0!==a.lastChild){for(a=this.__shady_lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_lastElementChild},get children(){return w(this)?z(Array.prototype.filter.call(sa(this),function(a){return a.nodeType=== | ||
Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){var a=this.__shady_children;return a?a.length:0}},P=B((zb.append=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];this.__shady_insertBefore(D.apply(null,p(b)),null)},zb.prepend=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];this.__shady_insertBefore(D.apply(null,p(b)),this.__shady_firstChild)},zb.replaceChildren=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c]; | ||
for(;null!==(c=this.__shady_firstChild);)this.__shady_removeChild(c);this.__shady_insertBefore(D.apply(null,p(b)),null)},zb)),Ab=B({querySelector:function(a){return xb(this,function(b){return ka.call(b,a)},function(b){return!!b})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return z(b.filter(function(d){return d.__shady_getRootNode()==c}))}return z(xb(this,function(d){return ka.call(d,a)}))}}), | ||
Bb=v.o&&!v.g?va({},P):P;va(P,Ab);/* | ||
'use strict';var n;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function p(a){if(!(a instanceof Array)){a=ba(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a} | ||
function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var da=ca(this);function ea(){}ea.prototype.toJSON=function(){return{}};function q(a){a.__shady||(a.__shady=new ea);return a.__shady}function t(a){return a&&a.__shady};var u=window.ShadyDOM||{};u.Y=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var fa=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");u.i=!!(fa&&fa.configurable&&fa.get);u.K=u.force||!u.Y;u.l=u.noPatch||!1;u.A=u.preferPerformance;u.L="on-demand"===u.l;u.R=navigator.userAgent.match("Trident");function ha(){return Document.prototype.msElementsFromPoint?"msElementsFromPoint":"elementsFromPoint"}function v(a){return(a=t(a))&&void 0!==a.firstChild} | ||
function w(a){return a instanceof ShadowRoot}function ia(a){return(a=(a=t(a))&&a.root)&&ja(a)}var x=Element.prototype,ka=x.matches||x.matchesSelector||x.mozMatchesSelector||x.msMatchesSelector||x.oMatchesSelector||x.webkitMatchesSelector,la=document.createTextNode(""),ma=0,na=[];(new MutationObserver(function(){for(;na.length;)try{na.shift()()}catch(a){throw la.textContent=ma++,a;}})).observe(la,{characterData:!0});function oa(a){na.push(a);la.textContent=ma++} | ||
var pa=document.contains?function(a,b){return a.__shady_native_contains(b)}:function(a,b){return a===b||a.documentElement&&a.documentElement.__shady_native_contains(b)};function qa(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1} | ||
function y(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(e){return a[e]};a.namedItem=function(e){if("length"!==e&&isNaN(e)&&a[e])return a[e];for(var f=ba(a),g=f.next();!g.done;g=f.next())if(g=g.value,(g.getAttribute("id")||g.getAttribute("name"))==e)return g;return null};return a}function ra(a){var b=[];for(a=a.__shady_native_firstChild;a;a=a.__shady_native_nextSibling)b.push(a);return b} | ||
function sa(a){var b=[];for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)b.push(a);return b}function ta(a,b,c){c.configurable=!0;if(c.value)a[b]=c.value;else try{Object.defineProperty(a,b,c)}catch(d){}}function z(a,b,c,d){c=void 0===c?"":c;for(var e in b)d&&0<=d.indexOf(e)||ta(a,c+e,b[e])}function ua(a,b){for(var c in b)c in a&&ta(a,c,b[c])}function A(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b} | ||
function va(a,b){for(var c=Object.getOwnPropertyNames(b),d=0,e;d<c.length;d++)e=c[d],a[e]=b[e]}function wa(a){return a instanceof Node?a:document.createTextNode(""+a)}function B(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];if(1===b.length)return wa(b[0]);c=document.createDocumentFragment();b=ba(b);for(var d=b.next();!d.done;d=b.next())c.appendChild(wa(d.value));return c};var D=[],xa;function ya(a){xa||(xa=!0,oa(E));D.push(a)}function E(){xa=!1;for(var a=!!D.length;D.length;)D.shift()();return a}E.list=D;function za(){this.g=!1;this.addedNodes=[];this.removedNodes=[];this.F=new Set}function Aa(a){a.g||(a.g=!0,oa(function(){a.flush()}))}za.prototype.flush=function(){if(this.g){this.g=!1;var a=this.takeRecords();a.length&&this.F.forEach(function(b){b(a)})}};za.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
function Ba(a,b){var c=q(a);c.v||(c.v=new za);c.v.F.add(b);var d=c.v;return{V:b,X:d,W:a,takeRecords:function(){return d.takeRecords()}}}function Ca(a){var b=a&&a.X;b&&(b.F.delete(a.V),b.F.size||(q(a.W).v=null))} | ||
function Da(a,b){var c=b.getRootNode();return a.map(function(d){var e=c===d.target.getRootNode();if(e&&d.addedNodes){if(e=[].slice.call(d.addedNodes).filter(function(f){return c===f.getRootNode()}),e.length)return d=Object.create(d),Object.defineProperty(d,"addedNodes",{value:e,configurable:!0}),d}else if(e)return d}).filter(function(d){return d})};var Ea=/[&\u00A0"]/g,Fa=/[&\u00A0<>]/g;function Ga(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function Ha(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var Ia=Ha("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),Ja=Ha("style script xmp iframe noembed noframes plaintext noscript".split(" ")); | ||
function Ka(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,g=void 0;e<f&&(g=d[e]);e++){a:{var h=g;var m=a,l=b;switch(h.nodeType){case Node.ELEMENT_NODE:m=h.localName;for(var k="<"+m,r=h.attributes,C=0,P;P=r[C];C++)k+=" "+P.name+'="'+P.value.replace(Ea,Ga)+'"';k+=">";h=Ia[m]?k:k+Ka(h,l)+"</"+m+">";break a;case Node.TEXT_NODE:h=h.data;h=m&&Ja[m.localName]?h:h.replace(Fa,Ga);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h), | ||
Error("not implemented");}}c+=h}return c};var F=u.i,La={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},Ma={};function Na(a){Ma[a]=function(b){return b["__shady_native_"+a]}}function G(a,b){z(a,b,"__shady_native_");for(var c in b)Na(c)}function H(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?La[d]||(La[d]=e.value):Na(d))}} | ||
var I=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),J=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),Oa=document.implementation.createHTMLDocument("inert");function Pa(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var Qa=["firstElementChild","lastElementChild","children","childElementCount"],Ra=["querySelector","querySelectorAll","append","prepend","replaceChildren"]; | ||
function Sa(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?(H(window.EventTarget.prototype,a),void 0===window.__shady_native_addEventListener&&H(Window.prototype,a)):(H(Node.prototype,a),H(Window.prototype,a));F?H(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):G(Node.prototype,{parentNode:{get:function(){I.currentNode=this;return I.parentNode()}},firstChild:{get:function(){I.currentNode= | ||
this;return I.firstChild()}},lastChild:{get:function(){I.currentNode=this;return I.lastChild()}},previousSibling:{get:function(){I.currentNode=this;return I.previousSibling()}},nextSibling:{get:function(){I.currentNode=this;return I.nextSibling()}},childNodes:{get:function(){var b=[];I.currentNode=this;for(var c=I.firstChild();c;)b.push(c),c=I.nextSibling();return b}},parentElement:{get:function(){J.currentNode=this;return J.parentNode()}},textContent:{get:function(){switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:for(var b= | ||
document.createTreeWalker(this,NodeFilter.SHOW_TEXT,null,!1),c="",d;d=b.nextNode();)c+=d.nodeValue;return c;default:return this.nodeValue}},set:function(b){if("undefined"===typeof b||null===b)b="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:Pa(this);(0<b.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_native_insertBefore(document.createTextNode(b),void 0);break;default:this.nodeValue=b}}}});H(Node.prototype,"appendChild insertBefore removeChild replaceChild cloneNode contains".split(" ")); | ||
H(HTMLElement.prototype,["parentElement","contains"]);a={firstElementChild:{get:function(){J.currentNode=this;return J.firstChild()}},lastElementChild:{get:function(){J.currentNode=this;return J.lastChild()}},children:{get:function(){var b=[];J.currentNode=this;for(var c=J.firstChild();c;)b.push(c),c=J.nextSibling();return y(b)}},childElementCount:{get:function(){return this.children?this.children.length:0}}};F?(H(Element.prototype,Qa),H(Element.prototype,["previousElementSibling","nextElementSibling", | ||
"innerHTML","className"]),H(HTMLElement.prototype,["children","innerHTML","className"])):(G(Element.prototype,a),G(Element.prototype,{previousElementSibling:{get:function(){J.currentNode=this;return J.previousSibling()}},nextElementSibling:{get:function(){J.currentNode=this;return J.nextSibling()}},innerHTML:{get:function(){return Ka(this,ra)},set:function(b){var c="template"===this.localName?this.content:this;Pa(c);var d=this.localName||"div";d=this.namespaceURI&&this.namespaceURI!==Oa.namespaceURI? | ||
Oa.createElementNS(this.namespaceURI,d):Oa.createElement(d);d.innerHTML=b;for(b="template"===this.localName?d.content:d;d=b.__shady_native_firstChild;)c.__shady_native_insertBefore(d,void 0)}},className:{get:function(){return this.getAttribute("class")||""},set:function(b){this.setAttribute("class",b)}}}));H(Element.prototype,"setAttribute getAttribute hasAttribute removeAttribute focus blur".split(" "));H(Element.prototype,Ra);H(HTMLElement.prototype,["focus","blur"]);window.HTMLTemplateElement&& | ||
H(window.HTMLTemplateElement.prototype,["innerHTML"]);F?H(DocumentFragment.prototype,Qa):G(DocumentFragment.prototype,a);H(DocumentFragment.prototype,Ra);F?(H(Document.prototype,Qa),H(Document.prototype,["activeElement"])):G(Document.prototype,a);H(Document.prototype,["importNode","getElementById","elementFromPoint",ha()]);H(Document.prototype,Ra)};var Ta=A({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get shadowRoot(){return this.__shady_shadowRoot}}),Ua=A({get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent= | ||
a},get innerHTML(){return this.__shady_innerHTML},set innerHTML(a){this.__shady_innerHTML=a}}),Va=A({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className},set className(a){this.__shady_className= | ||
a}});function Wa(a){for(var b in a){var c=a[b];c&&(c.enumerable=!1)}}Wa(Ta);Wa(Ua);Wa(Va);var Xa=u.i||!0===u.l,Ya=Xa?function(){}:function(a){var b=q(a);b.T||(b.T=!0,ua(a,Va))},Za=Xa?function(){}:function(a){var b=q(a);b.S||(b.S=!0,ua(a,Ta),window.customElements&&window.customElements.polyfillWrapFlushCallback&&!u.l||ua(a,Ua))};var K="__eventWrappers"+Date.now(),$a=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),ab=function(){function a(){}var b=!1,c={get capture(){b=!0;return!1}};window.addEventListener("test",a,c);window.removeEventListener("test",a,c);return b}();function bb(a){if(a&&"object"===typeof a){var b=!!a.capture;var c=!!a.once;var d=!!a.passive;var e=a.o}else b=!!a,d=c=!1;return{P:e,capture:b,once:c,passive:d,O:ab?a:b}} | ||
var cb={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0,pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0, | ||
drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},db={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0};function eb(a){return a instanceof Node?a.__shady_getRootNode():a} | ||
function L(a,b){var c=[],d=a;for(a=eb(a);d;)c.push(d),d=d.__shady_assignedSlot?d.__shady_assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d.host:d.__shady_parentNode;c[c.length-1]===document&&c.push(window);return c}function fb(a){a.__composedPath||(a.__composedPath=L(a.target,!0));return a.__composedPath}function gb(a,b){if(!w)return a;a=L(a,!0);for(var c=0,d,e=void 0,f,g=void 0;c<b.length;c++)if(d=b[c],f=eb(d),f!==e&&(g=a.indexOf(f),e=f),!w(f)||-1<g)return d} | ||
function hb(a){function b(c,d){c=new a(c,d);c.__composed=d&&!!d.composed;return c}b.__proto__=a;b.prototype=a.prototype;return b}var ib={focus:!0,blur:!0};function jb(a){return a.__target!==a.target||a.__relatedTarget!==a.relatedTarget}function kb(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!jb(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.__immediatePropagationStopped);d++);} | ||
function lb(a){var b=a.composedPath(),c=b.map(function(m){return gb(m,b)}),d=a.bubbles;Object.defineProperty(a,"currentTarget",{configurable:!0,enumerable:!0,get:function(){return g}});var e=Event.CAPTURING_PHASE;Object.defineProperty(a,"eventPhase",{configurable:!0,enumerable:!0,get:function(){return e}});for(var f=b.length-1;0<=f;f--){var g=b[f];e=g===c[f]?Event.AT_TARGET:Event.CAPTURING_PHASE;kb(a,g,"capture");if(a.H)return}for(f=0;f<b.length;f++){g=b[f];var h=g===c[f];if(h||d)if(e=h?Event.AT_TARGET: | ||
Event.BUBBLING_PHASE,kb(a,g,"bubble"),a.H)return}e=0;g=null}function mb(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],m=h.type,l=h.capture,k=h.once,r=h.passive;if(b===h.node&&c===m&&d===l&&e===k&&f===r)return g}return-1}function nb(a){E();return!u.A&&this instanceof Node&&!pa(document,this)?(a.__target||ob(a,this),lb(a)):this.__shady_native_dispatchEvent(a)} | ||
function pb(a,b,c){var d=bb(c),e=d.capture,f=d.once,g=d.passive,h=d.P;d=d.O;if(b){var m=typeof b;if("function"===m||"object"===m)if("object"!==m||b.handleEvent&&"function"===typeof b.handleEvent){if(db[a])return this.__shady_native_addEventListener(a,b,d);var l=h||this;if(h=b[K]){if(-1<mb(h,l,a,e,f,g))return}else b[K]=[];h=function(k){f&&this.__shady_removeEventListener(a,b,c);k.__target||ob(k);if(l!==this){var r=Object.getOwnPropertyDescriptor(k,"currentTarget");Object.defineProperty(k,"currentTarget", | ||
{get:function(){return l},configurable:!0});var C=Object.getOwnPropertyDescriptor(k,"eventPhase");Object.defineProperty(k,"eventPhase",{configurable:!0,enumerable:!0,get:function(){return e?Event.CAPTURING_PHASE:Event.BUBBLING_PHASE}})}k.__previousCurrentTarget=k.currentTarget;if(!w(l)&&"slot"!==l.localName||-1!=k.composedPath().indexOf(l))if(k.composed||-1<k.composedPath().indexOf(l))if(jb(k)&&k.target===k.relatedTarget)k.eventPhase===Event.BUBBLING_PHASE&&k.stopImmediatePropagation();else if(k.eventPhase=== | ||
Event.CAPTURING_PHASE||k.bubbles||k.target===l||l instanceof Window){var P="function"===m?b.call(l,k):b.handleEvent&&b.handleEvent(k);l!==this&&(r?(Object.defineProperty(k,"currentTarget",r),r=null):delete k.currentTarget,C?(Object.defineProperty(k,"eventPhase",C),C=null):delete k.eventPhase);return P}};b[K].push({node:l,type:a,capture:e,once:f,passive:g,aa:h});this.__handlers=this.__handlers||{};this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]};this.__handlers[a][e?"capture":"bubble"].push(h); | ||
ib[a]||this.__shady_native_addEventListener(a,h,d)}}} | ||
function qb(a,b,c){if(b){var d=bb(c);c=d.capture;var e=d.once,f=d.passive,g=d.P;d=d.O;if(db[a])return this.__shady_native_removeEventListener(a,b,d);var h=g||this;g=void 0;var m=null;try{m=b[K]}catch(l){}m&&(e=mb(m,h,a,c,e,f),-1<e&&(g=m.splice(e,1)[0].aa,m.length||(b[K]=void 0)));this.__shady_native_removeEventListener(a,g||b,d);g&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][c?"capture":"bubble"],b=a.indexOf(g),-1<b&&a.splice(b,1))}} | ||
function rb(){for(var a in ib)window.__shady_native_addEventListener(a,function(b){b.__target||(ob(b),lb(b))},!0)} | ||
var sb=A({get composed(){void 0===this.__composed&&($a?this.__composed="focusin"===this.type||"focusout"===this.type||$a(this):!1!==this.isTrusted&&(this.__composed=cb[this.type]));return this.__composed||!1},composedPath:function(){this.__composedPath||(this.__composedPath=L(this.__target,this.composed));return this.__composedPath},get target(){return gb(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.__relatedTarget)return null;this.__relatedTargetComposedPath|| | ||
(this.__relatedTargetComposedPath=L(this.__relatedTarget,!0));return gb(this.currentTarget||this.__previousCurrentTarget,this.__relatedTargetComposedPath)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);this.H=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.H=this.__immediatePropagationStopped=!0}}); | ||
function ob(a,b){b=void 0===b?a.target:b;a.__target=b;a.__relatedTarget=a.relatedTarget;if(u.i){b=Object.getPrototypeOf(a);if(!b.hasOwnProperty("__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;z(c,sb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else z(a,sb)}var tb=hb(Event),ub=hb(CustomEvent),vb=hb(MouseEvent); | ||
function wb(){if(!$a&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var b=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(b)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}} | ||
var xb=Object.getOwnPropertyNames(Element.prototype).filter(function(a){return"on"===a.substring(0,2)}),yb=Object.getOwnPropertyNames(HTMLElement.prototype).filter(function(a){return"on"===a.substring(0,2)});function zb(a){return{set:function(b){var c=q(this),d=a.substring(2);c.m||(c.m={});c.m[a]&&this.removeEventListener(d,c.m[a]);this.__shady_addEventListener(d,b);c.m[a]=b},get:function(){var b=t(this);return b&&b.m&&b.m[a]},configurable:!0}};function M(a,b){return{index:a,B:[],D:b}} | ||
function Ab(a,b,c,d){var e=0,f=0,g=0,h=0,m=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(g=0;g<m;g++)if(a[g]!==c[g])break a;g=m}if(b==a.length&&d==c.length){h=a.length;for(var l=c.length,k=0;k<m-g&&Bb(a[--h],c[--l]);)k++;h=k}e+=g;f+=g;b-=h;d-=h;if(0==b-e&&0==d-f)return[];if(e==b){for(b=M(e,0);f<d;)b.B.push(c[f++]);return[b]}if(f==d)return[M(e,b-e)];m=e;g=f;d=d-g+1;h=b-m+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(h),b[l][0]=l;for(l=0;l<h;l++)b[0][l]=l;for(l=1;l<d;l++)for(k=1;k<h;k++)if(a[m+k-1]===c[g+l-1])b[l][k]= | ||
b[l-1][k-1];else{var r=b[l-1][k]+1,C=b[l][k-1]+1;b[l][k]=r<C?r:C}m=b.length-1;g=b[0].length-1;d=b[m][g];for(a=[];0<m||0<g;)0==m?(a.push(2),g--):0==g?(a.push(3),m--):(h=b[m-1][g-1],l=b[m-1][g],k=b[m][g-1],r=l<k?l<h?l:h:k<h?k:h,r==h?(h==d?a.push(0):(a.push(1),d=h),m--,g--):r==l?(a.push(3),m--,d=l):(a.push(2),g--,d=k));a.reverse();b=void 0;m=[];for(g=0;g<a.length;g++)switch(a[g]){case 0:b&&(m.push(b),b=void 0);e++;f++;break;case 1:b||(b=M(e,0));b.D++;e++;b.B.push(c[f]);f++;break;case 2:b||(b=M(e,0)); | ||
b.D++;e++;break;case 3:b||(b=M(e,0)),b.B.push(c[f]),f++}b&&m.push(b);return m}function Bb(a,b){return a===b};var Cb=A({dispatchEvent:nb,addEventListener:pb,removeEventListener:qb});var Db=null;function N(){Db||(Db=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return Db||null}function Eb(a,b,c){var d=N();return d&&"class"===b?(d.setElementClass(a,c),!0):!1}function Fb(a,b){var c=N();c&&c.unscopeNode(a,b)}function Gb(a,b){var c=N();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)c=c&&Gb(a,b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b} | ||
function O(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=N();return b?b.currentScopeForNode(a):""}function Hb(a,b){if(a)for(a.nodeType===Node.ELEMENT_NODE&&b(a),a=a.__shady_firstChild;a;a=a.__shady_nextSibling)a.nodeType===Node.ELEMENT_NODE&&Hb(a,b)};var Ib=window.document,Jb=u.A,Kb=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),Lb=Kb&&Kb.get;function Mb(a){for(var b;b=a.__shady_firstChild;)a.__shady_removeChild(b)}function Nb(a){var b=t(a);if(b&&void 0!==b.G)for(b=a.__shady_firstChild;b;b=b.__shady_nextSibling)Nb(b);if(a=t(a))a.G=void 0}function Ob(a){var b=a;if(a&&"slot"===a.localName){var c=t(a);(c=c&&c.u)&&(b=c.length?c[0]:Ob(a.__shady_nextSibling))}return b} | ||
function Pb(a,b,c){if(a=(a=t(a))&&a.v){if(b)if(b.nodeType===Node.DOCUMENT_FRAGMENT_NODE)for(var d=0,e=b.childNodes.length;d<e;d++)a.addedNodes.push(b.childNodes[d]);else a.addedNodes.push(b);c&&a.removedNodes.push(c);Aa(a)}} | ||
var S=A({get parentNode(){var a=t(this);a=a&&a.parentNode;return void 0!==a?a:this.__shady_native_parentNode},get firstChild(){var a=t(this);a=a&&a.firstChild;return void 0!==a?a:this.__shady_native_firstChild},get lastChild(){var a=t(this);a=a&&a.lastChild;return void 0!==a?a:this.__shady_native_lastChild},get nextSibling(){var a=t(this);a=a&&a.nextSibling;return void 0!==a?a:this.__shady_native_nextSibling},get previousSibling(){var a=t(this);a=a&&a.previousSibling;return void 0!==a?a:this.__shady_native_previousSibling}, | ||
get childNodes(){if(v(this)){var a=t(this);if(!a.childNodes){a.childNodes=[];for(var b=this.__shady_firstChild;b;b=b.__shady_nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c=this.__shady_native_childNodes;c.item=function(d){return c[d]};return c},get parentElement(){var a=t(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:this.__shady_native_parentElement},get isConnected(){if(Lb&&Lb.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1; | ||
var a=this.ownerDocument;if(null===a||pa(a,this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(w(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(v(this)){for(var a=[],b=this.__shady_firstChild;b;b=b.__shady_nextSibling)b.nodeType!==Node.COMMENT_NODE&&a.push(b.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!v(this)&& | ||
u.i){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&Mb(this);this.__shady_native_textContent=a}else Mb(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==Ib&&a.ownerDocument!==Ib)return this.__shady_native_insertBefore(a,b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent."); | ||
if(b){var c=t(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;Pb(this,a);var d=[],e=(c=Q(this))?c.host.localName:O(this),f=a.__shady_parentNode;if(f){var g=O(a);var h=!!c||!Q(a)||Jb&&void 0!==this.__noInsertionPoint;f.__shady_removeChild(a,h)}f=!0;var m=(!Jb||void 0===a.__noInsertionPoint&&void 0=== | ||
this.__noInsertionPoint)&&!Gb(a,e),l=c&&!a.__noInsertionPoint&&(!Jb||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(l||m)m&&(g=g||O(a)),Hb(a,function(k){l&&"slot"===k.localName&&d.push(k);if(m){var r=g;N()&&(r&&Fb(k,r),(r=N())&&r.scopeNode(k,e))}});d.length&&(Qb(c),c.j.push.apply(c.j,p(d)),R(c));v(this)&&(Rb(a,this,b),h=t(this),h.root?(f=!1,ia(this)&&R(h.root)):c&&"slot"===this.localName&&(f=!1,R(c)));f?(c=w(this)?this.host:this,b?(b=Ob(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)): | ||
a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);return a},appendChild:function(a){if(this!=a||!w(a))return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==Ib)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);Pb(this,null,a);var c=Q(a),d=c&&Sb(c,a),e=t(this);if(v(this)&&(Tb(a,this),ia(this))){R(e.root);var f=!0}if(N()&&!b&&c&&a.nodeType!== | ||
Node.TEXT_NODE){var g=O(a);Hb(a,function(h){Fb(h,g)})}Nb(a);c&&((b="slot"===this.localName)&&(f=!0),(d||b)&&R(c));f||(f=w(this)?this.host:this,(!e.root&&"slot"!==a.localName||f===a.__shady_native_parentNode)&&f.__shady_native_removeChild(a));return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a);var b=this.__shady_native_cloneNode(!1);if(a&&b.nodeType!==Node.ATTRIBUTE_NODE){a= | ||
this.__shady_firstChild;for(var c;a;a=a.__shady_nextSibling)c=a.__shady_cloneNode(!0),b.__shady_appendChild(c)}return b},getRootNode:function(a){if(this&&this.nodeType){var b=q(this),c=b.G;void 0===c&&(w(this)?(c=this,b.G=c):(c=(c=this.__shady_parentNode)?c.__shady_getRootNode(a):this,document.documentElement.__shady_native_contains(this)&&(b.G=c)));return c}},contains:function(a){return qa(this,a)}});var T=A({get assignedSlot(){var a=this.__shady_parentNode;(a=a&&a.__shady_shadowRoot)&&Ub(a);return(a=t(this))&&a.assignedSlot||null}});function Vb(a,b,c){var d=[];Wb(a,b,c,d);return d}function Wb(a,b,c,d){for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling){var e;if(e=a.nodeType===Node.ELEMENT_NODE){e=a;var f=b,g=c,h=d,m=f(e);m&&h.push(e);g&&g(m)?e=m:(Wb(e,f,g,h),e=void 0)}if(e)break}} | ||
var Xb={get firstElementChild(){var a=t(this);if(a&&void 0!==a.firstChild){for(a=this.__shady_firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_firstElementChild},get lastElementChild(){var a=t(this);if(a&&void 0!==a.lastChild){for(a=this.__shady_lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_lastElementChild},get children(){return v(this)?y(Array.prototype.filter.call(sa(this),function(a){return a.nodeType=== | ||
Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){var a=this.__shady_children;return a?a.length:0}},U=A((Xb.append=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];this.__shady_insertBefore(B.apply(null,p(b)),null)},Xb.prepend=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];this.__shady_insertBefore(B.apply(null,p(b)),this.__shady_firstChild)},Xb.replaceChildren=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c]; | ||
for(;null!==(c=this.__shady_firstChild);)this.__shady_removeChild(c);this.__shady_insertBefore(B.apply(null,p(b)),null)},Xb)),Yb=A({querySelector:function(a){return Vb(this,function(b){return ka.call(b,a)},function(b){return!!b})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return y(b.filter(function(d){return d.__shady_getRootNode()==c}))}return y(Vb(this,function(d){return ka.call(d,a)}))}}), | ||
Zb=u.A&&!u.l?va({},U):U;va(U,Yb);/* | ||
@@ -61,55 +75,45 @@ Copyright (c) 2020 The Polymer Project Authors. All rights reserved. | ||
*/ | ||
var Cb=B({after:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];c=this.__shady_parentNode;if(null!==c){var d=this.__shady_nextSibling;c.__shady_insertBefore(D.apply(null,p(b)),d)}},before:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];c=this.__shady_parentNode;null!==c&&c.__shady_insertBefore(D.apply(null,p(b)),this)},remove:function(){var a=this.__shady_parentNode;null!==a&&a.__shady_removeChild(this)},replaceWith:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]= | ||
arguments[c];c=this.__shady_parentNode;if(null!==c){var d=this.__shady_nextSibling;c.__shady_removeChild(this);c.__shady_insertBefore(D.apply(null,p(b)),d)}}});var Db=null;function K(){Db||(Db=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return Db||null}function Eb(a,b,c){var d=K();return d&&"class"===b?(d.setElementClass(a,c),!0):!1}function sb(a,b){var c=K();c&&c.unscopeNode(a,b)}function qb(a,b){var c=K();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)c=c&&qb(a,b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b} | ||
function J(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=K();return b?b.currentScopeForNode(a):""}function rb(a,b){if(a)for(a.nodeType===Node.ELEMENT_NODE&&b(a),a=a.__shady_firstChild;a;a=a.__shady_nextSibling)a.nodeType===Node.ELEMENT_NODE&&rb(a,b)};var Fb=window.document;function Gb(a,b){if("slot"===b)a=a.__shady_parentNode,ia(a)&&L(u(a).root);else if("slot"===a.localName&&"name"===b&&(b=I(a))){if(b.a){Hb(b);var c=a.O,d=Ib(a);if(d!==c){c=b.b[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.b[d]||(b.b[d]=[]);c.push(a);1<c.length&&(b.b[d]=Jb(c))}}L(b)}} | ||
var Kb=B({get previousElementSibling(){var a=u(this);if(a&&void 0!==a.previousSibling){for(a=this.__shady_previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_previousElementSibling},get nextElementSibling(){var a=u(this);if(a&&void 0!==a.nextSibling){for(a=this.__shady_nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_nextElementSibling},get slot(){return this.getAttribute("slot")}, | ||
set slot(a){this.__shady_setAttribute("slot",a)},get className(){return this.getAttribute("class")||""},set className(a){this.__shady_setAttribute("class",a)},setAttribute:function(a,b){this.ownerDocument!==Fb?this.__shady_native_setAttribute(a,b):Eb(this,a,b)||(this.__shady_native_setAttribute(a,b),Gb(this,a))},removeAttribute:function(a){this.ownerDocument!==Fb?this.__shady_native_removeAttribute(a):Eb(this,a,"")?""===this.getAttribute(a)&&this.__shady_native_removeAttribute(a):(this.__shady_native_removeAttribute(a), | ||
Gb(this,a))}});v.o||db.forEach(function(a){Kb[a]=fb(a)}); | ||
var Pb=B({attachShadow:function(a){if(!this)throw Error("Must provide a host.");if(!a)throw Error("Not enough arguments.");if(a.shadyUpgradeFragment&&!v.L){var b=a.shadyUpgradeFragment;b.__proto__=ShadowRoot.prototype;Lb(b,this,a);Mb(b,b);a=b.__noInsertionPoint?null:b.querySelectorAll("slot");b.__noInsertionPoint=void 0;if(a&&a.length){var c=b;tb(c);c.f.push.apply(c.f,p(a));L(b)}b.host.__shady_native_appendChild(b)}else b=new Nb(Ob,this,a);return this.__CE_shadowRoot=b},get shadowRoot(){var a=u(this); | ||
return a&&a.U||null}});va(Kb,Pb);var Qb=/[&\u00A0"]/g,Rb=/[&\u00A0<>]/g;function Sb(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function Tb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var Ub=Tb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),Vb=Tb("style script xmp iframe noembed noframes plaintext noscript".split(" ")); | ||
function Wb(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,g=void 0;e<f&&(g=d[e]);e++){a:{var h=g;var m=a,l=b;switch(h.nodeType){case Node.ELEMENT_NODE:m=h.localName;for(var k="<"+m,r=h.attributes,C=0,R;R=r[C];C++)k+=" "+R.name+'="'+R.value.replace(Qb,Sb)+'"';k+=">";h=Ub[m]?k:k+Wb(h,l)+"</"+m+">";break a;case Node.TEXT_NODE:h=h.data;h=m&&Vb[m.localName]?h:h.replace(Rb,Sb);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h), | ||
Error("not implemented");}}c+=h}return c};var Xb=document.implementation.createHTMLDocument("inert"),Yb=B({get innerHTML(){return w(this)?Wb("template"===this.localName?this.content:this,sa):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{lb(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==Xb.namespaceURI?Xb.createElementNS(this.namespaceURI,b):Xb.createElement(b);for(v.c?b.__shady_native_innerHTML=a:b.innerHTML=a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var Zb=B({blur:function(){var a=u(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});v.o||eb.forEach(function(a){Zb[a]=fb(a)});var $b=B({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&x(b)&&N(b);return(b=u(this))?(a&&a.flatten?b.l:b.assignedNodes)||[]:[]}},addEventListener:function(a,b,c){if("slot"!==this.localName||"slotchange"===a)Wa.call(this,a,b,c);else{"object"!==typeof c&&(c={capture:!!c});var d=this.__shady_parentNode;if(!d)throw Error("ShadyDOM cannot attach event to slot unless it has a `parentNode`");c.i=this;d.__shady_addEventListener(a,b,c)}},removeEventListener:function(a, | ||
b,c){if("slot"!==this.localName||"slotchange"===a)Xa.call(this,a,b,c);else{"object"!==typeof c&&(c={capture:!!c});var d=this.__shady_parentNode;if(!d)throw Error("ShadyDOM cannot attach event to slot unless it has a `parentNode`");c.i=this;d.__shady_removeEventListener(a,b,c)}}});var ac=B({getElementById:function(a){return""===a?null:xb(this,function(b){return b.id==a},function(b){return!!b})[0]||null}});var bc=B({get activeElement(){var a=v.c?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!x(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=I(a);b&&b!==this;)a=b.host,b=I(a);return this===document?b?null:a:b===this?a:null}});var cc=window.document,dc=B({importNode:function(a,b){if(a.ownerDocument!==cc||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b)for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)b=this.__shady_importNode(a,!0),c.__shady_appendChild(b);return c}});var ec=B({dispatchEvent:Ua,addEventListener:Wa.bind(window),removeEventListener:Xa.bind(window)});var Q={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(Q.parentElement=M.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(Q.contains=M.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(Q.children=P.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(Q.innerHTML=Yb.innerHTML);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"className")&&(Q.className=Kb.className); | ||
var S={EventTarget:[gb],Node:[M,window.EventTarget?null:gb],Text:[O],Comment:[O],CDATASection:[O],ProcessingInstruction:[O],Element:[Kb,P,Cb,O,!v.c||"innerHTML"in Element.prototype?Yb:null,window.HTMLSlotElement?null:$b],HTMLElement:[Zb,Q],HTMLSlotElement:[$b],DocumentFragment:[Bb,ac],Document:[dc,Bb,ac,bc],Window:[ec],CharacterData:[Cb]},fc=v.c?null:["innerHTML","textContent"];function T(a,b,c,d){b.forEach(function(e){return a&&e&&A(a,e,c,d)})} | ||
function gc(a){var b=a?null:fc,c;for(c in S)T(window[c]&&window[c].prototype,S[c],a,b)}["Text","Comment","CDATASection","ProcessingInstruction"].forEach(function(a){var b=window[a],c=Object.create(b.prototype);c.__shady_protoIsPatched=!0;T(c,S.EventTarget);T(c,S.Node);S[a]&&T(c,S[a]);b.prototype.__shady_patchedProto=c});function hc(a){a.__shady_protoIsPatched=!0;T(a,S.EventTarget);T(a,S.Node);T(a,S.Element);T(a,S.HTMLElement);T(a,S.HTMLSlotElement);return a};var ic=v.G,jc=v.c;function kc(a,b){if(ic&&!a.__shady_protoIsPatched&&!x(a)){var c=Object.getPrototypeOf(a),d=c.hasOwnProperty("__shady_patchedProto")&&c.__shady_patchedProto;d||(d=Object.create(c),hc(d),c.__shady_patchedProto=d);Object.setPrototypeOf(a,d)}jc||(1===b?Ea(a):2===b&&Fa(a))} | ||
function lc(a,b,c,d){kc(a,1);d=d||null;var e=t(a),f=d?t(d):null;e.previousSibling=d?f.previousSibling:b.__shady_lastChild;if(f=u(e.previousSibling))f.nextSibling=a;if(f=u(e.nextSibling=d))f.previousSibling=a;e.parentNode=b;d?d===c.firstChild&&(c.firstChild=a):(c.lastChild=a,c.firstChild||(c.firstChild=a));c.childNodes=null} | ||
function ub(a,b,c){kc(b,2);var d=t(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE)for(a=a.__shady_native_firstChild;a;a=a.__shady_native_nextSibling)lc(a,b,d,c);else lc(a,b,d,c)} | ||
function wb(a,b){var c=t(a);b=t(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(t(a).nextSibling=d);d&&(t(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)} | ||
function Mb(a,b){var c=t(a);if(b||void 0===c.firstChild){c.childNodes=null;var d=c.firstChild=a.__shady_native_firstChild;c.lastChild=a.__shady_native_lastChild;kc(a,2);c=d;for(d=void 0;c;c=c.__shady_native_nextSibling){var e=t(c);e.parentNode=b||a;e.nextSibling=c.__shady_native_nextSibling;e.previousSibling=d||null;d=c;kc(c,1)}}};var mc=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.i=c.i||this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.i=c.i||this;this.host.__shady_removeEventListener(a,b,c)}});function nc(a,b){A(a,mc,b);A(a,bc,b);A(a,Yb,b);A(a,P,b);v.g&&!b?(A(a,M,b),A(a,ac,b)):v.c||(A(a,Ba),A(a,za),A(a,Aa))};var Ob={},U=v.deferConnectionCallbacks&&"loading"===document.readyState,oc;function pc(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b}function Nb(a,b,c){if(a!==Ob)throw new TypeError("Illegal constructor");this.a=null;Lb(this,b,c)} | ||
function Lb(a,b,c){a.host=b;a.mode=c&&c.mode;Mb(a.host);b=t(a.host);b.root=a;b.U="closed"!==a.mode?a:null;b=t(a);b.firstChild=b.lastChild=b.parentNode=b.nextSibling=b.previousSibling=null;if(v.preferPerformance)for(;b=a.host.__shady_native_firstChild;)a.host.__shady_native_removeChild(b);else L(a)}function L(a){a.j||(a.j=!0,ya(function(){return N(a)}))} | ||
function N(a){var b;if(b=a.j){for(var c;a;)a:{a.j&&(c=a),b=a;a=b.host.__shady_getRootNode();if(x(a)&&(b=u(b.host))&&0<b.u)break a;a=void 0}b=c}(c=b)&&c._renderSelf()} | ||
Nb.prototype._renderSelf=function(){var a=U;U=!0;this.j=!1;if(this.a){Hb(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=u(c),e=d.assignedNodes;d.assignedNodes=[];d.l=[];if(d.I=e)for(d=0;d<e.length;d++){var f=u(e[d]);f.C=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)qc(this,b);for(b=0;b<this.a.length;b++){c=this.a[b];e=u(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)qc(this,d,c); | ||
(d=(d=u(c.__shady_parentNode))&&d.root)&&(ja(d)||d.j)&&d._renderSelf();rc(this,e.l,e.assignedNodes);if(d=e.I){for(f=0;f<d.length;f++)u(d[f]).C=null;e.I=null;d.length>e.assignedNodes.length&&(e.D=!0)}e.D&&(e.D=!1,sc(this,c))}c=this.a;b=[];for(e=0;e<c.length;e++)d=c[e].__shady_parentNode,(f=u(d))&&f.root||!(0>b.indexOf(d))||b.push(d);for(c=0;c<b.length;c++){f=b[c];e=f===this?this.host:f;d=[];for(f=f.__shady_firstChild;f;f=f.__shady_nextSibling)if("slot"==f.localName)for(var g=u(f).l,h=0;h<g.length;h++)d.push(g[h]); | ||
else d.push(f);f=ra(e);g=da(d,d.length,f,f.length);for(var m=h=0,l=void 0;h<g.length&&(l=g[h]);h++){for(var k=0,r=void 0;k<l.s.length&&(r=l.s[k]);k++)r.__shady_native_parentNode===e&&e.__shady_native_removeChild(r),f.splice(l.index+m,1);m-=l.v}m=0;for(l=void 0;m<g.length&&(l=g[m]);m++)for(h=f[l.index],k=l.index;k<l.index+l.v;k++)r=d[k],e.__shady_native_insertBefore(r,h),f.splice(k,0,r)}}if(!v.preferPerformance&&!this.H)for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)c=u(b),b.__shady_native_parentNode!== | ||
this.host||"slot"!==b.localName&&c.assignedSlot||this.host.__shady_native_removeChild(b);this.H=!0;U=a;oc&&oc()};function qc(a,b,c){var d=t(b),e=d.C;d.C=null;c||(c=(a=a.b[b.__shady_slot||"__catchall"])&&a[0]);c?(t(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(t(d.assignedSlot).D=!0)}function rc(a,b,c){for(var d=0,e=void 0;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=u(e).assignedNodes;f&&f.length&&rc(a,b,f)}else b.push(c[d])} | ||
function sc(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=u(b);b.assignedSlot&&sc(a,b.assignedSlot)}function tb(a){a.f=a.f||[];a.a=a.a||[];a.b=a.b||{}}function Hb(a){if(a.f&&a.f.length){for(var b=a.f,c,d=0;d<b.length;d++){var e=b[d];Mb(e);var f=e.__shady_parentNode;Mb(f);f=u(f);f.u=(f.u||0)+1;f=Ib(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var g in c)a.b[g]=Jb(a.b[g]);a.f=[]}} | ||
function Ib(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.O=b}function Jb(a){return a.sort(function(b,c){b=pc(b);for(var d=pc(c),e=0;e<b.length;e++){c=b[e];var f=d[e];if(c!==f)return b=sa(c.__shady_parentNode),b.indexOf(c)-b.indexOf(f)}})} | ||
function vb(a,b){if(a.a){Hb(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var g=e[f];if(qa(b,g)){e.splice(f,1);var h=a.a.indexOf(g);0<=h&&(a.a.splice(h,1),(h=u(g.__shady_parentNode))&&h.u&&h.u--);f--;g=u(g);if(h=g.l)for(var m=0;m<h.length;m++){var l=h[m],k=l.__shady_native_parentNode;k&&k.__shady_native_removeChild(l)}g.l=[];g.assignedNodes=[];h=!0}}return h}}function ja(a){Hb(a);return!(!a.a||!a.a.length)} | ||
(function(a){a.__proto__=DocumentFragment.prototype;nc(a,"__shady_");nc(a);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]}, | ||
configurable:!0})})})(Nb.prototype); | ||
if(window.customElements&&window.customElements.define&&v.F&&!v.preferPerformance){var tc=new Map;oc=function(){var a=[];tc.forEach(function(d,e){a.push([e,d])});tc.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.__shadydom_connectedCallback():c.__shadydom_disconnectedCallback()}};U&&document.addEventListener("readystatechange",function(){U=!1;oc()},{once:!0});var uc=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.__shadydom_connectedCallback= | ||
function(){U?tc.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=a.prototype.__shadydom_disconnectedCallback=function(){U?this.isConnected||tc.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},vc=window.customElements.define,wc=function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;vc.call(window.customElements,a,uc(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d};window.customElements.define= | ||
wc;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:wc,configurable:!0})}function I(a){a=a.__shady_getRootNode();if(x(a))return a};function xc(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.w=new Set}function pb(a){a.a||(a.a=!0,oa(function(){a.flush()}))}xc.prototype.flush=function(){if(this.a){this.a=!1;var a=this.takeRecords();a.length&&this.w.forEach(function(b){b(a)})}};xc.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
function yc(a,b){var c=t(a);c.m||(c.m=new xc);c.m.w.add(b);var d=c.m;return{P:b,S:d,R:a,takeRecords:function(){return d.takeRecords()}}}function zc(a){var b=a&&a.S;b&&(b.w.delete(a.P),b.w.size||(t(a.R).m=null))} | ||
function Ac(a,b){var c=b.getRootNode();return a.map(function(d){var e=c===d.target.getRootNode();if(e&&d.addedNodes){if(e=[].slice.call(d.addedNodes).filter(function(f){return c===f.getRootNode()}),e.length)return d=Object.create(d),Object.defineProperty(d,"addedNodes",{value:e,configurable:!0}),d}else if(e)return d}).filter(function(d){return d})};var Bc=v.c,Cc={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},Dc={};function Ec(a){Dc[a]=function(b){return b["__shady_native_"+a]}}function V(a,b){A(a,b,"__shady_native_");for(var c in b)Ec(c)}function W(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?Cc[d]||(Cc[d]=e.value):Ec(d))}} | ||
var X=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),Y=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),Fc=document.implementation.createHTMLDocument("inert");function Gc(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var Hc=["firstElementChild","lastElementChild","children","childElementCount"],Ic=["querySelector","querySelectorAll","append","prepend","replaceChildren"]; | ||
function Jc(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?W(window.EventTarget.prototype,a):(W(Node.prototype,a),W(Window.prototype,a));Bc?W(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):V(Node.prototype,{parentNode:{get:function(){X.currentNode=this;return X.parentNode()}},firstChild:{get:function(){X.currentNode=this;return X.firstChild()}},lastChild:{get:function(){X.currentNode= | ||
this;return X.lastChild()}},previousSibling:{get:function(){X.currentNode=this;return X.previousSibling()}},nextSibling:{get:function(){X.currentNode=this;return X.nextSibling()}},childNodes:{get:function(){var b=[];X.currentNode=this;for(var c=X.firstChild();c;)b.push(c),c=X.nextSibling();return b}},parentElement:{get:function(){Y.currentNode=this;return Y.parentNode()}},textContent:{get:function(){switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:for(var b=document.createTreeWalker(this, | ||
NodeFilter.SHOW_TEXT,null,!1),c="",d;d=b.nextNode();)c+=d.nodeValue;return c;default:return this.nodeValue}},set:function(b){if("undefined"===typeof b||null===b)b="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:Gc(this);(0<b.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_native_insertBefore(document.createTextNode(b),void 0);break;default:this.nodeValue=b}}}});W(Node.prototype,"appendChild insertBefore removeChild replaceChild cloneNode contains".split(" ")); | ||
W(HTMLElement.prototype,["parentElement","contains"]);a={firstElementChild:{get:function(){Y.currentNode=this;return Y.firstChild()}},lastElementChild:{get:function(){Y.currentNode=this;return Y.lastChild()}},children:{get:function(){var b=[];Y.currentNode=this;for(var c=Y.firstChild();c;)b.push(c),c=Y.nextSibling();return z(b)}},childElementCount:{get:function(){return this.children?this.children.length:0}}};Bc?(W(Element.prototype,Hc),W(Element.prototype,["previousElementSibling","nextElementSibling", | ||
"innerHTML","className"]),W(HTMLElement.prototype,["children","innerHTML","className"])):(V(Element.prototype,a),V(Element.prototype,{previousElementSibling:{get:function(){Y.currentNode=this;return Y.previousSibling()}},nextElementSibling:{get:function(){Y.currentNode=this;return Y.nextSibling()}},innerHTML:{get:function(){return Wb(this,ra)},set:function(b){var c="template"===this.localName?this.content:this;Gc(c);var d=this.localName||"div";d=this.namespaceURI&&this.namespaceURI!==Fc.namespaceURI? | ||
Fc.createElementNS(this.namespaceURI,d):Fc.createElement(d);d.innerHTML=b;for(b="template"===this.localName?d.content:d;d=b.__shady_native_firstChild;)c.__shady_native_insertBefore(d,void 0)}},className:{get:function(){return this.getAttribute("class")||""},set:function(b){this.setAttribute("class",b)}}}));W(Element.prototype,"setAttribute getAttribute hasAttribute removeAttribute focus blur".split(" "));W(Element.prototype,Ic);W(HTMLElement.prototype,["focus","blur"]);window.HTMLTemplateElement&& | ||
W(window.HTMLTemplateElement.prototype,["innerHTML"]);Bc?W(DocumentFragment.prototype,Hc):V(DocumentFragment.prototype,a);W(DocumentFragment.prototype,Ic);Bc?(W(Document.prototype,Hc),W(Document.prototype,["activeElement"])):V(Document.prototype,a);W(Document.prototype,["importNode","getElementById"]);W(Document.prototype,Ic)};function Z(a){this.node=a}n=Z.prototype;n.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};n.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};n.appendChild=function(a){return this.node.__shady_appendChild(a)};n.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};n.removeChild=function(a){return this.node.__shady_removeChild(a)};n.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)}; | ||
var $b=A({after:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];c=this.__shady_parentNode;if(null!==c){var d=this.__shady_nextSibling;c.__shady_insertBefore(B.apply(null,p(b)),d)}},before:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];c=this.__shady_parentNode;null!==c&&c.__shady_insertBefore(B.apply(null,p(b)),this)},remove:function(){var a=this.__shady_parentNode;null!==a&&a.__shady_removeChild(this)},replaceWith:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]= | ||
arguments[c];c=this.__shady_parentNode;if(null!==c){var d=this.__shady_nextSibling;c.__shady_removeChild(this);c.__shady_insertBefore(B.apply(null,p(b)),d)}}});var ac=window.document;function bc(a,b){if("slot"===b)a=a.__shady_parentNode,ia(a)&&R(t(a).root);else if("slot"===a.localName&&"name"===b&&(b=Q(a))){if(b.g){cc(b);var c=a.U,d=dc(a);if(d!==c){c=b.h[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.h[d]||(b.h[d]=[]);c.push(a);1<c.length&&(b.h[d]=ec(c))}}R(b)}} | ||
var fc=A({get previousElementSibling(){var a=t(this);if(a&&void 0!==a.previousSibling){for(a=this.__shady_previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_previousElementSibling},get nextElementSibling(){var a=t(this);if(a&&void 0!==a.nextSibling){for(a=this.__shady_nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_nextElementSibling},get slot(){return this.getAttribute("slot")}, | ||
set slot(a){this.__shady_setAttribute("slot",a)},get className(){return this.getAttribute("class")||""},set className(a){this.__shady_setAttribute("class",a)},setAttribute:function(a,b){this.ownerDocument!==ac?this.__shady_native_setAttribute(a,b):Eb(this,a,b)||(this.__shady_native_setAttribute(a,b),bc(this,a))},removeAttribute:function(a){this.ownerDocument!==ac?this.__shady_native_removeAttribute(a):Eb(this,a,"")?""===this.getAttribute(a)&&this.__shady_native_removeAttribute(a):(this.__shady_native_removeAttribute(a), | ||
bc(this,a))}});u.A||xb.forEach(function(a){fc[a]=zb(a)}); | ||
var kc=A({attachShadow:function(a){if(!this)throw Error("Must provide a host.");if(!a)throw Error("Not enough arguments.");if(a.shadyUpgradeFragment&&!u.R){var b=a.shadyUpgradeFragment;b.__proto__=ShadowRoot.prototype;gc(b,this,a);hc(b,b);a=b.__noInsertionPoint?null:b.querySelectorAll("slot");b.__noInsertionPoint=void 0;if(a&&a.length){var c=b;Qb(c);c.j.push.apply(c.j,p(a));R(b)}b.host.__shady_native_appendChild(b)}else b=new ic(jc,this,a);return this.__CE_shadowRoot=b},get shadowRoot(){var a=t(this); | ||
return a&&a.Z||null}});va(fc,kc);var lc=document.implementation.createHTMLDocument("inert"),mc=A({get innerHTML(){return v(this)?Ka("template"===this.localName?this.content:this,sa):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{Mb(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==lc.namespaceURI?lc.createElementNS(this.namespaceURI,b):lc.createElement(b);for(u.i?b.__shady_native_innerHTML=a:b.innerHTML=a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var nc=A({blur:function(){var a=t(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});u.A||yb.forEach(function(a){nc[a]=zb(a)});var oc=A({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&w(b)&&Ub(b);return(b=t(this))?(a&&a.flatten?b.u:b.assignedNodes)||[]:[]}},addEventListener:function(a,b,c){if("slot"!==this.localName||"slotchange"===a)pb.call(this,a,b,c);else{"object"!==typeof c&&(c={capture:!!c});var d=this.__shady_parentNode;if(!d)throw Error("ShadyDOM cannot attach event to slot unless it has a `parentNode`");c.o=this;d.__shady_addEventListener(a,b,c)}},removeEventListener:function(a, | ||
b,c){if("slot"!==this.localName||"slotchange"===a)qb.call(this,a,b,c);else{"object"!==typeof c&&(c={capture:!!c});var d=this.__shady_parentNode;if(!d)throw Error("ShadyDOM cannot attach event to slot unless it has a `parentNode`");c.o=this;d.__shady_removeEventListener(a,b,c)}}});var pc=A({getElementById:function(a){return""===a?null:Vb(this,function(b){return b.id==a},function(b){return!!b})[0]||null}});function qc(a,b){for(var c;b&&!a.has(c=b.__shady_getRootNode());)b=c.host;return b}function rc(a){var b=new Set;for(b.add(a);w(a)&&a.host;)a=a.host.__shady_getRootNode(),b.add(a);return b} | ||
var sc="__shady_native_"+ha(),tc=A({get activeElement(){var a=u.i?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!w(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=Q(a);b&&b!==this;)a=b.host,b=Q(a);return this===document?b?null:a:b===this?a:null},elementsFromPoint:function(a,b){a=[].slice.call(document[sc](a,b));b=rc(this);for(var c=new Set,d=0;d<a.length;d++)c.add(qc(b,a[d]));var e=[];c.forEach(function(f){return e.push(f)}); | ||
return e},elementFromPoint:function(a,b){return this.__shady_elementsFromPoint(a,b)[0]||null}});var uc=window.document,vc=A({importNode:function(a,b){if(a.ownerDocument!==uc||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b)for(a=a.__shady_firstChild;a;a=a.__shady_nextSibling)b=this.__shady_importNode(a,!0),c.__shady_appendChild(b);return c}});var wc=A({dispatchEvent:nb,addEventListener:pb.bind(window),removeEventListener:qb.bind(window)});var V={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(V.parentElement=S.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(V.contains=S.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(V.children=U.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(V.innerHTML=mc.innerHTML);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"className")&&(V.className=fc.className); | ||
var W={EventTarget:[Cb],Node:[S,window.EventTarget?null:Cb],Text:[T],Comment:[T],CDATASection:[T],ProcessingInstruction:[T],Element:[fc,U,$b,T,!u.i||"innerHTML"in Element.prototype?mc:null,window.HTMLSlotElement?null:oc],HTMLElement:[nc,V],HTMLSlotElement:[oc],DocumentFragment:[Zb,pc],Document:[vc,Zb,pc,tc],Window:[wc],CharacterData:[$b]},xc=u.i?null:["innerHTML","textContent"];function X(a,b,c,d){b.forEach(function(e){return a&&e&&z(a,e,c,d)})} | ||
function yc(a){var b=a?null:xc,c;for(c in W)X(window[c]&&window[c].prototype,W[c],a,b)}["Text","Comment","CDATASection","ProcessingInstruction"].forEach(function(a){var b=window[a],c=Object.create(b.prototype);c.__shady_protoIsPatched=!0;X(c,W.EventTarget);X(c,W.Node);W[a]&&X(c,W[a]);b.prototype.__shady_patchedProto=c});function zc(a){a.__shady_protoIsPatched=!0;X(a,W.EventTarget);X(a,W.Node);X(a,W.Element);X(a,W.HTMLElement);X(a,W.HTMLSlotElement);return a};var Ac=u.L,Bc=u.i;function Cc(a,b){if(Ac&&!a.__shady_protoIsPatched&&!w(a)){var c=Object.getPrototypeOf(a),d=c.hasOwnProperty("__shady_patchedProto")&&c.__shady_patchedProto;d||(d=Object.create(c),zc(d),c.__shady_patchedProto=d);Object.setPrototypeOf(a,d)}Bc||(1===b?Ya(a):2===b&&Za(a))} | ||
function Dc(a,b,c,d){Cc(a,1);d=d||null;var e=q(a),f=d?q(d):null;e.previousSibling=d?f.previousSibling:b.__shady_lastChild;if(f=t(e.previousSibling))f.nextSibling=a;if(f=t(e.nextSibling=d))f.previousSibling=a;e.parentNode=b;d?d===c.firstChild&&(c.firstChild=a):(c.lastChild=a,c.firstChild||(c.firstChild=a));c.childNodes=null} | ||
function Rb(a,b,c){Cc(b,2);var d=q(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE)for(a=a.__shady_native_firstChild;a;a=a.__shady_native_nextSibling)Dc(a,b,d,c);else Dc(a,b,d,c)} | ||
function Tb(a,b){var c=q(a);b=q(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(q(a).nextSibling=d);d&&(q(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)} | ||
function hc(a,b){var c=q(a);if(b||void 0===c.firstChild){c.childNodes=null;var d=c.firstChild=a.__shady_native_firstChild;c.lastChild=a.__shady_native_lastChild;Cc(a,2);c=d;for(d=void 0;c;c=c.__shady_native_nextSibling){var e=q(c);e.parentNode=b||a;e.nextSibling=c.__shady_native_nextSibling;e.previousSibling=d||null;d=c;Cc(c,1)}}};var Ec=A({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.o=c.o||this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.o=c.o||this;this.host.__shady_removeEventListener(a,b,c)}});function Fc(a,b){z(a,Ec,b);z(a,tc,b);z(a,mc,b);z(a,U,b);u.l&&!b?(z(a,S,b),z(a,pc,b)):u.i||(z(a,Va),z(a,Ta),z(a,Ua))};var jc={},Y=u.deferConnectionCallbacks&&"loading"===document.readyState,Gc;function Hc(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b}function ic(a,b,c){if(a!==jc)throw new TypeError("Illegal constructor");this.g=null;gc(this,b,c)} | ||
function gc(a,b,c){a.host=b;a.mode=c&&c.mode;hc(a.host);b=q(a.host);b.root=a;b.Z="closed"!==a.mode?a:null;b=q(a);b.firstChild=b.lastChild=b.parentNode=b.nextSibling=b.previousSibling=null;if(u.preferPerformance)for(;b=a.host.__shady_native_firstChild;)a.host.__shady_native_removeChild(b);else R(a)}function R(a){a.s||(a.s=!0,ya(function(){return Ub(a)}))} | ||
function Ub(a){var b;if(b=a.s){for(var c;a;)a:{a.s&&(c=a),b=a;a=b.host.__shady_getRootNode();if(w(a)&&(b=t(b.host))&&0<b.C)break a;a=void 0}b=c}(c=b)&&c._renderSelf()} | ||
ic.prototype._renderSelf=function(){var a=Y;Y=!0;this.s=!1;if(this.g){cc(this);for(var b=0,c;b<this.g.length;b++){c=this.g[b];var d=t(c),e=d.assignedNodes;d.assignedNodes=[];d.u=[];if(d.N=e)for(d=0;d<e.length;d++){var f=t(e[d]);f.I=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)Ic(this,b);for(b=0;b<this.g.length;b++){c=this.g[b];e=t(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)Ic(this,d,c); | ||
(d=(d=t(c.__shady_parentNode))&&d.root)&&(ja(d)||d.s)&&d._renderSelf();Jc(this,e.u,e.assignedNodes);if(d=e.N){for(f=0;f<d.length;f++)t(d[f]).I=null;e.N=null;d.length>e.assignedNodes.length&&(e.J=!0)}e.J&&(e.J=!1,Kc(this,c))}c=this.g;b=[];for(e=0;e<c.length;e++)d=c[e].__shady_parentNode,(f=t(d))&&f.root||!(0>b.indexOf(d))||b.push(d);for(c=0;c<b.length;c++){f=b[c];e=f===this?this.host:f;d=[];for(f=f.__shady_firstChild;f;f=f.__shady_nextSibling)if("slot"==f.localName)for(var g=t(f).u,h=0;h<g.length;h++)d.push(g[h]); | ||
else d.push(f);f=ra(e);g=Ab(d,d.length,f,f.length);for(var m=h=0,l=void 0;h<g.length&&(l=g[h]);h++){for(var k=0,r=void 0;k<l.B.length&&(r=l.B[k]);k++)r.__shady_native_parentNode===e&&e.__shady_native_removeChild(r),f.splice(l.index+m,1);m-=l.D}m=0;for(l=void 0;m<g.length&&(l=g[m]);m++)for(h=f[l.index],k=l.index;k<l.index+l.D;k++)r=d[k],e.__shady_native_insertBefore(r,h),f.splice(k,0,r)}}if(!u.preferPerformance&&!this.M)for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)c=t(b),b.__shady_native_parentNode!== | ||
this.host||"slot"!==b.localName&&c.assignedSlot||this.host.__shady_native_removeChild(b);this.M=!0;Y=a;Gc&&Gc()};function Ic(a,b,c){var d=q(b),e=d.I;d.I=null;c||(c=(a=a.h[b.__shady_slot||"__catchall"])&&a[0]);c?(q(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(q(d.assignedSlot).J=!0)}function Jc(a,b,c){for(var d=0,e=void 0;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=t(e).assignedNodes;f&&f.length&&Jc(a,b,f)}else b.push(c[d])} | ||
function Kc(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=t(b);b.assignedSlot&&Kc(a,b.assignedSlot)}function Qb(a){a.j=a.j||[];a.g=a.g||[];a.h=a.h||{}}function cc(a){if(a.j&&a.j.length){for(var b=a.j,c,d=0;d<b.length;d++){var e=b[d];hc(e);var f=e.__shady_parentNode;hc(f);f=t(f);f.C=(f.C||0)+1;f=dc(e);a.h[f]?(c=c||{},c[f]=!0,a.h[f].push(e)):a.h[f]=[e];a.g.push(e)}if(c)for(var g in c)a.h[g]=ec(a.h[g]);a.j=[]}} | ||
function dc(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.U=b}function ec(a){return a.sort(function(b,c){b=Hc(b);for(var d=Hc(c),e=0;e<b.length;e++){c=b[e];var f=d[e];if(c!==f)return b=sa(c.__shady_parentNode),b.indexOf(c)-b.indexOf(f)}})} | ||
function Sb(a,b){if(a.g){cc(a);var c=a.h,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var g=e[f];if(qa(b,g)){e.splice(f,1);var h=a.g.indexOf(g);0<=h&&(a.g.splice(h,1),(h=t(g.__shady_parentNode))&&h.C&&h.C--);f--;g=t(g);if(h=g.u)for(var m=0;m<h.length;m++){var l=h[m],k=l.__shady_native_parentNode;k&&k.__shady_native_removeChild(l)}g.u=[];g.assignedNodes=[];h=!0}}return h}}function ja(a){cc(a);return!(!a.g||!a.g.length)} | ||
(function(a){a.__proto__=DocumentFragment.prototype;Fc(a,"__shady_");Fc(a);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]}, | ||
configurable:!0})})})(ic.prototype); | ||
if(window.customElements&&window.customElements.define&&u.K&&!u.preferPerformance){var Lc=new Map;Gc=function(){var a=[];Lc.forEach(function(d,e){a.push([e,d])});Lc.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.__shadydom_connectedCallback():c.__shadydom_disconnectedCallback()}};Y&&document.addEventListener("readystatechange",function(){Y=!1;Gc()},{once:!0});var Mc=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.__shadydom_connectedCallback= | ||
function(){Y?Lc.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=a.prototype.__shadydom_disconnectedCallback=function(){Y?this.isConnected||Lc.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},Nc=window.customElements.define,Oc=function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;Nc.call(window.customElements,a,Mc(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d};window.customElements.define= | ||
Oc;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:Oc,configurable:!0})}function Q(a){a=a.__shady_getRootNode();if(w(a))return a};function Z(a){this.node=a}n=Z.prototype;n.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};n.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};n.appendChild=function(a){return this.node.__shady_appendChild(a)};n.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};n.removeChild=function(a){return this.node.__shady_removeChild(a)};n.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)}; | ||
n.cloneNode=function(a){return this.node.__shady_cloneNode(a)};n.getRootNode=function(a){return this.node.__shady_getRootNode(a)};n.contains=function(a){return this.node.__shady_contains(a)};n.dispatchEvent=function(a){return this.node.__shady_dispatchEvent(a)};n.setAttribute=function(a,b){this.node.__shady_setAttribute(a,b)};n.getAttribute=function(a){return this.node.__shady_native_getAttribute(a)};n.removeAttribute=function(a){this.node.__shady_removeAttribute(a)};n.attachShadow=function(a){return this.node.__shady_attachShadow(a)}; | ||
n.focus=function(){this.node.__shady_native_focus()};n.blur=function(){this.node.__shady_blur()};n.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};n.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};n.querySelector=function(a){return this.node.__shady_querySelector(a)};n.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)}; | ||
n.assignedNodes=function(a){if("slot"===this.node.localName)return this.node.__shady_assignedNodes(a)};n.append=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_append.apply(this.node,p(b))};n.prepend=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_prepend.apply(this.node,p(b))};n.after=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_after.apply(this.node,p(b))}; | ||
n.before=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_before.apply(this.node,p(b))};n.remove=function(){return this.node.__shady_remove()};n.replaceWith=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_replaceWith.apply(this.node,p(b))}; | ||
ca.Object.defineProperties(Z.prototype,{activeElement:{configurable:!0,enumerable:!0,get:function(){if(x(this.node)||this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_activeElement}},_activeElement:{configurable:!0,enumerable:!0,get:function(){return this.activeElement}},host:{configurable:!0,enumerable:!0,get:function(){if(x(this.node))return this.node.host}},parentNode:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentNode}},firstChild:{configurable:!0, | ||
n.focus=function(){this.node.__shady_native_focus()};n.blur=function(){this.node.__shady_blur()};n.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};n.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};n.elementsFromPoint=function(a,b){return this.node.__shady_elementsFromPoint(a,b)};n.elementFromPoint=function(a,b){return this.node.__shady_elementFromPoint(a,b)}; | ||
n.querySelector=function(a){return this.node.__shady_querySelector(a)};n.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)};n.assignedNodes=function(a){if("slot"===this.node.localName)return this.node.__shady_assignedNodes(a)};n.append=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_append.apply(this.node,p(b))}; | ||
n.prepend=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_prepend.apply(this.node,p(b))};n.after=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_after.apply(this.node,p(b))};n.before=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_before.apply(this.node,p(b))};n.remove=function(){return this.node.__shady_remove()}; | ||
n.replaceWith=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.node.__shady_replaceWith.apply(this.node,p(b))}; | ||
da.Object.defineProperties(Z.prototype,{activeElement:{configurable:!0,enumerable:!0,get:function(){if(w(this.node)||this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_activeElement}},_activeElement:{configurable:!0,enumerable:!0,get:function(){return this.activeElement}},host:{configurable:!0,enumerable:!0,get:function(){if(w(this.node))return this.node.host}},parentNode:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentNode}},firstChild:{configurable:!0, | ||
enumerable:!0,get:function(){return this.node.__shady_firstChild}},lastChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastChild}},nextSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextSibling}},previousSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousSibling}},childNodes:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childNodes}},parentElement:{configurable:!0,enumerable:!0, | ||
get:function(){return this.node.__shady_parentElement}},firstElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_firstElementChild}},lastElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastElementChild}},nextElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextElementSibling}},previousElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousElementSibling}}, | ||
children:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_children}},childElementCount:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childElementCount}},shadowRoot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_shadowRoot}},assignedSlot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_assignedSlot}},isConnected:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_isConnected}},innerHTML:{configurable:!0, | ||
enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML=a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}},className:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_className},set:function(a){return this.node.__shady_className= | ||
a}}});function Kc(a){Object.defineProperty(Z.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})}db.forEach(function(a){return Kc(a)});eb.forEach(function(a){return Kc(a)});var Lc=new WeakMap;function Mc(a){if(x(a)||a instanceof Z)return a;var b=Lc.get(a);b||(b=new Z(a),Lc.set(a,b));return b};if(v.F){var Nc=v.c?function(a){return a}:function(a){Fa(a);Ea(a);return a};window.ShadyDOM={inUse:v.F,patch:Nc,isShadyRoot:x,enqueue:ya,flush:F,flushInitial:function(a){!a.H&&a.j&&N(a)},settings:v,filterMutations:Ac,observeChildren:yc,unobserveChildren:zc,deferConnectionCallbacks:v.deferConnectionCallbacks,preferPerformance:v.preferPerformance,handlesDynamicScoping:!0,wrap:v.g?Mc:Nc,wrapIfNeeded:!0===v.g?Mc:function(a){return a},Wrapper:Z,composedPath:Ma,noPatch:v.g,patchOnDemand:v.G,nativeMethods:Cc, | ||
nativeTree:Dc,patchElementProto:hc};Jc();gc("__shady_");Object.defineProperty(document,"_activeElement",bc.activeElement);A(Window.prototype,ec,"__shady_");v.g?v.G&&A(Element.prototype,Pb):(gc(),cb());Ya();window.Event=$a;window.CustomEvent=ab;window.MouseEvent=bb;window.ShadowRoot=Nb};}).call(this); | ||
enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML=a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}},className:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_className},set:function(a){this.node.__shady_className= | ||
a}}});function Pc(a){Object.defineProperty(Z.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})}xb.forEach(function(a){return Pc(a)});yb.forEach(function(a){return Pc(a)});var Qc=new WeakMap;function Rc(a){if(w(a)||a instanceof Z)return a;var b=Qc.get(a);b||(b=new Z(a),Qc.set(a,b));return b};if(u.K){var Sc=u.i?function(a){return a}:function(a){Za(a);Ya(a);return a};window.ShadyDOM={inUse:u.K,patch:Sc,isShadyRoot:w,enqueue:ya,flush:E,flushInitial:function(a){!a.M&&a.s&&Ub(a)},settings:u,filterMutations:Da,observeChildren:Ba,unobserveChildren:Ca,deferConnectionCallbacks:u.deferConnectionCallbacks,preferPerformance:u.preferPerformance,handlesDynamicScoping:!0,wrap:u.l?Rc:Sc,wrapIfNeeded:!0===u.l?Rc:function(a){return a},Wrapper:Z,composedPath:fb,noPatch:u.l,patchOnDemand:u.L,nativeMethods:La, | ||
nativeTree:Ma,patchElementProto:zc};Sa();yc("__shady_");Object.defineProperty(document,"_activeElement",tc.activeElement);z(Window.prototype,wc,"__shady_");u.l?u.L&&z(Element.prototype,kc):(yc(),wb());rb();window.Event=tb;window.CustomEvent=ub;window.MouseEvent=vb;window.ShadowRoot=ic};}).call(this); | ||
//# sourceMappingURL=shadydom.min.js.map |
@@ -15,3 +15,3 @@ /** | ||
removed: removed, | ||
addedCount: addedCount | ||
addedCount: addedCount, | ||
}; | ||
@@ -36,4 +36,10 @@ } | ||
// leaves the substring '123' intact. | ||
function calcEditDistances(current, currentStart, currentEnd, | ||
old, oldStart, oldEnd) { | ||
function calcEditDistances( | ||
current, | ||
currentStart, | ||
currentEnd, | ||
old, | ||
oldStart, | ||
oldEnd | ||
) { | ||
// "Deletion" columns | ||
@@ -51,10 +57,11 @@ let rowCount = oldEnd - oldStart + 1; | ||
// Initialize null row | ||
for (let j = 0; j < columnCount; j++) | ||
for (let j = 0; j < columnCount; j++) { | ||
distances[0][j] = j; | ||
} | ||
for (let i = 1; i < rowCount; i++) { | ||
for (let j = 1; j < columnCount; j++) { | ||
if (equals(current[currentStart + j - 1], old[oldStart + i - 1])) | ||
if (equals(current[currentStart + j - 1], old[oldStart + i - 1])) { | ||
distances[i][j] = distances[i - 1][j - 1]; | ||
else { | ||
} else { | ||
let north = distances[i - 1][j] + 1; | ||
@@ -94,6 +101,7 @@ let west = distances[i][j - 1] + 1; | ||
let min; | ||
if (west < north) | ||
if (west < north) { | ||
min = west < northWest ? west : northWest; | ||
else | ||
} else { | ||
min = north < northWest ? north : northWest; | ||
} | ||
@@ -148,4 +156,3 @@ if (min == northWest) { | ||
*/ | ||
function calcSplices(current, currentStart, currentEnd, | ||
old, oldStart, oldEnd) { | ||
function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) { | ||
let prefixCount = 0; | ||
@@ -156,7 +163,9 @@ let suffixCount = 0; | ||
let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart); | ||
if (currentStart == 0 && oldStart == 0) | ||
if (currentStart == 0 && oldStart == 0) { | ||
prefixCount = sharedPrefix(current, old, minLength); | ||
} | ||
if (currentEnd == current.length && oldEnd == old.length) | ||
if (currentEnd == current.length && oldEnd == old.length) { | ||
suffixCount = sharedSuffix(current, old, minLength - prefixCount); | ||
} | ||
@@ -168,17 +177,20 @@ currentStart += prefixCount; | ||
if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) | ||
if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) { | ||
return []; | ||
} | ||
if (currentStart == currentEnd) { | ||
splice = newSplice(currentStart, [], 0); | ||
while (oldStart < oldEnd) | ||
while (oldStart < oldEnd) { | ||
splice.removed.push(old[oldStart++]); | ||
} | ||
return [ splice ]; | ||
} else if (oldStart == oldEnd) | ||
return [ newSplice(currentStart, [], currentEnd - currentStart) ]; | ||
return [splice]; | ||
} else if (oldStart == oldEnd) { | ||
return [newSplice(currentStart, [], currentEnd - currentStart)]; | ||
} | ||
let ops = spliceOperationsFromEditDistances( | ||
calcEditDistances(current, currentStart, currentEnd, | ||
old, oldStart, oldEnd)); | ||
calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) | ||
); | ||
@@ -190,3 +202,3 @@ splice = undefined; | ||
for (let i = 0; i < ops.length; i++) { | ||
switch(ops[i]) { | ||
switch (ops[i]) { | ||
case EDIT_LEAVE: | ||
@@ -202,4 +214,5 @@ if (splice) { | ||
case EDIT_UPDATE: | ||
if (!splice) | ||
if (!splice) { | ||
splice = newSplice(index, [], 0); | ||
} | ||
@@ -213,4 +226,5 @@ splice.addedCount++; | ||
case EDIT_ADD: | ||
if (!splice) | ||
if (!splice) { | ||
splice = newSplice(index, [], 0); | ||
} | ||
@@ -221,4 +235,5 @@ splice.addedCount++; | ||
case EDIT_DELETE: | ||
if (!splice) | ||
if (!splice) { | ||
splice = newSplice(index, [], 0); | ||
} | ||
@@ -238,5 +253,7 @@ splice.removed.push(old[oldIndex]); | ||
function sharedPrefix(current, old, searchLength) { | ||
for (let i = 0; i < searchLength; i++) | ||
if (!equals(current[i], old[i])) | ||
for (let i = 0; i < searchLength; i++) { | ||
if (!equals(current[i], old[i])) { | ||
return i; | ||
} | ||
} | ||
return searchLength; | ||
@@ -249,4 +266,5 @@ } | ||
let count = 0; | ||
while (count < searchLength && equals(current[--index1], old[--index2])) | ||
while (count < searchLength && equals(current[--index1], old[--index2])) { | ||
count++; | ||
} | ||
@@ -261,5 +279,3 @@ return count; | ||
export function calculateSplices(current, previous) { | ||
return calcSplices(current, 0, current.length, previous, 0, | ||
previous.length); | ||
return calcSplices(current, 0, current.length, previous, 0, previous.length); | ||
} | ||
@@ -28,3 +28,5 @@ /** | ||
let isRendering = utils.settings['deferConnectionCallbacks'] && document.readyState === 'loading'; | ||
let isRendering = | ||
utils.settings['deferConnectionCallbacks'] && | ||
document.readyState === 'loading'; | ||
let rootRendered; | ||
@@ -44,3 +46,2 @@ | ||
class ShadyRoot { | ||
constructor(token, host, options) { | ||
@@ -75,5 +76,3 @@ if (token !== ShadyRootConstructionToken) { | ||
const rootData = ensureShadyDataForNode(this); | ||
rootData.firstChild = rootData.lastChild = | ||
rootData.parentNode = rootData.nextSibling = | ||
rootData.previousSibling = null; | ||
rootData.firstChild = rootData.lastChild = rootData.parentNode = rootData.nextSibling = rootData.previousSibling = null; | ||
// NOTE: optimization flag, only require an asynchronous render | ||
@@ -155,6 +154,12 @@ // to record parsed children if flag is not set. | ||
if (!utils.settings['preferPerformance'] && !this._hasRendered) { | ||
for (let n=this.host[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = this.host[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
const data = shadyDataForNode(n); | ||
if (n[utils.NATIVE_PREFIX + 'parentNode'] === this.host && | ||
(n.localName === 'slot' || !data.assignedSlot)) { | ||
if ( | ||
n[utils.NATIVE_PREFIX + 'parentNode'] === this.host && | ||
(n.localName === 'slot' || !data.assignedSlot) | ||
) { | ||
this.host[utils.NATIVE_PREFIX + 'removeChild'](n); | ||
@@ -174,3 +179,3 @@ } | ||
// capture # of previously assigned nodes to help determine if dirty. | ||
for (let i=0, slot; i < this._slotList.length; i++) { | ||
for (let i = 0, slot; i < this._slotList.length; i++) { | ||
slot = this._slotList[i]; | ||
@@ -180,7 +185,11 @@ this._clearSlotAssignedNodes(slot); | ||
// distribute host children. | ||
for (let n=this.host[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = this.host[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
this._distributeNodeToSlot(n); | ||
} | ||
// fallback content, slotchange, and dirty roots | ||
for (let i=0; i < this._slotList.length; i++) { | ||
for (let i = 0; i < this._slotList.length; i++) { | ||
const slot = this._slotList[i]; | ||
@@ -190,16 +199,27 @@ const slotData = shadyDataForNode(slot); | ||
if (!slotData.assignedNodes.length) { | ||
for (let n=slot[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = slot[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
this._distributeNodeToSlot(n, slot); | ||
} | ||
} | ||
const slotParentData = shadyDataForNode(slot[utils.SHADY_PREFIX + 'parentNode']); | ||
const slotParentData = shadyDataForNode( | ||
slot[utils.SHADY_PREFIX + 'parentNode'] | ||
); | ||
const slotParentRoot = slotParentData && slotParentData.root; | ||
if (slotParentRoot && (slotParentRoot._hasInsertionPoint() || slotParentRoot._renderPending)) { | ||
if ( | ||
slotParentRoot && | ||
(slotParentRoot._hasInsertionPoint() || slotParentRoot._renderPending) | ||
) { | ||
slotParentRoot._renderSelf(); | ||
} | ||
this._addAssignedToFlattenedNodes(slotData.flattenedNodes, | ||
slotData.assignedNodes); | ||
this._addAssignedToFlattenedNodes( | ||
slotData.flattenedNodes, | ||
slotData.assignedNodes | ||
); | ||
let prevAssignedNodes = slotData._previouslyAssignedNodes; | ||
if (prevAssignedNodes) { | ||
for (let i=0; i < prevAssignedNodes.length; i++) { | ||
for (let i = 0; i < prevAssignedNodes.length; i++) { | ||
shadyDataForNode(prevAssignedNodes[i])._prevAssignedSlot = null; | ||
@@ -274,3 +294,3 @@ } | ||
if (n$) { | ||
for (let i=0; i < n$.length; i++) { | ||
for (let i = 0; i < n$.length; i++) { | ||
let n = shadyDataForNode(n$[i]); | ||
@@ -289,3 +309,3 @@ n._prevAssignedSlot = n.assignedSlot; | ||
_addAssignedToFlattenedNodes(flattened, assigned) { | ||
for (let i=0, n; (i<assigned.length) && (n=assigned[i]); i++) { | ||
for (let i = 0, n; i < assigned.length && (n = assigned[i]); i++) { | ||
if (n.localName == 'slot') { | ||
@@ -321,3 +341,3 @@ const nestedAssigned = shadyDataForNode(n).assignedNodes; | ||
let composeList = []; | ||
for (let i=0; i < slots.length; i++) { | ||
for (let i = 0; i < slots.length; i++) { | ||
const parent = slots[i][utils.SHADY_PREFIX + 'parentNode']; | ||
@@ -331,8 +351,7 @@ /* compose node only if: | ||
const parentData = shadyDataForNode(parent); | ||
if (!(parentData && parentData.root) && | ||
composeList.indexOf(parent) < 0) { | ||
if (!(parentData && parentData.root) && composeList.indexOf(parent) < 0) { | ||
composeList.push(parent); | ||
} | ||
} | ||
for (let i=0; i < composeList.length; i++) { | ||
for (let i = 0; i < composeList.length; i++) { | ||
const node = composeList[i]; | ||
@@ -347,3 +366,7 @@ const targetNode = node === this ? this.host : node; | ||
let children = []; | ||
for (let n=node[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = node[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
// Note: if we see a slot here, the nodes are guaranteed to need to be | ||
@@ -356,3 +379,3 @@ // composed here. This is because if there is redistribution, it has | ||
let distributedNode = flattenedNodes[j]; | ||
children.push(distributedNode); | ||
children.push(distributedNode); | ||
} | ||
@@ -367,4 +390,4 @@ } else { | ||
_isInsertionPoint(node) { | ||
return node.localName == 'slot'; | ||
} | ||
return node.localName == 'slot'; | ||
} | ||
@@ -376,4 +399,4 @@ // Ensures that the rendered node list inside `container` is `children`. | ||
// process removals | ||
for (let i=0, d=0, s; (i<splices.length) && (s=splices[i]); i++) { | ||
for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) { | ||
for (let i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) { | ||
for (let j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) { | ||
// check if the node is still where we expect it is before trying | ||
@@ -392,5 +415,6 @@ // to remove it; this can happen if we move a node and | ||
// process adds | ||
for (let i=0, s, next; (i<splices.length) && (s=splices[i]); i++) { //eslint-disable-line no-redeclare | ||
for (let i = 0, s, next; i < splices.length && (s = splices[i]); i++) { | ||
// eslint-disable-line no-redeclare | ||
next = composed[s.index]; | ||
for (let j=s.index, n; j < s.index + s.addedCount; j++) { | ||
for (let j = s.index, n; j < s.index + s.addedCount; j++) { | ||
n = children[j]; | ||
@@ -427,3 +451,3 @@ container[utils.NATIVE_PREFIX + 'insertBefore'](n, next); | ||
let slotNamesToSort; | ||
for (let i=0; i < slots.length; i++) { | ||
for (let i = 0; i < slots.length; i++) { | ||
const slot = slots[i]; | ||
@@ -439,3 +463,4 @@ // ensure insertionPoints's and their parents have logical dom info. | ||
const slotParentData = shadyDataForNode(slotParent); | ||
slotParentData.__childSlotCount = (slotParentData.__childSlotCount || 0) + 1; | ||
slotParentData.__childSlotCount = | ||
(slotParentData.__childSlotCount || 0) + 1; | ||
let name = this._nameForSlot(slot); | ||
@@ -475,3 +500,3 @@ if (this._slotMap[name]) { | ||
let listB = ancestorList(b); | ||
for (var i=0; i < listA.length; i++) { | ||
for (var i = 0; i < listA.length; i++) { | ||
let nA = listA[i]; | ||
@@ -501,3 +526,3 @@ let nB = listB[i]; | ||
const slots = map[n]; | ||
for (let i=0; i < slots.length; i++) { | ||
for (let i = 0; i < slots.length; i++) { | ||
const slot = slots[i]; | ||
@@ -509,3 +534,5 @@ if (utils.contains(container, slot)) { | ||
this._slotList.splice(x, 1); | ||
const slotParentData = shadyDataForNode(slot[utils.SHADY_PREFIX + 'parentNode']); | ||
const slotParentData = shadyDataForNode( | ||
slot[utils.SHADY_PREFIX + 'parentNode'] | ||
); | ||
if (slotParentData && slotParentData.__childSlotCount) { | ||
@@ -553,3 +580,3 @@ slotParentData.__childSlotCount--; | ||
if (n$) { | ||
for (let i=0; i<n$.length; i++) { | ||
for (let i = 0; i < n$.length; i++) { | ||
let node = n$[i]; | ||
@@ -596,3 +623,5 @@ let parent = node[utils.NATIVE_PREFIX + 'parentNode']; | ||
/** @type {?NodeList<Element>} */ | ||
const slotsAdded = root['__noInsertionPoint'] ? null : root.querySelectorAll('slot'); | ||
const slotsAdded = root['__noInsertionPoint'] | ||
? null | ||
: root.querySelectorAll('slot'); | ||
// Reset scoping information so normal scoing rules apply after this. | ||
@@ -605,3 +634,5 @@ root['__noInsertionPoint'] = undefined; | ||
} | ||
/** @type {ShadowRoot} */(root).host[utils.NATIVE_PREFIX + 'appendChild'](root); | ||
/** @type {ShadowRoot} */ (root).host[utils.NATIVE_PREFIX + 'appendChild']( | ||
root | ||
); | ||
} else { | ||
@@ -611,3 +642,3 @@ root = new ShadyRoot(ShadyRootConstructionToken, host, options); | ||
return root; | ||
} | ||
}; | ||
@@ -617,8 +648,11 @@ // Mitigate connect/disconnect spam by wrapping custom element classes. This | ||
// not. | ||
if (utils.hasCustomElements() && utils.settings.inUse && !utils.settings['preferPerformance']) { | ||
if ( | ||
utils.hasCustomElements() && | ||
utils.settings.inUse && | ||
!utils.settings['preferPerformance'] | ||
) { | ||
// process connect/disconnect after roots have rendered to avoid | ||
// issues with reaction stack. | ||
let connectMap = new Map(); | ||
rootRendered = function() { | ||
rootRendered = function () { | ||
// allow elements to connect | ||
@@ -631,4 +665,5 @@ // save map state (without needing polyfills on IE11) | ||
connectMap.clear(); | ||
for (let i=0; i < r.length; i++) { | ||
const e = r[i][0], value = r[i][1]; | ||
for (let i = 0; i < r.length; i++) { | ||
const e = r[i][0], | ||
value = r[i][1]; | ||
if (value) { | ||
@@ -640,3 +675,3 @@ e['__shadydom_connectedCallback'](); | ||
} | ||
} | ||
}; | ||
@@ -646,6 +681,10 @@ // Document is in loading state and flag is set (deferConnectionCallbacks) | ||
if (isRendering) { | ||
document.addEventListener('readystatechange', () => { | ||
isRendering = false; | ||
rootRendered(); | ||
}, {once: true}); | ||
document.addEventListener( | ||
'readystatechange', | ||
() => { | ||
isRendering = false; | ||
rootRendered(); | ||
}, | ||
{once: true} | ||
); | ||
} | ||
@@ -662,5 +701,6 @@ | ||
if (connected || disconnected) { | ||
/** @this {!HTMLElement} */ | ||
base.prototype.connectedCallback = base.prototype['__shadydom_connectedCallback'] = function() { | ||
base.prototype.connectedCallback = base.prototype[ | ||
'__shadydom_connectedCallback' | ||
] = function () { | ||
// if rendering defer connected | ||
@@ -676,6 +716,8 @@ // otherwise connect only if we haven't already | ||
} | ||
} | ||
}; | ||
/** @this {!HTMLElement} */ | ||
base.prototype.disconnectedCallback = base.prototype['__shadydom_disconnectedCallback'] = function() { | ||
base.prototype.disconnectedCallback = base.prototype[ | ||
'__shadydom_disconnectedCallback' | ||
] = function () { | ||
// if rendering, cancel a pending connection and queue disconnect, | ||
@@ -698,14 +740,17 @@ // otherwise disconnect only if a connection has been allowed | ||
} | ||
} | ||
}; | ||
} | ||
return base; | ||
} | ||
}; | ||
const originalDefine = window['customElements']['define']; | ||
const define = function(name, constructor) { | ||
const define = function (name, constructor) { | ||
const connected = constructor.prototype.connectedCallback; | ||
const disconnected = constructor.prototype.disconnectedCallback; | ||
originalDefine.call(window['customElements'], name, | ||
ManageConnect(constructor, connected, disconnected)); | ||
originalDefine.call( | ||
window['customElements'], | ||
name, | ||
ManageConnect(constructor, connected, disconnected) | ||
); | ||
// unpatch connected/disconnected on class; custom elements tears this off | ||
@@ -716,3 +761,3 @@ // so the patch is maintained, but if the user calls these methods for | ||
constructor.prototype.disconnectedCallback = disconnected; | ||
} | ||
}; | ||
// Note, it would be better to only patch the CustomElementRegistry.prototype, | ||
@@ -725,3 +770,3 @@ // but ShadyCSS patches define directly. | ||
value: define, | ||
configurable: true | ||
configurable: true, | ||
}); | ||
@@ -736,2 +781,2 @@ } | ||
} | ||
} | ||
}; |
@@ -68,3 +68,3 @@ /** | ||
'track', | ||
'wbr' | ||
'wbr', | ||
]); | ||
@@ -80,3 +80,3 @@ | ||
'plaintext', | ||
'noscript' | ||
'noscript', | ||
]); | ||
@@ -127,7 +127,7 @@ | ||
if (node.localName === 'template') { | ||
node = /** @type {HTMLTemplateElement} */ (node).content; | ||
node = /** @type {HTMLTemplateElement} */ (node).content; | ||
} | ||
let s = ''; | ||
let c$ = callback ? callback(node) : node.childNodes; | ||
for (let i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) { | ||
for (let i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) { | ||
s += getOuterHTML(child, node, callback); | ||
@@ -134,0 +134,0 @@ } |
@@ -13,2 +13,3 @@ /** | ||
import {shadyDataForNode, ensureShadyDataForNode} from './shady-data.js'; | ||
// prettier-ignore | ||
import {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js'; | ||
@@ -42,4 +43,5 @@ import {patchNodeProto} from './patch-prototypes.js'; | ||
// update ref_node.previousSibling <-> node | ||
nodeData.previousSibling = ref_node ? ref_nodeData.previousSibling : | ||
container[utils.SHADY_PREFIX + 'lastChild']; | ||
nodeData.previousSibling = ref_node | ||
? ref_nodeData.previousSibling | ||
: container[utils.SHADY_PREFIX + 'lastChild']; | ||
let psd = shadyDataForNode(nodeData.previousSibling); | ||
@@ -50,3 +52,3 @@ if (psd) { | ||
// update node <-> ref_node | ||
let nsd = shadyDataForNode(nodeData.nextSibling = ref_node); | ||
let nsd = shadyDataForNode((nodeData.nextSibling = ref_node)); | ||
if (nsd) { | ||
@@ -83,3 +85,3 @@ nsd.previousSibling = node; | ||
const first = node[utils.NATIVE_PREFIX + 'firstChild']; | ||
for (let n = first; n; (n = n[utils.NATIVE_PREFIX + 'nextSibling'])) { | ||
for (let n = first; n; n = n[utils.NATIVE_PREFIX + 'nextSibling']) { | ||
linkNode(n, container, containerData, ref_node); | ||
@@ -90,3 +92,3 @@ } | ||
} | ||
} | ||
}; | ||
@@ -113,4 +115,3 @@ export const recordRemoveChild = (node, container) => { | ||
// from `null` which is set if info is null. | ||
nodeData.parentNode = nodeData.previousSibling = | ||
nodeData.nextSibling = undefined; | ||
nodeData.parentNode = nodeData.previousSibling = nodeData.nextSibling = undefined; | ||
if (containerData.childNodes !== undefined) { | ||
@@ -120,3 +121,3 @@ // remove caching of childNodes | ||
} | ||
} | ||
}; | ||
@@ -134,6 +135,7 @@ /** | ||
nodeData.childNodes = null; | ||
const first = nodeData.firstChild = node[utils.NATIVE_PREFIX + 'firstChild']; | ||
const first = (nodeData.firstChild = | ||
node[utils.NATIVE_PREFIX + 'firstChild']); | ||
nodeData.lastChild = node[utils.NATIVE_PREFIX + 'lastChild']; | ||
patchNode(node, InsideAcccessors); | ||
for (let n = first, previous; n; (n = n[utils.NATIVE_PREFIX + 'nextSibling'])) { | ||
for (let n = first, previous; n; n = n[utils.NATIVE_PREFIX + 'nextSibling']) { | ||
const sd = ensureShadyDataForNode(n); | ||
@@ -146,2 +148,2 @@ sd.parentNode = adoptedParent || node; | ||
} | ||
} | ||
}; |
@@ -15,3 +15,2 @@ /** | ||
class AsyncObserver { | ||
constructor() { | ||
@@ -38,3 +37,3 @@ this._scheduled = false; | ||
if (mutations.length) { | ||
this.callbacks.forEach(function(cb) { | ||
this.callbacks.forEach(function (cb) { | ||
cb(mutations); | ||
@@ -48,6 +47,8 @@ }); | ||
if (this.addedNodes.length || this.removedNodes.length) { | ||
let mutations = [{ | ||
addedNodes: this.addedNodes, | ||
removedNodes: this.removedNodes | ||
}]; | ||
let mutations = [ | ||
{ | ||
addedNodes: this.addedNodes, | ||
removedNodes: this.removedNodes, | ||
}, | ||
]; | ||
this.addedNodes = []; | ||
@@ -59,3 +60,2 @@ this.removedNodes = []; | ||
} | ||
} | ||
@@ -68,3 +68,3 @@ | ||
// subtree child mutations. | ||
export let observeChildren = function(node, callback) { | ||
export let observeChildren = function (node, callback) { | ||
const sd = ensureShadyDataForNode(node); | ||
@@ -81,8 +81,8 @@ if (!sd.observer) { | ||
takeRecords() { | ||
return observer.takeRecords() | ||
} | ||
return observer.takeRecords(); | ||
}, | ||
}; | ||
} | ||
}; | ||
export let unobserveChildren = function(handle) { | ||
export let unobserveChildren = function (handle) { | ||
let observer = handle && handle._observer; | ||
@@ -95,3 +95,3 @@ if (observer) { | ||
} | ||
} | ||
}; | ||
@@ -101,21 +101,25 @@ export function filterMutations(mutations, target) { | ||
const targetRootNode = target.getRootNode(); | ||
return mutations.map(function(mutation) { | ||
/** @const {boolean} */ | ||
const mutationInScope = (targetRootNode === mutation.target.getRootNode()); | ||
if (mutationInScope && mutation.addedNodes) { | ||
let nodes = utils.arrayFrom(mutation.addedNodes).filter(function(n) { | ||
return (targetRootNode === n.getRootNode()); | ||
}); | ||
if (nodes.length) { | ||
mutation = Object.create(mutation); | ||
Object.defineProperty(mutation, 'addedNodes', { | ||
value: nodes, | ||
configurable: true | ||
return mutations | ||
.map(function (mutation) { | ||
/** @const {boolean} */ | ||
const mutationInScope = targetRootNode === mutation.target.getRootNode(); | ||
if (mutationInScope && mutation.addedNodes) { | ||
let nodes = utils.arrayFrom(mutation.addedNodes).filter(function (n) { | ||
return targetRootNode === n.getRootNode(); | ||
}); | ||
if (nodes.length) { | ||
mutation = Object.create(mutation); | ||
Object.defineProperty(mutation, 'addedNodes', { | ||
value: nodes, | ||
configurable: true, | ||
}); | ||
return mutation; | ||
} | ||
} else if (mutationInScope) { | ||
return mutation; | ||
} | ||
} else if (mutationInScope) { | ||
return mutation; | ||
} | ||
}).filter(function(m) { return m}); | ||
}) | ||
.filter(function (m) { | ||
return m; | ||
}); | ||
} |
@@ -23,3 +23,6 @@ /** | ||
const composedGetter = (() => { | ||
const composedProp = Object.getOwnPropertyDescriptor(Event.prototype, 'composed'); | ||
const composedProp = Object.getOwnPropertyDescriptor( | ||
Event.prototype, | ||
'composed' | ||
); | ||
return composedProp ? (ev) => composedProp.get.call(ev) : null; | ||
@@ -34,5 +37,5 @@ })(); | ||
return false; | ||
} | ||
} | ||
const listener = () => {} | ||
}, | ||
}; | ||
const listener = () => {}; | ||
// NOTE: These will be unpatched at this point. | ||
@@ -61,5 +64,5 @@ window.addEventListener('test', listener, eventOptions); | ||
passive, | ||
nativeEventOptions: supportsEventOptions ? optionsOrCapture : capture | ||
} | ||
} | ||
nativeEventOptions: supportsEventOptions ? optionsOrCapture : capture, | ||
}; | ||
}; | ||
@@ -113,3 +116,3 @@ // https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937 | ||
'DOMFocusOut': true, | ||
'keypress': true | ||
'keypress': true, | ||
}; | ||
@@ -126,4 +129,4 @@ | ||
'DOMNodeRemovedFromDocument': true, | ||
'DOMSubtreeModified': true | ||
} | ||
'DOMSubtreeModified': true, | ||
}; | ||
@@ -153,3 +156,7 @@ /** | ||
current = current[utils.SHADY_PREFIX + 'assignedSlot']; | ||
} else if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && current.host && (composed || current !== startRoot)) { | ||
} else if ( | ||
current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && | ||
current.host && | ||
(composed || current !== startRoot) | ||
) { | ||
current = current.host; | ||
@@ -172,3 +179,3 @@ } else { | ||
return event.__composedPath; | ||
} | ||
}; | ||
@@ -183,3 +190,3 @@ function retarget(refNode, path) { | ||
let p$ = path; | ||
for (let i=0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) { | ||
for (let i = 0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) { | ||
ancestor = p$[i]; | ||
@@ -198,3 +205,2 @@ root = getRootNodeWithFallback(ancestor); | ||
let EventPatches = { | ||
/** | ||
@@ -208,4 +214,7 @@ * @this {Event} | ||
// TODO(web-padawan): see https://github.com/webcomponents/shadydom/issues/275 | ||
this.__composed = this.type === 'focusin' || this.type === 'focusout' || composedGetter(this); | ||
// If the event is trusted, or `isTrusted` is not supported, check the list of always composed events | ||
this.__composed = | ||
this.type === 'focusin' || | ||
this.type === 'focusout' || | ||
composedGetter(this); | ||
// If the event is trusted, or `isTrusted` is not supported, check the list of always composed events | ||
} else if (this.isTrusted !== false) { | ||
@@ -215,3 +224,3 @@ this.__composed = alwaysComposed[this.type]; | ||
} | ||
return /** @type {!Event} */(this).__composed || false; | ||
return /** @type {!Event} */ (this).__composed || false; | ||
}, | ||
@@ -226,3 +235,3 @@ | ||
} | ||
return /** @type {!Event} */(this).__composedPath; | ||
return /** @type {!Event} */ (this).__composedPath; | ||
}, | ||
@@ -234,3 +243,6 @@ | ||
get target() { | ||
return retarget(this.currentTarget || this['__previousCurrentTarget'], this.composedPath()); | ||
return retarget( | ||
this.currentTarget || this['__previousCurrentTarget'], | ||
this.composedPath() | ||
); | ||
}, | ||
@@ -247,6 +259,12 @@ | ||
if (!this.__relatedTargetComposedPath) { | ||
this.__relatedTargetComposedPath = pathComposer(this.__relatedTarget, true); | ||
this.__relatedTargetComposedPath = pathComposer( | ||
this.__relatedTarget, | ||
true | ||
); | ||
} | ||
// find the deepest node in relatedTarget composed path that is in the same root with the currentTarget | ||
return retarget(this.currentTarget || this['__previousCurrentTarget'], /** @type {!Event} */(this).__relatedTargetComposedPath); | ||
return retarget( | ||
this.currentTarget || this['__previousCurrentTarget'], | ||
/** @type {!Event} */ (this).__relatedTargetComposedPath | ||
); | ||
}, | ||
@@ -267,4 +285,3 @@ /** | ||
this.__propagationStopped = true; | ||
} | ||
}, | ||
}; | ||
@@ -275,7 +292,7 @@ | ||
// try to do `Base.call` with a dom construtor. | ||
let klazz = function(type, options) { | ||
let klazz = function (type, options) { | ||
let event = new Base(type, options); | ||
event.__composed = options && Boolean(options['composed']); | ||
return event; | ||
} | ||
}; | ||
// put constructor properties on subclass | ||
@@ -289,6 +306,5 @@ klazz.__proto__ = Base; | ||
'focus': true, | ||
'blur': true | ||
'blur': true, | ||
}; | ||
/** | ||
@@ -300,3 +316,6 @@ * Check if the event has been retargeted by comparing original `target`, and calculated `target` | ||
function hasRetargeted(event) { | ||
return event['__target'] !== event.target || event.__relatedTarget !== event.relatedTarget; | ||
return ( | ||
event['__target'] !== event.target || | ||
event.__relatedTarget !== event.relatedTarget | ||
); | ||
} | ||
@@ -311,3 +330,5 @@ | ||
function fireHandlers(event, node, phase) { | ||
let hs = node.__handlers && node.__handlers[event.type] && | ||
let hs = | ||
node.__handlers && | ||
node.__handlers[event.type] && | ||
node.__handlers[event.type][phase]; | ||
@@ -329,3 +350,3 @@ if (hs) { | ||
const path = e.composedPath(); | ||
const retargetedPath = path.map(node => retarget(node, path)); | ||
const retargetedPath = path.map((node) => retarget(node, path)); | ||
const bubbles = e.bubbles; | ||
@@ -338,3 +359,3 @@ | ||
enumerable: true, | ||
get: function() { | ||
get: function () { | ||
return currentTarget; | ||
@@ -348,3 +369,3 @@ }, | ||
enumerable: true, | ||
get: function() { | ||
get: function () { | ||
return eventPhase; | ||
@@ -356,3 +377,6 @@ }, | ||
currentTarget = path[i]; | ||
eventPhase = currentTarget === retargetedPath[i] ? Event.AT_TARGET : Event.CAPTURING_PHASE; | ||
eventPhase = | ||
currentTarget === retargetedPath[i] | ||
? Event.AT_TARGET | ||
: Event.CAPTURING_PHASE; | ||
// capture phase fires all capture handlers | ||
@@ -381,3 +405,10 @@ fireHandlers(e, currentTarget, 'capture'); | ||
function listenerSettingsEqual(savedListener, node, type, capture, once, passive) { | ||
function listenerSettingsEqual( | ||
savedListener, | ||
node, | ||
type, | ||
capture, | ||
once, | ||
passive | ||
) { | ||
let { | ||
@@ -388,9 +419,11 @@ node: savedNode, | ||
once: savedOnce, | ||
passive: savedPassive | ||
passive: savedPassive, | ||
} = savedListener; | ||
return node === savedNode && | ||
return ( | ||
node === savedNode && | ||
type === savedType && | ||
capture === savedCapture && | ||
once === savedOnce && | ||
passive === savedPassive; | ||
passive === savedPassive | ||
); | ||
} | ||
@@ -400,3 +433,5 @@ | ||
for (let i = 0; i < wrappers.length; i++) { | ||
if (listenerSettingsEqual(wrappers[i], node, type, capture, once, passive)) { | ||
if ( | ||
listenerSettingsEqual(wrappers[i], node, type, capture, once, passive) | ||
) { | ||
return i; | ||
@@ -431,4 +466,7 @@ } | ||
// include both connected and disconnected parts, dispatch it manually. | ||
if (!utils.settings.preferPerformance && this instanceof Node && | ||
!utils.documentContains(document, this)) { | ||
if ( | ||
!utils.settings.preferPerformance && | ||
this instanceof Node && | ||
!utils.documentContains(document, this) | ||
) { | ||
if (!event['__target']) { | ||
@@ -447,4 +485,9 @@ patchEvent(event, this); | ||
export function addEventListener(type, fnOrObj, optionsOrCapture) { | ||
const {capture, once, passive, shadyTarget, nativeEventOptions} = | ||
parseEventOptions(optionsOrCapture); | ||
const { | ||
capture, | ||
once, | ||
passive, | ||
shadyTarget, | ||
nativeEventOptions, | ||
} = parseEventOptions(optionsOrCapture); | ||
if (!fnOrObj) { | ||
@@ -462,3 +505,6 @@ return; | ||
// bail if `fnOrObj` is an object without a `handleEvent` method | ||
if (handlerType === 'object' && (!fnOrObj.handleEvent || typeof fnOrObj.handleEvent !== 'function')) { | ||
if ( | ||
handlerType === 'object' && | ||
(!fnOrObj.handleEvent || typeof fnOrObj.handleEvent !== 'function') | ||
) { | ||
return; | ||
@@ -468,3 +514,7 @@ } | ||
if (unpatchedEvents[type]) { | ||
return this[utils.NATIVE_PREFIX + 'addEventListener'](type, fnOrObj, nativeEventOptions); | ||
return this[utils.NATIVE_PREFIX + 'addEventListener']( | ||
type, | ||
fnOrObj, | ||
nativeEventOptions | ||
); | ||
} | ||
@@ -497,6 +547,10 @@ | ||
*/ | ||
const wrapperFn = function(e) { | ||
const wrapperFn = function (e) { | ||
// Support `once` option. | ||
if (once) { | ||
this[utils.SHADY_PREFIX + 'removeEventListener'](type, fnOrObj, optionsOrCapture); | ||
this[utils.SHADY_PREFIX + 'removeEventListener']( | ||
type, | ||
fnOrObj, | ||
optionsOrCapture | ||
); | ||
} | ||
@@ -510,4 +564,12 @@ if (!e['__target']) { | ||
// replace `currentTarget` to make `target` and `relatedTarget` correct for inside the shadowroot | ||
lastCurrentTargetDesc = Object.getOwnPropertyDescriptor(e, 'currentTarget'); | ||
Object.defineProperty(e, 'currentTarget', {get() { return target }, configurable: true}); | ||
lastCurrentTargetDesc = Object.getOwnPropertyDescriptor( | ||
e, | ||
'currentTarget' | ||
); | ||
Object.defineProperty(e, 'currentTarget', { | ||
get() { | ||
return target; | ||
}, | ||
configurable: true, | ||
}); | ||
lastEventPhaseDesc = Object.getOwnPropertyDescriptor(e, 'eventPhase'); | ||
@@ -528,3 +590,6 @@ Object.defineProperty(e, 'eventPhase', { | ||
// or a children of the host. | ||
if (targetNeedsPathCheck(target) && e.composedPath().indexOf(target) == -1) { | ||
if ( | ||
targetNeedsPathCheck(target) && | ||
e.composedPath().indexOf(target) == -1 | ||
) { | ||
return; | ||
@@ -543,8 +608,14 @@ } | ||
// prevent non-bubbling events from triggering bubbling handlers on shadowroot, but only if not in capture phase | ||
if (e.eventPhase !== Event.CAPTURING_PHASE && !e.bubbles && e.target !== target && !(target instanceof Window)) { | ||
if ( | ||
e.eventPhase !== Event.CAPTURING_PHASE && | ||
!e.bubbles && | ||
e.target !== target && | ||
!(target instanceof Window) | ||
) { | ||
return; | ||
} | ||
let ret = handlerType === 'function' ? | ||
fnOrObj.call(target, e) : | ||
(fnOrObj.handleEvent && fnOrObj.handleEvent(e)); | ||
let ret = | ||
handlerType === 'function' | ||
? fnOrObj.call(target, e) | ||
: fnOrObj.handleEvent && fnOrObj.handleEvent(e); | ||
if (target !== this) { | ||
@@ -578,12 +649,18 @@ // Replace the original descriptors for `currentTarget` and `eventPhase`. | ||
passive: passive, | ||
wrapperFn: wrapperFn | ||
wrapperFn: wrapperFn, | ||
}); | ||
this.__handlers = this.__handlers || {}; | ||
this.__handlers[type] = this.__handlers[type] || | ||
{'capture': [], 'bubble': []}; | ||
this.__handlers[type] = this.__handlers[type] || { | ||
'capture': [], | ||
'bubble': [], | ||
}; | ||
this.__handlers[type][capture ? 'capture' : 'bubble'].push(wrapperFn); | ||
if (!nonBubblingEventsToRetarget[type]) { | ||
this[utils.NATIVE_PREFIX + 'addEventListener'](type, wrapperFn, nativeEventOptions); | ||
this[utils.NATIVE_PREFIX + 'addEventListener']( | ||
type, | ||
wrapperFn, | ||
nativeEventOptions | ||
); | ||
} | ||
@@ -599,6 +676,15 @@ } | ||
} | ||
const {capture, once, passive, shadyTarget, nativeEventOptions} = | ||
parseEventOptions(optionsOrCapture); | ||
const { | ||
capture, | ||
once, | ||
passive, | ||
shadyTarget, | ||
nativeEventOptions, | ||
} = parseEventOptions(optionsOrCapture); | ||
if (unpatchedEvents[type]) { | ||
return this[utils.NATIVE_PREFIX + 'removeEventListener'](type, fnOrObj, nativeEventOptions); | ||
return this[utils.NATIVE_PREFIX + 'removeEventListener']( | ||
type, | ||
fnOrObj, | ||
nativeEventOptions | ||
); | ||
} | ||
@@ -619,4 +705,7 @@ let target = shadyTarget || this; | ||
} | ||
this[utils.NATIVE_PREFIX + 'removeEventListener'](type, wrapperFn || fnOrObj, | ||
nativeEventOptions); | ||
this[utils.NATIVE_PREFIX + 'removeEventListener']( | ||
type, | ||
wrapperFn || fnOrObj, | ||
nativeEventOptions | ||
); | ||
if (wrapperFn && this.__handlers && this.__handlers[type]) { | ||
@@ -633,8 +722,12 @@ const arr = this.__handlers[type][capture ? 'capture' : 'bubble']; | ||
for (let ev in nonBubblingEventsToRetarget) { | ||
window[utils.NATIVE_PREFIX + 'addEventListener'](ev, function(e) { | ||
if (!e['__target']) { | ||
patchEvent(e); | ||
shadyDispatchEvent(e); | ||
} | ||
}, true); | ||
window[utils.NATIVE_PREFIX + 'addEventListener']( | ||
ev, | ||
function (e) { | ||
if (!e['__target']) { | ||
patchEvent(e); | ||
shadyDispatchEvent(e); | ||
} | ||
}, | ||
true | ||
); | ||
} | ||
@@ -662,3 +755,3 @@ } | ||
event.__proto__ = proto[SHADY_PROTO]; | ||
// and fallback to patching instance | ||
// and fallback to patching instance | ||
} else { | ||
@@ -673,3 +766,2 @@ utils.patchProperties(event, EventPatchesDescriptors); | ||
export function patchEvents() { | ||
@@ -684,9 +776,12 @@ activateFocusEventOverrides(); | ||
// Fix up `Element.prototype.click()` if `isTrusted` is supported, but `composed` isn't | ||
if (!composedGetter && Object.getOwnPropertyDescriptor(Event.prototype, 'isTrusted')) { | ||
if ( | ||
!composedGetter && | ||
Object.getOwnPropertyDescriptor(Event.prototype, 'isTrusted') | ||
) { | ||
/** @this {Element} */ | ||
const composedClickFn = function() { | ||
const composedClickFn = function () { | ||
const ev = new MouseEvent('click', { | ||
bubbles: true, | ||
cancelable: true, | ||
composed: true | ||
composed: true, | ||
}); | ||
@@ -703,9 +798,9 @@ this[utils.SHADY_PREFIX + 'dispatchEvent'](ev); | ||
export const eventPropertyNamesForElement = | ||
Object.getOwnPropertyNames(Element.prototype) | ||
.filter(name => name.substring(0,2) === 'on'); | ||
export const eventPropertyNamesForElement = Object.getOwnPropertyNames( | ||
Element.prototype | ||
).filter((name) => name.substring(0, 2) === 'on'); | ||
export const eventPropertyNamesForHTMLElement = | ||
Object.getOwnPropertyNames(HTMLElement.prototype) | ||
.filter(name => name.substring(0,2) === 'on'); | ||
export const eventPropertyNamesForHTMLElement = Object.getOwnPropertyNames( | ||
HTMLElement.prototype | ||
).filter((name) => name.substring(0, 2) === 'on'); | ||
@@ -719,3 +814,3 @@ /** | ||
/** @this {Element} */ | ||
set: function(fn) { | ||
set: function (fn) { | ||
const shadyData = ensureShadyDataForNode(this); | ||
@@ -726,3 +821,7 @@ const eventName = property.substring(2); | ||
} | ||
shadyData.__onCallbackListeners[property] && this.removeEventListener(eventName, shadyData.__onCallbackListeners[property]); | ||
shadyData.__onCallbackListeners[property] && | ||
this.removeEventListener( | ||
eventName, | ||
shadyData.__onCallbackListeners[property] | ||
); | ||
this[utils.SHADY_PREFIX + 'addEventListener'](eventName, fn); | ||
@@ -734,6 +833,10 @@ shadyData.__onCallbackListeners[property] = fn; | ||
const shadyData = shadyDataForNode(this); | ||
return shadyData && shadyData.__onCallbackListeners && shadyData.__onCallbackListeners[property]; | ||
return ( | ||
shadyData && | ||
shadyData.__onCallbackListeners && | ||
shadyData.__onCallbackListeners[property] | ||
); | ||
}, | ||
configurable: true | ||
configurable: true, | ||
}; | ||
}; |
@@ -15,3 +15,2 @@ /** | ||
export const InsideDescriptors = utils.getOwnPropertyDescriptors({ | ||
/** @this {Node} */ | ||
@@ -56,3 +55,2 @@ get childNodes() { | ||
}, | ||
}); | ||
@@ -78,3 +76,3 @@ | ||
set innerHTML(value) { | ||
return this[utils.SHADY_PREFIX + 'innerHTML'] = value; | ||
this[utils.SHADY_PREFIX + 'innerHTML'] = value; | ||
}, | ||
@@ -84,3 +82,2 @@ }); | ||
export const OutsideDescriptors = utils.getOwnPropertyDescriptors({ | ||
/** @this {Node} */ | ||
@@ -123,5 +120,4 @@ get parentElement() { | ||
set className(value) { | ||
return this[utils.SHADY_PREFIX + 'className'] = value; | ||
} | ||
this[utils.SHADY_PREFIX + 'className'] = value; | ||
}, | ||
}); | ||
@@ -139,3 +135,3 @@ | ||
} | ||
} | ||
}; | ||
@@ -146,38 +142,44 @@ makeNonEnumerable(InsideDescriptors); | ||
const noInstancePatching = utils.settings.hasDescriptors || (utils.settings.noPatch === true); | ||
const noInstancePatching = | ||
utils.settings.hasDescriptors || utils.settings.noPatch === true; | ||
// ensure an element has patched "outside" accessors; no-op when not needed | ||
export let patchOutsideElementAccessors = noInstancePatching ? | ||
function() {} : function(element) { | ||
const sd = ensureShadyDataForNode(element); | ||
if (!sd.__outsideAccessors) { | ||
sd.__outsideAccessors = true; | ||
utils.patchExistingProperties(element, OutsideDescriptors); | ||
} | ||
} | ||
export let patchOutsideElementAccessors = noInstancePatching | ||
? function () {} | ||
: function (element) { | ||
const sd = ensureShadyDataForNode(element); | ||
if (!sd.__outsideAccessors) { | ||
sd.__outsideAccessors = true; | ||
utils.patchExistingProperties(element, OutsideDescriptors); | ||
} | ||
}; | ||
// ensure an element has patched "inside" accessors; no-op when not needed | ||
export let patchInsideElementAccessors = noInstancePatching ? | ||
function() {} : function(element) { | ||
const sd = ensureShadyDataForNode(element); | ||
if (!sd.__insideAccessors) { | ||
sd.__insideAccessors = true; | ||
utils.patchExistingProperties(element, InsideDescriptors); | ||
// NOTE: There are compatibility issues with patches for `textContent` | ||
// and `innerHTML` between CE and SD. Since SD patches are applied | ||
// via `ShadyDOM.patch` and CE patches are applied as the tree is walked, | ||
// SD patches overwrite CE patches. | ||
// * When SD is in patching mode, SD calls through to native | ||
// methods not patched by CE (since SD is at the bottom) and CE does not | ||
// upgrade, connect, or disconnect elements. Therefore do *not patch* | ||
// these accessors in this case. | ||
// * When SD is in `noPatch` mode, the SD patches call through to | ||
// "native" methods that are patched by CE (since CE is at the bottom). | ||
// Therefore continue to patch in this case. | ||
// If the custom elements polyfill is not loaded, then these accessors | ||
// should be patched so they work correctly. | ||
if (!utils.hasPolyfilledCustomElements() || utils.settings.noPatch) { | ||
utils.patchExistingProperties(element, TextContentInnerHTMLDescriptors); | ||
export let patchInsideElementAccessors = noInstancePatching | ||
? function () {} | ||
: function (element) { | ||
const sd = ensureShadyDataForNode(element); | ||
if (!sd.__insideAccessors) { | ||
sd.__insideAccessors = true; | ||
utils.patchExistingProperties(element, InsideDescriptors); | ||
// NOTE: There are compatibility issues with patches for `textContent` | ||
// and `innerHTML` between CE and SD. Since SD patches are applied | ||
// via `ShadyDOM.patch` and CE patches are applied as the tree is walked, | ||
// SD patches overwrite CE patches. | ||
// * When SD is in patching mode, SD calls through to native | ||
// methods not patched by CE (since SD is at the bottom) and CE does not | ||
// upgrade, connect, or disconnect elements. Therefore do *not patch* | ||
// these accessors in this case. | ||
// * When SD is in `noPatch` mode, the SD patches call through to | ||
// "native" methods that are patched by CE (since CE is at the bottom). | ||
// Therefore continue to patch in this case. | ||
// If the custom elements polyfill is not loaded, then these accessors | ||
// should be patched so they work correctly. | ||
if (!utils.hasPolyfilledCustomElements() || utils.settings.noPatch) { | ||
utils.patchExistingProperties( | ||
element, | ||
TextContentInnerHTMLDescriptors | ||
); | ||
} | ||
} | ||
} | ||
} | ||
}; |
@@ -28,3 +28,3 @@ /** | ||
return this[NATIVE_PREFIX + 'querySelectorAll'](selector); | ||
} | ||
}, | ||
}; | ||
@@ -38,3 +38,3 @@ // Object on which raw native accessors are available via `accessorName(node)`. | ||
nativeTree[name] = (node) => node[NATIVE_PREFIX + name]; | ||
} | ||
}; | ||
@@ -45,5 +45,4 @@ const installNativeMethod = (name, fn) => { | ||
} | ||
} | ||
}; | ||
const defineNativeAccessors = (proto, descriptors) => { | ||
@@ -55,3 +54,3 @@ patchProperties(proto, descriptors, NATIVE_PREFIX); | ||
} | ||
} | ||
}; | ||
@@ -72,11 +71,19 @@ const copyProperties = (proto, list = []) => { | ||
} | ||
} | ||
}; | ||
/** @type {!TreeWalker} */ | ||
const nodeWalker = document.createTreeWalker(document, NodeFilter.SHOW_ALL, | ||
null, false); | ||
const nodeWalker = document.createTreeWalker( | ||
document, | ||
NodeFilter.SHOW_ALL, | ||
null, | ||
false | ||
); | ||
/** @type {!TreeWalker} */ | ||
const elementWalker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, | ||
null, false); | ||
const elementWalker = document.createTreeWalker( | ||
document, | ||
NodeFilter.SHOW_ELEMENT, | ||
null, | ||
false | ||
); | ||
@@ -86,3 +93,3 @@ /** @type {!Document} */ | ||
const clearNode = node => { | ||
const clearNode = (node) => { | ||
let firstChild; | ||
@@ -92,3 +99,3 @@ while ((firstChild = node[NATIVE_PREFIX + 'firstChild'])) { | ||
} | ||
} | ||
}; | ||
@@ -111,3 +118,2 @@ const ParentNodeAccessors = [ | ||
export const addNativePrefixedProperties = () => { | ||
// EventTarget | ||
@@ -117,6 +123,13 @@ const eventProps = [ | ||
'addEventListener', | ||
'removeEventListener' | ||
'removeEventListener', | ||
]; | ||
if (window.EventTarget) { | ||
copyProperties(window.EventTarget.prototype, eventProps); | ||
// In Firefox 31, `EventTarget` exists, but `EventTarget.prototype` is not | ||
// in the prototype chain of `window` and, strangely, | ||
// `window instanceof EventTarget` still returns true. | ||
if (window[NATIVE_PREFIX + 'addEventListener'] === undefined) { | ||
copyProperties(Window.prototype, eventProps); | ||
} | ||
} else { | ||
@@ -127,3 +140,2 @@ copyProperties(Node.prototype, eventProps); | ||
// Node | ||
@@ -148,3 +160,3 @@ if (hasDescriptors) { | ||
return nodeWalker.parentNode(); | ||
} | ||
}, | ||
}, | ||
@@ -156,3 +168,3 @@ firstChild: { | ||
return nodeWalker.firstChild(); | ||
} | ||
}, | ||
}, | ||
@@ -164,4 +176,3 @@ lastChild: { | ||
return nodeWalker.lastChild(); | ||
} | ||
}, | ||
}, | ||
@@ -173,3 +184,3 @@ previousSibling: { | ||
return nodeWalker.previousSibling(); | ||
} | ||
}, | ||
}, | ||
@@ -181,3 +192,3 @@ nextSibling: { | ||
return nodeWalker.nextSibling(); | ||
} | ||
}, | ||
}, | ||
@@ -196,3 +207,3 @@ // TODO(sorvell): make this a NodeList or whatever | ||
return nodes; | ||
} | ||
}, | ||
}, | ||
@@ -204,3 +215,3 @@ parentElement: { | ||
return elementWalker.parentNode(); | ||
} | ||
}, | ||
}, | ||
@@ -210,3 +221,2 @@ textContent: { | ||
get() { | ||
/* eslint-disable no-case-declarations */ | ||
switch (this.nodeType) { | ||
@@ -217,6 +227,13 @@ case Node.ELEMENT_NODE: | ||
// at least for Safari 9, but it's unclear why. | ||
const textWalker = document.createTreeWalker(this, NodeFilter.SHOW_TEXT, | ||
null, false); | ||
let content = '', n; | ||
while ( (n = textWalker.nextNode()) ) { | ||
// eslint-disable-next-line no-case-declarations | ||
const textWalker = document.createTreeWalker( | ||
this, | ||
NodeFilter.SHOW_TEXT, | ||
null, | ||
false | ||
); | ||
// eslint-disable-next-line no-case-declarations | ||
let content = '', | ||
n; | ||
while ((n = textWalker.nextNode())) { | ||
// TODO(sorvell): can't use textContent since we patch it on Node.prototype! | ||
@@ -235,3 +252,3 @@ // However, should probably patch it only on element. | ||
if (typeof value === 'undefined' || value === null) { | ||
value = '' | ||
value = ''; | ||
} | ||
@@ -245,3 +262,6 @@ switch (this.nodeType) { | ||
// Note: old Chrome versions require 2nd argument here | ||
this[NATIVE_PREFIX + 'insertBefore'](document.createTextNode(value), undefined); | ||
this[NATIVE_PREFIX + 'insertBefore']( | ||
document.createTextNode(value), | ||
undefined | ||
); | ||
} | ||
@@ -254,4 +274,4 @@ break; | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -266,10 +286,7 @@ } | ||
'cloneNode', | ||
'contains' | ||
'contains', | ||
]); | ||
// NOTE, on some browsers IE 11 / Edge 15 some properties are incorrectly on HTMLElement | ||
copyProperties(HTMLElement.prototype, [ | ||
'parentElement', | ||
'contains' | ||
]); | ||
copyProperties(HTMLElement.prototype, ['parentElement', 'contains']); | ||
@@ -282,3 +299,3 @@ const ParentNodeWalkerDescriptors = { | ||
return elementWalker.firstChild(); | ||
} | ||
}, | ||
}, | ||
@@ -290,3 +307,3 @@ lastElementChild: { | ||
return elementWalker.lastChild(); | ||
} | ||
}, | ||
}, | ||
@@ -304,3 +321,3 @@ children: { | ||
return utils.createPolyfilledHTMLCollection(nodes); | ||
} | ||
}, | ||
}, | ||
@@ -314,4 +331,4 @@ childElementCount: { | ||
return 0; | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
@@ -327,3 +344,3 @@ | ||
'innerHTML', | ||
'className' | ||
'className', | ||
]); | ||
@@ -335,3 +352,3 @@ | ||
'innerHTML', | ||
'className' | ||
'className', | ||
]); | ||
@@ -346,3 +363,3 @@ } else { | ||
return elementWalker.previousSibling(); | ||
} | ||
}, | ||
}, | ||
@@ -354,3 +371,3 @@ nextElementSibling: { | ||
return elementWalker.nextSibling(); | ||
} | ||
}, | ||
}, | ||
@@ -365,15 +382,25 @@ innerHTML: { | ||
set(value) { | ||
const content = this.localName === 'template' ? | ||
/** @type {HTMLTemplateElement} */(this).content : this; | ||
const content = | ||
this.localName === 'template' | ||
? /** @type {HTMLTemplateElement} */ (this).content | ||
: this; | ||
clearNode(content); | ||
const containerName = this.localName || 'div'; | ||
let htmlContainer; | ||
if (!this.namespaceURI || this.namespaceURI === inertDoc.namespaceURI) { | ||
if ( | ||
!this.namespaceURI || | ||
this.namespaceURI === inertDoc.namespaceURI | ||
) { | ||
htmlContainer = inertDoc.createElement(containerName); | ||
} else { | ||
htmlContainer = inertDoc.createElementNS(this.namespaceURI, containerName); | ||
htmlContainer = inertDoc.createElementNS( | ||
this.namespaceURI, | ||
containerName | ||
); | ||
} | ||
htmlContainer.innerHTML = value; | ||
const newContent = this.localName === 'template' ? | ||
/** @type {HTMLTemplateElement} */(htmlContainer).content : htmlContainer; | ||
const newContent = | ||
this.localName === 'template' | ||
? /** @type {HTMLTemplateElement} */ (htmlContainer).content | ||
: htmlContainer; | ||
let firstChild; | ||
@@ -384,3 +411,3 @@ while ((firstChild = newContent[NATIVE_PREFIX + 'firstChild'])) { | ||
} | ||
} | ||
}, | ||
}, | ||
@@ -395,4 +422,4 @@ className: { | ||
this.setAttribute('class', value); | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -413,6 +440,3 @@ } | ||
// HTMLElement | ||
copyProperties(HTMLElement.prototype, [ | ||
'focus', | ||
'blur' | ||
]); | ||
copyProperties(HTMLElement.prototype, ['focus', 'blur']); | ||
@@ -431,3 +455,6 @@ // HTMLTemplateElement | ||
} else { | ||
defineNativeAccessors(DocumentFragment.prototype, ParentNodeWalkerDescriptors); | ||
defineNativeAccessors( | ||
DocumentFragment.prototype, | ||
ParentNodeWalkerDescriptors | ||
); | ||
} | ||
@@ -440,5 +467,3 @@ | ||
copyProperties(Document.prototype, ParentNodeAccessors); | ||
copyProperties(Document.prototype, [ | ||
'activeElement' | ||
]); | ||
copyProperties(Document.prototype, ['activeElement']); | ||
} else { | ||
@@ -450,6 +475,7 @@ defineNativeAccessors(Document.prototype, ParentNodeWalkerDescriptors); | ||
'importNode', | ||
'getElementById' | ||
'getElementById', | ||
'elementFromPoint', | ||
utils.getPropertyName(Document.prototype, 'elementsFromPoint'), | ||
]); | ||
copyProperties(Document.prototype, ParentNodeMethods); | ||
}; |
@@ -15,2 +15,3 @@ /** | ||
import {SlotablePatches} from './patches/Slotable.js'; | ||
// prettier-ignore | ||
import {ParentNodePatches, ParentNodeDocumentOrFragmentPatches} from './patches/ParentNode.js'; | ||
@@ -52,3 +53,4 @@ import {ChildNodePatches} from './patches/ChildNode.js'; | ||
// and we can patch accessors (hasDescriptors). | ||
const ElementShouldHaveInnerHTML = !utils.settings.hasDescriptors || 'innerHTML' in Element.prototype; | ||
const ElementShouldHaveInnerHTML = | ||
!utils.settings.hasDescriptors || 'innerHTML' in Element.prototype; | ||
@@ -63,12 +65,25 @@ // setup patching | ||
ProcessingInstruction: [SlotablePatches], | ||
Element: [ElementPatches, ParentNodePatches, ChildNodePatches, SlotablePatches, | ||
Element: [ | ||
ElementPatches, | ||
ParentNodePatches, | ||
ChildNodePatches, | ||
SlotablePatches, | ||
ElementShouldHaveInnerHTML ? ElementOrShadowRootPatches : null, | ||
!window.HTMLSlotElement ? SlotPatches : null], | ||
!window.HTMLSlotElement ? SlotPatches : null, | ||
], | ||
HTMLElement: [HTMLElementPatches, NonStandardHTMLElement], | ||
HTMLSlotElement: [SlotPatches], | ||
DocumentFragment: [ParentNodeDocumentOrFragmentPatches, DocumentOrFragmentPatches], | ||
Document: [DocumentPatches, ParentNodeDocumentOrFragmentPatches, DocumentOrFragmentPatches, DocumentOrShadowRootPatches], | ||
DocumentFragment: [ | ||
ParentNodeDocumentOrFragmentPatches, | ||
DocumentOrFragmentPatches, | ||
], | ||
Document: [ | ||
DocumentPatches, | ||
ParentNodeDocumentOrFragmentPatches, | ||
DocumentOrFragmentPatches, | ||
DocumentOrShadowRootPatches, | ||
], | ||
Window: [WindowPatches], | ||
CharacterData: [ChildNodePatches], | ||
} | ||
}; | ||
@@ -80,3 +95,5 @@ const getPatchPrototype = (name) => window[name] && window[name].prototype; | ||
// CustomElements polyfill *only* cares about these accessors. | ||
const disallowedNativePatches = utils.settings.hasDescriptors ? null : ['innerHTML', 'textContent']; | ||
const disallowedNativePatches = utils.settings.hasDescriptors | ||
? null | ||
: ['innerHTML', 'textContent']; | ||
@@ -91,4 +108,6 @@ /** | ||
function applyPatchList(proto, list, prefix, disallowed) { | ||
list.forEach(patch => proto && patch && | ||
utils.patchProperties(proto, patch, prefix, disallowed)); | ||
list.forEach( | ||
(patch) => | ||
proto && patch && utils.patchProperties(proto, patch, prefix, disallowed) | ||
); | ||
} | ||
@@ -103,3 +122,3 @@ | ||
} | ||
} | ||
}; | ||
@@ -119,3 +138,3 @@ const PROTO_IS_PATCHED = utils.SHADY_PREFIX + 'protoIsPatched'; | ||
// the type of Node when patching an can always assume we're patching an element. | ||
['Text', 'Comment', 'CDATASection', 'ProcessingInstruction'].forEach(name => { | ||
['Text', 'Comment', 'CDATASection', 'ProcessingInstruction'].forEach((name) => { | ||
const ctor = window[name]; | ||
@@ -140,3 +159,3 @@ const patchedProto = Object.create(ctor.prototype); | ||
return proto; | ||
} | ||
}; | ||
@@ -151,3 +170,4 @@ export const patchNodeProto = (node) => { | ||
// patched, without this check, an <input> element would get the wrong patch. | ||
let proto = nativeProto.hasOwnProperty(PATCHED_PROTO) && nativeProto[PATCHED_PROTO]; | ||
let proto = | ||
nativeProto.hasOwnProperty(PATCHED_PROTO) && nativeProto[PATCHED_PROTO]; | ||
if (!proto) { | ||
@@ -159,7 +179,7 @@ proto = Object.create(nativeProto); | ||
Object.setPrototypeOf(node, proto); | ||
} | ||
}; | ||
export const patchShadowOnElement = () => { | ||
utils.patchProperties(Element.prototype, ElementShadowPatches); | ||
} | ||
}; | ||
@@ -166,0 +186,0 @@ export const addShadyPrefixedProperties = () => { |
@@ -13,2 +13,3 @@ /** | ||
import {NodePatches} from './patches/Node.js'; | ||
// prettier-ignore | ||
import {OutsideDescriptors, InsideDescriptors, TextContentInnerHTMLDescriptors} from './patch-instances.js'; | ||
@@ -43,6 +44,7 @@ import {ParentNodePatches} from './patches/ParentNode.js'; | ||
utils.patchProperties(proto, DocumentOrFragmentPatches, prefix); | ||
} | ||
// Case 2, bad descriptors: Ensure accessors are on ShadowRoot. | ||
// These descriptors are normally used for instance patching but because | ||
// ShadyRoot can always be patched, just do it to the prototype. | ||
} else if (!utils.settings.hasDescriptors) { | ||
else if (!utils.settings.hasDescriptors) { | ||
utils.patchProperties(proto, OutsideDescriptors); | ||
@@ -52,3 +54,3 @@ utils.patchProperties(proto, InsideDescriptors); | ||
} | ||
} | ||
}; | ||
@@ -67,23 +69,19 @@ export const patchShadyRoot = (proto) => { | ||
value: Node.DOCUMENT_FRAGMENT_NODE, | ||
configurable: true | ||
configurable: true, | ||
}, | ||
nodeName: { | ||
value: '#document-fragment', | ||
configurable: true | ||
configurable: true, | ||
}, | ||
nodeValue: { | ||
value: null, | ||
configurable: true | ||
} | ||
configurable: true, | ||
}, | ||
}); | ||
// make undefined | ||
[ | ||
'localName', | ||
'namespaceURI', | ||
'prefix' | ||
].forEach((prop) => { | ||
['localName', 'namespaceURI', 'prefix'].forEach((prop) => { | ||
Object.defineProperty(proto, prop, { | ||
value: undefined, | ||
configurable: true | ||
configurable: true, | ||
}); | ||
@@ -93,7 +91,3 @@ }); | ||
// defer properties to host | ||
[ | ||
'ownerDocument', | ||
'baseURI', | ||
'isConnected' | ||
].forEach((prop) => { | ||
['ownerDocument', 'baseURI', 'isConnected'].forEach((prop) => { | ||
Object.defineProperty(proto, prop, { | ||
@@ -104,5 +98,5 @@ /** @this {ShadowRoot} */ | ||
}, | ||
configurable: true | ||
configurable: true, | ||
}); | ||
}); | ||
} | ||
}; |
@@ -21,3 +21,6 @@ /** | ||
const nextSibling = this[utils.SHADY_PREFIX + 'nextSibling']; | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore'](utils.convertNodesIntoANode(...args), nextSibling); | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), | ||
nextSibling | ||
); | ||
}, | ||
@@ -31,3 +34,6 @@ | ||
} | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore'](utils.convertNodesIntoANode(...args), this); | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), | ||
this | ||
); | ||
}, | ||
@@ -52,4 +58,7 @@ | ||
parentNode[utils.SHADY_PREFIX + 'removeChild'](this); | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore'](utils.convertNodesIntoANode(...args), nextSibling); | ||
parentNode[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), | ||
nextSibling | ||
); | ||
}, | ||
}); |
@@ -16,3 +16,2 @@ /** | ||
export const DocumentPatches = utils.getOwnPropertyDescriptors({ | ||
// note: Though not technically correct, we fast path `importNode` | ||
@@ -36,3 +35,7 @@ // when called on a node not owned by the main document. | ||
if (deep) { | ||
for (let c=node[utils.SHADY_PREFIX + 'firstChild'], nc; c; c = c[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let c = node[utils.SHADY_PREFIX + 'firstChild'], nc; | ||
c; | ||
c = c[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
nc = this[utils.SHADY_PREFIX + 'importNode'](c, true); | ||
@@ -43,4 +46,3 @@ n[utils.SHADY_PREFIX + 'appendChild'](nc); | ||
return n; | ||
} | ||
}); | ||
}, | ||
}); |
@@ -11,6 +11,5 @@ /** | ||
import * as utils from '../utils.js'; | ||
import { query } from './ParentNode.js'; | ||
import {query} from './ParentNode.js'; | ||
export const DocumentOrFragmentPatches = utils.getOwnPropertyDescriptors({ | ||
/** | ||
@@ -24,10 +23,13 @@ * @this {Element} | ||
} | ||
let result = query(this, function(n) { | ||
return n.id == id; | ||
}, function(n) { | ||
return Boolean(n); | ||
})[0]; | ||
let result = query( | ||
this, | ||
function (n) { | ||
return n.id == id; | ||
}, | ||
function (n) { | ||
return Boolean(n); | ||
} | ||
)[0]; | ||
return result || null; | ||
} | ||
}); | ||
}, | ||
}); |
@@ -22,4 +22,29 @@ /** | ||
// Get the element within the given set of roots. | ||
function getElInRoot(roots, el) { | ||
let elRoot; | ||
while ( | ||
el && | ||
!roots.has((elRoot = el[utils.SHADY_PREFIX + 'getRootNode']())) | ||
) { | ||
el = elRoot.host; | ||
} | ||
return el; | ||
} | ||
function getAncestorRoots(docOrRoot) { | ||
const roots = new Set(); | ||
roots.add(docOrRoot); | ||
while (utils.isShadyRoot(docOrRoot) && docOrRoot.host) { | ||
docOrRoot = docOrRoot.host[utils.SHADY_PREFIX + 'getRootNode'](); | ||
roots.add(docOrRoot); | ||
} | ||
return roots; | ||
} | ||
const elementsFromPointProperty = | ||
utils.NATIVE_PREFIX + | ||
utils.getPropertyName(Document.prototype, 'elementsFromPoint'); | ||
export const DocumentOrShadowRootPatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Document|ShadowRoot} */ | ||
@@ -34,3 +59,3 @@ get activeElement() { | ||
} | ||
let isShadyRoot = !!(utils.isShadyRoot(this)); | ||
let isShadyRoot = !!utils.isShadyRoot(this); | ||
if (this !== document) { | ||
@@ -45,4 +70,6 @@ // If this node isn't a document or shady root, then it doesn't have | ||
// then it doesn't have an active element. | ||
if (this.host === active || | ||
!this.host[utils.NATIVE_PREFIX + 'contains'](active)) { | ||
if ( | ||
this.host === active || | ||
!this.host[utils.NATIVE_PREFIX + 'contains'](active) | ||
) { | ||
return null; | ||
@@ -67,3 +94,28 @@ } | ||
} | ||
} | ||
}, | ||
/** @this {Document|ShadowRoot} */ | ||
elementsFromPoint(x, y) { | ||
const nativeResult = utils.arrayFrom( | ||
document[elementsFromPointProperty](x, y) | ||
); | ||
// Filter native result to return the element in this root | ||
// OR an above root. | ||
// Set containing this root and its ancestor roots. | ||
const ancestorRoots = getAncestorRoots(this); | ||
// Use a Set since the elements can repeat. | ||
const rootedResult = new Set(); | ||
for (let i = 0; i < nativeResult.length; i++) { | ||
rootedResult.add(getElInRoot(ancestorRoots, nativeResult[i])); | ||
} | ||
// Note, for IE compat avoid Array.from(set). | ||
const r = []; | ||
rootedResult.forEach((x) => r.push(x)); | ||
return r; | ||
}, | ||
/** @this {Document|ShadowRoot} */ | ||
elementFromPoint(x, y) { | ||
return this[utils.SHADY_PREFIX + 'elementsFromPoint'](x, y)[0] || null; | ||
}, | ||
}); |
@@ -15,2 +15,3 @@ /** | ||
import {attachShadow, ownerShadyRootForNode} from '../attach-shadow.js'; | ||
// prettier-ignore | ||
import {eventPropertyNamesForElement, wrappedDescriptorForEventProperty} from '../patch-events.js'; | ||
@@ -43,3 +44,2 @@ | ||
export const ElementPatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Element} */ | ||
@@ -124,8 +124,7 @@ get previousElementSibling() { | ||
} | ||
} | ||
}, | ||
}); | ||
if (!utils.settings.preferPerformance) { | ||
eventPropertyNamesForElement.forEach(property => { | ||
eventPropertyNamesForElement.forEach((property) => { | ||
ElementPatches[property] = wrappedDescriptorForEventProperty(property); | ||
@@ -158,3 +157,3 @@ }); | ||
const nodeData = shadyDataForNode(this); | ||
return nodeData && nodeData.publicRoot || null; | ||
return (nodeData && nodeData.publicRoot) || null; | ||
}, | ||
@@ -161,0 +160,0 @@ }); |
@@ -19,8 +19,9 @@ /** | ||
export const ElementOrShadowRootPatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Element} */ | ||
get innerHTML() { | ||
if (utils.isTrackingLogicalChildNodes(this)) { | ||
const content = this.localName === 'template' ? | ||
/** @type {HTMLTemplateElement} */(this).content : this; | ||
const content = | ||
this.localName === 'template' | ||
? /** @type {HTMLTemplateElement} */ (this).content | ||
: this; | ||
return getInnerHTML(content, utils.childNodesArray); | ||
@@ -46,3 +47,6 @@ } else { | ||
} else { | ||
htmlContainer = inertDoc.createElementNS(this.namespaceURI, containerName); | ||
htmlContainer = inertDoc.createElementNS( | ||
this.namespaceURI, | ||
containerName | ||
); | ||
} | ||
@@ -59,4 +63,3 @@ if (utils.settings.hasDescriptors) { | ||
} | ||
} | ||
}, | ||
}); |
@@ -12,6 +12,6 @@ /** | ||
import * as utils from '../utils.js'; | ||
// prettier-ignore | ||
import {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js'; | ||
export const EventTargetPatches = utils.getOwnPropertyDescriptors({ | ||
dispatchEvent, | ||
@@ -21,4 +21,3 @@ | ||
removeEventListener | ||
}); | ||
removeEventListener, | ||
}); |
@@ -12,2 +12,3 @@ /** | ||
import * as utils from '../utils.js'; | ||
// prettier-ignore | ||
import {eventPropertyNamesForHTMLElement, wrappedDescriptorForEventProperty} from '../patch-events.js'; | ||
@@ -17,3 +18,2 @@ import {shadyDataForNode} from '../shady-data.js'; | ||
export const HTMLElementPatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {HTMLElement} */ | ||
@@ -29,10 +29,9 @@ blur() { | ||
} | ||
} | ||
}, | ||
}); | ||
if (!utils.settings.preferPerformance) { | ||
eventPropertyNamesForHTMLElement.forEach(property => { | ||
eventPropertyNamesForHTMLElement.forEach((property) => { | ||
HTMLElementPatches[property] = wrappedDescriptorForEventProperty(property); | ||
}); | ||
} |
@@ -12,4 +12,4 @@ /** | ||
import * as utils from '../utils.js'; | ||
import {getScopingShim, removeShadyScoping, replaceShadyScoping, | ||
treeVisitor, currentScopeForNode, currentScopeIsCorrect } from '../style-scoping.js'; | ||
// prettier-ignore | ||
import {getScopingShim, removeShadyScoping, replaceShadyScoping, treeVisitor, currentScopeForNode, currentScopeIsCorrect} from '../style-scoping.js'; | ||
import {shadyDataForNode, ensureShadyDataForNode} from '../shady-data.js'; | ||
@@ -23,8 +23,9 @@ import {recordInsertBefore, recordRemoveChild} from '../link-nodes.js'; | ||
const nativeIsConnectedAccessors = | ||
/** @type {ObjectPropertyDescriptor} */( | ||
Object.getOwnPropertyDescriptor(Node.prototype, 'isConnected') | ||
); | ||
const nativeIsConnectedAccessors = /** @type {ObjectPropertyDescriptor} */ (Object.getOwnPropertyDescriptor( | ||
Node.prototype, | ||
'isConnected' | ||
)); | ||
const nativeIsConnected = nativeIsConnectedAccessors && nativeIsConnectedAccessors.get; | ||
const nativeIsConnected = | ||
nativeIsConnectedAccessors && nativeIsConnectedAccessors.get; | ||
@@ -41,3 +42,7 @@ export function clearNode(node) { | ||
if (hasCachedOwnerRoot(node)) { | ||
for (let n=node[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = node[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
removeOwnerShadyRoot(n); | ||
@@ -73,4 +78,5 @@ } | ||
if (flattened) { | ||
composed = flattened.length ? flattened[0] : | ||
firstComposedNode(node[utils.SHADY_PREFIX + 'nextSibling']); | ||
composed = flattened.length | ||
? flattened[0] | ||
: firstComposedNode(node[utils.SHADY_PREFIX + 'nextSibling']); | ||
} | ||
@@ -107,3 +113,2 @@ } | ||
export const NodePatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Node} */ | ||
@@ -151,3 +156,7 @@ get parentNode() { | ||
nodeData.childNodes = []; | ||
for (let n=this[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = this[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
nodeData.childNodes.push(n); | ||
@@ -160,5 +169,5 @@ } | ||
} | ||
childNodes.item = function(index) { | ||
childNodes.item = function (index) { | ||
return childNodes[index]; | ||
} | ||
}; | ||
return childNodes; | ||
@@ -193,3 +202,7 @@ }, | ||
while (node && !(node instanceof Document)) { | ||
node = node[utils.SHADY_PREFIX + 'parentNode'] || (utils.isShadyRoot(node) ? /** @type {ShadowRoot} */(node).host : undefined); | ||
node = | ||
node[utils.SHADY_PREFIX + 'parentNode'] || | ||
(utils.isShadyRoot(node) | ||
? /** @type {ShadowRoot} */ (node).host | ||
: undefined); | ||
} | ||
@@ -203,3 +216,7 @@ return !!(node && node instanceof Document); | ||
let tc = []; | ||
for (let n=this[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = this[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
if (n.nodeType !== Node.COMMENT_NODE) { | ||
@@ -221,3 +238,3 @@ tc.push(n[utils.SHADY_PREFIX + 'textContent']); | ||
if (typeof value === 'undefined' || value === null) { | ||
value = '' | ||
value = ''; | ||
} | ||
@@ -227,7 +244,12 @@ switch (this.nodeType) { | ||
case Node.DOCUMENT_FRAGMENT_NODE: | ||
if (!utils.isTrackingLogicalChildNodes(this) && utils.settings.hasDescriptors) { | ||
if ( | ||
!utils.isTrackingLogicalChildNodes(this) && | ||
utils.settings.hasDescriptors | ||
) { | ||
// may be removing a nested slot but fast path if we know we are not. | ||
const firstChild = this[utils.SHADY_PREFIX + 'firstChild']; | ||
if (firstChild != this[utils.SHADY_PREFIX + 'lastChild'] || | ||
(firstChild && firstChild.nodeType != Node.TEXT_NODE)) { | ||
if ( | ||
firstChild != this[utils.SHADY_PREFIX + 'lastChild'] || | ||
(firstChild && firstChild.nodeType != Node.TEXT_NODE) | ||
) { | ||
clearNode(this); | ||
@@ -240,3 +262,5 @@ } | ||
if (value.length > 0 || this.nodeType === Node.ELEMENT_NODE) { | ||
this[utils.SHADY_PREFIX + 'insertBefore'](document.createTextNode(value)) | ||
this[utils.SHADY_PREFIX + 'insertBefore']( | ||
document.createTextNode(value) | ||
); | ||
} | ||
@@ -269,3 +293,5 @@ } | ||
if (node === this) { | ||
throw Error(`Failed to execute 'appendChild' on 'Node': The new child element contains the parent.`); | ||
throw Error( | ||
`Failed to execute 'appendChild' on 'Node': The new child element contains the parent.` | ||
); | ||
} | ||
@@ -275,6 +301,11 @@ if (ref_node) { | ||
const p = refData && refData.parentNode; | ||
if ((p !== undefined && p !== this) || | ||
(p === undefined && ref_node[utils.NATIVE_PREFIX + 'parentNode'] !== this)) { | ||
throw Error(`Failed to execute 'insertBefore' on 'Node': The node ` + | ||
`before which the new node is to be inserted is not a child of this node.`); | ||
if ( | ||
(p !== undefined && p !== this) || | ||
(p === undefined && | ||
ref_node[utils.NATIVE_PREFIX + 'parentNode'] !== this) | ||
) { | ||
throw Error( | ||
`Failed to execute 'insertBefore' on 'Node': The node ` + | ||
`before which the new node is to be inserted is not a child of this node.` | ||
); | ||
} | ||
@@ -290,3 +321,5 @@ } | ||
/** @type {string} */ | ||
const newScopeName = ownerRoot ? ownerRoot.host.localName : currentScopeForNode(this); | ||
const newScopeName = ownerRoot | ||
? ownerRoot.host.localName | ||
: currentScopeForNode(this); | ||
/** @type {string} */ | ||
@@ -313,10 +346,13 @@ let oldScopeName; | ||
let allowNativeInsert = true; | ||
const needsScoping = (!preferPerformance || | ||
const needsScoping = | ||
(!preferPerformance || | ||
// Under preferPerformance, only re-scope if we're not coming from a | ||
// pre-scoped doc fragment or back into a pre-scoped doc fragment | ||
(node['__noInsertionPoint'] === undefined && | ||
this['__noInsertionPoint'] === undefined)) && | ||
!currentScopeIsCorrect(node, newScopeName); | ||
const needsSlotFinding = ownerRoot && !node['__noInsertionPoint'] && | ||
(!preferPerformance || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE); | ||
this['__noInsertionPoint'] === undefined)) && | ||
!currentScopeIsCorrect(node, newScopeName); | ||
const needsSlotFinding = | ||
ownerRoot && | ||
!node['__noInsertionPoint'] && | ||
(!preferPerformance || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE); | ||
if (needsSlotFinding || needsScoping) { | ||
@@ -338,3 +374,3 @@ // NOTE: avoid node.removeChild as this *can* trigger another patched | ||
if (needsSlotFinding && node.localName === 'slot') { | ||
slotsAdded.push(/** @type {!HTMLSlotElement} */(node)); | ||
slotsAdded.push(/** @type {!HTMLSlotElement} */ (node)); | ||
} | ||
@@ -365,5 +401,6 @@ if (needsScoping) { | ||
} | ||
} | ||
// when inserting into a slot inside a shadowRoot, render the | ||
// containing shadowRoot to update fallback content. | ||
} else if (ownerRoot && this.localName === 'slot') { | ||
else if (ownerRoot && this.localName === 'slot') { | ||
allowNativeInsert = false; | ||
@@ -375,4 +412,5 @@ ownerRoot._asyncRender(); | ||
// if adding to a shadyRoot, add to host instead | ||
let container = utils.isShadyRoot(this) ? | ||
/** @type {ShadowRoot} */(this).host : this; | ||
let container = utils.isShadyRoot(this) | ||
? /** @type {ShadowRoot} */ (this).host | ||
: this; | ||
// if ref_node, get the ref_node that's actually in composed dom. | ||
@@ -385,2 +423,3 @@ if (ref_node) { | ||
} | ||
} | ||
// Since ownerDocument is not patched, it can be incorrect after this call | ||
@@ -390,3 +429,3 @@ // if the node is physically appended via distribution. This can result | ||
// We correct this by calling `adoptNode`. | ||
} else if (node.ownerDocument !== this.ownerDocument) { | ||
else if (node.ownerDocument !== this.ownerDocument) { | ||
this.ownerDocument.adoptNode(node); | ||
@@ -422,4 +461,5 @@ } | ||
if (node[utils.SHADY_PREFIX + 'parentNode'] !== this) { | ||
throw Error('The node to be removed is not a child of this node: ' + | ||
node); | ||
throw Error( | ||
'The node to be removed is not a child of this node: ' + node | ||
); | ||
} | ||
@@ -429,3 +469,4 @@ scheduleObserver(this, null, node); | ||
let ownerRoot = ownerShadyRootForNode(node); | ||
const removingInsertionPoint = ownerRoot && ownerRoot._removeContainedSlots(node); | ||
const removingInsertionPoint = | ||
ownerRoot && ownerRoot._removeContainedSlots(node); | ||
const parentData = shadyDataForNode(this); | ||
@@ -441,4 +482,8 @@ if (utils.isTrackingLogicalChildNodes(this)) { | ||
// is not going to be rescoped in `insertBefore` | ||
if (getScopingShim() && !skipUnscoping && ownerRoot | ||
&& node.nodeType !== Node.TEXT_NODE) { | ||
if ( | ||
getScopingShim() && | ||
!skipUnscoping && | ||
ownerRoot && | ||
node.nodeType !== Node.TEXT_NODE | ||
) { | ||
const oldScopeName = currentScopeForNode(node); | ||
@@ -462,5 +507,5 @@ treeVisitor(node, (node) => { | ||
// if removing from a shadyRoot, remove from host instead | ||
let container = utils.isShadyRoot(this) ? | ||
/** @type {ShadowRoot} */(this).host : | ||
this; | ||
let container = utils.isShadyRoot(this) | ||
? /** @type {ShadowRoot} */ (this).host | ||
: this; | ||
// not guaranteed to physically be in container; e.g. | ||
@@ -470,4 +515,6 @@ // (1) if parent has a shadyRoot, element may or may not at distributed | ||
// (2) if parent is a slot, element may not ben in composed dom | ||
if (!(parentData.root || node.localName === 'slot') || | ||
(container === node[utils.NATIVE_PREFIX + 'parentNode'])) { | ||
if ( | ||
!(parentData.root || node.localName === 'slot') || | ||
container === node[utils.NATIVE_PREFIX + 'parentNode'] | ||
) { | ||
container[utils.NATIVE_PREFIX + 'removeChild'](node); | ||
@@ -503,3 +550,7 @@ } | ||
if (deep && n.nodeType !== Node.ATTRIBUTE_NODE) { | ||
for (let c=this[utils.SHADY_PREFIX + 'firstChild'], nc; c; c = c[utils.SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let c = this[utils.SHADY_PREFIX + 'firstChild'], nc; | ||
c; | ||
c = c[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
nc = c[utils.SHADY_PREFIX + 'cloneNode'](true); | ||
@@ -518,3 +569,3 @@ n[utils.SHADY_PREFIX + 'appendChild'](nc); | ||
// TODO(sorvell): implement `options` e.g. `{ composed: boolean }` | ||
getRootNode(options) { // eslint-disable-line no-unused-vars | ||
getRootNode(options) { | ||
if (!this || !this.nodeType) { | ||
@@ -531,3 +582,5 @@ return; | ||
let parent = this[utils.SHADY_PREFIX + 'parentNode']; | ||
root = parent ? parent[utils.SHADY_PREFIX + 'getRootNode'](options) : this; | ||
root = parent | ||
? parent[utils.SHADY_PREFIX + 'getRootNode'](options) | ||
: this; | ||
// memo-ize result for performance but only memo-ize | ||
@@ -542,3 +595,2 @@ // result if node is in the document. This avoids a problem where a root | ||
} | ||
} | ||
@@ -551,4 +603,3 @@ return root; | ||
return utils.contains(this, node); | ||
} | ||
}, | ||
}); |
@@ -21,4 +21,3 @@ /** | ||
let list = []; | ||
queryChildNodes(node, matcher, | ||
halter, list); | ||
queryChildNodes(node, matcher, halter, list); | ||
return list; | ||
@@ -28,5 +27,11 @@ } | ||
function queryChildNodes(parent, matcher, halter, list) { | ||
for (let n = parent[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
if (n.nodeType === Node.ELEMENT_NODE && | ||
queryElement(n, matcher, halter, list)) { | ||
for ( | ||
let n = parent[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
if ( | ||
n.nodeType === Node.ELEMENT_NODE && | ||
queryElement(n, matcher, halter, list) | ||
) { | ||
return true; | ||
@@ -45,4 +50,3 @@ } | ||
} | ||
queryChildNodes(node, matcher, | ||
halter, list); | ||
queryChildNodes(node, matcher, halter, list); | ||
} | ||
@@ -52,3 +56,2 @@ | ||
export const ParentNodePatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Element} */ | ||
@@ -87,6 +90,7 @@ get firstElementChild() { | ||
} | ||
return utils.createPolyfilledHTMLCollection(Array.prototype.filter.call( | ||
utils.childNodesArray(this), (n) => { | ||
return (n.nodeType === Node.ELEMENT_NODE); | ||
})); | ||
return utils.createPolyfilledHTMLCollection( | ||
Array.prototype.filter.call(utils.childNodesArray(this), (n) => { | ||
return n.nodeType === Node.ELEMENT_NODE; | ||
}) | ||
); | ||
}, | ||
@@ -97,3 +101,3 @@ | ||
let children = this[utils.SHADY_PREFIX + 'children']; | ||
if(children) { | ||
if (children) { | ||
return children.length; | ||
@@ -106,3 +110,6 @@ } | ||
append(...args) { | ||
this[utils.SHADY_PREFIX + 'insertBefore'](utils.convertNodesIntoANode(...args), null); | ||
this[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), | ||
null | ||
); | ||
}, | ||
@@ -113,3 +120,5 @@ | ||
this[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), this[utils.SHADY_PREFIX + 'firstChild']); | ||
utils.convertNodesIntoANode(...args), | ||
this[utils.SHADY_PREFIX + 'firstChild'] | ||
); | ||
}, | ||
@@ -123,5 +132,7 @@ | ||
} | ||
this[utils.SHADY_PREFIX + 'insertBefore'](utils.convertNodesIntoANode(...args), null); | ||
this[utils.SHADY_PREFIX + 'insertBefore']( | ||
utils.convertNodesIntoANode(...args), | ||
null | ||
); | ||
}, | ||
}); | ||
@@ -137,7 +148,11 @@ | ||
// match selector and halt on first result. | ||
let result = query(this, function(n) { | ||
return utils.matchesSelector(n, selector); | ||
}, function(n) { | ||
return Boolean(n); | ||
})[0]; | ||
let result = query( | ||
this, | ||
function (n) { | ||
return utils.matchesSelector(n, selector); | ||
}, | ||
function (n) { | ||
return Boolean(n); | ||
} | ||
)[0]; | ||
return result || null; | ||
@@ -156,11 +171,16 @@ }, | ||
if (useNative) { | ||
const o = Array.prototype.slice.call(this[utils.NATIVE_PREFIX + 'querySelectorAll'](selector)); | ||
const o = Array.prototype.slice.call( | ||
this[utils.NATIVE_PREFIX + 'querySelectorAll'](selector) | ||
); | ||
const root = this[utils.SHADY_PREFIX + 'getRootNode'](); | ||
return utils.createPolyfilledHTMLCollection(o.filter(e => e[utils.SHADY_PREFIX + 'getRootNode']() == root)); | ||
return utils.createPolyfilledHTMLCollection( | ||
o.filter((e) => e[utils.SHADY_PREFIX + 'getRootNode']() == root) | ||
); | ||
} | ||
return utils.createPolyfilledHTMLCollection(query(this, function(n) { | ||
return utils.matchesSelector(n, selector); | ||
})); | ||
} | ||
return utils.createPolyfilledHTMLCollection( | ||
query(this, function (n) { | ||
return utils.matchesSelector(n, selector); | ||
}) | ||
); | ||
}, | ||
}); | ||
@@ -173,5 +193,6 @@ | ||
export const ParentNodeDocumentOrFragmentPatches = | ||
(utils.settings.preferPerformance && !utils.settings.noPatch) ? | ||
utils.assign({}, ParentNodePatches) : ParentNodePatches; | ||
utils.settings.preferPerformance && !utils.settings.noPatch | ||
? utils.assign({}, ParentNodePatches) | ||
: ParentNodePatches; | ||
utils.assign(ParentNodePatches, QueryPatches); |
@@ -14,3 +14,2 @@ /** | ||
export const ShadowRootPatches = utils.getOwnPropertyDescriptors({ | ||
/** | ||
@@ -25,8 +24,12 @@ * @this {ShadowRoot} | ||
optionsOrCapture = { | ||
capture: Boolean(optionsOrCapture) | ||
} | ||
capture: Boolean(optionsOrCapture), | ||
}; | ||
} | ||
// Note, `__shadyTarget` may already be set if an event was added on a <slot> child | ||
optionsOrCapture.__shadyTarget = optionsOrCapture.__shadyTarget || this; | ||
this.host[utils.SHADY_PREFIX + 'addEventListener'](type, fn, optionsOrCapture); | ||
this.host[utils.SHADY_PREFIX + 'addEventListener']( | ||
type, | ||
fn, | ||
optionsOrCapture | ||
); | ||
}, | ||
@@ -43,10 +46,13 @@ | ||
optionsOrCapture = { | ||
capture: Boolean(optionsOrCapture) | ||
} | ||
capture: Boolean(optionsOrCapture), | ||
}; | ||
} | ||
// Note, `__shadyTarget` may already be set if an event was added on a <slot> child | ||
optionsOrCapture.__shadyTarget = optionsOrCapture.__shadyTarget || this; | ||
this.host[utils.SHADY_PREFIX + 'removeEventListener'](type, fn, optionsOrCapture); | ||
} | ||
this.host[utils.SHADY_PREFIX + 'removeEventListener']( | ||
type, | ||
fn, | ||
optionsOrCapture | ||
); | ||
}, | ||
}); |
@@ -16,3 +16,2 @@ /** | ||
export const SlotPatches = utils.getOwnPropertyDescriptors({ | ||
/** | ||
@@ -31,6 +30,7 @@ * @this {HTMLSlotElement} | ||
const nodeData = shadyDataForNode(this); | ||
return nodeData ? | ||
((options && options.flatten ? nodeData.flattenedNodes : | ||
nodeData.assignedNodes) || []) : | ||
[]; | ||
return nodeData | ||
? (options && options.flatten | ||
? nodeData.flattenedNodes | ||
: nodeData.assignedNodes) || [] | ||
: []; | ||
} | ||
@@ -53,11 +53,17 @@ }, | ||
optionsOrCapture = { | ||
capture: Boolean(optionsOrCapture) | ||
} | ||
capture: Boolean(optionsOrCapture), | ||
}; | ||
} | ||
const parent = this[utils.SHADY_PREFIX + 'parentNode']; | ||
if (!parent) { | ||
throw new Error('ShadyDOM cannot attach event to slot unless it has a `parentNode`'); | ||
throw new Error( | ||
'ShadyDOM cannot attach event to slot unless it has a `parentNode`' | ||
); | ||
} | ||
optionsOrCapture.__shadyTarget = this; | ||
parent[utils.SHADY_PREFIX + 'addEventListener'](type, fn, optionsOrCapture); | ||
parent[utils.SHADY_PREFIX + 'addEventListener']( | ||
type, | ||
fn, | ||
optionsOrCapture | ||
); | ||
} | ||
@@ -80,14 +86,19 @@ }, | ||
optionsOrCapture = { | ||
capture: Boolean(optionsOrCapture) | ||
} | ||
capture: Boolean(optionsOrCapture), | ||
}; | ||
} | ||
const parent = this[utils.SHADY_PREFIX + 'parentNode']; | ||
if (!parent) { | ||
throw new Error('ShadyDOM cannot attach event to slot unless it has a `parentNode`'); | ||
throw new Error( | ||
'ShadyDOM cannot attach event to slot unless it has a `parentNode`' | ||
); | ||
} | ||
optionsOrCapture.__shadyTarget = this; | ||
parent[utils.SHADY_PREFIX + 'removeEventListener'](type, fn, optionsOrCapture); | ||
parent[utils.SHADY_PREFIX + 'removeEventListener']( | ||
type, | ||
fn, | ||
optionsOrCapture | ||
); | ||
} | ||
} | ||
}, | ||
}); |
@@ -15,3 +15,2 @@ /** | ||
export const SlotablePatches = utils.getOwnPropertyDescriptors({ | ||
/** @this {Node} */ | ||
@@ -27,5 +26,4 @@ get assignedSlot() { | ||
const nodeData = shadyDataForNode(this); | ||
return nodeData && nodeData.assignedSlot || null; | ||
} | ||
return (nodeData && nodeData.assignedSlot) || null; | ||
}, | ||
}); |
@@ -11,6 +11,6 @@ /** | ||
import * as utils from '../utils.js'; | ||
// prettier-ignore | ||
import {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js'; | ||
export const WindowPatches = utils.getOwnPropertyDescriptors({ | ||
// Ensure that `dispatchEvent` is patched directly on Window since on | ||
@@ -25,4 +25,3 @@ // IE11, Window does not descend from EventTarget. | ||
removeEventListener: removeEventListener.bind(window) | ||
}); | ||
removeEventListener: removeEventListener.bind(window), | ||
}); |
@@ -11,5 +11,3 @@ /** | ||
export class ShadyData { | ||
/** @override */ | ||
@@ -16,0 +14,0 @@ toJSON() { |
@@ -23,4 +23,7 @@ /** | ||
import {flush, enqueue} from './flush.js'; | ||
// prettier-ignore | ||
import {observeChildren, unobserveChildren, filterMutations} from './observe-changes.js'; | ||
// prettier-ignore | ||
import {addNativePrefixedProperties, nativeMethods, nativeTree} from './patch-native.js'; | ||
// prettier-ignore | ||
import {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js'; | ||
@@ -30,13 +33,14 @@ import {patchEvents, patchClick, composedPath} from './patch-events.js'; | ||
import {wrap, Wrapper} from './wrapper.js'; | ||
// prettier-ignore | ||
import {addShadyPrefixedProperties, applyPatches, patchShadowOnElement, patchElementProto} from './patch-prototypes.js'; | ||
if (utils.settings.inUse) { | ||
const patch = utils.settings.hasDescriptors | ||
? (n) => n | ||
: (node) => { | ||
patchInsideElementAccessors(node); | ||
patchOutsideElementAccessors(node); | ||
return node; | ||
}; | ||
const patch = utils.settings.hasDescriptors ? n => n : (node) => { | ||
patchInsideElementAccessors(node); | ||
patchOutsideElementAccessors(node); | ||
return node; | ||
}; | ||
let ShadyDOM = { | ||
@@ -96,3 +100,3 @@ // TODO(sorvell): remove when Polymer does not depend on this. | ||
// performance. | ||
'wrapIfNeeded': utils.settings.noPatch === true ? wrap : n => n, | ||
'wrapIfNeeded': utils.settings.noPatch === true ? wrap : (n) => n, | ||
'Wrapper': Wrapper, | ||
@@ -119,3 +123,3 @@ 'composedPath': composedPath, | ||
'nativeTree': nativeTree, | ||
'patchElementProto': patchElementProto | ||
'patchElementProto': patchElementProto, | ||
}; | ||
@@ -156,3 +160,3 @@ | ||
// Patch click event behavior only if we're patching | ||
patchClick() | ||
patchClick(); | ||
} else if (utils.settings.patchOnDemand) { | ||
@@ -172,3 +176,3 @@ // In `on-demand` patching, do patch `attachShadow` and `shadowRoot`. | ||
window.ShadowRoot = /** @type {function(new:ShadowRoot)} */(ShadyRoot); | ||
window.ShadowRoot = /** @type {function(new:ShadowRoot)} */ (ShadyRoot); | ||
} |
@@ -90,5 +90,8 @@ /** | ||
let correctScope = true; | ||
for (let n=node[utils.SHADY_PREFIX + 'firstChild']; n; n = n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
correctScope = correctScope && | ||
currentScopeIsCorrect(n, newScopeName); | ||
for ( | ||
let n = node[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
correctScope = correctScope && currentScopeIsCorrect(n, newScopeName); | ||
} | ||
@@ -133,3 +136,7 @@ return correctScope; | ||
} | ||
for (let n = node[utils.SHADY_PREFIX + 'firstChild']; n; (n = n[utils.SHADY_PREFIX + 'nextSibling'])) { | ||
for ( | ||
let n = node[utils.SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[utils.SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
if (n.nodeType === Node.ELEMENT_NODE) { | ||
@@ -139,2 +146,2 @@ treeVisitor(n, visitorFn); | ||
} | ||
} | ||
} |
114
src/utils.js
@@ -15,23 +15,26 @@ /** | ||
settings.hasNativeShadowDOM = Boolean(Element.prototype.attachShadow && Node.prototype.getRootNode); | ||
settings.hasNativeShadowDOM = Boolean( | ||
Element.prototype.attachShadow && Node.prototype.getRootNode | ||
); | ||
// The user might need to pass the custom elements polyfill a flag by setting an | ||
// object to `customElements`, so check for `customElements.define` also. | ||
export const hasCustomElements = | ||
() => Boolean(window.customElements && window.customElements.define); | ||
export const hasCustomElements = () => | ||
Boolean(window.customElements && window.customElements.define); | ||
// The custom elements polyfill is typically loaded after Shady DOM, so this | ||
// check isn't reliable during initial evaluation. However, because the | ||
// polyfills are loaded immediately after one another, it works at runtime. | ||
export const hasPolyfilledCustomElements = | ||
() => Boolean(window.customElements && window.customElements['polyfillWrapFlushCallback']); | ||
export const hasPolyfilledCustomElements = () => | ||
Boolean( | ||
window.customElements && window.customElements['polyfillWrapFlushCallback'] | ||
); | ||
const desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild'); | ||
/* eslint-disable */ | ||
settings.hasDescriptors = Boolean(desc && desc.configurable && desc.get); | ||
settings.inUse = settings['force'] || !settings.hasNativeShadowDOM; | ||
settings.noPatch = /** @type {string|boolean} */(settings['noPatch'] || false); | ||
settings.noPatch = /** @type {string|boolean} */ (settings['noPatch'] || false); | ||
// eslint-disable-next-line no-self-assign | ||
settings.preferPerformance = settings['preferPerformance']; | ||
settings.patchOnDemand = (settings.noPatch === 'on-demand'); | ||
/* eslint-enable */ | ||
settings.patchOnDemand = settings.noPatch === 'on-demand'; | ||
@@ -41,2 +44,8 @@ const IS_IE = navigator.userAgent.match('Trident'); | ||
// Helper for prefixed properties. | ||
export const getPropertyName = (obj, name) => { | ||
const prefixed = `ms${name[0].toUpperCase() + name.slice(1)}`; | ||
return obj[prefixed] ? prefixed : name; | ||
}; | ||
export const canUpgrade = () => !settings.IS_IE; | ||
@@ -46,6 +55,6 @@ | ||
const nodeData = shadyDataForNode(node); | ||
return (nodeData && nodeData.firstChild !== undefined); | ||
} | ||
return nodeData && nodeData.firstChild !== undefined; | ||
}; | ||
export const isShadyRoot = obj => obj instanceof ShadowRoot; | ||
export const isShadyRoot = (obj) => obj instanceof ShadowRoot; | ||
@@ -55,13 +64,17 @@ export const hasShadowRootWithSlot = (node) => { | ||
let root = nodeData && nodeData.root; | ||
return (root && root._hasInsertionPoint()); | ||
} | ||
return root && root._hasInsertionPoint(); | ||
}; | ||
let p = Element.prototype; | ||
let matches = p.matches || p.matchesSelector || | ||
p.mozMatchesSelector || p.msMatchesSelector || | ||
p.oMatchesSelector || p.webkitMatchesSelector; | ||
let matches = | ||
p.matches || | ||
p.matchesSelector || | ||
p.mozMatchesSelector || | ||
p.msMatchesSelector || | ||
p.oMatchesSelector || | ||
p.webkitMatchesSelector; | ||
export const matchesSelector = (element, selector) => { | ||
return matches.call(element, selector); | ||
} | ||
}; | ||
@@ -73,3 +86,3 @@ export const mixin = (target, source) => { | ||
return target; | ||
} | ||
}; | ||
@@ -86,6 +99,6 @@ // NOTE, prefer MutationObserver over Promise for microtask timing | ||
queue.shift()(); | ||
} catch(e) { | ||
} catch (e) { | ||
// enqueue another record and throw | ||
twiddle.textContent = content++; | ||
throw(e); | ||
throw e; | ||
} | ||
@@ -99,3 +112,3 @@ } | ||
twiddle.textContent = content++; | ||
} | ||
}; | ||
@@ -107,6 +120,6 @@ /** @type {function(!Document, !Node): boolean} */ | ||
} else { | ||
return (doc, node) => ( | ||
return (doc, node) => | ||
doc === node || | ||
(doc.documentElement && doc.documentElement[NATIVE_PREFIX + 'contains'](node)) | ||
); | ||
(doc.documentElement && | ||
doc.documentElement[NATIVE_PREFIX + 'contains'](node)); | ||
} | ||
@@ -123,6 +136,6 @@ })(); | ||
return false; | ||
} | ||
}; | ||
const getNodeHTMLCollectionName = (node) => | ||
node.getAttribute('id') || node.getAttribute('name'); | ||
node.getAttribute('id') || node.getAttribute('name'); | ||
@@ -141,6 +154,6 @@ const isValidHTMLCollectionName = (name) => name !== 'length' && isNaN(name); | ||
} | ||
nodes.item = function(index) { | ||
nodes.item = function (index) { | ||
return nodes[index]; | ||
} | ||
nodes.namedItem = function(name) { | ||
}; | ||
nodes.namedItem = function (name) { | ||
if (isValidHTMLCollectionName(name) && nodes[name]) { | ||
@@ -161,3 +174,3 @@ return nodes[name]; | ||
return nodes; | ||
} | ||
}; | ||
@@ -169,15 +182,23 @@ export const NATIVE_PREFIX = '__shady_native_'; | ||
const result = []; | ||
for (let n=parent[NATIVE_PREFIX + 'firstChild']; n; n = n[NATIVE_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = parent[NATIVE_PREFIX + 'firstChild']; | ||
n; | ||
n = n[NATIVE_PREFIX + 'nextSibling'] | ||
) { | ||
result.push(n); | ||
} | ||
return result; | ||
} | ||
}; | ||
export const childNodesArray = (parent) => { | ||
const result = []; | ||
for (let n=parent[SHADY_PREFIX + 'firstChild']; n; n = n[SHADY_PREFIX + 'nextSibling']) { | ||
for ( | ||
let n = parent[SHADY_PREFIX + 'firstChild']; | ||
n; | ||
n = n[SHADY_PREFIX + 'nextSibling'] | ||
) { | ||
result.push(n); | ||
} | ||
return result; | ||
} | ||
}; | ||
@@ -194,7 +215,7 @@ const patchProperty = (proto, name, descriptor) => { | ||
Object.defineProperty(proto, name, descriptor); | ||
} catch(e) { | ||
} catch (e) { | ||
// this error is harmless so we just trap it. | ||
} | ||
} | ||
} | ||
}; | ||
@@ -208,3 +229,8 @@ /** | ||
*/ | ||
export const patchProperties = (proto, descriptors, prefix = '', disallowedPatches) => { | ||
export const patchProperties = ( | ||
proto, | ||
descriptors, | ||
prefix = '', | ||
disallowedPatches | ||
) => { | ||
for (let name in descriptors) { | ||
@@ -214,5 +240,5 @@ if (disallowedPatches && disallowedPatches.indexOf(name) >= 0) { | ||
} | ||
patchProperty(proto, prefix + name, descriptors[name]); | ||
patchProperty(proto, prefix + name, descriptors[name]); | ||
} | ||
} | ||
}; | ||
@@ -222,6 +248,6 @@ export const patchExistingProperties = (proto, descriptors) => { | ||
if (name in proto) { | ||
patchProperty(proto, name, descriptors[name]); | ||
patchProperty(proto, name, descriptors[name]); | ||
} | ||
} | ||
} | ||
}; | ||
@@ -247,3 +273,3 @@ // note, this is not a perfect polyfill since it doesn't include symbols | ||
export const arrayFrom = (object) => { | ||
return [].slice.call(/** @type {IArrayLike} */(object)); | ||
return [].slice.call(/** @type {IArrayLike} */ (object)); | ||
}; | ||
@@ -261,3 +287,3 @@ | ||
// argument type `(number|string)`. | ||
return !(arg instanceof Node) ? document.createTextNode("" + arg) : arg; | ||
return !(arg instanceof Node) ? document.createTextNode('' + arg) : arg; | ||
}; | ||
@@ -264,0 +290,0 @@ |
@@ -12,2 +12,3 @@ /** | ||
import * as utils from './utils.js'; | ||
// prettier-ignore | ||
import {eventPropertyNamesForElement, eventPropertyNamesForHTMLElement} from './patch-events.js'; | ||
@@ -17,3 +18,2 @@ | ||
class Wrapper { | ||
/** @param {!Node} node */ | ||
@@ -26,7 +26,15 @@ constructor(node) { | ||
addEventListener(name, fn, options) { | ||
return this.node[utils.SHADY_PREFIX + 'addEventListener'](name, fn, options); | ||
return this.node[utils.SHADY_PREFIX + 'addEventListener']( | ||
name, | ||
fn, | ||
options | ||
); | ||
} | ||
removeEventListener(name, fn, options) { | ||
return this.node[utils.SHADY_PREFIX + 'removeEventListener'](name, fn, options); | ||
return this.node[utils.SHADY_PREFIX + 'removeEventListener']( | ||
name, | ||
fn, | ||
options | ||
); | ||
} | ||
@@ -91,3 +99,6 @@ | ||
get activeElement() { | ||
if (utils.isShadyRoot(this.node) || this.node.nodeType === Node.DOCUMENT_NODE) { | ||
if ( | ||
utils.isShadyRoot(this.node) || | ||
this.node.nodeType === Node.DOCUMENT_NODE | ||
) { | ||
const e = this.node[utils.SHADY_PREFIX + 'activeElement']; | ||
@@ -133,2 +144,10 @@ return e; | ||
elementsFromPoint(x, y) { | ||
return this.node[utils.SHADY_PREFIX + 'elementsFromPoint'](x, y); | ||
} | ||
elementFromPoint(x, y) { | ||
return this.node[utils.SHADY_PREFIX + 'elementFromPoint'](x, y); | ||
} | ||
// query | ||
@@ -140,3 +159,6 @@ querySelector(selector) { | ||
querySelectorAll(selector, useNative) { | ||
return this.node[utils.SHADY_PREFIX + 'querySelectorAll'](selector, useNative); | ||
return this.node[utils.SHADY_PREFIX + 'querySelectorAll']( | ||
selector, | ||
useNative | ||
); | ||
} | ||
@@ -153,3 +175,3 @@ | ||
if (utils.isShadyRoot(this.node)) { | ||
return /** @type {!ShadowRoot} */(this.node).host; | ||
return /** @type {!ShadowRoot} */ (this.node).host; | ||
} | ||
@@ -252,3 +274,3 @@ return undefined; | ||
set className(value) { | ||
return this.node[utils.SHADY_PREFIX + 'className'] = value; | ||
this.node[utils.SHADY_PREFIX + 'className'] = value; | ||
} | ||
@@ -283,3 +305,2 @@ | ||
} | ||
} | ||
@@ -297,8 +318,10 @@ | ||
}, | ||
configurable: true | ||
configurable: true, | ||
}); | ||
}; | ||
eventPropertyNamesForElement.forEach(name => addEventPropertyWrapper(name)); | ||
eventPropertyNamesForHTMLElement.forEach(name => addEventPropertyWrapper(name)); | ||
eventPropertyNamesForElement.forEach((name) => addEventPropertyWrapper(name)); | ||
eventPropertyNamesForHTMLElement.forEach((name) => | ||
addEventPropertyWrapper(name) | ||
); | ||
@@ -313,3 +336,3 @@ export {Wrapper}; | ||
} | ||
let wrapper = wrapperMap.get(obj) | ||
let wrapper = wrapperMap.get(obj); | ||
if (!wrapper) { | ||
@@ -316,0 +339,0 @@ wrapper = new Wrapper(obj); |
Sorry, the diff of this file is not supported yet
527149
38
5463
58