var __defProp = Object.defineProperty; var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); var __export = (target, all) => { for (var name in all) __defProp(target, name, {get: all[name], enumerable: true}); }; __markAsModule(exports); __export(exports, { CUSTOM_TYPES: () => CUSTOM_TYPES, Comment: () => Comment, CustomEvent: () => CustomEvent2, Document: () => Document, DocumentFragment: () => DocumentFragment, Easer: () => Easer, Element: () => Element, ElementRoute: () => ElementRoute, ElementRouteTo: () => ElementRouteTo, Event: () => Event, EventHandler: () => EventHandler, Fragment: () => Fragment, HTMLButtonElement: () => HTMLButtonElement, HTMLElement: () => HTMLElement, HTMLHtmlElement: () => HTMLHtmlElement, HTMLInputElement: () => HTMLInputElement, HTMLOptionElement: () => HTMLOptionElement, HTMLScriptElement: () => HTMLScriptElement, HTMLSelectElement: () => HTMLSelectElement, HTMLTextAreaElement: () => HTMLTextAreaElement, ImbaElement: () => ImbaElement, IntersectionEventDefaults: () => IntersectionEventDefaults, KeyboardEvent: () => KeyboardEvent, LazyProxy: () => LazyProxy, MouseEvent: () => MouseEvent, Node: () => Node2, PointerEvent: () => PointerEvent, Router: () => Router, SVGElement: () => SVGElement, Scheduler: () => Scheduler, ShadowRoot: () => ShadowRoot, TYPES: () => TYPES, Text: () => Text, UIEvent: () => UIEvent, Window: () => Window, asset: () => asset, clearInterval: () => clearInterval, clearTimeout: () => clearTimeout, colors: () => colors, commit: () => commit, createComment: () => createComment, createComponent: () => createComponent, createElement: () => createElement, createFragment: () => createFragment, createIndexedList: () => createIndexedList, createKeyedList: () => createKeyedList, createLiveFragment: () => createLiveFragment, createSVGElement: () => createSVGElement, createSlot: () => createSlot, createTextNode: () => createTextNode, customElements: () => customElements, defineTag: () => defineTag, deserializeData: () => deserializeData, emit: () => emit, events: () => events, getDeepPropertyDescriptor: () => getDeepPropertyDescriptor, getSuperTagType: () => getSuperTagType, getTagType: () => getTagType, get_document: () => get_document, hydrate: () => hydrate, listen: () => listen, manifest: () => manifest, mount: () => mount, once: () => once, parseTime: () => parseTime, patchManifest: () => patchManifest, process: () => process, proxy: () => proxy, render: () => render, renderContext: () => renderContext, router: () => router, scheduler: () => scheduler, serializeData: () => serializeData, setInterval: () => setInterval, setTimeout: () => setTimeout2, styles: () => styles, toCamelCase: () => toCamelCase, transitions: () => transitions, unlisten: () => unlisten, unmount: () => unmount, use_dom_bind: () => use_dom_bind, use_dom_teleport: () => use_dom_teleport, use_dom_transitions: () => use_dom_transitions, use_events: () => use_events, use_events_intersect: () => use_events_intersect, use_events_pointer: () => use_events_pointer, use_events_resize: () => use_events_resize, use_events_selection: () => use_events_selection, use_router: () => use_router, use_styles: () => use_styles, use_window: () => use_window }); var __create = Object.create; var __defProp2 = Object.defineProperty; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __markAsModule2 = (target) => __defProp2(target, "__esModule", {value: true}); var __commonJS = (callback2, module2) => () => { if (!module2) { module2 = {exports: {}}; callback2(module2.exports, module2); } return module2.exports; }; var __exportStar = (target, module2, desc) => { if (module2 && typeof module2 === "object" || typeof module2 === "function") { for (let key of __getOwnPropNames(module2)) if (!__hasOwnProp.call(target, key) && key !== "default") __defProp2(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable}); } return target; }; var __toModule = (module2) => { return __exportStar(__markAsModule2(__defProp2(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2); }; var require_events = __commonJS((exports2, module2) => { "use strict"; var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); }; var ReflectOwnKeys; if (R && typeof R.ownKeys === "function") { ReflectOwnKeys = R.ownKeys; } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target); }; } function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { return value !== value; }; function EventEmitter2() { EventEmitter2.init.call(this); } module2.exports = EventEmitter2; module2.exports.once = once2; EventEmitter2.EventEmitter = EventEmitter2; EventEmitter2.prototype._events = void 0; EventEmitter2.prototype._eventsCount = 0; EventEmitter2.prototype._maxListeners = void 0; var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== "function") { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } } Object.defineProperty(EventEmitter2, "defaultMaxListeners", { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); } defaultMaxListeners = arg; } }); EventEmitter2.init = function() { if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { this._events = Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || void 0; }; EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); } this._maxListeners = n; return this; }; function _getMaxListeners(that) { if (that._maxListeners === void 0) return EventEmitter2.defaultMaxListeners; return that._maxListeners; } EventEmitter2.prototype.getMaxListeners = function getMaxListeners() { return _getMaxListeners(this); }; EventEmitter2.prototype.emit = function emit2(type) { var args = []; for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = type === "error"; var events2 = this._events; if (events2 !== void 0) doError = doError && events2.error === void 0; else if (!doError) return false; if (doError) { var er; if (args.length > 0) er = args[0]; if (er instanceof Error) { throw er; } var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); err.context = er; throw err; } var handler = events2[type]; if (handler === void 0) return false; if (typeof handler === "function") { ReflectApply(handler, this, args); } else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events2; var existing; checkListener(listener); events2 = target._events; if (events2 === void 0) { events2 = target._events = Object.create(null); target._eventsCount = 0; } else { if (events2.newListener !== void 0) { target.emit("newListener", type, listener.listener ? listener.listener : listener); events2 = target._events; } existing = events2[type]; } if (existing === void 0) { existing = events2[type] = listener; ++target._eventsCount; } else { if (typeof existing === "function") { existing = events2[type] = prepend ? [listener, existing] : [existing, listener]; } else if (prepend) { existing.unshift(listener); } else { existing.push(listener); } m = _getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); w.name = "MaxListenersExceededWarning"; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter2.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter2.prototype.on = EventEmitter2.prototype.addListener; EventEmitter2.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; if (arguments.length === 0) return this.listener.call(this.target); return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = {fired: false, wrapFn: void 0, target, type, listener}; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter2.prototype.once = function once3(type, listener) { checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; EventEmitter2.prototype.removeListener = function removeListener(type, listener) { var list, events2, position, i, originalListener; checkListener(listener); events2 = this._events; if (events2 === void 0) return this; list = events2[type]; if (list === void 0) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = Object.create(null); else { delete events2[type]; if (events2.removeListener) this.emit("removeListener", type, list.listener || listener); } } else if (typeof list !== "function") { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else { spliceOne(list, position); } if (list.length === 1) events2[type] = list[0]; if (events2.removeListener !== void 0) this.emit("removeListener", type, originalListener || listener); } return this; }; EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener; EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events2, i; events2 = this._events; if (events2 === void 0) return this; if (events2.removeListener === void 0) { if (arguments.length === 0) { this._events = Object.create(null); this._eventsCount = 0; } else if (events2[type] !== void 0) { if (--this._eventsCount === 0) this._events = Object.create(null); else delete events2[type]; } return this; } if (arguments.length === 0) { var keys = Object.keys(events2); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === "removeListener") continue; this.removeAllListeners(key); } this.removeAllListeners("removeListener"); this._events = Object.create(null); this._eventsCount = 0; return this; } listeners = events2[type]; if (typeof listeners === "function") { this.removeListener(type, listeners); } else if (listeners !== void 0) { for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events2 = target._events; if (events2 === void 0) return []; var evlistener = events2[type]; if (evlistener === void 0) return []; if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter2.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter2.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter2.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === "function") { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter2.prototype.listenerCount = listenerCount; function listenerCount(type) { var events2 = this._events; if (events2 !== void 0) { var evlistener = events2[type]; if (typeof evlistener === "function") { return 1; } else if (evlistener !== void 0) { return evlistener.length; } } return 0; } EventEmitter2.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function once2(emitter, name) { return new Promise(function(resolve, reject) { function eventListener() { if (errorListener !== void 0) { emitter.removeListener("error", errorListener); } resolve([].slice.call(arguments)); } ; var errorListener; if (name !== "error") { errorListener = function errorListener2(err) { emitter.removeListener(name, eventListener); reject(err); }; emitter.once("error", errorListener); } emitter.once(name, eventListener); }); } }); function iter$__(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C61 = Symbol.for("#type"); var \u03C620 = Symbol.for("#__listeners__"); var dashRegex = /-./g; var LazyProxy = class { static for(getter) { return new Proxy({}, new this(getter)); } constructor(getter) { this.getter = getter; } get target() { return this.getter(); } get(_, key) { return this.target[key]; } set(_, key, value) { this.target[key] = value; return true; } }; function proxy(getter, placeholder = {}) { return new Proxy(placeholder, new LazyProxy(getter)); } function parseTime(value) { let typ = typeof value; if (typ == "number") { return value; } ; if (typ == "string") { if (/^\d+fps$/.test(value)) { return 1e3 / parseFloat(value); } else if (/^([-+]?[\d\.]+)s$/.test(value)) { return parseFloat(value) * 1e3; } else if (/^([-+]?[\d\.]+)ms$/.test(value)) { return parseFloat(value); } ; } ; return null; } function serializeData(data) { let map = new Map(); let arr = []; let logging = false; let replacer = function(key, value) { if (value && value[\u03C61] && key !== "") { let ref = map.get(value); if (!map.has(value)) { map.set(value, ref = "$$" + arr.length + "$$"); arr.push(value); } ; return key == null ? value : ref; } ; return value; }; let json = JSON.stringify(data, replacer, 2); let i = 0; logging = true; while (i < arr.length) { arr[i] = JSON.stringify(arr[i], replacer, 2); i++; } ; let inject = ""; for (let i2 = 0, \u03C6220 = iter$__(arr), \u03C6312 = \u03C6220.length; i2 < \u03C6312; i2++) { let item = \u03C6220[i2]; inject += '"$$' + i2 + '$$":' + item + ",\n"; } ; json = "{" + inject + json.slice(1); return json; } function deserializeData(data, reviver = null) { let objects = {}; let reg = /\$\$\d+\$\$/; let lookup = function(value) { return objects[value] || (objects[value] = reviver ? reviver(value) : {}); }; let parser = function(key, value) { if (typeof value == "string") { if (value[0] == "$" && reg.test(value)) { return lookup(value); } ; } else if (typeof key == "string" && key[0] == "$" && reg.test(key)) { let obj = lookup(key); Object.assign(obj, value); return obj; } ; return value; }; let parsed = JSON.parse(data, parser); return parsed; } function patchManifest(prev, curr) { var \u03C679, \u03C669, \u03C61111, \u03C6185; let origs = {}; let diff = { added: [], changed: [], removed: [], all: [], urls: {} }; if (prev.assets) { for (let \u03C6410 = 0, \u03C659 = iter$__(prev.assets), \u03C6810 = \u03C659.length; \u03C6410 < \u03C6810; \u03C6410++) { let item = \u03C659[\u03C6410]; let ref = item.originalPath || item.path; origs[ref] = item; if (item.url) { (\u03C679 = curr.urls)[\u03C669 = item.url] || (\u03C679[\u03C669] = item); } ; } ; } ; for (let \u03C699 = 0, \u03C6105 = iter$__(curr.assets || []), \u03C6127 = \u03C6105.length; \u03C699 < \u03C6127; \u03C699++) { let item = \u03C6105[\u03C699]; let ref = item.originalPath || item.path; let orig = origs[ref]; if (item.url && prev.urls) { prev.urls[item.url] = item; } ; if (orig) { if (orig.hash != item.hash) { orig.invalidated = Date.now(); orig.replacedBy = item; item.replaces = orig; diff.changed.push(item); diff.all.push(item); if (orig == prev.main) { diff.main = item; } ; } ; \u03C61111 = origs[ref], delete origs[ref], \u03C61111; } else { diff.added.push(item); diff.all.push(item); } ; } ; for (let \u03C6135 = 0, \u03C6144 = Object.keys(origs), \u03C6152 = \u03C6144.length, path, item; \u03C6135 < \u03C6152; \u03C6135++) { path = \u03C6144[\u03C6135]; item = origs[path]; item.removed = Date.now(); diff.all.push(item); } ; for (let \u03C6165 = 0, \u03C6176 = iter$__(diff.all), \u03C6193 = \u03C6176.length; \u03C6165 < \u03C6193; \u03C6165++) { let item = \u03C6176[\u03C6165]; let typ = diff[\u03C6185 = item.type] || (diff[\u03C6185] = []); typ.push(item); } ; diff.removed = Object.values(origs); curr.changes = diff; return curr; } function toCamelCase(str) { if (str.indexOf("-") >= 0) { return str.replace(dashRegex, function(_0) { return _0.charAt(1).toUpperCase(); }); } else { return str; } ; } function getDeepPropertyDescriptor(item, key, stop) { if (!item) { return void 0; } ; let desc = Object.getOwnPropertyDescriptor(item, key); if (desc || item == stop) { return desc || void 0; } ; return getDeepPropertyDescriptor(Reflect.getPrototypeOf(item), key, stop); } var emit__ = function(event, args, node) { let prev; let cb; let ret; while ((prev = node) && (node = node.next)) { if (cb = node.listener) { if (node.path && cb[node.path]) { ret = args ? cb[node.path].apply(cb, args) : cb[node.path](); } else { ret = args ? cb.apply(node, args) : cb.call(node); } ; } ; if (node.times && --node.times <= 0) { prev.next = node.next; node.listener = null; } ; } ; return; }; function listen(obj, event, listener, path) { var \u03C62110; let cbs; let list; let tail; cbs = obj[\u03C620] || (obj[\u03C620] = {}); list = cbs[event] || (cbs[event] = {}); tail = list.tail || (list.tail = list.next = {}); tail.listener = listener; tail.path = path; list.tail = tail.next = {}; return tail; } function once(obj, event, listener) { let tail = listen(obj, event, listener); tail.times = 1; return tail; } function unlisten(obj, event, cb, meth) { let node; let prev; let meta = obj[\u03C620]; if (!meta) { return; } ; if (node = meta[event]) { while ((prev = node) && (node = node.next)) { if (node == cb || node.listener == cb) { prev.next = node.next; node.listener = null; break; } ; } ; } ; return; } function emit(obj, event, params) { let cb; if (cb = obj[\u03C620]) { if (cb[event]) { emit__(event, params, cb[event]); } ; if (cb.all) { emit__(event, [event, params], cb.all); } ; } ; return; } function iter$__2(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C612 = Symbol.for("#init"); var \u03C62 = Symbol.for("#schedule"); var \u03C64 = Symbol.for("#frames"); var \u03C65 = Symbol.for("#interval"); var \u03C66 = Symbol.for("#stage"); var \u03C67 = Symbol.for("#scheduled"); var \u03C68 = Symbol.for("#fps"); var \u03C69 = Symbol.for("#ticker"); var rAF = globalThis.requestAnimationFrame || function(blk) { return setTimeout1(blk, 1e3 / 60); }; var SPF = 1 / 60; var Scheduled = class { constructor($$ = null) { this[\u03C612]($$); } [\u03C612]($$ = null) { var \u03C6312; this.owner = $$ && (\u03C6312 = $$.owner) !== void 0 ? \u03C6312 : null; this.target = $$ && (\u03C6312 = $$.target) !== void 0 ? \u03C6312 : null; this.active = $$ && (\u03C6312 = $$.active) !== void 0 ? \u03C6312 : false; this.value = $$ && (\u03C6312 = $$.value) !== void 0 ? \u03C6312 : void 0; this.skip = $$ && (\u03C6312 = $$.skip) !== void 0 ? \u03C6312 : 0; this.last = $$ && (\u03C6312 = $$.last) !== void 0 ? \u03C6312 : 0; } tick(scheduler2, source) { this.last = this.owner[\u03C64]; this.target.tick(this, source); return 1; } update(o, activate\u03A6) { let on = this.active; let val = o.value; let changed = this.value != val; if (changed) { this.deactivate(); this.value = val; } ; if (this.value || on || activate\u03A6) { this.activate(); } ; return this; } queue() { this.owner.add(this); return; } activate() { if (this.value === true) { this.owner.on("commit", this); } else if (this.value === false) { true; } else if (typeof this.value == "number") { let tock = this.value / (1e3 / 60); if (tock <= 2) { this.owner.on("raf", this); } else { this[\u03C65] = globalThis.setInterval(this.queue.bind(this), this.value); } ; } ; this.active = true; return this; } deactivate() { if (this.value === true) { this.owner.un("commit", this); } ; this.owner.un("raf", this); if (this[\u03C65]) { globalThis.clearInterval(this[\u03C65]); this[\u03C65] = null; } ; this.active = false; return this; } }; var Scheduler = class { constructor() { var self = this; this.id = Symbol(); this.queue = []; this.stage = -1; this[\u03C66] = -1; this[\u03C64] = 0; this[\u03C67] = false; this.listeners = {}; this.intervals = {}; this.commit = function() { self.add("commit"); return self; }; this[\u03C68] = 0; this.$promise = null; this.$resolve = null; this[\u03C69] = function(e) { self[\u03C67] = false; return self.tick(e); }; this; } add(item, force) { if (force || this.queue.indexOf(item) == -1) { this.queue.push(item); } ; if (!this[\u03C67]) { this[\u03C62](); } ; return this; } listen(ns, item) { let set = this.listeners[ns]; let first = !set; set || (set = this.listeners[ns] = new Set()); set.add(item); if (ns == "raf" && first) { this.add("raf"); } ; return this; } unlisten(ns, item) { var \u03C6105; let set = this.listeners[ns]; set && set.delete(item); if (ns == "raf" && set && set.size == 0) { \u03C6105 = this.listeners.raf, delete this.listeners.raf, \u03C6105; } ; return this; } on(ns, item) { return this.listen(ns, item); } un(ns, item) { return this.unlisten(ns, item); } get promise() { var self = this; return this.$promise || (this.$promise = new Promise(function(resolve) { return self.$resolve = resolve; })); } tick(timestamp) { var self = this; let items = this.queue; let frame = this[\u03C64]++; if (!this.ts) { this.ts = timestamp; } ; this.dt = timestamp - this.ts; this.ts = timestamp; this.queue = []; this[\u03C66] = 1; if (items.length) { for (let i = 0, \u03C61111 = iter$__2(items), \u03C6127 = \u03C61111.length; i < \u03C6127; i++) { let item = \u03C61111[i]; if (typeof item === "string" && this.listeners[item]) { this.listeners[item].forEach(function(listener) { if (listener.tick instanceof Function) { return listener.tick(self, item); } else if (listener instanceof Function) { return listener(self, item); } ; }); } else if (item instanceof Function) { item(this.dt, this); } else if (item.tick) { item.tick(this.dt, this); } ; } ; } ; this[\u03C66] = this[\u03C67] ? 0 : -1; if (this.$promise) { this.$resolve(this); this.$promise = this.$resolve = null; } ; if (this.listeners.raf && true) { this.add("raf"); } ; return this; } [\u03C62]() { if (!this[\u03C67]) { this[\u03C67] = true; if (this[\u03C66] == -1) { this[\u03C66] = 0; } ; rAF(this[\u03C69]); } ; return this; } schedule(item, o) { var \u03C6135, \u03C6144; o || (o = item[\u03C6135 = this.id] || (item[\u03C6135] = {value: true})); let state = o[\u03C6144 = this.id] || (o[\u03C6144] = new Scheduled({owner: this, target: item})); return state.update(o, true); } unschedule(item, o = {}) { o || (o = item[this.id]); let state = o && o[this.id]; if (state && state.active) { state.deactivate(); } ; return this; } }; var scheduler = new Scheduler(); function commit() { return scheduler.add("commit").promise; } function setTimeout2(fn, ms) { return globalThis.setTimeout(function() { fn(); commit(); return; }, ms); } function setInterval(fn, ms) { return globalThis.setInterval(function() { fn(); commit(); return; }, ms); } var clearInterval = globalThis.clearInterval; var clearTimeout = globalThis.clearTimeout; var instance = globalThis.imba || (globalThis.imba = {}); instance.commit = commit; instance.setTimeout = setTimeout2; instance.setInterval = setInterval; instance.clearInterval = clearInterval; instance.clearTimeout = clearTimeout; var Manifest = class { constructor() { this.data = {}; } }; var manifest = new Manifest(); var process = {}; var \u03C613 = Symbol.for("#init"); var \u03C622 = Symbol.for("#warned"); var \u03C672 = Symbol.for("#asset"); var AssetProxy = class { static wrap(meta) { let handler = new AssetProxy(meta); return new Proxy(handler, handler); } constructor(meta) { this.meta = meta; } get input() { return manifest.inputs[this.meta.input]; } get asset() { return globalThis._MF_ ? this.meta : this.input ? this.input.asset : null; } set(target, key, value) { return true; } get(target, key) { if (this.meta.meta && this.meta.meta[key] != void 0) { return this.meta.meta[key]; } ; if (!this.asset) { if (this.meta[\u03C622] != true ? (this.meta[\u03C622] = true, true) : false) { console.warn("Asset for '" + this.meta.input + "' not found"); } ; if (key == "valueOf") { return function() { return ""; }; } ; return null; } ; if (key == "absPath" && !this.asset.absPath) { return this.asset.url; } ; return this.asset[key]; } }; var SVGAsset = class { constructor($$ = null) { this[\u03C613]($$); } [\u03C613]($$ = null) { this.url = $$ ? $$.url : void 0; this.meta = $$ ? $$.meta : void 0; } adoptNode(node) { var _a; if ((_a = this.meta) == null ? void 0 : _a.content) { for (let \u03C659 = this.meta.attributes, \u03C6312 = 0, \u03C6410 = Object.keys(\u03C659), \u03C669 = \u03C6410.length, k, v; \u03C6312 < \u03C669; \u03C6312++) { k = \u03C6410[\u03C6312]; v = \u03C659[k]; node.setAttribute(k, v); } ; node.innerHTML = this.meta.content; } ; return this; } toString() { return this.url; } toStyleString() { return "url(" + this.url + ")"; } }; function asset(data) { var \u03C6810, \u03C699; if (data[\u03C672]) { return data[\u03C672]; } ; if (data.type == "svg") { return data[\u03C672] || (data[\u03C672] = new SVGAsset(data)); } ; if (data.input) { let extra = globalThis._MF_ && globalThis._MF_[data.input]; if (extra) { Object.assign(data, extra); data.toString = function() { return this.absPath; }; } ; return data[\u03C672] || (data[\u03C672] = AssetProxy.wrap(data)); } ; return data; } var Flags = class { constructor(dom) { this.dom = dom; this.string = ""; } contains(ref) { return this.dom.classList.contains(ref); } add(ref) { if (this.contains(ref)) { return this; } ; this.string += (this.string ? " " : "") + ref; this.dom.classList.add(ref); return this; } remove(ref) { if (!this.contains(ref)) { return this; } ; let regex = new RegExp("(^|\\s)*" + ref + "(\\s|$)*", "g"); this.string = this.string.replace(regex, ""); this.dom.classList.remove(ref); return this; } toggle(ref, bool) { if (bool === void 0) { bool = !this.contains(ref); } ; return bool ? this.add(ref) : this.remove(ref); } incr(ref) { let m = this.stacks || (this.stacks = {}); let c = m[ref] || 0; if (c < 1) { this.add(ref); } ; return m[ref] = Math.max(c, 0) + 1; } decr(ref) { let m = this.stacks || (this.stacks = {}); let c = m[ref] || 0; if (c == 1) { this.remove(ref); } ; return m[ref] = Math.max(c, 1) - 1; } valueOf() { return this.string; } toString() { return this.string; } sync() { return this.dom.flagSync$(); } }; function extend$__(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function iter$__3(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C614 = Symbol.for("#parent"); var \u03C623 = Symbol.for("#context"); var \u03C63 = Symbol.for("#__init__"); var \u03C642 = Symbol.for("#insertChild"); var \u03C652 = Symbol.for("#appendChild"); var \u03C662 = Symbol.for("#replaceChild"); var \u03C673 = Symbol.for("#removeChild"); var \u03C682 = Symbol.for("#insertInto"); var \u03C692 = Symbol.for("#insertIntoDeopt"); var \u03C610 = Symbol.for("#removeFrom"); var \u03C611 = Symbol.for("#removeFromDeopt"); var \u03C6122 = Symbol.for("#replaceWith"); var \u03C6132 = Symbol.for("#replaceWithDeopt"); var \u03C6142 = Symbol.for("#placeholderNode"); var \u03C615 = Symbol.for("#attachToParent"); var \u03C616 = Symbol.for("#detachFromParent"); var \u03C617 = Symbol.for("#placeChild"); var \u03C618 = Symbol.for("#beforeReconcile"); var \u03C619 = Symbol.for("#afterReconcile"); var \u03C6202 = Symbol.for("#afterVisit"); var \u03C621 = Symbol.for("##parent"); var \u03C6222 = Symbol.for("##up"); var \u03C6232 = Symbol.for("##context"); var \u03C624 = Symbol.for("#domNode"); var \u03C625 = Symbol.for("##placeholderNode"); var \u03C626 = Symbol.for("#domDeopt"); var \u03C628 = Symbol.for("#src"); var \u03C636 = Symbol.for("#htmlNodeName"); var \u03C637 = Symbol.for("#ImbaElement"); var { Event, UIEvent, MouseEvent, PointerEvent, KeyboardEvent, CustomEvent: CustomEvent2, Node: Node2, Comment, Text, Element, HTMLElement, HTMLHtmlElement, HTMLSelectElement, HTMLInputElement, HTMLTextAreaElement, HTMLButtonElement, HTMLOptionElement, HTMLScriptElement, SVGElement, DocumentFragment, ShadowRoot, Document, Window, customElements } = globalThis.window; var descriptorCache = {}; function getDescriptor(item, key, cache) { if (!item) { return cache[key] = null; } ; if (cache[key] !== void 0) { return cache[key]; } ; let desc = Object.getOwnPropertyDescriptor(item, key); if (desc !== void 0 || item == SVGElement) { return cache[key] = desc || null; } ; return getDescriptor(Reflect.getPrototypeOf(item), key, cache); } var CustomTagConstructors = {}; var CustomTagToElementNames = {}; var TYPES = {}; var CUSTOM_TYPES = {}; function get_document() { return globalThis.document; } function use_window() { return true; } var contextHandler = { get(target, name) { let ctx = target; let val = void 0; while (ctx && val == void 0) { if (ctx = ctx[\u03C614]) { val = ctx[name]; } ; } ; return val; }, set(target, name, value) { let ctx = target; let val = void 0; while (ctx && val == void 0) { let desc = getDeepPropertyDescriptor(ctx, name, Element); if (desc) { ctx[name] = value; return true; } else { ctx = ctx[\u03C614]; } ; } ; return true; } }; var Extend$Document$af = class { get flags() { return this.documentElement.flags; } }; extend$__(Document.prototype, Extend$Document$af.prototype); var Extend$Node$ag = class { get [\u03C614]() { return this[\u03C621] || this.parentNode || this[\u03C6222]; } get [\u03C623]() { return this[\u03C6232] || (this[\u03C6232] = new Proxy(this, contextHandler)); } [\u03C63]() { return this; } [\u03C642](newnode, refnode) { return newnode[\u03C682](this, refnode); } [\u03C652](newnode) { return newnode[\u03C682](this, null); } [\u03C662](newnode, oldnode) { let res = this[\u03C642](newnode, oldnode); this[\u03C673](oldnode); return res; } [\u03C673](node) { return node[\u03C610](this); } [\u03C682](parent, before = null) { if (before) { parent.insertBefore(this, before); } else { parent.appendChild(this); } ; return this; } [\u03C692](parent, before) { if (before) { parent.insertBefore(this[\u03C624] || this, before); } else { parent.appendChild(this[\u03C624] || this); } ; return this; } [\u03C610](parent) { return parent.removeChild(this); } [\u03C611](parent) { return parent.removeChild(this[\u03C624] || this); } [\u03C6122](other, parent) { return parent[\u03C662](other, this); } [\u03C6132](other, parent) { return parent[\u03C662](other, this[\u03C624] || this); } get [\u03C6142]() { return this[\u03C625] || (this[\u03C625] = globalThis.document.createComment("placeholder")); } set [\u03C6142](value) { let prev = this[\u03C625]; this[\u03C625] = value; if (prev && prev != value && prev.parentNode) { prev[\u03C6122](value); } ; } [\u03C615]() { let ph = this[\u03C624]; let par = ph && ph.parentNode; if (ph && par && ph != this) { this[\u03C624] = null; this[\u03C682](par, ph); ph[\u03C610](par); } ; return this; } [\u03C616]() { if (this[\u03C626] != true ? (this[\u03C626] = true, true) : false) { this[\u03C6122] = this[\u03C6132]; this[\u03C610] = this[\u03C611]; this[\u03C682] = this[\u03C692]; } ; let ph = this[\u03C6142]; if (this.parentNode && ph != this) { ph[\u03C682](this.parentNode, this); this[\u03C610](this.parentNode); } ; this[\u03C624] = ph; return this; } [\u03C617](item, f, prev) { let type = typeof item; if (type === "undefined" || item === null) { if (prev && prev instanceof Comment) { return prev; } ; let el = globalThis.document.createComment(""); return prev ? prev[\u03C6122](el, this) : el[\u03C682](this, null); } ; if (item === prev) { return item; } else if (type !== "object") { let res; let txt = item; if (f & 128 && f & 256 && false) { this.textContent = txt; return; } ; if (prev) { if (prev instanceof Text) { prev.textContent = txt; return prev; } else { res = globalThis.document.createTextNode(txt); prev[\u03C6122](res, this); return res; } ; } else { this.appendChild(res = globalThis.document.createTextNode(txt)); return res; } ; } else { return prev ? prev[\u03C6122](item, this) : item[\u03C682](this, null); } ; return; } }; extend$__(Node2.prototype, Extend$Node$ag.prototype); var Extend$Element$ah = class { log(...params) { console.log(...params); return this; } emit(name, detail, o = {bubbles: true, cancelable: true}) { if (detail != void 0) { o.detail = detail; } ; let event = new CustomEvent2(name, o); let res = this.dispatchEvent(event); return event; } slot$(name, ctx) { return this; } text$(item) { this.textContent = item; return this; } [\u03C618]() { return this; } [\u03C619]() { return this; } [\u03C6202]() { if (this.render) { this.render(); } ; return; } get flags() { if (!this.$flags) { this.$flags = new Flags(this); if (this.flag$ == Element.prototype.flag$) { this.flags$ext = this.className; } ; this.flagDeopt$(); } ; return this.$flags; } flag$(str) { let ns = this.flags$ns; this.className = ns ? ns + (this.flags$ext = str) : this.flags$ext = str; return; } flagDeopt$() { var self = this; this.flag$ = this.flagExt$; this.flagSelf$ = function(str) { return self.flagSync$(self.flags$own = str); }; return; } flagExt$(str) { return this.flagSync$(this.flags$ext = str); } flagSelf$(str) { this.flagDeopt$(); return this.flagSelf$(str); } flagSync$() { return this.className = (this.flags$ns || "") + (this.flags$ext || "") + " " + (this.flags$own || "") + " " + (this.$flags || ""); } set$(key, value) { let desc = getDeepPropertyDescriptor(this, key, Element); if (!desc || !desc.set) { this.setAttribute(key, value); } else { this[key] = value; } ; return; } get richValue() { return this.value; } set richValue(value) { this.value = value; } }; extend$__(Element.prototype, Extend$Element$ah.prototype); Element.prototype.setns$ = Element.prototype.setAttributeNS; function createElement(name, parent, flags, text) { let el = globalThis.document.createElement(name); if (flags) { el.className = flags; } ; if (text !== null) { el.text$(text); } ; if (parent && parent[\u03C652]) { parent[\u03C652](el); } ; return el; } var Extend$SVGElement$ai = class { set$(key, value) { var \u03C6273; let cache = descriptorCache[\u03C6273 = this.nodeName] || (descriptorCache[\u03C6273] = {}); let desc = getDescriptor(this, key, cache); if (!desc || !desc.set) { this.setAttribute(key, value); } else { this[key] = value; } ; return; } flag$(str) { let ns = this.flags$ns; this.setAttribute("class", ns ? ns + (this.flags$ext = str) : this.flags$ext = str); return; } flagSelf$(str) { var self = this; this.flag$ = function(str2) { return self.flagSync$(self.flags$ext = str2); }; this.flagSelf$ = function(str2) { return self.flagSync$(self.flags$own = str2); }; return this.flagSelf$(str); } flagSync$() { return this.setAttribute("class", (this.flags$ns || "") + (this.flags$ext || "") + " " + (this.flags$own || "") + " " + (this.$flags || "")); } }; extend$__(SVGElement.prototype, Extend$SVGElement$ai.prototype); var Extend$SVGSVGElement$aj = class { set src(value) { if (this[\u03C628] != value ? (this[\u03C628] = value, true) : false) { if (value) { if (value.adoptNode) { value.adoptNode(this); } else if (value.content) { for (let \u03C6312 = value.attributes, \u03C6293 = 0, \u03C6302 = Object.keys(\u03C6312), \u03C6323 = \u03C6302.length, k, v; \u03C6293 < \u03C6323; \u03C6293++) { k = \u03C6302[\u03C6293]; v = \u03C6312[k]; this.setAttribute(k, v); } ; this.innerHTML = value.content; } ; } ; } ; return; } }; extend$__(SVGSVGElement.prototype, Extend$SVGSVGElement$aj.prototype); function createSVGElement(name, parent, flags, text, ctx) { let el = globalThis.document.createElementNS("http://www.w3.org/2000/svg", name); if (flags) { el.className.baseVal = flags; } ; if (parent && parent[\u03C652]) { parent[\u03C652](el); } ; if (text) { el.textContent = text; } ; return el; } function createComment(text) { return globalThis.document.createComment(text); } function createTextNode(text) { return globalThis.document.createTextNode(text); } function createFragment() { return globalThis.document.createDocumentFragment(); } var navigator = globalThis.navigator; var vendor = navigator && navigator.vendor || ""; var ua = navigator && navigator.userAgent || ""; var isSafari = vendor.indexOf("Apple") > -1 || ua.indexOf("CriOS") >= 0 || ua.indexOf("FxiOS") >= 0; var supportsCustomizedBuiltInElements = !isSafari; var CustomDescriptorCache = new Map(); var CustomHook = class extends HTMLElement { connectedCallback() { if (supportsCustomizedBuiltInElements) { return this.parentNode.removeChild(this); } else { return this.parentNode.connectedCallback(); } ; } disconnectedCallback() { if (!supportsCustomizedBuiltInElements) { return this.parentNode.disconnectedCallback(); } ; } }; window.customElements.define("i-hook", CustomHook); function getCustomDescriptors(el, klass) { let props = CustomDescriptorCache.get(klass); if (!props) { props = {}; let proto = klass.prototype; let protos = [proto]; while (proto = proto && Object.getPrototypeOf(proto)) { if (proto.constructor == el.constructor) { break; } ; protos.unshift(proto); } ; for (let \u03C6333 = 0, \u03C6342 = iter$__3(protos), \u03C6352 = \u03C6342.length; \u03C6333 < \u03C6352; \u03C6333++) { let item = \u03C6342[\u03C6333]; let desc = Object.getOwnPropertyDescriptors(item); Object.assign(props, desc); } ; CustomDescriptorCache.set(klass, props); } ; return props; } function createComponent(name, parent, flags, text, ctx) { let el; if (typeof name != "string") { if (name && name.nodeName) { name = name.nodeName; } ; } ; let cmpname = CustomTagToElementNames[name] || name; if (CustomTagConstructors[name]) { let cls = CustomTagConstructors[name]; let typ = cls.prototype[\u03C636]; if (typ && supportsCustomizedBuiltInElements) { el = globalThis.document.createElement(typ, {is: name}); } else if (cls.create$ && typ) { el = globalThis.document.createElement(typ); el.setAttribute("is", cmpname); let props = getCustomDescriptors(el, cls); Object.defineProperties(el, props); el.__slots = {}; el.appendChild(globalThis.document.createElement("i-hook")); } else if (cls.create$) { el = cls.create$(el); el.__slots = {}; } else { console.warn("could not create tag " + name); } ; } else { el = globalThis.document.createElement(CustomTagToElementNames[name] || name); } ; el[\u03C621] = parent; el[\u03C63](); if (text !== null) { el.slot$("__").text$(text); } ; if (flags || el.flags$ns) { el.flag$(flags || ""); } ; return el; } function getTagType(name, klass) { if (TYPES[name]) { return TYPES[name]; } ; if (window[klass]) { return window[klass]; } ; if (window[name]) { return window[name]; } ; } function getSuperTagType(name, klass, cmp) { let typ = getTagType(name, klass); let custom = typ == cmp || typ.prototype instanceof cmp || typ.prototype[\u03C636]; if (!custom) { let cls = typ.prototype[\u03C637]; if (!cls) { cls = class CustomBuiltInElement extends typ { constructor() { super(...arguments); this.__slots = {}; this.__F = 0; } }; typ.prototype[\u03C637] = cls; let descriptors = Object.getOwnPropertyDescriptors(cmp.prototype); Object.defineProperties(cls.prototype, descriptors); cls.prototype[\u03C636] = name; } ; return cls; } ; return typ; } function defineTag(name, klass, options = {}) { TYPES[name] = CUSTOM_TYPES[name] = klass; klass.nodeName = name; let componentName = name; let proto = klass.prototype; if (name.indexOf("-") == -1) { componentName = "" + name + "-tag"; CustomTagToElementNames[name] = componentName; } ; let basens = proto._ns_; if (options.ns) { let ns = options.ns; let flags = ns + " " + ns + "_ "; if (basens) { flags += proto.flags$ns; ns += " " + basens; } ; proto._ns_ = ns; proto.flags$ns = flags; } ; if (proto[\u03C636]) { options.extends = proto[\u03C636]; } ; if (options.extends) { proto[\u03C636] = options.extends; CustomTagConstructors[name] = klass; if (supportsCustomizedBuiltInElements) { window.customElements.define(componentName, klass, {extends: options.extends}); } ; } else { window.customElements.define(componentName, klass); } ; return klass; } var instance2 = globalThis.imba || (globalThis.imba = {}); instance2.document = globalThis.document; function iter$__4(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6110 = Symbol.for("#parent"); var \u03C627 = Symbol.for("#appendChild"); var \u03C632 = Symbol.for("#removeChild"); var \u03C643 = Symbol.for("#insertInto"); var \u03C653 = Symbol.for("#replaceWith"); var \u03C663 = Symbol.for("#insertChild"); var \u03C674 = Symbol.for("#removeFrom"); var \u03C683 = Symbol.for("#placeChild"); var \u03C693 = Symbol.for("##up"); var \u03C6102 = Symbol.for("#domFlags"); var \u03C6112 = Symbol.for("#end"); var \u03C6123 = Symbol.for("##parent"); var \u03C6133 = Symbol.for("#textContent"); var \u03C6172 = Symbol.for("#textNode"); var Fragment = class { constructor() { this.childNodes = []; } log(...params) { return; return console.log(this.constructor.name, ...params); } hasChildNodes() { return false; } }; var counter = 0; var VirtualFragment = class extends Fragment { constructor(flags, parent) { super(...arguments); this[\u03C693] = parent; this.parentNode = null; this[\u03C6102] = flags; this.childNodes = []; this[\u03C6112] = createComment("slot" + counter++); this[\u03C6112].node = this; if (parent) { parent[\u03C627](this); } ; } get [\u03C6110]() { return this[\u03C6123] || this.parentNode || this[\u03C693]; } set textContent(text) { this[\u03C6133] = text; } get textContent() { return this[\u03C6133]; } hasChildNodes() { for (let \u03C6144 = 0, \u03C6152 = iter$__4(this.childNodes), \u03C6165 = \u03C6152.length; \u03C6144 < \u03C6165; \u03C6144++) { let item = \u03C6152[\u03C6144]; if (item instanceof Fragment) { if (item.hasChildNodes()) { return true; } ; } ; if (item instanceof Comment) { true; } else if (item instanceof Node) { return true; } ; } ; return false; } text$(item) { if (!this[\u03C6172]) { this[\u03C6172] = this[\u03C683](item); } else { this[\u03C6172].textContent = item; } ; return this[\u03C6172]; } appendChild(child) { if (this.parentNode) { child[\u03C643](this.parentNode, this[\u03C6112]); } ; return this.childNodes.push(child); } [\u03C627](child) { if (this.parentNode) { child[\u03C643](this.parentNode, this[\u03C6112]); } ; return this.childNodes.push(child); } insertBefore(node, refnode) { if (this.parentNode) { this.parentNode[\u03C663](node, refnode); } ; let idx = this.childNodes.indexOf(refnode); if (idx >= 0) { this.childNodes.splice(idx, 0, node); } ; return node; } [\u03C632](node) { if (this.parentNode) { this.parentNode[\u03C632](node); } ; let idx = this.childNodes.indexOf(node); if (idx >= 0) { this.childNodes.splice(idx, 1); } ; return; } [\u03C643](parent, before) { let prev = this.parentNode; if (this.parentNode != parent ? (this.parentNode = parent, true) : false) { if (this[\u03C6112]) { before = this[\u03C6112][\u03C643](parent, before); } ; for (let \u03C6185 = 0, \u03C6193 = iter$__4(this.childNodes), \u03C6204 = \u03C6193.length; \u03C6185 < \u03C6204; \u03C6185++) { let item = \u03C6193[\u03C6185]; item[\u03C643](parent, before); } ; } ; return this; } [\u03C653](node, parent) { let res = node[\u03C643](parent, this[\u03C6112]); this[\u03C674](parent); return res; } [\u03C663](node, refnode) { if (this.parentNode) { this.insertBefore(node, refnode || this[\u03C6112]); } ; if (refnode) { let idx = this.childNodes.indexOf(refnode); if (idx >= 0) { this.childNodes.splice(idx, 0, node); } ; } else { this.childNodes.push(node); } ; return node; } [\u03C674](parent) { for (let \u03C62110 = 0, \u03C6224 = iter$__4(this.childNodes), \u03C6234 = \u03C6224.length; \u03C62110 < \u03C6234; \u03C62110++) { let item = \u03C6224[\u03C62110]; item[\u03C674](parent); } ; if (this[\u03C6112]) { this[\u03C6112][\u03C674](parent); } ; this.parentNode = null; return this; } [\u03C683](item, f, prev) { let par = this.parentNode; let type = typeof item; if (type === "undefined" || item === null) { if (prev && prev instanceof Comment) { return prev; } ; let el = createComment(""); if (prev) { let idx = this.childNodes.indexOf(prev); this.childNodes.splice(idx, 1, el); if (par) { prev[\u03C653](el, par); } ; return el; } ; this.childNodes.push(el); if (par) { el[\u03C643](par, this[\u03C6112]); } ; return el; } ; if (item === prev) { return item; } ; if (type !== "object") { let res; let txt = item; if (prev) { if (prev instanceof Text) { prev.textContent = txt; return prev; } else { res = createTextNode(txt); let idx = this.childNodes.indexOf(prev); this.childNodes.splice(idx, 1, res); if (par) { prev[\u03C653](res, par); } ; return res; } ; } else { this.childNodes.push(res = createTextNode(txt)); if (par) { res[\u03C643](par, this[\u03C6112]); } ; return res; } ; } else if (prev) { let idx = this.childNodes.indexOf(prev); this.childNodes.splice(idx, 1, item); if (par) { prev[\u03C653](item, par); } ; return item; } else { this.childNodes.push(item); if (par) { item[\u03C643](par, this[\u03C6112]); } ; return item; } ; } }; function createLiveFragment(bitflags, par) { const el = new VirtualFragment(bitflags, par); return el; } function createSlot(bitflags, par) { const el = new VirtualFragment(bitflags, null); el[\u03C693] = par; return el; } function iter$__5(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6111 = Symbol.for("#afterVisit"); var \u03C629 = Symbol.for("#insertInto"); var \u03C633 = Symbol.for("#appendChild"); var \u03C644 = Symbol.for("#replaceWith"); var \u03C654 = Symbol.for("#removeFrom"); var \u03C664 = Symbol.for("#domFlags"); var \u03C675 = Symbol.for("#parent"); var \u03C684 = Symbol.for("#end"); var \u03C694 = Symbol.for("#removeChild"); var \u03C6103 = Symbol.for("#insertChild"); var IndexedTagFragment = class extends Fragment { constructor(f, parent) { super(...arguments); this[\u03C664] = f; this[\u03C675] = parent; this.log("IndexedTag", parent); if (!(f & 256)) { this[\u03C684] = createComment("list"); this[\u03C684].node = this; } ; this.$ = this.childNodes; this.length = 0; if (parent) { parent[\u03C633](this); } ; } hasChildNodes() { if (this.length == 0) { return false; } ; return true; } [\u03C6111](len) { let from = this.length; this.length = len; if (from == len || !this.parentNode) { return; } ; let array = this.childNodes; let par = this[\u03C675]; let end = this[\u03C684]; if (from > len) { while (from > len) { par[\u03C694](array[--from]); } ; } else if (len > from) { while (len > from) { par[\u03C6103](array[from++], end); } ; } ; this.length = len; return; } [\u03C629](parent, before) { this.parentNode = parent; if (this[\u03C684]) { this[\u03C684][\u03C629](parent, before); } ; before || (before = this[\u03C684]); for (let i = 0, \u03C61111 = iter$__5(this.childNodes), \u03C6127 = \u03C61111.length; i < \u03C6127; i++) { let item = \u03C61111[i]; if (i == this.length) { break; } ; item[\u03C629](parent, before); } ; return this; } [\u03C633](item) { return; } [\u03C644](rel, parent) { let res = rel[\u03C629](parent, this[\u03C684]); this[\u03C654](parent); return res; } [\u03C654](parent) { let i = this.length; while (i > 0) { let el = this.childNodes[--i]; el[\u03C654](parent); } ; if (this[\u03C684]) { parent.removeChild(this[\u03C684]); } ; this.parentNode = null; return; } }; function createIndexedList(bitflags, parent) { return new IndexedTagFragment(bitflags, parent); } function iter$__6(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6113 = Symbol.for("#appendChild"); var \u03C6210 = Symbol.for("#insertChild"); var \u03C634 = Symbol.for("#replaceWith"); var \u03C645 = Symbol.for("#insertInto"); var \u03C655 = Symbol.for("#removeFrom"); var \u03C665 = Symbol.for("#afterVisit"); var \u03C676 = Symbol.for("#domFlags"); var \u03C685 = Symbol.for("#parent"); var \u03C695 = Symbol.for("#end"); var \u03C6143 = Symbol.for("#removeChild"); var KeyedTagFragment = class extends Fragment { constructor(f, parent) { super(...arguments); this[\u03C676] = f; this[\u03C685] = parent; this.changes = new Map(); this.dirty = false; this.array = this.childNodes; this.$ = {}; if (!(f & 256)) { this[\u03C695] = createComment("map"); this[\u03C695].node = this; } ; if (parent) { parent[\u03C6113](this); } ; } [\u03C6113](item) { if (this.parentNode) { return this.parentNode[\u03C6210](item, this[\u03C695]); } ; } hasChildNodes() { if (this.childNodes.length == 0) { return false; } ; return true; } push(item, idx) { if (!(this[\u03C676] & 1)) { this.array.push(item); this[\u03C6113](item); return; } ; let toReplace = this.array[idx]; if (toReplace === item) { true; } else { this.dirty = true; let prevIndex = this.array.indexOf(item); let changed = this.changes.get(item); if (prevIndex === -1) { this.array.splice(idx, 0, item); this.insertChild(item, idx, prevIndex); } else if (prevIndex === idx + 1) { if (toReplace) { this.changes.set(toReplace, -1); } ; this.array.splice(idx, 1); } else { if (prevIndex >= 0) { this.array.splice(prevIndex, 1); } ; this.array.splice(idx, 0, item); this.moveChild(item, idx, prevIndex); } ; if (changed == -1) { this.changes.delete(item); } ; } ; return; } insertChild(item, index, prevIndex) { let par = this.parentNode; if (!par) { return; } ; if (index > 0) { let other = this.array[index - 1]; par[\u03C6210](item, other.nextSibling); } else { par[\u03C6210](item, this.childNodes[index + 1] || this[\u03C695]); } ; return; } moveChild(item, index, prevIndex) { return this.insertChild(item, index, prevIndex); } removeChild(item, index) { if (item.parentNode) { item[\u03C655](item.parentNode); } ; return; } [\u03C6210](node, relnode) { return; } [\u03C634](rel, parent) { let res = rel[\u03C645](parent, this[\u03C695]); this[\u03C655](parent); return res; } [\u03C645](parent, before) { this[\u03C685] = parent; let prev = this.parentNode; if (parent != prev) { this.parentNode = parent; for (let i = 0, \u03C6105 = iter$__6(this.array), \u03C61111 = \u03C6105.length; i < \u03C61111; i++) { let item = \u03C6105[i]; item[\u03C645](parent, before); } ; if (this[\u03C695]) { this[\u03C695][\u03C645](parent, before); } ; } ; return this; } [\u03C655](parent) { for (let \u03C6127 = 0, \u03C6135 = iter$__6(this.array), \u03C6152 = \u03C6135.length; \u03C6127 < \u03C6152; \u03C6127++) { let item = \u03C6135[\u03C6127]; parent[\u03C6143](item); } ; if (this[\u03C695]) { parent[\u03C6143](this[\u03C695]); } ; return this.parentNode = null; } [\u03C665](index) { var self = this; if (!(this[\u03C676] & 1)) { this[\u03C676] |= 1; return; } ; if (this.dirty) { this.changes.forEach(function(pos, item) { if (pos == -1) { return self.removeChild(item); } ; }); this.changes.clear(); this.dirty = false; } ; if (this.array.length > index) { while (this.array.length > index) { let item = this.array.pop(); this.removeChild(item); } ; } ; return; } }; function createKeyedList(bitflags, parent) { return new KeyedTagFragment(bitflags, parent); } function iter$__7(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6114 = Symbol.for("#init"); var \u03C6211 = Symbol.for("#__init__"); var \u03C635 = Symbol.for("#afterVisit"); var \u03C646 = Symbol.for("#beforeReconcile"); var \u03C686 = Symbol.for("#count"); var \u03C6134 = Symbol.for("#autorender"); var hydrator = new class { constructor($$ = null) { this[\u03C6114]($$); } [\u03C6114]($$ = null) { var \u03C659; this.items = $$ && (\u03C659 = $$.items) !== void 0 ? \u03C659 : []; this.current = $$ && (\u03C659 = $$.current) !== void 0 ? \u03C659 : null; this.lastQueued = $$ && (\u03C659 = $$.lastQueued) !== void 0 ? \u03C659 : null; this.tests = $$ && (\u03C659 = $$.tests) !== void 0 ? \u03C659 : 0; } flush() { let item = null; if (false) { } ; while (item = this.items.shift()) { if (!item.parentNode || item.hydrated\u03A6) { continue; } ; let prev = this.current; this.current = item; item.__F |= 1024; item.connectedCallback(); this.current = prev; } ; return; } queue(item) { var self = this; let len = this.items.length; let idx = 0; let prev = this.lastQueued; this.lastQueued = item; let BEFORE = Node2.DOCUMENT_POSITION_PRECEDING; let AFTER = Node2.DOCUMENT_POSITION_FOLLOWING; if (len) { let prevIndex = this.items.indexOf(prev); let index = prevIndex; let compare = function(a, b) { self.tests++; return a.compareDocumentPosition(b); }; if (prevIndex == -1 || prev.nodeName != item.nodeName) { index = prevIndex = 0; } ; let curr = this.items[index]; while (curr && compare(curr, item) & AFTER) { curr = this.items[++index]; } ; if (index != prevIndex) { curr ? this.items.splice(index, 0, item) : this.items.push(item); } else { while (curr && compare(curr, item) & BEFORE) { curr = this.items[--index]; } ; if (index != prevIndex) { curr ? this.items.splice(index + 1, 0, item) : this.items.unshift(item); } ; } ; } else { this.items.push(item); if (!this.current) { globalThis.queueMicrotask(this.flush.bind(this)); } ; } ; return; } run(item) { var \u03C61111, \u03C699; if (this.active) { return; } ; this.active = true; let all = globalThis.document.querySelectorAll(".__ssr"); console.log("running hydrator", item, all.length, Array.from(all)); for (let \u03C669 = 0, \u03C679 = iter$__7(all), \u03C6105 = \u03C679.length; \u03C669 < \u03C6105; \u03C669++) { let item2 = \u03C679[\u03C669]; item2[\u03C686] || (item2[\u03C686] = 1); item2[\u03C686]++; let name = item2.nodeName; let typ = (\u03C699 = this.map)[name] || (\u03C699[name] = globalThis.window.customElements.get(name.toLowerCase()) || HTMLElement); console.log("item type", name, typ, !!CUSTOM_TYPES[name.toLowerCase()]); if (!item2.connectedCallback || !item2.parentNode || item2.hydrated\u03A6) { continue; } ; console.log("hydrate", item2); } ; return this.active = false; } }(); function hydrate() { return hydrator.flush(); } var ImbaElement = class extends HTMLElement { constructor() { super(); if (this.flags$ns) { this.flag$ = this.flagExt$; } ; this.setup$(); this.build(); } setup$() { this.__slots = {}; return this.__F = 0; } [\u03C6211]() { this.__F |= 1 | 2; return this; } flag$(str) { this.className = this.flags$ext = str; return; } slot$(name, ctx) { var \u03C6127; if (name == "__" && !this.render) { return this; } ; return (\u03C6127 = this.__slots)[name] || (\u03C6127[name] = createSlot(0, this)); } build() { return this; } awaken() { return this; } mount() { return this; } unmount() { return this; } rendered() { return this; } dehydrate() { return this; } hydrate() { this.autoschedule = true; return this; } tick() { return this.commit(); } visit() { return this.commit(); } commit() { if (!this.render\u03A6) { this.__F |= 8192; return this; } ; this.__F |= 256; this.render && this.render(); this.rendered(); return this.__F = (this.__F | 512) & ~256 & ~8192; } get autoschedule() { return (this.__F & 64) != 0; } set autoschedule(value) { value ? this.__F |= 64 : this.__F &= ~64; } set autorender(value) { let o = this[\u03C6134] || (this[\u03C6134] = {}); o.value = value; if (this.mounted\u03A6) { scheduler.schedule(this, o); } ; return; } get render\u03A6() { return !this.suspended\u03A6; } get mounting\u03A6() { return (this.__F & 16) != 0; } get mounted\u03A6() { return (this.__F & 32) != 0; } get awakened\u03A6() { return (this.__F & 8) != 0; } get rendered\u03A6() { return (this.__F & 512) != 0; } get suspended\u03A6() { return (this.__F & 4096) != 0; } get rendering\u03A6() { return (this.__F & 256) != 0; } get scheduled\u03A6() { return (this.__F & 128) != 0; } get hydrated\u03A6() { return (this.__F & 2) != 0; } get ssr\u03A6() { return (this.__F & 1024) != 0; } schedule() { scheduler.on("commit", this); this.__F |= 128; return this; } unschedule() { scheduler.un("commit", this); this.__F &= ~128; return this; } async suspend(cb = null) { let val = this.flags.incr("_suspended_"); this.__F |= 4096; if (cb instanceof Function) { await cb(); this.unsuspend(); } ; return this; } unsuspend() { let val = this.flags.decr("_suspended_"); if (val == 0) { this.__F &= ~4096; this.commit(); } ; return this; } [\u03C635]() { return this.visit(); } [\u03C646]() { if (this.__F & 1024) { this.__F = this.__F & ~1024; this.classList.remove("_ssr_"); if (this.flags$ext && this.flags$ext.indexOf("_ssr_") == 0) { this.flags$ext = this.flags$ext.slice(5); } ; if (!(this.__F & 512)) { this.innerHTML = ""; } ; } ; return this; } connectedCallback() { let flags = this.__F; let inited = flags & 1; let awakened = flags & 8; if (!inited && !(flags & 1024)) { hydrator.queue(this); return; } ; if (flags & (16 | 32)) { return; } ; this.__F |= 16; if (!inited) { this[\u03C6211](); } ; if (!(flags & 2)) { this.flags$ext = this.className; this.__F |= 2; this.hydrate(); this.commit(); } ; if (!awakened) { this.awaken(); this.__F |= 8; } ; let res = this.mount(); if (res && res.then instanceof Function) { res.then(scheduler.commit); } ; flags = this.__F = (this.__F | 32) & ~16; if (flags & 64) { this.schedule(); } ; if (this[\u03C6134]) { scheduler.schedule(this, this[\u03C6134]); } ; return this; } disconnectedCallback() { this.__F = this.__F & (~32 & ~16); if (this.__F & 128) { this.unschedule(); } ; this.unmount(); if (this[\u03C6134]) { return scheduler.unschedule(this, this[\u03C6134]); } ; } }; function extend$__2(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } var \u03C6115 = Symbol.for("#init"); var VALID_CSS_UNITS = { cm: 1, mm: 1, Q: 1, pc: 1, pt: 1, px: 1, em: 1, ex: 1, ch: 1, rem: 1, vw: 1, vh: 1, vmin: 1, vmax: 1, s: 1, ms: 1, fr: 1, "%": 1, in: 1, turn: 1, grad: 1, rad: 1, deg: 1, Hz: 1, kHz: 1 }; var CSS_STR_PROPS = { prefix: 1, suffix: 1, content: 1 }; var CSS_COLORS = { rose: [[356, 100, 97], [356, 100, 95], [353, 96, 90], [353, 96, 82], [351, 95, 71], [350, 89, 60], [347, 77, 50], [345, 83, 41], [343, 80, 35], [342, 75, 30]], pink: [[327, 73, 97], [326, 78, 95], [326, 85, 90], [327, 87, 82], [329, 86, 70], [330, 81, 60], [333, 71, 51], [335, 78, 42], [336, 74, 35], [336, 69, 30]], fuchsia: [[289, 100, 98], [287, 100, 95], [288, 96, 91], [291, 93, 83], [292, 91, 73], [292, 84, 61], [293, 69, 49], [295, 72, 40], [295, 70, 33], [297, 64, 28]], purple: [[270, 100, 98], [269, 100, 95], [269, 100, 92], [269, 97, 85], [270, 95, 75], [271, 91, 65], [271, 81, 56], [272, 72, 47], [273, 67, 39], [274, 66, 32]], violet: [[250, 100, 98], [251, 91, 95], [251, 95, 92], [252, 95, 85], [255, 92, 76], [258, 90, 66], [262, 83, 58], [263, 70, 50], [263, 69, 42], [264, 67, 35]], indigo: [[226, 100, 97], [226, 100, 94], [228, 96, 89], [230, 94, 82], [234, 89, 74], [239, 84, 67], [243, 75, 59], [245, 58, 51], [244, 55, 41], [242, 47, 34]], blue: [[214, 100, 97], [214, 95, 93], [213, 97, 87], [212, 96, 78], [213, 94, 68], [217, 91, 60], [221, 83, 53], [224, 76, 48], [226, 71, 40], [224, 64, 33]], sky: [[204, 100, 97], [204, 94, 94], [201, 94, 86], [199, 95, 74], [198, 93, 60], [199, 89, 48], [200, 98, 39], [201, 96, 32], [201, 90, 27], [202, 80, 24]], cyan: [[183, 100, 96], [185, 96, 90], [186, 94, 82], [187, 92, 69], [188, 86, 53], [189, 94, 43], [192, 91, 36], [193, 82, 31], [194, 70, 27], [196, 64, 24]], teal: [[166, 76, 97], [167, 85, 89], [168, 84, 78], [171, 77, 64], [172, 66, 50], [173, 80, 40], [175, 84, 32], [175, 77, 26], [176, 69, 22], [176, 61, 19]], emerald: [[152, 81, 96], [149, 80, 90], [152, 76, 80], [156, 72, 67], [158, 64, 52], [160, 84, 39], [161, 94, 30], [163, 94, 24], [163, 88, 20], [164, 86, 16]], green: [[138, 76, 97], [141, 84, 93], [141, 79, 85], [142, 77, 73], [142, 69, 58], [142, 71, 45], [142, 76, 36], [142, 72, 29], [143, 64, 24], [144, 61, 20]], lime: [[78, 92, 95], [80, 89, 89], [81, 88, 80], [82, 85, 67], [83, 78, 55], [84, 81, 44], [85, 85, 35], [86, 78, 27], [86, 69, 23], [88, 61, 20]], yellow: [[55, 92, 95], [55, 97, 88], [53, 98, 77], [50, 98, 64], [48, 96, 53], [45, 93, 47], [41, 96, 40], [35, 92, 33], [32, 81, 29], [28, 73, 26]], amber: [[48, 100, 96], [48, 96, 89], [48, 97, 77], [46, 97, 65], [43, 96, 56], [38, 92, 50], [32, 95, 44], [26, 90, 37], [23, 83, 31], [22, 78, 26]], orange: [[33, 100, 96], [34, 100, 92], [32, 98, 83], [31, 97, 72], [27, 96, 61], [25, 95, 53], [21, 90, 48], [17, 88, 40], [15, 79, 34], [15, 75, 28]], red: [[0, 86, 97], [0, 93, 94], [0, 96, 89], [0, 94, 82], [0, 91, 71], [0, 84, 60], [0, 72, 51], [0, 74, 42], [0, 70, 35], [0, 63, 31]], warmer: [[60, 9, 98], [60, 5, 96], [20, 6, 90], [24, 6, 83], [24, 5, 64], [25, 5, 45], [33, 5, 32], [30, 6, 25], [12, 6, 15], [24, 10, 10]], warm: [[0, 0, 98], [0, 0, 96], [0, 0, 90], [0, 0, 83], [0, 0, 64], [0, 0, 45], [0, 0, 32], [0, 0, 25], [0, 0, 15], [0, 0, 9]], gray: [[0, 0, 98], [240, 5, 96], [240, 6, 90], [240, 5, 84], [240, 5, 65], [240, 4, 46], [240, 5, 34], [240, 5, 26], [240, 4, 16], [240, 6, 10]], cool: [[210, 20, 98], [220, 14, 96], [220, 13, 91], [216, 12, 84], [218, 11, 65], [220, 9, 46], [215, 14, 34], [217, 19, 27], [215, 28, 17], [221, 39, 11]], cooler: [[210, 40, 98], [210, 40, 96], [214, 32, 91], [213, 27, 84], [215, 20, 65], [215, 16, 47], [215, 19, 35], [215, 25, 27], [217, 33, 17], [222, 47, 11]] }; var CSS_COLORS_REGEX = new RegExp("^(" + Object.keys(CSS_COLORS).join("|") + ")(\\d+(?:\\.\\d+)?)$"); var CSS_PX_PROPS = /^([xyz])$/; var CSS_DIM_PROPS = /^([tlbr]|size|[whtlbr]|[mps][tlbrxy]?|[rcxy]?[gs])$/; var resets = "*,::before,::after {\nbox-sizing: border-box;\nborder-width: 0;\nborder-style: solid;\nborder-color: currentColor;\n}"; var Styles = class { constructor($$ = null) { this[\u03C6115]($$); } [\u03C6115]($$ = null) { var \u03C6220; this.entries = $$ && (\u03C6220 = $$.entries) !== void 0 ? \u03C6220 : {}; } register(id, styles2) { let entry = this.entries[id]; if (!entry) { entry = this.entries[id] = {sourceId: id, css: styles2}; if (!this.entries.resets) { this.register("resets", resets); } ; entry.node = globalThis.document.createElement("style"); entry.node.setAttribute("data-id", id); entry.node.textContent = entry.css; globalThis.document.head.appendChild(entry.node); } else if (entry) { entry.css = styles2; if (entry.node) { entry.node.textContent = styles2; } ; } ; return; } toString() { return Object.values(this.entries).map(function(_0) { return _0.css; }).join("\n\n"); } toValue(value, unit, key, param = null) { let colormatch; if (CSS_STR_PROPS[key]) { value = String(value); } ; let typ = typeof value; if (typ == "number") { if (!unit) { if (CSS_PX_PROPS.test(key)) { unit = "px"; } else if (CSS_DIM_PROPS.test(key)) { unit = "u"; } else if (key == "rotate") { unit = "turn"; value = (value % 1).toFixed(4); } ; } ; if (unit) { if (VALID_CSS_UNITS[unit]) { return value + unit; } else if (unit == "u") { return value * 4 + "px"; } else { return "calc(var(--u_" + unit + ",1px) * " + value + ")"; } ; } else { true; } ; } else if (typ == "string") { if (key && CSS_STR_PROPS[key] && value[0] != '"' && value[0] != "'") { if (value.indexOf('"') >= 0) { if (value.indexOf("'") == -1) { value = "'" + value + "'"; } else { false; } ; } else { value = '"' + value + '"'; } ; } ; if (colormatch = value.match(CSS_COLORS_REGEX)) { let color = CSS_COLORS[colormatch[1]]; let level = color[parseInt(colormatch[2])]; let a = "100%"; if (typeof param == "number") { a = param + "%"; } else if (typeof param == "string") { a = param; } ; if (level) { return "hsla(" + level[0] + "," + level[1] + "%," + level[2] + "%," + a + ")"; } ; } ; } else if (value && value.toStyleString instanceof Function) { return value.toStyleString(); } ; return value; } parseDimension(val) { if (typeof val == "string") { let [m, num, unit] = val.match(/^([-+]?[\d\.]+)(%|\w+)$/); return [parseFloat(num), unit]; } else if (typeof val == "number") { return [val]; } ; } }; var styles = new Styles(); var colors = Object.keys(CSS_COLORS); function use_styles() { return true; } var Extend$Element$af = class { css$(key, value, mods) { return this.style[key] = value; } css$var(name, value, unit, key, param = null) { let cssval = styles.toValue(value, unit, key, param); this.style.setProperty(name, cssval); return; } }; extend$__2(Element.prototype, Extend$Element$af.prototype); var renderContext = { context: null }; var \u03C6116 = Symbol.for("#insertInto"); var \u03C6212 = Symbol.for("#removeFrom"); function render(blk, ctx = {}) { let prev = renderContext.context; renderContext.context = ctx; let res = blk(ctx); if (renderContext.context == ctx) { renderContext.context = prev; } ; return res; } function mount(mountable, into) { let parent = into || globalThis.document.body; let element = mountable; if (mountable instanceof Function) { let ctx = {_: parent}; let tick = function() { let prev = renderContext.context; renderContext.context = ctx; let res = mountable(ctx); if (renderContext.context == ctx) { renderContext.context = prev; } ; return res; }; element = tick(); scheduler.listen("commit", tick); } else { element.__F |= 64; } ; element[\u03C6116](parent); return element; } function unmount(el) { if (el && el[\u03C6212]) { el[\u03C6212](el.parentNode); } ; return el; } var instance3 = globalThis.imba || (globalThis.imba = {}); instance3.mount = mount; instance3.unmount = unmount; function extend$__3(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function iter$__8(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6117 = Symbol.for("#afterVisit"); function use_dom_bind() { return true; } var toBind = { INPUT: true, SELECT: true, TEXTAREA: true, BUTTON: true }; var isGroup = function(obj) { return obj instanceof Array || obj && obj.has instanceof Function; }; var bindHas = function(object, value) { if (object == value) { return true; } else if (object instanceof Array) { return object.indexOf(value) >= 0; } else if (object && object.has instanceof Function) { return object.has(value); } else if (object && object.contains instanceof Function) { return object.contains(value); } else { return false; } ; }; var bindAdd = function(object, value) { if (object instanceof Array) { return object.push(value); } else if (object && object.add instanceof Function) { return object.add(value); } ; }; var bindRemove = function(object, value) { if (object instanceof Array) { let idx = object.indexOf(value); if (idx >= 0) { return object.splice(idx, 1); } ; } else if (object && object.delete instanceof Function) { return object.delete(value); } ; }; function createProxyProperty(target) { function getter() { return target[0] ? target[0][target[1]] : void 0; } ; function setter(v) { return target[0] ? target[0][target[1]] = v : null; } ; return { get: getter, set: setter }; } var Extend$Element$af2 = class { getRichValue() { return this.value; } setRichValue(value) { return this.value = value; } bind$(key, value) { let o = value || []; if (key == "data" && !this.$$bound && toBind[this.nodeName]) { this.$$bound = true; if (this.change$) { this.addEventListener("change", this.change$ = this.change$.bind(this)); } ; if (this.input$) { this.addEventListener("input", this.input$ = this.input$.bind(this), {capture: true}); } ; if (this.click$) { this.addEventListener("click", this.click$ = this.click$.bind(this), {capture: true}); } ; } ; Object.defineProperty(this, key, o instanceof Array ? createProxyProperty(o) : o); return o; } }; extend$__3(Element.prototype, Extend$Element$af2.prototype); Object.defineProperty(Element.prototype, "richValue", { get: function() { return this.getRichValue(); }, set: function(v) { return this.setRichValue(v); } }); var Extend$HTMLSelectElement$ag = class { change$(e) { let model = this.data; let prev = this.$$value; this.$$value = void 0; let values = this.getRichValue(); if (this.multiple) { if (prev) { for (let \u03C6220 = 0, \u03C6312 = iter$__8(prev), \u03C6410 = \u03C6312.length; \u03C6220 < \u03C6410; \u03C6220++) { let value = \u03C6312[\u03C6220]; if (values.indexOf(value) != -1) { continue; } ; bindRemove(model, value); } ; } ; for (let \u03C659 = 0, \u03C669 = iter$__8(values), \u03C679 = \u03C669.length; \u03C659 < \u03C679; \u03C659++) { let value = \u03C669[\u03C659]; if (!prev || prev.indexOf(value) == -1) { bindAdd(model, value); } ; } ; } else { this.data = values[0]; } ; commit(); return this; } getRichValue() { var \u03C6810; if (this.$$value) { return this.$$value; } ; \u03C6810 = []; for (let \u03C699 = 0, \u03C6105 = iter$__8(this.selectedOptions), \u03C61111 = \u03C6105.length; \u03C699 < \u03C61111; \u03C699++) { let o = \u03C6105[\u03C699]; \u03C6810.push(o.richValue); } ; return this.$$value = \u03C6810; } syncValue() { let model = this.data; if (this.multiple) { let vals = []; for (let i = 0, \u03C6127 = iter$__8(this.options), \u03C6135 = \u03C6127.length; i < \u03C6135; i++) { let option = \u03C6127[i]; let val = option.richValue; let sel = bindHas(model, val); option.selected = sel; if (sel) { vals.push(val); } ; } ; this.$$value = vals; } else { for (let i = 0, \u03C6144 = iter$__8(this.options), \u03C6152 = \u03C6144.length; i < \u03C6152; i++) { let option = \u03C6144[i]; let val = option.richValue; if (val == model) { this.$$value = [val]; this.selectedIndex = i; break; } ; } ; } ; return; } [\u03C6117]() { return this.syncValue(); } }; extend$__3(HTMLSelectElement.prototype, Extend$HTMLSelectElement$ag.prototype); var Extend$HTMLOptionElement$ah = class { setRichValue(value) { this.$$value = value; return this.value = value; } getRichValue() { if (this.$$value !== void 0) { return this.$$value; } ; return this.value; } }; extend$__3(HTMLOptionElement.prototype, Extend$HTMLOptionElement$ah.prototype); var Extend$HTMLTextAreaElement$ai = class { setRichValue(value) { this.$$value = value; return this.value = value; } getRichValue() { if (this.$$value !== void 0) { return this.$$value; } ; return this.value; } input$(e) { this.data = this.value; return commit(); } [\u03C6117]() { if (this.$$bound && this.value != this.data) { return this.value = this.data; } ; } }; extend$__3(HTMLTextAreaElement.prototype, Extend$HTMLTextAreaElement$ai.prototype); var Extend$HTMLInputElement$aj = class { input$(e) { let typ = this.type; if (typ == "checkbox" || typ == "radio") { return; } ; this.$$value = void 0; this.data = this.richValue; return commit(); } change$(e) { let model = this.data; let val = this.richValue; if (this.type == "checkbox" || this.type == "radio") { let checked = this.checked; if (isGroup(model)) { checked ? bindAdd(model, val) : bindRemove(model, val); } else { this.data = checked ? val : false; } ; } ; return commit(); } setRichValue(value) { if (this.$$value !== value) { this.$$value = value; if (this.value !== value) { this.value = value; } ; } ; return; } getRichValue() { if (this.$$value !== void 0) { return this.$$value; } ; let value = this.value; let typ = this.type; if (typ == "range" || typ == "number") { value = this.valueAsNumber; if (Number.isNaN(value)) { value = null; } ; } else if (typ == "checkbox") { if (value == void 0 || value === "on") { value = true; } ; } ; return value; } [\u03C6117]() { if (this.$$bound) { let typ = this.type; if (typ == "checkbox" || typ == "radio") { let val = this.data; if (val === true || val === false || val == null) { this.checked = !!val; } else { this.checked = bindHas(val, this.richValue); } ; } else { this.richValue = this.data; } ; } ; return; } }; extend$__3(HTMLInputElement.prototype, Extend$HTMLInputElement$aj.prototype); var Extend$HTMLButtonElement$ak = class { get checked() { return this.$checked; } set checked(val) { if (val != this.$checked) { this.$checked = val; this.flags.toggle("checked", !!val); } ; } setRichValue(value) { this.$$value = value; return this.value = value; } getRichValue() { if (this.$$value !== void 0) { return this.$$value; } ; return this.value; } click$(e) { let data = this.data; let toggled = this.checked; let val = this.richValue; if (isGroup(data)) { toggled ? bindRemove(data, val) : bindAdd(data, val); } else if (this.$$value == void 0) { this.data = toggled ? false : true; } else { this.data = toggled ? null : val; } ; this[\u03C6117](); return commit(); } [\u03C6117]() { if (this.$$bound) { let data = this.data; let val = this.$$value == void 0 ? true : this.$$value; if (isGroup(data)) { this.checked = bindHas(data, val); } else { this.checked = data == val; } ; } ; return; } }; extend$__3(HTMLButtonElement.prototype, Extend$HTMLButtonElement$ak.prototype); function iter$__9(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6118 = Symbol.for("#container"); var \u03C6213 = Symbol.for("#afterVisit"); var \u03C638 = Symbol.for("#init"); var \u03C647 = Symbol.for("#listeners"); var \u03C656 = Symbol.for("#slot"); var \u03C666 = Symbol.for("#parent"); var \u03C677 = Symbol.for("##container"); var \u03C687 = Symbol.for("#domTarget"); var \u03C696 = Symbol.for("#insertInto"); var \u03C6162 = Symbol.for("#removeFrom"); var \u03C6173 = Symbol.for("#self"); var \u03C6182 = Symbol.for("#target"); var TeleportHook = class extends ImbaElement { constructor() { super(...arguments); super[\u03C638] || this[\u03C638](); } [\u03C638]($$ = null) { super[\u03C638] && super[\u03C638](...arguments); this.to = $$ ? $$.to : void 0; } build() { this[\u03C647] = []; this.win = globalThis; return this.doc = globalThis.document; } setup() { return this.setAttribute("style", "display:none !important;"); } slot$(name, ctx) { this[\u03C656] || (this[\u03C656] = createSlot(0, this[\u03C666])); return this[\u03C656]; } get [\u03C6118]() { if (!this[\u03C677]) { let classes = this.className; this[\u03C677] = this.doc.createElement("div"); this[\u03C677].className = classes; this[\u03C677].style.cssText = "display:contents !important;"; } ; return this[\u03C677]; } get domTarget() { return this[\u03C687] || (this[\u03C687] = this.to instanceof Element ? this.to : this.closest(this.to) || this.doc.querySelector(this.to)); } get eventTarget() { return this.domTarget; } get style() { return this[\u03C677] ? this[\u03C677].style : super.style; } get classList() { return this[\u03C677] ? this[\u03C677].classList : super.classList; } get className() { return this[\u03C677] ? this[\u03C677].className : super.className; } set className(val) { this[\u03C677] ? this[\u03C677].className = val : super.className = val; } [\u03C6213]() { if (this.mounted\u03A6 && this[\u03C656] && !this[\u03C656].parentNode) { return this[\u03C656][\u03C696](this.target); } ; } mount() { for (let \u03C6105 = 0, \u03C61111 = iter$__9(this[\u03C647]), \u03C6127 = \u03C61111.length; \u03C6105 < \u03C6127; \u03C6105++) { let [name, handler, o] = \u03C61111[\u03C6105]; this.eventTarget.addEventListener(name, handler, o); } ; let target = this.domTarget; if (this[\u03C656]) { this[\u03C656][\u03C696](target); } ; return this; } unmount() { for (let \u03C6135 = 0, \u03C6144 = iter$__9(this[\u03C647]), \u03C6152 = \u03C6144.length; \u03C6135 < \u03C6152; \u03C6135++) { let [name, handler, o] = \u03C6144[\u03C6135]; this.eventTarget.removeEventListener(name, handler, o); } ; if (this[\u03C656]) { this[\u03C656][\u03C6162](this.domTarget); } ; this[\u03C687] = null; return this; } addEventListener(name, handler, o = {}) { var _a; handler[\u03C6173] = this; this[\u03C647].push([name, handler, o]); if (this.mounted\u03A6 && ((_a = this.eventTarget) == null ? void 0 : _a.addEventListener)) { return this.eventTarget.addEventListener(name, handler, o); } ; } }; var GlobalHook = class extends TeleportHook { get domTarget() { return this.doc.body; } get eventTarget() { return this.win; } addEventListener(name, handler, o = {}) { handler[\u03C6182] = this.domTarget.parentNode; return super.addEventListener(...arguments); } on$resize(mods, scope, handler, o) { this.addEventListener("resize", handler, o); return handler; } }; if (globalThis.customElements) { globalThis.customElements.define("i-teleport", TeleportHook); globalThis.customElements.define("i-global", GlobalHook); } function use_dom_teleport() { return true; } function iter$__10(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } function extend$__4(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } var \u03C6119 = Symbol.for("#init"); var \u03C6214 = Symbol.for("#insertInto"); var \u03C639 = Symbol.for("#removeFrom"); var \u03C688 = Symbol.for("#phase"); var \u03C697 = Symbol.for("#nodes"); var \u03C6163 = Symbol.for("#enabled"); var \u03C6174 = Symbol.for("#anims"); var \u03C6183 = Symbol.for("#_easer_"); var Transitions = class { constructor($$ = null) { this[\u03C6119]($$); } [\u03C6119]($$ = null) { var \u03C6410; this.selectors = $$ && (\u03C6410 = $$.selectors) !== void 0 ? \u03C6410 : []; } addSelectors(add) { this.selectors.push(...add); return true; } nodesForBase(base) { let query = this.selectors.join(","); let hits = [base]; let elements = base.querySelectorAll(query); for (let \u03C659 = 0, \u03C669 = iter$__10(elements), \u03C679 = \u03C669.length; \u03C659 < \u03C679; \u03C659++) { let el = \u03C669[\u03C659]; if (el.closest("._ease_") == base) { hits.push(el); } ; } ; return hits; } }; var transitions = new Transitions(); var Easer = class { constructor(target) { this.dom = target; this[\u03C688] = null; this[\u03C697] = []; } log(...params) { return; } get flags() { return this.dom.flags; } flag(flags) { for (let \u03C6105 = 0, \u03C61111 = iter$__10(this[\u03C697]), \u03C6127 = \u03C61111.length; \u03C6105 < \u03C6127; \u03C6105++) { let node = \u03C61111[\u03C6105]; node.flags.add(flags); } ; return this; } unflag(flags) { for (let \u03C6135 = 0, \u03C6144 = iter$__10(this[\u03C697]), \u03C6152 = \u03C6144.length; \u03C6135 < \u03C6152; \u03C6135++) { let node = \u03C6144[\u03C6135]; node.flags.remove(flags); } ; return this; } commit() { return this.dom.offsetWidth; } enable() { if (!(this[\u03C6163] != true ? (this[\u03C6163] = true, true) : false)) { return this; } ; this.dom[\u03C6214] = this[\u03C6214].bind(this); this.dom[\u03C639] = this[\u03C639].bind(this); return this.flags.add("_ease_"); } disable() { this.flags.unflag("_ease_"); return true; } set phase(val) { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; let prev = this[\u03C688]; if (this[\u03C688] != val ? (this[\u03C688] = val, true) : false) { if (prev) { this.flags.remove("_" + prev + "_"); } ; if (val) { this.flags.add("_" + val + "_"); } ; this.flags.toggle("_easing_", !!val); if (!val) { this.unflag("_out_"); this.unflag("_in_"); this.unflag("_off_"); this[\u03C697] = null; } ; if (val == "enter" && prev == "leave") { (_b = (_a = this.dom) == null ? void 0 : _a.transition\u039Eout\u039Ecancel) == null ? void 0 : _b.call(_a, this); } ; if (val == "leave" && prev == "enter") { (_d = (_c = this.dom) == null ? void 0 : _c.transition\u039Ein\u039Ecancel) == null ? void 0 : _d.call(_c, this); } ; if (val == "enter") { (_f = (_e = this.dom) == null ? void 0 : _e.transition\u039Ein) == null ? void 0 : _f.call(_e, this); } ; if (val == "leave") { (_h = (_g = this.dom) == null ? void 0 : _g.transition\u039Eout) == null ? void 0 : _h.call(_g, this); } ; if (prev == "leave" && !val) { (_j = (_i = this.dom) == null ? void 0 : _i.transition\u039Eout\u039Eend) == null ? void 0 : _j.call(_i, this); } ; if (prev == "enter" && !val) { (_l = (_k = this.dom) == null ? void 0 : _k.transition\u039Ein\u039Eend) == null ? void 0 : _l.call(_k, this); } ; } ; } get phase() { return this[\u03C688]; } get leaving\u03A6() { return this.phase == "leave"; } get entering\u03A6() { return this.phase == "enter"; } get idle\u03A6() { return this.phase == null; } track(cb) { var self = this; let anims = {before: get_document().getAnimations()}; this.commit(); cb(); this.commit(); anims.after = get_document().getAnimations(); anims.fresh = anims.after.filter(function(_0) { return anims.before.indexOf(_0) == -1; }); anims.deep = anims.fresh.filter(function(_0) { let el; if (el = _0.effect.target) { if (el.closest("._ease_") != self.dom) { return true; } ; } ; return false; }); anims.own = anims.fresh.filter(function(_0) { return anims.deep.indexOf(_0) == -1; }); anims.finished = Promise.all(anims.own.map(function(_0) { return _0.finished; })); return anims; } getAnimatedNodes() { return transitions.nodesForBase(this.dom); } [\u03C6214](parent, before) { var self = this; if (this.entering\u03A6) { return this.dom; } ; let finish = function() { if (self.entering\u03A6) { return self.phase = null; } ; }; if (this.leaving\u03A6) { let anims2 = this.track(function() { self.phase = "enter"; self.unflag("_off_"); return self.unflag("_out_"); }); anims2.finished.then(finish, function(_0) { return self.log("error cancel leave", _0); }); return this.dom; } ; let parConnected = get_document().contains(parent); let nodes = this[\u03C697] = this.getAnimatedNodes(); this.flag("_off_"); this.unflag("_out_"); this.flag("_in_"); before ? parent.insertBefore(this.dom, before) : parent.appendChild(this.dom); let anims = this[\u03C6174] = this.track(function() { self.phase = "enter"; self.unflag("_off_"); return self.unflag("_in_"); }); anims.finished.then(finish, function(_0) { return self.log("cancelled insert into", _0); }); return this.dom; } [\u03C639](parent) { var self = this; if (this.leaving\u03A6) { return; } ; let finalize = function() { if (self.phase == "leave") { parent.removeChild(self.dom); return self.phase = null; } ; }; if (this.entering\u03A6) { let anims2 = this.track(function() { self.flag("_off_"); self.flag("_in_"); self.unflag("_out_"); return self.phase = "leave"; }); anims2.finished.then(finalize, function(_0) { return self.log("error cancel entering", _0); }); return; } ; this[\u03C697] = this.getAnimatedNodes(); let anims = this[\u03C6174] = this.track(function() { self.phase = "leave"; self.flag("_off_"); return self.flag("_out_"); }); if (!anims.own.length) { finalize(); return; } ; anims.finished.then(finalize, function() { return true; }); return; } }; var Extend$Element$af3 = class { transition\u039Ein(transition) { return true; } transition\u039Ein\u039Eend(transition) { return true; } transition\u039Ein\u039Ecancel(transition) { return true; } transition\u039Eout(transition) { return true; } transition\u039Eout\u039Eend(transition) { return true; } transition\u039Eout\u039Ecancel(transition) { return true; } get ease() { return this[\u03C6183] || (this[\u03C6183] = new Easer(this)); } set ease(value) { var _a, _b; if (value == false) { (_b = (_a = this[\u03C6183]) == null ? void 0 : _a.disable) == null ? void 0 : _b.call(_a); return; } ; this.ease.enable(value); } }; extend$__4(Element.prototype, Extend$Element$af3.prototype); function use_dom_transitions() { return true; } function iter$__11(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } function extend$__5(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } var \u03C6120 = Symbol.for("#self"); var \u03C6310 = Symbol.for("#target"); var keyCodes = { esc: [27], tab: [9], enter: [13], space: [32], up: [38], down: [40], left: [37], right: [39], del: [8, 46] }; var events = {}; function use_events() { return true; } Event.log$mod = function(...params) { console.log(...params); return true; }; Event.sel$mod = function(expr) { return !!this.event.target.matches(String(expr)); }; Event.outside$mod = function() { if (this.handler && this.handler[\u03C6120]) { return !this.handler[\u03C6120].parentNode.contains(this.event.target); } ; return false; }; Event.if$mod = function(expr) { return !!expr; }; Event.wait$mod = function(time = 250) { return new Promise(function(_0) { return setTimeout(_0, parseTime(time)); }); }; Event.self$mod = function() { return this.event.target == this.element; }; Event.throttle$mod = function(time = 250) { var self = this; if (this.handler.throttled) { return false; } ; this.handler.throttled = true; this.element.flags.incr("throttled"); once(this.current, "end", function() { return setTimeout(function() { self.element.flags.decr("throttled"); return self.handler.throttled = false; }, parseTime(time)); }); return true; }; Event.debounce$mod = function(time = 250) { var self = this, \u03C6220; let queue = (\u03C6220 = this.state).debounced || (\u03C6220.debounced = []); queue.push(queue.last = this.event); return new Promise(function(resolve) { return setTimeout(function() { if (queue.last == self.event) { self.event.debounced = queue; self.handler.state = {}; return resolve(true); } else { return resolve(false); } ; }, parseTime(time)); }); }; Event.flag$mod = function(name, sel) { let el = sel instanceof Element ? sel : sel ? this.element.closest(sel) : this.element; if (!el) { return true; } ; let step = this.step; this.state[step] = this.id; el.flags.incr(name); let ts = Date.now(); once(this.current, "end", function() { let elapsed = Date.now() - ts; let delay = Math.max(250 - elapsed, 0); return setTimeout(function() { return el.flags.decr(name); }, delay); }); return true; }; Event.busy$mod = function(sel) { return Event.flag$mod.call(this, "busy", 250, sel); }; Event.mod$mod = function(name) { return Event.flag$mod.call(this, "mod-" + name, globalThis.document.documentElement); }; var EventHandler = class { constructor(params, closure) { this.params = params; this.closure = closure; } getHandlerForMethod(el, name) { if (!el) { return null; } ; return el[name] ? el : this.getHandlerForMethod(el.parentNode, name); } emit(name, ...params) { return emit(this, name, params); } on(name, ...params) { return listen(this, name, ...params); } once(name, ...params) { return once(this, name, ...params); } un(name, ...params) { return unlisten(this, name, ...params); } async handleEvent(event) { let target = event.target; let element = this[\u03C6310] || event.currentTarget; let mods = this.params; let i = 0; let awaited = false; let prevRes = void 0; this.count || (this.count = 0); this.state || (this.state = {}); let state = { element, event, modifiers: mods, handler: this, id: ++this.count, step: -1, state: this.state, commit: null, current: null }; state.current = state; if (event.handle$mod) { if (event.handle$mod.apply(state, mods.options || []) == false) { return; } ; } ; let guard = Event[this.type + "$handle"] || Event[event.type + "$handle"] || event.handle$mod; if (guard && guard.apply(state, mods.options || []) == false) { return; } ; this.currentEvents || (this.currentEvents = new Set()); this.currentEvents.add(event); for (let \u03C6410 = 0, \u03C659 = Object.keys(mods), \u03C6105 = \u03C659.length, handler, val; \u03C6410 < \u03C6105; \u03C6410++) { handler = \u03C659[\u03C6410]; val = mods[handler]; state.step++; if (handler[0] == "_") { continue; } ; if (handler.indexOf("~") > 0) { handler = handler.split("~")[0]; } ; let modargs = null; let ismod = false; let args = [event, state]; let res = void 0; let context = null; let m; let isstring = typeof handler == "string"; if (handler[0] == "$" && handler[1] == "_" && val[0] instanceof Function) { handler = val[0]; args = [event, state].concat(val.slice(1)); context = element; } else if (val instanceof Array) { args = val.slice(); modargs = args; for (let i2 = 0, \u03C669 = iter$__11(args), \u03C699 = \u03C669.length; i2 < \u03C699; i2++) { let par = \u03C669[i2]; if (typeof par == "string" && par[0] == "~" && par[1] == "$") { let name = par.slice(2); let chain = name.split("."); let value = state[chain.shift()] || event; for (let i3 = 0, \u03C679 = iter$__11(chain), \u03C6810 = \u03C679.length; i3 < \u03C6810; i3++) { let part = \u03C679[i3]; value = value ? value[part] : void 0; } ; args[i2] = value; } ; } ; } ; if (typeof handler == "string" && (m = handler.match(/^(emit|flag|mod|moved|pin|fit|refit|map|remap|css)-(.+)$/))) { if (!modargs) { modargs = args = []; } ; args.unshift(m[2]); handler = m[1]; } ; if (handler == "stop") { event.stopImmediatePropagation(); } else if (handler == "prevent") { event.preventDefault(); } else if (handler == "commit") { state.commit = true; } else if (handler == "silence" || handler == "silent") { state.commit = false; } else if (handler == "ctrl") { if (!event.ctrlKey) { break; } ; } else if (handler == "alt") { if (!event.altKey) { break; } ; } else if (handler == "shift") { if (!event.shiftKey) { break; } ; } else if (handler == "meta") { if (!event.metaKey) { break; } ; } else if (handler == "once") { element.removeEventListener(event.type, this); } else if (handler == "options") { continue; } else if (keyCodes[handler]) { if (keyCodes[handler].indexOf(event.keyCode) < 0) { break; } ; } else if (handler == "emit") { let name = args[0]; let detail = args[1]; let e = new CustomEvent(name, {bubbles: true, detail}); e.originalEvent = event; let customRes = element.dispatchEvent(e); } else if (typeof handler == "string") { let fn = this.type && Event[this.type + "$" + handler + "$mod"]; fn || (fn = event[handler + "$mod"] || Event[event.type + "$" + handler] || Event[handler + "$mod"]); if (fn instanceof Function) { handler = fn; context = state; args = modargs || []; ismod = true; } else if (handler[0] == "_") { handler = handler.slice(1); context = this.closure; } else { context = this.getHandlerForMethod(element, handler); } ; } ; if (handler instanceof Function) { res = handler.apply(context || element, args); } else if (context) { res = context[handler].apply(context, args); } ; if (state.commit === null && !ismod) { state.commit = true; } ; if (res && res.then instanceof Function && res != scheduler.$promise) { if (state.commit) { scheduler.commit(); } ; awaited = true; res = await res; } ; if (res === false) { break; } ; state.value = res; } ; emit(state, "end", state); if (state.commit) { scheduler.commit(); } ; this.currentEvents.delete(event); if (this.currentEvents.size == 0) { this.emit("idle"); } ; return; } }; var Extend$Element$af4 = class { on$(type, mods, scope) { let check = "on$" + type; let handler; handler = new EventHandler(mods, scope); let capture = mods.capture; let passive = mods.passive; let o = capture; if (passive) { o = {passive, capture}; } ; if (this[check] instanceof Function) { handler = this[check](mods, scope, handler, o); } else { this.addEventListener(type, handler, o); } ; return handler; } }; extend$__5(Element.prototype, Extend$Element$af4.prototype); function iter$__12(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } function extend$__6(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function use_events_intersect() { return true; } var observers = new (globalThis.WeakMap || Map)(); var IntersectionEventDefaults = {threshold: [0]}; var viewport = {}; Event.intersect$handle = function() { let obs = this.event.detail.observer; return this.modifiers._observer == obs; }; Event.intersect$in = function() { return this.event.delta >= 0 && this.event.entry.isIntersecting; }; Event.intersect$out = function() { return this.event.delta < 0; }; Event.intersect$css = function() { this.element.style.setProperty("--ratio", this.event.ratio); return true; }; function callback(name, key) { return function(entries, observer) { let map = observer.prevRatios || (observer.prevRatios = new WeakMap()); for (let \u03C6127 = 0, \u03C6220 = iter$__12(entries), \u03C6312 = \u03C6220.length; \u03C6127 < \u03C6312; \u03C6127++) { let entry = \u03C6220[\u03C6127]; let prev = map.get(entry.target) || 0; let ratio = entry.intersectionRatio; let detail = {entry, ratio, from: prev, delta: ratio - prev, observer}; let e = new CustomEvent2(name, {bubbles: false, detail}); e.entry = entry; e.isIntersecting = entry.isIntersecting; e.delta = detail.delta; e.ratio = detail.ratio; map.set(entry.target, ratio); entry.target.dispatchEvent(e); } ; return; }; } function getIntersectionObserver(opts = IntersectionEventDefaults) { let key = opts.threshold.join("-") + opts.rootMargin; if (!opts.root && IntersectionEventDefaults.root) { opts.root || (opts.root = IntersectionEventDefaults.root); } ; let target = opts.root || viewport; let map = observers.get(target); map || observers.set(target, map = {}); return map[key] || (map[key] = new IntersectionObserver(callback("intersect", key), opts)); } var Extend$Element$af5 = class { on$intersect(mods, context, handler, o) { let obs; if (mods.options) { let th = []; let opts = {threshold: th}; for (let \u03C6410 = 0, \u03C659 = iter$__12(mods.options), \u03C669 = \u03C659.length; \u03C6410 < \u03C669; \u03C6410++) { let arg = \u03C659[\u03C6410]; if (arg instanceof Element || arg instanceof Document) { opts.root = arg; } else if (typeof arg == "number") { th.push(arg); } else if (typeof arg == "string") { opts.rootMargin = arg; } else if (typeof arg == "object") { Object.assign(opts, arg); } ; } ; if (th.length == 1) { let num = th[0]; if (num > 1) { th[0] = 0; while (th.length < num) { th.push(th.length / (num - 1)); } ; } ; } ; if (th.length == 0) { th.push(0); } ; obs = getIntersectionObserver(opts); } else { obs = getIntersectionObserver(); } ; mods._observer = obs; obs.observe(this); this.addEventListener("intersect", handler, o); return handler; } }; extend$__6(Element.prototype, Extend$Element$af5.prototype); function extend$__7(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function use_events_pointer() { return true; } function round(val, step = 1) { let inv = 1 / step; return Math.round(val * inv) / inv; } function clamp(val, min, max) { if (min > max) { return Math.max(max, Math.min(min, val)); } else { return Math.min(max, Math.max(min, val)); } ; } function parseDimension(val) { if (typeof val == "string") { let [m, num, unit] = val.match(/^([-+]?[\d\.]+)(%|\w+)$/); return [parseFloat(num), unit]; } else if (typeof val == "number") { return [val]; } ; } function scale(a0, a1, b0r, b1r, s = 0.1) { let [b0, b0u] = parseDimension(b0r); let [b1, b1u] = parseDimension(b1r); let [sv, su] = parseDimension(s); if (b0u == "%") { b0 = (a1 - a0) * (b0 / 100); } ; if (b1u == "%") { b1 = (a1 - a0) * (b1 / 100); } ; if (su == "%") { sv = (b1 - b0) * (sv / 100); } ; return function(value, fit) { let pct = (value - a0) / (a1 - a0); let val = b0 + (b1 - b0) * pct; if (s) { val = round(val, sv); } ; if (fit) { val = clamp(val, b0, b1); } ; return val; }; } var Extend$PointerEvent$af = class { primary$mod() { return !!this.event.isPrimary; } mouse$mod() { return this.event.pointerType == "mouse"; } pen$mod() { return this.event.pointerType == "pen"; } touch$mod() { return this.event.pointerType == "touch"; } pressure$mod(threshold = 0) { return this.event.pressure > threshold; } lock$mod(dr) { return true; } }; extend$__7(PointerEvent.prototype, Extend$PointerEvent$af.prototype); var Touch = class { constructor(e, handler, el) { this.phase = "init"; this.events = []; this.originalEvent = e; this.handler = handler; this.target = this.currentTarget = el; } set event(value) { this.events.push(value); } get ctrlKey() { return this.originalEvent.ctrlKey; } get altKey() { return this.originalEvent.altKey; } get shiftKey() { return this.originalEvent.shiftKey; } get metaKey() { return this.originalEvent.metaKey; } get isPrimary() { return this.originalEvent.isPrimary; } get pointerType() { return this.originalEvent.pointerType; } get start() { return this.originalEvent; } get originalTarget() { return this.originalEvent.target; } get event() { return this.events[this.events.length - 1]; } get elapsed() { return this.event.timeStamp - this.events[0].timeStamp; } get pointerId() { return this.event.pointerId; } get clientX() { return this.event.clientX; } get clientY() { return this.event.clientY; } get offsetX() { return this.event.offsetX; } get offsetY() { return this.event.offsetY; } get type() { return this.event.type; } get active\u03A6() { return this.phase != "ended"; } stopImmediatePropagation() { this.cancelBubble = true; this.event.stopImmediatePropagation(); return this; } stopPropagation() { this.cancelBubble = true; this.event.stopPropagation(); return this; } preventDefault() { this.defaultPrevented = true; return this.event.preventDefault(); } emit(name, ...params) { return emit(this, name, params); } on(name, ...params) { return listen(this, name, ...params); } once(name, ...params) { return once(this, name, ...params); } un(name, ...params) { return unlisten(this, name, ...params); } }; Event.touch$in$mod = function() { return Event.touch$reframe$mod.apply(this, arguments); }; Event.touch$fit$mod = function() { var \u03C6220, \u03C6127; let o = (\u03C6220 = this.state)[\u03C6127 = this.step] || (\u03C6220[\u03C6127] = {clamp: true}); return Event.touch$reframe$mod.apply(this, arguments); }; Event.touch$round$mod = function(sx = 1, sy = sx) { this.event.x = round(this.event.x, sx); this.event.y = round(this.event.y, sy); return true; }; Event.touch$snap$mod = function(sx = 1, sy = sx) { this.event.x = round(this.event.x, sx); this.event.y = round(this.event.y, sy); return true; }; Event.touch$moved$mod = function(a, b) { var self = this, \u03C6410, \u03C6312; let o = (\u03C6410 = this.state)[\u03C6312 = this.step] || (\u03C6410[\u03C6312] = {}); if (!o.setup) { let th2 = a || 4; if (typeof a == "string" && a.match(/^(up|down|left|right|x|y)$/)) { o.dir = a; th2 = b || 4; } ; o.setup = true; let [tv, tu] = parseDimension(th2); o.threshold = tv; o.sy = tv; o.x0 = this.event.x; o.y0 = this.event.y; if (tu && tu != "px") { console.warn("only px threshold allowed in @touch.moved"); } ; } ; if (o.active) { return true; } ; let th = o.threshold; let dx = this.event.x - o.x0; let dy = this.event.y - o.y0; let hit = false; if (dx > th && (o.dir == "right" || o.dir == "x")) { hit = true; } ; if (!hit && dx < -th && (o.dir == "left" || o.dir == "x")) { hit = true; } ; if (!hit && dy > th && (o.dir == "down" || o.dir == "y")) { hit = true; } ; if (!hit && dy < -th && (o.dir == "up" || o.dir == "y")) { hit = true; } ; if (!hit) { let dr = Math.sqrt(dx * dx + dy * dy); if (dr > th && !o.dir) { hit = true; } ; } ; if (hit) { o.active = true; let pinned = this.state.pinTarget; this.element.flags.incr("_move_"); if (pinned) { pinned.flags.incr("_move_"); } ; once(this.current, "end", function() { if (pinned) { pinned.flags.decr("_move_"); } ; return self.element.flags.decr("_move_"); }); } ; return !!o.active; }; Event.touch$reframe$mod = function(...params) { var \u03C669, \u03C659; let o = (\u03C669 = this.state)[\u03C659 = this.step] || (\u03C669[\u03C659] = {}); if (!o.rect) { let el = this.element; let len = params.length; let box = params[0]; let min = 0; let max = "100%"; let snap = 1; let typ = typeof box; if (typ == "number" || typ == "string" && /^([-+]?\d[\d\.]*)(%|\w+)$/.test(box) || box instanceof Array) { box = null; } else if (typ == "string") { if (box == "this" || box == "") { box = this.element; } else if (box == "up") { box = this.element.parentNode; } else if (box == "op") { box = this.element.offsetParent; } else { box = el.closest(box) || el.querySelector(box); } ; } ; if (box == null) { len++; params.unshift(box = el); } ; if (len == 2) { snap = params[1]; } else if (len > 2) { [min, max, snap = 1] = params.slice(1); } ; let rect = box.getBoundingClientRect(); if (!(min instanceof Array)) { min = [min, min]; } ; if (!(max instanceof Array)) { max = [max, max]; } ; if (!(snap instanceof Array)) { snap = [snap, snap]; } ; o.rect = rect; o.x = scale(rect.left, rect.right, min[0], max[0], snap[0]); o.y = scale(rect.top, rect.bottom, min[1], max[1], snap[1]); this.state.scaleX = o.x; this.state.scaleY = o.y; this.event.x0 = this.event.x = o.x(this.event.x, o.clamp); this.event.y0 = this.event.y = o.y(this.event.y, o.clamp); } else { let x = this.event.x = o.x(this.event.x, o.clamp); let y = this.event.y = o.y(this.event.y, o.clamp); this.event.dx = x - this.event.x0; this.event.dy = y - this.event.y0; } ; return true; }; Event.touch$pin$mod = function(...params) { let o = this.state[this.step]; if (!o) { let box = params[0]; if (typeof box == "string") { box = this.element.closest(box) || this.element.querySelector(box); } ; if (!(box instanceof Element)) { params.unshift(box = this.state.target); } ; let ax = params[1] || 0; let ay = params[2] == null ? params[2] = ax : params[2]; let rect = box.getBoundingClientRect(); o = this.state[this.step] = { x: this.state.clientX - (rect.left + rect.width * ax), y: this.state.clientY - (rect.top + rect.height * ay) }; if (box) { this.state.pinTarget = box; box.flags.incr("_touch_"); this.state.once("end", function() { return box.flags.decr("_touch_"); }); } ; } ; this.event.x -= o.x; this.event.y -= o.y; return true; }; Event.touch$lock$mod = function(...params) { let o = this.state[this.step]; if (!o) { o = this.state[this.step] = this.state.target.style; let prev = o.touchAction; o.touchAction = "none"; this.state.once("end", function() { return o.removeProperty("touch-action"); }); } ; return true; }; Event.touch$sync$mod = function(item, xalias = "x", yalias = "y") { let o = this.state[this.step]; if (!o) { o = this.state[this.step] = { x: item[xalias] || 0, y: item[yalias] || 0, tx: this.state.x, ty: this.state.y }; } ; if (this.commit === null) { this.commit = true; } ; if (xalias) { item[xalias] = o.x + (this.state.x - o.tx); } ; if (yalias) { item[yalias] = o.y + (this.state.y - o.ty); } ; return true; }; function isIOS() { let nav = globalThis.navigator.platform || ""; if (nav.match(/iPhone|iPod|iPad/)) { return true; } ; if (nav == "MacIntel" && globalThis.navigator.maxTouchPoints > 2) { return true; } ; return false; } var Extend$Element$ag = class { on$touch(mods, context, handler, o) { handler.type = "touch"; handler.isIOS = isIOS(); this.addEventListener("pointerdown", handler, o); if (handler.isIOS && !mods.passive) { this.addEventListener("touchstart", handler); } ; return handler; } }; extend$__7(Element.prototype, Extend$Element$ag.prototype); Event.touch$handle = function() { var self = this, \u03C679; let e = this.event; let el = this.element; let id = this.state.pointerId; let m = this.modifiers; this.current = this.state; if (e.type == "touchstart") { try { if (id && id == e.targetTouches[0].identifier) { e.preventDefault(); } ; } catch (e2) { } ; return false; } ; if (id != void 0) { return id == e.pointerId; } ; if (m.ctrl && !e.ctrlKey) { return; } ; if (m.alt && !e.altKey) { return; } ; if (m.meta && !e.metaKey) { return; } ; if (m.shift && !e.shiftKey) { return; } ; if (m.if && !!m.if[0] == false) { return; } ; if (m.self && e.target != el) { return; } ; if (m.primary && !e.isPrimary) { return; } ; if (m.pen && e.pointerType != "pen") { return; } ; if (m.mouse && e.pointerType != "mouse") { return; } ; if (m.touch && e.pointerType != "touch") { return; } ; if (m.sel && !e.target.matches(String(m.sel[0]))) { return; } ; let t = this.state = this.handler.state = this.current = new Touch(e, this.handler, el); let canceller = function(e2) { e2.preventDefault(); return false; }; let listener = function(e2) { let typ = e2.type; let ph = t.phase; t.event = e2; let end = typ == "pointerup" || typ == "pointercancel"; if (typ != "pointercancel") { t.x = e2.clientX; t.y = e2.clientY; } ; if (end) { t.phase = "ended"; } ; try { self.handler.handleEvent(t); } catch (e3) { } ; if (ph == "init") { t.phase = "active"; } ; if (end && !self.handler.isIOS) { return el.releasePointerCapture(e2.pointerId); } ; }; let disposed = false; let teardown = function(e2) { if (disposed) { return; } ; el.flags.decr("_touch_"); t.emit("end"); if (!m.passive) { if (--self.handler.prevents == 0) { el.style.removeProperty("touch-action"); } ; } ; self.handler.state = {}; el.removeEventListener("pointermove", listener); el.removeEventListener("pointerup", listener); el.removeEventListener("pointercancel", listener); globalThis.document.removeEventListener("selectstart", canceller, {capture: true}); return disposed = true; }; if (!m.passive) { (\u03C679 = this.handler).prevents || (\u03C679.prevents = 0); this.handler.prevents++; el.style.setProperty("touch-action", "none"); el.offsetWidth; } ; el.flags.incr("_touch_"); el.addEventListener("pointermove", listener); el.addEventListener("pointerup", listener); el.addEventListener("pointercancel", listener); el.addEventListener("lostpointercapture", teardown, {once: true}); if (!this.handler.isIOS) { el.setPointerCapture(e.pointerId); } ; globalThis.document.addEventListener("selectstart", canceller, {capture: true}); listener(e); return false; }; function iter$__13(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } function extend$__8(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function use_events_resize() { return true; } var resizeObserver = null; function getResizeObserver() { if (!globalThis.ResizeObserver) { if (!resizeObserver) { console.warn(":resize not supported in this browser"); resizeObserver = {observe: function() { return true; }}; } ; } ; return resizeObserver || (resizeObserver = new ResizeObserver(function(entries) { for (let \u03C6127 = 0, \u03C6220 = iter$__13(entries), \u03C6312 = \u03C6220.length; \u03C6127 < \u03C6312; \u03C6127++) { let entry = \u03C6220[\u03C6127]; let e = new CustomEvent2("resize", {bubbles: false, detail: entry}); e.entry = entry; e.rect = entry.contentRect; e.width = entry.target.offsetWidth; e.height = entry.target.offsetHeight; entry.target.dispatchEvent(e); let e2 = new CustomEvent2("resized", {bubbles: true, detail: entry}); entry.target.dispatchEvent(e2); } ; return; })); } var Extend$Element$af6 = class { on$resize(chain, context, handler, o) { getResizeObserver().observe(this); this.addEventListener("resize", handler, o); return handler; } }; extend$__8(Element.prototype, Extend$Element$af6.prototype); function extend$__9(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } function use_events_selection() { return true; } var selHandler; var handledSym = Symbol(); function activateSelectionHandler() { if (!selHandler) { selHandler = function(e) { if (e[handledSym]) { return; } ; e[handledSym] = true; let target = globalThis.document.activeElement; if (target && target.matches("input,textarea")) { let custom = new CustomEvent2("selection", { detail: { start: target.selectionStart, end: target.selectionEnd } }); return target.dispatchEvent(custom); } ; }; return globalThis.document.addEventListener("selectionchange", selHandler); } ; } var Extend$Element$af7 = class { on$selection(mods, context, handler, o) { activateSelectionHandler(); this.addEventListener("selection", handler, o); return handler; } }; extend$__9(Element.prototype, Extend$Element$af7.prototype); var import_events = __toModule(require_events()); var \u03C6121 = Symbol.for("#getQueryParam"); var \u03C6215 = Symbol.for("#setQueryParam"); var \u03C667 = Symbol.for("#query"); var Location = class { static parse(url, router2) { if (url instanceof Location) { return url; } ; return new Location(url, router2); } constructor(url, router2) { this.router = router2; this.parse(url); } parse(url) { var _a; let alias; if (!(url instanceof URL)) { url = new URL(url, this.router.origin); } ; if (alias = (_a = this.router) == null ? void 0 : _a.aliases[url.pathname]) { url.pathname = alias; } ; this.url = url; return this; } get active\u03A6() { return this.router.location == this; } reparse() { return this.parse(this.url); } get searchParams() { return this.url.searchParams; } search() { let str = this.searchParams ? this.searchParams.toString() : ""; return str ? "?" + str : ""; } update(value) { if (value instanceof Object) { for (let \u03C6312 = 0, \u03C6410 = Object.keys(value), \u03C659 = \u03C6410.length, k, v; \u03C6312 < \u03C659; \u03C6312++) { k = \u03C6410[\u03C6312]; v = value[k]; this.searchParams.set(k, v); } ; } else if (typeof value == "string") { this.parse(value); } ; return this; } clone() { return new Location(this.url.href, this.router); } equals(other) { return this.toString() == String(other); } get href() { return this.url.href; } get path() { return this.url.href.slice(this.url.origin.length); } get pathname() { return this.url.pathname; } get query() { return this[\u03C667] || (this[\u03C667] = new Proxy({}, { get: this[\u03C6121].bind(this), set: this[\u03C6215].bind(this) })); } toString() { return this.href; } [\u03C6121](target, name) { return this.searchParams.get(name); } [\u03C6215](target, name, value) { let curr = this[\u03C6121](target, name); if (curr != value) { if (value == null || value == "") { this.searchParams.delete(name); } else { this.searchParams.set(name, value); } ; if (this.active\u03A6) { this.router.history.replaceState({}, null, this.url.toString()); this.router.touch(); } ; } ; return true; } }; var Request = class { constructor(router2, loc, referrer) { this.router = router2; if (loc) { this.location = Location.parse(loc); this.original = this.location.clone(); } ; this.referrer = referrer; } redirect(path) { var _a, _b; (_b = (_a = this.location) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, path); return this; } get path() { var _a; return (_a = this.location) == null ? void 0 : _a.path; } get url() { var _a, _b; return (_b = (_a = this.location) == null ? void 0 : _a.toString) == null ? void 0 : _b.call(_a); } set path(value) { this.location.path = value; } abort(forced = false) { this.aborted = true; if (forced) { this.forceAbort = forced; } ; return this; } match(str) { return this.location ? this.router.route(str).match(this.path) : null; } }; function iter$__14(a) { let v; return a ? (v = a.toIterable) ? v.call(a) : a : []; } var \u03C6124 = Symbol.for("#routes"); var \u03C6216 = Symbol.for("#match"); var \u03C648 = Symbol.for("#symbol"); var \u03C657 = Symbol.for("#matches"); var cacheMap = new Map(); var urlCache = {}; var queryCache = {}; function cacheForMatch(match) { if (!cacheMap.has(match)) { let map = new Map(); cacheMap.set(match, map); return map; } ; return cacheMap.get(match); } function combinedDeepMatch(parent, params) { let map = cacheForMatch(parent); if (!map.has(params)) { let item = Object.create(parent); Object.assign(item, params); map.set(params, item); return item; } ; return map.get(params); } var Match = class { }; function parseUrl(str) { if (urlCache[str]) { return urlCache[str]; } ; let url = urlCache[str] = {url: str}; let qryidx = str.indexOf("?"); let hshidx = str.indexOf("#"); if (hshidx >= 0) { url.hash = str.slice(hshidx + 1); str = url.url = str.slice(0, hshidx); } ; if (qryidx >= 0) { let q = url.query = str.slice(qryidx + 1); str = str.slice(0, qryidx); url.query = queryCache[q] || (queryCache[q] = new URLSearchParams(q)); } ; url.path = str; return url; } var RootRoute = class { constructor(router2) { this.router = router2; this.fullPath = ""; this[\u03C6124] = {}; this[\u03C6216] = new Match(); this[\u03C6216].path = ""; } route(pattern) { var \u03C6312; return (\u03C6312 = this[\u03C6124])[pattern] || (\u03C6312[pattern] = new Route(this.router, pattern, this)); } match() { return this[\u03C6216]; } resolve(url) { return "/"; } }; var Route = class { constructor(router2, str, parent) { this.parent = parent || router2.rootRoute; this.router = router2; this.status = 200; this.path = str; this[\u03C648] = Symbol(); this[\u03C657] = {}; this[\u03C6124] = {}; } route(pattern) { var \u03C669; return (\u03C669 = this[\u03C6124])[pattern] || (\u03C669[pattern] = new Route(this.router, pattern, this)); } get fullPath() { return "" + this.parent.fullPath + "/" + this.$path; } load(cb) { return this.router.queue.add(cb); } set path(path) { var self = this; if (this.$path == path) { return; } ; this.raw = path; this.$path = path; this.groups = []; this.cache = {}; this.dynamic = false; if (path.indexOf("?") >= 0) { let parts = path.split("?"); path = parts.shift(); this.query = {}; for (let \u03C679 = 0, \u03C6810 = iter$__14(parts.join("?").split("&")), \u03C699 = \u03C6810.length; \u03C679 < \u03C699; \u03C679++) { let pair = \u03C6810[\u03C679]; if (!pair) { continue; } ; let [k, v] = pair.split("="); if (k[0] == "!") { this.dynamic = true; k = k.slice(1); v = false; } ; if (v === "") { v = false; } ; if (v && v[0] == ":") { this.dynamic = true; } ; this.query[k] = v || (v === false ? false : true); } ; } ; path = path.replace(/\:(\w+|\*)(\.)?/g, function(m, id, dot) { self.dynamic = true; if (id != "*") { self.groups.push(id); } ; if (dot) { return "([^/#.?]+)."; } else { return "([^/#?]+)"; } ; }); if (path == "" && this.query) { return; } ; path = "^" + path; let end = path[path.length - 1]; if (end == "$") { path = path.slice(0, -1) + "(?=/?[#?]|/?$)"; } ; if (end != "/" && end != "$" && path != "^/") { path = path + "(?=[/#?]|$)"; } ; this.regex = new RegExp(path); this; } match(str = this.router.path) { var _a, _b; var match, \u03C6165; let up = this.parent.match(str); if (!up) { return null; } ; let url = parseUrl(str); let matcher = url.url; let prefix = ""; if (up.path && url.path.indexOf(up.path) == 0) { prefix = up.path + "/"; matcher = matcher.slice(prefix.length); } ; if (match = this.regex ? matcher.match(this.regex) : [""]) { let fullpath = prefix + match[0]; let matchid = [this.$path]; let params = {}; if (this.groups.length) { for (let i = 0, \u03C6105 = iter$__14(match), \u03C61111 = \u03C6105.length, name; i < \u03C61111; i++) { let item = \u03C6105[i]; if (name = this.groups[i - 1]) { params[name] = item; matchid.push(item); } ; } ; } ; if (this.query) { for (let \u03C6144 = this.query, \u03C6127 = 0, \u03C6135 = Object.keys(\u03C6144), \u03C6152 = \u03C6135.length, k, v; \u03C6127 < \u03C6152; \u03C6127++) { k = \u03C6135[\u03C6127]; v = \u03C6144[k]; let name = k; let m = (_b = (_a = url.query) == null ? void 0 : _a.get) == null ? void 0 : _b.call(_a, k); if (v === false) { if (m) { return null; } ; matchid.push("1"); continue; } ; if (v[0] == ":") { name = v.slice(1); v = true; } ; if (v == true && m || v == m) { params[name] = m; matchid.push(m); } else { return null; } ; } ; } ; let key = matchid.join("*"); params = (\u03C6165 = this[\u03C657])[key] || (\u03C6165[key] = params); let result = combinedDeepMatch(up, params); result.path = fullpath; return result; } ; return null; } resolve(url = this.router.path) { if (this.raw[0] == "/" && !this.dynamic) { return this.raw.replace(/\$/g, ""); } ; let up = this.parent.match(url); let upres = this.parent.resolve(url); let out; if (this.dynamic) { let m = this.match(url); if (m) { return m.path; } else { return null; } ; } ; if (this.raw[0] == "?") { out = (upres || "/") + this.raw; } else { out = upres + "/" + this.raw; } ; return out.replace(/\$/g, "").replace(/\/\/+/g, "/"); } }; var \u03C6125 = Symbol.for("#idler"); var \u03C6217 = Symbol.for("#resolve"); var Queue = class extends Set { constructor() { super(); this[\u03C6125] = Promise.resolve(this); } emit(name, ...params) { return emit(this, name, params); } on(name, ...params) { return listen(this, name, ...params); } once(name, ...params) { return once(this, name, ...params); } un(name, ...params) { return unlisten(this, name, ...params); } add(value) { var self = this; if (value instanceof Function) { value = value(); } ; if (!this.has(value)) { value.then(function() { return self.delete(value); }); let first = this.size == 0; super.add(value); if (first) { this[\u03C6125] = this[\u03C6217] = null; this.emit("busy", this); } ; } ; return value; } delete(value) { if (super.delete(value)) { if (this.size == 0) { if (this[\u03C6217]) { this[\u03C6217](this); this[\u03C6217] = null; } ; this.emit("idle", this); } ; return true; } ; return false; } get idle() { var self = this; return this[\u03C6125] || (this[\u03C6125] = new Promise(function(resolve) { return self[\u03C6217] = resolve; })); } }; function extend$__10(target, ext) { var descriptors = Object.getOwnPropertyDescriptors(ext); Object.defineProperties(target, descriptors); return target; } var \u03C6126 = Symbol.for("#enter"); var \u03C6218 = Symbol.for("#resolved"); var \u03C6311 = Symbol.for("#leave"); var \u03C649 = Symbol.for("#router"); var \u03C658 = Symbol.for("#routes"); var \u03C668 = Symbol.for("#version"); var \u03C678 = Symbol.for("#doc"); var \u03C689 = Symbol.for("#origin"); var \u03C698 = Symbol.for("#request"); var \u03C6104 = Symbol.for("#hash"); var \u03C61110 = Symbol.for("#routeTo"); var \u03C6164 = Symbol.for("#path"); var \u03C6175 = Symbol.for("#match"); var \u03C6184 = Symbol.for("#options"); var \u03C6192 = Symbol.for("#cache"); var \u03C6203 = Symbol.for("#unmatched"); var \u03C6219 = Symbol.for("#active"); var \u03C6223 = Symbol.for("#resolvedPath"); var \u03C6233 = Symbol.for("#dataKey"); var \u03C6242 = Symbol.for("#activeKey"); var \u03C6252 = Symbol.for("#urlKey"); var \u03C6262 = Symbol.for("#dataMap"); var \u03C6272 = Symbol.for("#href"); var \u03C6282 = Symbol.for("#route"); var \u03C6292 = Symbol.for("#context"); var \u03C630 = Symbol.for("#afterVisit"); var \u03C631 = Symbol.for("#routeHandler"); var \u03C6322 = Symbol.for("#attachToParent"); var \u03C6332 = Symbol.for("#detachFromParent"); var Extend$Document$af2 = class { get router() { return this[\u03C649] || (this[\u03C649] = new Router(this)); } }; extend$__10(Document.prototype, Extend$Document$af2.prototype); function use_router() { return true; } var router = proxy(function() { return globalThis.document.router; }); var Router = class extends import_events.EventEmitter { constructor(doc, o = {}) { super(); this[\u03C658] = {}; this.aliases = {}; this.redirects = {}; this.rules = {}; this.options = o; this.busy = []; this[\u03C668] = 0; this[\u03C678] = doc; this.queue = new Queue(); this.web\u03A6 = !!doc.defaultView; this.root = new RootRoute(this); this.history = globalThis.window.history; this.location = new Location(o.url || doc.location.href, this); this.mode = o.mode || "history"; this.queue.on("busy", function() { return globalThis.document.flags.incr("_routing_"); }); this.queue.on("idle", function() { globalThis.document.flags.decr("_routing_"); return commit(); }); this.setup(); this; } get origin() { return this[\u03C689] || (this[\u03C689] = this[\u03C678].location.origin); } get query() { return this.location.query; } init() { this.refresh({mode: "replace"}); return this; } alias(from, to) { this.aliases[from] = to; this.location.reparse(); return this; } touch() { return this[\u03C668]++; } option(key, value) { if (value == void 0) { return this.options[key]; } else { this.options[key] = value; } ; return this; } get realpath() { let loc = this[\u03C678].location; return loc.href.slice(loc.origin.length); } get state() { return {}; } get ctx() { return this[\u03C698]; } pushState(state, title, url) { return this.history.pushState(state, title || null, String(url)); } replaceState(state, title, url) { return this.history.replaceState(state, title || null, String(url)); } refresh(params = {}) { var self = this; if (this.refreshing) { return; } ; this.refreshing = true; let original = this.location; let loc = Location.parse(params.location || this.realpath, this); let mode = params.mode; let prev = this[\u03C698]; if (!loc.equals(original) || !prev) { let req = new Request(this, loc, original); req.mode = mode; this[\u03C698] = req; this.emit("beforechange", req); if (req.aborted) { let res = !req.forceAbort && globalThis.window.confirm("Are you sure you want to leave? You might have unsaved changes"); if (res) { req.aborted = false; } else if (mode == "pop") { this.pushState(this.state, null, String(original)); } else if (mode == "replace") { this.replaceState(this.state, null, String(original)); } ; } ; if (!req.aborted) { this.location = req.location; if (mode == "push") { this.pushState(params.state || this.state, null, String(this.location)); } else if (mode == "replace") { this.replaceState(params.state || this.state, null, String(this.location)); } ; this.location.state = globalThis.window.history.state; this.emit("change", req); this.touch(); commit(); } ; } ; scheduler.add(function() { let hash = self[\u03C678].location.hash; if (hash != self[\u03C6104]) { return self.emit("hashchange", self[\u03C6104] = hash); } ; }); this.refreshing = false; return this; } onpopstate(e) { this.refresh({pop: true, mode: "pop"}); return this; } onbeforeunload(e) { let req = new Request(this, null, this.location); this.emit("beforechange", req); if (req.aborted) { return true; } ; return; } onhashchange(e) { this.emit("hashchange", this[\u03C6104] = this[\u03C678].location.hash); return commit(); } setup() { this.onclick = this.onclick.bind(this); this.onhashchange = this.onhashchange.bind(this); let win = globalThis.window; this[\u03C6104] = this[\u03C678].location.hash; this.location = Location.parse(this.realpath, this); this.history.replaceState(this.state, null, String(this.location)); win.onpopstate = this.onpopstate.bind(this); win.onbeforeunload = this.onbeforeunload.bind(this); win.addEventListener("hashchange", this.onhashchange); win.addEventListener("click", this.onclick, {capture: true}); win.document.documentElement.emit("routerinit", this); this.refresh; return this; } onclick(e) { if (e.metaKey || e.altKey) { return; } ; let a = null; let r = null; let t = e.target; while (t && (!a || !r)) { if (!a && t.nodeName == "A") { a = t; } ; if (!r && t[\u03C61110]) { r = t; } ; t = t.parentNode; } ; if (a && r != a && (!r || r.contains(a))) { let href = a.getAttribute("href"); if (href && !href.match(/\:\/\//) && !a.getAttribute("target") && !a.classList.contains("external")) { a.addEventListener("click", this.onclicklink.bind(this), {once: true}); } ; } ; return true; } onclicklink(e) { let a = e.currentTarget || e.target; if (a[\u03C61110]) { a[\u03C61110].resolve(); } ; let href = a.getAttribute("href"); let url = new URL(a.href); let target = url.href.slice(url.origin.length); let currpath = this.realpath.split("#")[0]; let newpath = target.split("#")[0]; if (currpath == newpath) { globalThis.document.location.hash = url.hash; } else if (a[\u03C61110]) { a[\u03C61110].go(); } else { this.go(target); } ; e.stopPropagation(); return e.preventDefault(); } get url() { return this.location.url; } get path() { let path = this.location.path; return this.aliases[path] || path; } get pathname() { return this.location.pathname; } serializeParams(params) { var \u03C6127; if (params instanceof Object) { \u03C6127 = []; for (let \u03C6135 = 0, \u03C6144 = Object.keys(params), \u03C6152 = \u03C6144.length, key, val; \u03C6135 < \u03C6152; \u03C6135++) { key = \u03C6144[\u03C6135]; val = params[key]; \u03C6127.push([key, globalThis.encodeURI(val)].join("=")); } ; let value = \u03C6127; return value.join("&"); } ; return params || ""; } get hash() { return this[\u03C6104]; } set hash(value) { this.history.replaceState({}, null, "#" + this.serializeParams(value)); } match(pattern) { return this.route(pattern).match(this.path); } route(pattern) { return this.root.route(pattern); } go(url, state = {}) { let loc = this.location.clone().update(url, state); this.refresh({push: true, mode: "push", location: loc, state}); return this; } replace(url, state = {}) { let loc = this.location.clone().update(url, state); return this.refresh({replace: true, mode: "replace", location: loc, state}); } }; var ElementRoute = class { constructor(node, path, parent, options = {}) { this.parent = parent; this.node = node; this[\u03C6164] = path; this[\u03C6175] = null; this[\u03C6184] = options; this[\u03C6192] = {}; this[\u03C6203] = {}; this[\u03C6219] = null; this[\u03C6223] = null; this[\u03C6233] = Symbol(); this[\u03C6242] = Symbol(); this[\u03C6252] = Symbol(); } get router() { return this.node.ownerDocument.router; } get route() { let pr = this.parent ? this.parent.route : this.router; return pr.route(this[\u03C6164]); } get match() { return this[\u03C6175]; } get params() { return this[\u03C6175] || this[\u03C6203]; } get state() { let map = this[\u03C6262] || (this[\u03C6262] = new Map()); let pars = this.params; let data = this[\u03C6262].get(pars); data || this[\u03C6262].set(pars, data = {}); return data; } set state(value) { (this[\u03C6262] || (this[\u03C6262] = new Map())).set(this.params, value); } set path(value) { if (this[\u03C6164] != value ? (this[\u03C6164] = value, true) : false) { this.router.touch(); } ; } get isActive() { return !!this[\u03C6219]; } resolve() { let v = this.router[\u03C668]; if (!(this[\u03C668] != v ? (this[\u03C668] = v, true) : false)) { return; } ; let r = this.route; let o = this[\u03C6184]; let url = this.router.path; let match = r.match(url); let shown = this[\u03C6219]; let last = this[\u03C6175]; let changed = match != last; let prevUrl = match && match[this[\u03C6252]]; if (match) { this[\u03C6219] = true; this[\u03C6175] = match; match[this[\u03C6252]] = url; } ; if (match) { if (changed || prevUrl != url) { this[\u03C6218](match, last, prevUrl); } ; } ; if (!shown && match) { this[\u03C6126](); } ; if (!match && (shown || shown === null)) { this[\u03C6219] = false; this[\u03C6311](); } ; return this[\u03C6175]; } [\u03C6126]() { var _a, _b; this.node.flags.remove("not-routed"); this.node.flags.add("routed"); return (_b = (_a = this.node) == null ? void 0 : _a.routeDidEnter) == null ? void 0 : _b.call(_a, this); } [\u03C6218](match, prev, prevUrl = "") { var _a, _b; return (_b = (_a = this.node) == null ? void 0 : _a.routeDidResolve) == null ? void 0 : _b.call(_a, this, match, prev, prevUrl); } [\u03C6311]() { var _a, _b; this.node.flags.add("not-routed"); this.node.flags.remove("routed"); return (_b = (_a = this.node) == null ? void 0 : _a.routeDidLeave) == null ? void 0 : _b.call(_a, this); } }; var ElementRouteTo = class extends ElementRoute { [\u03C6126]() { return this; } [\u03C6218]() { return this; } [\u03C6311]() { return this; } resolve() { let v = this.router[\u03C668]; if (!(this[\u03C668] != v ? (this[\u03C668] = v, true) : false)) { return; } ; let o = this[\u03C6184]; let r = this.route; let url = this.router.path; let href = this.route.resolve(url); let match = this.route.match(url); if (match) { this[\u03C6175] = match; this[\u03C6175][this[\u03C6252]] = url; } ; if (o.sticky && this[\u03C6175]) { href = this[\u03C6175][this[\u03C6252]]; } ; if (this[\u03C6272] != href ? (this[\u03C6272] = href, true) : false) { if (this.node.nodeName == "A") { this.node.setAttribute("href", href); } ; } ; this.node.flags.toggle("active", !!match); return; } go() { this.resolve(); if (this[\u03C6184] && this[\u03C6184].replace) { return this.router.replace(this[\u03C6272]); } else { return this.router.go(this[\u03C6272]); } ; } }; var Extend$Node$ag2 = class { get router() { return this.ownerDocument.router; } }; extend$__10(Node2.prototype, Extend$Node$ag2.prototype); var Extend$Element$ah2 = class { set route(value) { if (this[\u03C6282]) { this[\u03C6282].path = value; return; } ; let par = value[0] != "/" ? this[\u03C6292].route : null; this[\u03C6282] = new ElementRoute(this, value, par, this.route__); this[\u03C630] = this.end$routed; } get route() { return this[\u03C6282]; } set route\u039Eto(value) { var self = this; if (this[\u03C61110]) { this[\u03C61110].path = value; return; } ; let par = value[0] != "/" ? this[\u03C6292].route : null; this[\u03C6282] = this[\u03C61110] = new ElementRouteTo(this, value, par, this.routeTo__); this[\u03C630] = this.end$routeTo; this.onclick = function(e) { if (!e.altKey && !e.metaKey && !e[\u03C631]) { e.preventDefault(); e[\u03C631] = self[\u03C61110]; return self[\u03C61110].go(); } ; }; } end$routed() { if (this[\u03C6282]) { this[\u03C6282].resolve(); if (!this[\u03C6282].isActive) { return; } ; } ; if (this.visit) { return this.visit(); } ; } end$routeTo() { if (this[\u03C61110]) { this[\u03C61110].resolve(); } ; if (this.visit) { return this.visit(); } ; } routeDidEnter(route) { return this[\u03C6322](); } routeDidLeave(route) { return this[\u03C6332](); } routeDidResolve(route, match, prev) { var self = this; if (this.routed instanceof Function && match != prev) { this.router.queue.add(async function() { self.suspend(); let res = await self.routed(match, route.state, prev); return self.unsuspend(); }); } ; return; } }; extend$__10(Element.prototype, Extend$Element$ah2.prototype);