Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skatejs-named-slots

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skatejs-named-slots - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

src/v1/index.js

919

dist/index-with-deps.js

@@ -62,66 +62,441 @@ (function webpackUniversalModuleDefinition(root, factory) {

});
exports.v1 = exports.v0 = undefined;
__webpack_require__(1);
var _debounce = __webpack_require__(2);
var _support = __webpack_require__(2);
var _v = __webpack_require__(3);
var _v2 = _interopRequireDefault(_v);
var _v3 = __webpack_require__(4);
var _v4 = _interopRequireDefault(_v3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// TODO move into the skatejs-web-components package.
if (_support.shadowDomV1) {
// then we should probably not be loading this
} else if (_support.shadowDomV0) {
(0, _v2.default)();
} else {
(0, _v4.default)();
}
exports.v0 = _v2.default;
exports.v1 = _v4.default;
/***/ },
/* 1 */
/***/ function(module, exports) {
'use strict';
// Polyfill for creating CustomEvents on IE9/10/11
// code pulled from:
// https://github.com/d4tocchini/customevent-polyfill
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
try {
var ce = new window.CustomEvent('test');
ce.preventDefault();
if (ce.defaultPrevented !== true) {
// IE has problems with .preventDefault() on custom events
// http://stackoverflow.com/questions/23349191
throw new Error('Could not prevent default');
}
} catch (e) {
var CustomEvent = function CustomEvent(event, params) {
var evt, origPrevent;
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
origPrevent = evt.preventDefault;
evt.preventDefault = function () {
origPrevent.call(this);
try {
Object.defineProperty(this, 'defaultPrevented', {
get: function get() {
return true;
}
});
} catch (e) {
this.defaultPrevented = true;
}
};
return evt;
};
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent; // expose definition to window
}
/***/ },
/* 2 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var div = document.createElement('div');
var shadowDomV0 = exports.shadowDomV0 = !!div.createShadowRoot;
var shadowDomV1 = exports.shadowDomV1 = !!div.attachShadow;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
__webpack_require__(1);
var $shadowRoot = '__shadowRoot';
exports.default = function () {
// Returns the assigned nodes (unflattened) for a <content> node.
var getAssignedNodes = function getAssignedNodes(node) {
var slot = node.getAttribute('name');
var host = node;
while (host) {
var sr = host[$shadowRoot];
if (sr && sr.contains(node)) {
break;
}
host = host.parentNode;
}
if (!host) {
return [];
}
var chs = host.childNodes;
var chsLen = chs.length;
var filtered = [];
for (var a = 0; a < chsLen; a++) {
var ch = chs[a];
var chSlot = ch.getAttribute ? ch.getAttribute('slot') : null;
if (slot === chSlot) {
filtered.push(ch);
}
}
return filtered;
};
var _HTMLElement$prototyp = HTMLElement.prototype;
var getAttribute = _HTMLElement$prototyp.getAttribute;
var setAttribute = _HTMLElement$prototyp.setAttribute;
var elementInnerHTML = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
var shadowRootInnerHTML = Object.getOwnPropertyDescriptor(ShadowRoot.prototype, 'innerHTML');
// We do this so creating a <slot> actually creates a <content>.
var filterTagName = function filterTagName(name) {
return name === 'slot' ? 'content' : name;
};
var createElement = document.createElement.bind(document);
var createElementNS = document.createElementNS.bind(document);
document.createElement = function (name) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return createElement.apply(undefined, [filterTagName(name)].concat(args));
};
document.createElementNS = function (uri, name) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
return createElementNS.apply(undefined, [uri, filterTagName(name)].concat(args));
};
// Override innerHTML to turn slot nodes into content nodes.
function replaceSlotsWithContents(node) {
var tree = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT);
var repl = [];
// Walk the tree and record nodes that need replacing.
while (tree.nextNode()) {
var currentNode = tree.currentNode;
if (currentNode.tagName === 'SLOT') {
repl.push(currentNode);
}
}
repl.forEach(function (fake) {
var name = fake.getAttribute('name');
var real = document.createElement('slot');
if (name) {
real.setAttribute('name', name);
}
fake.parentNode.replaceChild(real, fake);
while (fake.hasChildNodes()) {
real.appendChild(fake.firstChild);
}
});
}
Object.defineProperty(Element.prototype, 'innerHTML', {
configurable: true,
get: elementInnerHTML.get,
set: function set(html) {
elementInnerHTML.set.call(this, html);
replaceSlotsWithContents(this);
}
});
Object.defineProperty(ShadowRoot.prototype, 'innerHTML', {
configurable: true,
get: shadowRootInnerHTML.get,
set: function set(html) {
shadowRootInnerHTML.set.call(this, html);
replaceSlotsWithContents(this);
}
});
// Node
// ----
Object.defineProperty(Node.prototype, 'assignedSlot', {
get: function get() {
var parentNode = this.parentNode;
if (parentNode) {
var shadowRoot = parentNode.shadowRoot;
// If { mode } is "closed", always return `null`.
if (!shadowRoot) {
return null;
}
var contents = shadowRoot.querySelectorAll('content');
for (var a = 0; a < contents.length; a++) {
var content = contents[a];
if (content.assignedNodes().indexOf(this) > -1) {
return content;
}
}
}
return null;
}
});
// Just proxy createShadowRoot() because there's no such thing as closed
// shadow trees in v0.
HTMLElement.prototype.attachShadow = function attachShadow() {
var _this = this;
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var mode = _ref.mode;
// In v1 you must specify a mode.
if (mode !== 'closed' && mode !== 'open') {
throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');
}
// Proxy native v0.
var sr = this.createShadowRoot();
// In v0 it always defines the shadowRoot property so we must undefine it.
if (mode === 'closed') {
Object.defineProperty(this, 'shadowRoot', {
configurable: true,
get: function get() {
return null;
}
});
}
// For some reason this wasn't being reported as set, but it seems to work
// in dev tools.
Object.defineProperty(sr, 'parentNode', {
get: function get() {
return _this;
}
});
// Add a MutationObserver to trigger slot change events when the element
// is mutated. We only need to listen to the childList because we only care
// about light DOM.
var mo = new MutationObserver(function (muts) {
var root = _this[$shadowRoot];
muts.forEach(function (mut) {
var addedNodes = mut.addedNodes;
var removedNodes = mut.removedNodes;
var slots = {};
var recordSlots = function recordSlots(node) {
return slots[node.getAttribute && node.getAttribute('slot') || '__default'] = true;
};
if (addedNodes) {
var addedNodesLen = addedNodes.length;
for (var a = 0; a < addedNodesLen; a++) {
recordSlots(addedNodes[a]);
}
}
if (removedNodes) {
var removedNodesLen = removedNodes.length;
for (var _a = 0; _a < removedNodesLen; _a++) {
recordSlots(removedNodes[_a]);
}
}
Object.keys(slots).forEach(function (slot) {
var node = slot === '__default' ? root.querySelector('content:not([name])') || root.querySelector('content[name=""]') : root.querySelector('content[name="' + slot + '"]');
if (node) {
node.dispatchEvent(new CustomEvent('slotchange', {
bubbles: false,
cancelable: false
}));
}
});
});
});
mo.observe(this, { childList: true });
return this[$shadowRoot] = sr;
};
// Make like the <slot> name property.
Object.defineProperty(HTMLContentElement.prototype, 'name', {
get: function get() {
return this.getAttribute('name');
},
set: function set(name) {
return this.setAttribute('name', name);
}
});
// Make like the element slot property.
Object.defineProperty(HTMLElement.prototype, 'slot', {
get: function get() {
return this.getAttribute('slot');
},
set: function set(name) {
return this.setAttribute('slot', name);
}
});
// By default, getDistributedNodes() returns a flattened tree (no <slot>
// nodes). That means we get native { deep } but we have to manually do the
// opposite.
HTMLContentElement.prototype.assignedNodes = function assignedNodes() {
var _ref2 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var deep = _ref2.deep;
var cnodes = [];
var dnodes = deep ? this.getDistributedNodes() : getAssignedNodes(this);
// Regardless of how we get the nodes, we must ensure we're only given text
// nodes or element nodes.
for (var a = 0; a < dnodes.length; a++) {
var dnode = dnodes[a];
var dtype = dnode.nodeType;
if (dtype === Node.ELEMENT_NODE || dtype === Node.TEXT_NODE) {
cnodes.push(dnode);
}
}
return cnodes;
};
HTMLContentElement.prototype.getAttribute = function overriddenGetAttribute(name) {
if (name === 'name') {
var select = getAttribute.call(this, 'select');
return select ? select.match(/\[slot=['"]?(.*?)['"]?\]/)[1] : null;
}
return getAttribute.call(this, name);
};
HTMLContentElement.prototype.setAttribute = function overriddenSetAttribute(name, value) {
if (name === 'name') {
name = 'select';
value = '[slot=\'' + value + '\']';
}
return setAttribute.call(this, name, value);
};
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _debounce = __webpack_require__(5);
var _debounce2 = _interopRequireDefault(_debounce);
var _weakmap = __webpack_require__(4);
var _weakmap = __webpack_require__(7);
var _weakmap2 = _interopRequireDefault(_weakmap);
var _each = __webpack_require__(5);
var _each = __webpack_require__(8);
var _support = __webpack_require__(6);
var _canPatchNativeAccessors = __webpack_require__(9);
var _canPatchNativeAccessors = __webpack_require__(7);
var _canPatchNativeAccessors2 = _interopRequireDefault(_canPatchNativeAccessors);
var _getPropertyDescriptor = __webpack_require__(8);
var _getPropertyDescriptor = __webpack_require__(10);
var _getPropertyDescriptor2 = _interopRequireDefault(_getPropertyDescriptor);
var _getEscapedTextContent = __webpack_require__(9);
var _getEscapedTextContent = __webpack_require__(11);
var _getEscapedTextContent2 = _interopRequireDefault(_getEscapedTextContent);
var _getRawTextContent = __webpack_require__(10);
var _getRawTextContent = __webpack_require__(12);
var _getRawTextContent2 = _interopRequireDefault(_getRawTextContent);
var _getCommentNodeOuterHtml = __webpack_require__(11);
var _getCommentNodeOuterHtml = __webpack_require__(13);
var _getCommentNodeOuterHtml2 = _interopRequireDefault(_getCommentNodeOuterHtml);
var _findSlots = __webpack_require__(12);
var _findSlots = __webpack_require__(14);
var _findSlots2 = _interopRequireDefault(_findSlots);
var _isRootNode = __webpack_require__(14);
var _isRootNode = __webpack_require__(16);
var _isRootNode2 = _interopRequireDefault(_isRootNode);
var _isSlotNode = __webpack_require__(13);
var _isSlotNode = __webpack_require__(15);
var _isSlotNode2 = _interopRequireDefault(_isSlotNode);
var _pseudoArrayToArray = __webpack_require__(15);
var _pseudoArrayToArray = __webpack_require__(17);
var _pseudoArrayToArray2 = _interopRequireDefault(_pseudoArrayToArray);
var _v = __webpack_require__(16);
var _v2 = _interopRequireDefault(_v);
var _version = __webpack_require__(17);
var _version2 = _interopRequireDefault(_version);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// TODO move into the skatejs-web-components package.
var arrProto = Array.prototype;

@@ -1026,120 +1401,61 @@ var forEach = arrProto.forEach;

if (_support.shadowDomV1) {
// then we should probably not be loading this
} else if (_support.shadowDomV0) {
(0, _v2.default)();
} else {
(function () {
var commProto = Comment.prototype;
var elementProto = HTMLElement.prototype;
var svgProto = SVGElement.prototype;
var textProto = Text.prototype;
var textNode = document.createTextNode('');
var commNode = document.createComment('');
exports.default = function () {
var commProto = Comment.prototype;
var elementProto = HTMLElement.prototype;
var svgProto = SVGElement.prototype;
var textProto = Text.prototype;
var textNode = document.createTextNode('');
var commNode = document.createComment('');
Object.keys(members).forEach(function (memberName) {
var memberProperty = members[memberName];
Object.keys(members).forEach(function (memberName) {
var memberProperty = members[memberName];
// All properties should be configurable and enumerable.
memberProperty.configurable = true;
memberProperty.enumerable = true;
// All properties should be configurable and enumerable.
memberProperty.configurable = true;
memberProperty.enumerable = true;
// Applying to the data properties only since we can't have writable accessor properties.
if (memberProperty.hasOwnProperty('value')) {
// eslint-disable-line no-prototype-builtins
memberProperty.writable = true;
}
// Applying to the data properties only since we can't have writable accessor properties.
if (memberProperty.hasOwnProperty('value')) {
// eslint-disable-line no-prototype-builtins
memberProperty.writable = true;
}
// Polyfill as much as we can and work around WebKit in other areas.
if (_canPatchNativeAccessors2.default || polyfillAtRuntime.indexOf(memberName) === -1) {
var nativeDescriptor = (0, _getPropertyDescriptor2.default)(elementProto, memberName);
var nativeTextDescriptor = (0, _getPropertyDescriptor2.default)(textProto, memberName);
var nativeCommDescriptor = (0, _getPropertyDescriptor2.default)(commProto, memberName);
var shouldOverrideInTextNode = memberName in textNode && doNotOverridePropertiesInTextNodes.indexOf(memberName) === -1 || ~defineInTextNodes.indexOf(memberName);
var shouldOverrideInCommentNode = memberName in commNode && doNotOverridePropertiesInCommNodes.indexOf(memberName) === -1 || ~defineInCommNodes.indexOf(memberName);
var nativeMemberName = '__' + memberName;
// Polyfill as much as we can and work around WebKit in other areas.
if (_canPatchNativeAccessors2.default || polyfillAtRuntime.indexOf(memberName) === -1) {
var nativeDescriptor = (0, _getPropertyDescriptor2.default)(elementProto, memberName);
var nativeTextDescriptor = (0, _getPropertyDescriptor2.default)(textProto, memberName);
var nativeCommDescriptor = (0, _getPropertyDescriptor2.default)(commProto, memberName);
var shouldOverrideInTextNode = memberName in textNode && doNotOverridePropertiesInTextNodes.indexOf(memberName) === -1 || ~defineInTextNodes.indexOf(memberName);
var shouldOverrideInCommentNode = memberName in commNode && doNotOverridePropertiesInCommNodes.indexOf(memberName) === -1 || ~defineInCommNodes.indexOf(memberName);
var nativeMemberName = '__' + memberName;
Object.defineProperty(elementProto, memberName, memberProperty);
Object.defineProperty(svgProto, memberName, memberProperty);
Object.defineProperty(elementProto, memberName, memberProperty);
Object.defineProperty(svgProto, memberName, memberProperty);
if (nativeDescriptor) {
Object.defineProperty(elementProto, nativeMemberName, nativeDescriptor);
Object.defineProperty(svgProto, nativeMemberName, nativeDescriptor);
}
if (nativeDescriptor) {
Object.defineProperty(elementProto, nativeMemberName, nativeDescriptor);
Object.defineProperty(svgProto, nativeMemberName, nativeDescriptor);
}
if (shouldOverrideInTextNode) {
Object.defineProperty(textProto, memberName, memberProperty);
}
if (shouldOverrideInTextNode) {
Object.defineProperty(textProto, memberName, memberProperty);
}
if (shouldOverrideInTextNode && nativeTextDescriptor) {
Object.defineProperty(textProto, nativeMemberName, nativeTextDescriptor);
}
if (shouldOverrideInTextNode && nativeTextDescriptor) {
Object.defineProperty(textProto, nativeMemberName, nativeTextDescriptor);
}
if (shouldOverrideInCommentNode) {
Object.defineProperty(commProto, memberName, memberProperty);
}
if (shouldOverrideInCommentNode) {
Object.defineProperty(commProto, memberName, memberProperty);
}
if (shouldOverrideInCommentNode && nativeCommDescriptor) {
Object.defineProperty(commProto, nativeMemberName, nativeCommDescriptor);
}
}
});
})();
}
exports.default = _version2.default;
/***/ },
/* 1 */
/***/ function(module, exports) {
'use strict';
// Polyfill for creating CustomEvents on IE9/10/11
// code pulled from:
// https://github.com/d4tocchini/customevent-polyfill
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
try {
var ce = new window.CustomEvent('test');
ce.preventDefault();
if (ce.defaultPrevented !== true) {
// IE has problems with .preventDefault() on custom events
// http://stackoverflow.com/questions/23349191
throw new Error('Could not prevent default');
}
} catch (e) {
var CustomEvent = function CustomEvent(event, params) {
var evt, origPrevent;
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
origPrevent = evt.preventDefault;
evt.preventDefault = function () {
origPrevent.call(this);
try {
Object.defineProperty(this, 'defaultPrevented', {
get: function get() {
return true;
}
});
} catch (e) {
this.defaultPrevented = true;
if (shouldOverrideInCommentNode && nativeCommDescriptor) {
Object.defineProperty(commProto, nativeMemberName, nativeCommDescriptor);
}
};
return evt;
};
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent; // expose definition to window
}
}
});
};
/***/ },
/* 2 */
/* 5 */
/***/ function(module, exports, __webpack_require__) {

@@ -1153,3 +1469,3 @@

var now = __webpack_require__(3);
var now = __webpack_require__(6);

@@ -1204,3 +1520,3 @@ /**

/***/ },
/* 3 */
/* 6 */
/***/ function(module, exports) {

@@ -1217,3 +1533,3 @@

/***/ },
/* 4 */
/* 7 */
/***/ function(module, exports, __webpack_require__) {

@@ -1456,3 +1772,3 @@

/***/ },
/* 5 */
/* 8 */
/***/ function(module, exports) {

@@ -1513,16 +1829,3 @@

/***/ },
/* 6 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var div = document.createElement('div');
var shadowDomV0 = exports.shadowDomV0 = !!div.createShadowRoot;
var shadowDomV1 = exports.shadowDomV1 = !!div.attachShadow;
/***/ },
/* 7 */
/* 9 */
/***/ function(module, exports, __webpack_require__) {

@@ -1536,3 +1839,3 @@

var _getPropertyDescriptor = __webpack_require__(8);
var _getPropertyDescriptor = __webpack_require__(10);

@@ -1549,3 +1852,3 @@ var _getPropertyDescriptor2 = _interopRequireDefault(_getPropertyDescriptor);

/***/ },
/* 8 */
/* 10 */
/***/ function(module, exports) {

@@ -1602,3 +1905,3 @@

/***/ },
/* 9 */
/* 11 */
/***/ function(module, exports) {

@@ -1622,3 +1925,3 @@

/***/ },
/* 10 */
/* 12 */
/***/ function(module, exports) {

@@ -1641,3 +1944,3 @@

/***/ },
/* 11 */
/* 13 */
/***/ function(module, exports) {

@@ -1660,3 +1963,3 @@

/***/ },
/* 12 */
/* 14 */
/***/ function(module, exports, __webpack_require__) {

@@ -1671,5 +1974,5 @@

var _support = __webpack_require__(6);
var _support = __webpack_require__(2);
var _isSlotNode = __webpack_require__(13);
var _isSlotNode = __webpack_require__(15);

@@ -1711,3 +2014,3 @@ var _isSlotNode2 = _interopRequireDefault(_isSlotNode);

/***/ },
/* 13 */
/* 15 */
/***/ function(module, exports) {

@@ -1726,3 +2029,3 @@

/***/ },
/* 14 */
/* 16 */
/***/ function(module, exports) {

@@ -1741,3 +2044,3 @@

/***/ },
/* 15 */
/* 17 */
/***/ function(module, exports) {

@@ -1755,300 +2058,2 @@

/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
__webpack_require__(1);
var $shadowRoot = '__shadowRoot';
exports.default = function () {
// Returns the assigned nodes (unflattened) for a <content> node.
var getAssignedNodes = function getAssignedNodes(node) {
var slot = node.getAttribute('name');
var host = node;
while (host) {
var sr = host[$shadowRoot];
if (sr && sr.contains(node)) {
break;
}
host = host.parentNode;
}
if (!host) {
return [];
}
var chs = host.childNodes;
var chsLen = chs.length;
var filtered = [];
for (var a = 0; a < chsLen; a++) {
var ch = chs[a];
var chSlot = ch.getAttribute ? ch.getAttribute('slot') : null;
if (slot === chSlot) {
filtered.push(ch);
}
}
return filtered;
};
var _HTMLElement$prototyp = HTMLElement.prototype;
var getAttribute = _HTMLElement$prototyp.getAttribute;
var setAttribute = _HTMLElement$prototyp.setAttribute;
var elementInnerHTML = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
var shadowRootInnerHTML = Object.getOwnPropertyDescriptor(ShadowRoot.prototype, 'innerHTML');
// We do this so creating a <slot> actually creates a <content>.
var filterTagName = function filterTagName(name) {
return name === 'slot' ? 'content' : name;
};
var createElement = document.createElement.bind(document);
var createElementNS = document.createElementNS.bind(document);
document.createElement = function (name) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return createElement.apply(undefined, [filterTagName(name)].concat(args));
};
document.createElementNS = function (uri, name) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
return createElementNS.apply(undefined, [uri, filterTagName(name)].concat(args));
};
// Override innerHTML to turn slot nodes into content nodes.
function replaceSlotsWithContents(node) {
var tree = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT);
var repl = [];
// Walk the tree and record nodes that need replacing.
while (tree.nextNode()) {
var currentNode = tree.currentNode;
if (currentNode.tagName === 'SLOT') {
repl.push(currentNode);
}
}
repl.forEach(function (fake) {
var name = fake.getAttribute('name');
var real = document.createElement('slot');
if (name) {
real.setAttribute('name', name);
}
fake.parentNode.replaceChild(real, fake);
while (fake.hasChildNodes()) {
real.appendChild(fake.firstChild);
}
});
}
Object.defineProperty(Element.prototype, 'innerHTML', {
configurable: true,
get: elementInnerHTML.get,
set: function set(html) {
elementInnerHTML.set.call(this, html);
replaceSlotsWithContents(this);
}
});
Object.defineProperty(ShadowRoot.prototype, 'innerHTML', {
configurable: true,
get: shadowRootInnerHTML.get,
set: function set(html) {
shadowRootInnerHTML.set.call(this, html);
replaceSlotsWithContents(this);
}
});
// Node
// ----
Object.defineProperty(Node.prototype, 'assignedSlot', {
get: function get() {
var parentNode = this.parentNode;
if (parentNode) {
var shadowRoot = parentNode.shadowRoot;
// If { mode } is "closed", always return `null`.
if (!shadowRoot) {
return null;
}
var contents = shadowRoot.querySelectorAll('content');
for (var a = 0; a < contents.length; a++) {
var content = contents[a];
if (content.assignedNodes().indexOf(this) > -1) {
return content;
}
}
}
return null;
}
});
// Just proxy createShadowRoot() because there's no such thing as closed
// shadow trees in v0.
HTMLElement.prototype.attachShadow = function attachShadow() {
var _this = this;
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var mode = _ref.mode;
// In v1 you must specify a mode.
if (mode !== 'closed' && mode !== 'open') {
throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');
}
// Proxy native v0.
var sr = this.createShadowRoot();
// In v0 it always defines the shadowRoot property so we must undefine it.
if (mode === 'closed') {
Object.defineProperty(this, 'shadowRoot', {
configurable: true,
get: function get() {
return null;
}
});
}
// For some reason this wasn't being reported as set, but it seems to work
// in dev tools.
Object.defineProperty(sr, 'parentNode', {
get: function get() {
return _this;
}
});
// Add a MutationObserver to trigger slot change events when the element
// is mutated. We only need to listen to the childList because we only care
// about light DOM.
var mo = new MutationObserver(function (muts) {
var root = _this[$shadowRoot];
muts.forEach(function (mut) {
var addedNodes = mut.addedNodes;
var removedNodes = mut.removedNodes;
var slots = {};
var recordSlots = function recordSlots(node) {
return slots[node.getAttribute && node.getAttribute('slot') || '__default'] = true;
};
if (addedNodes) {
var addedNodesLen = addedNodes.length;
for (var a = 0; a < addedNodesLen; a++) {
recordSlots(addedNodes[a]);
}
}
if (removedNodes) {
var removedNodesLen = removedNodes.length;
for (var _a = 0; _a < removedNodesLen; _a++) {
recordSlots(removedNodes[_a]);
}
}
Object.keys(slots).forEach(function (slot) {
var node = slot === '__default' ? root.querySelector('content:not([name])') || root.querySelector('content[name=""]') : root.querySelector('content[name="' + slot + '"]');
if (node) {
node.dispatchEvent(new CustomEvent('slotchange', {
bubbles: false,
cancelable: false
}));
}
});
});
});
mo.observe(this, { childList: true });
return this[$shadowRoot] = sr;
};
// Make like the <slot> name property.
Object.defineProperty(HTMLContentElement.prototype, 'name', {
get: function get() {
return this.getAttribute('name');
},
set: function set(name) {
return this.setAttribute('name', name);
}
});
// Make like the element slot property.
Object.defineProperty(HTMLElement.prototype, 'slot', {
get: function get() {
return this.getAttribute('slot');
},
set: function set(name) {
return this.setAttribute('slot', name);
}
});
// By default, getDistributedNodes() returns a flattened tree (no <slot>
// nodes). That means we get native { deep } but we have to manually do the
// opposite.
HTMLContentElement.prototype.assignedNodes = function assignedNodes() {
var _ref2 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var deep = _ref2.deep;
var cnodes = [];
var dnodes = deep ? this.getDistributedNodes() : getAssignedNodes(this);
// Regardless of how we get the nodes, we must ensure we're only given text
// nodes or element nodes.
for (var a = 0; a < dnodes.length; a++) {
var dnode = dnodes[a];
var dtype = dnode.nodeType;
if (dtype === Node.ELEMENT_NODE || dtype === Node.TEXT_NODE) {
cnodes.push(dnode);
}
}
return cnodes;
};
HTMLContentElement.prototype.getAttribute = function overriddenGetAttribute(name) {
if (name === 'name') {
var select = getAttribute.call(this, 'select');
return select ? select.match(/\[slot=['"]?(.*?)['"]?\]/)[1] : null;
}
return getAttribute.call(this, name);
};
HTMLContentElement.prototype.setAttribute = function overriddenSetAttribute(name, value) {
if (name === 'name') {
name = 'select';
value = '[slot=\'' + value + '\']';
}
return setAttribute.call(this, name, value);
};
};
/***/ },
/* 17 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = '0.0.1';
/***/ }

@@ -2055,0 +2060,0 @@ /******/ ])

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.skatejsNamedSlots=t():e.skatejsNamedSlots=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=document.createElement("div");if(R["default"])return t.__innerHTML=e,t;for(var n=Oe.parseFromString("<div>"+e+"</div>","text/html").body.firstChild;n.hasChildNodes();){var r=n.firstChild;n.removeChild(r),t.appendChild(r)}return document.importNode(t,!0)}function i(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n}})}function u(e){return this[e]}function a(e){return e.item=u,e}function l(e){return!!_e.get(e)}function s(e){return l(e)?"host":(0,Q["default"])(e)?"slot":(0,J["default"])(e)?"root":"node"}function c(e,t){for(;e&&e!==document;){if(t(e))return e;e=e.parentNode}}function d(e){return e.getAttribute&&e.getAttribute("name")||"default"}function f(e){return e.getAttribute&&e.getAttribute("slot")||"default"}function h(e,t,n){if(he.indexOf(t.nodeType)!==-1){var r=e.assignedNodes(),o=0===r.length,i=r.indexOf(n);ye.set(t,e),o&&ue.call(e.childNodes,function(t){return e.__removeChild(t)}),i>-1?(e.__insertBefore(t,void 0!==n?n:null),r.splice(i,0,t)):(e.__appendChild(t),r.push(t)),e.____triggerSlotChangeEvent()}}function p(e){var t=ye.get(e);if(t){var n=t.assignedNodes(),r=n.indexOf(e);if(r>-1){var o=1===n.length;n.splice(r,1),ye.set(e,null),t.__removeChild(e),o&&ue.call(t.childNodes,function(e){return t.__appendChild(e)}),t.____triggerSlotChangeEvent()}}}function v(e,t){for(var n=e.childNodes,r=n.length,o=0;o<r;o++)if(n[o]===t)return o;return-1}function _(e,t,n,r){var o=v(e,n);(0,k.eachNodeOrFragmentNodes)(t,function(t,n){r(t,n),R["default"]?me.set(t,e):i(t,"parentNode",e),o>-1?ie.splice.call(e.childNodes,o+n,0,t):ie.push.call(e.childNodes,t)})}function g(e,t,n){var r=v(e,t);r>-1&&(n(t,0),R["default"]?me.set(t,null):i(t,"parentNode",null),ie.splice.call(e.childNodes,r,1))}function m(e,t,n){_(e,t,n,function(t){e.__insertBefore(t,void 0!==n?n:null)})}function y(e,t,n){_(e,t,n,function(t){var r=_e.get(e),o=be.get(r),i=o[f(t)];i&&h(i,t,n)})}function N(e,t){var n=d(t);R["default"]||Array.isArray(t.childNodes)||i(t,"childNodes",(0,ee["default"])(t.childNodes)),be.get(e)[n]=t,Ee.has(t)||Ee.set(t,e),(0,k.eachChildNode)(Ne.get(e),function(e){e.assignedSlot||n!==f(e)||h(t,e)})}function b(e,t,n){(0,k.eachNodeOrFragmentNodes)(t,function(t){if((0,Q["default"])(t))N(e,t);else{var n=(0,$["default"])(t);if(n)for(var r=n.length,o=0;o<r;o++)N(e,n[o])}}),m(e,t,n)}function E(e,t,n){var r=0===e.assignedNodes().length;_(e,t,n,function(t){r&&e.__insertBefore(t,void 0!==n?n:null)})}function O(e,t){var n=0===e.assignedNodes().length;g(e,t,function(){n&&e.__removeChild(t)})}function C(e,t){g(e,t,function(){e.__removeChild(t)})}function w(e,t){g(e,t,function(){p(t)})}function T(e,t){var n=Array.prototype.slice.call(t.assignedNodes());n.forEach(p),delete be.get(e)[d(t)],Ee["delete"](t)}function j(e,t){g(e,t,function(){if((0,Q["default"])(t))T(e,t);else{var n=(0,$["default"])(t);if(n)for(var r=0;r<n.length;r++)T(e,n[r])}e.__removeChild(t)})}function M(e){if((0,J["default"])(e))return e;if(e.parentNode)return M(e.parentNode)}function A(e,t,n){var r=s(e),o=t.parentNode,u=M(e);return R["default"]||Array.isArray(e.childNodes)||i(e,"childNodes",(0,ee["default"])(e.childNodes)),u&&"slot"===s(t)&&N(u,t),o&&"host"===s(o)&&(R["default"]?me.set(t,null):i(t,"parentNode",null)),"node"===r?R["default"]?(me.set(t,e),e.__insertBefore(t,void 0!==n?n:null)):m(e,t,n):"slot"===r?E(e,t,n):"host"===r?y(e,t,n):"root"===r?b(e,t,n):void 0}function L(e){if(R["default"]&&"slot"===s(e)&&e.__childNodes.length!==e.childNodes.length){for(;e.hasChildNodes();)e.removeChild(e.firstChild);ue.call(e.__childNodes,function(t){return e.appendChild(t)})}}Object.defineProperty(t,"__esModule",{value:!0}),n(1);var P=n(2),S=r(P),x=n(4),D=r(x),k=n(5),H=n(6),F=n(7),R=r(F),W=n(8),V=r(W),B=n(9),q=r(B),X=n(10),G=r(X),I=n(11),Y=r(I),U=n(12),$=r(U),z=n(14),J=r(z),K=n(13),Q=r(K),Z=n(15),ee=r(Z),te=n(16),ne=r(te),re=n(17),oe=r(re),ie=Array.prototype,ue=ie.forEach,ae="_shadow_root_",le=["childNodes","parentNode"],se=["textContent"],ce=["assignedSlot"],de=["textContent"],fe=[],he=[Node.ELEMENT_NODE,Node.TEXT_NODE],pe=new D["default"],ve=new D["default"],_e=new D["default"],ge=new D["default"],me=new D["default"],ye=new D["default"],Ne=new D["default"],be=new D["default"],Ee=new D["default"],Oe=new DOMParser,Ce={____assignedNodes:{get:function(){return this.______assignedNodes||(this.______assignedNodes=[])}},____isInFallbackMode:{get:function(){return 0===this.assignedNodes().length}},____slotChangeListeners:{get:function(){return"undefined"==typeof this.______slotChangeListeners&&(this.______slotChangeListeners=0),this.______slotChangeListeners},set:function(e){this.______slotChangeListeners=e}},____triggerSlotChangeEvent:{value:(0,S["default"])(function(){this.____slotChangeListeners&&this.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})},addEventListener:{value:function(e,t,n){return"slotchange"===e&&(0,Q["default"])(this)&&this.____slotChangeListeners++,this.__addEventListener(e,t,n)}},appendChild:{value:function(e){return A(this,e),e}},assignedSlot:{get:function(){var e=ye.get(this);if(!e)return null;var t=Ee.get(e),n=Ne.get(t),r=ve.get(n);return"open"===r?e:null}},attachShadow:{value:function(e){var t=this,n=e&&e.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=_e.get(this);if(r)return r;var o=a([].slice.call(this.childNodes)),u=document.createElement(e.polyfillShadowRootTagName||ae);return ve.set(this,n),_e.set(this,u),Ne.set(u,this),be.set(u,{}),R["default"]?ge.set(this,o):i(this,"childNodes",o),o.forEach(function(e){t.__removeChild(e),R["default"]?me.set(e,t):i(e,"parentNode",t)}),this.__appendChild(u)}},childElementCount:{get:function(){return this.children.length}},childNodes:{get:function(){if(R["default"]&&"node"===s(this))return this.__childNodes;var e=ge.get(this);return e||ge.set(this,e=a([])),e}},children:{get:function(){var e=[];return(0,k.eachChildNode)(this,function(t){1===t.nodeType&&e.push(t)}),a(e)}},firstChild:{get:function(){return this.childNodes[0]||null}},firstElementChild:{get:function(){return this.children[0]||null}},assignedNodes:{value:function(){if((0,Q["default"])(this)){var e=pe.get(this);return e||pe.set(this,e=[]),e}}},hasChildNodes:{value:function(){return this.childNodes.length>0}},innerHTML:{get:function(){function e(e){return e.nodeType===Node.ELEMENT_NODE&&e.nodeName.toLowerCase()in o}var t="",n=function(e){return e.outerHTML},r={};r[Node.ELEMENT_NODE]=n,r[Node.COMMENT_NODE]=Y["default"];var o={style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,noscript:!0,plaintext:!0},i=e(this);return(0,k.eachChildNode)(this,function(e){var o=void 0;o=e.nodeType===Node.TEXT_NODE?i?G["default"]:q["default"]:r[e.nodeType]||n,t+=o(e)}),t},set:function(e){for(var t=o(e);this.hasChildNodes();)this.removeChild(this.firstChild);var n=(0,$["default"])(t);for(ue.call(n,function(e){return L(e)});t.hasChildNodes();){var r=t.firstChild;t.removeChild(r),this.appendChild(r)}}},insertBefore:{value:function(e,t){return A(this,e,t),e}},lastChild:{get:function(){var e=this.childNodes;return e[e.length-1]||null}},lastElementChild:{get:function(){var e=this.children;return e[e.length-1]||null}},name:{get:function(){return this.getAttribute("name")},set:function(e){var t=this.name,n=this.__setAttribute("name",e);if(e===t)return n;if(!(0,Q["default"])(this))return n;var r=Ee.get(this);return r&&(T(r,this),N(r,this)),n}},nextSibling:{get:function(){var e=this;return(0,k.eachChildNode)(this.parentNode,function(t,n,r){if(e===t)return r[n+1]||null})}},nextElementSibling:{get:function(){var e=this,t=void 0;return(0,k.eachChildNode)(this.parentNode,function(n){return t&&1===n.nodeType?n:void(e===n&&(t=!0))})}},outerHTML:{get:function(){var e=this.tagName.toLowerCase(),t=Array.prototype.slice.call(this.attributes).map(function(e){return" "+e.name+(e.value?'="'+e.value+'"':"")}).join("");return"<"+e+t+">"+this.innerHTML+"</"+e+">"},set:function(e){if(this.parentNode){var t=o(e);this.parentNode.replaceChild(t.firstChild,this)}else{if(!R["default"])throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");this.__outerHTML=e}}},parentElement:{get:function(){return c(this.parentNode,function(e){return 1===e.nodeType})}},parentNode:{get:function(){return me.get(this)||this.__parentNode||null}},previousSibling:{get:function(){var e=this;return(0,k.eachChildNode)(this.parentNode,function(t,n,r){if(e===t)return r[n-1]||null})}},previousElementSibling:{get:function(){var e=this,t=void 0;return(0,k.eachChildNode)(this.parentNode,function(n){return t&&e===n?t:void(1===n.nodeType&&(t=n))})}},removeChild:{value:function(e){var t=s(this);switch(t){case"node":if(R["default"])return me.set(e,null),this.__removeChild(e);C(this,e);break;case"slot":O(this,e);break;case"host":w(this,e);break;case"root":j(this,e)}return e}},removeEventListener:{value:function(e,t,n){return"slotchange"===e&&this.____slotChangeListeners&&(0,Q["default"])(this)&&this.____slotChangeListeners--,this.__removeEventListener(e,t,n)}},replaceChild:{value:function(e,t){return this.insertBefore(e,t),this.removeChild(t)}},setAttribute:{value:function(e,t){return"slot"===e&&(this[e]=t),(0,Q["default"])(this)&&"name"===e&&(this[e]=t),this.__setAttribute(e,t)}},shadowRoot:{get:function(){return"open"===ve.get(this)?_e.get(this):null}},slot:{get:function(){return this.getAttribute("slot")},set:function(e){var t=this.name,n=this.__setAttribute("slot",e);if(t===e)return n;var r=ye.get(this),o=r&&Ee.get(r),i=o&&Ne.get(o);return i&&(w(i,this),y(i,this)),n}},textContent:{get:function(){var e="";return(0,k.eachChildNode)(this,function(t){t.nodeType!==Node.COMMENT_NODE&&(e+=t.textContent)}),e},set:function(e){for(;this.hasChildNodes();)this.removeChild(this.firstChild);e&&this.appendChild(document.createTextNode(e))}}};H.shadowDomV1||(H.shadowDomV0?(0,ne["default"])():!function(){var e=Comment.prototype,t=HTMLElement.prototype,n=SVGElement.prototype,r=Text.prototype,o=document.createTextNode(""),i=document.createComment("");Object.keys(Ce).forEach(function(u){var a=Ce[u];if(a.configurable=!0,a.enumerable=!0,a.hasOwnProperty("value")&&(a.writable=!0),R["default"]||le.indexOf(u)===-1){var l=(0,V["default"])(t,u),s=(0,V["default"])(r,u),c=(0,V["default"])(e,u),d=u in o&&se.indexOf(u)===-1||~ce.indexOf(u),f=u in i&&de.indexOf(u)===-1||~fe.indexOf(u),h="__"+u;Object.defineProperty(t,u,a),Object.defineProperty(n,u,a),l&&(Object.defineProperty(t,h,l),Object.defineProperty(n,h,l)),d&&Object.defineProperty(r,u,a),d&&s&&Object.defineProperty(r,h,s),f&&Object.defineProperty(e,u,a),f&&c&&Object.defineProperty(e,h,c)}})}()),t["default"]=oe["default"]},function(e,t){"use strict";try{var n=new window.CustomEvent("test");if(n.preventDefault(),n.defaultPrevented!==!0)throw new Error("Could not prevent default")}catch(r){var o=function(e,t){var n,r;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},n=document.createEvent("CustomEvent"),n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};o.prototype=window.Event.prototype,window.CustomEvent=o}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e,t,n){function o(){var c=r()-l;c<t&&c>0?i=setTimeout(o,t-c):(i=null,n||(s=e.apply(a,u),i||(a=u=null)))}var i,u,a,l,s;return null==t&&(t=100),function(){a=this,u=arguments,l=r();var c=n&&!i;return i||(i=setTimeout(o,t)),c&&(s=e.apply(a,u),a=u=null),s}}},function(e,t){"use strict";function n(){return(new Date).getTime()}e.exports=Date.now||n},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};void function(t,n,o){function i(e,t,n){return"function"==typeof t&&(n=t,t=u(n).replace(/_$/,"")),s(e,t,{configurable:!0,writable:!0,value:n})}function u(e){return"function"!=typeof e?"":"name"in e?e.name:c.call(e).match(h)[1]}function a(e){function t(t,r){return r||2===arguments.length?n.set(t,r):(r=n.get(t),r===o&&(r=e(t),n.set(t,r))),r}var n=new v;return e||(e=_),t}var l=Object.getOwnPropertyNames,s=Object.defineProperty,c=Function.prototype.toString,d=Object.create,f=Object.prototype.hasOwnProperty,h=/^\n?function\s?(\w*)?_?\(/,p=function(){function e(){var e=u(),r={};this.unlock=function(o){var i=c(o);if(f.call(i,e))return i[e](r);var u=d(null,t);return s(i,e,{value:new Function("s","l",n)(r,u)}),u}}var t={value:{writable:!0,value:o}},n="return function(k){if(k===s)return l}",r=d(null),u=function h(){var e=Math.random().toString(36).slice(2);return e in r?h():r[e]=e},a=u(),c=function(e){if(f.call(e,a))return e[a];if(!Object.isExtensible(e))throw new TypeError("Object must be extensible");var t=d(null);return s(e,a,{value:t}),t};return i(Object,function(e){var t=l(e);return f.call(e,a)&&t.splice(t.indexOf(a),1),t}),i(e.prototype,function(e){return this.unlock(e).value}),i(e.prototype,function(e,t){this.unlock(e).value=t}),e}(),v=function(e){function a(e){return this===t||null==this||this===a.prototype?new a(e):(v(this,new p),void g(this,e))}function l(e){h(e);var t=_(this).get(e);return t===n?o:t}function s(e,t){h(e),_(this).set(e,t===o?n:t)}function c(e){return h(e),_(this).get(e)!==o}function d(e){h(e);var t=_(this),n=t.get(e)!==o;return t.set(e,o),n}function f(){return _(this),"[object WeakMap]"}var h=function(e){if(null==e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e)throw new TypeError("Invalid WeakMap key")},v=function(t,n){var r=e.unlock(t);if(r.value)throw new TypeError("Object is already a WeakMap");r.value=n},_=function(t){var n=e.unlock(t).value;if(!n)throw new TypeError("WeakMap is not generic");return n},g=function(e,t){null!==t&&"object"===("undefined"==typeof t?"undefined":r(t))&&"function"==typeof t.forEach&&t.forEach(function(n,r){n instanceof Array&&2===n.length&&s.call(e,t[r][0],t[r][1])})};try{var m=("return "+d).replace("e_","\\u0065"),y=new Function("unwrap","validate",m)(_,h)}catch(N){var y=d}var m=(""+Object).split("Object"),b=function(){return m[0]+u(this)+m[1]};i(b,b);var E={__proto__:[]}instanceof Array?function(e){e.__proto__=b}:function(e){i(e,b)};return E(a),[f,l,s,c,y].forEach(function(e){i(a.prototype,e),E(e)}),a}(new p),_=Object.create?function(){return Object.create(null)}:function(){return{}};e.exports=v,v.createStorage=a,t.WeakMap&&(t.WeakMap.createStorage=a)}((0,eval)("this"))},function(e,t){"use strict";function n(e,t){if(e)for(var n=e.childNodes,r=n.length,o=0;o<r;o++){var i=t(n[o],o,n);if("undefined"!=typeof i)return i}}function r(e){for(var t=[],n=e.length-1;n>=0;n--)t.push(e[n]);return t}function o(e,t){if(e instanceof DocumentFragment)for(var n=e.childNodes,o=n.length,i=o-1;i>=0;i--){var u=r(e.childNodes)[i];t(u,i)}else t(e,0)}Object.defineProperty(t,"__esModule",{value:!0}),t.eachChildNode=n,t.eachNodeOrFragmentNodes=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=document.createElement("div");t.shadowDomV0=!!n.createShadowRoot,t.shadowDomV1=!!n.attachShadow},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(8),i=r(o),u=(0,i["default"])(Element.prototype,"innerHTML");t["default"]=!!u},function(e,t){"use strict";function n(e,t){for(var n=void 0;e&&!(n=Object.getOwnPropertyDescriptor(e,t));)e=Object.getPrototypeOf(e);return n}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){e instanceof Node&&(e=r);var o=n(e,t);if(o){var i=o.get,u=o.set,a={configurable:!0,enumerable:!0};if(i)return a.get=i,a.set=u,a;if("function"==typeof e[t])return a.value=e[t],a}var l=Object.getOwnPropertyDescriptor(e,t);if(l&&l.get)return l};var r=document.createElement("div")},function(e,t){"use strict";function n(e){return e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){return e.textContent}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){return e.text||"<!--"+e.textContent+"-->"}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],n=e.childNodes;if(u.shadowDomV0&&!u.shadowDomV1)return[].concat(o(e.querySelectorAll("content")));if(!n||[Node.ELEMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].indexOf(e.nodeType)===-1)return t;for(var r=n.length,a=0;a<r;a++){var s=n[a];(0,l["default"])(s)&&t.push(s),i(s,t)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=n(6),a=n(13),l=r(a)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return"SLOT"===e.tagName}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return"_SHADOW_ROOT_"===e.tagName}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return Array.prototype.slice.call(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(1);var r="__shadowRoot";t["default"]=function(){function e(e){for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=[];t.nextNode();){var r=t.currentNode;"SLOT"===r.tagName&&n.push(r)}n.forEach(function(e){var t=e.getAttribute("name"),n=document.createElement("slot");for(t&&n.setAttribute("name",t),e.parentNode.replaceChild(n,e);e.hasChildNodes();)n.appendChild(e.firstChild)})}var t=function(e){for(var t=e.getAttribute("name"),n=e;n;){var o=n[r];if(o&&o.contains(e))break;n=n.parentNode}if(!n)return[];for(var i=n.childNodes,u=i.length,a=[],l=0;l<u;l++){var s=i[l],c=s.getAttribute?s.getAttribute("slot"):null;t===c&&a.push(s)}return a},n=HTMLElement.prototype,o=n.getAttribute,i=n.setAttribute,u=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),a=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"),l=function(e){return"slot"===e?"content":e},s=document.createElement.bind(document),c=document.createElementNS.bind(document);document.createElement=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return s.apply(void 0,[l(e)].concat(n))},document.createElementNS=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return c.apply(void 0,[e,l(t)].concat(r))},Object.defineProperty(Element.prototype,"innerHTML",{configurable:!0,get:u.get,set:function(t){u.set.call(this,t),e(this)}}),Object.defineProperty(ShadowRoot.prototype,"innerHTML",{configurable:!0,get:a.get,set:function(t){a.set.call(this,t),e(this)}}),Object.defineProperty(Node.prototype,"assignedSlot",{get:function(){var e=this.parentNode;if(e){var t=e.shadowRoot;if(!t)return null;for(var n=t.querySelectorAll("content"),r=0;r<n.length;r++){var o=n[r];if(o.assignedNodes().indexOf(this)>-1)return o}}return null}}),HTMLElement.prototype.attachShadow=function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var o=this.createShadowRoot();"closed"===n&&Object.defineProperty(this,"shadowRoot",{configurable:!0,get:function(){return null}}),Object.defineProperty(o,"parentNode",{get:function(){return e}});var i=new MutationObserver(function(t){var n=e[r];t.forEach(function(e){var t=e.addedNodes,r=e.removedNodes,o={},i=function(e){return o[e.getAttribute&&e.getAttribute("slot")||"__default"]=!0};if(t)for(var u=t.length,a=0;a<u;a++)i(t[a]);if(r)for(var l=r.length,s=0;s<l;s++)i(r[s]);Object.keys(o).forEach(function(e){var t="__default"===e?n.querySelector("content:not([name])")||n.querySelector('content[name=""]'):n.querySelector('content[name="'+e+'"]');t&&t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})})});return i.observe(this,{childList:!0}),this[r]=o},Object.defineProperty(HTMLContentElement.prototype,"name",{get:function(){return this.getAttribute("name")},set:function(e){return this.setAttribute("name",e)}}),Object.defineProperty(HTMLElement.prototype,"slot",{get:function(){return this.getAttribute("slot")},set:function(e){return this.setAttribute("slot",e)}}),HTMLContentElement.prototype.assignedNodes=function(){for(var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.deep,r=[],o=n?this.getDistributedNodes():t(this),i=0;i<o.length;i++){var u=o[i],a=u.nodeType;a!==Node.ELEMENT_NODE&&a!==Node.TEXT_NODE||r.push(u)}return r},HTMLContentElement.prototype.getAttribute=function(e){if("name"===e){var t=o.call(this,"select");return t?t.match(/\[slot=['"]?(.*?)['"]?\]/)[1]:null}return o.call(this,e)},HTMLContentElement.prototype.setAttribute=function(e,t){return"name"===e&&(e="select",t="[slot='"+t+"']"),i.call(this,e,t)}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]="0.0.1"}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.skatejsNamedSlots=t():e.skatejsNamedSlots=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.v1=t.v0=void 0,n(1);var o=n(2),i=n(3),u=r(i),a=n(4),l=r(a);o.shadowDomV1||(o.shadowDomV0?(0,u["default"])():(0,l["default"])()),t.v0=u["default"],t.v1=l["default"]},function(e,t){"use strict";try{var n=new window.CustomEvent("test");if(n.preventDefault(),n.defaultPrevented!==!0)throw new Error("Could not prevent default")}catch(r){var o=function(e,t){var n,r;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},n=document.createEvent("CustomEvent"),n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};o.prototype=window.Event.prototype,window.CustomEvent=o}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=document.createElement("div");t.shadowDomV0=!!n.createShadowRoot,t.shadowDomV1=!!n.attachShadow},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(1);var r="__shadowRoot";t["default"]=function(){function e(e){for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=[];t.nextNode();){var r=t.currentNode;"SLOT"===r.tagName&&n.push(r)}n.forEach(function(e){var t=e.getAttribute("name"),n=document.createElement("slot");for(t&&n.setAttribute("name",t),e.parentNode.replaceChild(n,e);e.hasChildNodes();)n.appendChild(e.firstChild)})}var t=function(e){for(var t=e.getAttribute("name"),n=e;n;){var o=n[r];if(o&&o.contains(e))break;n=n.parentNode}if(!n)return[];for(var i=n.childNodes,u=i.length,a=[],l=0;l<u;l++){var s=i[l],c=s.getAttribute?s.getAttribute("slot"):null;t===c&&a.push(s)}return a},n=HTMLElement.prototype,o=n.getAttribute,i=n.setAttribute,u=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),a=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"),l=function(e){return"slot"===e?"content":e},s=document.createElement.bind(document),c=document.createElementNS.bind(document);document.createElement=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return s.apply(void 0,[l(e)].concat(n))},document.createElementNS=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return c.apply(void 0,[e,l(t)].concat(r))},Object.defineProperty(Element.prototype,"innerHTML",{configurable:!0,get:u.get,set:function(t){u.set.call(this,t),e(this)}}),Object.defineProperty(ShadowRoot.prototype,"innerHTML",{configurable:!0,get:a.get,set:function(t){a.set.call(this,t),e(this)}}),Object.defineProperty(Node.prototype,"assignedSlot",{get:function(){var e=this.parentNode;if(e){var t=e.shadowRoot;if(!t)return null;for(var n=t.querySelectorAll("content"),r=0;r<n.length;r++){var o=n[r];if(o.assignedNodes().indexOf(this)>-1)return o}}return null}}),HTMLElement.prototype.attachShadow=function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var o=this.createShadowRoot();"closed"===n&&Object.defineProperty(this,"shadowRoot",{configurable:!0,get:function(){return null}}),Object.defineProperty(o,"parentNode",{get:function(){return e}});var i=new MutationObserver(function(t){var n=e[r];t.forEach(function(e){var t=e.addedNodes,r=e.removedNodes,o={},i=function(e){return o[e.getAttribute&&e.getAttribute("slot")||"__default"]=!0};if(t)for(var u=t.length,a=0;a<u;a++)i(t[a]);if(r)for(var l=r.length,s=0;s<l;s++)i(r[s]);Object.keys(o).forEach(function(e){var t="__default"===e?n.querySelector("content:not([name])")||n.querySelector('content[name=""]'):n.querySelector('content[name="'+e+'"]');t&&t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})})});return i.observe(this,{childList:!0}),this[r]=o},Object.defineProperty(HTMLContentElement.prototype,"name",{get:function(){return this.getAttribute("name")},set:function(e){return this.setAttribute("name",e)}}),Object.defineProperty(HTMLElement.prototype,"slot",{get:function(){return this.getAttribute("slot")},set:function(e){return this.setAttribute("slot",e)}}),HTMLContentElement.prototype.assignedNodes=function(){for(var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.deep,r=[],o=n?this.getDistributedNodes():t(this),i=0;i<o.length;i++){var u=o[i],a=u.nodeType;a!==Node.ELEMENT_NODE&&a!==Node.TEXT_NODE||r.push(u)}return r},HTMLContentElement.prototype.getAttribute=function(e){if("name"===e){var t=o.call(this,"select");return t?t.match(/\[slot=['"]?(.*?)['"]?\]/)[1]:null}return o.call(this,e)},HTMLContentElement.prototype.setAttribute=function(e,t){return"name"===e&&(e="select",t="[slot='"+t+"']"),i.call(this,e,t)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=document.createElement("div");if(F["default"])return t.__innerHTML=e,t;for(var n=me.parseFromString("<div>"+e+"</div>","text/html").body.firstChild;n.hasChildNodes();){var r=n.firstChild;n.removeChild(r),t.appendChild(r)}return document.importNode(t,!0)}function i(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n}})}function u(e){return this[e]}function a(e){return e.item=u,e}function l(e){return!!de.get(e)}function s(e){return l(e)?"host":(0,K["default"])(e)?"slot":(0,z["default"])(e)?"root":"node"}function c(e,t){for(;e&&e!==document;){if(t(e))return e;e=e.parentNode}}function d(e){return e.getAttribute&&e.getAttribute("name")||"default"}function f(e){return e.getAttribute&&e.getAttribute("slot")||"default"}function h(e,t,n){if(le.indexOf(t.nodeType)!==-1){var r=e.assignedNodes(),o=0===r.length,i=r.indexOf(n);pe.set(t,e),o&&te.call(e.childNodes,function(t){return e.__removeChild(t)}),i>-1?(e.__insertBefore(t,void 0!==n?n:null),r.splice(i,0,t)):(e.__appendChild(t),r.push(t)),e.____triggerSlotChangeEvent()}}function p(e){var t=pe.get(e);if(t){var n=t.assignedNodes(),r=n.indexOf(e);if(r>-1){var o=1===n.length;n.splice(r,1),pe.set(e,null),t.__removeChild(e),o&&te.call(t.childNodes,function(e){return t.__appendChild(e)}),t.____triggerSlotChangeEvent()}}}function v(e,t){for(var n=e.childNodes,r=n.length,o=0;o<r;o++)if(n[o]===t)return o;return-1}function _(e,t,n,r){var o=v(e,n);(0,k.eachNodeOrFragmentNodes)(t,function(t,n){r(t,n),F["default"]?he.set(t,e):i(t,"parentNode",e),o>-1?ee.splice.call(e.childNodes,o+n,0,t):ee.push.call(e.childNodes,t)})}function g(e,t,n){var r=v(e,t);r>-1&&(n(t,0),F["default"]?he.set(t,null):i(t,"parentNode",null),ee.splice.call(e.childNodes,r,1))}function m(e,t,n){_(e,t,n,function(t){e.__insertBefore(t,void 0!==n?n:null)})}function y(e,t,n){_(e,t,n,function(t){var r=de.get(e),o=_e.get(r),i=o[f(t)];i&&h(i,t,n)})}function N(e,t){var n=d(t);F["default"]||Array.isArray(t.childNodes)||i(t,"childNodes",(0,Z["default"])(t.childNodes)),_e.get(e)[n]=t,ge.has(t)||ge.set(t,e),(0,k.eachChildNode)(ve.get(e),function(e){e.assignedSlot||n!==f(e)||h(t,e)})}function b(e,t,n){(0,k.eachNodeOrFragmentNodes)(t,function(t){if((0,K["default"])(t))N(e,t);else{var n=(0,U["default"])(t);if(n)for(var r=n.length,o=0;o<r;o++)N(e,n[o])}}),m(e,t,n)}function E(e,t,n){var r=0===e.assignedNodes().length;_(e,t,n,function(t){r&&e.__insertBefore(t,void 0!==n?n:null)})}function O(e,t){var n=0===e.assignedNodes().length;g(e,t,function(){n&&e.__removeChild(t)})}function C(e,t){g(e,t,function(){e.__removeChild(t)})}function w(e,t){g(e,t,function(){p(t)})}function T(e,t){var n=Array.prototype.slice.call(t.assignedNodes());n.forEach(p),delete _e.get(e)[d(t)],ge["delete"](t)}function M(e,t){g(e,t,function(){if((0,K["default"])(t))T(e,t);else{var n=(0,U["default"])(t);if(n)for(var r=0;r<n.length;r++)T(e,n[r])}e.__removeChild(t)})}function j(e){if((0,z["default"])(e))return e;if(e.parentNode)return j(e.parentNode)}function A(e,t,n){var r=s(e),o=t.parentNode,u=j(e);return F["default"]||Array.isArray(e.childNodes)||i(e,"childNodes",(0,Z["default"])(e.childNodes)),u&&"slot"===s(t)&&N(u,t),o&&"host"===s(o)&&(F["default"]?he.set(t,null):i(t,"parentNode",null)),"node"===r?F["default"]?(he.set(t,e),e.__insertBefore(t,void 0!==n?n:null)):m(e,t,n):"slot"===r?E(e,t,n):"host"===r?y(e,t,n):"root"===r?b(e,t,n):void 0}function L(e){if(F["default"]&&"slot"===s(e)&&e.__childNodes.length!==e.childNodes.length){for(;e.hasChildNodes();)e.removeChild(e.firstChild);te.call(e.__childNodes,function(t){return e.appendChild(t)})}}Object.defineProperty(t,"__esModule",{value:!0});var P=n(5),S=r(P),x=n(7),D=r(x),k=n(8),H=n(9),F=r(H),R=n(10),W=r(R),V=n(11),B=r(V),q=n(12),X=r(q),G=n(13),I=r(G),Y=n(14),U=r(Y),$=n(16),z=r($),J=n(15),K=r(J),Q=n(17),Z=r(Q),ee=Array.prototype,te=ee.forEach,ne="_shadow_root_",re=["childNodes","parentNode"],oe=["textContent"],ie=["assignedSlot"],ue=["textContent"],ae=[],le=[Node.ELEMENT_NODE,Node.TEXT_NODE],se=new D["default"],ce=new D["default"],de=new D["default"],fe=new D["default"],he=new D["default"],pe=new D["default"],ve=new D["default"],_e=new D["default"],ge=new D["default"],me=new DOMParser,ye={____assignedNodes:{get:function(){return this.______assignedNodes||(this.______assignedNodes=[])}},____isInFallbackMode:{get:function(){return 0===this.assignedNodes().length}},____slotChangeListeners:{get:function(){return"undefined"==typeof this.______slotChangeListeners&&(this.______slotChangeListeners=0),this.______slotChangeListeners},set:function(e){this.______slotChangeListeners=e}},____triggerSlotChangeEvent:{value:(0,S["default"])(function(){this.____slotChangeListeners&&this.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})},addEventListener:{value:function(e,t,n){return"slotchange"===e&&(0,K["default"])(this)&&this.____slotChangeListeners++,this.__addEventListener(e,t,n)}},appendChild:{value:function(e){return A(this,e),e}},assignedSlot:{get:function(){var e=pe.get(this);if(!e)return null;var t=ge.get(e),n=ve.get(t),r=ce.get(n);return"open"===r?e:null}},attachShadow:{value:function(e){var t=this,n=e&&e.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=de.get(this);if(r)return r;var o=a([].slice.call(this.childNodes)),u=document.createElement(e.polyfillShadowRootTagName||ne);return ce.set(this,n),de.set(this,u),ve.set(u,this),_e.set(u,{}),F["default"]?fe.set(this,o):i(this,"childNodes",o),o.forEach(function(e){t.__removeChild(e),F["default"]?he.set(e,t):i(e,"parentNode",t)}),this.__appendChild(u)}},childElementCount:{get:function(){return this.children.length}},childNodes:{get:function(){if(F["default"]&&"node"===s(this))return this.__childNodes;var e=fe.get(this);return e||fe.set(this,e=a([])),e}},children:{get:function(){var e=[];return(0,k.eachChildNode)(this,function(t){1===t.nodeType&&e.push(t)}),a(e)}},firstChild:{get:function(){return this.childNodes[0]||null}},firstElementChild:{get:function(){return this.children[0]||null}},assignedNodes:{value:function(){if((0,K["default"])(this)){var e=se.get(this);return e||se.set(this,e=[]),e}}},hasChildNodes:{value:function(){return this.childNodes.length>0}},innerHTML:{get:function(){function e(e){return e.nodeType===Node.ELEMENT_NODE&&e.nodeName.toLowerCase()in o}var t="",n=function(e){return e.outerHTML},r={};r[Node.ELEMENT_NODE]=n,r[Node.COMMENT_NODE]=I["default"];var o={style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,noscript:!0,plaintext:!0},i=e(this);return(0,k.eachChildNode)(this,function(e){var o=void 0;o=e.nodeType===Node.TEXT_NODE?i?X["default"]:B["default"]:r[e.nodeType]||n,t+=o(e)}),t},set:function(e){for(var t=o(e);this.hasChildNodes();)this.removeChild(this.firstChild);var n=(0,U["default"])(t);for(te.call(n,function(e){return L(e)});t.hasChildNodes();){var r=t.firstChild;t.removeChild(r),this.appendChild(r)}}},insertBefore:{value:function(e,t){return A(this,e,t),e}},lastChild:{get:function(){var e=this.childNodes;return e[e.length-1]||null}},lastElementChild:{get:function(){var e=this.children;return e[e.length-1]||null}},name:{get:function(){return this.getAttribute("name")},set:function(e){var t=this.name,n=this.__setAttribute("name",e);if(e===t)return n;if(!(0,K["default"])(this))return n;var r=ge.get(this);return r&&(T(r,this),N(r,this)),n}},nextSibling:{get:function(){var e=this;return(0,k.eachChildNode)(this.parentNode,function(t,n,r){if(e===t)return r[n+1]||null})}},nextElementSibling:{get:function(){var e=this,t=void 0;return(0,k.eachChildNode)(this.parentNode,function(n){return t&&1===n.nodeType?n:void(e===n&&(t=!0))})}},outerHTML:{get:function(){var e=this.tagName.toLowerCase(),t=Array.prototype.slice.call(this.attributes).map(function(e){return" "+e.name+(e.value?'="'+e.value+'"':"")}).join("");return"<"+e+t+">"+this.innerHTML+"</"+e+">"},set:function(e){if(this.parentNode){var t=o(e);this.parentNode.replaceChild(t.firstChild,this)}else{if(!F["default"])throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");this.__outerHTML=e}}},parentElement:{get:function(){return c(this.parentNode,function(e){return 1===e.nodeType})}},parentNode:{get:function(){return he.get(this)||this.__parentNode||null}},previousSibling:{get:function(){var e=this;return(0,k.eachChildNode)(this.parentNode,function(t,n,r){if(e===t)return r[n-1]||null})}},previousElementSibling:{get:function(){var e=this,t=void 0;return(0,k.eachChildNode)(this.parentNode,function(n){return t&&e===n?t:void(1===n.nodeType&&(t=n))})}},removeChild:{value:function(e){var t=s(this);switch(t){case"node":if(F["default"])return he.set(e,null),this.__removeChild(e);C(this,e);break;case"slot":O(this,e);break;case"host":w(this,e);break;case"root":M(this,e)}return e}},removeEventListener:{value:function(e,t,n){return"slotchange"===e&&this.____slotChangeListeners&&(0,K["default"])(this)&&this.____slotChangeListeners--,this.__removeEventListener(e,t,n)}},replaceChild:{value:function(e,t){return this.insertBefore(e,t),this.removeChild(t)}},setAttribute:{value:function(e,t){return"slot"===e&&(this[e]=t),(0,K["default"])(this)&&"name"===e&&(this[e]=t),this.__setAttribute(e,t)}},shadowRoot:{get:function(){return"open"===ce.get(this)?de.get(this):null}},slot:{get:function(){return this.getAttribute("slot")},set:function(e){var t=this.name,n=this.__setAttribute("slot",e);if(t===e)return n;var r=pe.get(this),o=r&&ge.get(r),i=o&&ve.get(o);return i&&(w(i,this),y(i,this)),n}},textContent:{get:function(){var e="";return(0,k.eachChildNode)(this,function(t){t.nodeType!==Node.COMMENT_NODE&&(e+=t.textContent)}),e},set:function(e){for(;this.hasChildNodes();)this.removeChild(this.firstChild);e&&this.appendChild(document.createTextNode(e))}}};t["default"]=function(){var e=Comment.prototype,t=HTMLElement.prototype,n=SVGElement.prototype,r=Text.prototype,o=document.createTextNode(""),i=document.createComment("");Object.keys(ye).forEach(function(u){var a=ye[u];if(a.configurable=!0,a.enumerable=!0,a.hasOwnProperty("value")&&(a.writable=!0),F["default"]||re.indexOf(u)===-1){var l=(0,W["default"])(t,u),s=(0,W["default"])(r,u),c=(0,W["default"])(e,u),d=u in o&&oe.indexOf(u)===-1||~ie.indexOf(u),f=u in i&&ue.indexOf(u)===-1||~ae.indexOf(u),h="__"+u;Object.defineProperty(t,u,a),Object.defineProperty(n,u,a),l&&(Object.defineProperty(t,h,l),Object.defineProperty(n,h,l)),d&&Object.defineProperty(r,u,a),d&&s&&Object.defineProperty(r,h,s),f&&Object.defineProperty(e,u,a),f&&c&&Object.defineProperty(e,h,c)}})}},function(e,t,n){"use strict";var r=n(6);e.exports=function(e,t,n){function o(){var c=r()-l;c<t&&c>0?i=setTimeout(o,t-c):(i=null,n||(s=e.apply(a,u),i||(a=u=null)))}var i,u,a,l,s;return null==t&&(t=100),function(){a=this,u=arguments,l=r();var c=n&&!i;return i||(i=setTimeout(o,t)),c&&(s=e.apply(a,u),a=u=null),s}}},function(e,t){"use strict";function n(){return(new Date).getTime()}e.exports=Date.now||n},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};void function(t,n,o){function i(e,t,n){return"function"==typeof t&&(n=t,t=u(n).replace(/_$/,"")),s(e,t,{configurable:!0,writable:!0,value:n})}function u(e){return"function"!=typeof e?"":"name"in e?e.name:c.call(e).match(h)[1]}function a(e){function t(t,r){return r||2===arguments.length?n.set(t,r):(r=n.get(t),r===o&&(r=e(t),n.set(t,r))),r}var n=new v;return e||(e=_),t}var l=Object.getOwnPropertyNames,s=Object.defineProperty,c=Function.prototype.toString,d=Object.create,f=Object.prototype.hasOwnProperty,h=/^\n?function\s?(\w*)?_?\(/,p=function(){function e(){var e=u(),r={};this.unlock=function(o){var i=c(o);if(f.call(i,e))return i[e](r);var u=d(null,t);return s(i,e,{value:new Function("s","l",n)(r,u)}),u}}var t={value:{writable:!0,value:o}},n="return function(k){if(k===s)return l}",r=d(null),u=function h(){var e=Math.random().toString(36).slice(2);return e in r?h():r[e]=e},a=u(),c=function(e){if(f.call(e,a))return e[a];if(!Object.isExtensible(e))throw new TypeError("Object must be extensible");var t=d(null);return s(e,a,{value:t}),t};return i(Object,function(e){var t=l(e);return f.call(e,a)&&t.splice(t.indexOf(a),1),t}),i(e.prototype,function(e){return this.unlock(e).value}),i(e.prototype,function(e,t){this.unlock(e).value=t}),e}(),v=function(e){function a(e){return this===t||null==this||this===a.prototype?new a(e):(v(this,new p),void g(this,e))}function l(e){h(e);var t=_(this).get(e);return t===n?o:t}function s(e,t){h(e),_(this).set(e,t===o?n:t)}function c(e){return h(e),_(this).get(e)!==o}function d(e){h(e);var t=_(this),n=t.get(e)!==o;return t.set(e,o),n}function f(){return _(this),"[object WeakMap]"}var h=function(e){if(null==e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e)throw new TypeError("Invalid WeakMap key")},v=function(t,n){var r=e.unlock(t);if(r.value)throw new TypeError("Object is already a WeakMap");r.value=n},_=function(t){var n=e.unlock(t).value;if(!n)throw new TypeError("WeakMap is not generic");return n},g=function(e,t){null!==t&&"object"===("undefined"==typeof t?"undefined":r(t))&&"function"==typeof t.forEach&&t.forEach(function(n,r){n instanceof Array&&2===n.length&&s.call(e,t[r][0],t[r][1])})};try{var m=("return "+d).replace("e_","\\u0065"),y=new Function("unwrap","validate",m)(_,h)}catch(N){var y=d}var m=(""+Object).split("Object"),b=function(){return m[0]+u(this)+m[1]};i(b,b);var E={__proto__:[]}instanceof Array?function(e){e.__proto__=b}:function(e){i(e,b)};return E(a),[f,l,s,c,y].forEach(function(e){i(a.prototype,e),E(e)}),a}(new p),_=Object.create?function(){return Object.create(null)}:function(){return{}};e.exports=v,v.createStorage=a,t.WeakMap&&(t.WeakMap.createStorage=a)}((0,eval)("this"))},function(e,t){"use strict";function n(e,t){if(e)for(var n=e.childNodes,r=n.length,o=0;o<r;o++){var i=t(n[o],o,n);if("undefined"!=typeof i)return i}}function r(e){for(var t=[],n=e.length-1;n>=0;n--)t.push(e[n]);return t}function o(e,t){if(e instanceof DocumentFragment)for(var n=e.childNodes,o=n.length,i=o-1;i>=0;i--){var u=r(e.childNodes)[i];t(u,i)}else t(e,0)}Object.defineProperty(t,"__esModule",{value:!0}),t.eachChildNode=n,t.eachNodeOrFragmentNodes=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),i=r(o),u=(0,i["default"])(Element.prototype,"innerHTML");t["default"]=!!u},function(e,t){"use strict";function n(e,t){for(var n=void 0;e&&!(n=Object.getOwnPropertyDescriptor(e,t));)e=Object.getPrototypeOf(e);return n}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){e instanceof Node&&(e=r);var o=n(e,t);if(o){var i=o.get,u=o.set,a={configurable:!0,enumerable:!0};if(i)return a.get=i,a.set=u,a;if("function"==typeof e[t])return a.value=e[t],a}var l=Object.getOwnPropertyDescriptor(e,t);if(l&&l.get)return l};var r=document.createElement("div")},function(e,t){"use strict";function n(e){return e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){return e.textContent}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){return e.text||"<!--"+e.textContent+"-->"}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],n=e.childNodes;if(u.shadowDomV0&&!u.shadowDomV1)return[].concat(o(e.querySelectorAll("content")));if(!n||[Node.ELEMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].indexOf(e.nodeType)===-1)return t;for(var r=n.length,a=0;a<r;a++){var s=n[a];(0,l["default"])(s)&&t.push(s),i(s,t)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=n(2),a=n(15),l=r(a)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return"SLOT"===e.tagName}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return"_SHADOW_ROOT_"===e.tagName}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return Array.prototype.slice.call(e)}}])});
//# sourceMappingURL=index-with-deps.min.js.map

@@ -10,47 +10,2 @@ (function (global, factory) {

function eachChildNode(node, func) {
if (!node) {
return;
}
var chs = node.childNodes;
var chsLen = chs.length;
for (var a = 0; a < chsLen; a++) {
var ret = func(chs[a], a, chs);
if (typeof ret !== 'undefined') {
return ret; // eslint-disable-line consistent-return
}
}
}
// Re-implemented to avoid Array.prototype.slice.call for performance reasons
function reverse(arr) {
var reversedArray = [];
for (var i = arr.length - 1; i >= 0; i--) {
reversedArray.push(arr[i]);
}
return reversedArray;
}
/**
* Execute func over all child nodes or a document fragment, or a single node
* @param node the node or document fragment
* @param func a function to execute on node or the children of node, if node is a document fragment.
* func may optionally append the node elsewhere, in the case of a document fragment
*/
function eachNodeOrFragmentNodes(node, func) {
if (node instanceof DocumentFragment) {
var chs = node.childNodes;
var chsLen = chs.length;
// We must iterate in reverse to handle the case where child nodes are moved elsewhere during execution
for (var a = chsLen - 1; a >= 0; a--) {
var thisNode = reverse(node.childNodes)[a];
func(thisNode, a);
}
} else {
func(node, 0);
}
}
var div = document.createElement('div');

@@ -60,125 +15,2 @@ var shadowDomV0 = !!div.createShadowRoot;

var div$1 = document.createElement('div');
function getPrototype(obj, key) {
var descriptor = void 0;
while (obj && !(descriptor = Object.getOwnPropertyDescriptor(obj, key))) {
// eslint-disable-line no-cond-assign
obj = Object.getPrototypeOf(obj);
}
return descriptor;
}
function getPropertyDescriptor (obj, key) {
if (obj instanceof Node) {
obj = div$1;
}
var proto = getPrototype(obj, key);
if (proto) {
var getter = proto.get;
var setter = proto.set;
var _descriptor = {
configurable: true,
enumerable: true
};
if (getter) {
_descriptor.get = getter;
_descriptor.set = setter;
return _descriptor;
} else if (typeof obj[key] === 'function') {
_descriptor.value = obj[key];
return _descriptor;
}
}
var descriptor = Object.getOwnPropertyDescriptor(obj, key);
if (descriptor && descriptor.get) {
return descriptor;
}
}
// Any code referring to this is because it has to work around this bug in
// WebKit: https://bugs.webkit.org/show_bug.cgi?id=49739
var nativeParentNode = getPropertyDescriptor(Element.prototype, 'innerHTML');
var canPatchNativeAccessors = !!nativeParentNode;
/**
* See https://w3c.github.io/DOM-Parsing/#serializing
* @param {TextNode}
* @returns {string}
*/
function getEscapedTextContent(textNode) {
return textNode.textContent.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
/**
* @param {TextNode}
* @returns {string}
*/
function getRawTextContent(textNode) {
return textNode.textContent;
}
/**
* @returns {string}
* @param {commentNode}
*/
function getCommentNodeOuterHtml(commentNode) {
return commentNode.text || "<!--" + commentNode.textContent + "-->";
}
function isSlotNode (node) {
return node.tagName === 'SLOT';
}
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
function findSlots(root) {
var slots = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var childNodes = root.childNodes;
if (shadowDomV0 && !shadowDomV1) {
return [].concat(toConsumableArray(root.querySelectorAll('content')));
}
if (!childNodes || [Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].indexOf(root.nodeType) === -1) {
return slots;
}
var length = childNodes.length;
for (var a = 0; a < length; a++) {
var childNode = childNodes[a];
if (isSlotNode(childNode)) {
slots.push(childNode);
}
findSlots(childNode, slots);
}
return slots;
}
function isRootNode (node) {
return node.tagName === '_SHADOW_ROOT_';
}
var pseudoArrayToArray = (function (pseudoArray) {
return Array.prototype.slice.call(pseudoArray);
})
var $shadowRoot = '__shadowRoot';

@@ -459,5 +291,170 @@

var version = '0.0.1';
function eachChildNode(node, func) {
if (!node) {
return;
}
// TODO move into the skatejs-web-components package.
var chs = node.childNodes;
var chsLen = chs.length;
for (var a = 0; a < chsLen; a++) {
var ret = func(chs[a], a, chs);
if (typeof ret !== 'undefined') {
return ret; // eslint-disable-line consistent-return
}
}
}
// Re-implemented to avoid Array.prototype.slice.call for performance reasons
function reverse(arr) {
var reversedArray = [];
for (var i = arr.length - 1; i >= 0; i--) {
reversedArray.push(arr[i]);
}
return reversedArray;
}
/**
* Execute func over all child nodes or a document fragment, or a single node
* @param node the node or document fragment
* @param func a function to execute on node or the children of node, if node is a document fragment.
* func may optionally append the node elsewhere, in the case of a document fragment
*/
function eachNodeOrFragmentNodes(node, func) {
if (node instanceof DocumentFragment) {
var chs = node.childNodes;
var chsLen = chs.length;
// We must iterate in reverse to handle the case where child nodes are moved elsewhere during execution
for (var a = chsLen - 1; a >= 0; a--) {
var thisNode = reverse(node.childNodes)[a];
func(thisNode, a);
}
} else {
func(node, 0);
}
}
var div$1 = document.createElement('div');
function getPrototype(obj, key) {
var descriptor = void 0;
while (obj && !(descriptor = Object.getOwnPropertyDescriptor(obj, key))) {
// eslint-disable-line no-cond-assign
obj = Object.getPrototypeOf(obj);
}
return descriptor;
}
function getPropertyDescriptor (obj, key) {
if (obj instanceof Node) {
obj = div$1;
}
var proto = getPrototype(obj, key);
if (proto) {
var getter = proto.get;
var setter = proto.set;
var _descriptor = {
configurable: true,
enumerable: true
};
if (getter) {
_descriptor.get = getter;
_descriptor.set = setter;
return _descriptor;
} else if (typeof obj[key] === 'function') {
_descriptor.value = obj[key];
return _descriptor;
}
}
var descriptor = Object.getOwnPropertyDescriptor(obj, key);
if (descriptor && descriptor.get) {
return descriptor;
}
}
// Any code referring to this is because it has to work around this bug in
// WebKit: https://bugs.webkit.org/show_bug.cgi?id=49739
var nativeParentNode = getPropertyDescriptor(Element.prototype, 'innerHTML');
var canPatchNativeAccessors = !!nativeParentNode;
/**
* See https://w3c.github.io/DOM-Parsing/#serializing
* @param {TextNode}
* @returns {string}
*/
function getEscapedTextContent(textNode) {
return textNode.textContent.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
/**
* @param {TextNode}
* @returns {string}
*/
function getRawTextContent(textNode) {
return textNode.textContent;
}
/**
* @returns {string}
* @param {commentNode}
*/
function getCommentNodeOuterHtml(commentNode) {
return commentNode.text || "<!--" + commentNode.textContent + "-->";
}
function isSlotNode (node) {
return node.tagName === 'SLOT';
}
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
function findSlots(root) {
var slots = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var childNodes = root.childNodes;
if (shadowDomV0 && !shadowDomV1) {
return [].concat(toConsumableArray(root.querySelectorAll('content')));
}
if (!childNodes || [Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].indexOf(root.nodeType) === -1) {
return slots;
}
var length = childNodes.length;
for (var a = 0; a < length; a++) {
var childNode = childNodes[a];
if (isSlotNode(childNode)) {
slots.push(childNode);
}
findSlots(childNode, slots);
}
return slots;
}
function isRootNode (node) {
return node.tagName === '_SHADOW_ROOT_';
}
var pseudoArrayToArray = (function (pseudoArray) {
return Array.prototype.slice.call(pseudoArray);
})
var arrProto = Array.prototype;

@@ -1362,66 +1359,70 @@ var forEach = arrProto.forEach;

if (shadowDomV1) {
// then we should probably not be loading this
} else if (shadowDomV0) {
v0();
} else {
(function () {
var commProto = Comment.prototype;
var elementProto = HTMLElement.prototype;
var svgProto = SVGElement.prototype;
var textProto = Text.prototype;
var textNode = document.createTextNode('');
var commNode = document.createComment('');
var v1 = (function () {
var commProto = Comment.prototype;
var elementProto = HTMLElement.prototype;
var svgProto = SVGElement.prototype;
var textProto = Text.prototype;
var textNode = document.createTextNode('');
var commNode = document.createComment('');
Object.keys(members).forEach(function (memberName) {
var memberProperty = members[memberName];
Object.keys(members).forEach(function (memberName) {
var memberProperty = members[memberName];
// All properties should be configurable and enumerable.
memberProperty.configurable = true;
memberProperty.enumerable = true;
// All properties should be configurable and enumerable.
memberProperty.configurable = true;
memberProperty.enumerable = true;
// Applying to the data properties only since we can't have writable accessor properties.
if (memberProperty.hasOwnProperty('value')) {
// eslint-disable-line no-prototype-builtins
memberProperty.writable = true;
}
// Applying to the data properties only since we can't have writable accessor properties.
if (memberProperty.hasOwnProperty('value')) {
// eslint-disable-line no-prototype-builtins
memberProperty.writable = true;
}
// Polyfill as much as we can and work around WebKit in other areas.
if (canPatchNativeAccessors || polyfillAtRuntime.indexOf(memberName) === -1) {
var nativeDescriptor = getPropertyDescriptor(elementProto, memberName);
var nativeTextDescriptor = getPropertyDescriptor(textProto, memberName);
var nativeCommDescriptor = getPropertyDescriptor(commProto, memberName);
var shouldOverrideInTextNode = memberName in textNode && doNotOverridePropertiesInTextNodes.indexOf(memberName) === -1 || ~defineInTextNodes.indexOf(memberName);
var shouldOverrideInCommentNode = memberName in commNode && doNotOverridePropertiesInCommNodes.indexOf(memberName) === -1 || ~defineInCommNodes.indexOf(memberName);
var nativeMemberName = '__' + memberName;
// Polyfill as much as we can and work around WebKit in other areas.
if (canPatchNativeAccessors || polyfillAtRuntime.indexOf(memberName) === -1) {
var nativeDescriptor = getPropertyDescriptor(elementProto, memberName);
var nativeTextDescriptor = getPropertyDescriptor(textProto, memberName);
var nativeCommDescriptor = getPropertyDescriptor(commProto, memberName);
var shouldOverrideInTextNode = memberName in textNode && doNotOverridePropertiesInTextNodes.indexOf(memberName) === -1 || ~defineInTextNodes.indexOf(memberName);
var shouldOverrideInCommentNode = memberName in commNode && doNotOverridePropertiesInCommNodes.indexOf(memberName) === -1 || ~defineInCommNodes.indexOf(memberName);
var nativeMemberName = '__' + memberName;
Object.defineProperty(elementProto, memberName, memberProperty);
Object.defineProperty(svgProto, memberName, memberProperty);
Object.defineProperty(elementProto, memberName, memberProperty);
Object.defineProperty(svgProto, memberName, memberProperty);
if (nativeDescriptor) {
Object.defineProperty(elementProto, nativeMemberName, nativeDescriptor);
Object.defineProperty(svgProto, nativeMemberName, nativeDescriptor);
}
if (nativeDescriptor) {
Object.defineProperty(elementProto, nativeMemberName, nativeDescriptor);
Object.defineProperty(svgProto, nativeMemberName, nativeDescriptor);
}
if (shouldOverrideInTextNode) {
Object.defineProperty(textProto, memberName, memberProperty);
}
if (shouldOverrideInTextNode) {
Object.defineProperty(textProto, memberName, memberProperty);
}
if (shouldOverrideInTextNode && nativeTextDescriptor) {
Object.defineProperty(textProto, nativeMemberName, nativeTextDescriptor);
}
if (shouldOverrideInTextNode && nativeTextDescriptor) {
Object.defineProperty(textProto, nativeMemberName, nativeTextDescriptor);
}
if (shouldOverrideInCommentNode) {
Object.defineProperty(commProto, memberName, memberProperty);
}
if (shouldOverrideInCommentNode) {
Object.defineProperty(commProto, memberName, memberProperty);
}
if (shouldOverrideInCommentNode && nativeCommDescriptor) {
Object.defineProperty(commProto, nativeMemberName, nativeCommDescriptor);
}
}
});
})();
if (shouldOverrideInCommentNode && nativeCommDescriptor) {
Object.defineProperty(commProto, nativeMemberName, nativeCommDescriptor);
}
}
});
})
// TODO move into the skatejs-web-components package.
if (shadowDomV1) {
// then we should probably not be loading this
} else if (shadowDomV0) {
v0();
} else {
v1();
}
exports['default'] = version;
exports.v0 = v0;
exports.v1 = v1;

@@ -1428,0 +1429,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("custom-event-polyfill"),require("debounce"),require("weakmap")):"function"==typeof define&&define.amd?define(["exports","custom-event-polyfill","debounce","weakmap"],t):t(e.skatejsNamedSlots=e.skatejsNamedSlots||{},e.customEventPolyfill,e.debounce,e.WeakMap)}(this,function(e,t,n,r){function o(e,t){if(e)for(var n=e.childNodes,r=n.length,o=0;o<r;o++){var i=t(n[o],o,n);if("undefined"!=typeof i)return i}}function i(e){for(var t=[],n=e.length-1;n>=0;n--)t.push(e[n]);return t}function s(e,t){if(e instanceof DocumentFragment)for(var n=e.childNodes,r=n.length,o=r-1;o>=0;o--){var s=i(e.childNodes)[o];t(s,o)}else t(e,0)}function u(e,t){for(var n=void 0;e&&!(n=Object.getOwnPropertyDescriptor(e,t));)e=Object.getPrototypeOf(e);return n}function a(e,t){e instanceof Node&&(e=I);var n=u(e,t);if(n){var r=n.get,o=n.set,i={configurable:!0,enumerable:!0};if(r)return i.get=r,i.set=o,i;if("function"==typeof e[t])return i.value=e[t],i}var s=Object.getOwnPropertyDescriptor(e,t);if(s&&s.get)return s}function l(e){return e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d(e){return e.textContent}function c(e){return e.text||"<!--"+e.textContent+"-->"}function h(e){return"SLOT"===e.tagName}function f(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],n=e.childNodes;if(G&&!Y)return[].concat(z(e.querySelectorAll("content")));if(!n||[Node.ELEMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].indexOf(e.nodeType)===-1)return t;for(var r=n.length,o=0;o<r;o++){var i=n[o];h(i)&&t.push(i),f(i,t)}return t}function p(e){return"_SHADOW_ROOT_"===e.tagName}function g(e){var t=document.createElement("div");if(V)return t.__innerHTML=e,t;for(var n=_e.parseFromString("<div>"+e+"</div>","text/html").body.firstChild;n.hasChildNodes();){var r=n.firstChild;n.removeChild(r),t.appendChild(r)}return document.importNode(t,!0)}function v(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n}})}function _(e){return this[e]}function m(e){return e.item=_,e}function N(e){return!!de.get(e)}function y(e){return N(e)?"host":h(e)?"slot":p(e)?"root":"node"}function b(e,t){for(;e&&e!==document;){if(t(e))return e;e=e.parentNode}}function E(e){return e.getAttribute&&e.getAttribute("name")||"default"}function C(e){return e.getAttribute&&e.getAttribute("slot")||"default"}function O(e,t,n){if(ue.indexOf(t.nodeType)!==-1){var r=e.assignedNodes(),o=0===r.length,i=r.indexOf(n);fe.set(t,e),o&&ee.call(e.childNodes,function(t){return e.__removeChild(t)}),i>-1?(e.__insertBefore(t,void 0!==n?n:null),r.splice(i,0,t)):(e.__appendChild(t),r.push(t)),e.____triggerSlotChangeEvent()}}function T(e){var t=fe.get(e);if(t){var n=t.assignedNodes(),r=n.indexOf(e);if(r>-1){var o=1===n.length;n.splice(r,1),fe.set(e,null),t.__removeChild(e),o&&ee.call(t.childNodes,function(e){return t.__appendChild(e)}),t.____triggerSlotChangeEvent()}}}function w(e,t){for(var n=e.childNodes,r=n.length,o=0;o<r;o++)if(n[o]===t)return o;return-1}function L(e,t,n,r){var o=w(e,n);s(t,function(t,n){r(t,n),V?he.set(t,e):v(t,"parentNode",e),o>-1?$.splice.call(e.childNodes,o+n,0,t):$.push.call(e.childNodes,t)})}function A(e,t,n){var r=w(e,t);r>-1&&(n(t,0),V?he.set(t,null):v(t,"parentNode",null),$.splice.call(e.childNodes,r,1))}function M(e,t,n){L(e,t,n,function(t){e.__insertBefore(t,void 0!==n?n:null)})}function S(e,t,n){L(e,t,n,function(t){var r=de.get(e),o=ge.get(r),i=o[C(t)];i&&O(i,t,n)})}function x(e,t){var n=E(t);V||Array.isArray(t.childNodes)||v(t,"childNodes",J(t.childNodes)),ge.get(e)[n]=t,ve.has(t)||ve.set(t,e),o(pe.get(e),function(e){e.assignedSlot||n!==C(e)||O(t,e)})}function j(e,t,n){s(t,function(t){if(h(t))x(e,t);else{var n=f(t);if(n)for(var r=n.length,o=0;o<r;o++)x(e,n[o])}}),M(e,t,n)}function P(e,t,n){var r=0===e.assignedNodes().length;L(e,t,n,function(t){r&&e.__insertBefore(t,void 0!==n?n:null)})}function H(e,t){var n=0===e.assignedNodes().length;A(e,t,function(){n&&e.__removeChild(t)})}function D(e,t){A(e,t,function(){e.__removeChild(t)})}function k(e,t){A(e,t,function(){T(t)})}function R(e,t){var n=Array.prototype.slice.call(t.assignedNodes());n.forEach(T),delete ge.get(e)[E(t)],ve.delete(t)}function q(e,t){A(e,t,function(){if(h(t))R(e,t);else{var n=f(t);if(n)for(var r=0;r<n.length;r++)R(e,n[r])}e.__removeChild(t)})}function B(e){if(p(e))return e;if(e.parentNode)return B(e.parentNode)}function F(e,t,n){var r=y(e),o=t.parentNode,i=B(e);return V||Array.isArray(e.childNodes)||v(e,"childNodes",J(e.childNodes)),i&&"slot"===y(t)&&x(i,t),o&&"host"===y(o)&&(V?he.set(t,null):v(t,"parentNode",null)),"node"===r?V?(he.set(t,e),e.__insertBefore(t,void 0!==n?n:null)):M(e,t,n):"slot"===r?P(e,t,n):"host"===r?S(e,t,n):"root"===r?j(e,t,n):void 0}function W(e){if(V&&"slot"===y(e)&&e.__childNodes.length!==e.childNodes.length){for(;e.hasChildNodes();)e.removeChild(e.firstChild);ee.call(e.__childNodes,function(t){return e.appendChild(t)})}}n="default"in n?n.default:n,r="default"in r?r.default:r;var X=document.createElement("div"),G=!!X.createShadowRoot,Y=!!X.attachShadow,I=document.createElement("div"),U=a(Element.prototype,"innerHTML"),V=!!U,z=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},J=function(e){return Array.prototype.slice.call(e)},K="__shadowRoot",Q=function(){function e(e){for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=[];t.nextNode();){var r=t.currentNode;"SLOT"===r.tagName&&n.push(r)}n.forEach(function(e){var t=e.getAttribute("name"),n=document.createElement("slot");for(t&&n.setAttribute("name",t),e.parentNode.replaceChild(n,e);e.hasChildNodes();)n.appendChild(e.firstChild)})}var t=function(e){for(var t=e.getAttribute("name"),n=e;n;){var r=n[K];if(r&&r.contains(e))break;n=n.parentNode}if(!n)return[];for(var o=n.childNodes,i=o.length,s=[],u=0;u<i;u++){var a=o[u],l=a.getAttribute?a.getAttribute("slot"):null;t===l&&s.push(a)}return s},n=HTMLElement.prototype,r=n.getAttribute,o=n.setAttribute,i=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),s=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"),u=function(e){return"slot"===e?"content":e},a=document.createElement.bind(document),l=document.createElementNS.bind(document);document.createElement=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return a.apply(void 0,[u(e)].concat(n))},document.createElementNS=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return l.apply(void 0,[e,u(t)].concat(r))},Object.defineProperty(Element.prototype,"innerHTML",{configurable:!0,get:i.get,set:function(t){i.set.call(this,t),e(this)}}),Object.defineProperty(ShadowRoot.prototype,"innerHTML",{configurable:!0,get:s.get,set:function(t){s.set.call(this,t),e(this)}}),Object.defineProperty(Node.prototype,"assignedSlot",{get:function(){var e=this.parentNode;if(e){var t=e.shadowRoot;if(!t)return null;for(var n=t.querySelectorAll("content"),r=0;r<n.length;r++){var o=n[r];if(o.assignedNodes().indexOf(this)>-1)return o}}return null}}),HTMLElement.prototype.attachShadow=function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=this.createShadowRoot();"closed"===n&&Object.defineProperty(this,"shadowRoot",{configurable:!0,get:function(){return null}}),Object.defineProperty(r,"parentNode",{get:function(){return e}});var o=new MutationObserver(function(t){var n=e[K];t.forEach(function(e){var t=e.addedNodes,r=e.removedNodes,o={},i=function(e){return o[e.getAttribute&&e.getAttribute("slot")||"__default"]=!0};if(t)for(var s=t.length,u=0;u<s;u++)i(t[u]);if(r)for(var a=r.length,l=0;l<a;l++)i(r[l]);Object.keys(o).forEach(function(e){var t="__default"===e?n.querySelector("content:not([name])")||n.querySelector('content[name=""]'):n.querySelector('content[name="'+e+'"]');t&&t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})})});return o.observe(this,{childList:!0}),this[K]=r},Object.defineProperty(HTMLContentElement.prototype,"name",{get:function(){return this.getAttribute("name")},set:function(e){return this.setAttribute("name",e)}}),Object.defineProperty(HTMLElement.prototype,"slot",{get:function(){return this.getAttribute("slot")},set:function(e){return this.setAttribute("slot",e)}}),HTMLContentElement.prototype.assignedNodes=function(){for(var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.deep,r=[],o=n?this.getDistributedNodes():t(this),i=0;i<o.length;i++){var s=o[i],u=s.nodeType;u!==Node.ELEMENT_NODE&&u!==Node.TEXT_NODE||r.push(s)}return r},HTMLContentElement.prototype.getAttribute=function(e){if("name"===e){var t=r.call(this,"select");return t?t.match(/\[slot=['"]?(.*?)['"]?\]/)[1]:null}return r.call(this,e)},HTMLContentElement.prototype.setAttribute=function(e,t){return"name"===e&&(e="select",t="[slot='"+t+"']"),o.call(this,e,t)}},Z="0.0.1",$=Array.prototype,ee=$.forEach,te="_shadow_root_",ne=["childNodes","parentNode"],re=["textContent"],oe=["assignedSlot"],ie=["textContent"],se=[],ue=[Node.ELEMENT_NODE,Node.TEXT_NODE],ae=new r,le=new r,de=new r,ce=new r,he=new r,fe=new r,pe=new r,ge=new r,ve=new r,_e=new DOMParser,me={____assignedNodes:{get:function(){return this.______assignedNodes||(this.______assignedNodes=[])}},____isInFallbackMode:{get:function(){return 0===this.assignedNodes().length}},____slotChangeListeners:{get:function(){return"undefined"==typeof this.______slotChangeListeners&&(this.______slotChangeListeners=0),this.______slotChangeListeners},set:function(e){this.______slotChangeListeners=e}},____triggerSlotChangeEvent:{value:n(function(){this.____slotChangeListeners&&this.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})},addEventListener:{value:function(e,t,n){return"slotchange"===e&&h(this)&&this.____slotChangeListeners++,this.__addEventListener(e,t,n)}},appendChild:{value:function(e){return F(this,e),e}},assignedSlot:{get:function(){var e=fe.get(this);if(!e)return null;var t=ve.get(e),n=pe.get(t),r=le.get(n);return"open"===r?e:null}},attachShadow:{value:function(e){var t=this,n=e&&e.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=de.get(this);if(r)return r;var o=m([].slice.call(this.childNodes)),i=document.createElement(e.polyfillShadowRootTagName||te);return le.set(this,n),de.set(this,i),pe.set(i,this),ge.set(i,{}),V?ce.set(this,o):v(this,"childNodes",o),o.forEach(function(e){t.__removeChild(e),V?he.set(e,t):v(e,"parentNode",t)}),this.__appendChild(i)}},childElementCount:{get:function(){return this.children.length}},childNodes:{get:function(){if(V&&"node"===y(this))return this.__childNodes;var e=ce.get(this);return e||ce.set(this,e=m([])),e}},children:{get:function(){var e=[];return o(this,function(t){1===t.nodeType&&e.push(t)}),m(e)}},firstChild:{get:function(){return this.childNodes[0]||null}},firstElementChild:{get:function(){return this.children[0]||null}},assignedNodes:{value:function(){if(h(this)){var e=ae.get(this);return e||ae.set(this,e=[]),e}}},hasChildNodes:{value:function(){return this.childNodes.length>0}},innerHTML:{get:function(){function e(e){return e.nodeType===Node.ELEMENT_NODE&&e.nodeName.toLowerCase()in i}var t="",n=function(e){return e.outerHTML},r={};r[Node.ELEMENT_NODE]=n,r[Node.COMMENT_NODE]=c;var i={style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,noscript:!0,plaintext:!0},s=e(this);return o(this,function(e){var o=void 0;o=e.nodeType===Node.TEXT_NODE?s?d:l:r[e.nodeType]||n,t+=o(e)}),t},set:function(e){for(var t=g(e);this.hasChildNodes();)this.removeChild(this.firstChild);var n=f(t);for(ee.call(n,function(e){return W(e)});t.hasChildNodes();){var r=t.firstChild;t.removeChild(r),this.appendChild(r)}}},insertBefore:{value:function(e,t){return F(this,e,t),e}},lastChild:{get:function(){var e=this.childNodes;return e[e.length-1]||null}},lastElementChild:{get:function(){var e=this.children;return e[e.length-1]||null}},name:{get:function(){return this.getAttribute("name")},set:function(e){var t=this.name,n=this.__setAttribute("name",e);if(e===t)return n;if(!h(this))return n;var r=ve.get(this);return r&&(R(r,this),x(r,this)),n}},nextSibling:{get:function(){var e=this;return o(this.parentNode,function(t,n,r){if(e===t)return r[n+1]||null})}},nextElementSibling:{get:function(){var e=this,t=void 0;return o(this.parentNode,function(n){return t&&1===n.nodeType?n:void(e===n&&(t=!0))})}},outerHTML:{get:function(){var e=this.tagName.toLowerCase(),t=Array.prototype.slice.call(this.attributes).map(function(e){return" "+e.name+(e.value?'="'+e.value+'"':"")}).join("");return"<"+e+t+">"+this.innerHTML+"</"+e+">"},set:function(e){if(this.parentNode){var t=g(e);this.parentNode.replaceChild(t.firstChild,this)}else{if(!V)throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");this.__outerHTML=e}}},parentElement:{get:function(){return b(this.parentNode,function(e){return 1===e.nodeType})}},parentNode:{get:function(){return he.get(this)||this.__parentNode||null}},previousSibling:{get:function(){var e=this;return o(this.parentNode,function(t,n,r){if(e===t)return r[n-1]||null})}},previousElementSibling:{get:function(){var e=this,t=void 0;return o(this.parentNode,function(n){return t&&e===n?t:void(1===n.nodeType&&(t=n))})}},removeChild:{value:function(e){var t=y(this);switch(t){case"node":if(V)return he.set(e,null),this.__removeChild(e);D(this,e);break;case"slot":H(this,e);break;case"host":k(this,e);break;case"root":q(this,e)}return e}},removeEventListener:{value:function(e,t,n){return"slotchange"===e&&this.____slotChangeListeners&&h(this)&&this.____slotChangeListeners--,this.__removeEventListener(e,t,n)}},replaceChild:{value:function(e,t){return this.insertBefore(e,t),this.removeChild(t)}},setAttribute:{value:function(e,t){return"slot"===e&&(this[e]=t),h(this)&&"name"===e&&(this[e]=t),this.__setAttribute(e,t)}},shadowRoot:{get:function(){return"open"===le.get(this)?de.get(this):null}},slot:{get:function(){return this.getAttribute("slot")},set:function(e){var t=this.name,n=this.__setAttribute("slot",e);if(t===e)return n;var r=fe.get(this),o=r&&ve.get(r),i=o&&pe.get(o);return i&&(k(i,this),S(i,this)),n}},textContent:{get:function(){var e="";return o(this,function(t){t.nodeType!==Node.COMMENT_NODE&&(e+=t.textContent)}),e},set:function(e){for(;this.hasChildNodes();)this.removeChild(this.firstChild);e&&this.appendChild(document.createTextNode(e))}}};Y||(G?Q():!function(){var e=Comment.prototype,t=HTMLElement.prototype,n=SVGElement.prototype,r=Text.prototype,o=document.createTextNode(""),i=document.createComment("");Object.keys(me).forEach(function(s){var u=me[s];if(u.configurable=!0,u.enumerable=!0,u.hasOwnProperty("value")&&(u.writable=!0),V||ne.indexOf(s)===-1){var l=a(t,s),d=a(r,s),c=a(e,s),h=s in o&&re.indexOf(s)===-1||~oe.indexOf(s),f=s in i&&ie.indexOf(s)===-1||~se.indexOf(s),p="__"+s;Object.defineProperty(t,s,u),Object.defineProperty(n,s,u),l&&(Object.defineProperty(t,p,l),Object.defineProperty(n,p,l)),h&&Object.defineProperty(r,s,u),h&&d&&Object.defineProperty(r,p,d),f&&Object.defineProperty(e,s,u),f&&c&&Object.defineProperty(e,p,c)}})}()),e.default=Z,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("custom-event-polyfill"),require("debounce"),require("weakmap")):"function"==typeof define&&define.amd?define(["exports","custom-event-polyfill","debounce","weakmap"],t):t(e.skatejsNamedSlots=e.skatejsNamedSlots||{},e.customEventPolyfill,e.debounce,e.WeakMap)}(this,function(e,t,n,r){function o(e,t){if(e)for(var n=e.childNodes,r=n.length,o=0;o<r;o++){var i=t(n[o],o,n);if("undefined"!=typeof i)return i}}function i(e){for(var t=[],n=e.length-1;n>=0;n--)t.push(e[n]);return t}function s(e,t){if(e instanceof DocumentFragment)for(var n=e.childNodes,r=n.length,o=r-1;o>=0;o--){var s=i(e.childNodes)[o];t(s,o)}else t(e,0)}function u(e,t){for(var n=void 0;e&&!(n=Object.getOwnPropertyDescriptor(e,t));)e=Object.getPrototypeOf(e);return n}function a(e,t){e instanceof Node&&(e=V);var n=u(e,t);if(n){var r=n.get,o=n.set,i={configurable:!0,enumerable:!0};if(r)return i.get=r,i.set=o,i;if("function"==typeof e[t])return i.value=e[t],i}var s=Object.getOwnPropertyDescriptor(e,t);if(s&&s.get)return s}function l(e){return e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d(e){return e.textContent}function c(e){return e.text||"<!--"+e.textContent+"-->"}function h(e){return"SLOT"===e.tagName}function f(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],n=e.childNodes;if(G&&!Y)return[].concat(K(e.querySelectorAll("content")));if(!n||[Node.ELEMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].indexOf(e.nodeType)===-1)return t;for(var r=n.length,o=0;o<r;o++){var i=n[o];h(i)&&t.push(i),f(i,t)}return t}function p(e){return"_SHADOW_ROOT_"===e.tagName}function g(e){var t=document.createElement("div");if(J)return t.__innerHTML=e,t;for(var n=ve.parseFromString("<div>"+e+"</div>","text/html").body.firstChild;n.hasChildNodes();){var r=n.firstChild;n.removeChild(r),t.appendChild(r)}return document.importNode(t,!0)}function v(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n}})}function _(e){return this[e]}function m(e){return e.item=_,e}function N(e){return!!le.get(e)}function y(e){return N(e)?"host":h(e)?"slot":p(e)?"root":"node"}function b(e,t){for(;e&&e!==document;){if(t(e))return e;e=e.parentNode}}function E(e){return e.getAttribute&&e.getAttribute("name")||"default"}function C(e){return e.getAttribute&&e.getAttribute("slot")||"default"}function O(e,t,n){if(se.indexOf(t.nodeType)!==-1){var r=e.assignedNodes(),o=0===r.length,i=r.indexOf(n);he.set(t,e),o&&$.call(e.childNodes,function(t){return e.__removeChild(t)}),i>-1?(e.__insertBefore(t,void 0!==n?n:null),r.splice(i,0,t)):(e.__appendChild(t),r.push(t)),e.____triggerSlotChangeEvent()}}function T(e){var t=he.get(e);if(t){var n=t.assignedNodes(),r=n.indexOf(e);if(r>-1){var o=1===n.length;n.splice(r,1),he.set(e,null),t.__removeChild(e),o&&$.call(t.childNodes,function(e){return t.__appendChild(e)}),t.____triggerSlotChangeEvent()}}}function w(e,t){for(var n=e.childNodes,r=n.length,o=0;o<r;o++)if(n[o]===t)return o;return-1}function L(e,t,n,r){var o=w(e,n);s(t,function(t,n){r(t,n),J?ce.set(t,e):v(t,"parentNode",e),o>-1?Z.splice.call(e.childNodes,o+n,0,t):Z.push.call(e.childNodes,t)})}function A(e,t,n){var r=w(e,t);r>-1&&(n(t,0),J?ce.set(t,null):v(t,"parentNode",null),Z.splice.call(e.childNodes,r,1))}function M(e,t,n){L(e,t,n,function(t){e.__insertBefore(t,void 0!==n?n:null)})}function S(e,t,n){L(e,t,n,function(t){var r=le.get(e),o=pe.get(r),i=o[C(t)];i&&O(i,t,n)})}function x(e,t){var n=E(t);J||Array.isArray(t.childNodes)||v(t,"childNodes",Q(t.childNodes)),pe.get(e)[n]=t,ge.has(t)||ge.set(t,e),o(fe.get(e),function(e){e.assignedSlot||n!==C(e)||O(t,e)})}function j(e,t,n){s(t,function(t){if(h(t))x(e,t);else{var n=f(t);if(n)for(var r=n.length,o=0;o<r;o++)x(e,n[o])}}),M(e,t,n)}function P(e,t,n){var r=0===e.assignedNodes().length;L(e,t,n,function(t){r&&e.__insertBefore(t,void 0!==n?n:null)})}function H(e,t){var n=0===e.assignedNodes().length;A(e,t,function(){n&&e.__removeChild(t)})}function D(e,t){A(e,t,function(){e.__removeChild(t)})}function k(e,t){A(e,t,function(){T(t)})}function R(e,t){var n=Array.prototype.slice.call(t.assignedNodes());n.forEach(T),delete pe.get(e)[E(t)],ge.delete(t)}function q(e,t){A(e,t,function(){if(h(t))R(e,t);else{var n=f(t);if(n)for(var r=0;r<n.length;r++)R(e,n[r])}e.__removeChild(t)})}function B(e){if(p(e))return e;if(e.parentNode)return B(e.parentNode)}function F(e,t,n){var r=y(e),o=t.parentNode,i=B(e);return J||Array.isArray(e.childNodes)||v(e,"childNodes",Q(e.childNodes)),i&&"slot"===y(t)&&x(i,t),o&&"host"===y(o)&&(J?ce.set(t,null):v(t,"parentNode",null)),"node"===r?J?(ce.set(t,e),e.__insertBefore(t,void 0!==n?n:null)):M(e,t,n):"slot"===r?P(e,t,n):"host"===r?S(e,t,n):"root"===r?j(e,t,n):void 0}function W(e){if(J&&"slot"===y(e)&&e.__childNodes.length!==e.childNodes.length){for(;e.hasChildNodes();)e.removeChild(e.firstChild);$.call(e.__childNodes,function(t){return e.appendChild(t)})}}n="default"in n?n.default:n,r="default"in r?r.default:r;var X=document.createElement("div"),G=!!X.createShadowRoot,Y=!!X.attachShadow,I="__shadowRoot",U=function(){function e(e){for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=[];t.nextNode();){var r=t.currentNode;"SLOT"===r.tagName&&n.push(r)}n.forEach(function(e){var t=e.getAttribute("name"),n=document.createElement("slot");for(t&&n.setAttribute("name",t),e.parentNode.replaceChild(n,e);e.hasChildNodes();)n.appendChild(e.firstChild)})}var t=function(e){for(var t=e.getAttribute("name"),n=e;n;){var r=n[I];if(r&&r.contains(e))break;n=n.parentNode}if(!n)return[];for(var o=n.childNodes,i=o.length,s=[],u=0;u<i;u++){var a=o[u],l=a.getAttribute?a.getAttribute("slot"):null;t===l&&s.push(a)}return s},n=HTMLElement.prototype,r=n.getAttribute,o=n.setAttribute,i=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),s=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"),u=function(e){return"slot"===e?"content":e},a=document.createElement.bind(document),l=document.createElementNS.bind(document);document.createElement=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return a.apply(void 0,[u(e)].concat(n))},document.createElementNS=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return l.apply(void 0,[e,u(t)].concat(r))},Object.defineProperty(Element.prototype,"innerHTML",{configurable:!0,get:i.get,set:function(t){i.set.call(this,t),e(this)}}),Object.defineProperty(ShadowRoot.prototype,"innerHTML",{configurable:!0,get:s.get,set:function(t){s.set.call(this,t),e(this)}}),Object.defineProperty(Node.prototype,"assignedSlot",{get:function(){var e=this.parentNode;if(e){var t=e.shadowRoot;if(!t)return null;for(var n=t.querySelectorAll("content"),r=0;r<n.length;r++){var o=n[r];if(o.assignedNodes().indexOf(this)>-1)return o}}return null}}),HTMLElement.prototype.attachShadow=function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=this.createShadowRoot();"closed"===n&&Object.defineProperty(this,"shadowRoot",{configurable:!0,get:function(){return null}}),Object.defineProperty(r,"parentNode",{get:function(){return e}});var o=new MutationObserver(function(t){var n=e[I];t.forEach(function(e){var t=e.addedNodes,r=e.removedNodes,o={},i=function(e){return o[e.getAttribute&&e.getAttribute("slot")||"__default"]=!0};if(t)for(var s=t.length,u=0;u<s;u++)i(t[u]);if(r)for(var a=r.length,l=0;l<a;l++)i(r[l]);Object.keys(o).forEach(function(e){var t="__default"===e?n.querySelector("content:not([name])")||n.querySelector('content[name=""]'):n.querySelector('content[name="'+e+'"]');t&&t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})})});return o.observe(this,{childList:!0}),this[I]=r},Object.defineProperty(HTMLContentElement.prototype,"name",{get:function(){return this.getAttribute("name")},set:function(e){return this.setAttribute("name",e)}}),Object.defineProperty(HTMLElement.prototype,"slot",{get:function(){return this.getAttribute("slot")},set:function(e){return this.setAttribute("slot",e)}}),HTMLContentElement.prototype.assignedNodes=function(){for(var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.deep,r=[],o=n?this.getDistributedNodes():t(this),i=0;i<o.length;i++){var s=o[i],u=s.nodeType;u!==Node.ELEMENT_NODE&&u!==Node.TEXT_NODE||r.push(s)}return r},HTMLContentElement.prototype.getAttribute=function(e){if("name"===e){var t=r.call(this,"select");return t?t.match(/\[slot=['"]?(.*?)['"]?\]/)[1]:null}return r.call(this,e)},HTMLContentElement.prototype.setAttribute=function(e,t){return"name"===e&&(e="select",t="[slot='"+t+"']"),o.call(this,e,t)}},V=document.createElement("div"),z=a(Element.prototype,"innerHTML"),J=!!z,K=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},Q=function(e){return Array.prototype.slice.call(e)},Z=Array.prototype,$=Z.forEach,ee="_shadow_root_",te=["childNodes","parentNode"],ne=["textContent"],re=["assignedSlot"],oe=["textContent"],ie=[],se=[Node.ELEMENT_NODE,Node.TEXT_NODE],ue=new r,ae=new r,le=new r,de=new r,ce=new r,he=new r,fe=new r,pe=new r,ge=new r,ve=new DOMParser,_e={____assignedNodes:{get:function(){return this.______assignedNodes||(this.______assignedNodes=[])}},____isInFallbackMode:{get:function(){return 0===this.assignedNodes().length}},____slotChangeListeners:{get:function(){return"undefined"==typeof this.______slotChangeListeners&&(this.______slotChangeListeners=0),this.______slotChangeListeners},set:function(e){this.______slotChangeListeners=e}},____triggerSlotChangeEvent:{value:n(function(){this.____slotChangeListeners&&this.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1}))})},addEventListener:{value:function(e,t,n){return"slotchange"===e&&h(this)&&this.____slotChangeListeners++,this.__addEventListener(e,t,n)}},appendChild:{value:function(e){return F(this,e),e}},assignedSlot:{get:function(){var e=he.get(this);if(!e)return null;var t=ge.get(e),n=fe.get(t),r=ae.get(n);return"open"===r?e:null}},attachShadow:{value:function(e){var t=this,n=e&&e.mode;if("closed"!==n&&"open"!==n)throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');var r=le.get(this);if(r)return r;var o=m([].slice.call(this.childNodes)),i=document.createElement(e.polyfillShadowRootTagName||ee);return ae.set(this,n),le.set(this,i),fe.set(i,this),pe.set(i,{}),J?de.set(this,o):v(this,"childNodes",o),o.forEach(function(e){t.__removeChild(e),J?ce.set(e,t):v(e,"parentNode",t)}),this.__appendChild(i)}},childElementCount:{get:function(){return this.children.length}},childNodes:{get:function(){if(J&&"node"===y(this))return this.__childNodes;var e=de.get(this);return e||de.set(this,e=m([])),e}},children:{get:function(){var e=[];return o(this,function(t){1===t.nodeType&&e.push(t)}),m(e)}},firstChild:{get:function(){return this.childNodes[0]||null}},firstElementChild:{get:function(){return this.children[0]||null}},assignedNodes:{value:function(){if(h(this)){var e=ue.get(this);return e||ue.set(this,e=[]),e}}},hasChildNodes:{value:function(){return this.childNodes.length>0}},innerHTML:{get:function(){function e(e){return e.nodeType===Node.ELEMENT_NODE&&e.nodeName.toLowerCase()in i}var t="",n=function(e){return e.outerHTML},r={};r[Node.ELEMENT_NODE]=n,r[Node.COMMENT_NODE]=c;var i={style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,noscript:!0,plaintext:!0},s=e(this);return o(this,function(e){var o=void 0;o=e.nodeType===Node.TEXT_NODE?s?d:l:r[e.nodeType]||n,t+=o(e)}),t},set:function(e){for(var t=g(e);this.hasChildNodes();)this.removeChild(this.firstChild);var n=f(t);for($.call(n,function(e){return W(e)});t.hasChildNodes();){var r=t.firstChild;t.removeChild(r),this.appendChild(r)}}},insertBefore:{value:function(e,t){return F(this,e,t),e}},lastChild:{get:function(){var e=this.childNodes;return e[e.length-1]||null}},lastElementChild:{get:function(){var e=this.children;return e[e.length-1]||null}},name:{get:function(){return this.getAttribute("name")},set:function(e){var t=this.name,n=this.__setAttribute("name",e);if(e===t)return n;if(!h(this))return n;var r=ge.get(this);return r&&(R(r,this),x(r,this)),n}},nextSibling:{get:function(){var e=this;return o(this.parentNode,function(t,n,r){if(e===t)return r[n+1]||null})}},nextElementSibling:{get:function(){var e=this,t=void 0;return o(this.parentNode,function(n){return t&&1===n.nodeType?n:void(e===n&&(t=!0))})}},outerHTML:{get:function(){var e=this.tagName.toLowerCase(),t=Array.prototype.slice.call(this.attributes).map(function(e){return" "+e.name+(e.value?'="'+e.value+'"':"")}).join("");return"<"+e+t+">"+this.innerHTML+"</"+e+">"},set:function(e){if(this.parentNode){var t=g(e);this.parentNode.replaceChild(t.firstChild,this)}else{if(!J)throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");this.__outerHTML=e}}},parentElement:{get:function(){return b(this.parentNode,function(e){return 1===e.nodeType})}},parentNode:{get:function(){return ce.get(this)||this.__parentNode||null}},previousSibling:{get:function(){var e=this;return o(this.parentNode,function(t,n,r){if(e===t)return r[n-1]||null})}},previousElementSibling:{get:function(){var e=this,t=void 0;return o(this.parentNode,function(n){return t&&e===n?t:void(1===n.nodeType&&(t=n))})}},removeChild:{value:function(e){var t=y(this);switch(t){case"node":if(J)return ce.set(e,null),this.__removeChild(e);D(this,e);break;case"slot":H(this,e);break;case"host":k(this,e);break;case"root":q(this,e)}return e}},removeEventListener:{value:function(e,t,n){return"slotchange"===e&&this.____slotChangeListeners&&h(this)&&this.____slotChangeListeners--,this.__removeEventListener(e,t,n)}},replaceChild:{value:function(e,t){return this.insertBefore(e,t),this.removeChild(t)}},setAttribute:{value:function(e,t){return"slot"===e&&(this[e]=t),h(this)&&"name"===e&&(this[e]=t),this.__setAttribute(e,t)}},shadowRoot:{get:function(){return"open"===ae.get(this)?le.get(this):null}},slot:{get:function(){return this.getAttribute("slot")},set:function(e){var t=this.name,n=this.__setAttribute("slot",e);if(t===e)return n;var r=he.get(this),o=r&&ge.get(r),i=o&&fe.get(o);return i&&(k(i,this),S(i,this)),n}},textContent:{get:function(){var e="";return o(this,function(t){t.nodeType!==Node.COMMENT_NODE&&(e+=t.textContent)}),e},set:function(e){for(;this.hasChildNodes();)this.removeChild(this.firstChild);e&&this.appendChild(document.createTextNode(e))}}},me=function(){var e=Comment.prototype,t=HTMLElement.prototype,n=SVGElement.prototype,r=Text.prototype,o=document.createTextNode(""),i=document.createComment("");Object.keys(_e).forEach(function(s){var u=_e[s];if(u.configurable=!0,u.enumerable=!0,u.hasOwnProperty("value")&&(u.writable=!0),J||te.indexOf(s)===-1){var l=a(t,s),d=a(r,s),c=a(e,s),h=s in o&&ne.indexOf(s)===-1||~re.indexOf(s),f=s in i&&oe.indexOf(s)===-1||~ie.indexOf(s),p="__"+s;Object.defineProperty(t,s,u),Object.defineProperty(n,s,u),l&&(Object.defineProperty(t,p,l),Object.defineProperty(n,p,l)),h&&Object.defineProperty(r,s,u),h&&d&&Object.defineProperty(r,p,d),f&&Object.defineProperty(e,s,u),f&&c&&Object.defineProperty(e,p,c)}})};Y||(G?U():me()),e.v0=U,e.v1=me,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map

@@ -57,3 +57,3 @@ {

],
"version": "1.2.5"
"version": "1.3.0"
}
// TODO move into the skatejs-web-components package.
import 'custom-event-polyfill';
import debounce from 'debounce';
import WeakMap from 'weakmap';
import { eachChildNode, eachNodeOrFragmentNodes } from './util/each';
import { shadowDomV0, shadowDomV1 } from './util/support';
import canPatchNativeAccessors from './util/can-patch-native-accessors';
import getPropertyDescriptor from './util/get-property-descriptor';
import getEscapedTextContent from './util/get-escaped-text-content';
import getRawTextContent from './util/get-raw-text-content';
import getCommentNodeOuterHtml from './util/get-comment-node-outer-html';
import findSlots from './util/find-slots';
import isRootNode from './util/is-root-node';
import isSlotNode from './util/is-slot-node';
import pseudoArrayToArray from './util/pseudo-array-to-array';
import v0 from './v0';
import version from './version';
import v1 from './v1';
const arrProto = Array.prototype;
const { forEach } = arrProto;
// We use a real DOM node for a shadow root. This is because the host node
// basically becomes a virtual entry point for your element leaving the shadow
// root the only thing that can receive instructions on how the host should
// render to the browser.
const defaultShadowRootTagName = '_shadow_root_';
// * WebKit only *
//
// These members we need cannot override as we require native access to their
// original values at some point.
const polyfillAtRuntime = ['childNodes', 'parentNode'];
// Some properties that should not be overridden in the Text prototype.
const doNotOverridePropertiesInTextNodes = ['textContent'];
// Some new properties that should be defined in the Text prototype.
const defineInTextNodes = ['assignedSlot'];
// Some properties that should not be overridden in the Comment prototype.
const doNotOverridePropertiesInCommNodes = ['textContent'];
// Some new properties that should be defined in the Comment prototype.
const defineInCommNodes = [];
// Nodes that should be slotted
const slottedNodeTypes = [Node.ELEMENT_NODE, Node.TEXT_NODE];
// Private data stores.
const assignedToSlotMap = new WeakMap();
const hostToModeMap = new WeakMap();
const hostToRootMap = new WeakMap();
const nodeToChildNodesMap = new WeakMap();
const nodeToParentNodeMap = new WeakMap();
const nodeToSlotMap = new WeakMap();
const rootToHostMap = new WeakMap();
const rootToSlotMap = new WeakMap();
const slotToRootMap = new WeakMap();
// Unfortunately manual DOM parsing is because of WebKit.
const parser = new DOMParser();
function parse(html) {
const tree = document.createElement('div');
// Everything not WebKit can do this easily.
if (canPatchNativeAccessors) {
tree.__innerHTML = html;
return tree;
}
const parsed = parser.parseFromString(`<div>${html}</div>`, 'text/html').body.firstChild;
while (parsed.hasChildNodes()) {
const firstChild = parsed.firstChild;
parsed.removeChild(firstChild);
tree.appendChild(firstChild);
}
// Need to import the node to initialise the custom elements from the parser.
return document.importNode(tree, true);
}
function staticProp(obj, name, value) {
Object.defineProperty(obj, name, {
configurable: true,
get() { return value; },
});
}
// Slotting helpers.
function arrayItem(idx) {
return this[idx];
}
function makeLikeNodeList(arr) {
arr.item = arrayItem;
return arr;
}
function isHostNode(node) {
return !!hostToRootMap.get(node);
}
function getNodeType(node) {
if (isHostNode(node)) {
return 'host';
}
if (isSlotNode(node)) {
return 'slot';
}
if (isRootNode(node)) {
return 'root';
}
return 'node';
}
function findClosest(node, func) {
while (node) {
if (node === document) {
break;
}
if (func(node)) {
return node;
}
node = node.parentNode;
}
}
function getSlotNameFromSlot(node) {
return (node.getAttribute && node.getAttribute('name')) || 'default';
}
function getSlotNameFromNode(node) {
return (node.getAttribute && node.getAttribute('slot')) || 'default';
}
function slotNodeIntoSlot(slot, node, insertBefore) {
// Only Text and Element nodes should be slotted.
if (slottedNodeTypes.indexOf(node.nodeType) === -1) {
return;
}
const assignedNodes = slot.assignedNodes();
const shouldGoIntoContentMode = assignedNodes.length === 0;
const slotInsertBeforeIndex = assignedNodes.indexOf(insertBefore);
// Assign the slot to the node internally.
nodeToSlotMap.set(node, slot);
// Remove the fallback content and state if we're going into content mode.
if (shouldGoIntoContentMode) {
forEach.call(slot.childNodes, child => slot.__removeChild(child));
}
if (slotInsertBeforeIndex > -1) {
slot.__insertBefore(node, insertBefore !== undefined ? insertBefore : null);
assignedNodes.splice(slotInsertBeforeIndex, 0, node);
} else {
slot.__appendChild(node);
assignedNodes.push(node);
}
slot.____triggerSlotChangeEvent();
}
function slotNodeFromSlot(node) {
const slot = nodeToSlotMap.get(node);
if (slot) {
const assignedNodes = slot.assignedNodes();
const index = assignedNodes.indexOf(node);
if (index > -1) {
const shouldGoIntoDefaultMode = assignedNodes.length === 1;
assignedNodes.splice(index, 1);
nodeToSlotMap.set(node, null);
// Actually remove the child.
slot.__removeChild(node);
// If this was the last slotted node, then insert fallback content.
if (shouldGoIntoDefaultMode) {
forEach.call(slot.childNodes, child => slot.__appendChild(child));
}
slot.____triggerSlotChangeEvent();
}
}
}
// Returns the index of the node in the host's childNodes.
function indexOfNode(host, node) {
const chs = host.childNodes;
const chsLen = chs.length;
for (let a = 0; a < chsLen; a++) {
if (chs[a] === node) {
return a;
}
}
return -1;
}
// Adds the node to the list of childNodes on the host and fakes any necessary
// information such as parentNode.
function registerNode(host, node, insertBefore, func) {
const index = indexOfNode(host, insertBefore);
eachNodeOrFragmentNodes(node, (eachNode, eachIndex) => {
func(eachNode, eachIndex);
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(eachNode, host);
} else {
staticProp(eachNode, 'parentNode', host);
}
if (index > -1) {
arrProto.splice.call(host.childNodes, index + eachIndex, 0, eachNode);
} else {
arrProto.push.call(host.childNodes, eachNode);
}
});
}
// Cleans up registerNode().
function unregisterNode(host, node, func) {
const index = indexOfNode(host, node);
if (index > -1) {
func(node, 0);
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(node, null);
} else {
staticProp(node, 'parentNode', null);
}
arrProto.splice.call(host.childNodes, index, 1);
}
}
function addNodeToNode(host, node, insertBefore) {
registerNode(host, node, insertBefore, eachNode => {
host.__insertBefore(eachNode, insertBefore !== undefined ? insertBefore : null);
});
}
function addNodeToHost(host, node, insertBefore) {
registerNode(host, node, insertBefore, eachNode => {
const rootNode = hostToRootMap.get(host);
const slotNodes = rootToSlotMap.get(rootNode);
const slotNode = slotNodes[getSlotNameFromNode(eachNode)];
if (slotNode) {
slotNodeIntoSlot(slotNode, eachNode, insertBefore);
}
});
}
function addSlotToRoot(root, slot) {
const slotName = getSlotNameFromSlot(slot);
// Ensure a slot node's childNodes are overridden at the earliest point
// possible for WebKit.
if (!canPatchNativeAccessors && !Array.isArray(slot.childNodes)) {
staticProp(slot, 'childNodes', pseudoArrayToArray(slot.childNodes));
}
rootToSlotMap.get(root)[slotName] = slot;
if (!slotToRootMap.has(slot)) {
slotToRootMap.set(slot, root);
}
eachChildNode(rootToHostMap.get(root), eachNode => {
if (!eachNode.assignedSlot && slotName === getSlotNameFromNode(eachNode)) {
slotNodeIntoSlot(slot, eachNode);
}
});
}
function addNodeToRoot(root, node, insertBefore) {
eachNodeOrFragmentNodes(node, child => {
if (isSlotNode(child)) {
addSlotToRoot(root, child);
} else {
const slotNodes = findSlots(child);
if (slotNodes) {
const slotNodesLen = slotNodes.length;
for (let a = 0; a < slotNodesLen; a++) {
addSlotToRoot(root, slotNodes[a]);
}
}
}
});
addNodeToNode(root, node, insertBefore);
}
// Adds a node to a slot. In other words, adds default content to a slot. It
// ensures that if the slot doesn't have any assigned nodes yet, that the node
// is actually displayed, otherwise it's just registered as child content.
function addNodeToSlot(slot, node, insertBefore) {
const isInDefaultMode = slot.assignedNodes().length === 0;
registerNode(slot, node, insertBefore, eachNode => {
if (isInDefaultMode) {
slot.__insertBefore(eachNode, insertBefore !== undefined ? insertBefore : null);
}
});
}
// Removes a node from a slot (default content). It ensures that if the slot
// doesn't have any assigned nodes yet, that the node is actually removed,
// otherwise it's just unregistered.
function removeNodeFromSlot(slot, node) {
const isInDefaultMode = slot.assignedNodes().length === 0;
unregisterNode(slot, node, () => {
if (isInDefaultMode) {
slot.__removeChild(node);
}
});
}
function removeNodeFromNode(host, node) {
unregisterNode(host, node, () => {
host.__removeChild(node);
});
}
function removeNodeFromHost(host, node) {
unregisterNode(host, node, () => {
slotNodeFromSlot(node);
});
}
function removeSlotFromRoot(root, node) {
const assignedNodes = Array.prototype.slice.call(node.assignedNodes());
assignedNodes.forEach(slotNodeFromSlot);
delete rootToSlotMap.get(root)[getSlotNameFromSlot(node)];
slotToRootMap.delete(node);
}
function removeNodeFromRoot(root, node) {
unregisterNode(root, node, () => {
if (isSlotNode(node)) {
removeSlotFromRoot(root, node);
} else {
const nodes = findSlots(node);
if (nodes) {
for (let a = 0; a < nodes.length; a++) {
removeSlotFromRoot(root, nodes[a]);
}
}
}
root.__removeChild(node);
});
}
// TODO terribly inefficient
function getRootNode(host) {
if (isRootNode(host)) {
return host;
}
if (!host.parentNode) {
return;
}
return getRootNode(host.parentNode);
}
function appendChildOrInsertBefore(host, newNode, refNode) {
const nodeType = getNodeType(host);
const parentNode = newNode.parentNode;
const rootNode = getRootNode(host);
// Ensure childNodes is patched so we can manually update it for WebKit.
if (!canPatchNativeAccessors && !Array.isArray(host.childNodes)) {
staticProp(host, 'childNodes', pseudoArrayToArray(host.childNodes));
}
if (rootNode && getNodeType(newNode) === 'slot') {
addSlotToRoot(rootNode, newNode);
}
// If we append a child to a host, the host tells the shadow root to distribute
// it. If the root decides it doesn't need to be distributed, it is never
// removed from the old parent because in polyfill land we store a reference
// to the node but we don't move it. Due to that, we must explicitly remove the
// node from its old parent.
if (parentNode && getNodeType(parentNode) === 'host') {
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(newNode, null);
} else {
staticProp(newNode, 'parentNode', null);
}
}
if (nodeType === 'node') {
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(newNode, host);
return host.__insertBefore(newNode, refNode !== undefined ? refNode : null);
}
return addNodeToNode(host, newNode, refNode);
}
if (nodeType === 'slot') {
return addNodeToSlot(host, newNode, refNode);
}
if (nodeType === 'host') {
return addNodeToHost(host, newNode, refNode);
}
if (nodeType === 'root') {
return addNodeToRoot(host, newNode, refNode);
}
}
function syncSlotChildNodes(node) {
if (canPatchNativeAccessors && getNodeType(node) === 'slot' && (node.__childNodes.length !== node.childNodes.length)) {
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
forEach.call(node.__childNodes, child => node.appendChild(child));
}
}
const members = {
// For testing purposes.
____assignedNodes: {
get() {
return this.______assignedNodes || (this.______assignedNodes = []);
},
},
// For testing purposes.
____isInFallbackMode: {
get() {
return this.assignedNodes().length === 0;
},
},
____slotChangeListeners: {
get() {
if (typeof this.______slotChangeListeners === 'undefined') {
this.______slotChangeListeners = 0;
}
return this.______slotChangeListeners;
},
set(value) {
this.______slotChangeListeners = value;
},
},
____triggerSlotChangeEvent: {
value: debounce(function callback() {
if (this.____slotChangeListeners) {
this.dispatchEvent(new CustomEvent('slotchange', {
bubbles: false,
cancelable: false,
}));
}
}),
},
addEventListener: {
value(name, func, opts) {
if (name === 'slotchange' && isSlotNode(this)) {
this.____slotChangeListeners++;
}
return this.__addEventListener(name, func, opts);
},
},
appendChild: {
value(newNode) {
appendChildOrInsertBefore(this, newNode);
return newNode;
},
},
assignedSlot: {
get() {
const slot = nodeToSlotMap.get(this);
if (!slot) {
return null;
}
const root = slotToRootMap.get(slot);
const host = rootToHostMap.get(root);
const mode = hostToModeMap.get(host);
return mode === 'open' ? slot : null;
},
},
attachShadow: {
value(opts) {
const mode = opts && opts.mode;
if (mode !== 'closed' && mode !== 'open') {
throw new Error('You must specify { mode } as "open" or "closed" to attachShadow().');
}
// Return the existing shadow root if it exists.
const existingShadowRoot = hostToRootMap.get(this);
if (existingShadowRoot) {
return existingShadowRoot;
}
const lightNodes = makeLikeNodeList([].slice.call(this.childNodes));
const shadowRoot = document.createElement(opts.polyfillShadowRootTagName || defaultShadowRootTagName);
// Host and shadow root data.
hostToModeMap.set(this, mode);
hostToRootMap.set(this, shadowRoot);
rootToHostMap.set(shadowRoot, this);
rootToSlotMap.set(shadowRoot, {});
if (canPatchNativeAccessors) {
nodeToChildNodesMap.set(this, lightNodes);
} else {
staticProp(this, 'childNodes', lightNodes);
}
// Process light DOM.
lightNodes.forEach(node => {
// Existing children should be removed from being displayed, but still
// appear to be child nodes. This is how light DOM works; they're still
// child nodes but not in the composed DOM yet as there won't be any
// slots for them to go into.
this.__removeChild(node);
// We must register the parentNode here as this has the potential to
// become out of sync if the node is moved before being slotted.
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(node, this);
} else {
staticProp(node, 'parentNode', this);
}
});
// The shadow root is actually the only child of the host.
return this.__appendChild(shadowRoot);
},
},
childElementCount: {
get() {
return this.children.length;
},
},
childNodes: {
get() {
if (canPatchNativeAccessors && getNodeType(this) === 'node') {
return this.__childNodes;
}
let childNodes = nodeToChildNodesMap.get(this);
if (!childNodes) {
nodeToChildNodesMap.set(this, childNodes = makeLikeNodeList([]));
}
return childNodes;
},
},
children: {
get() {
const chs = [];
eachChildNode(this, node => {
if (node.nodeType === 1) {
chs.push(node);
}
});
return makeLikeNodeList(chs);
},
},
firstChild: {
get() {
return this.childNodes[0] || null;
},
},
firstElementChild: {
get() {
return this.children[0] || null;
},
},
assignedNodes: {
value() {
if (isSlotNode(this)) {
let assigned = assignedToSlotMap.get(this);
if (!assigned) {
assignedToSlotMap.set(this, assigned = []);
}
return assigned;
}
},
},
hasChildNodes: {
value() {
return this.childNodes.length > 0;
},
},
innerHTML: {
get() {
let innerHTML = '';
const getHtmlNodeOuterHtml = (node) => node.outerHTML;
const getOuterHtmlByNodeType = {};
getOuterHtmlByNodeType[Node.ELEMENT_NODE] = getHtmlNodeOuterHtml;
getOuterHtmlByNodeType[Node.COMMENT_NODE] = getCommentNodeOuterHtml;
// Text nodes with these ancestors should be treated as raw text
// See section 8.4 of
// https://www.w3.org/TR/2008/WD-html5-20080610/serializing.html#html-fragment
// Though Chrome does not adhere to spec for <noscript/>
const rawTextNodeNames = {
style: true,
script: true,
xmp: true,
iframe: true,
noembed: true,
noframes: true,
noscript: true,
plaintext: true,
};
function isRawTextNode(node) {
return node.nodeType === Node.ELEMENT_NODE &&
node.nodeName.toLowerCase() in rawTextNodeNames;
}
const isParentNodeRawText = isRawTextNode(this);
eachChildNode(this, node => {
let getOuterHtml;
if (node.nodeType === Node.TEXT_NODE) {
if (isParentNodeRawText) {
getOuterHtml = getRawTextContent;
} else {
getOuterHtml = getEscapedTextContent;
}
} else {
getOuterHtml = getOuterHtmlByNodeType[node.nodeType] || getHtmlNodeOuterHtml;
}
innerHTML += getOuterHtml(node);
});
return innerHTML;
},
set(innerHTML) {
const parsed = parse(innerHTML);
while (this.hasChildNodes()) {
this.removeChild(this.firstChild);
}
// when we are doing this: root.innerHTML = "<slot><div></div></slot>";
// slot.__childNodes is out of sync with slot.childNodes.
// to fix it we have to manually remove and insert them
const slots = findSlots(parsed);
forEach.call(slots, slot => syncSlotChildNodes(slot));
while (parsed.hasChildNodes()) {
const firstChild = parsed.firstChild;
// When we polyfill everything on HTMLElement.prototype, we overwrite
// properties. This makes it so that parentNode reports null even though
// it's actually a parent of the HTML parser. For this reason,
// cleanNode() won't work and we must manually remove it from the
// parser before it is moved to the host just in case it's added as a
// light node but not assigned to a slot.
parsed.removeChild(firstChild);
this.appendChild(firstChild);
}
},
},
insertBefore: {
value(newNode, refNode) {
appendChildOrInsertBefore(this, newNode, refNode);
return newNode;
},
},
lastChild: {
get() {
const ch = this.childNodes;
return ch[ch.length - 1] || null;
},
},
lastElementChild: {
get() {
const ch = this.children;
return ch[ch.length - 1] || null;
},
},
name: {
get() {
return this.getAttribute('name');
},
set(name) {
const oldName = this.name;
const ret = this.__setAttribute('name', name);
if (name === oldName) {
return ret;
}
if (!isSlotNode(this)) {
return ret;
}
const root = slotToRootMap.get(this);
if (root) {
removeSlotFromRoot(root, this);
addSlotToRoot(root, this);
}
return ret;
},
},
nextSibling: {
get() {
const host = this;
return eachChildNode(this.parentNode, (child, index, nodes) => {
if (host === child) {
return nodes[index + 1] || null;
}
});
},
},
nextElementSibling: {
get() {
const host = this;
let found;
return eachChildNode(this.parentNode, child => {
if (found && child.nodeType === 1) {
return child;
}
if (host === child) {
found = true;
}
});
},
},
outerHTML: {
get() {
const name = this.tagName.toLowerCase();
const attributes = Array.prototype.slice.call(this.attributes).map((attr) =>
(` ${attr.name}${attr.value ? `="${attr.value}"` : ''}`)
).join('');
return `<${name}${attributes}>${this.innerHTML}</${name}>`;
},
set(outerHTML) {
if (this.parentNode) {
const parsed = parse(outerHTML);
this.parentNode.replaceChild(parsed.firstChild, this);
} else if (canPatchNativeAccessors) {
this.__outerHTML = outerHTML; // this will throw a native error;
} else {
throw new Error('Failed to set the \'outerHTML\' property on \'Element\': This element has no parent node.');
}
},
},
parentElement: {
get() {
return findClosest(this.parentNode, (node) => node.nodeType === 1);
},
},
parentNode: {
get() {
return nodeToParentNodeMap.get(this) || this.__parentNode || null;
},
},
previousSibling: {
get() {
const host = this;
return eachChildNode(this.parentNode, (child, index, nodes) => {
if (host === child) {
return nodes[index - 1] || null;
}
});
},
},
previousElementSibling: {
get() {
const host = this;
let found;
return eachChildNode(this.parentNode, child => {
if (found && host === child) {
return found;
}
if (child.nodeType === 1) {
found = child;
}
});
},
},
removeChild: {
value(refNode) {
const nodeType = getNodeType(this);
switch (nodeType) {
case 'node':
if (canPatchNativeAccessors) {
nodeToParentNodeMap.set(refNode, null);
return this.__removeChild(refNode);
}
removeNodeFromNode(this, refNode);
break;
case 'slot':
removeNodeFromSlot(this, refNode);
break;
case 'host':
removeNodeFromHost(this, refNode);
break;
case 'root':
removeNodeFromRoot(this, refNode);
break;
default:
break;
}
return refNode;
},
},
removeEventListener: {
value(name, func, opts) {
if (name === 'slotchange' && this.____slotChangeListeners && isSlotNode(this)) {
this.____slotChangeListeners--;
}
return this.__removeEventListener(name, func, opts);
},
},
replaceChild: {
value(newNode, refNode) {
this.insertBefore(newNode, refNode);
return this.removeChild(refNode);
},
},
setAttribute: {
value(attrName, attrValue) {
if (attrName === 'slot') {
this[attrName] = attrValue;
}
if (isSlotNode(this)) {
if (attrName === 'name') {
this[attrName] = attrValue;
}
}
return this.__setAttribute(attrName, attrValue);
},
},
shadowRoot: {
get() {
return hostToModeMap.get(this) === 'open' ? hostToRootMap.get(this) : null;
},
},
slot: {
get() {
return this.getAttribute('slot');
},
set(name) {
const oldName = this.name;
const ret = this.__setAttribute('slot', name);
if (oldName === name) {
return ret;
}
const slot = nodeToSlotMap.get(this);
const root = slot && slotToRootMap.get(slot);
const host = root && rootToHostMap.get(root);
if (host) {
removeNodeFromHost(host, this);
addNodeToHost(host, this);
}
return ret;
},
},
textContent: {
get() {
let textContent = '';
eachChildNode(this, node => {
if (node.nodeType !== Node.COMMENT_NODE) {
textContent += node.textContent;
}
});
return textContent;
},
set(textContent) {
while (this.hasChildNodes()) {
this.removeChild(this.firstChild);
}
if (!textContent) {
return;
}
this.appendChild(document.createTextNode(textContent));
},
},
};
if (shadowDomV1) {

@@ -912,63 +12,5 @@ // then we should probably not be loading this

} else {
const commProto = Comment.prototype;
const elementProto = HTMLElement.prototype;
const svgProto = SVGElement.prototype;
const textProto = Text.prototype;
const textNode = document.createTextNode('');
const commNode = document.createComment('');
Object.keys(members).forEach(memberName => {
const memberProperty = members[memberName];
// All properties should be configurable and enumerable.
memberProperty.configurable = true;
memberProperty.enumerable = true;
// Applying to the data properties only since we can't have writable accessor properties.
if (memberProperty.hasOwnProperty('value')) { // eslint-disable-line no-prototype-builtins
memberProperty.writable = true;
}
// Polyfill as much as we can and work around WebKit in other areas.
if (canPatchNativeAccessors || polyfillAtRuntime.indexOf(memberName) === -1) {
const nativeDescriptor = getPropertyDescriptor(elementProto, memberName);
const nativeTextDescriptor = getPropertyDescriptor(textProto, memberName);
const nativeCommDescriptor = getPropertyDescriptor(commProto, memberName);
const shouldOverrideInTextNode = (
memberName in textNode &&
doNotOverridePropertiesInTextNodes.indexOf(memberName) === -1
) || ~defineInTextNodes.indexOf(memberName);
const shouldOverrideInCommentNode = (
memberName in commNode &&
doNotOverridePropertiesInCommNodes.indexOf(memberName) === -1
) || ~defineInCommNodes.indexOf(memberName);
const nativeMemberName = `__${memberName}`;
Object.defineProperty(elementProto, memberName, memberProperty);
Object.defineProperty(svgProto, memberName, memberProperty);
if (nativeDescriptor) {
Object.defineProperty(elementProto, nativeMemberName, nativeDescriptor);
Object.defineProperty(svgProto, nativeMemberName, nativeDescriptor);
}
if (shouldOverrideInTextNode) {
Object.defineProperty(textProto, memberName, memberProperty);
}
if (shouldOverrideInTextNode && nativeTextDescriptor) {
Object.defineProperty(textProto, nativeMemberName, nativeTextDescriptor);
}
if (shouldOverrideInCommentNode) {
Object.defineProperty(commProto, memberName, memberProperty);
}
if (shouldOverrideInCommentNode && nativeCommDescriptor) {
Object.defineProperty(commProto, nativeMemberName, nativeCommDescriptor);
}
}
});
v1();
}
export default version;
export { v0, v1 };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc