Skip to content

Instantly share code, notes, and snippets.

@jimmont
Last active November 3, 2021 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmont/5ed5a9814d4d75ea88f134838bc87c59 to your computer and use it in GitHub Desktop.
Save jimmont/5ed5a9814d4d75ea88f134838bc87c59 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
if (typeof document === 'undefined' || 'adoptedStyleSheets' in document) {
return;
}
var hasShadyCss = 'ShadyCSS' in window && !ShadyCSS.nativeShadow;
var bootstrapper = document.implementation.createHTMLDocument('');
var closedShadowRootRegistry = new WeakMap();
var _DOMException = typeof DOMException === 'object' ? Error : DOMException;
var defineProperty = Object.defineProperty;
var forEach = Array.prototype.forEach;
var importPattern = /@import.+?;?$/gm;
function rejectImports(contents) {
var _contents = contents.replace(importPattern, '');
if (_contents !== contents) {
console.warn('@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418');
}
return _contents.trim();
}
function isElementConnected(element) {
return 'isConnected' in element ? element.isConnected : document.contains(element);
}
function unique(arr) {
return arr.filter(function(value, index) {
return arr.indexOf(value) === index;
});
}
function diff(arr1, arr2) {
return arr1.filter(function(value) {
return arr2.indexOf(value) === -1;
});
}
function removeNode(node) {
node.parentNode.removeChild(node);
}
function getShadowRoot(element) {
return element.shadowRoot || closedShadowRootRegistry.get(element);
}
var cssStyleSheetMethods = [
'addRule',
'deleteRule',
'insertRule',
'removeRule'
];
var NonConstructedStyleSheet = CSSStyleSheet;
var nonConstructedProto = NonConstructedStyleSheet.prototype;
nonConstructedProto.replace = function() {
return Promise.reject(new _DOMException("Can't call replace on non-constructed CSSStyleSheets."));
};
nonConstructedProto.replaceSync = function() {
throw new _DOMException("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.");
};
function isCSSStyleSheetInstance(instance) {
return typeof instance === 'object' ? proto$1.isPrototypeOf(instance) || nonConstructedProto.isPrototypeOf(instance) : false;
}
function isNonConstructedStyleSheetInstance(instance) {
return typeof instance === 'object' ? nonConstructedProto.isPrototypeOf(instance) : false;
}
var $basicStyleElement = new WeakMap();
var $locations = new WeakMap();
var $adoptersByLocation = new WeakMap();
var $appliedMethods = new WeakMap();
function addAdopterLocation(sheet, location) {
var adopter = document.createElement('style');
$adoptersByLocation.get(sheet).set(location, adopter);
$locations.get(sheet).push(location);
return adopter;
}
function getAdopterByLocation(sheet, location) {
return $adoptersByLocation.get(sheet).get(location);
}
function removeAdopterLocation(sheet, location) {
$adoptersByLocation.get(sheet).delete(location);
$locations.set(sheet, $locations.get(sheet).filter(function(_location) {
return _location !== location;
}));
}
function restyleAdopter(sheet, adopter) {
requestAnimationFrame(function() {
adopter.textContent = $basicStyleElement.get(sheet).textContent;
$appliedMethods.get(sheet).forEach(function(command) {
return adopter.sheet[command.method].apply(adopter.sheet, command.args);
});
});
}
function checkInvocationCorrectness(self) {
if (!$basicStyleElement.has(self)) {
throw new TypeError('Illegal invocation');
}
}
function ConstructedStyleSheet() {
var self = this;
var style = document.createElement('style');
bootstrapper.body.appendChild(style);
$basicStyleElement.set(self, style);
$locations.set(self, []);
$adoptersByLocation.set(self, new WeakMap());
$appliedMethods.set(self, []);
}
var proto$1 = ConstructedStyleSheet.prototype;
proto$1.replace = function replace(contents) {
try {
this.replaceSync(contents);
return Promise.resolve(this);
} catch (e) {
return Promise.reject(e);
}
};
proto$1.replaceSync = function replaceSync(contents) {
checkInvocationCorrectness(this);
if (typeof contents === 'string') {
var self_1 = this;
$basicStyleElement.get(self_1).textContent = rejectImports(contents);
$appliedMethods.set(self_1, []);
$locations.get(self_1).forEach(function(location) {
if (location.isConnected()) {
restyleAdopter(self_1, getAdopterByLocation(self_1, location));
}
});
}
};
defineProperty(proto$1, 'cssRules', {
configurable: true,
enumerable: true,
get: function cssRules() {
checkInvocationCorrectness(this);
return $basicStyleElement.get(this).sheet.cssRules;
}
});
cssStyleSheetMethods.forEach(function(method) {
proto$1[method] = function() {
var self = this;
checkInvocationCorrectness(self);
var args = arguments;
$appliedMethods.get(self).push({
method: method,
args: args
});
$locations.get(self).forEach(function(location) {
if (location.isConnected()) {
var sheet = getAdopterByLocation(self, location).sheet;
sheet[method].apply(sheet, args);
}
});
var basicSheet = $basicStyleElement.get(self).sheet;
return basicSheet[method].apply(basicSheet, args);
};
});
defineProperty(ConstructedStyleSheet, Symbol.hasInstance, {
configurable: true,
value: isCSSStyleSheetInstance
});
var defaultObserverOptions = {
childList: true,
subtree: true
};
var locations = new WeakMap();
function getAssociatedLocation(element) {
var location = locations.get(element);
if (!location) {
location = new Location(element);
locations.set(element, location);
}
return location;
}
function attachAdoptedStyleSheetProperty(constructor) {
defineProperty(constructor.prototype, 'adoptedStyleSheets', {
configurable: true,
enumerable: true,
get: function() {
return getAssociatedLocation(this).sheets;
},
set: function(sheets) {
getAssociatedLocation(this).update(sheets);
}
});
}
function traverseWebComponents(node, callback) {
var iter = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT, function(foundNode) {
return getShadowRoot(foundNode) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
}, null, false);
for(var next = void 0; next = iter.nextNode();){
callback(getShadowRoot(next));
}
}
var $element = new WeakMap();
var $uniqueSheets = new WeakMap();
var $observer = new WeakMap();
function isExistingAdopter(self, element) {
return element instanceof HTMLStyleElement && $uniqueSheets.get(self).some(function(sheet) {
return getAdopterByLocation(sheet, self);
});
}
function getAdopterContainer(self) {
var element = $element.get(self);
return element instanceof Document ? element.body : element;
}
function adopt(self) {
var styleList = document.createDocumentFragment();
var sheets = $uniqueSheets.get(self);
var observer = $observer.get(self);
var container = getAdopterContainer(self);
observer.disconnect();
sheets.forEach(function(sheet) {
styleList.appendChild(getAdopterByLocation(sheet, self) || addAdopterLocation(sheet, self));
});
container.insertBefore(styleList, null);
observer.observe(container, defaultObserverOptions);
sheets.forEach(function(sheet) {
restyleAdopter(sheet, getAdopterByLocation(sheet, self));
});
}
function Location(element) {
var self = this;
self.sheets = [];
$element.set(self, element);
$uniqueSheets.set(self, []);
$observer.set(self, new MutationObserver(function(mutations, observer) {
if (!document) {
observer.disconnect();
return;
}
mutations.forEach(function(mutation) {
if (!hasShadyCss) {
forEach.call(mutation.addedNodes, function(node) {
if (!(node instanceof Element)) {
return;
}
traverseWebComponents(node, function(root) {
getAssociatedLocation(root).connect();
});
});
}
forEach.call(mutation.removedNodes, function(node) {
if (!(node instanceof Element)) {
return;
}
if (isExistingAdopter(self, node)) {
adopt(self);
}
if (!hasShadyCss) {
traverseWebComponents(node, function(root) {
getAssociatedLocation(root).disconnect();
});
}
});
});
}));
}
Location.prototype = {
isConnected: function() {
var element = $element.get(this);
return element instanceof Document ? element.readyState !== 'loading' : isElementConnected(element.host);
},
connect: function() {
var container = getAdopterContainer(this);
$observer.get(this).observe(container, defaultObserverOptions);
if ($uniqueSheets.get(this).length > 0) {
adopt(this);
}
traverseWebComponents(container, function(root) {
getAssociatedLocation(root).connect();
});
},
disconnect: function() {
$observer.get(this).disconnect();
},
update: function(sheets) {
var self = this;
var locationType = $element.get(self) === document ? 'Document' : 'ShadowRoot';
if (!Array.isArray(sheets)) {
throw new TypeError("Failed to set the 'adoptedStyleSheets' property on " + locationType + ": Iterator getter is not callable.");
}
if (!sheets.every(isCSSStyleSheetInstance)) {
throw new TypeError("Failed to set the 'adoptedStyleSheets' property on " + locationType + ": Failed to convert value to 'CSSStyleSheet'");
}
if (sheets.some(isNonConstructedStyleSheetInstance)) {
throw new TypeError("Failed to set the 'adoptedStyleSheets' property on " + locationType + ": Can't adopt non-constructed stylesheets");
}
self.sheets = sheets;
var oldUniqueSheets = $uniqueSheets.get(self);
var uniqueSheets = unique(sheets);
var removedSheets = diff(oldUniqueSheets, uniqueSheets);
removedSheets.forEach(function(sheet) {
removeNode(getAdopterByLocation(sheet, self));
removeAdopterLocation(sheet, self);
});
$uniqueSheets.set(self, uniqueSheets);
if (self.isConnected() && uniqueSheets.length > 0) {
adopt(self);
}
}
};
window.CSSStyleSheet = ConstructedStyleSheet;
attachAdoptedStyleSheetProperty(Document);
if ('ShadowRoot' in window) {
attachAdoptedStyleSheetProperty(ShadowRoot);
var proto = Element.prototype;
var attach_1 = proto.attachShadow;
proto.attachShadow = function attachShadow(init) {
var root = attach_1.call(this, init);
if (init.mode === 'closed') {
closedShadowRootRegistry.set(this, root);
}
return root;
};
}
var documentLocation = getAssociatedLocation(document);
if (documentLocation.isConnected()) {
documentLocation.connect();
} else {
document.addEventListener('DOMContentLoaded', documentLocation.connect.bind(documentLocation));
}
})();
(function() {
'use strict';
const refMap = new WeakMap();
const validityMap = new WeakMap();
const hiddenInputMap = new WeakMap();
const internalsMap = new WeakMap();
const validationMessageMap = new WeakMap();
const formsMap = new WeakMap();
const shadowHostsMap = new WeakMap();
const formElementsMap = new WeakMap();
const refValueMap = new WeakMap();
const upgradeMap = new WeakMap();
const shadowRootMap = new WeakMap();
const validationAnchorMap = new WeakMap();
const documentFragmentMap = new WeakMap();
const onSubmitMap = new WeakMap();
const observerConfig$1 = {
attributes: true,
attributeFilter: [
'disabled'
]
};
const observer = new MutationObserver((mutationsList)=>{
for (const mutation of mutationsList){
const target = mutation.target;
if (target.constructor['formAssociated']) {
const isDisabled = target.hasAttribute('disabled');
target.toggleAttribute('internals-disabled', isDisabled);
if (target.formDisabledCallback) {
target.formDisabledCallback.apply(target, [
target.hasAttribute('disabled')
]);
}
}
}
});
const removeHiddenInputs = (internals)=>{
const hiddenInputs = hiddenInputMap.get(internals);
hiddenInputs.forEach((hiddenInput)=>{
hiddenInput.remove();
});
hiddenInputMap.set(internals, []);
};
const createHiddenInput = (ref, internals)=>{
const input = document.createElement('input');
input.type = 'hidden';
input.name = ref.getAttribute('name');
ref.after(input);
hiddenInputMap.get(internals).push(input);
return input;
};
const initRef = (ref, internals)=>{
hiddenInputMap.set(internals, []);
const isDisabled = ref.hasAttribute('disabled');
ref.toggleAttribute('internals-disabled', isDisabled);
observer.observe(ref, observerConfig$1);
};
const initLabels = (ref, labels)=>{
if (labels.length) {
Array.from(labels).forEach((label)=>label.addEventListener('click', ref.focus.bind(ref))
);
let firstLabelId = labels[0].id;
if (!labels[0].id) {
firstLabelId = `${labels[0].htmlFor}_Label`;
labels[0].id = firstLabelId;
}
ref.setAttribute('aria-labelledby', firstLabelId);
}
};
const formSubmitCallback = (event)=>{
const form = event.target;
const elements = formElementsMap.get(form);
if (elements.size) {
const nodes = Array.from(elements);
const validityList = nodes.reverse().map((node)=>{
const internals = internalsMap.get(node);
return internals.reportValidity();
});
if (validityList.includes(false)) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
} else if (onSubmitMap.get(form)) {
const callback = onSubmitMap.get(form);
const canceled = callback.call(form, event);
if (canceled === false) {
event.preventDefault();
}
}
}
};
const formResetCallback = (event)=>{
const elements = formElementsMap.get(event.target);
if (elements && elements.size) {
elements.forEach((element)=>{
if (element.constructor.formAssociated && element.formResetCallback) {
element.formResetCallback.apply(element);
}
});
}
};
const initForm = (ref, form, internals)=>{
if (form) {
if (form.onsubmit) {
onSubmitMap.set(form, form.onsubmit.bind(form));
form.onsubmit = null;
}
const formElements = formElementsMap.get(form);
if (formElements) {
formElements.add(ref);
} else {
const initSet = new Set();
initSet.add(ref);
formElementsMap.set(form, initSet);
form.addEventListener('submit', formSubmitCallback);
form.addEventListener('reset', formResetCallback);
}
formsMap.set(form, {
ref,
internals
});
if (ref.constructor['formAssociated'] && ref.formAssociatedCallback) {
setTimeout(()=>{
ref.formAssociatedCallback.apply(ref, [
form
]);
}, 0);
}
}
};
const findParentForm = (elem)=>{
let parent = elem.parentNode;
if (parent && parent.tagName !== 'FORM') {
parent = findParentForm(parent);
} else if (!parent && elem.toString() === '[object ShadowRoot]') {
parent = findParentForm(elem.host);
}
return parent;
};
const throwIfNotFormAssociated = (ref, message, ErrorType = DOMException)=>{
if (!ref.constructor['formAssociated']) {
throw new ErrorType(message);
}
};
const overrideFormMethod = (form, returnValue, method)=>{
const elements = formElementsMap.get(form);
if (elements && elements.size) {
elements.forEach((element)=>{
const internals = internalsMap.get(element);
const valid = internals[method]();
if (!valid) {
returnValue = false;
}
});
}
return returnValue;
};
const upgradeInternals = (ref)=>{
if (ref.constructor['formAssociated']) {
const internals = internalsMap.get(ref);
const { labels , form } = internals;
initLabels(ref, labels);
initForm(ref, form, internals);
}
};
const aom = {
ariaAtomic: 'aria-atomic',
ariaAutoComplete: 'aria-autocomplete',
ariaBusy: 'aria-busy',
ariaChecked: 'aria-checked',
ariaColCount: 'aria-colcount',
ariaColIndex: 'aria-colindex',
ariaColSpan: 'aria-colspan',
ariaCurrent: 'aria-current',
ariaDisabled: 'aria-disabled',
ariaExpanded: 'aria-expanded',
ariaHasPopup: 'aria-haspopup',
ariaHidden: 'aria-hidden',
ariaKeyShortcuts: 'aria-keyshortcuts',
ariaLabel: 'aria-label',
ariaLevel: 'aria-level',
ariaLive: 'aria-live',
ariaModal: 'aria-modal',
ariaMultiLine: 'aria-multiline',
ariaMultiSelectable: 'aria-multiselectable',
ariaOrientation: 'aria-orientation',
ariaPlaceholder: 'aria-placeholder',
ariaPosInSet: 'aria-posinset',
ariaPressed: 'aria-pressed',
ariaReadOnly: 'aria-readonly',
ariaRelevant: 'aria-relevant',
ariaRequired: 'aria-required',
ariaRoleDescription: 'aria-roledescription',
ariaRowCount: 'aria-rowcount',
ariaRowIndex: 'aria-rowindex',
ariaRowSpan: 'aria-rowspan',
ariaSelected: 'aria-selected',
ariaSort: 'aria-sort',
ariaValueMax: 'aria-valuemax',
ariaValueMin: 'aria-valuemin',
ariaValueNow: 'aria-valuenow',
ariaValueText: 'aria-valuetext',
role: 'role'
};
const initAom = (ref, internals)=>{
for(let key in aom){
internals[key] = null;
let closureValue = null;
const attributeName = aom[key];
Object.defineProperty(internals, key, {
get () {
return closureValue;
},
set (value) {
closureValue = value;
if (ref.isConnected) {
ref.setAttribute(attributeName, value);
} else {
upgradeMap.set(ref, internals);
}
}
});
}
};
class ValidityState {
constructor(){
this.badInput = false;
this.customError = false;
this.patternMismatch = false;
this.rangeOverflow = false;
this.rangeUnderflow = false;
this.stepMismatch = false;
this.tooLong = false;
this.tooShort = false;
this.typeMismatch = false;
this.valid = true;
this.valueMissing = false;
Object.seal(this);
}
}
const setValid = (validityObject)=>{
validityObject.badInput = false;
validityObject.customError = false;
validityObject.patternMismatch = false;
validityObject.rangeOverflow = false;
validityObject.rangeUnderflow = false;
validityObject.stepMismatch = false;
validityObject.tooLong = false;
validityObject.tooShort = false;
validityObject.typeMismatch = false;
validityObject.valid = true;
validityObject.valueMissing = false;
return validityObject;
};
const reconcileValidty = (validityObject, newState)=>{
validityObject.valid = isValid(newState);
Object.keys(newState).forEach((key)=>validityObject[key] = newState[key]
);
return validityObject;
};
const isValid = (validityState)=>{
let valid = true;
for(let key in validityState){
if (key !== 'valid' && validityState[key] !== false) {
valid = false;
}
}
return valid;
};
function observerCallback(mutationList) {
mutationList.forEach((mutationRecord)=>{
const { addedNodes , removedNodes } = mutationRecord;
const added = Array.from(addedNodes);
const removed = Array.from(removedNodes);
added.forEach((node)=>{
if (internalsMap.has(node) && node.constructor['formAssociated']) {
const internals = internalsMap.get(node);
const { form } = internals;
initForm(node, form, internals);
initLabels(node, internals.labels);
}
if (upgradeMap.has(node)) {
const internals = upgradeMap.get(node);
const aomKeys = Object.keys(aom);
aomKeys.filter((key)=>internals[key] !== null
).forEach((key)=>{
node.setAttribute(aom[key], internals[key]);
});
upgradeMap.delete(node);
}
});
removed.forEach((node)=>{
const internals = internalsMap.get(node);
if (internals && hiddenInputMap.get(internals)) {
removeHiddenInputs(internals);
}
if (shadowHostsMap.has(node)) {
const observer = shadowHostsMap.get(node);
observer.disconnect();
}
});
});
}
function fragmentObserverCallback(mutationList) {
mutationList.forEach((mutation)=>{
const { removedNodes } = mutation;
removedNodes.forEach((node)=>{
const observer = documentFragmentMap.get(mutation.target);
if (internalsMap.has(node)) {
upgradeInternals(node);
}
observer.disconnect();
});
});
}
const deferUpgrade = (fragment)=>{
const observer = new MutationObserver(fragmentObserverCallback);
observer.observe(fragment, {
childList: true
});
documentFragmentMap.set(fragment, observer);
};
new MutationObserver(observerCallback);
const observerConfig = {
childList: true,
subtree: true
};
const customStateMap = new WeakMap();
class CustomStateSet extends Set {
constructor(ref){
super();
if (!ref || !ref.tagName || ref.tagName.indexOf('-') === -1) {
throw new TypeError('Illegal constructor');
}
customStateMap.set(this, ref);
}
add(state) {
if (!/^--/.exec(state) || typeof state !== 'string') {
throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${state} must start with '--'.`);
}
const result = super.add(state);
const ref = customStateMap.get(this);
ref.toggleAttribute(`state${state}`, true);
return result;
}
clear() {
for (let [entry] of this.entries()){
this.delete(entry);
}
super.clear();
}
delete(state) {
const result = super.delete(state);
const ref = customStateMap.get(this);
ref.toggleAttribute(`state${state}`, false);
return result;
}
}
class ElementInternals {
constructor(ref){
if (!ref || !ref.tagName || ref.tagName.indexOf('-') === -1) {
throw new TypeError('Illegal constructor');
}
const rootNode = ref.getRootNode();
const validity = new ValidityState();
this.states = new CustomStateSet(ref);
refMap.set(this, ref);
validityMap.set(this, validity);
internalsMap.set(ref, this);
initAom(ref, this);
initRef(ref, this);
Object.seal(this);
upgradeInternals(ref);
if (rootNode instanceof DocumentFragment) {
deferUpgrade(rootNode);
}
}
static get isPolyfilled() {
return true;
}
checkValidity() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);
const validity = validityMap.get(this);
if (!validity.valid) {
const validityEvent = new Event('invalid', {
bubbles: false,
cancelable: true,
composed: false
});
ref.dispatchEvent(validityEvent);
}
return validity.valid;
}
get form() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);
let form;
if (ref.constructor['formAssociated'] === true) {
form = findParentForm(ref);
}
return form;
}
get labels() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);
const id = ref.getAttribute('id');
const hostRoot = ref.getRootNode();
if (hostRoot && id) {
return hostRoot ? hostRoot.querySelectorAll(`[for=${id}]`) : [];
}
return [];
}
reportValidity() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);
const valid = this.checkValidity();
const anchor = validationAnchorMap.get(this);
if (anchor && !ref.constructor['formAssociated']) {
throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);
}
if (!valid && anchor) {
ref.focus();
anchor.focus();
}
return valid;
}
setFormValue(value) {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`);
removeHiddenInputs(this);
if (value != null && !(value instanceof FormData)) {
if (ref.getAttribute('name')) {
const hiddenInput = createHiddenInput(ref, this);
hiddenInput.value = value;
}
} else if (value != null && value instanceof FormData) {
value.forEach((formDataValue, formDataKey)=>{
if (typeof formDataValue === 'string') {
const hiddenInput = createHiddenInput(ref, this);
hiddenInput.name = formDataKey;
hiddenInput.value = formDataValue;
}
});
}
refValueMap.set(ref, value);
}
setValidity(validityChanges, validationMessage, anchor) {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);
if (!validityChanges) {
throw new TypeError('Failed to execute \'setValidity\' on \'ElementInternals\': 1 argument required, but only 0 present.');
}
validationAnchorMap.set(this, anchor);
const validity = validityMap.get(this);
const validityChangesObj = {
};
for(const key in validityChanges){
validityChangesObj[key] = validityChanges[key];
}
if (Object.keys(validityChangesObj).length === 0) {
setValid(validity);
}
const check = {
...validity,
...validityChangesObj
};
delete check.valid;
const { valid } = reconcileValidty(validity, check);
if (!valid && !validationMessage) {
throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);
}
validationMessageMap.set(this, valid ? '' : validationMessage);
ref.toggleAttribute('internals-invalid', !valid);
ref.toggleAttribute('internals-valid', valid);
ref.setAttribute('aria-invalid', `${!valid}`);
}
get shadowRoot() {
const ref = refMap.get(this);
const shadowRoot = shadowRootMap.get(ref);
if (shadowRoot) {
return shadowRootMap.get(ref);
}
return null;
}
get validationMessage() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`);
return validationMessageMap.get(this);
}
get validity() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`);
const validity = validityMap.get(this);
return validity;
}
get willValidate() {
const ref = refMap.get(this);
throwIfNotFormAssociated(ref, `Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`);
if (ref.disabled || ref.hasAttribute('disabled')) {
return false;
}
return true;
}
}
if (!window.CustomStateSet) {
window.CustomStateSet = CustomStateSet;
}
function isElementInternalsSupported() {
if (!window.ElementInternals) {
return false;
}
class ElementInternalsFeatureDetection extends HTMLElement {
constructor(){
super();
this.internals = this.attachInternals();
}
}
const randomName = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, '')}`;
customElements.define(randomName, ElementInternalsFeatureDetection);
const featureDetectionElement = new ElementInternalsFeatureDetection();
return [
"shadowRoot",
"form",
"states",
"willValidate",
"validity",
"validationMessage",
"labels",
"setFormValue",
"setValidity",
"checkValidity",
"reportValidity"
].every((prop)=>prop in featureDetectionElement.internals
);
}
if (!isElementInternalsSupported()) {
window.ElementInternals = ElementInternals;
function attachShadowObserver(...args) {
const shadowRoot = attachShadow.apply(this, args);
const observer = new MutationObserver(observerCallback);
shadowRootMap.set(this, shadowRoot);
observer.observe(shadowRoot, observerConfig);
shadowHostsMap.set(this, observer);
return shadowRoot;
}
function checkValidityOverride(...args) {
let returnValue = checkValidity.apply(this, args);
return overrideFormMethod(this, returnValue, 'checkValidity');
}
function reportValidityOverride(...args) {
let returnValue = reportValidity.apply(this, args);
return overrideFormMethod(this, returnValue, 'reportValidity');
}
Object.defineProperty(HTMLElement.prototype, 'attachInternals', {
get () {
return ()=>{
if (this.tagName.indexOf('-') === -1) {
throw new Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);
}
return new ElementInternals(this);
};
}
});
const attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = attachShadowObserver;
const documentObserver = new MutationObserver(observerCallback);
documentObserver.observe(document.documentElement, observerConfig);
const checkValidity = HTMLFormElement.prototype.checkValidity;
HTMLFormElement.prototype.checkValidity = checkValidityOverride;
const reportValidity = HTMLFormElement.prototype.reportValidity;
HTMLFormElement.prototype.reportValidity = reportValidityOverride;
}
})();
function queryShadowRoot(root, skipNode, isMatch, maxDepth = 20, depth = 0) {
let matches = [];
if (depth >= maxDepth) {
return matches;
}
const traverseSlot = ($slot)=>{
const assignedNodes = $slot.assignedNodes().filter((node)=>node.nodeType === 1
);
if (assignedNodes.length > 0) {
return queryShadowRoot(assignedNodes[0].parentElement, skipNode, isMatch, maxDepth, depth + 1);
}
return [];
};
const children = Array.from(root.children || []);
for (const $child of children){
if (skipNode($child)) {
continue;
}
if (isMatch($child)) {
matches.push($child);
}
if ($child.shadowRoot != null) {
matches.push(...queryShadowRoot($child.shadowRoot, skipNode, isMatch, maxDepth, depth + 1));
} else if ($child.tagName === "SLOT") {
matches.push(...traverseSlot($child));
} else {
matches.push(...queryShadowRoot($child, skipNode, isMatch, maxDepth, depth + 1));
}
}
return matches;
}
function isHidden($elem) {
return $elem.hasAttribute("hidden") || $elem.hasAttribute("aria-hidden") && $elem.getAttribute("aria-hidden") !== "false" || $elem.style.display === `none` || $elem.style.opacity === `0` || $elem.style.visibility === `hidden` || $elem.style.visibility === `collapse`;
}
function isDisabled($elem) {
return $elem.hasAttribute("disabled") || $elem.hasAttribute("aria-disabled") && $elem.getAttribute("aria-disabled") !== "false";
}
function isFocusable($elem) {
if ($elem.getAttribute("tabindex") === "-1" || isHidden($elem) || isDisabled($elem)) {
return false;
}
return $elem.hasAttribute("tabindex") || ($elem instanceof HTMLAnchorElement || $elem instanceof HTMLAreaElement) && $elem.hasAttribute("href") || $elem instanceof HTMLButtonElement || $elem instanceof HTMLInputElement || $elem instanceof HTMLTextAreaElement || $elem instanceof HTMLSelectElement || $elem instanceof HTMLIFrameElement;
}
const timeouts = new Map();
function debounce(cb, ms, id) {
const timeout = timeouts.get(id);
if (timeout != null) {
window.clearTimeout(timeout);
}
timeouts.set(id, window.setTimeout(()=>{
cb();
timeouts.delete(id);
}, ms));
}
const template = document.createElement("template");
template.innerHTML = `
<div id="start"></div>
<div id="backup"></div>
<slot></slot>
<div id="end"></div>
`;
class FocusTrap extends HTMLElement {
constructor(){
super();
this.debounceId = Math.random().toString();
this._focused = false;
const shadow = this.attachShadow({
mode: "open"
});
shadow.appendChild(template.content.cloneNode(true));
this.$backup = shadow.querySelector("#backup");
this.$start = shadow.querySelector("#start");
this.$end = shadow.querySelector("#end");
this.focusLastElement = this.focusLastElement.bind(this);
this.focusFirstElement = this.focusFirstElement.bind(this);
this.onFocusIn = this.onFocusIn.bind(this);
this.onFocusOut = this.onFocusOut.bind(this);
}
static get observedAttributes() {
return [
"inactive"
];
}
get inactive() {
return this.hasAttribute("inactive");
}
set inactive(value) {
value ? this.setAttribute("inactive", "") : this.removeAttribute("inactive");
}
get focused() {
return this._focused;
}
connectedCallback() {
this.$start.addEventListener("focus", this.focusLastElement);
this.$end.addEventListener("focus", this.focusFirstElement);
this.addEventListener("focusin", this.onFocusIn);
this.addEventListener("focusout", this.onFocusOut);
this.render();
}
disconnectedCallback() {
this.$start.removeEventListener("focus", this.focusLastElement);
this.$end.removeEventListener("focus", this.focusFirstElement);
this.removeEventListener("focusin", this.onFocusIn);
this.removeEventListener("focusout", this.onFocusOut);
}
attributeChangedCallback() {
this.render();
}
focusFirstElement() {
this.trapFocus();
}
focusLastElement() {
this.trapFocus(true);
}
getFocusableElements() {
return queryShadowRoot(this, isHidden, isFocusable);
}
trapFocus(trapToEnd) {
if (this.inactive) return;
let focusableChildren = this.getFocusableElements();
if (focusableChildren.length > 0) {
if (trapToEnd) {
focusableChildren[focusableChildren.length - 1].focus();
} else {
focusableChildren[0].focus();
}
this.$backup.setAttribute("tabindex", "-1");
} else {
this.$backup.setAttribute("tabindex", "0");
this.$backup.focus();
}
}
onFocusIn() {
this.updateFocused(true);
}
onFocusOut() {
this.updateFocused(false);
}
updateFocused(value) {
debounce(()=>{
if (this.focused !== value) {
this._focused = value;
this.render();
}
}, 0, this.debounceId);
}
render() {
this.$start.setAttribute("tabindex", !this.focused || this.inactive ? `-1` : `0`);
this.$end.setAttribute("tabindex", !this.focused || this.inactive ? `-1` : `0`);
this.focused ? this.setAttribute("focused", "") : this.removeAttribute("focused");
}
}
window.customElements.define("focus-trap", FocusTrap);
function getType(payload) {
return Object.prototype.toString.call(payload).slice(8, -1);
}
function isUndefined(payload) {
return getType(payload) === 'Undefined';
}
function isNull(payload) {
return getType(payload) === 'Null';
}
function isPlainObject(payload) {
if (getType(payload) !== 'Object') return false;
return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
}
function isArray(payload) {
return getType(payload) === 'Array';
}
function isSymbol(payload) {
return getType(payload) === 'Symbol';
}
isOneOf(isNull, isUndefined);
function isOneOf(a, b, c, d, e) {
return function(value) {
return a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
};
}
function __spreadArray(to, from) {
for(var i = 0, il = from.length, j = to.length; i < il; i++, j++)to[j] = from[i];
return to;
}
function assignProp(carry, key, newVal, originalObject) {
var propType = ({
}).propertyIsEnumerable.call(originalObject, key) ? 'enumerable' : 'nonenumerable';
if (propType === 'enumerable') carry[key] = newVal;
if (propType === 'nonenumerable') {
Object.defineProperty(carry, key, {
value: newVal,
enumerable: false,
writable: true,
configurable: true
});
}
}
function mergeRecursively(origin, newComer, compareFn) {
if (!isPlainObject(newComer)) return newComer;
var newObject = {
};
if (isPlainObject(origin)) {
var props_1 = Object.getOwnPropertyNames(origin);
var symbols_1 = Object.getOwnPropertySymbols(origin);
newObject = __spreadArray(__spreadArray([], props_1), symbols_1).reduce(function(carry, key) {
var targetVal = origin[key];
if (!isSymbol(key) && !Object.getOwnPropertyNames(newComer).includes(key) || isSymbol(key) && !Object.getOwnPropertySymbols(newComer).includes(key)) {
assignProp(carry, key, targetVal, origin);
}
return carry;
}, {
});
}
var props = Object.getOwnPropertyNames(newComer);
var symbols = Object.getOwnPropertySymbols(newComer);
var result = __spreadArray(__spreadArray([], props), symbols).reduce(function(carry, key) {
var newVal = newComer[key];
var targetVal = isPlainObject(origin) ? origin[key] : undefined;
if (targetVal !== undefined && isPlainObject(newVal)) {
newVal = mergeRecursively(targetVal, newVal, compareFn);
}
var propToAssign = compareFn ? compareFn(targetVal, newVal, key) : newVal;
assignProp(carry, key, propToAssign, newComer);
return carry;
}, newObject);
return result;
}
function merge1(object) {
var otherObjects = [];
for(var _i = 1; _i < arguments.length; _i++){
otherObjects[_i - 1] = arguments[_i];
}
return otherObjects.reduce(function(result, newComer) {
return mergeRecursively(result, newComer);
}, object);
}
function __spreadArrays() {
for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length;
for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j];
return r;
}
function assignProp1(carry, key, newVal, originalObject, includeNonenumerable) {
var propType = ({
}).propertyIsEnumerable.call(originalObject, key) ? 'enumerable' : 'nonenumerable';
if (propType === 'enumerable') carry[key] = newVal;
if (includeNonenumerable && propType === 'nonenumerable') {
Object.defineProperty(carry, key, {
value: newVal,
enumerable: false,
writable: true,
configurable: true
});
}
}
function copy1(target, options) {
if (options === void 0) {
options = {
};
}
if (isArray(target)) return target.map(function(item) {
return copy1(item, options);
});
if (!isPlainObject(target)) return target;
var props = Object.getOwnPropertyNames(target);
var symbols = Object.getOwnPropertySymbols(target);
return __spreadArrays(props, symbols).reduce(function(carry, key) {
if (isArray(options.props) && !options.props.includes(key)) {
return carry;
}
var val = target[key];
var newVal = copy1(val, options);
assignProp1(carry, key, newVal, target, options.nonenumerable);
return carry;
}, {
});
}
const t1 = window.ShadowRoot && (void 0 === window.ShadyCSS || window.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, e = Symbol(), n = new Map();
class s7 {
constructor(t, n){
if (this._$cssResult$ = !0, n !== e) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = t;
}
get styleSheet() {
let e = n.get(this.cssText);
return t1 && void 0 === e && (n.set(this.cssText, e = new CSSStyleSheet()), e.replaceSync(this.cssText)), e;
}
toString() {
return this.cssText;
}
}
const o = (t)=>new s7("string" == typeof t ? t : t + "", e)
, r = (t, ...n)=>{
const o = 1 === t.length ? t[0] : n.reduce((e, n, s)=>e + ((t)=>{
if (!0 === t._$cssResult$) return t.cssText;
if ("number" == typeof t) return t;
throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
})(n) + t[s + 1]
, t[0]);
return new s7(o, e);
}, i1 = (e, n)=>{
t1 ? e.adoptedStyleSheets = n.map((t)=>t instanceof CSSStyleSheet ? t : t.styleSheet
) : n.forEach((t)=>{
const n = document.createElement("style"), s = window.litNonce;
void 0 !== s && n.setAttribute("nonce", s), n.textContent = t.cssText, e.appendChild(n);
});
}, S = t1 ? (t)=>t
: (t)=>t instanceof CSSStyleSheet ? ((t)=>{
let e = "";
for (const n of t.cssRules)e += n.cssText;
return o(e);
})(t) : t
;
var s1;
const e1 = window.reactiveElementPolyfillSupport, r1 = {
toAttribute (t, i) {
switch(i){
case Boolean:
t = t ? "" : null;
break;
case Object:
case Array:
t = null == t ? t : JSON.stringify(t);
}
return t;
},
fromAttribute (t, i) {
let s = t;
switch(i){
case Boolean:
s = null !== t;
break;
case Number:
s = null === t ? null : Number(t);
break;
case Object:
case Array:
try {
s = JSON.parse(t);
} catch (t2) {
s = null;
}
}
return s;
}
}, h = (t, i)=>i !== t && (i == i || t == t)
, o1 = {
attribute: !0,
type: String,
converter: r1,
reflect: !1,
hasChanged: h
};
class n1 extends HTMLElement {
constructor(){
super(), this._$Et = new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$Ei = null, this.o();
}
static addInitializer(t) {
var i;
null !== (i = this.l) && void 0 !== i || (this.l = []), this.l.push(t);
}
static get observedAttributes() {
this.finalize();
const t = [];
return this.elementProperties.forEach((i, s)=>{
const e = this._$Eh(s, i);
void 0 !== e && (this._$Eu.set(e, s), t.push(e));
}), t;
}
static createProperty(t, i = o1) {
if (i.state && (i.attribute = !1), this.finalize(), this.elementProperties.set(t, i), !i.noAccessor && !this.prototype.hasOwnProperty(t)) {
const s = "symbol" == typeof t ? Symbol() : "__" + t, e = this.getPropertyDescriptor(t, s, i);
void 0 !== e && Object.defineProperty(this.prototype, t, e);
}
}
static getPropertyDescriptor(t, i, s) {
return {
get () {
return this[i];
},
set (e) {
const r = this[t];
this[i] = e, this.requestUpdate(t, r, s);
},
configurable: !0,
enumerable: !0
};
}
static getPropertyOptions(t) {
return this.elementProperties.get(t) || o1;
}
static finalize() {
if (this.hasOwnProperty("finalized")) return !1;
this.finalized = !0;
const t = Object.getPrototypeOf(this);
if (t.finalize(), this.elementProperties = new Map(t.elementProperties), this._$Eu = new Map(), this.hasOwnProperty("properties")) {
const t = this.properties, i = [
...Object.getOwnPropertyNames(t),
...Object.getOwnPropertySymbols(t)
];
for (const s of i)this.createProperty(s, t[s]);
}
return this.elementStyles = this.finalizeStyles(this.styles), !0;
}
static finalizeStyles(i) {
const s = [];
if (Array.isArray(i)) {
const e = new Set(i.flat(1 / 0).reverse());
for (const i2 of e)s.unshift(S(i2));
} else void 0 !== i && s.push(S(i));
return s;
}
static _$Eh(t, i) {
const s = i.attribute;
return !1 === s ? void 0 : "string" == typeof s ? s : "string" == typeof t ? t.toLowerCase() : void 0;
}
o() {
var t;
this._$Ev = new Promise((t)=>this.enableUpdating = t
), this._$AL = new Map(), this._$Ep(), this.requestUpdate(), null === (t = this.constructor.l) || void 0 === t || t.forEach((t)=>t(this)
);
}
addController(t) {
var i, s1;
(null !== (i = this._$Em) && void 0 !== i ? i : this._$Em = []).push(t), void 0 !== this.renderRoot && this.isConnected && (null === (s1 = t.hostConnected) || void 0 === s1 || s1.call(t));
}
removeController(t) {
var i;
null === (i = this._$Em) || void 0 === i || i.splice(this._$Em.indexOf(t) >>> 0, 1);
}
_$Ep() {
this.constructor.elementProperties.forEach((t, i)=>{
this.hasOwnProperty(i) && (this._$Et.set(i, this[i]), delete this[i]);
});
}
createRenderRoot() {
var t;
const s = null !== (t = this.shadowRoot) && void 0 !== t ? t : this.attachShadow(this.constructor.shadowRootOptions);
return i1(s, this.constructor.elementStyles), s;
}
connectedCallback() {
var t;
void 0 === this.renderRoot && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), null === (t = this._$Em) || void 0 === t || t.forEach((t)=>{
var i;
return null === (i = t.hostConnected) || void 0 === i ? void 0 : i.call(t);
});
}
enableUpdating(t) {
}
disconnectedCallback() {
var t;
null === (t = this._$Em) || void 0 === t || t.forEach((t)=>{
var i;
return null === (i = t.hostDisconnected) || void 0 === i ? void 0 : i.call(t);
});
}
attributeChangedCallback(t, i, s) {
this._$AK(t, s);
}
_$Eg(t, i, s = o1) {
var e1, h1;
const n = this.constructor._$Eh(t, s);
if (void 0 !== n && !0 === s.reflect) {
const o = (null !== (h1 = null === (e1 = s.converter) || void 0 === e1 ? void 0 : e1.toAttribute) && void 0 !== h1 ? h1 : r1.toAttribute)(i, s.type);
this._$Ei = t, null == o ? this.removeAttribute(n) : this.setAttribute(n, o), this._$Ei = null;
}
}
_$AK(t, i) {
var s1, e1, h1;
const o = this.constructor, n = o._$Eu.get(t);
if (void 0 !== n && this._$Ei !== n) {
const t = o.getPropertyOptions(n), l = t.converter, a = null !== (h1 = null !== (e1 = null === (s1 = l) || void 0 === s1 ? void 0 : s1.fromAttribute) && void 0 !== e1 ? e1 : "function" == typeof l ? l : null) && void 0 !== h1 ? h1 : r1.fromAttribute;
this._$Ei = n, this[n] = a(i, t.type), this._$Ei = null;
}
}
requestUpdate(t, i, s) {
let e = !0;
void 0 !== t && (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || h)(this[t], i) ? (this._$AL.has(t) || this._$AL.set(t, i), !0 === s.reflect && this._$Ei !== t && (void 0 === this._$ES && (this._$ES = new Map()), this._$ES.set(t, s))) : e = !1), !this.isUpdatePending && e && (this._$Ev = this._$EC());
}
async _$EC() {
this.isUpdatePending = !0;
try {
await this._$Ev;
} catch (t) {
Promise.reject(t);
}
const t2 = this.scheduleUpdate();
return null != t2 && await t2, !this.isUpdatePending;
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var t;
if (!this.isUpdatePending) return;
this.hasUpdated, this._$Et && (this._$Et.forEach((t, i)=>this[i] = t
), this._$Et = void 0);
let i = !1;
const s = this._$AL;
try {
i = this.shouldUpdate(s), i ? (this.willUpdate(s), null === (t = this._$Em) || void 0 === t || t.forEach((t)=>{
var i;
return null === (i = t.hostUpdate) || void 0 === i ? void 0 : i.call(t);
}), this.update(s)) : this._$EU();
} catch (t2) {
throw i = !1, this._$EU(), t2;
}
i && this._$AE(s);
}
willUpdate(t) {
}
_$AE(t) {
var i;
null === (i = this._$Em) || void 0 === i || i.forEach((t)=>{
var i;
return null === (i = t.hostUpdated) || void 0 === i ? void 0 : i.call(t);
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
}
_$EU() {
this._$AL = new Map(), this.isUpdatePending = !1;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this._$Ev;
}
shouldUpdate(t) {
return !0;
}
update(t) {
void 0 !== this._$ES && (this._$ES.forEach((t, i)=>this._$Eg(i, this[i], t)
), this._$ES = void 0), this._$EU();
}
updated(t) {
}
firstUpdated(t) {
}
}
n1.finalized = !0, n1.elementProperties = new Map(), n1.elementStyles = [], n1.shadowRootOptions = {
mode: "open"
}, null == e1 || e1({
ReactiveElement: n1
}), (null !== (s1 = globalThis.reactiveElementVersions) && void 0 !== s1 ? s1 : globalThis.reactiveElementVersions = []).push("1.0.1");
var t2;
const i2 = globalThis.trustedTypes, s2 = i2 ? i2.createPolicy("lit-html", {
createHTML: (t)=>t
}) : void 0, e2 = `lit$${(Math.random() + "").slice(9)}$`, o2 = "?" + e2, n2 = `<${o2}>`, l = document, h1 = (t = "")=>l.createComment(t)
, r2 = (t)=>null === t || "object" != typeof t && "function" != typeof t
, d = Array.isArray, u = (t)=>{
var i;
return d(t) || "function" == typeof (null === (i = t) || void 0 === i ? void 0 : i[Symbol.iterator]);
}, c = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, a = />/g, f = />|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g, _ = /'/g, m3 = /"/g, g = /^(?:script|style|textarea)$/i, $ = (t)=>(i, ...s)=>({
_$litType$: t,
strings: i,
values: s
})
, p = $(1), y = $(2), b = Symbol.for("lit-noChange"), T = Symbol.for("lit-nothing"), x = new WeakMap(), w = (t, i, s)=>{
var e, o;
const n = null !== (e = null == s ? void 0 : s.renderBefore) && void 0 !== e ? e : i;
let l = n._$litPart$;
if (void 0 === l) {
const t = null !== (o = null == s ? void 0 : s.renderBefore) && void 0 !== o ? o : null;
n._$litPart$ = l = new N(i.insertBefore(h1(), t), t, void 0, null != s ? s : {
});
}
return l._$AI(t), l;
}, A = l.createTreeWalker(l, 129, null, !1), C = (t, i)=>{
const o = t.length - 1, l = [];
let h, r = 2 === i ? "<svg>" : "", d = c;
for(let i1 = 0; i1 < o; i1++){
const s = t[i1];
let o, u, $ = -1, p = 0;
for(; p < s.length && (d.lastIndex = p, u = d.exec(s), null !== u);)p = d.lastIndex, d === c ? "!--" === u[1] ? d = v : void 0 !== u[1] ? d = a : void 0 !== u[2] ? (g.test(u[2]) && (h = RegExp("</" + u[2], "g")), d = f) : void 0 !== u[3] && (d = f) : d === f ? ">" === u[0] ? (d = null != h ? h : c, $ = -1) : void 0 === u[1] ? $ = -2 : ($ = d.lastIndex - u[2].length, o = u[1], d = void 0 === u[3] ? f : '"' === u[3] ? m3 : _) : d === m3 || d === _ ? d = f : d === v || d === a ? d = c : (d = f, h = void 0);
const y = d === f && t[i1 + 1].startsWith("/>") ? " " : "";
r += d === c ? s + n2 : $ >= 0 ? (l.push(o), s.slice(0, $) + "$lit$" + s.slice($) + e2 + y) : s + e2 + (-2 === $ ? (l.push(void 0), i1) : y);
}
const u = r + (t[o] || "<?>") + (2 === i ? "</svg>" : "");
return [
void 0 !== s2 ? s2.createHTML(u) : u,
l
];
};
class P {
constructor({ strings: t , _$litType$: s }, n){
let l;
this.parts = [];
let r = 0, d = 0;
const u = t.length - 1, c = this.parts, [v, a] = C(t, s);
if (this.el = P.createElement(v, n), A.currentNode = this.el.content, 2 === s) {
const t = this.el.content, i = t.firstChild;
i.remove(), t.append(...i.childNodes);
}
for(; null !== (l = A.nextNode()) && c.length < u;){
if (1 === l.nodeType) {
if (l.hasAttributes()) {
const t = [];
for (const i of l.getAttributeNames())if (i.endsWith("$lit$") || i.startsWith(e2)) {
const s = a[d++];
if (t.push(i), void 0 !== s) {
const t = l.getAttribute(s.toLowerCase() + "$lit$").split(e2), i = /([.?@])?(.*)/.exec(s);
c.push({
type: 1,
index: r,
name: i[2],
strings: t,
ctor: "." === i[1] ? M : "?" === i[1] ? k : "@" === i[1] ? H : S1
});
} else c.push({
type: 6,
index: r
});
}
for (const i1 of t)l.removeAttribute(i1);
}
if (g.test(l.tagName)) {
const t = l.textContent.split(e2), s = t.length - 1;
if (s > 0) {
l.textContent = i2 ? i2.emptyScript : "";
for(let i1 = 0; i1 < s; i1++)l.append(t[i1], h1()), A.nextNode(), c.push({
type: 2,
index: ++r
});
l.append(t[s], h1());
}
}
} else if (8 === l.nodeType) if (l.data === o2) c.push({
type: 2,
index: r
});
else {
let t = -1;
for(; -1 !== (t = l.data.indexOf(e2, t + 1));)c.push({
type: 7,
index: r
}), t += e2.length - 1;
}
r++;
}
}
static createElement(t, i) {
const s = l.createElement("template");
return s.innerHTML = t, s;
}
}
function V(t, i, s = t, e) {
var o1, n1, l1, h1;
if (i === b) return i;
let d = void 0 !== e ? null === (o1 = s._$Cl) || void 0 === o1 ? void 0 : o1[e] : s._$Cu;
const u = r2(i) ? void 0 : i._$litDirective$;
return (null == d ? void 0 : d.constructor) !== u && (null === (n1 = null == d ? void 0 : d._$AO) || void 0 === n1 || n1.call(d, !1), void 0 === u ? d = void 0 : (d = new u(t), d._$AT(t, s, e)), void 0 !== e ? (null !== (l1 = (h1 = s)._$Cl) && void 0 !== l1 ? l1 : h1._$Cl = [])[e] = d : s._$Cu = d), void 0 !== d && (i = V(t, d._$AS(t, i.values), d, e)), i;
}
class E {
constructor(t, i){
this.v = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
p(t) {
var i;
const { el: { content: s } , parts: e } = this._$AD, o = (null !== (i = null == t ? void 0 : t.creationScope) && void 0 !== i ? i : l).importNode(s, !0);
A.currentNode = o;
let n = A.nextNode(), h = 0, r = 0, d = e[0];
for(; void 0 !== d;){
if (h === d.index) {
let i;
2 === d.type ? i = new N(n, n.nextSibling, this, t) : 1 === d.type ? i = new d.ctor(n, d.name, d.strings, this, t) : 6 === d.type && (i = new I(n, this, t)), this.v.push(i), d = e[++r];
}
h !== (null == d ? void 0 : d.index) && (n = A.nextNode(), h++);
}
return o;
}
m(t) {
let i = 0;
for (const s of this.v)void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
}
}
class N {
constructor(t, i, s, e){
var o;
this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cg = null === (o = null == e ? void 0 : e.isConnected) || void 0 === o || o;
}
get _$AU() {
var t1, i;
return null !== (i = null === (t1 = this._$AM) || void 0 === t1 ? void 0 : t1._$AU) && void 0 !== i ? i : this._$Cg;
}
get parentNode() {
let t = this._$AA.parentNode;
const i = this._$AM;
return void 0 !== i && 11 === t.nodeType && (t = i.parentNode), t;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(t, i = this) {
t = V(this, t, i), r2(t) ? t === T || null == t || "" === t ? (this._$AH !== T && this._$AR(), this._$AH = T) : t !== this._$AH && t !== b && this.$(t) : void 0 !== t._$litType$ ? this.T(t) : void 0 !== t.nodeType ? this.S(t) : u(t) ? this.M(t) : this.$(t);
}
A(t, i = this._$AB) {
return this._$AA.parentNode.insertBefore(t, i);
}
S(t) {
this._$AH !== t && (this._$AR(), this._$AH = this.A(t));
}
$(t) {
this._$AH !== T && r2(this._$AH) ? this._$AA.nextSibling.data = t : this.S(l.createTextNode(t)), this._$AH = t;
}
T(t) {
var i;
const { values: s , _$litType$: e } = t, o = "number" == typeof e ? this._$AC(t) : (void 0 === e.el && (e.el = P.createElement(e.h, this.options)), e);
if ((null === (i = this._$AH) || void 0 === i ? void 0 : i._$AD) === o) this._$AH.m(s);
else {
const t = new E(o, this), i = t.p(this.options);
t.m(s), this.S(i), this._$AH = t;
}
}
_$AC(t) {
let i = x.get(t.strings);
return void 0 === i && x.set(t.strings, i = new P(t)), i;
}
M(t) {
d(this._$AH) || (this._$AH = [], this._$AR());
const i = this._$AH;
let s, e = 0;
for (const o of t)e === i.length ? i.push(s = new N(this.A(h1()), this.A(h1()), this, this.options)) : s = i[e], s._$AI(o), e++;
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
}
_$AR(t = this._$AA.nextSibling, i) {
var s1;
for(null === (s1 = this._$AP) || void 0 === s1 || s1.call(this, !1, !0, i); t && t !== this._$AB;){
const i = t.nextSibling;
t.remove(), t = i;
}
}
setConnected(t) {
var i;
void 0 === this._$AM && (this._$Cg = t, null === (i = this._$AP) || void 0 === i || i.call(this, t));
}
}
class S1 {
constructor(t, i, s, e, o){
this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = o, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = T;
}
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t, i = this, s, e) {
const o = this.strings;
let n = !1;
if (void 0 === o) t = V(this, t, i, 0), n = !r2(t) || t !== this._$AH && t !== b, n && (this._$AH = t);
else {
const e = t;
let l, h;
for(t = o[0], l = 0; l < o.length - 1; l++)h = V(this, e[s + l], i, l), h === b && (h = this._$AH[l]), n || (n = !r2(h) || h !== this._$AH[l]), h === T ? t = T : t !== T && (t += (null != h ? h : "") + o[l + 1]), this._$AH[l] = h;
}
n && !e && this.k(t);
}
k(t) {
t === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, null != t ? t : "");
}
}
class M extends S1 {
constructor(){
super(...arguments), this.type = 3;
}
k(t) {
this.element[this.name] = t === T ? void 0 : t;
}
}
class k extends S1 {
constructor(){
super(...arguments), this.type = 4;
}
k(t) {
t && t !== T ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name);
}
}
class H extends S1 {
constructor(t, i, s, e, o){
super(t, i, s, e, o), this.type = 5;
}
_$AI(t, i = this) {
var s1;
if ((t = null !== (s1 = V(this, t, i, 0)) && void 0 !== s1 ? s1 : T) === b) return;
const e = this._$AH, o = t === T && e !== T || t.capture !== e.capture || t.once !== e.once || t.passive !== e.passive, n = t !== T && (e === T || o);
o && this.element.removeEventListener(this.name, this, e), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
}
handleEvent(t) {
var i, s1;
"function" == typeof this._$AH ? this._$AH.call(null !== (s1 = null === (i = this.options) || void 0 === i ? void 0 : i.host) && void 0 !== s1 ? s1 : this.element, t) : this._$AH.handleEvent(t);
}
}
class I {
constructor(t, i, s){
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t) {
V(this, t);
}
}
const L = {
P: "$lit$",
V: e2,
L: o2,
I: 1,
N: C,
R: E,
D: u,
j: V,
H: N,
O: S1,
F: k,
B: H,
W: M,
Z: I
}, R = window.litHtmlPolyfillSupport;
null == R || R(P, N), (null !== (t2 = globalThis.litHtmlVersions) && void 0 !== t2 ? t2 : globalThis.litHtmlVersions = []).push("2.0.1");
var l1, o3;
class s3 extends n1 {
constructor(){
super(...arguments), this.renderOptions = {
host: this
}, this._$Dt = void 0;
}
createRenderRoot() {
var t1, e1;
const i = super.createRenderRoot();
return null !== (t1 = (e1 = this.renderOptions).renderBefore) && void 0 !== t1 || (e1.renderBefore = i.firstChild), i;
}
update(t) {
const i = this.render();
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Dt = w(i, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var t1;
super.connectedCallback(), null === (t1 = this._$Dt) || void 0 === t1 || t1.setConnected(!0);
}
disconnectedCallback() {
var t1;
super.disconnectedCallback(), null === (t1 = this._$Dt) || void 0 === t1 || t1.setConnected(!1);
}
render() {
return b;
}
}
s3.finalized = !0, s3._$litElement$ = !0, null === (l1 = globalThis.litElementHydrateSupport) || void 0 === l1 || l1.call(globalThis, {
LitElement: s3
});
const n3 = globalThis.litElementPolyfillSupport;
null == n3 || n3({
LitElement: s3
});
(null !== (o3 = globalThis.litElementVersions) && void 0 !== o3 ? o3 : globalThis.litElementVersions = []).push("3.0.1");
const t3 = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
}, e3 = (t)=>(...e)=>({
_$litDirective$: t,
values: e
})
;
class i3 {
constructor(t){
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(t, e, i) {
this._$Ct = t, this._$AM = e, this._$Ci = i;
}
_$AS(t, e) {
return this.update(t, e);
}
update(t, e) {
return this.render(...e);
}
}
const { H: i4 } = L, t4 = (o)=>null === o || "object" != typeof o && "function" != typeof o
, v1 = (o, i)=>{
var t, n;
return void 0 === i ? void 0 !== (null === (t = o) || void 0 === t ? void 0 : t._$litType$) : (null === (n = o) || void 0 === n ? void 0 : n._$litType$) === i;
}, r3 = (o)=>void 0 === o.strings
, e4 = ()=>document.createComment("")
, u1 = (o, t, n)=>{
var v;
const l = o._$AA.parentNode, d = void 0 === t ? o._$AB : t._$AA;
if (void 0 === n) {
const t = l.insertBefore(e4(), d), v = l.insertBefore(e4(), d);
n = new i4(t, v, o, o.options);
} else {
const i = n._$AB.nextSibling, t = n._$AM, r = t !== o;
if (r) {
let i;
null === (v = n._$AQ) || void 0 === v || v.call(n, o), n._$AM = o, void 0 !== n._$AP && (i = o._$AU) !== t._$AU && n._$AP(i);
}
if (i !== d || r) {
let o = n._$AA;
for(; o !== i;){
const i = o.nextSibling;
l.insertBefore(o, d), o = i;
}
}
}
return n;
}, c1 = (o, i, t = o)=>(o._$AI(i, t), o)
, f1 = {
}, s4 = (o, i = f1)=>o._$AH = i
, a1 = (o)=>o._$AH
, m1 = (o)=>{
var i;
null === (i = o._$AP) || void 0 === i || i.call(o, !1, !0);
let t = o._$AA;
const n = o._$AB.nextSibling;
for(; t !== n;){
const o = t.nextSibling;
t.remove(), t = o;
}
}, p1 = (o)=>{
o._$AR();
};
const e5 = (i, t)=>{
var s, o;
const n = i._$AN;
if (void 0 === n) return !1;
for (const i1 of n)null === (o = (s = i1)._$AO) || void 0 === o || o.call(s, t, !1), e5(i1, t);
return !0;
}, o4 = (i)=>{
let t, s;
do {
if (void 0 === (t = i._$AM)) break;
s = t._$AN, s.delete(i), i = t;
}while (0 === (null == s ? void 0 : s.size))
}, n4 = (i)=>{
for(let t; t = i._$AM; i = t){
let s = t._$AN;
if (void 0 === s) t._$AN = s = new Set();
else if (s.has(i)) break;
s.add(i), l2(t);
}
};
function r4(i) {
void 0 !== this._$AN ? (o4(this), this._$AM = i, n4(this)) : this._$AM = i;
}
function h2(i, t = !1, s = 0) {
const n = this._$AH, r = this._$AN;
if (void 0 !== r && 0 !== r.size) if (t) {
if (Array.isArray(n)) for(let i = s; i < n.length; i++)e5(n[i], !1), o4(n[i]);
else null != n && (e5(n, !1), o4(n));
} else e5(this, i);
}
const l2 = (i)=>{
var t, e, o, n;
i.type == t3.CHILD && (null !== (t = (o = i)._$AP) && void 0 !== t || (o._$AP = h2), null !== (e = (n = i)._$AQ) && void 0 !== e || (n._$AQ = r4));
};
class d1 extends i3 {
constructor(){
super(...arguments), this._$AN = void 0;
}
_$AT(i, t, s) {
super._$AT(i, t, s), n4(this), this.isConnected = i._$AU;
}
_$AO(i, t = !0) {
var s1, n1;
i !== this.isConnected && (this.isConnected = i, i ? null === (s1 = this.reconnected) || void 0 === s1 || s1.call(this) : null === (n1 = this.disconnected) || void 0 === n1 || n1.call(this)), t && (e5(this, i), o4(this));
}
setValue(t) {
if (r3(this._$Ct)) this._$Ct._$AI(t, this);
else {
const i = [
...this._$Ct._$AH
];
i[this._$Ci] = t, this._$Ct._$AI(i, this, 0);
}
}
disconnected() {
}
reconnected() {
}
}
const t7 = async (t, s)=>{
for await (const i of t)if (!1 === await s(i)) return;
};
class s5 {
constructor(t){
this.U = t;
}
disconnect() {
this.U = void 0;
}
reconnect(t) {
this.U = t;
}
deref() {
return this.U;
}
}
class i5 {
constructor(){
this.Y = void 0, this.q = void 0;
}
get() {
return this.Y;
}
pause() {
var t1;
null !== (t1 = this.Y) && void 0 !== t1 || (this.Y = new Promise((t)=>this.q = t
));
}
resume() {
var t1;
null === (t1 = this.q) || void 0 === t1 || t1.call(this), this.Y = this.q = void 0;
}
}
class o5 extends d1 {
constructor(){
super(...arguments), this._$CG = new s5(this), this._$CK = new i5();
}
render(i, s) {
return b;
}
update(i, [s, r]) {
if (this.isConnected || this.disconnected(), s === this._$CJ) return;
this._$CJ = s;
let e = 0;
const { _$CG: o , _$CK: h } = this;
return t7(s, async (t)=>{
for(; h.get();)await h.get();
const i = o.deref();
if (void 0 !== i) {
if (i._$CJ !== s) return !1;
void 0 !== r && (t = r(t, e)), i.commitValue(t, e), e++;
}
return !0;
}), b;
}
commitValue(t, i) {
this.setValue(t);
}
disconnected() {
this._$CG.disconnect(), this._$CK.pause();
}
reconnected() {
this._$CG.reconnect(this), this._$CK.resume();
}
}
const h3 = e3(o5);
const c2 = e3(class extends o5 {
constructor(r){
if (super(r), r.type !== t3.CHILD) throw Error("asyncAppend can only be used in child expressions");
}
update(r, e) {
return this._$CX = r, super.update(r, e);
}
commitValue(r, e) {
0 === e && p1(this._$CX);
const s = u1(this._$CX);
c1(s, r);
}
});
const d2 = e3(class extends i3 {
constructor(t){
super(t), this.tt = new WeakMap();
}
render(t) {
return [
t
];
}
update(s, [e]) {
if (v1(this.it) && (!v1(e) || this.it.strings !== e.strings)) {
const e = a1(s).pop();
let o = this.tt.get(this.it.strings);
if (void 0 === o) {
const s = document.createDocumentFragment();
o = w(T, s), o.setConnected(!1), this.tt.set(this.it.strings, o);
}
s4(o, [
e
]), u1(o, void 0, e);
}
if (v1(e)) {
if (!v1(this.it) || this.it.strings !== e.strings) {
const t = this.tt.get(e.strings);
if (void 0 !== t) {
const i = a1(t).pop();
p1(s), u1(s, void 0, i), s4(s, [
i
]);
}
}
this.it = e;
} else this.it = void 0;
return this.render(e);
}
});
const o6 = e3(class extends i3 {
constructor(t1){
var i;
if (super(t1), t1.type !== t3.ATTRIBUTE || "class" !== t1.name || (null === (i = t1.strings) || void 0 === i ? void 0 : i.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
}
render(t) {
return " " + Object.keys(t).filter((i)=>t[i]
).join(" ") + " ";
}
update(i, [s]) {
var r1, o6;
if (void 0 === this.st) {
this.st = new Set(), void 0 !== i.strings && (this.et = new Set(i.strings.join(" ").split(/\s/).filter((t)=>"" !== t
)));
for(const t in s)s[t] && !(null === (r1 = this.et) || void 0 === r1 ? void 0 : r1.has(t)) && this.st.add(t);
return this.render(s);
}
const e = i.element.classList;
this.st.forEach((t)=>{
t in s || (e.remove(t), this.st.delete(t));
});
for(const t1 in s){
const i = !!s[t1];
i === this.st.has(t1) || (null === (o6 = this.et) || void 0 === o6 ? void 0 : o6.has(t1)) || (i ? (e.add(t1), this.st.add(t1)) : (e.remove(t1), this.st.delete(t1)));
}
return b;
}
});
const l3 = (l)=>null != l ? l : T
;
const e6 = {
}, i6 = e3(class extends i3 {
constructor(){
super(...arguments), this.ot = e6;
}
render(r, t) {
return t();
}
update(t, [s, e]) {
if (Array.isArray(s)) {
if (Array.isArray(this.ot) && this.ot.length === s.length && s.every((r, t)=>r === this.ot[t]
)) return b;
} else if (this.ot === s) return b;
return this.ot = Array.isArray(s) ? Array.from(s) : s, this.render(s, e);
}
});
const u2 = (e, s, t)=>{
const r = new Map();
for(let l = s; l <= t; l++)r.set(e[l], l);
return r;
}, c1 = e3(class extends i3 {
constructor(e){
if (super(e), e.type !== t3.CHILD) throw Error("repeat() can only be used in text expressions");
}
dt(e, s, t) {
let r;
void 0 === t ? t = s : void 0 !== s && (r = s);
const l = [], o = [];
let i = 0;
for (const s1 of e)l[i] = r ? r(s1, i) : i, o[i] = t(s1, i), i++;
return {
values: o,
keys: l
};
}
render(e, s, t) {
return this.dt(e, s, t).values;
}
update(s, [t, r, c]) {
var d3;
const a2 = a1(s), { values: p , keys: v } = this.dt(t, r, c);
if (!Array.isArray(a2)) return this.ct = v, p;
const h = null !== (d3 = this.ct) && void 0 !== d3 ? d3 : this.ct = [], m = [];
let y, x, j = 0, k = a2.length - 1, w = 0, A = p.length - 1;
for(; j <= k && w <= A;)if (null === a2[j]) j++;
else if (null === a2[k]) k--;
else if (h[j] === v[w]) m[w] = c1(a2[j], p[w]), j++, w++;
else if (h[k] === v[A]) m[A] = c1(a2[k], p[A]), k--, A--;
else if (h[j] === v[A]) m[A] = c1(a2[j], p[A]), u1(s, m[A + 1], a2[j]), j++, A--;
else if (h[k] === v[w]) m[w] = c1(a2[k], p[w]), u1(s, a2[j], a2[k]), k--, w++;
else if (void 0 === y && (y = u2(v, w, A), x = u2(h, j, k)), y.has(h[j])) {
if (y.has(h[k])) {
const e = x.get(v[w]), t = void 0 !== e ? a2[e] : null;
if (null === t) {
const e = u1(s, a2[j]);
c1(e, p[w]), m[w] = e;
} else m[w] = c1(t, p[w]), u1(s, a2[j], t), a2[e] = null;
w++;
} else m1(a2[k]), k--;
} else m1(a2[j]), j++;
for(; w <= A;){
const e = u1(s, m[A + 1]);
c1(e, p[w]), m[w++] = e;
}
for(; j <= k;){
const e = a2[j++];
null !== e && m1(e);
}
return this.ct = v, s4(s, m), b;
}
});
const i7 = e3(class extends i3 {
constructor(t1){
var e;
if (super(t1), t1.type !== t3.ATTRIBUTE || "style" !== t1.name || (null === (e = t1.strings) || void 0 === e ? void 0 : e.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
}
render(t) {
return Object.keys(t).reduce((e, r)=>{
const s = t[r];
return null == s ? e : e + `${r = r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s};`;
}, "");
}
update(e, [r]) {
const { style: s } = e.element;
if (void 0 === this.ut) {
this.ut = new Set();
for(const t in r)this.ut.add(t);
return this.render(r);
}
this.ut.forEach((t)=>{
null == r[t] && (this.ut.delete(t), t.includes("-") ? s.removeProperty(t) : s[t] = "");
});
for(const t1 in r){
const e = r[t1];
null != e && (this.ut.add(t1), t1.includes("-") ? s.setProperty(t1, e) : s[t1] = e);
}
return b;
}
});
class e7 extends i3 {
constructor(i){
if (super(i), this.it = T, i.type !== t3.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
}
render(r) {
if (r === T || null == r) return this.vt = void 0, this.it = r;
if (r === b) return r;
if ("string" != typeof r) throw Error(this.constructor.directiveName + "() called with a non-string value");
if (r === this.it) return this.vt;
this.it = r;
const s = [
r
];
return s.raw = s, this.vt = {
_$litType$: this.constructor.resultType,
strings: s,
values: []
};
}
}
e7.directiveName = "unsafeHTML", e7.resultType = 1;
const o7 = e3(e7);
const n5 = (t)=>!t4(t) && "function" == typeof t.then
;
class h4 extends d1 {
constructor(){
super(...arguments), this._$Cft = 1073741823, this._$Cwt = [], this._$CG = new s5(this), this._$CK = new i5();
}
render(...s) {
var i1;
return null !== (i1 = s.find((t)=>!n5(t)
)) && void 0 !== i1 ? i1 : b;
}
update(s, i) {
const r = this._$Cwt;
let e = r.length;
this._$Cwt = i;
const o = this._$CG, h = this._$CK;
this.isConnected || this.disconnected();
for(let t1 = 0; t1 < i.length && !(t1 > this._$Cft); t1++){
const s = i[t1];
if (!n5(s)) return this._$Cft = t1, s;
t1 < e && s === r[t1] || (this._$Cft = 1073741823, e = 0, Promise.resolve(s).then(async (t)=>{
for(; h.get();)await h.get();
const i = o.deref();
if (void 0 !== i) {
const r = i._$Cwt.indexOf(s);
r > -1 && r < i._$Cft && (i._$Cft = r, i.setValue(t));
}
}));
}
return b;
}
disconnected() {
this._$CG.disconnect(), this._$CK.pause();
}
reconnected() {
this._$CG.reconnect(this), this._$CK.resume();
}
}
const c3 = e3(h4);
const l4 = e3(class extends i3 {
constructor(r1){
if (super(r1), r1.type !== t3.PROPERTY && r1.type !== t3.ATTRIBUTE && r1.type !== t3.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
if (!r3(r1)) throw Error("`live` bindings can only contain a single expression");
}
render(r) {
return r;
}
update(i, [t]) {
if (t === b || t === T) return t;
const o = i.element, l = i.name;
if (i.type === t3.PROPERTY) {
if (t === o[l]) return b;
} else if (i.type === t3.BOOLEAN_ATTRIBUTE) {
if (!!t === o.hasAttribute(l)) return b;
} else if (i.type === t3.ATTRIBUTE && o.getAttribute(l) === t + "") return b;
return s4(i), t;
}
});
const o8 = e3(class extends i3 {
constructor(t1){
if (super(t1), t1.type !== t3.CHILD) throw Error("templateContent can only be used in child bindings");
}
render(r) {
return this.at === r ? b : (this.at = r, document.importNode(r.content, !0));
}
});
class t12 extends e7 {
}
t12.directiveName = "unsafeSVG", t12.resultType = 2;
const o9 = e3(t12);
(function(root, factory) {
if (typeof exports === 'object') {
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
define([], factory);
} else {
root.Draggable = factory();
}
})(this, function() {
'use strict';
var defaults = {
grid: 0,
filterTarget: null,
limit: {
x: null,
y: null
},
threshold: 0,
setCursor: false,
setPosition: true,
smoothDrag: true,
useGPU: true,
onDrag: noop,
onDragStart: noop,
onDragEnd: noop
};
var env = {
transform: function() {
var prefixes = ' -o- -ms- -moz- -webkit-'.split(' ');
var style = document.body.style;
for(var n = prefixes.length; n--;){
var property = prefixes[n] + 'transform';
if (property in style) {
return property;
}
}
}()
};
var util = {
assign: function() {
var obj = arguments[0];
var count = arguments.length;
for(var n = 1; n < count; n++){
var argument = arguments[n];
for(var key in argument){
obj[key] = argument[key];
}
}
return obj;
},
bind: function(fn, context) {
return function() {
fn.apply(context, arguments);
};
},
on: function(element, e, fn) {
if (e && fn) {
util.addEvent(element, e, fn);
} else if (e) {
for(var ee in e){
util.addEvent(element, ee, e[ee]);
}
}
},
off: function(element, e, fn) {
if (e && fn) {
util.removeEvent(element, e, fn);
} else if (e) {
for(var ee in e){
util.removeEvent(element, ee, e[ee]);
}
}
},
limit: function(n, limit) {
if (isArray(limit)) {
limit = [
+limit[0],
+limit[1]
];
if (n < limit[0]) n = limit[0];
else if (n > limit[1]) n = limit[1];
} else {
n = +limit;
}
return n;
},
addEvent: 'attachEvent' in Element.prototype ? function(element, e, fn) {
element.attachEvent('on' + e, fn);
} : function(element, e, fn) {
element.addEventListener(e, fn, false);
},
removeEvent: 'attachEvent' in Element.prototype ? function(element, e, fn) {
element.detachEvent('on' + e, fn);
} : function(element, e, fn) {
element.removeEventListener(e, fn);
}
};
function Draggable(element, options) {
var me = this, start = util.bind(me.start, me), drag = util.bind(me.drag, me), stop = util.bind(me.stop, me);
if (!isElement(element)) {
throw new TypeError('Draggable expects argument 0 to be an Element');
}
options = util.assign({
}, defaults, options);
util.assign(me, {
element: element,
handle: options.handle && isElement(options.handle) ? options.handle : element,
handlers: {
start: {
mousedown: start,
touchstart: start
},
move: {
mousemove: drag,
mouseup: stop,
touchmove: drag,
touchend: stop
}
},
options: options
});
me.initialize();
}
util.assign(Draggable.prototype, {
setOption: function(property, value) {
var me = this;
me.options[property] = value;
me.initialize();
return me;
},
get: function() {
var dragEvent = this.dragEvent;
return {
x: dragEvent.x,
y: dragEvent.y
};
},
set: function(x, y) {
var me = this, dragEvent = me.dragEvent;
dragEvent.original = {
x: dragEvent.x,
y: dragEvent.y
};
me.move(x, y);
return me;
},
dragEvent: {
started: false,
x: 0,
y: 0
},
initialize: function() {
var me = this, element = me.element, handle = me.handle, style = element.style, compStyle = getStyle(element), options = me.options, transform = env.transform, oldTransform;
var _dimensions = me._dimensions = {
height: element.offsetHeight,
left: element.offsetLeft,
top: element.offsetTop,
width: element.offsetWidth
};
if (options.useGPU && transform) {
oldTransform = compStyle[transform];
if (oldTransform === 'none') {
oldTransform = '';
}
style[transform] = oldTransform + ' translate3d(0,0,0)';
}
if (options.setPosition) {
style.display = 'block';
style.left = _dimensions.left + 'px';
style.top = _dimensions.top + 'px';
style.width = _dimensions.width + 'px';
style.height = _dimensions.height + 'px';
style.bottom = style.right = 'auto';
style.margin = 0;
style.position = 'absolute';
}
if (options.setCursor) {
style.cursor = 'move';
}
me.setLimit(options.limit);
util.assign(me.dragEvent, {
x: _dimensions.left,
y: _dimensions.top
});
util.on(me.handle, me.handlers.start);
},
start: function(e) {
var me = this;
var cursor = me.getCursor(e);
var element = me.element;
if (!me.useTarget(e.target || e.srcElement)) {
return;
}
if (e.preventDefault && !e.target.getAttribute('contenteditable')) {
e.preventDefault();
} else if (!e.target.getAttribute('contenteditable')) {
e.returnValue = false;
}
me.dragEvent.oldZindex = element.style.zIndex;
element.style.zIndex = 10000;
me.setCursor(cursor);
me.setPosition();
me.setZoom();
util.on(document, me.handlers.move);
},
drag: function(e) {
var me = this, dragEvent = me.dragEvent, element = me.element, initialCursor = me._cursor, initialPosition = me._dimensions, options = me.options, zoom = initialPosition.zoom, cursor = me.getCursor(e), threshold = options.threshold, x = (cursor.x - initialCursor.x) / zoom + initialPosition.left, y = (cursor.y - initialCursor.y) / zoom + initialPosition.top;
if (!dragEvent.started && threshold && Math.abs(initialCursor.x - cursor.x) < threshold && Math.abs(initialCursor.y - cursor.y) < threshold) {
return;
}
if (!dragEvent.original) {
dragEvent.original = {
x: x,
y: y
};
}
if (!dragEvent.started) {
options.onDragStart(element, x, y, e);
dragEvent.started = true;
}
if (me.move(x, y)) {
options.onDrag(element, dragEvent.x, dragEvent.y, e);
}
},
move: function(x, y) {
var me = this, dragEvent = me.dragEvent, options = me.options, grid = options.grid, style = me.element.style, pos = me.limit(x, y, dragEvent.original.x, dragEvent.original.y);
if (!options.smoothDrag && grid) {
pos = me.round(pos, grid);
}
if (pos.x !== dragEvent.x || pos.y !== dragEvent.y) {
dragEvent.x = pos.x;
dragEvent.y = pos.y;
style.left = pos.x + 'px';
style.top = pos.y + 'px';
return true;
}
return false;
},
stop: function(e) {
var me = this, dragEvent = me.dragEvent, element = me.element, options = me.options, grid = options.grid, pos;
util.off(document, me.handlers.move);
element.style.zIndex = dragEvent.oldZindex;
if (options.smoothDrag && grid) {
pos = me.round({
x: dragEvent.x,
y: dragEvent.y
}, grid);
me.move(pos.x, pos.y);
util.assign(me.dragEvent, pos);
}
if (me.dragEvent.started) {
options.onDragEnd(element, dragEvent.x, dragEvent.y, e);
}
me.reset();
},
reset: function() {
this.dragEvent.started = false;
},
round: function(pos) {
var grid = this.options.grid;
return {
x: grid * Math.round(pos.x / grid),
y: grid * Math.round(pos.y / grid)
};
},
getCursor: function(e) {
return {
x: (e.targetTouches ? e.targetTouches[0] : e).clientX,
y: (e.targetTouches ? e.targetTouches[0] : e).clientY
};
},
setCursor: function(xy) {
this._cursor = xy;
},
setLimit: function(limit) {
var me = this, _true = function(x, y) {
return {
x: x,
y: y
};
};
if (isFunction(limit)) {
me.limit = limit;
} else if (isElement(limit)) {
var draggableSize = me._dimensions, height = limit.scrollHeight - draggableSize.height, width = limit.scrollWidth - draggableSize.width;
me.limit = function(x, y) {
return {
x: util.limit(x, [
0,
width
]),
y: util.limit(y, [
0,
height
])
};
};
} else if (limit) {
var defined = {
x: isDefined(limit.x),
y: isDefined(limit.y)
};
if (!defined.x && !defined.y) {
me.limit = _true;
} else {
me.limit = function(x, y) {
return {
x: defined.x ? util.limit(x, limit.x) : x,
y: defined.y ? util.limit(y, limit.y) : y
};
};
}
} else {
me.limit = _true;
}
},
setPosition: function() {
var me = this, element = me.element, style = element.style;
util.assign(me._dimensions, {
left: parse(style.left) || element.offsetLeft,
top: parse(style.top) || element.offsetTop
});
},
setZoom: function() {
var me = this;
var element = me.element;
var zoom = 1;
while(element = element.offsetParent){
var z = getStyle(element).zoom;
if (z && z !== 'normal') {
zoom = z;
break;
}
}
me._dimensions.zoom = zoom;
},
useTarget: function(element) {
var filterTarget = this.options.filterTarget;
if (filterTarget instanceof Function) {
return filterTarget(element);
}
return true;
},
destroy: function() {
util.off(this.handle, this.handlers.start);
util.off(document, this.handlers.move);
}
});
function parse(string) {
return parseInt(string, 10);
}
function getStyle(element) {
return 'currentStyle' in element ? element.currentStyle : getComputedStyle(element);
}
function isArray(thing) {
return thing instanceof Array;
}
function isDefined(thing) {
return thing !== void 0 && thing !== null;
}
function isElement(thing) {
return thing instanceof Element || typeof HTMLDocument !== 'undefined' && thing instanceof HTMLDocument;
}
function isFunction(thing) {
return thing instanceof Function;
}
function noop() {
}
return Draggable;
});
function getBoundingClientRect(element, includeScale) {
if (includeScale === void 0) {
includeScale = false;
}
var rect = element.getBoundingClientRect();
var scaleX = 1;
var scaleY = 1;
return {
width: rect.width / scaleX,
height: rect.height / scaleY,
top: rect.top / scaleY,
right: rect.right / scaleX,
bottom: rect.bottom / scaleY,
left: rect.left / scaleX,
x: rect.left / scaleX,
y: rect.top / scaleY
};
}
function getWindow(node) {
if (node == null) {
return window;
}
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}
function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
}
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
if (typeof ShadowRoot === 'undefined') {
return false;
}
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
function getNodeName(element) {
return element ? (element.nodeName || '').toLowerCase() : null;
}
function getDocumentElement(element) {
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
function getWindowScrollBarX(element) {
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}
function getComputedStyle1(element) {
return getWindow(element).getComputedStyle(element);
}
function isScrollParent(element) {
var _getComputedStyle = getComputedStyle1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}
function isElementScaled(element) {
var rect = element.getBoundingClientRect();
var scaleX = rect.width / element.offsetWidth || 1;
var scaleY = rect.height / element.offsetHeight || 1;
return scaleX !== 1 || scaleY !== 1;
}
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent, true);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
function getLayoutRect(element) {
var clientRect = getBoundingClientRect(element);
var width = element.offsetWidth;
var height = element.offsetHeight;
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}
return {
x: element.offsetLeft,
y: element.offsetTop,
width: width,
height: height
};
}
function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
}
return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
}
function getScrollParent(node) {
if ([
'html',
'body',
'#document'
].indexOf(getNodeName(node)) >= 0) {
return node.ownerDocument.body;
}
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
return getScrollParent(getParentNode(node));
}
function listScrollParents(element, list) {
var _element$ownerDocumen;
if (list === void 0) {
list = [];
}
var scrollParent = getScrollParent(element);
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
var win = getWindow(scrollParent);
var target = isBody ? [
win
].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}
function isTableElement(element) {
return [
'table',
'td',
'th'
].indexOf(getNodeName(element)) >= 0;
}
function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || getComputedStyle1(element).position === 'fixed') {
return null;
}
return element.offsetParent;
}
function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
if (isIE && isHTMLElement(element)) {
var elementCss = getComputedStyle1(element);
if (elementCss.position === 'fixed') {
return null;
}
}
var currentNode = getParentNode(element);
while(isHTMLElement(currentNode) && [
'html',
'body'
].indexOf(getNodeName(currentNode)) < 0){
var css = getComputedStyle1(currentNode);
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || [
'transform',
'perspective'
].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
}
return null;
}
function getOffsetParent(element) {
var window = getWindow(element);
var offsetParent = getTrueOffsetParent(element);
while(offsetParent && isTableElement(offsetParent) && getComputedStyle1(offsetParent).position === 'static'){
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle1(offsetParent).position === 'static')) {
return window;
}
return offsetParent || getContainingBlock(element) || window;
}
var top = 'top';
var bottom = 'bottom';
var right = 'right';
var left = 'left';
var auto = 'auto';
var basePlacements = [
top,
bottom,
right,
left
];
var start = 'start';
var end = 'end';
basePlacements.reduce(function(acc, placement) {
return acc.concat([
placement + "-" + start,
placement + "-" + end
]);
}, []);
[].concat(basePlacements, [
auto
]).reduce(function(acc, placement) {
return acc.concat([
placement,
placement + "-" + start,
placement + "-" + end
]);
}, []);
var beforeRead = 'beforeRead';
var read = 'read';
var afterRead = 'afterRead';
var beforeMain = 'beforeMain';
var main = 'main';
var afterMain = 'afterMain';
var beforeWrite = 'beforeWrite';
var write = 'write';
var afterWrite = 'afterWrite';
var modifierPhases = [
beforeRead,
read,
afterRead,
beforeMain,
main,
afterMain,
beforeWrite,
write,
afterWrite
];
function order(modifiers) {
var map = new Map();
var visited = new Set();
var result = [];
modifiers.forEach(function(modifier) {
map.set(modifier.name, modifier);
});
function sort(modifier) {
visited.add(modifier.name);
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
requires.forEach(function(dep) {
if (!visited.has(dep)) {
var depModifier = map.get(dep);
if (depModifier) {
sort(depModifier);
}
}
});
result.push(modifier);
}
modifiers.forEach(function(modifier) {
if (!visited.has(modifier.name)) {
sort(modifier);
}
});
return result;
}
function orderModifiers(modifiers) {
var orderedModifiers = order(modifiers);
return modifierPhases.reduce(function(acc, phase) {
return acc.concat(orderedModifiers.filter(function(modifier) {
return modifier.phase === phase;
}));
}, []);
}
function debounce1(fn) {
var pending;
return function() {
if (!pending) {
pending = new Promise(function(resolve) {
Promise.resolve().then(function() {
pending = undefined;
resolve(fn());
});
});
}
return pending;
};
}
function format(str) {
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
args[_key - 1] = arguments[_key];
}
return [].concat(args).reduce(function(p, c) {
return p.replace(/%s/, c);
}, str);
}
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
var VALID_PROPERTIES = [
'name',
'enabled',
'phase',
'fn',
'effect',
'requires',
'options'
];
function validateModifiers(modifiers) {
modifiers.forEach(function(modifier) {
[].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
return self.indexOf(value) === index;
}).forEach(function(key) {
switch(key){
case 'name':
if (typeof modifier.name !== 'string') {
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
}
break;
case 'enabled':
if (typeof modifier.enabled !== 'boolean') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
}
break;
case 'phase':
if (modifierPhases.indexOf(modifier.phase) < 0) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
}
break;
case 'fn':
if (typeof modifier.fn !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
}
break;
case 'effect':
if (modifier.effect != null && typeof modifier.effect !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
}
break;
case 'requires':
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
}
break;
case 'requiresIfExists':
if (!Array.isArray(modifier.requiresIfExists)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
}
break;
case 'options':
case 'data':
break;
default:
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function(s) {
return "\"" + s + "\"";
}).join(', ') + "; but \"" + key + "\" was provided.");
}
modifier.requires && modifier.requires.forEach(function(requirement) {
if (modifiers.find(function(mod) {
return mod.name === requirement;
}) == null) {
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
}
});
});
});
}
function uniqueBy(arr, fn) {
var identifiers = new Set();
return arr.filter(function(item) {
var identifier = fn(item);
if (!identifiers.has(identifier)) {
identifiers.add(identifier);
return true;
}
});
}
function getBasePlacement(placement) {
return placement.split('-')[0];
}
function mergeByName(modifiers) {
var merged = modifiers.reduce(function(merged, current) {
var existing = merged[current.name];
merged[current.name] = existing ? Object.assign({
}, existing, current, {
options: Object.assign({
}, existing.options, current.options),
data: Object.assign({
}, existing.data, current.data)
}) : current;
return merged;
}, {
});
return Object.keys(merged).map(function(key) {
return merged[key];
});
}
var round = Math.round;
function getVariation(placement) {
return placement.split('-')[1];
}
function getMainAxisFromPlacement(placement) {
return [
'top',
'bottom'
].indexOf(placement) >= 0 ? 'x' : 'y';
}
function computeOffsets(_ref) {
var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
var basePlacement = placement ? getBasePlacement(placement) : null;
var variation = placement ? getVariation(placement) : null;
var commonX = reference.x + reference.width / 2 - element.width / 2;
var commonY = reference.y + reference.height / 2 - element.height / 2;
var offsets;
switch(basePlacement){
case top:
offsets = {
x: commonX,
y: reference.y - element.height
};
break;
case bottom:
offsets = {
x: commonX,
y: reference.y + reference.height
};
break;
case right:
offsets = {
x: reference.x + reference.width,
y: commonY
};
break;
case left:
offsets = {
x: reference.x - element.width,
y: commonY
};
break;
default:
offsets = {
x: reference.x,
y: reference.y
};
}
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch(variation){
case start:
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
break;
case end:
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
break;
default:
}
}
return offsets;
}
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
var DEFAULT_OPTIONS = {
placement: 'bottom',
modifiers: [],
strategy: 'absolute'
};
function areValidElements() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
return !args.some(function(element) {
return !(element && typeof element.getBoundingClientRect === 'function');
});
}
function popperGenerator1(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {
};
}
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
return function createPopper(reference, popper, options) {
if (options === void 0) {
options = defaultOptions;
}
var state = {
placement: 'bottom',
orderedModifiers: [],
options: Object.assign({
}, DEFAULT_OPTIONS, defaultOptions),
modifiersData: {
},
elements: {
reference: reference,
popper: popper
},
attributes: {
},
styles: {
}
};
var effectCleanupFns = [];
var isDestroyed = false;
var instance = {
state: state,
setOptions: function setOptions(setOptionsAction) {
var options1 = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
cleanupModifierEffects();
state.options = Object.assign({
}, defaultOptions, state.options, options1);
state.scrollParents = {
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
popper: listScrollParents(popper)
};
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers)));
state.orderedModifiers = orderedModifiers.filter(function(m) {
return m.enabled;
});
if (process.env.NODE_ENV !== "production") {
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
var name = _ref.name;
return name;
});
validateModifiers(modifiers);
if (getBasePlacement(state.options.placement) === auto) {
var flipModifier = state.orderedModifiers.find(function(_ref2) {
var name = _ref2.name;
return name === 'flip';
});
if (!flipModifier) {
console.error([
'Popper: "auto" placements require the "flip" modifier be',
'present and enabled to work.'
].join(' '));
}
}
var _getComputedStyle = getComputedStyle1(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
if ([
marginTop,
marginRight,
marginBottom,
marginLeft
].some(function(margin) {
return parseFloat(margin);
})) {
console.warn([
'Popper: CSS "margin" styles cannot be used to apply padding',
'between the popper and its reference element or boundary.',
'To replicate margin, use the `offset` modifier, as well as',
'the `padding` option in the `preventOverflow` and `flip`',
'modifiers.'
].join(' '));
}
}
runModifierEffects();
return instance.update();
},
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference1 = _state$elements.reference, popper1 = _state$elements.popper;
if (!areValidElements(reference1, popper1)) {
if (process.env.NODE_ENV !== "production") {
console.error(INVALID_ELEMENT_ERROR);
}
return;
}
state.rects = {
reference: getCompositeRect(reference1, getOffsetParent(popper1), state.options.strategy === 'fixed'),
popper: getLayoutRect(popper1)
};
state.reset = false;
state.placement = state.options.placement;
state.orderedModifiers.forEach(function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({
}, modifier.data);
});
var __debug_loops__ = 0;
for(var index = 0; index < state.orderedModifiers.length; index++){
if (process.env.NODE_ENV !== "production") {
__debug_loops__ += 1;
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
if (state.reset === true) {
state.reset = false;
index = -1;
continue;
}
var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {
} : _state$orderedModifie2, name = _state$orderedModifie.name;
if (typeof fn === 'function') {
state = fn({
state: state,
options: _options,
name: name,
instance: instance
}) || state;
}
}
},
update: debounce1(function() {
return new Promise(function(resolve) {
instance.forceUpdate();
resolve(state);
});
}),
destroy: function destroy() {
cleanupModifierEffects();
isDestroyed = true;
}
};
if (!areValidElements(reference, popper)) {
if (process.env.NODE_ENV !== "production") {
console.error(INVALID_ELEMENT_ERROR);
}
return instance;
}
instance.setOptions(options).then(function(state) {
if (!isDestroyed && options.onFirstUpdate) {
options.onFirstUpdate(state);
}
});
function runModifierEffects() {
state.orderedModifiers.forEach(function(_ref3) {
var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {
} : _ref3$options, effect = _ref3.effect;
if (typeof effect === 'function') {
var cleanupFn = effect({
state: state,
name: name,
instance: instance,
options: options
});
var noopFn = function noopFn() {
};
effectCleanupFns.push(cleanupFn || noopFn);
}
});
}
function cleanupModifierEffects() {
effectCleanupFns.forEach(function(fn) {
return fn();
});
effectCleanupFns = [];
}
return instance;
};
}
popperGenerator1();
var passive = {
passive: true
};
function effect(_ref) {
var state = _ref.state, instance = _ref.instance, options = _ref.options;
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
var window = getWindow(state.elements.popper);
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
if (scroll) {
scrollParents.forEach(function(scrollParent) {
scrollParent.addEventListener('scroll', instance.update, passive);
});
}
if (resize) {
window.addEventListener('resize', instance.update, passive);
}
return function() {
if (scroll) {
scrollParents.forEach(function(scrollParent) {
scrollParent.removeEventListener('scroll', instance.update, passive);
});
}
if (resize) {
window.removeEventListener('resize', instance.update, passive);
}
};
}
const __default = {
name: 'eventListeners',
enabled: true,
phase: 'write',
fn: function fn() {
},
effect: effect,
data: {
}
};
function popperOffsets(_ref) {
var state = _ref.state, name = _ref.name;
state.modifiersData[name] = computeOffsets({
reference: state.rects.reference,
element: state.rects.popper,
strategy: 'absolute',
placement: state.placement
});
}
const __default1 = {
name: 'popperOffsets',
enabled: true,
phase: 'read',
fn: popperOffsets,
data: {
}
};
var unsetSides = {
top: 'auto',
right: 'auto',
bottom: 'auto',
left: 'auto'
};
function roundOffsetsByDPR(_ref) {
var x1 = _ref.x, y1 = _ref.y;
var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(round(x1 * dpr) / dpr) || 0,
y: round(round(y1 * dpr) / dpr) || 0
};
}
function mapToStyles(_ref2) {
var _Object$assign2;
var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets;
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x1 = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y1 = _ref3$y === void 0 ? 0 : _ref3$y;
var hasX = offsets.hasOwnProperty('x');
var hasY = offsets.hasOwnProperty('y');
var sideX = left;
var sideY = top;
var win = window;
if (adaptive) {
var offsetParent = getOffsetParent(popper);
var heightProp = 'clientHeight';
var widthProp = 'clientWidth';
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
if (getComputedStyle1(offsetParent).position !== 'static' && position === 'absolute') {
heightProp = 'scrollHeight';
widthProp = 'scrollWidth';
}
}
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
y1 -= offsetParent[heightProp] - popperRect.height;
y1 *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
x1 -= offsetParent[widthProp] - popperRect.width;
x1 *= gpuAcceleration ? 1 : -1;
}
}
var commonStyles = Object.assign({
position: position
}, adaptive && unsetSides);
if (gpuAcceleration) {
var _Object$assign;
return Object.assign({
}, commonStyles, (_Object$assign = {
}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x1 + "px, " + y1 + "px)" : "translate3d(" + x1 + "px, " + y1 + "px, 0)", _Object$assign));
}
return Object.assign({
}, commonStyles, (_Object$assign2 = {
}, _Object$assign2[sideY] = hasY ? y1 + "px" : '', _Object$assign2[sideX] = hasX ? x1 + "px" : '', _Object$assign2.transform = '', _Object$assign2));
}
function computeStyles(_ref4) {
var state = _ref4.state, options = _ref4.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
if (process.env.NODE_ENV !== "production") {
var transitionProperty = getComputedStyle1(state.elements.popper).transitionProperty || '';
if (adaptive && [
'transform',
'top',
'right',
'bottom',
'left'
].some(function(property) {
return transitionProperty.indexOf(property) >= 0;
})) {
console.warn([
'Popper: Detected CSS transitions on at least one of the following',
'CSS properties: "transform", "top", "right", "bottom", "left".',
'\n\n',
'Disable the "computeStyles" modifier\'s `adaptive` option to allow',
'for smooth transitions, or remove these properties from the CSS',
'transition declaration on the popper element if only transitioning',
'opacity or background-color for example.',
'\n\n',
'We recommend using the popper element as a wrapper around an inner',
'element that can have any CSS property transitioned for animations.'
].join(' '));
}
}
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
gpuAcceleration: gpuAcceleration
};
if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign({
}, state.styles.popper, mapToStyles(Object.assign({
}, commonStyles, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
adaptive: adaptive,
roundOffsets: roundOffsets
})));
}
if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign({
}, state.styles.arrow, mapToStyles(Object.assign({
}, commonStyles, {
offsets: state.modifiersData.arrow,
position: 'absolute',
adaptive: false,
roundOffsets: roundOffsets
})));
}
state.attributes.popper = Object.assign({
}, state.attributes.popper, {
'data-popper-placement': state.placement
});
}
const __default2 = {
name: 'computeStyles',
enabled: true,
phase: 'beforeWrite',
fn: computeStyles,
data: {
}
};
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach(function(name) {
var style = state.styles[name] || {
};
var attributes = state.attributes[name] || {
};
var element = state.elements[name];
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach(function(name) {
var value = attributes[name];
if (value === false) {
element.removeAttribute(name);
} else {
element.setAttribute(name, value === true ? '' : value);
}
});
});
}
function effect1(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: '0',
top: '0',
margin: '0'
},
arrow: {
position: 'absolute'
},
reference: {
}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
state.styles = initialStyles;
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
return function() {
Object.keys(state.elements).forEach(function(name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {
};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
var style = styleProperties.reduce(function(style, property) {
style[property] = '';
return style;
}, {
});
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach(function(attribute) {
element.removeAttribute(attribute);
});
});
};
}
const __default3 = {
name: 'applyStyles',
enabled: true,
phase: 'write',
fn: applyStyles,
effect: effect1,
requires: [
'computeStyles'
]
};
var defaultModifiers1 = [
__default,
__default1,
__default2,
__default3
];
popperGenerator1({
defaultModifiers: defaultModifiers1
});
class MoreBar1 {
constructor(barEl, moreEl, isJustifyEnd = false){
if (!barEl || !moreEl) throw new Error('MoreBar: two arguments required!');
this.barEl = barEl;
this.moreEl = moreEl;
this.isJustifyEnd = isJustifyEnd;
this.__onIntersection = this.__onIntersection.bind(this);
}
init() {
this.destroy();
const barEl = this.barEl;
const moreEl = this.moreEl;
const isJustifyEnd = this.isJustifyEnd;
barEl.style.display = 'flex';
moreEl.style.position = 'static';
const moreElWidthPlusMargins = getWidthPlusMargins(moreEl);
this.__hideEl(moreEl);
this.barEl.style.minWidth = moreElWidthPlusMargins + 'px';
const itemObserverOpts = {
root: barEl,
threshold: 0.99,
rootMargin: isJustifyEnd ? `0px 0px 0px ${-moreElWidthPlusMargins}px` : `0px ${-moreElWidthPlusMargins}px 0px 0px`
};
const lastItemObserverOpts = {
...itemObserverOpts,
rootMargin: '0px'
};
this.__itemObserver = new IntersectionObserver(this.__onIntersection, itemObserverOpts);
this.__lastItemObserver = new IntersectionObserver(this.__onIntersection, lastItemObserverOpts);
this.__observe();
}
destroy() {
this.__unobserve();
}
get barItems() {
let barChildArry;
if (this.barEl.matches('slot')) {
barChildArry = this.barEl.assignedElements();
} else {
barChildArry = Array.from(this.barEl.children);
}
const items = barChildArry.reduce((items, child)=>{
if (child.matches('slot')) {
items = items.concat(child.assignedElements());
} else if (child !== this.moreEl) {
items.push(child);
}
return items;
}, []);
return this.isJustifyEnd ? items.reverse() : items;
}
get __firstHiddenItem() {
for (const item of this.barItems){
if (this.__isHidden(item)) return item;
}
return undefined;
}
__observe() {
const barItems = this.barItems;
for (const item of barItems){
if (item !== barItems[barItems.length - 1]) {
this.__itemObserver.observe(item);
} else {
this.__lastItemObserver.observe(item);
}
}
}
__unobserve() {
var _this$__itemObserver, _this$__lastItemObser;
(_this$__itemObserver = this.__itemObserver) === null || _this$__itemObserver === void 0 ? void 0 : _this$__itemObserver.disconnect();
(_this$__lastItemObser = this.__lastItemObserver) === null || _this$__lastItemObser === void 0 ? void 0 : _this$__lastItemObser.disconnect();
}
__isHidden(el) {
return (el === null || el === void 0 ? void 0 : el.style.visibility) === 'hidden';
}
__hideEl(el) {
el.style.visibility = 'hidden';
}
__showEl(el) {
el.style.visibility = 'visible';
}
__positionMoreItem() {
this.__hideEl(this.moreEl);
this.moreEl.style.transform = '';
const firstHiddenItem = this.__firstHiddenItem;
if (firstHiddenItem) {
const side = this.isJustifyEnd ? 'right' : 'left';
this.moreEl.style.transform = `
translateX(${firstHiddenItem.getBoundingClientRect()[side] - this.moreEl.getBoundingClientRect()[side]}px)
`;
this.__showEl(this.moreEl);
this.barEl.dispatchEvent(new CustomEvent('morebar-moreitem-show', {
bubbles: true,
detail: {
item: this.moreEl,
type: 'show',
transform: this.moreEl.style.transform,
moreBar: this
}
}));
}
}
__onIntersection(entries) {
for (const entry of entries){
let isShow;
if (entry.isIntersecting) {
this.__showEl(entry.target);
isShow = true;
} else {
this.__hideEl(entry.target);
isShow = false;
}
this.barEl.dispatchEvent(new CustomEvent('morebar-item-update', {
bubbles: true,
detail: {
item: entry.target,
type: isShow ? 'show' : 'hide',
index: this.barItems.indexOf(entry.target),
moreBar: this
}
}));
}
this.__positionMoreItem();
}
}
function getMargins(el) {
const style = getComputedStyle(el);
return {
top: parseInt(style.marginTop || 0, 10),
right: parseInt(style.marginRight || 0, 10),
bottom: parseInt(style.marginBottom || 0, 10),
left: parseInt(style.marginLeft || 0, 10)
};
}
function getWidthPlusMargins(el) {
const margins = getMargins(el);
return el.offsetWidth + margins.left + margins.right;
}
const KEYCODES = {
TAB: 9,
ENTER: 13,
SHIFT: 16,
ESC: 27,
SPACE: 32,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
const template1 = document.createElement('template');
template1.innerHTML = `
<style>
:host {
display: flex;
align-items: center;
}
:host([checked]) .thumb {
right: 0px;
}
:host([disabled]) {
opacity: 50%;
}
.button {
display: inline-block;
position: relative;
height: 16px;
width: 36px;
}
.track {
height: 100%;
background-color: lightgrey;
}
.thumb {
right: 18px;
transition: right .1s;
top: 0;
position: absolute;
width: 50%;
height: 100%;
background-color: grey;
}
div[part="button"]:focus-visible,
div[part="button"]:focus:not(:focus-visible) {
outline: none;
}
div[part="button"]:focus .thumb {
box-shadow: var(--generic-switch-focus, 0 0 0 2px #145dce);
}
div[part="button"]:focus:not(:focus-visible) .thumb {
box-shadow: none;
}
label[part="label"] {
user-select: none;
}
</style>
<label part="label"><slot></slot></label>
<div part="button" class="button">
<div part="track" class="track"></div>
<div part="thumb" class="thumb"></div>
</div>
`;
let __count = 0;
class GenericSwitch1 extends HTMLElement {
constructor(){
super();
this.attachShadow({
mode: 'open'
});
this.shadowRoot.appendChild(template1.content.cloneNode(true));
this.__onClick = this.__onClick.bind(this);
this.__onKeyDown = this.__onKeyDown.bind(this);
}
static get observedAttributes() {
return [
'disabled',
'checked',
'label'
];
}
connectedCallback() {
this.__label = this.shadowRoot.querySelector('[part="label"]');
this.__button = this.shadowRoot.querySelector('[part="button"]');
this.__track = this.shadowRoot.querySelector('[part="track"]');
this.__thumb = this.shadowRoot.querySelector('[part="thumb"]');
this.__label.id = `label-${__count}`;
this.__button.id = `button-${__count}`;
this.__track.id = `track-${__count}`;
this.__thumb.id = `thumb-${__count}`;
this.addEventListener('click', this.__onClick);
this.addEventListener('keydown', this.__onKeyDown);
this.__button.setAttribute('role', 'switch');
if (!this.hasAttribute('label')) {
this.__button.setAttribute('aria-labelledby', `label-${__count}`);
this.__button.setAttribute('aria-describedby', `label-${__count}`);
this.__label.style.marginRight = '10px';
} else {
this.__button.setAttribute('aria-label', this.getAttribute('label'));
}
this.__checked = this.hasAttribute('checked') || false;
this.__update(false);
this.__handleDisabled();
__count++;
}
disconnectedCallback() {
this.__button.removeEventListener('click', this.__onClick);
this.__button.removeEventListener('keydown', this.__onKeyDown);
}
__handleDisabled() {
if (this.hasAttribute('disabled')) {
this.setAttribute('disabled', '');
this.__button.setAttribute('aria-disabled', 'true');
this.__button.removeAttribute('tabindex');
} else {
this.removeAttribute('disabled');
this.__button.removeAttribute('aria-disabled');
this.__button.setAttribute('tabindex', '0');
}
}
__onClick() {
if (!this.hasAttribute('disabled')) {
if (this.hasAttribute('checked')) {
this.removeAttribute('checked');
} else {
this.setAttribute('checked', '');
}
}
}
__onKeyDown(event) {
switch(event.keyCode){
case KEYCODES.SPACE:
case KEYCODES.ENTER:
event.preventDefault();
if (this.hasAttribute('checked')) {
this.removeAttribute('checked');
} else {
this.setAttribute('checked', '');
}
break;
default:
break;
}
}
__update(dispatch) {
if (this.__checked && !this.hasAttribute('disabled')) {
this.__button.setAttribute('aria-checked', 'true');
this.__button.setAttribute('checked', '');
} else {
this.__button.setAttribute('aria-checked', 'false');
this.__button.removeAttribute('checked');
}
if (dispatch) {
const { __checked } = this;
this.dispatchEvent(new CustomEvent('checked-changed', {
detail: __checked
}));
}
}
set checked(val) {
if (val) {
this.setAttribute('checked', '');
} else {
this.removeAttribute('checked');
}
}
get checked() {
return this.__checked;
}
attributeChangedCallback(name, oldVal, newVal) {
if (!this.__button) return;
if (newVal !== oldVal) {
switch(name){
case 'disabled':
this.__disabled = !this.__disabled;
this.__handleDisabled();
break;
case 'checked':
this.__checked = !this.__checked;
this.__update(true);
break;
case 'label':
this.__button.setAttribute('aria-label', newVal);
break;
default:
break;
}
}
}
}
export { merge1 as merge };
export { copy1 as copy };
export { s3 as LitElement, n1 as ReactiveElement, r as css, html as html, svg as svg, o as unsafeCSS };
export { c2 as asyncAppend };
export { h3 as asyncReplace };
export { d2 as cache };
export { o6 as classMap };
export { l3 as ifDefined };
export { i6 as guard };
export { c1 as repeat };
export { i7 as styleMap };
export { o7 as unsafeHTML };
export { c3 as until };
export { T as nothing, w as render };
export { l4 as live };
export { o8 as templateContent };
export { o9 as unsafeSVG };
export { Draggable as Draggable };
export { popperGenerator1 as popperGenerator, defaultModifiers1 as defaultModifiers };
export { flip as flip };
export { preventOverflow as preventOverflow };
export { offset as offset };
export { arrow as arrow };
export { MoreBar1 as MoreBar };
export { GenericSwitch1 as GenericSwitch };
// to use remove bundle --lock option or do preparation step:
// DENO_DIR=./cache deno cache --lock=lock.json --lock-write ./deps.js
// deno bundle --lock=lock.json ./deps.js ./deps.bundle.js
// NOTICE lines 1806,2047 in bundle output has const c1 declared separately twice, throwing:
// Uncaught SyntaxError: Identifier 'c1' has already been declared
/*
deno --version
deno 1.15.3 (release, aarch64-apple-darwin)
v8 9.5.172.19
typescript 4.4.2
*/
export { merge } from 'https://unpkg.com/merge-anything@4.0.1/dist/index.esm.js?module';
export { copy } from 'https://unpkg.com/copy-anything@2.0.3/dist/index.esm.js?module';
import 'https://unpkg.com/construct-style-sheets-polyfill@3.0.4/dist/adoptedStyleSheets.js?module';
import 'https://unpkg.com/element-internals-polyfill@0.1.46/dist/index.js?module';
import 'https://unpkg.com/@a11y/focus-trap@1.0.5/index.js?module';
export { LitElement, ReactiveElement, css, html, svg, unsafeCSS } from 'https://unpkg.com/lit@2.0.2/index.js?module';
export { asyncAppend } from 'https://unpkg.com/lit@2.0.2/directives/async-append.js?module';
export { asyncReplace } from 'https://unpkg.com/lit@2.0.2/directives/async-replace.js?module';
export { cache } from 'https://unpkg.com/lit@2.0.2/directives/cache.js?module';
export { classMap } from 'https://unpkg.com/lit@2.0.2/directives/class-map.js?module';
export { ifDefined } from 'https://unpkg.com/lit@2.0.2/directives/if-defined.js?module';
export { guard } from 'https://unpkg.com/lit@2.0.2/directives/guard.js?module';
export { repeat } from 'https://unpkg.com/lit@2.0.2/directives/repeat.js?module';
export { styleMap } from 'https://unpkg.com/lit@2.0.2/directives/style-map.js?module';
export { unsafeHTML } from 'https://unpkg.com/lit@2.0.2/directives/unsafe-html.js?module';
export { until } from 'https://unpkg.com/lit@2.0.2/directives/until.js?module';
export { nothing, render } from 'https://unpkg.com/lit@2.0.2/html.js?module';
export { live } from 'https://unpkg.com/lit@2.0.2/directives/live.js?module';
export { templateContent } from 'https://unpkg.com/lit@2.0.2/directives/template-content.js?module';
export { unsafeSVG } from 'https://unpkg.com/lit@2.0.2/directives/unsafe-svg.js?module';
export { Draggable } from 'https://unpkg.com/draggable@4.2.0/src/draggable.js?module';
export { popperGenerator, defaultModifiers } from 'https://unpkg.com/@popperjs/core/lib/popper-lite.js?module';
export { flip } from 'https://unpkg.com/@popperjs/core/lib/modifiers/flip.js?module';
export { preventOverflow } from 'https://unpkg.com/@popperjs/core/lib/modifiers/preventOverflow.js?module';
export { offset } from 'https://unpkg.com/@popperjs/core/lib/modifiers/offset.js?module';
export { arrow } from 'https://unpkg.com/@popperjs/core/lib/modifiers/arrow.js?module';
export { MoreBar } from 'https://unpkg.com/more-bar@0.2.2/index.js?module';
export { GenericSwitch } from 'https://unpkg.com/@generic-components/components@1.0.1/generic-switch/GenericSwitch.js?module';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment