");
css(wrapper, {
boxSizing: "border-box",
height: dim.height,
width: dim.width,
...css(el, [
"overflow",
"padding",
"borderTop",
"borderRight",
"borderBottom",
"borderLeft",
"borderImage",
marginStartProp
])
});
css(el, {
padding: 0,
border: 0,
minWidth: 0,
minHeight: 0,
[marginStartProp]: 0,
width: dim.width,
height: dim.height,
overflow: "hidden",
[dimProp]: currentDim
});
const percent = currentDim / endDim;
duration = (velocity * endDim + duration) * (show ? 1 - percent : percent);
const endProps = { [dimProp]: show ? endDim : 0 };
if (end) {
css(el, marginProp, endDim - currentDim + currentMargin);
endProps[marginProp] = show ? currentMargin : endDim + currentMargin;
}
if (!end ^ mode === "reveal") {
css(wrapper, marginProp, -endDim + currentDim);
Transition.start(wrapper, { [marginProp]: show ? 0 : -endDim }, duration, transition);
}
try {
await Transition.start(el, endProps, duration, transition);
} finally {
css(el, prevProps);
unwrap(wrapper.firstChild);
if (!show) {
_toggle(el, false);
}
}
}
function toggleAnimation(el, show, cmp) {
Animation.cancel(el);
const { animation, duration, _toggle } = cmp;
if (show) {
_toggle(el, true);
return Animation.in(el, animation[0], duration, cmp.origin);
}
return Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(
() => _toggle(el, false)
);
}
const keyMap = {
TAB: 9,
ESC: 27,
SPACE: 32,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
function resize(options) {
return observe(observeResize, options, "resize");
}
function intersection(options) {
return observe(observeIntersection, options);
}
function mutation(options) {
return observe(observeMutation, options);
}
function lazyload(options = {}) {
return intersection({
handler: function(entries, observer) {
const { targets = this.$el, preload = 5 } = options;
for (const el of toNodes(isFunction(targets) ? targets(this) : targets)) {
$$('[loading="lazy"]', el).slice(0, preload - 1).forEach((el2) => removeAttr(el2, "loading"));
}
for (const el of entries.filter(({ isIntersecting }) => isIntersecting).map(({ target }) => target)) {
observer.unobserve(el);
}
},
...options
});
}
function scroll$1(options) {
return observe(
function(target, handler) {
return {
disconnect: on(target, "scroll", handler, {
passive: true,
capture: true
})
};
},
{
target: () => window,
...options
},
"scroll"
);
}
function swipe(options) {
return {
observe(target, handler) {
return {
observe: noop,
unobserve: noop,
disconnect: on(target, pointerDown$1, handler, { passive: true })
};
},
handler(e) {
if (!isTouch(e)) {
return;
}
const pos = getEventPos(e);
const target = "tagName" in e.target ? e.target : parent(e.target);
once(document, `${pointerUp$1} ${pointerCancel} scroll`, (e2) => {
const { x, y } = getEventPos(e2);
if (e2.type !== "scroll" && target && x && Math.abs(pos.x - x) > 100 || y && Math.abs(pos.y - y) > 100) {
setTimeout(() => {
trigger(target, "swipe");
trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
});
}
});
},
...options
};
}
function observe(observe2, options, emit) {
return {
observe: observe2,
handler() {
this.$emit(emit);
},
...options
};
}
function swipeDirection(x1, y1, x2, y2) {
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? "Left" : "Right" : y1 - y2 > 0 ? "Up" : "Down";
}
var Accordion = {
mixins: [Class, Togglable],
props: {
animation: Boolean,
targets: String,
active: null,
collapsible: Boolean,
multiple: Boolean,
toggle: String,
content: String,
offset: Number
},
data: {
targets: "> *",
active: false,
animation: true,
collapsible: true,
multiple: false,
clsOpen: "uk-open",
toggle: "> .uk-accordion-title",
content: "> .uk-accordion-content",
offset: 0
},
computed: {
items({ targets }, $el) {
return $$(targets, $el);
},
toggles({ toggle }) {
return this.items.map((item) => $(toggle, item));
},
contents({ content }) {
return this.items.map((item) => {
var _a;
return ((_a = item._wrapper) == null ? void 0 : _a.firstElementChild) || $(content, item);
});
}
},
watch: {
items(items, prev) {
if (prev || hasClass(items, this.clsOpen)) {
return;
}
const active = this.active !== false && items[Number(this.active)] || !this.collapsible && items[0];
if (active) {
this.toggle(active, false);
}
},
toggles() {
this.$emit();
},
contents(items) {
for (const el of items) {
const isOpen = hasClass(
this.items.find((item) => within(el, item)),
this.clsOpen
);
hide(el, !isOpen);
}
this.$emit();
}
},
observe: lazyload(),
events: [
{
name: "click keydown",
delegate() {
return `${this.targets} ${this.$props.toggle}`;
},
async handler(e) {
var _a;
if (e.type === "keydown" && e.keyCode !== keyMap.SPACE) {
return;
}
e.preventDefault();
(_a = this._off) == null ? void 0 : _a.call(this);
this._off = keepScrollPosition(e.target);
await this.toggle(index(this.toggles, e.current));
this._off();
}
},
{
name: "shown hidden",
self: true,
delegate() {
return this.targets;
},
handler() {
this.$emit();
}
}
],
update() {
const activeItems = filter$1(this.items, `.${this.clsOpen}`);
for (const index2 in this.items) {
const toggle = this.toggles[index2];
const content = this.contents[index2];
if (!toggle || !content) {
continue;
}
toggle.id = generateId(this, toggle, `-title-${index2}`);
content.id = generateId(this, content, `-content-${index2}`);
const active = includes(activeItems, this.items[index2]);
attr(toggle, {
role: isTag(toggle, "a") ? "button" : null,
"aria-controls": content.id,
"aria-expanded": active,
"aria-disabled": !this.collapsible && activeItems.length < 2 && active
});
attr(content, { role: "region", "aria-labelledby": toggle.id });
if (isTag(content, "ul")) {
attr(children(content), "role", "presentation");
}
}
},
methods: {
toggle(item, animate) {
item = this.items[getIndex(item, this.items)];
let items = [item];
const activeItems = filter$1(this.items, `.${this.clsOpen}`);
if (!this.multiple && !includes(activeItems, items[0])) {
items = items.concat(activeItems);
}
if (!this.collapsible && activeItems.length < 2 && includes(activeItems, item)) {
return;
}
return Promise.all(
items.map(
(el) => this.toggleElement(el, !includes(activeItems, el), (el2, show) => {
toggleClass(el2, this.clsOpen, show);
if (animate === false || !this.animation) {
hide($(this.content, el2), !show);
return;
}
return transition(el2, show, this);
})
)
);
}
}
};
function hide(el, hide2) {
el && (el.hidden = hide2);
}
async function transition(el, show, { content, duration, velocity, transition: transition2 }) {
var _a;
content = ((_a = el._wrapper) == null ? void 0 : _a.firstElementChild) || $(content, el);
if (!el._wrapper) {
el._wrapper = wrapAll(content, "
");
}
const wrapper = el._wrapper;
css(wrapper, "overflow", "hidden");
const currentHeight = toFloat(css(wrapper, "height"));
await Transition.cancel(wrapper);
hide(content, false);
const endHeight = sumBy(["marginTop", "marginBottom"], (prop) => css(content, prop)) + dimensions$1(content).height;
const percent = currentHeight / endHeight;
duration = (velocity * endHeight + duration) * (show ? 1 - percent : percent);
css(wrapper, "height", currentHeight);
await Transition.start(wrapper, { height: show ? endHeight : 0 }, duration, transition2);
unwrap(content);
delete el._wrapper;
if (!show) {
hide(content, true);
}
}
function keepScrollPosition(el) {
const [scrollParent] = scrollParents(el, true);
let frame;
(function scroll() {
frame = requestAnimationFrame(() => {
const { top } = el.getBoundingClientRect();
if (top < 0) {
scrollParent.scrollTop += top;
}
scroll();
});
})();
return () => requestAnimationFrame(() => cancelAnimationFrame(frame));
}
var alert = {
mixins: [Class, Togglable],
args: "animation",
props: {
animation: Boolean,
close: String
},
data: {
animation: true,
selClose: ".uk-alert-close",
duration: 150
},
events: {
name: "click",
delegate() {
return this.selClose;
},
handler(e) {
e.preventDefault();
this.close();
}
},
methods: {
async close() {
await this.toggleElement(this.$el, false, animate$1);
this.$destroy(true);
}
}
};
function animate$1(el, show, { duration, transition, velocity }) {
const height = toFloat(css(el, "height"));
css(el, "height", height);
return Transition.start(
el,
{
height: 0,
marginTop: 0,
marginBottom: 0,
paddingTop: 0,
paddingBottom: 0,
borderTop: 0,
borderBottom: 0,
opacity: 0
},
velocity * height + duration,
transition
);
}
var Video = {
args: "autoplay",
props: {
automute: Boolean,
autoplay: Boolean
},
data: {
automute: false,
autoplay: true
},
connected() {
this.inView = this.autoplay === "inview";
if (this.inView && !hasAttr(this.$el, "preload")) {
this.$el.preload = "none";
}
if (isTag(this.$el, "iframe") && !hasAttr(this.$el, "allow")) {
this.$el.allow = "autoplay";
}
if (this.automute) {
mute(this.$el);
}
},
observe: [intersection({ args: { intersecting: false } }), resize()],
update: {
read({ visible }) {
if (!isVideo(this.$el)) {
return false;
}
return {
prev: visible,
visible: isVisible(this.$el),
inView: this.inView && isInView(this.$el)
};
},
write({ prev, visible, inView }) {
if (!visible || this.inView && !inView) {
pause(this.$el);
} else if (this.autoplay === true && !prev || inView) {
play(this.$el);
}
},
events: ["resize"]
}
};
var cover = {
mixins: [Video],
props: {
width: Number,
height: Number
},
data: {
automute: true
},
events: {
"load loadedmetadata"() {
this.$emit("resize");
}
},
observe: resize({
target: ({ $el }) => [getPositionedParent($el) || parent($el)]
}),
update: {
read() {
const { ratio, cover } = Dimensions;
const { $el, width, height } = this;
let dim = { width, height };
if (!width || !height) {
const intrinsic = {
width: $el.naturalWidth || $el.videoWidth || $el.clientWidth,
height: $el.naturalHeight || $el.videoHeight || $el.clientHeight
};
if (width) {
dim = ratio(intrinsic, "width", width);
} else if (height) {
dim = ratio(intrinsic, "height", height);
} else {
dim = intrinsic;
}
}
const { offsetHeight: coverHeight, offsetWidth: coverWidth } = getPositionedParent($el) || parent($el);
const coverDim = cover(dim, {
width: coverWidth + (coverWidth % 2 ? 1 : 0),
height: coverHeight + (coverHeight % 2 ? 1 : 0)
});
if (!coverDim.width || !coverDim.height) {
return false;
}
return coverDim;
},
write({ height, width }) {
css(this.$el, { height, width });
},
events: ["resize"]
}
};
function getPositionedParent(el) {
while (el = parent(el)) {
if (css(el, "position") !== "static") {
return el;
}
}
}
var Position = {
props: {
pos: String,
offset: null,
flip: Boolean,
shift: Boolean,
inset: Boolean
},
data: {
pos: `bottom-${isRtl ? "right" : "left"}`,
offset: false,
flip: true,
shift: true,
inset: false
},
connected() {
this.pos = this.$props.pos.split("-").concat("center").slice(0, 2);
[this.dir, this.align] = this.pos;
this.axis = includes(["top", "bottom"], this.dir) ? "y" : "x";
},
methods: {
positionAt(element, target, boundary) {
let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
const placement = [this.flip && "flip", this.shift && "shift"];
const attach = {
element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
target: [this.dir, this.align]
};
if (this.axis === "y") {
for (const prop in attach) {
attach[prop].reverse();
}
offset.reverse();
placement.reverse();
}
const restoreScrollPosition = storeScrollPosition(element);
const elDim = dimensions$1(element);
css(element, { top: -elDim.height, left: -elDim.width });
positionAt(element, target, {
attach,
offset,
boundary,
placement,
viewportOffset: this.getViewportOffset(element)
});
restoreScrollPosition();
},
getPositionOffset(element) {
return toPx(
this.offset === false ? css(element, "--uk-position-offset") : this.offset,
this.axis === "x" ? "width" : "height",
element
) * (includes(["left", "top"], this.dir) ? -1 : 1) * (this.inset ? -1 : 1);
},
getShiftOffset(element) {
return this.align === "center" ? 0 : toPx(
css(element, "--uk-position-shift-offset"),
this.axis === "y" ? "width" : "height",
element
) * (includes(["left", "top"], this.align) ? 1 : -1);
},
getViewportOffset(element) {
return toPx(css(element, "--uk-position-viewport-offset"));
}
}
};
function storeScrollPosition(element) {
const [scrollElement] = scrollParents(element);
const { scrollTop } = scrollElement;
return () => {
if (scrollTop !== scrollElement.scrollTop) {
scrollElement.scrollTop = scrollTop;
}
};
}
var Container = {
props: {
container: Boolean
},
data: {
container: true
},
computed: {
container({ container }) {
return container === true && this.$container || container && $(container);
}
}
};
let prevented;
function preventBackgroundScroll(el) {
const off = on(
el,
"touchmove",
(e) => {
if (e.targetTouches.length !== 1 || matches(e.target, 'input[type="range"')) {
return;
}
let [{ scrollHeight, clientHeight }] = scrollParents(e.target);
if (clientHeight >= scrollHeight && e.cancelable) {
e.preventDefault();
}
},
{ passive: false }
);
if (prevented) {
return off;
}
prevented = true;
const { scrollingElement } = document;
css(scrollingElement, {
overflowY: CSS.supports("overflow", "clip") ? "clip" : "hidden",
touchAction: "none",
paddingRight: width(window) - scrollingElement.clientWidth || ""
});
return () => {
prevented = false;
off();
css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
};
}
let active$1;
var drop = {
mixins: [Container, Position, Togglable],
args: "pos",
props: {
mode: "list",
toggle: Boolean,
boundary: Boolean,
boundaryX: Boolean,
boundaryY: Boolean,
target: Boolean,
targetX: Boolean,
targetY: Boolean,
stretch: Boolean,
delayShow: Number,
delayHide: Number,
autoUpdate: Boolean,
clsDrop: String,
animateOut: Boolean,
bgScroll: Boolean
},
data: {
mode: ["click", "hover"],
toggle: "- *",
boundary: false,
boundaryX: false,
boundaryY: false,
target: false,
targetX: false,
targetY: false,
stretch: false,
delayShow: 0,
delayHide: 800,
autoUpdate: true,
clsDrop: false,
animateOut: false,
bgScroll: true,
animation: ["uk-animation-fade"],
cls: "uk-open",
container: false
},
computed: {
boundary({ boundary, boundaryX, boundaryY }, $el) {
return [
query(boundaryX || boundary, $el) || window,
query(boundaryY || boundary, $el) || window
];
},
target({ target, targetX, targetY }, $el) {
targetX || (targetX = target || this.targetEl);
targetY || (targetY = target || this.targetEl);
return [
targetX === true ? window : query(targetX, $el),
targetY === true ? window : query(targetY, $el)
];
}
},
created() {
this.tracker = new MouseTracker();
},
beforeConnect() {
this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
},
connected() {
addClass(this.$el, "uk-drop", this.clsDrop);
if (this.toggle && !this.targetEl) {
this.targetEl = createToggleComponent(this);
}
this._style = pick(this.$el.style, ["width", "height"]);
},
disconnected() {
if (this.isActive()) {
this.hide(false);
active$1 = null;
}
css(this.$el, this._style);
},
observe: lazyload({
target: ({ toggle, $el }) => query(toggle, $el),
targets: ({ $el }) => $el
}),
events: [
{
name: "click",
delegate() {
return ".uk-drop-close";
},
handler(e) {
e.preventDefault();
this.hide(false);
}
},
{
name: "click",
delegate() {
return 'a[href*="#"]';
},
handler({ defaultPrevented, current }) {
const { hash } = current;
if (!defaultPrevented && hash && isSameSiteAnchor(current) && !within(hash, this.$el)) {
this.hide(false);
}
}
},
{
name: "beforescroll",
handler() {
this.hide(false);
}
},
{
name: "toggle",
self: true,
handler(e, toggle) {
e.preventDefault();
if (this.isToggled()) {
this.hide(false);
} else {
this.show(toggle == null ? void 0 : toggle.$el, false);
}
}
},
{
name: "toggleshow",
self: true,
handler(e, toggle) {
e.preventDefault();
this.show(toggle == null ? void 0 : toggle.$el);
}
},
{
name: "togglehide",
self: true,
handler(e) {
e.preventDefault();
if (!matches(this.$el, ":focus,:hover")) {
this.hide();
}
}
},
{
name: `${pointerEnter} focusin`,
filter() {
return includes(this.mode, "hover");
},
handler(e) {
if (!isTouch(e)) {
this.clearTimers();
}
}
},
{
name: `${pointerLeave} focusout`,
filter() {
return includes(this.mode, "hover");
},
handler(e) {
if (!isTouch(e) && e.relatedTarget) {
this.hide();
}
}
},
{
name: "toggled",
self: true,
handler(e, toggled) {
attr(this.targetEl, "aria-expanded", toggled ? true : null);
if (!toggled) {
return;
}
this.clearTimers();
this.position();
}
},
{
name: "show",
self: true,
handler() {
active$1 = this;
this.tracker.init();
const handlers = [
listenForResize(this),
listenForEscClose$1(this),
listenForBackgroundClose$1(this),
this.autoUpdate && listenForScroll(this),
!this.bgScroll && preventBackgroundScroll(this.$el)
];
once(this.$el, "hide", () => handlers.forEach((handler) => handler && handler()), {
self: true
});
}
},
{
name: "beforehide",
self: true,
handler() {
this.clearTimers();
}
},
{
name: "hide",
handler({ target }) {
if (this.$el !== target) {
active$1 = active$1 === null && within(target, this.$el) && this.isToggled() ? this : active$1;
return;
}
active$1 = this.isActive() ? null : active$1;
this.tracker.cancel();
}
}
],
update: {
write() {
if (this.isToggled() && !hasClass(this.$el, this.clsEnter)) {
this.position();
}
}
},
methods: {
show(target = this.targetEl, delay = true) {
if (this.isToggled() && target && this.targetEl && target !== this.targetEl) {
this.hide(false, false);
}
this.targetEl = target;
this.clearTimers();
if (this.isActive()) {
return;
}
if (active$1) {
if (delay && active$1.isDelaying) {
this.showTimer = setTimeout(() => matches(target, ":hover") && this.show(), 10);
return;
}
let prev;
while (active$1 && prev !== active$1 && !within(this.$el, active$1.$el)) {
prev = active$1;
active$1.hide(false, false);
}
}
if (this.container && parent(this.$el) !== this.container) {
append(this.container, this.$el);
}
this.showTimer = setTimeout(
() => this.toggleElement(this.$el, true),
delay && this.delayShow || 0
);
},
hide(delay = true, animate = true) {
const hide = () => this.toggleElement(this.$el, false, this.animateOut && animate);
this.clearTimers();
this.isDelaying = getPositionedElements(this.$el).some(
(el) => this.tracker.movesTo(el)
);
if (delay && this.isDelaying) {
this.hideTimer = setTimeout(this.hide, 50);
} else if (delay && this.delayHide) {
this.hideTimer = setTimeout(hide, this.delayHide);
} else {
hide();
}
},
clearTimers() {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
this.showTimer = null;
this.hideTimer = null;
this.isDelaying = false;
},
isActive() {
return active$1 === this;
},
position() {
removeClass(this.$el, "uk-drop-stack");
css(this.$el, this._style);
this.$el.hidden = true;
const viewports = this.target.map((target) => getViewport$1(this.$el, target));
const viewportOffset = this.getViewportOffset(this.$el);
const dirs = [
[0, ["x", "width", "left", "right"]],
[1, ["y", "height", "top", "bottom"]]
];
for (const [i, [axis, prop]] of dirs) {
if (this.axis !== axis && includes([axis, true], this.stretch)) {
css(this.$el, {
[prop]: Math.min(
offset(this.boundary[i])[prop],
viewports[i][prop] - 2 * viewportOffset
),
[`overflow-${axis}`]: "auto"
});
}
}
const maxWidth = viewports[0].width - 2 * viewportOffset;
this.$el.hidden = false;
css(this.$el, "maxWidth", "");
if (this.$el.offsetWidth > maxWidth) {
addClass(this.$el, "uk-drop-stack");
}
css(this.$el, "maxWidth", maxWidth);
this.positionAt(this.$el, this.target, this.boundary);
for (const [i, [axis, prop, start, end]] of dirs) {
if (this.axis === axis && includes([axis, true], this.stretch)) {
const positionOffset = Math.abs(this.getPositionOffset(this.$el));
const targetOffset = offset(this.target[i]);
const elOffset = offset(this.$el);
css(this.$el, {
[prop]: (targetOffset[start] > elOffset[start] ? targetOffset[this.inset ? end : start] - Math.max(
offset(this.boundary[i])[start],
viewports[i][start] + viewportOffset
) : Math.min(
offset(this.boundary[i])[end],
viewports[i][end] - viewportOffset
) - targetOffset[this.inset ? start : end]) - positionOffset,
[`overflow-${axis}`]: "auto"
});
this.positionAt(this.$el, this.target, this.boundary);
}
}
}
}
};
function getPositionedElements(el) {
const result = [];
apply(el, (el2) => css(el2, "position") !== "static" && result.push(el2));
return result;
}
function getViewport$1(el, target) {
return offsetViewport(overflowParents(target).find((parent2) => within(el, parent2)));
}
function createToggleComponent(drop) {
const { $el } = drop.$create("toggle", query(drop.toggle, drop.$el), {
target: drop.$el,
mode: drop.mode
});
attr($el, "aria-haspopup", true);
return $el;
}
function listenForResize(drop) {
const update = () => drop.$emit();
const off = on(window, "resize", update);
const observer = observeResize(overflowParents(drop.$el).concat(drop.target), update);
return () => {
observer.disconnect();
off();
};
}
function listenForScroll(drop) {
return on([document, ...overflowParents(drop.$el)], "scroll", () => drop.$emit(), {
passive: true
});
}
function listenForEscClose$1(drop) {
return on(document, "keydown", (e) => {
if (e.keyCode === keyMap.ESC) {
drop.hide(false);
}
});
}
function listenForBackgroundClose$1(drop) {
return on(document, pointerDown$1, ({ target }) => {
if (!within(target, drop.$el)) {
once(
document,
`${pointerUp$1} ${pointerCancel} scroll`,
({ defaultPrevented, type, target: newTarget }) => {
if (!defaultPrevented && type === pointerUp$1 && target === newTarget && !(drop.targetEl && within(target, drop.targetEl))) {
drop.hide(false);
}
},
true
);
}
});
}
var Dropnav = {
mixins: [Class, Container],
props: {
align: String,
clsDrop: String,
boundary: Boolean,
dropbar: Boolean,
dropbarAnchor: Boolean,
duration: Number,
mode: Boolean,
offset: Boolean,
stretch: Boolean,
delayShow: Boolean,
delayHide: Boolean,
target: Boolean,
targetX: Boolean,
targetY: Boolean,
animation: Boolean,
animateOut: Boolean
},
data: {
align: isRtl ? "right" : "left",
clsDrop: "uk-dropdown",
clsDropbar: "uk-dropnav-dropbar",
boundary: true,
dropbar: false,
dropbarAnchor: false,
duration: 200,
container: false,
selNavItem: "> li > a, > ul > li > a"
},
computed: {
dropbarAnchor({ dropbarAnchor }, $el) {
return query(dropbarAnchor, $el) || $el;
},
dropbar({ dropbar }) {
if (!dropbar) {
return null;
}
dropbar = this._dropbar || query(dropbar, this.$el) || $(`+ .${this.clsDropbar}`, this.$el);
return dropbar ? dropbar : this._dropbar = $("
");
},
dropContainer(_, $el) {
return this.container || $el;
},
dropdowns({ clsDrop }, $el) {
var _a;
const dropdowns = $$(`.${clsDrop}`, $el);
if (this.dropContainer !== $el) {
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
const target = (_a = this.getDropdown(el)) == null ? void 0 : _a.targetEl;
if (!includes(dropdowns, el) && target && within(target, this.$el)) {
dropdowns.push(el);
}
}
}
return dropdowns;
},
items({ selNavItem }, $el) {
return $$(selNavItem, $el);
}
},
watch: {
dropbar(dropbar) {
addClass(
dropbar,
"uk-dropbar",
"uk-dropbar-top",
this.clsDropbar,
`uk-${this.$options.name}-dropbar`
);
},
dropdowns(dropdowns) {
this.$create(
"drop",
dropdowns.filter((el) => !this.getDropdown(el)),
{
...this.$props,
flip: false,
shift: true,
pos: `bottom-${this.align}`,
boundary: this.boundary === true ? this.$el : this.boundary
}
);
}
},
disconnected() {
remove$1(this._dropbar);
delete this._dropbar;
},
events: [
{
name: "mouseover focusin",
delegate() {
return this.selNavItem;
},
handler({ current }) {
const active2 = this.getActive();
if (active2 && includes(active2.mode, "hover") && active2.targetEl && !within(active2.targetEl, current) && !active2.isDelaying) {
active2.hide(false);
}
}
},
{
name: "keydown",
self: true,
delegate() {
return this.selNavItem;
},
handler(e) {
var _a;
const { current, keyCode } = e;
const active2 = this.getActive();
if (keyCode === keyMap.DOWN && (active2 == null ? void 0 : active2.targetEl) === current) {
e.preventDefault();
(_a = $(selFocusable, active2.$el)) == null ? void 0 : _a.focus();
}
handleNavItemNavigation(e, this.items, active2);
}
},
{
name: "keydown",
el() {
return this.dropContainer;
},
delegate() {
return `.${this.clsDrop}`;
},
handler(e) {
var _a;
const { current, keyCode } = e;
if (!includes(this.dropdowns, current)) {
return;
}
const active2 = this.getActive();
let next = -1;
if (keyCode === keyMap.HOME) {
next = 0;
} else if (keyCode === keyMap.END) {
next = "last";
} else if (keyCode === keyMap.UP) {
next = "previous";
} else if (keyCode === keyMap.DOWN) {
next = "next";
} else if (keyCode === keyMap.ESC) {
(_a = active2.targetEl) == null ? void 0 : _a.focus();
}
if (~next) {
e.preventDefault();
const elements = $$(selFocusable, current);
elements[getIndex(
next,
elements,
findIndex(elements, (el) => matches(el, ":focus"))
)].focus();
}
handleNavItemNavigation(e, this.items, active2);
}
},
{
name: "mouseleave",
el() {
return this.dropbar;
},
filter() {
return this.dropbar;
},
handler() {
const active2 = this.getActive();
if (active2 && includes(active2.mode, "hover") && !this.dropdowns.some((el) => matches(el, ":hover"))) {
active2.hide();
}
}
},
{
name: "beforeshow",
el() {
return this.dropContainer;
},
filter() {
return this.dropbar;
},
handler({ target }) {
if (!this.isDropbarDrop(target)) {
return;
}
if (this.dropbar.previousElementSibling !== this.dropbarAnchor) {
after(this.dropbarAnchor, this.dropbar);
}
addClass(target, `${this.clsDrop}-dropbar`);
}
},
{
name: "show",
el() {
return this.dropContainer;
},
filter() {
return this.dropbar;
},
handler({ target }) {
if (!this.isDropbarDrop(target)) {
return;
}
const drop = this.getDropdown(target);
const adjustHeight = () => {
const targetOffsets = parents(target, `.${this.clsDrop}`).concat(target).map((el) => offset(el));
const minTop = Math.min(...targetOffsets.map(({ top }) => top));
const maxBottom = Math.max(...targetOffsets.map(({ bottom }) => bottom));
const dropbarOffset = offset(this.dropbar);
css(this.dropbar, "top", this.dropbar.offsetTop - (dropbarOffset.top - minTop));
this.transitionTo(
maxBottom - minTop + toFloat(css(target, "marginBottom")),
target
);
};
this._observer = observeResize([drop.$el, ...drop.target], adjustHeight);
adjustHeight();
}
},
{
name: "beforehide",
el() {
return this.dropContainer;
},
filter() {
return this.dropbar;
},
handler(e) {
const active2 = this.getActive();
if (matches(this.dropbar, ":hover") && active2.$el === e.target && !this.items.some((el) => active2.targetEl !== el && matches(el, ":focus"))) {
e.preventDefault();
}
}
},
{
name: "hide",
el() {
return this.dropContainer;
},
filter() {
return this.dropbar;
},
handler({ target }) {
var _a;
if (!this.isDropbarDrop(target)) {
return;
}
(_a = this._observer) == null ? void 0 : _a.disconnect();
const active2 = this.getActive();
if (!active2 || active2.$el === target) {
this.transitionTo(0);
}
}
}
],
methods: {
getActive() {
var _a;
return includes(this.dropdowns, (_a = active$1) == null ? void 0 : _a.$el) && active$1;
},
async transitionTo(newHeight, el) {
const { dropbar } = this;
const oldHeight = height(dropbar);
el = oldHeight < newHeight && el;
await Transition.cancel([el, dropbar]);
css(el, "clipPath", `polygon(0 0,100% 0,100% ${oldHeight}px,0 ${oldHeight}px)`);
height(dropbar, oldHeight);
await Promise.all([
Transition.start(dropbar, { height: newHeight }, this.duration),
Transition.start(
el,
{
clipPath: `polygon(0 0,100% 0,100% ${newHeight}px,0 ${newHeight}px)`
},
this.duration
).finally(() => css(el, { clipPath: "" }))
]).catch(noop);
},
getDropdown(el) {
return this.$getComponent(el, "drop") || this.$getComponent(el, "dropdown");
},
isDropbarDrop(el) {
return this.getDropdown(el) && hasClass(el, this.clsDrop);
}
}
};
function handleNavItemNavigation(e, toggles, active2) {
var _a, _b, _c;
const { current, keyCode } = e;
let next = -1;
if (keyCode === keyMap.HOME) {
next = 0;
} else if (keyCode === keyMap.END) {
next = "last";
} else if (keyCode === keyMap.LEFT) {
next = "previous";
} else if (keyCode === keyMap.RIGHT) {
next = "next";
} else if (keyCode === keyMap.TAB) {
(_a = active2.targetEl) == null ? void 0 : _a.focus();
(_b = active2.hide) == null ? void 0 : _b.call(active2, false);
}
if (~next) {
e.preventDefault();
(_c = active2.hide) == null ? void 0 : _c.call(active2, false);
toggles[getIndex(next, toggles, toggles.indexOf(active2.targetEl || current))].focus();
}
}
var formCustom = {
mixins: [Class],
args: "target",
props: {
target: Boolean
},
data: {
target: false
},
computed: {
input(_, $el) {
return $(selInput, $el);
},
state() {
return this.input.nextElementSibling;
},
target({ target }, $el) {
return target && (target === true && parent(this.input) === $el && this.input.nextElementSibling || $(target, $el));
}
},
update() {
var _a;
const { target, input } = this;
if (!target) {
return;
}
let option;
const prop = isInput(target) ? "value" : "textContent";
const prev = target[prop];
const value = ((_a = input.files) == null ? void 0 : _a[0]) ? input.files[0].name : matches(input, "select") && (option = $$("option", input).filter((el) => el.selected)[0]) ? option.textContent : input.value;
if (prev !== value) {
target[prop] = value;
}
},
events: [
{
name: "change",
handler() {
this.$emit();
}
},
{
name: "reset",
el() {
return closest(this.$el, "form");
},
handler() {
this.$emit();
}
}
]
};
var Margin = {
props: {
margin: String,
firstColumn: Boolean
},
data: {
margin: "uk-margin-small-top",
firstColumn: "uk-first-column"
},
observe: [
mutation({
options: {
childList: true,
attributes: true,
attributeFilter: ["style"]
}
}),
resize({
target: ({ $el }) => [$el, ...children($el)]
})
],
update: {
read() {
const rows = getRows(this.$el.children);
return {
rows,
columns: getColumns(rows)
};
},
write({ columns, rows }) {
for (const row of rows) {
for (const column of row) {
toggleClass(column, this.margin, rows[0] !== row);
toggleClass(column, this.firstColumn, columns[0].includes(column));
}
}
},
events: ["resize"]
}
};
function getRows(items) {
return sortBy(items, "top", "bottom");
}
function getColumns(rows) {
const columns = [];
for (const row of rows) {
const sorted = sortBy(row, "left", "right");
for (let j = 0; j < sorted.length; j++) {
columns[j] = columns[j] ? columns[j].concat(sorted[j]) : sorted[j];
}
}
return isRtl ? columns.reverse() : columns;
}
function sortBy(items, startProp, endProp) {
const sorted = [[]];
for (const el of items) {
if (!isVisible(el)) {
continue;
}
let dim = getOffset(el);
for (let i = sorted.length - 1; i >= 0; i--) {
const current = sorted[i];
if (!current[0]) {
current.push(el);
break;
}
let startDim;
if (current[0].offsetParent === el.offsetParent) {
startDim = getOffset(current[0]);
} else {
dim = getOffset(el, true);
startDim = getOffset(current[0], true);
}
if (dim[startProp] >= startDim[endProp] - 1 && dim[startProp] !== startDim[startProp]) {
sorted.push([el]);
break;
}
if (dim[endProp] - 1 > startDim[startProp] || dim[startProp] === startDim[startProp]) {
current.push(el);
break;
}
if (i === 0) {
sorted.unshift([el]);
break;
}
}
}
return sorted;
}
function getOffset(element, offset = false) {
let { offsetTop, offsetLeft, offsetHeight, offsetWidth } = element;
if (offset) {
[offsetTop, offsetLeft] = offsetPosition(element);
}
return {
top: offsetTop,
left: offsetLeft,
bottom: offsetTop + offsetHeight,
right: offsetLeft + offsetWidth
};
}
var grid = {
extends: Margin,
mixins: [Class],
name: "grid",
props: {
masonry: Boolean,
parallax: Number
},
data: {
margin: "uk-grid-margin",
clsStack: "uk-grid-stack",
masonry: false,
parallax: 0
},
connected() {
this.masonry && addClass(this.$el, "uk-flex-top uk-flex-wrap-top");
},
observe: scroll$1({ filter: ({ parallax }) => parallax }),
update: [
{
write({ columns }) {
toggleClass(this.$el, this.clsStack, columns.length < 2);
},
events: ["resize"]
},
{
read(data) {
let { columns, rows } = data;
if (!columns.length || !this.masonry && !this.parallax || positionedAbsolute(this.$el)) {
data.translates = false;
return false;
}
let translates = false;
const nodes = children(this.$el);
const columnHeights = columns.map((column) => sumBy(column, "offsetHeight"));
const margin = getMarginTop(nodes, this.margin) * (rows.length - 1);
const elHeight = Math.max(...columnHeights) + margin;
if (this.masonry) {
columns = columns.map((column) => sortBy$1(column, "offsetTop"));
translates = getTranslates(rows, columns);
}
let padding = Math.abs(this.parallax);
if (padding) {
padding = columnHeights.reduce(
(newPadding, hgt, i) => Math.max(
newPadding,
hgt + margin + (i % 2 ? padding : padding / 8) - elHeight
),
0
);
}
return { padding, columns, translates, height: translates ? elHeight : "" };
},
write({ height, padding }) {
css(this.$el, "paddingBottom", padding || "");
height !== false && css(this.$el, "height", height);
},
events: ["resize"]
},
{
read() {
if (this.parallax && positionedAbsolute(this.$el)) {
return false;
}
return {
scrolled: this.parallax ? scrolledOver(this.$el) * Math.abs(this.parallax) : false
};
},
write({ columns, scrolled, translates }) {
if (scrolled === false && !translates) {
return;
}
columns.forEach(
(column, i) => column.forEach(
(el, j) => css(
el,
"transform",
!scrolled && !translates ? "" : `translateY(${(translates && -translates[i][j]) + (scrolled ? i % 2 ? scrolled : scrolled / 8 : 0)}px)`
)
)
);
},
events: ["scroll", "resize"]
}
]
};
function positionedAbsolute(el) {
return children(el).some((el2) => css(el2, "position") === "absolute");
}
function getTranslates(rows, columns) {
const rowHeights = rows.map((row) => Math.max(...row.map((el) => el.offsetHeight)));
return columns.map((elements) => {
let prev = 0;
return elements.map(
(element, row) => prev += row ? rowHeights[row - 1] - elements[row - 1].offsetHeight : 0
);
});
}
function getMarginTop(nodes, cls) {
const [node] = nodes.filter((el) => hasClass(el, cls));
return toFloat(node ? css(node, "marginTop") : css(nodes[0], "paddingLeft"));
}
var heightMatch = {
args: "target",
props: {
target: String,
row: Boolean
},
data: {
target: "> *",
row: true
},
computed: {
elements({ target }, $el) {
return $$(target, $el);
}
},
observe: resize({
target: ({ $el, elements }) => [$el, ...elements]
}),
update: {
read() {
return {
rows: (this.row ? getRows(this.elements) : [this.elements]).map(match$1)
};
},
write({ rows }) {
for (const { heights, elements } of rows) {
elements.forEach((el, i) => css(el, "minHeight", heights[i]));
}
},
events: ["resize"]
}
};
function match$1(elements) {
if (elements.length < 2) {
return { heights: [""], elements };
}
let heights = elements.map(getHeight);
const max = Math.max(...heights);
return {
heights: elements.map((el, i) => heights[i].toFixed(2) === max.toFixed(2) ? "" : max),
elements
};
}
function getHeight(element) {
const style = pick(element.style, ["display", "minHeight"]);
if (!isVisible(element)) {
css(element, "display", "block", "important");
}
css(element, "minHeight", "");
const height = dimensions$1(element).height - boxModelAdjust(element, "height", "content-box");
css(element, style);
return height;
}
var heightViewport = {
props: {
expand: Boolean,
offsetTop: Boolean,
offsetBottom: Boolean,
minHeight: Number
},
data: {
expand: false,
offsetTop: false,
offsetBottom: false,
minHeight: 0
},
// check for offsetTop change
observe: resize({
target: ({ $el }) => [$el, ...scrollParents($el)]
}),
update: {
read({ minHeight: prev }) {
if (!isVisible(this.$el)) {
return false;
}
let minHeight = "";
const box = boxModelAdjust(this.$el, "height", "content-box");
const { body, scrollingElement } = document;
const [scrollElement] = scrollParents(this.$el);
const { height: viewportHeight } = offsetViewport(
scrollElement === body ? scrollingElement : scrollElement
);
if (this.expand) {
minHeight = Math.max(
viewportHeight - (dimensions$1(scrollElement).height - dimensions$1(this.$el).height) - box,
0
);
} else {
const isScrollingElement = scrollingElement === scrollElement || body === scrollElement;
minHeight = `calc(${isScrollingElement ? "100vh" : `${viewportHeight}px`}`;
if (this.offsetTop) {
if (isScrollingElement) {
const top = offsetPosition(this.$el)[0] - offsetPosition(scrollElement)[0];
minHeight += top > 0 && top < viewportHeight / 2 ? ` - ${top}px` : "";
} else {
minHeight += ` - ${css(scrollElement, "paddingTop")}`;
}
}
if (this.offsetBottom === true) {
minHeight += ` - ${dimensions$1(this.$el.nextElementSibling).height}px`;
} else if (isNumeric(this.offsetBottom)) {
minHeight += ` - ${this.offsetBottom}vh`;
} else if (this.offsetBottom && endsWith(this.offsetBottom, "px")) {
minHeight += ` - ${toFloat(this.offsetBottom)}px`;
} else if (isString(this.offsetBottom)) {
minHeight += ` - ${dimensions$1(query(this.offsetBottom, this.$el)).height}px`;
}
minHeight += `${box ? ` - ${box}px` : ""})`;
}
return { minHeight, prev };
},
write({ minHeight }) {
css(this.$el, { minHeight });
if (this.minHeight && toFloat(css(this.$el, "minHeight")) < this.minHeight) {
css(this.$el, "minHeight", this.minHeight);
}
},
events: ["resize"]
}
};
var Svg = {
args: "src",
props: {
width: Number,
height: Number,
ratio: Number
},
data: {
ratio: 1
},
connected() {
this.svg = this.getSvg().then((el) => {
if (!this._connected) {
return;
}
const svg = insertSVG(el, this.$el);
if (this.svgEl && svg !== this.svgEl) {
remove$1(this.svgEl);
}
applyWidthAndHeight.call(this, svg, el);
return this.svgEl = svg;
}, noop);
},
disconnected() {
this.svg.then((svg) => {
if (this._connected) {
return;
}
if (isVoidElement(this.$el)) {
this.$el.hidden = false;
}
remove$1(svg);
this.svgEl = null;
});
this.svg = null;
},
methods: {
async getSvg() {
}
}
};
function insertSVG(el, root) {
if (isVoidElement(root) || isTag(root, "canvas")) {
root.hidden = true;
const next = root.nextElementSibling;
return equals(el, next) ? next : after(root, el);
}
const last = root.lastElementChild;
return equals(el, last) ? last : append(root, el);
}
function equals(el, other) {
return isTag(el, "svg") && isTag(other, "svg") && el.innerHTML === other.innerHTML;
}
function applyWidthAndHeight(el, ref) {
const props = ["width", "height"];
let dimensions = props.map((prop) => this[prop]);
if (!dimensions.some((val) => val)) {
dimensions = props.map((prop) => attr(ref, prop));
}
const viewBox = attr(ref, "viewBox");
if (viewBox && !dimensions.some((val) => val)) {
dimensions = viewBox.split(" ").slice(2);
}
dimensions.forEach((val, i) => attr(el, props[i], toFloat(val) * this.ratio || null));
}
var I18n = {
props: {
i18n: Object
},
data: {
i18n: null
},
methods: {
t(key, ...params) {
var _a, _b, _c;
let i = 0;
return ((_c = ((_a = this.i18n) == null ? void 0 : _a[key]) || ((_b = this.$options.i18n) == null ? void 0 : _b[key])) == null ? void 0 : _c.replace(
/%s/g,
() => params[i++] || ""
)) || "";
}
}
};
var closeIcon = "
";
var closeLarge = "
";
var dropParentIcon = "
";
var marker = "
";
var navParentIcon = "
";
var navParentIconLarge = "
";
var navbarParentIcon = "
";
var navbarToggleIcon = "
";
var overlayIcon = "
";
var paginationNext = "
";
var paginationPrevious = "
";
var searchIcon = "
";
var searchLarge = "
";
var searchNavbar = "
";
var slidenavNext = "
";
var slidenavNextLarge = "
";
var slidenavPrevious = "
";
var slidenavPreviousLarge = "
";
var spinner = "
";
var totop = "
";
const icons = {
spinner,
totop,
marker,
"close-icon": closeIcon,
"close-large": closeLarge,
"drop-parent-icon": dropParentIcon,
"nav-parent-icon": navParentIcon,
"nav-parent-icon-large": navParentIconLarge,
"navbar-parent-icon": navbarParentIcon,
"navbar-toggle-icon": navbarToggleIcon,
"overlay-icon": overlayIcon,
"pagination-next": paginationNext,
"pagination-previous": paginationPrevious,
"search-icon": searchIcon,
"search-large": searchLarge,
"search-navbar": searchNavbar,
"slidenav-next": slidenavNext,
"slidenav-next-large": slidenavNextLarge,
"slidenav-previous": slidenavPrevious,
"slidenav-previous-large": slidenavPreviousLarge
};
const Icon = {
install: install$3,
mixins: [Svg],
args: "icon",
props: { icon: String },
isIcon: true,
beforeConnect() {
addClass(this.$el, "uk-icon");
},
methods: {
async getSvg() {
const icon = getIcon(this.icon);
if (!icon) {
throw "Icon not found.";
}
return icon;
}
}
};
const IconComponent = {
args: false,
extends: Icon,
data: (vm) => ({
icon: hyphenate(vm.constructor.options.name)
}),
beforeConnect() {
addClass(this.$el, this.$options.id);
}
};
const NavParentIcon = {
extends: IconComponent,
beforeConnect() {
const icon = this.$props.icon;
this.icon = closest(this.$el, ".uk-nav-primary") ? `${icon}-large` : icon;
}
};
const Search = {
extends: IconComponent,
mixins: [I18n],
i18n: { toggle: "Open Search", submit: "Submit Search" },
beforeConnect() {
this.icon = hasClass(this.$el, "uk-search-icon") && parents(this.$el, ".uk-search-large").length ? "search-large" : parents(this.$el, ".uk-search-navbar").length ? "search-navbar" : this.$props.icon;
if (hasAttr(this.$el, "aria-label")) {
return;
}
if (hasClass(this.$el, "uk-search-toggle") || hasClass(this.$el, "uk-navbar-toggle")) {
const label = this.t("toggle");
attr(this.$el, "aria-label", label);
} else {
const button = closest(this.$el, "a,button");
if (button) {
const label = this.t("submit");
attr(button, "aria-label", label);
}
}
}
};
const Spinner = {
extends: IconComponent,
beforeConnect() {
attr(this.$el, "role", "status");
},
methods: {
async getSvg() {
const icon = await Icon.methods.getSvg.call(this);
if (this.ratio !== 1) {
css($("circle", icon), "strokeWidth", 1 / this.ratio);
}
return icon;
}
}
};
const ButtonComponent = {
extends: IconComponent,
mixins: [I18n],
beforeConnect() {
const button = closest(this.$el, "a,button");
attr(button, "role", this.role !== null && isTag(button, "a") ? "button" : this.role);
const label = this.t("label");
if (label && !hasAttr(button, "aria-label")) {
attr(button, "aria-label", label);
}
}
};
const Slidenav = {
extends: ButtonComponent,
beforeConnect() {
addClass(this.$el, "uk-slidenav");
const icon = this.$props.icon;
this.icon = hasClass(this.$el, "uk-slidenav-large") ? `${icon}-large` : icon;
}
};
const NavbarToggleIcon = {
extends: ButtonComponent,
i18n: { label: "Open menu" }
};
const Close = {
extends: ButtonComponent,
i18n: { label: "Close" },
beforeConnect() {
this.icon = `close-${hasClass(this.$el, "uk-close-large") ? "large" : "icon"}`;
}
};
const Marker = {
extends: ButtonComponent,
i18n: { label: "Open" }
};
const Totop = {
extends: ButtonComponent,
i18n: { label: "Back to top" }
};
const PaginationNext = {
extends: ButtonComponent,
i18n: { label: "Next page" },
data: { role: null }
};
const PaginationPrevious = {
extends: ButtonComponent,
i18n: { label: "Previous page" },
data: { role: null }
};
const parsed = {};
function install$3(UIkit) {
UIkit.icon.add = (name, svg) => {
const added = isString(name) ? { [name]: svg } : name;
each(added, (svg2, name2) => {
icons[name2] = svg2;
delete parsed[name2];
});
if (UIkit._initialized) {
apply(
document.body,
(el) => each(UIkit.getComponents(el), (cmp) => {
cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
})
);
}
};
}
function getIcon(icon) {
if (!icons[icon]) {
return null;
}
if (!parsed[icon]) {
parsed[icon] = $((icons[applyRtl(icon)] || icons[icon]).trim());
}
return parsed[icon].cloneNode(true);
}
function applyRtl(icon) {
return isRtl ? swap(swap(icon, "left", "right"), "previous", "next") : icon;
}
const nativeLazyLoad = inBrowser && "loading" in HTMLImageElement.prototype;
var img = {
args: "dataSrc",
props: {
dataSrc: String,
sources: String,
margin: String,
target: String,
loading: String
},
data: {
dataSrc: "",
sources: false,
margin: "50%",
target: false,
loading: "lazy"
},
connected() {
if (this.loading !== "lazy") {
this.load();
return;
}
if (nativeLazyLoad && isImg(this.$el)) {
this.$el.loading = "lazy";
setSrcAttrs(this.$el);
}
ensureSrcAttribute(this.$el);
},
disconnected() {
if (this.img) {
this.img.onload = "";
}
delete this.img;
},
observe: intersection({
target: ({ $el, $props }) => [$el, ...queryAll($props.target, $el)],
handler(entries, observer) {
this.load();
observer.disconnect();
},
options: ({ margin }) => ({ rootMargin: margin }),
filter: ({ loading }) => loading === "lazy"
}),
methods: {
load() {
if (this.img) {
return this.img;
}
const image = isImg(this.$el) ? this.$el : getImageFromElement(this.$el, this.dataSrc, this.sources);
removeAttr(image, "loading");
setSrcAttrs(this.$el, image.currentSrc);
return this.img = image;
}
}
};
function setSrcAttrs(el, src) {
if (isImg(el)) {
const parentNode = parent(el);
const elements = isTag(parentNode, "picture") ? children(parentNode) : [el];
elements.forEach((el2) => setSourceProps(el2, el2));
} else if (src) {
const change = !includes(el.style.backgroundImage, src);
if (change) {
css(el, "backgroundImage", `url(${escape(src)})`);
trigger(el, createEvent("load", false));
}
}
}
const srcProps = ["data-src", "data-srcset", "sizes"];
function setSourceProps(sourceEl, targetEl) {
for (const prop of srcProps) {
const value = data(sourceEl, prop);
if (value) {
attr(targetEl, prop.replace(/^(data-)+/, ""), value);
}
}
}
function getImageFromElement(el, src, sources) {
const img = new Image();
wrapInPicture(img, sources);
setSourceProps(el, img);
img.onload = () => {
setSrcAttrs(el, img.currentSrc);
};
attr(img, "src", src);
return img;
}
function wrapInPicture(img, sources) {
sources = parseSources(sources);
if (sources.length) {
const picture = fragment("