native-document 1.0.105 → 1.0.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var NativeDocument=function(e){"use strict";let t={};t={log(){},warn(){},error(){},disable(){}};var n=t;class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function o(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}o.prototype.__$isObservableChecker=!0,o.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},o.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},o.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},o.prototype.set=function(e){return this.observable.set(e)},o.prototype.trigger=function(){return this.observable.trigger()},o.prototype.cleanup=function(){return this.observable.cleanup()};const s={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=s.mounted.get(e);if(t&&(t.inDom=!0,t.mounted))if(Array.isArray(t.mounted))for(const n of t.mounted)n(e);else t.mounted(e)},executeUnmountedCallback(e){const t=s.unmounted.get(e);if(!t)return;if(t.inDom=!1,!t.unmounted)return;let n=!1;if(Array.isArray(t.unmounted))for(const r of t.unmounted)!0===r(e)&&(n=!0);else n=!0===t.unmounted(e);n&&(t.disconnect(),e.nd?.remove())},checkMutation:function(e){for(const t of e){if(s.mountedSupposedSize>0)for(const e of t.addedNodes){if(s.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)s.executeMountedCallback(e)}if(s.unmountedSupposedSize>0)for(const e of t.removedNodes){if(s.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)s.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1,o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(s.mounted.delete(e),s.mountedSupposedSize--),r&&(s.unmounted.delete(e),s.unmountedSupposedSize--),o=null}};const i=(e,t)=>{o[e]?Array.isArray(o[e])?o[e].push(t):o[e]=[o[e],t]:o[e]=t};return{disconnect:()=>o?.disconnect(),mounted:t=>{i("mounted",t),s.mounted.set(e,o),n||(s.mountedSupposedSize++,n=!0)},unmounted:t=>{i("unmounted",t),s.unmounted.set(e,o),r||(s.unmountedSupposedSize++,r=!0)},off:(e,t)=>{((e,t)=>{if(o?.[e]){if(Array.isArray(o[e])){const n=o[e].indexOf(t);return n>-1&&o[e].splice(n,1),1===o[e].length&&(o[e]=o[e][0]),void(0===o[e].length&&(o[e]=null))}o[e]=null}})(e,t)}}}};s.observer=new MutationObserver(s.checkMutation),s.observer.observe(document.body,{childList:!0,subtree:!0});function i(e){this.$element=e,this.$observer=null}i.prototype.__$isNDElement=!0,i.prototype.valueOf=function(){return this.$element},i.prototype.ref=function(e,t){return e[t]=this.$element,this},i.prototype.refSelf=function(e,t){return e[t]=this,this},i.prototype.unmountChildren=function(){let e=this.$element;for(let t=0,n=e.children.length;t<n;t++){let n=e.children[t];n.$ndProx||n.nd?.remove(),n=null}return e=null,this},i.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},i.prototype.lifecycle=function(e){return this.$observer=this.$observer||s.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},i.prototype.mounted=function(e){return this.lifecycle({mounted:e})},i.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},i.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!s.beforeUnmount.has(n)){s.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;n.remove=async()=>{if(!t){t=!0;try{const e=s.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return s.beforeUnmount.get(n).set(e,t),this},i.prototype.htmlElement=function(){return this.$element},i.prototype.node=i.prototype.htmlElement,i.prototype.shadow=function(e,t=null){const n=this.$element,r=Array.from(n.childNodes),o=n.attachShadow({mode:e});if(t){const e=document.createElement("style");e.textContent=t,o.appendChild(e)}return n.append=o.append.bind(o),n.appendChild=o.appendChild.bind(o),o.append(...r),this},i.prototype.openShadow=function(e=null){return this.shadow("open",e)},i.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},i.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},i.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const n=e[t];"function"==typeof n?this[t]=n.bind(this):console.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},i.extend=function(e){if(!e||"object"!=typeof e)throw new r("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new r("NDElement.extend() requires an object, not an array");const t=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!Object.hasOwn(e,o))continue;const s=e[o];if("function"==typeof s){if(t.has(o))throw n.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);i.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),i.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return i};const a=1,u=3,l=8,c=11,h={[a]:!0,[u]:!0,[c]:!0,[l]:!0},p={isObservable:e=>e?.__$isObservable,isTemplateBinding:e=>e?.__$isTemplateBinding,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>p.isObservable(e)||p.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof o,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isNumber:e=>"number"==typeof e,isBoolean:e=>"boolean"==typeof e,isFunction:e=>"function"==typeof e,isAsyncFunction:e=>"function"==typeof e&&"AsyncFunction"===e.constructor.name,isObject:e=>"object"==typeof e&&null!==e,isJson:e=>!("object"!=typeof e||null===e||Array.isArray(e)||"Object"!==e.constructor.name),isElement:e=>e&&h[e.nodeType],isDOMNode:e=>h[e.nodeType],isFragment:e=>e?.nodeType===c,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof i,isValidChildren(e){Array.isArray(e)||(e=[e]);return 0===e.filter(e=>!this.isValidChild(e)).length},validateChildren(e){Array.isArray(e)||(e=[e]);const t=e.filter(e=>!this.isValidChild(e));if(t.length>0)throw new r(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(p.isObject(e)&&Object.values(e).some(e=>p.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new r("Event callback must be a function")}};function d(e,t=!1){const r=document.createDocumentFragment();r.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),s=document.createComment("/ Anchor End "+e);r.appendChild(o),r.appendChild(s),r.nativeInsertBefore=r.insertBefore,r.nativeAppendChild=r.appendChild,r.nativeAppend=r.append;const i=t?()=>!0:e=>e.firstChild===o&&e.lastChild===s;return r.appendElement=function(e,t=null){const n=o.parentNode,i=t||s;n!==r?n?.insertBefore(e,i):n.nativeInsertBefore(e,i)},r.appendChild=function(e,t=null){const o=s.parentNode;o?function(e,t,n){const o=p.isElement(t)?t:R.getChild(t);e!==r?i(e)&&n===s?e.append(o,n):e.insertBefore(o,n):e.nativeInsertBefore(o,n)}(o,e,t=t??s):n.error("Anchor","Anchor : parent not found",e)},r.append=function(...e){return r.appendChild(e)},r.removeChildren=function(){const e=s.parentNode;if(e===r)return;if(i(e))return void e.replaceChildren(o,s);let t,n=o.nextSibling;for(;n&&n!==s;)t=n.nextSibling,n.remove(),n=t},r.remove=function(){const e=s.parentNode;if(e===r)return;if(i(e))return void e.replaceChildren(o,s);let t,n=o.nextSibling;for(;n&&n!==s;)t=n.nextSibling,r.nativeAppend(n),n=t},r.removeWithAnchors=function(){r.removeChildren(),o.remove(),s.remove()},r.replaceContent=function(e){const t=p.isElement(e)?e:R.getChild(e),n=s.parentNode;n&&(i(n)?n.replaceChildren(o,t,s):(r.removeChildren(),n.insertBefore(t,s)))},r.setContent=r.replaceContent,r.insertBefore=function(e,t=null){r.appendChild(e,t)},r.endElement=function(){return s},r.startElement=function(){return o},r.restore=function(){r.appendChild(r)},r.clear=r.remove,r.detach=r.remove,r.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},r}DocumentFragment.prototype.setAttribute=()=>{};const f=new Set(["checked","selected","disabled","readonly","required","autofocus","multiple","autocomplete","hidden","contenteditable","spellcheck","translate","draggable","async","defer","autoplay","controls","loop","muted","download","reversed","open","default","formnovalidate","novalidate","scoped","itemscope","allowfullscreen","allowpaymentrequest","playsinline"]),m=function(){let e=0;const t=new Map;return{register(n){const r=++e;return t.set(r,new WeakRef(n)),r},unregister(e){t.delete(e)},getObservableById:e=>t.get(e)?.deref(),cleanup(){for(const[e,n]of t){const e=n.deref();e&&e.cleanup()}t.clear()},cleanObservables(e){if(t.size<e)return;let r=0;for(const[e,n]of t)n.deref()||(t.delete(e),r++);r>0&&n.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}(),b=function(e,t){this.$target=t,this.$observer=e};b.prototype.__$isObservableWhen=!0,b.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},b.prototype.val=function(){return this.$observer.$currentValue===this.$target},b.prototype.isMatch=b.prototype.val,b.prototype.isActive=b.prototype.val;const y=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},g=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},v=(e,t)=>{try{if(void 0!==window.structuredClone)return window.structuredClone(e)}catch(e){}if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>v(e));if(p.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=v(e[t]));return n},w={getJson(e){let t=localStorage.getItem(e);try{return JSON.parse(t)}catch(t){throw new r("invalid_json:"+e)}},getNumber(e){return Number(this.get(e))},getBool(e){const t=this.get(e);return"true"===t||"1"===t},setJson(e,t){localStorage.setItem(e,JSON.stringify(t))},setBool(e,t){localStorage.setItem(e,t?"true":"false")},get:(e,t=null)=>localStorage.getItem(e)||t,set:(e,t)=>localStorage.setItem(e,t),remove(e){localStorage.removeItem(e)},has:e=>null!=localStorage.getItem(e)},$=(e,t)=>{if(!w.has(e))return t;switch(typeof t){case"object":return w.getJson(e)??t;case"boolean":return w.getBool(e)??t;case"number":return w.getNumber(e)??t;default:return w.get(e,t)??t}},S=e=>{switch(typeof e){case"object":return w.setJson;case"boolean":return w.setBool;default:return w.set}},O=function(){const e=new Map,t=new Map,o=(t,o)=>{const s=e.get(o);if(!s)throw n.error("Store",`Store.${t}('${o}') : store not found. Did you call Store.create('${o}') first?`),new r(`Store.${t}('${o}') : store not found.`);return s},s=(e,t={})=>Array.isArray(e)?k.array(e,t):"object"==typeof e?k.object(e,t):k(e,t);return new Proxy({create(t,o){if(e.has(t))throw n.warn("Store",`Store.create('${t}') : a store with this name already exists. Use Store.get('${t}') to retrieve it.`),new r(`Store.create('${t}') : a store with this name already exists.`);const i=s(o);return e.set(t,{observer:i,subscribers:new Set,resettable:!1,composed:!1}),i},createResettable(t,o){if(e.has(t))throw n.warn("Store",`Store.createResettable('${t}') : a store with this name already exists.`),new r(`Store.createResettable('${t}') : a store with this name already exists.`);const i=s(o,{reset:!0});return e.set(t,{observer:i,subscribers:new Set,resettable:!0,composed:!1}),i},createComposed(t,o,s){if(e.has(t))throw n.warn("Store",`Store.createComposed('${t}') : a store with this name already exists.`),new r(`Store.createComposed('${t}') : a store with this name already exists.`);if("function"!=typeof o)throw new r(`Store.createComposed('${t}') : computation must be a function.`);if(!Array.isArray(s)||0===s.length)throw new r(`Store.createComposed('${t}') : dependencies must be a non-empty array of store names.`);const i=s.map(o=>{if("string"!=typeof o)return o;const s=e.get(o);if(!s)throw n.error("Store",`Store.createComposed('${t}') : dependency '${o}' not found. Create it first.`),new r(`Store.createComposed('${t}') : dependency store '${o}' not found.`);return s.observer}),a=k.computed(o,i);return e.set(t,{observer:a,subscribers:new Set,resettable:!1,composed:!0}),a},has:t=>e.has(t),reset(e){const t=o("reset",e);if(t.composed)throw n.error("Store",`Store.reset('${e}') : composed stores cannot be reset. Their value is derived from dependencies.`),new r(`Store.reset('${e}') : composed stores cannot be reset.`);if(!t.resettable)throw n.error("Store",`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`),new r(`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`);t.observer.reset()},use(e){const t=o("use",e);if(t.composed)throw n.error("Store",`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`),new r(`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`);const{observer:i,subscribers:a}=t,u=s(i.val()),l=e=>u.set(e),c=e=>i.set(e);return i.subscribe(l),u.subscribe(c),u.destroy=()=>{i.unsubscribe(l),u.unsubscribe(c),a.delete(u),u.cleanup()},u.dispose=u.destroy,a.add(u),u},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),u=e=>a.set(e);return t.subscribe(u),((e,t,o)=>{const s=e=>()=>{throw n.error("Store",`Store.${o}('${t}') is read-only. '${e}()' is not allowed.`),new r(`Store.${o}('${t}') is read-only.`)};e.set=s("set"),e.toggle=s("toggle"),e.reset=s("reset")})(a,e,"follow"),a.destroy=()=>{t.unsubscribe(u),i.delete(a),a.cleanup()},a.dispose=a.destroy,i.add(a),a},get(t){const r=e.get(t);return r?r.observer:(n.warn("Store",`Store.get('${t}') : store not found.`),null)},getWithSubscribers:t=>e.get(t)??null,delete(t){const r=e.get(t);r?(r.subscribers.forEach(e=>e.destroy()),r.subscribers.clear(),r.observer.cleanup(),e.delete(t)):n.warn("Store",`Store.delete('${t}') : store not found, nothing to delete.`)},group(e,t){"function"==typeof e&&(t=e,e="anonymous");const n=O();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,$(n,t)),o=S(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,$(n,t)),o=S(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{w.remove(n),s()},r}},{get(e,n){if("symbol"==typeof n||n.startsWith("$")||n in e)return e[n];if(e.has(n)){if(t.has(n))return t.get(n);const r=e.follow(n);return t.set(n,r),r}},set(e,t,o){throw n.error("Store",`Forbidden: You cannot overwrite the store key '${String(t)}'. Use .use('${String(t)}').set(value) instead.`),new r("Store structure is immutable. Use .set() on the observable.")},deleteProperty(e,t){throw new r("Store keys cannot be deleted.")}})},C=O();C.create("locale",navigator.language.split("-")[0]||"en");const A=(e,t)=>{const n=new Date(e);return{d:n,parts:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n).reduce((e,{type:t,value:n})=>(e[t]=n,e),{})}},E=(e,t,n)=>{const r=e=>String(e).padStart(2,"0");return e.replace("YYYY",n.year).replace("YY",n.year.slice(-2)).replace("MMMM",n.month).replace("MMM",n.month.slice(0,3)).replace("MM",r(t.getMonth()+1)).replace("DD",r(t.getDate())).replace("D",t.getDate()).replace("HH",n.hour).replace("mm",n.minute).replace("ss",n.second)},x={currency:(e,t,{currency:n="XOF",notation:r,minimumFractionDigits:o,maximumFractionDigits:s}={})=>new Intl.NumberFormat(t,{style:"currency",currency:n,notation:r,minimumFractionDigits:o,maximumFractionDigits:s}).format(e),number:(e,t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}={})=>new Intl.NumberFormat(t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}).format(e),percent:(e,t,{decimals:n=1}={})=>new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:n}).format(e),date:(e,t,{format:n,dateStyle:r="long"}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r}).format(new Date(e))},time:(e,t,{format:n,hour:r="2-digit",minute:o="2-digit",second:s}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{hour:r,minute:o,second:s}).format(new Date(e))},datetime:(e,t,{format:n,dateStyle:r="long",hour:o="2-digit",minute:s="2-digit",second:i}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r,hour:o,minute:s,second:i}).format(new Date(e))},relative:(e,t,{unit:n="day",numeric:r="auto"}={})=>{const o=Math.round((e-Date.now())/864e5);return new Intl.RelativeTimeFormat(t,{numeric:r}).format(o,n)},plural:(e,t,{singular:n,plural:r}={})=>`${e} ${"one"===new Intl.PluralRules(t).select(e)?n:r}`};function D(e,t=null){e=p.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$firstListener=null,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=p.isObject(e)?v(e):e))}Object.defineProperty(D.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),D.prototype.__$isObservable=!0;const N=function(){};function k(e,t=null){return new D(e,t)}D.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},D.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},D.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;for(let o=0,s=t.length;o<s;o++)t[o](r,n,e)},D.prototype.triggerWatchers=function(e){const t=this.$watchers,n=this.$previousValue,r=this.$currentValue,o=t.get(r),s=t.get(n);o&&o(!0,n,e),s&&s(!1,r,e)},D.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},D.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},D.prototype.assocTrigger=function(){this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?1===this.$listeners.length?(this.$firstListener=this.$listeners[0],this.trigger=this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=N},D.prototype.trigger=N,D.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(),this.$previousValue=null)},D.prototype.$setWithInterceptor=function(e){let t="function"==typeof e?e(this.$currentValue):e;const n=this.$interceptor(t,this.$currentValue);void 0!==n&&(t=n),this.$updateWithNewValue(t)},D.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},D.prototype.set=D.prototype.$basicSet,D.prototype.val=function(){return this.$currentValue},D.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=N},D.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},D.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}m.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},D.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},D.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);t.__$isObservable&&(t=t.set.bind(t)),n?p.isArray(n.list)?n.list.push(t):(n=[n,t],t=e=>{for(let t=0,r=n.length;t<r;t++)n[t](e)},t.list=n,this.$watchers.set(e,t)):(n=t,this.$watchers.set(e,t)),this.assocTrigger()},D.prototype.off=function(e,t){if(!this.$watchers)return;const n=this.$watchers.get(e);if(!n)return;if(!t||!Array.isArray(n.list))return this.$watchers?.delete(e),void this.assocTrigger();const r=n.indexOf(t);n?.splice(r,1),1===n.length?this.$watchers.set(e,n[0]):0===n.length&&this.$watchers?.delete(e),this.assocTrigger()},D.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=e=>{n(e)&&(this.unsubscribe(r),t(e))};this.subscribe(r)},D.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},D.prototype.check=function(e){return new o(this,e)},D.prototype.transform=D.prototype.check,D.prototype.pluck=D.prototype.check,D.prototype.is=D.prototype.check,D.prototype.select=D.prototype.check,D.prototype.get=function(e){const t=this.$currentValue[e];return p.isObservable(t)?t.val():t},D.prototype.when=function(e){return new b(this,e)},D.prototype.equals=function(e){return p.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},D.prototype.toBool=function(){return!!this.$currentValue},D.prototype.toggle=function(){this.set(!this.$currentValue)},D.prototype.reset=function(){if(!this.configs?.reset)return;const e=p.isObject(this.$initialValue)?v(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},D.prototype.toString=function(){return String(this.$currentValue)},D.prototype.valueOf=function(){return this.$currentValue},D.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new o(n,e);const r=x[e],s=x.locale;return k.computed(()=>r(n.val(),s.val(),t),[n,s])},D.prototype.persist=function(e,t={}){let n=$(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=S(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this};const T=k,F=k;function I(e,t){for(const n in t){const r=t[n];r.__$isObservable?(e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))):r.__$isObservableWhen?(e.classes.toggle(n,r.isActive()),r.subscribe(t=>e.classes.toggle(n,t))):r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}t=null}function _(e,t){for(const n in t){const r=t[n];r.__$isObservable?(e.style[n]=r.val(),r.subscribe(t=>e.style[n]=t)):e.style[n]=r}}function M(e,t,n){const r=n.__$isObservable,o=r?n.val():n;if(p.isBoolean(o)?e[t]=o:e[t]=o===e.value,r){if("checked"===t)return"boolean"==typeof o?e.addEventListener("input",()=>n.set(e[t])):e.addEventListener("input",()=>n.set(e.value)),void n.subscribe(n=>e[t]=n);n.subscribe(n=>e[t]=n===e.value)}}function P(e){this.$hydrate=e}k.useValueProperty=function(e="value"){Object.defineProperty(D.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},k.getById=function(e){const t=m.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},k.cleanup=function(e){e.cleanup()},k.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{m.cleanup()}),setInterval(()=>m.cleanObservables(r),n)},P.prototype.__$isTemplateBinding=!0,String.prototype.toNdElement=function(){return R.createStaticTextNode(null,this)},Element.prototype.toNdElement=function(){return this},Text.prototype.toNdElement=function(){return this},Comment.prototype.toNdElement=function(){return this},Document.prototype.toNdElement=function(){return this},DocumentFragment.prototype.toNdElement=function(){return this},D.prototype.toNdElement=function(){return R.createObservableNode(null,this)},o.prototype.toNdElement=D.prototype.toNdElement,i.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=R.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return R.getChild(this())},P.prototype.toNdElement=function(){return R.createHydratableNode(null,this)};const V=(e,t=1e3)=>new Promise(n=>{let r=!1;const o=t=>{t&&t.target!==e||r||(r=!0,e.removeEventListener("transitionend",o),e.removeEventListener("animationend",o),clearTimeout(s),n())};e.addEventListener("transitionend",o),e.addEventListener("animationend",o);const s=setTimeout(o,t),i=window.getComputedStyle(e),a="0s"!==i.transitionDuration,u="0s"!==i.animationDuration;a||u||o()});i.prototype.transitionOut=function(e){const t=e+"-exit";return this.beforeUnmount("transition-exit",async function(){this.$element.classes.add(t),await V(this.$element),this.$element.classes.remove(t)}),this},i.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to";return this.$element.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.$element.classes.remove(t),this.$element.classes.add(n),V(this.$element).then(()=>{this.$element.classes.remove(n)})})})}),this},i.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},i.prototype.animate=function(e){return this.$element.classes.add(e),V(this.$element).then(()=>{this.$element.classes.remove(e)}),this},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},D.prototype.handleNdAttribute=function(e,t){f.has(t)?M(e,t,this):function(e,t,n){const r="value"===t?t=>e.value=t:n=>e.setAttribute(t,n);if(n.subscribe(r),"value"===t)return e.value=n.val(),void e.addEventListener("input",()=>n.set(e.value));e.setAttribute(t,n.val())}(e,t,this)},P.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const L=new Map;let j=null;const R={createTextNode:()=>(j||(j=document.createTextNode("")),j.cloneNode()),createObservableNode(e,t){const n=R.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=R.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=R.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){const t=L.get(e);if(t)return t.cloneNode();const n=document.createElement(e);return L.set(e,n),n.cloneNode()}return d("Fragment")},bindTextNode(e,t){if(t?.__$isObservable)return t.subscribe(t=>e.nodeValue=t),void(e.nodeValue=t.val());e.nodeValue=t},processChildren(e,t){if(null===e)return;let n=this.getChild(e);n&&t.appendChild(n)},async safeRemove(e){await e.remove()},getChild(e){if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),p.isElement(e))return e}while(e.toNdElement);return R.createStaticTextNode(null,e)},processAttributes(e,t){t&&function(e,t){p.validateAttributes(t);for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){I(e,o);continue}if("style"===r){_(e,o);continue}}f.has(r)?M(e,r,o):e.setAttribute(r,o)}}}(e,t)}},q={configurable:!0,get(){return new i(this)}};Object.defineProperty(HTMLElement.prototype,"nd",q),Object.defineProperty(DocumentFragment.prototype,"nd",q),Object.defineProperty(i.prototype,"nd",{configurable:!0,get:function(){return this}}),["Click","DblClick","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Blur","Change","Focus","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","AfterPrint","BeforePrint","BeforeUnload","Error","HashChange","Load","Offline","Online","PageHide","PageShow","Resize","Scroll","Unload","Abort","CanPlay","CanPlayThrough","DurationChange","Emptied","Ended","LoadedData","LoadedMetadata","LoadStart","Pause","Play","Playing","Progress","RateChange","Seeked","Seeking","Stalled","Suspend","TimeUpdate","VolumeChange","Waiting","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),this}}),["Click","DblClick","MouseDown","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Change","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","BeforeUnload","HashChange","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["onStop"+e]=function(e=null){return B(this.$element,t,e),this},i.prototype["onPreventStop"+e]=function(e=null){return U(this.$element,t,e),this}}),["Click","DblClick","MouseDown","MouseUp","Wheel","KeyDown","KeyPress","Invalid","Reset","Submit","DragOver","Drop","BeforeUnload","TouchCancel","TouchEnd","TouchMove","TouchStart","Copy","Cut","Paste","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["onPrevent"+e]=function(e=null){return W(this.$element,t,e),this}}),i.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const W=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},B=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},U=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)}),this},H={getClasses(){return this.$element.className?.split(" ").filter(Boolean)},add(e){const t=this.getClasses();t.indexOf(e)>=0||(t.push(e),this.$element.className=t.join(" "))},remove(e){const t=this.getClasses(),n=t.indexOf(e);n<0||(t.splice(n,1),this.$element.className=t.join(" "))},toggle(e,t=void 0){const n=this.getClasses(),r=n.indexOf(e);if(r>=0){if(!0===t)return;n.splice(r,1)}else{if(!1===t)return;n.push(e)}this.$element.className=n.join(" ")},contains(e){return this.getClasses().indexOf(e)>=0}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...H}}});let z=e=>e;e.ArgTypes={},e.ArgTypes={string:()=>!0,number:()=>!0,boolean:()=>!0,observable:()=>!0,element:()=>!0,function:()=>!0,object:()=>!0,objectNotNull:()=>!0,children:()=>!0,attributes:()=>!0,optional:()=>!0,oneOf:()=>!0};const K=function(e,t=null){return Array.isArray(e)||"object"!=typeof e||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}};function J(e,t,n,r=null){let{props:o,children:s=null}=K(n,r),i=R.createElement(e),a=t&&"function"==typeof t?t(i):i;return R.processAttributes(a,o),R.processChildren(s,a),a}function Y(e,t=null){return J.bind(null,e,t)}const G=new WeakMap,Q=(e,t,n)=>{let r=null;if(t.attributes){r={};for(const e in t.attributes)r[e]=t.attributes[e].apply(null,n)}if(t.classes){r=r||{},r.class={};for(const e in t.classes)r.class[e]=t.classes[e].apply(null,n)}if(t.styles){r=r||{},r.style={};for(const e in t.styles)r.style[e]=t.styles[e].apply(null,n)}return r?(R.processAttributes(e,r),!0):null},X=(e,t,n)=>{if(!t.attach)return null;for(const r in t.attach)e.nd[r](function(...e){t.attach[r].apply(this,[...e,...n])})},Z=(e,t,n,r)=>{if(r.fn&&("string"==typeof r.fn?R.bindTextNode(t,n[0][r.fn]):r.fn(n,t,e)),r.children)for(let o=0,s=r.children.length;o<s;o++){const s=r.children[o],i=t.childNodes[s.index];Z(e,i,n,s)}};function ee(e){let t=null,n=!1;const r={fn:null,children:[]},o=(e,t,n)=>{const r=G.get(e);if(3===e.nodeType){if(r&&r.value){n.fn=r.value;const o=e.cloneNode();return"string"==typeof r.value?(R.bindTextNode(o,t[0][r.value]),o):(r.value(t,o),o)}return e.cloneNode(!0)}const s=e.cloneNode();r&&(Q(s,r,t),X(s,r,t),n.fn=(e,t)=>{Q(t,r,e),X(t,r,e)});const i=e.childNodes,a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],r={index:e,fn:null},u=o(n,t,r);(r.children||r.fn)&&a.push(r),s.appendChild(u)}return a.length&&(n.children=n.children||[],n.children=a),s},s=e=>{let n=t.cloneNode(!0);return Z(n,n,e,r),n};this.clone=i=>{if(t=e(this),!n)return this.clone=()=>t.cloneNode(!0),t.cloneNode(!0);const a=o(t,i,r);return this.clone=s,a};const i=(e,t)=>new P((r,o)=>{n=!0,function(e,t,n,r){G.has(n)||G.set(n,{});const o=G.get(n);"value"!==t?(o[t]=o[t]||{},o[t][r]=e):o.value=e}(e,t,r,o)});this.style=e=>i(e,"styles"),this.class=e=>i(e,"classes"),this.property=e=>this.value(e),this.value=e=>i("function"!=typeof e?e:(t,n)=>{R.bindTextNode(n,e(...t))},"value"),this.attr=e=>i(e,"attributes"),this.attach=e=>i(e,"attach")}function te(e){let t=null,n=null;this.render=r=>{if(t||(t=e(this)),!n)return t;for(const e in n){(0,n[e])(...r)}return t},this.createSection=(e,t)=>{n=n||{};const r=d("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}DocumentFragment.prototype.__IS_FRAGMENT=!0,Function.prototype.args=function(...e){return this},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new i(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){const t=(...n)=>{try{return this.apply(this,n)}catch(r){return e(r,{caller:t,args:n})}};return t},String.prototype.use=function(e){const t=this;return k.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return p.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return p.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!p.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return k.getById(n)}):this.valueOf()};const ne=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},re=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},oe=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{const o=t.get(r);if(o)return o;if(e.length>0)return(...n)=>{const o=e(...n,r);return t.set(r,o),o};const s=e(r);return t.set(r,s),s}})};function se(e){return e instanceof Date?e:new Date(e)}function ie(e,t){const n=se(e),r=se(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function ae(e){const t=se(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function ue(e,t){const n=p.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function le(e,t){const n=e.filter(p.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>p.isObservable(e)?e.val():e))}}function ce(e){return ue(e,(e,t)=>e===t)}function he(e){return ue(e,(e,t)=>e!==t)}function pe(e){return ue(e,(e,t)=>e>t)}function de(e){return ue(e,(e,t)=>e>=t)}function fe(e){return ue(e,(e,t)=>e<t)}function me(e){return ue(e,(e,t)=>e<=t)}function be(e,t=!0,n=""){return le([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function ye(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(p.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function ge(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(p.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const ve=pe,we=de,$e=fe,Se=me,Oe=ce,Ce=he,Ae=ye,Ee=ge;function xe(e,t=!1){return ue(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const De=xe;var Ne=Object.freeze({__proto__:null,all:Ae,and:ye,any:Ee,between:function(e,t){return le([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:De,createFilter:ue,createMultiSourceFilter:le,custom:function(e,...t){const n=t.filter(p.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>p.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)>se(t)),dateBefore:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)<se(t)),dateBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=se(e);return r>=se(t)&&r<=se(n)}),dateEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e,t)),dateTimeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)>se(t)),dateTimeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)<se(t)),dateTimeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=se(e);return r>=se(t)&&r<=se(n)}),dateTimeEquals:e=>ue(e,(e,t)=>!(!e||!t)&&se(e).getTime()===se(t).getTime()),endsWith:function(e,t=!1){return ue(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:Oe,equals:ce,getSecondsOfDay:ae,greaterThan:pe,greaterThanOrEqual:de,gt:ve,gte:we,inArray:function(e){return ue(e,(e,t)=>t.includes(e))},includes:xe,isEmpty:function(e=!0){return ue(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return ue(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:ie,lessThan:fe,lessThanOrEqual:me,lt:$e,lte:Se,match:be,neq:Ce,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:he,notIn:function(e){return ue(e,(e,t)=>!t.includes(e))},or:ge,startsWith:function(e,t=!1){return ue(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e)>ae(t)),timeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e)<ae(t)),timeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ae(e);return r>=ae(t)&&r<=ae(n)}),timeEquals:e=>ue(e,(e,t)=>{if(!e||!t)return!1;const n=se(e),r=se(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:se});const ke=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");D.call(this,e,t)};(ke.prototype=Object.create(D.prototype)).constructor=ke,ke.prototype.__$isObservableArray=!0,Object.defineProperty(ke.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{ke.prototype[e]=function(...t){const n=this.$currentValue[e].apply(this.$currentValue,t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{ke.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}}),ke.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},ke.prototype.at=function(e){return this.$currentValue[e]},ke.prototype.merge=function(e){this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})},ke.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},ke.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],s=n[t];return n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]}),!0},ke.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},ke.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},ke.prototype.isEmpty=function(){return 0===this.$currentValue.length},ke.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},ke.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=p.isObservable(o)?be(o,!1):o;if(e&&"object"==typeof e&&"callback"in e){if(r[t]=e.callback,e.dependencies){const t=Array.isArray(e.dependencies)?e.dependencies:[e.dependencies];n.push.apply(n,t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=k.array(),s=Object.entries(r),i=()=>{const e=t.val().filter(e=>{for(const[t,n]of s)if("_"===t){if(!n(e))return!1}else if(!n(e[t]))return!1;return!0});o.set(e)};return n.forEach(e=>e.subscribe(i)),i(),o},ke.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},ke.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},ke.prototype.deepSubscribe=function(e){const t=y(()=>e(this.val())),n=new WeakMap,r=e=>{n.has(e)||(e?.__$isObservableArray?n.set(e,e.deepSubscribe(t)):e?.__$isObservable&&(e.subscribe(t),n.set(e,()=>e.unsubscribe(t))))},o=e=>{const t=n.get(e);t&&(t(),n.delete(e))};return this.$currentValue.forEach(r),this.subscribe(t),this.subscribe((e,t,n)=>{switch(n?.action){case"push":case"unshift":case"merge":n.args.forEach(r);break;case"splice":{const[e,t,...s]=n.args;n.result?.forEach(o),s.forEach(r);break}case"remove":o(n.result);break;case"clear":this.$currentValue.forEach(o)}}),()=>{this.$currentValue.forEach(o)}},k.array=function(e=[],t=null){return new ke(e,t)},k.batch=function(e){const t=k(0),n=function(){if(p.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};const Te=function(e,t){D.call(this,e),this.$observables={},this.configs=t,this.$load(e);for(const t in e)Object.hasOwn(this,t)||Object.defineProperty(this,t,{get:()=>this.$observables[t],set:e=>this.$observables[t].set(e)})};Te.prototype=Object.create(D.prototype),Object.defineProperty(Te,"$value",{get(){return this.val()},set(e){this.set(e)}}),Te.prototype.__$isObservableObject=!0,Te.prototype.__isProxy__=!0,Te.prototype.$load=function(e){const t=this.configs;for(const n in e){const r=e[n];if(Array.isArray(r)){if(!1!==t?.deep){const e=r.map(e=>p.isJson(e)?k.json(e,t):p.isArray(e)?k.array(e,t):k(e,t));this.$observables[n]=k.array(e,t);continue}this.$observables[n]=k.array(r,t)}else p.isObservable(r)||p.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?k.object(r,t):k(r,t)}},Te.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(p.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>p.isObservable(e)?e.val():p.isProxy(e)?e.$value:e)),e[t]=r}else p.isProxy(n)?e[t]=n.$value:e[t]=n}return e},Te.prototype.$val=Te.prototype.val,Te.prototype.get=function(e){const t=this.$observables[e];return p.isObservable(t)?t.val():p.isProxy(t)?t.$value:t},Te.prototype.$get=Te.prototype.get,Te.prototype.set=function(e){const t=p.isProxy(e)?e.$value:e,n=this.configs;for(const r in t){const o=this.$observables[r],s=e[r],i=t[r];if(p.isObservable(o)){if(!p.isArray(i)){o.set(i);continue}const e=s.at(0);if(p.isObservable(e)||p.isProxy(e)){const t=i.map(t=>p.isProxy(e)?k.init(t,n):k(t,n));o.set(t);continue}o.set([...i]);continue}p.isProxy(o)?o.update(i):this[r]=i}},Te.prototype.$set=Te.prototype.set,Te.prototype.$updateWith=Te.prototype.set,Te.prototype.observables=function(){return Object.values(this.$observables)},Te.prototype.$observables=Te.prototype.observables,Te.prototype.keys=function(){return Object.keys(this.$observables)},Te.prototype.$keys=Te.prototype.keys,Te.prototype.clone=function(){return k.init(this.val(),this.configs)},Te.prototype.$clone=Te.prototype.clone,Te.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},Te.prototype.originalSubscribe=Te.prototype.subscribe,Te.prototype.subscribe=function(e){const t=this.observables(),n=y(()=>this.trigger());this.originalSubscribe(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];r.__$isObservableArray?r.deepSubscribe(n):r.subscribe(n)}},Te.prototype.configs=function(){return this.configs},Te.prototype.update=Te.prototype.set,k.init=function(e,t=null){return new Te(e,t)},k.arrayOfObject=function(e){return e.map(e=>k.object(e))},k.value=function(e){if(p.isObservable(e))return e.val();if(p.isProxy(e))return e.$value;if(p.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(k.value(r))}return t}return e},k.object=k.init,k.json=k.init,k.computed=function(e,t=[]){const n=new D(e()),o=y(()=>n.set(e()));if(p.isFunction(t)){if(!p.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{p.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const Fe=new Set(["clear","push","unshift","replace"]);const Ie=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!p.isObservable(e)&&!p.isObservableWhenResult(e))return n.warn("ShowIf","ShowIf : condition must be an Observable / "+r,e);const s=d("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=R.getChild(t),p.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},_e=function(e,t,n=!0){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=d("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=R.getChild(r),p.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),u=i(a);return u&&o.appendChild(u),e.subscribe(e=>{const t=i(e);o.remove(),t&&o.appendChild(t)}),o.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(e){n&&s.delete(e),delete t[e]}})},Me=function(e,t,n){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");return _e(e,{true:t,false:n})},Pe=Y("div"),Ve=Y("span"),Le=Y("label"),je=Y("p"),Re=je,qe=Y("strong"),We=Y("h1"),Be=Y("h2"),Ue=Y("h3"),He=Y("h4"),ze=Y("h5"),Ke=Y("h6"),Je=Y("br"),Ye=Y("a"),Ge=Y("pre"),Qe=Y("code"),Xe=Y("blockquote"),Ze=Y("hr"),et=Y("em"),tt=Y("small"),nt=Y("mark"),rt=Y("del"),ot=Y("ins"),st=Y("sub"),it=Y("sup"),at=Y("abbr"),ut=Y("cite"),lt=Y("q"),ct=Y("dl"),ht=Y("dt"),pt=Y("dd"),dt=Y("form",function(e){return e.submit=function(t){return"function"==typeof t?(e.onSubmit(e=>{e.preventDefault(),t(e)}),e):(this.setAttribute("action",t),e)},e.multipartFormData=function(){return this.setAttribute("enctype","multipart/form-data"),e},e.post=function(t){return this.setAttribute("method","post"),this.setAttribute("action",t),e},e.get=function(e){this.setAttribute("method","get"),this.setAttribute("action",e)},e}),ft=Y("input"),mt=Y("textarea"),bt=mt,yt=Y("select"),gt=Y("fieldset"),vt=Y("option"),wt=Y("legend"),$t=Y("datalist"),St=Y("output"),Ot=Y("progress"),Ct=Y("meter"),At=Y("button"),Et=Y("main"),xt=Y("section"),Dt=Y("article"),Nt=Y("aside"),kt=Y("nav"),Tt=Y("figure"),Ft=Y("figcaption"),It=Y("header"),_t=Y("footer"),Mt=Y("img"),Pt=function(e,t){return Mt({src:e,...t})},Vt=Y("details"),Lt=Y("summary"),jt=Y("dialog"),Rt=Y("menu"),qt=Y("ol"),Wt=Y("ul"),Bt=Y("li"),Ut=Bt,Ht=qt,zt=Wt,Kt=Y("audio"),Jt=Y("video"),Yt=Y("source"),Gt=Y("track"),Qt=Y("canvas"),Xt=Y("svg"),Zt=Y("time"),en=Y("data"),tn=Y("address"),nn=Y("kbd"),rn=Y("samp"),on=Y("var"),sn=Y("wbr"),an=Y("caption"),un=Y("table"),ln=Y("thead"),cn=Y("tfoot"),hn=Y("tbody"),pn=Y("tr"),dn=pn,fn=Y("th"),mn=fn,bn=fn,yn=Y("td"),gn=yn,vn=Y("");var wn=Object.freeze({__proto__:null,Abbr:at,Address:tn,Anchor:d,Article:Dt,Aside:Nt,AsyncImg:function(e,t,n,o){const s=p.isObservable(e)?e.val():e,i=Pt(t||s,n),a=new Image;return a.onload=()=>{p.isFunction(o)&&o(null,i),i.src=p.isObservable(e)?e.val():e},a.onerror=()=>{p.isFunction(o)&&o(new r("Image not found"))},p.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:Kt,BaseImage:Mt,Blockquote:Xe,Br:Je,Button:At,Canvas:Qt,Caption:an,Checkbox:e=>ft({type:"checkbox",...e}),Cite:ut,Code:Qe,ColorInput:e=>ft({type:"color",...e}),Data:en,Datalist:$t,DateInput:e=>ft({type:"date",...e}),DateTimeInput:e=>ft({type:"datetime-local",...e}),Dd:pt,Del:rt,Details:Vt,Dialog:jt,Div:Pe,Dl:ct,Dt:ht,Em:et,EmailInput:e=>ft({type:"email",...e}),FieldSet:gt,FigCaption:Ft,Figure:Tt,FileInput:e=>ft({type:"file",...e}),Footer:_t,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){const i=d("ForEach"),a=i.endElement();i.startElement();let u=new Map,l=null;const c=new Set,h=e=>{if(!s)for(const[t,n]of u.entries()){if(c.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),l&&l.delete(n.keyId)}},f=(e,s)=>{const i=((e,t,n)=>{if(p.isString(n)){const r=p.isObservable(e)?e.val():e,o=r?.[n];return p.isObservable(o)?o.val():o??t}return p.isFunction(n)?n(e,t):(p.isObservable(e)?e.val():e)??t})(e,s,o);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?k(s):null;let o=R.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(o),indexObserver:n})}catch(e){throw n.error("ForEach",`Error creating element for key ${i}`,e),e}return i},m=()=>{const t=a.parentNode;if(!t)return;const n=p.isObservable(e)?e.val():e;if(c.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=f(n[e],e);c.add(t)}else for(const e in n){const t=f(n[e],e);c.add(t)}if(0===c.size)return i.removeChildren(),h(),void l?.clear();h(t),l&&0!==l.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(c);Array.from(l);for(const n in t){const r=t[n],o=u.get(r);if(!o)continue;const s=o.child.deref();s&&e.appendChild(s)}i.replaceContent(e)})():(e=>{const t=document.createDocumentFragment();for(const e of c){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),l?.clear(),l=new Set([...c])};return m(),p.isObservable(e)&&e.subscribe(m),i},ForEachArray:function(e,t,n={}){const r=d("ForEach Array",n.isParentUniqueChild),o=r.endElement(),s=r.startElement();let i=new Map,a=0;const u=t.length>=2,l=e=>{r.removeChildren(),g(e),a=0},c=e=>i.get(e)?.child,h=(e,t=!0)=>{const n=i.get(e);if(n){if(t){const t=n.child;t?.remove(),i.delete(e)}n.indexObserver?.cleanup()}},f=e=>{const n=R.getChild(t(e,null));return i.set(e,{child:n,indexObserver:null}),n},m=(e,n)=>{const r=k(n),o=R.getChild(t(e,r));return i.set(e,{child:o,indexObserver:r}),o},b=(e,t)=>{const n=i.get(e);return n?(n.indexObserver?.set(t),n.child):f(e)};let y=f;const g=e=>{if(u){if(!n.shouldKeepItemsInCache)for(const[t,n]of i.entries())e&&e.includes(t)||h(t,!1)}else i.clear()},v=function(e,t){const n=i.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()},w={toFragment(e){const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(y(e[n],a)),a++;return t},add(e){r.appendElement(w.toFragment(e))},replace(e){l(e),w.add(e)},reOrder(e){let t=null;const n=document.createDocumentFragment();for(const r of e)t=c(r),t&&n.appendChild(t);t=null,r.appendElement(n,o)},removeOne(e,t){h(e,!0)},clear:l,merge(e){w.add(e)},push(e){let t=0;n.pushDelay&&(t=n.pushDelay(e)??0),w.add(e,t)},populate([e,t,n]){const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(y(t,r)),a++}r.appendChild(o),o.replaceChildren()},unshift(e){r.insertBefore(w.toFragment(e),s.nextSibling)},splice(e,t){const[n,s,...i]=e;let a=null;const u=document.createDocumentFragment();if(t.length>0){let e=t[0];if(1===t.length)v(e,u);else if(t.length>1){const e=c(t[0]);a=e?.previousSibling;for(let e=0;e<t.length;e++)v(t[e],u)}}else a=o;u.replaceChildren(),i&&i.length&&a&&r.insertBefore(w.toFragment(i),a.nextSibling)},reverse(e,t){w.reOrder(t)},sort(e,t){w.reOrder(t)},remove(e,t){w.removeOne(t)},pop(e,t){w.removeOne(t)},shift(e,t){w.removeOne(t)},swap(e,t){const n=o.parentNode;let r=c(t[0]),s=c(t[1]);if(!r||!s)return;const i=s.nextSibling;n.insertBefore(s,r),n.insertBefore(r,i),r=null,s=null}},$=(e,t,n)=>{if("clear"!==n?.action&&e.length){if(((e=null)=>{y=Fe.includes(e)?u?m:f:i.size?b:u?m:f})(n?.action),n?.action)w[n.action]&&w[n.action](n.args,n.result);else{if(0===a)return void w.add(e);w.replace(e)}((e,t=0)=>{if(!u)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=i.get(e[r]);t&&(t.indexObserver?.set(n),n++)}})(e,0)}else{if(0===a)return;l()}};return e.val().length&&$(e.val(),0,{action:null}),p.isObservable(e)&&e.subscribe($),r},Form:dt,Fragment:vn,H1:We,H2:Be,H3:Ue,H4:He,H5:ze,H6:Ke,Header:It,HiddenInput:e=>ft({type:"hidden",...e}),HideIf:function(e,t,n){const r=k(!e.val());return e.subscribe(e=>r.set(!e)),Ie(r,t,n)},HideIfNot:function(e,t,n){return Ie(e,t,n)},Hr:Ze,Img:Pt,Input:ft,Ins:ot,Kbd:nn,Label:Le,LazyImg:function(e,t){return Pt(e,{...t,loading:"lazy"})},Legend:wt,Li:Ut,Link:Ye,ListItem:Bt,Main:Et,Mark:nt,Match:_e,Menu:Rt,Meter:Ct,MonthInput:e=>ft({type:"month",...e}),NativeDocumentFragment:d,Nav:kt,NumberInput:e=>ft({type:"number",...e}),Ol:Ht,Option:vt,OrderedList:qt,Output:St,P:je,Paragraph:Re,PasswordInput:e=>ft({type:"password",...e}),Pre:Ge,Progress:Ot,Quote:lt,Radio:e=>ft({type:"radio",...e}),RangeInput:e=>ft({type:"range",...e}),ReadonlyInput:e=>ft({readonly:!0,...e}),Samp:rn,SearchInput:e=>ft({type:"search",...e}),Section:xt,Select:yt,ShowIf:Ie,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!p.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return Ie(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!p.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return Ie(e.when(t),n)}throw new r("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>At(e,{type:"button",...t}),Small:tt,Source:Yt,Span:Ve,Strong:qe,Sub:st,SubmitButton:(e,t)=>At(e,{type:"submit",...t}),Summary:Lt,Sup:it,Svg:Xt,Switch:Me,TBody:hn,TBodyCell:gn,TFoot:cn,TFootCell:bn,THead:ln,THeadCell:mn,TRow:dn,Table:un,Td:yn,TelInput:e=>ft({type:"tel",...e}),TextArea:mt,TextInput:bt,Th:fn,Time:Zt,TimeInput:e=>ft({type:"time",...e}),Tr:pn,Track:Gt,Ul:zt,UnorderedList:Wt,UrlInput:e=>ft({type:"url",...e}),Var:on,Video:Jt,Wbr:sn,WeekInput:e=>ft({type:"week",...e}),When:function(e){if(!p.isObservable(e))throw new r("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,Me(e,t,n)),toNdElement:()=>Me(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=d("Portal "+n);return r.appendChild(R.getChild(e)),(t||document.body).appendChild(r),r}});const $n={};function Sn(e,t,n={}){e="/"+g(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},u=n.layout||null,l={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=$n[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},p=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=h(t);return n&&n.pattern?(l[n.name]=n.pattern,c.push(n.name),n.pattern):e});return r=new RegExp("^"+t+"$"),r};this.name=()=>o,this.component=()=>t,this.middlewares=()=>s,this.shouldRebuild=()=>i,this.path=()=>e,this.layout=()=>u,this.match=function(e){e="/"+g(e,"/");if(!p().exec(e))return!1;const t={};return p().exec(e).forEach((e,n)=>{if(n<1)return;const r=c[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=h(n);if(t.params&&t.params[r.name])return t.params[r.name];throw new Error(`Missing parameter '${r.name}'`)}),r="object"==typeof t.query?new URLSearchParams(t.query).toString():null;return(t.basePath?t.basePath:"")+(r?`${n}?${r}`:n)}}class On extends Error{constructor(e,t){super(e),this.context=t}}const Cn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(g(e.suffix,"/"))}),n.push(g(t,"/")),n.join("/")},An=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},En=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},xn=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Dn(){const e=[];let t=0;const n=n=>{const o=t+n;if(!e[o])return;t=o;const{route:s,params:i,query:a,path:u}=e[o];r(u)},r=e=>{window.location.replace(`${window.location.pathname}${window.location.search}#${e}`)},o=()=>window.location.hash.slice(1);this.push=function(n){const{route:s,params:i,query:a,path:u}=this.resolve(n);u!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:u}),t++,r(u))},this.replace=function(n){const{route:r,params:s,query:i,path:a}=this.resolve(n);a!==o()&&(e[t]={route:r,params:s,query:i,path:a})},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){window.addEventListener("hashchange",()=>{const{route:e,params:t,query:n,path:r}=this.resolve(o());this.handleRouteChange(e,t,n,r)});const{route:r,params:s,query:i,path:a}=this.resolve(n||o());e.push({route:r,params:s,query:i,path:a}),t=0,this.handleRouteChange(r,s,i,a)}}function Nn(){this.push=function(e){try{const{route:t,path:n,params:r,query:o}=this.resolve(e);if(window.history.state&&window.history.state.path===n)return;window.history.pushState({name:t.name(),params:r,path:n},t.name()||n,n),this.handleRouteChange(t,r,o,n)}catch(e){n.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:r,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:r},t.name()||r,r),this.handleRouteChange(t,o,{},r)}catch(e){n.error("HistoryRouter","Error in replaceState",e)}},this.forward=function(){window.history.forward()},this.back=function(){window.history.back()},this.init=function(e){window.addEventListener("popstate",e=>{try{if(!e.state||!e.state.path)return;const t=e.state.path,{route:n,params:r,query:o,path:s}=this.resolve(t);if(!n)return;this.handleRouteChange(n,r,o,s)}catch(e){n.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:r,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,r,o,s)}}function kn(){const e=[];let t=0;const n=n=>{const r=t+n;if(!e[r])return;t=r;const{route:o,params:s,query:i,path:a}=e[r];this.handleRouteChange(o,s,i,a)};this.push=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]&&e[t].path===i||(e.splice(t+1),e.push({route:r,params:o,query:s,path:i}),t++,this.handleRouteChange(r,o,s,i))},this.replace=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]={route:r,params:o,query:s,path:i},this.handleRouteChange(r,o,s,i)},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){const r=n||window.location.pathname+window.location.search,{route:o,params:s,query:i,path:a}=this.resolve(r);e.push({route:o,params:s,query:i,path:a}),t=0,this.handleRouteChange(o,s,i,a)}}function Tn(e,t){const n=new Map,r=new WeakMap,o=new WeakMap;let s=null,i=null;const a=(e,t)=>{const n=o.get(e);if(n)return n;let r=e;return p.isAnchor(e)||(r=d(t),r.appendChild(e)),o.set(e,r),r},u=()=>{p.isAnchor(i)&&i.remove()},l=()=>{t.nodeValue="",u(),s&&s.remove()},c=e=>{let t=e;return p.isNDElement(e)&&(t=e.node()),t},h=function(e,n,o){const h=n.layout();if(h)return void((e,n,o,i)=>{let h=c(n);const p=r.get(h);if(p){if(p===s){const e=a(h,i);return u(),void e.replaceContent(h)}return l(),s=p,a(h,i).replaceContent(h),void t.appendChild(s)}l();const d=a(h,i);s=e(d),r.set(h,s),t.appendChild(s)})(h,e,0,o);let p=c(e);l(),t.appendChild(p),i=e},f=function(e){if(!e.route)return;const{route:t,params:r,query:o,path:s}=e;if(n.has(s)){const e=n.get(s);return void h(e,t)}const i=t.component()({params:r,query:o});n.set(s,i),h(i,t,s)};return e.subscribe(f),f(e.currentState()),t}const Fn="default";function In(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Dn.apply(this,[]);else if("history"===e.mode)Nn.apply(this,[]);else{if("memory"!==e.mode)throw new On("Invalid router mode "+e.mode);kn.apply(this,[])}const a=function(e,t){for(const r of s)try{r(e),t&&t(e)}catch(e){n.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,n,s){const i=new Sn(Cn(o,e),n,{...s,middlewares:An(o,s?.middlewares||[]),name:s?.name?En(o,s.name):null,layout:s?.layout||xn(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!p.isFunction(n))throw new On("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},n={}){const o=r[e];if(!o)throw new On(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if(p.isJson(e)){const t=r[e.name];if(!t)throw new On(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[n,o]=e.split("?"),s="/"+g(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new On(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:a,params:i,query:u,path:e}},this.subscribe=function(e){if(!p.isFunction(e))throw new On("Listener must be a function");return s.push(e),()=>{s.splice(s.indexOf(e),1)}},this.handleRouteChange=function(e,t,n,r){i.route=e,i.params=t,i.query=n,i.path=r;const o=[...e.middlewares(),a];let s=0;const u={...i},l=e=>{if(s++,!(s>=o.length))return o[s](e||u,l)};return o[s](u,l)}}function _n(e,t){const{to:n,href:r,...o}=e;if(r){const e=In.get();return Ye({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Fn,a=In.get(i);if(!a)throw new On('Router not found "'+i+'" for link "'+s.name+'"');const u=a.generateUrl(s.name,s.params,s.query);return Ye({...o,href:u},t).nd.onPreventClick(()=>{a.push(u)})}In.routers={},In.create=function(e,t){if(!p.isFunction(t))throw n.error("Router","Callback must be a function"),new On("Callback must be a function");const r=new In(e);return In.routers[e.name||Fn]=r,t(r),r.init(e.entry),r.mount=function(e){if(p.isString(e)){const t=document.querySelector(e);if(!t)throw new On(`Container not found for selector: ${e}`);e=t}else if(!p.isElement(e))throw new On("Container must be a string or an Element");return Tn(r,e)},r},In.get=function(e){const t=In.routers[e||Fn];if(!t)throw new On(`Router not found for name: ${e}`);return t},In.push=function(e,t=null){return In.get(t).push(e)},In.replace=function(e,t=null){return In.get(t).replace(e)},In.forward=function(e=null){return In.get(e).forward()},In.back=function(e=null){return In.get(e).back()},_n.blank=function(e,t){return Ye({...e,target:"_blank"},t)};var Mn=Object.freeze({__proto__:null,Link:_n,RouteParamPatterns:$n,Router:In});var Pn=Object.freeze({__proto__:null,memoize:e=>oe(e),once:e=>re(e),singleton:e=>ne(e)}),Vn=Object.freeze({__proto__:null,Cache:Pn,NativeFetch:function(e){const t={request:[],response:[]};this.interceptors={response:e=>{t.response.push(e)},request:e=>{t.request.push(e)}},this.fetch=async function(n,r,o={},s={}){if(s.formData){const e=new FormData;for(const t in o)e.append(t,o[t]);o=e}r.startsWith("http")||(r=(e.endsWith("/")?e:e+"/")+r);let i={method:n,headers:{...s.headers||{}}};if(o)if(o instanceof FormData)i.body=o;else if("GET"!==n)i.headers["Content-Type"]="application/json",i.body=JSON.stringify(o);else{const e=new URLSearchParams(o).toString();e&&(r=r+(r.includes("?")?"&":"?")+e)}for(const e of t.request)i=await e(i,r)||i;let a=await fetch(r,i);for(const e of t.response)a=await e(a,r)||a;const u=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(u?.message||a.statusText);throw e.status=a.status,e.data=u,e}return u},this.post=function(e,t={},n={}){return this.fetch("POST",e,t,n)},this.put=function(e,t={},n={}){return this.fetch("PUT",e,t,n)},this.delete=function(e,t={},n={}){return this.fetch("DELETE",e,t,n)},this.get=function(e,t={},n={}){return this.fetch("GET",e,t,n)}},filters:Ne});return e.$=T,e.ElementCreator=R,e.HtmlElementWrapper=Y,e.NDElement=i,e.Observable=k,e.PluginsManager=null,e.SingletonView=te,e.Store=C,e.StoreFactory=O,e.TemplateCloner=ee,e.Validator=p,e.autoMemoize=oe,e.autoOnce=re,e.classPropertyAccumulator=function(e=[]){let t=p.isString(e)?e.split(" ").filter(Boolean):e;const n=p.isArray(t);return{add(e,r=!0){n?t.push(e):t[e]=r},value:()=>n?t.join(" "):{...t}}},e.createTextNode=function(e){return p.isObservable(e)?R.createObservableNode(null,e):R.createStaticTextNode(null,e)},e.cssPropertyAccumulator=function(e={}){let t=p.isString(e)?e.split(";").filter(Boolean):e;const n=p.isArray(t);return{add(e,r){n?t.push(e+" : "+r):t[e]=r},value:()=>n?t.join(";").concat(";"):{...t}}},e.elements=wn,e.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n,s=t.get(r);if(s)return s;const i=e(...o);return t.set(r,i),i}},e.normalizeComponentArgs=K,e.obs=F,e.once=ne,e.router=Mn,e.useCache=function(e){let t=null;const n=function(n){return t||(t=new ee(e)),t.clone(n)};return e.length<2?function(...e){return n(e)}:function(e,t,...r){return n([e,t,...r])}},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new te(e)),t.render(n)}},e.utils=Vn,e.withValidation=z,e}({});
1
+ var NativeDocument=function(e){"use strict";let t={};t={log(){},warn(){},error(){},disable(){}};var n=t;class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function o(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}o.prototype.__$isObservableChecker=!0,o.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},o.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},o.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},o.prototype.set=function(e){return this.observable.set(e)},o.prototype.trigger=function(){return this.observable.trigger()},o.prototype.cleanup=function(){return this.observable.cleanup()};const s={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=s.mounted.get(e);if(t&&(t.inDom=!0,t.mounted))if(Array.isArray(t.mounted))for(const n of t.mounted)n(e);else t.mounted(e)},executeUnmountedCallback(e){const t=s.unmounted.get(e);if(!t)return;if(t.inDom=!1,!t.unmounted)return;let n=!1;if(Array.isArray(t.unmounted))for(const r of t.unmounted)!0===r(e)&&(n=!0);else n=!0===t.unmounted(e);n&&(t.disconnect(),e.nd?.remove())},checkMutation:function(e){for(const t of e){if(s.mountedSupposedSize>0)for(const e of t.addedNodes){if(s.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)s.executeMountedCallback(e)}if(s.unmountedSupposedSize>0)for(const e of t.removedNodes){if(s.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)s.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1,o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(s.mounted.delete(e),s.mountedSupposedSize--),r&&(s.unmounted.delete(e),s.unmountedSupposedSize--),o=null}};const i=(e,t)=>{o[e]?Array.isArray(o[e])?o[e].push(t):o[e]=[o[e],t]:o[e]=t};return{disconnect:()=>o?.disconnect(),mounted:t=>{i("mounted",t),s.mounted.set(e,o),n||(s.mountedSupposedSize++,n=!0)},unmounted:t=>{i("unmounted",t),s.unmounted.set(e,o),r||(s.unmountedSupposedSize++,r=!0)},off:(e,t)=>{((e,t)=>{if(o?.[e]){if(Array.isArray(o[e])){const n=o[e].indexOf(t);return n>-1&&o[e].splice(n,1),1===o[e].length&&(o[e]=o[e][0]),void(0===o[e].length&&(o[e]=null))}o[e]=null}})(e,t)}}}};s.observer=new MutationObserver(s.checkMutation),s.observer.observe(document.body,{childList:!0,subtree:!0});function i(e){this.$element=e,this.$observer=null}i.prototype.__$isNDElement=!0,i.prototype.valueOf=function(){return this.$element},i.prototype.ref=function(e,t){return e[t]=this.$element,this},i.prototype.refSelf=function(e,t){return e[t]=this,this},i.prototype.unmountChildren=function(){let e=this.$element;for(let t=0,n=e.children.length;t<n;t++){let n=e.children[t];n.$ndProx||n.nd?.remove(),n=null}return e=null,this},i.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},i.prototype.lifecycle=function(e){return this.$observer=this.$observer||s.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},i.prototype.mounted=function(e){return this.lifecycle({mounted:e})},i.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},i.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!s.beforeUnmount.has(n)){s.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;n.remove=async()=>{if(!t){t=!0;try{const e=s.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return s.beforeUnmount.get(n).set(e,t),this},i.prototype.htmlElement=function(){return this.$element},i.prototype.node=i.prototype.htmlElement,i.prototype.shadow=function(e,t=null){const n=this.$element,r=Array.from(n.childNodes),o=n.attachShadow({mode:e});if(t){const e=document.createElement("style");e.textContent=t,o.appendChild(e)}return n.append=o.append.bind(o),n.appendChild=o.appendChild.bind(o),o.append(...r),this},i.prototype.openShadow=function(e=null){return this.shadow("open",e)},i.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},i.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},i.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const n=e[t];"function"==typeof n?this[t]=n.bind(this):console.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},i.extend=function(e){if(!e||"object"!=typeof e)throw new r("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new r("NDElement.extend() requires an object, not an array");const t=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!Object.hasOwn(e,o))continue;const s=e[o];if("function"==typeof s){if(t.has(o))throw n.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);i.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),i.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return i};const a=1,u=3,l=8,c=11,h={[a]:!0,[u]:!0,[c]:!0,[l]:!0},p={isObservable:e=>e?.__$isObservable,isTemplateBinding:e=>e?.__$isTemplateBinding,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>p.isObservable(e)||p.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof o,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isNumber:e=>"number"==typeof e,isBoolean:e=>"boolean"==typeof e,isFunction:e=>"function"==typeof e,isAsyncFunction:e=>"function"==typeof e&&"AsyncFunction"===e.constructor.name,isObject:e=>"object"==typeof e&&null!==e,isJson:e=>!("object"!=typeof e||null===e||Array.isArray(e)||"Object"!==e.constructor.name),isElement:e=>e&&h[e.nodeType],isDOMNode:e=>h[e.nodeType],isFragment:e=>e?.nodeType===c,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof i,isValidChildren(e){Array.isArray(e)||(e=[e]);return 0===e.filter(e=>!this.isValidChild(e)).length},validateChildren(e){Array.isArray(e)||(e=[e]);const t=e.filter(e=>!this.isValidChild(e));if(t.length>0)throw new r(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(p.isObject(e)&&Object.values(e).some(e=>p.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new r("Event callback must be a function")}};function d(e,t=!1){const r=document.createDocumentFragment();r.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),s=document.createComment("/ Anchor End "+e);r.appendChild(o),r.appendChild(s),r.nativeInsertBefore=r.insertBefore,r.nativeAppendChild=r.appendChild,r.nativeAppend=r.append;const i=t?()=>!0:e=>e.firstChild===o&&e.lastChild===s;return r.appendElement=function(e,t=null){const n=o.parentNode,i=t||s;n!==r?n?.insertBefore(e,i):n.nativeInsertBefore(e,i)},r.appendChild=function(e,t=null){const o=s.parentNode;o?function(e,t,n){const o=p.isElement(t)?t:R.getChild(t);e!==r?i(e)&&n===s?e.append(o,n):e.insertBefore(o,n):e.nativeInsertBefore(o,n)}(o,e,t=t??s):n.error("Anchor","Anchor : parent not found",e)},r.append=function(...e){return r.appendChild(e)},r.removeChildren=function(){const e=s.parentNode;if(e===r)return;if(i(e))return void e.replaceChildren(o,s);let t,n=o.nextSibling;for(;n&&n!==s;)t=n.nextSibling,n.remove(),n=t},r.remove=function(){const e=s.parentNode;if(e===r)return;if(i(e))return void e.replaceChildren(o,s);let t,n=o.nextSibling;for(;n&&n!==s;)t=n.nextSibling,r.nativeAppend(n),n=t},r.removeWithAnchors=function(){r.removeChildren(),o.remove(),s.remove()},r.replaceContent=function(e){const t=p.isElement(e)?e:R.getChild(e),n=s.parentNode;n&&(i(n)?n.replaceChildren(o,t,s):(r.removeChildren(),n.insertBefore(t,s)))},r.setContent=r.replaceContent,r.insertBefore=function(e,t=null){r.appendChild(e,t)},r.endElement=function(){return s},r.startElement=function(){return o},r.restore=function(){r.appendChild(r)},r.clear=r.remove,r.detach=r.remove,r.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},r}DocumentFragment.prototype.setAttribute=()=>{};const f=new Set(["checked","selected","disabled","readonly","required","autofocus","multiple","autocomplete","hidden","contenteditable","spellcheck","translate","draggable","async","defer","autoplay","controls","loop","muted","download","reversed","open","default","formnovalidate","novalidate","scoped","itemscope","allowfullscreen","allowpaymentrequest","playsinline"]),m=function(){let e=0;const t=new Map;return{register(n){const r=++e;return t.set(r,new WeakRef(n)),r},unregister(e){t.delete(e)},getObservableById:e=>t.get(e)?.deref(),cleanup(){for(const[e,n]of t){const e=n.deref();e&&e.cleanup()}t.clear()},cleanObservables(e){if(t.size<e)return;let r=0;for(const[e,n]of t)n.deref()||(t.delete(e),r++);r>0&&n.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}(),b=function(e,t){this.$target=t,this.$observer=e};b.prototype.__$isObservableWhen=!0,b.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},b.prototype.val=function(){return this.$observer.$currentValue===this.$target},b.prototype.isMatch=b.prototype.val,b.prototype.isActive=b.prototype.val;const y=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},g=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},v=(e,t)=>{try{if(void 0!==window.structuredClone)return window.structuredClone(e)}catch(e){}if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>v(e));if(p.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=v(e[t]));return n},w={getJson(e){let t=localStorage.getItem(e);try{return JSON.parse(t)}catch(t){throw new r("invalid_json:"+e)}},getNumber(e){return Number(this.get(e))},getBool(e){const t=this.get(e);return"true"===t||"1"===t},setJson(e,t){localStorage.setItem(e,JSON.stringify(t))},setBool(e,t){localStorage.setItem(e,t?"true":"false")},get:(e,t=null)=>localStorage.getItem(e)||t,set:(e,t)=>localStorage.setItem(e,t),remove(e){localStorage.removeItem(e)},has:e=>null!=localStorage.getItem(e)},$=(e,t)=>{if(!w.has(e))return t;switch(typeof t){case"object":return w.getJson(e)??t;case"boolean":return w.getBool(e)??t;case"number":return w.getNumber(e)??t;default:return w.get(e,t)??t}},S=e=>{switch(typeof e){case"object":return w.setJson;case"boolean":return w.setBool;default:return w.set}},O=function(){const e=new Map,t=new Map,o=(t,o)=>{const s=e.get(o);if(!s)throw n.error("Store",`Store.${t}('${o}') : store not found. Did you call Store.create('${o}') first?`),new r(`Store.${t}('${o}') : store not found.`);return s},s=(e,t={})=>Array.isArray(e)?k.array(e,t):"object"==typeof e?k.object(e,t):k(e,t);return new Proxy({create(t,o){if(e.has(t))throw n.warn("Store",`Store.create('${t}') : a store with this name already exists. Use Store.get('${t}') to retrieve it.`),new r(`Store.create('${t}') : a store with this name already exists.`);const i=s(o);return e.set(t,{observer:i,subscribers:new Set,resettable:!1,composed:!1}),i},createResettable(t,o){if(e.has(t))throw n.warn("Store",`Store.createResettable('${t}') : a store with this name already exists.`),new r(`Store.createResettable('${t}') : a store with this name already exists.`);const i=s(o,{reset:!0});return e.set(t,{observer:i,subscribers:new Set,resettable:!0,composed:!1}),i},createComposed(t,o,s){if(e.has(t))throw n.warn("Store",`Store.createComposed('${t}') : a store with this name already exists.`),new r(`Store.createComposed('${t}') : a store with this name already exists.`);if("function"!=typeof o)throw new r(`Store.createComposed('${t}') : computation must be a function.`);if(!Array.isArray(s)||0===s.length)throw new r(`Store.createComposed('${t}') : dependencies must be a non-empty array of store names.`);const i=s.map(o=>{if("string"!=typeof o)return o;const s=e.get(o);if(!s)throw n.error("Store",`Store.createComposed('${t}') : dependency '${o}' not found. Create it first.`),new r(`Store.createComposed('${t}') : dependency store '${o}' not found.`);return s.observer}),a=k.computed(o,i);return e.set(t,{observer:a,subscribers:new Set,resettable:!1,composed:!0}),a},has:t=>e.has(t),reset(e){const t=o("reset",e);if(t.composed)throw n.error("Store",`Store.reset('${e}') : composed stores cannot be reset. Their value is derived from dependencies.`),new r(`Store.reset('${e}') : composed stores cannot be reset.`);if(!t.resettable)throw n.error("Store",`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`),new r(`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`);t.observer.reset()},use(e){const t=o("use",e);if(t.composed)throw n.error("Store",`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`),new r(`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`);const{observer:i,subscribers:a}=t,u=s(i.val()),l=e=>u.set(e),c=e=>i.set(e);return i.subscribe(l),u.subscribe(c),u.destroy=()=>{i.unsubscribe(l),u.unsubscribe(c),a.delete(u),u.cleanup()},u.dispose=u.destroy,a.add(u),u},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),u=e=>a.set(e);return t.subscribe(u),((e,t,o)=>{const s=e=>()=>{throw n.error("Store",`Store.${o}('${t}') is read-only. '${e}()' is not allowed.`),new r(`Store.${o}('${t}') is read-only.`)};e.set=s("set"),e.toggle=s("toggle"),e.reset=s("reset")})(a,e,"follow"),a.destroy=()=>{t.unsubscribe(u),i.delete(a),a.cleanup()},a.dispose=a.destroy,i.add(a),a},get(t){const r=e.get(t);return r?r.observer:(n.warn("Store",`Store.get('${t}') : store not found.`),null)},getWithSubscribers:t=>e.get(t)??null,delete(t){const r=e.get(t);r?(r.subscribers.forEach(e=>e.destroy()),r.subscribers.clear(),r.observer.cleanup(),e.delete(t)):n.warn("Store",`Store.delete('${t}') : store not found, nothing to delete.`)},group(e,t){"function"==typeof e&&(t=e,e="anonymous");const n=O();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,$(n,t)),o=S(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,$(n,t)),o=S(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{w.remove(n),s()},r}},{get(e,n){if("symbol"==typeof n||n.startsWith("$")||n in e)return e[n];if(e.has(n)){if(t.has(n))return t.get(n);const r=e.follow(n);return t.set(n,r),r}},set(e,t,o){throw n.error("Store",`Forbidden: You cannot overwrite the store key '${String(t)}'. Use .use('${String(t)}').set(value) instead.`),new r("Store structure is immutable. Use .set() on the observable.")},deleteProperty(e,t){throw new r("Store keys cannot be deleted.")}})},C=O();C.create("locale",navigator.language.split("-")[0]||"en");const A=(e,t)=>{const n=new Date(e);return{d:n,parts:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n).reduce((e,{type:t,value:n})=>(e[t]=n,e),{})}},E=(e,t,n)=>{const r=e=>String(e).padStart(2,"0");return e.replace("YYYY",n.year).replace("YY",n.year.slice(-2)).replace("MMMM",n.month).replace("MMM",n.month.slice(0,3)).replace("MM",r(t.getMonth()+1)).replace("DD",r(t.getDate())).replace("D",t.getDate()).replace("HH",n.hour).replace("mm",n.minute).replace("ss",n.second)},x={currency:(e,t,{currency:n="XOF",notation:r,minimumFractionDigits:o,maximumFractionDigits:s}={})=>new Intl.NumberFormat(t,{style:"currency",currency:n,notation:r,minimumFractionDigits:o,maximumFractionDigits:s}).format(e),number:(e,t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}={})=>new Intl.NumberFormat(t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}).format(e),percent:(e,t,{decimals:n=1}={})=>new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:n}).format(e),date:(e,t,{format:n,dateStyle:r="long"}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r}).format(new Date(e))},time:(e,t,{format:n,hour:r="2-digit",minute:o="2-digit",second:s}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{hour:r,minute:o,second:s}).format(new Date(e))},datetime:(e,t,{format:n,dateStyle:r="long",hour:o="2-digit",minute:s="2-digit",second:i}={})=>{if(n){const{d:r,parts:o}=A(e,t);return E(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r,hour:o,minute:s,second:i}).format(new Date(e))},relative:(e,t,{unit:n="day",numeric:r="auto"}={})=>{const o=Math.round((e-Date.now())/864e5);return new Intl.RelativeTimeFormat(t,{numeric:r}).format(o,n)},plural:(e,t,{singular:n,plural:r}={})=>`${e} ${"one"===new Intl.PluralRules(t).select(e)?n:r}`};function D(e,t=null){e=p.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$firstListener=null,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=p.isObject(e)?v(e):e))}Object.defineProperty(D.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),D.prototype.__$isObservable=!0;const N=function(){};function k(e,t=null){return new D(e,t)}D.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},D.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},D.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;for(let o=0,s=t.length;o<s;o++)t[o](r,n,e)},D.prototype.triggerWatchers=function(e){const t=this.$watchers,n=this.$previousValue,r=this.$currentValue,o=t.get(r),s=t.get(n);o&&o(!0,n,e),s&&s(!1,r,e)},D.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},D.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},D.prototype.assocTrigger=function(){this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?1===this.$listeners.length?(this.$firstListener=this.$listeners[0],this.trigger=this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=N},D.prototype.trigger=N,D.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(),this.$previousValue=null)},D.prototype.$setWithInterceptor=function(e){let t="function"==typeof e?e(this.$currentValue):e;const n=this.$interceptor(t,this.$currentValue);void 0!==n&&(t=n),this.$updateWithNewValue(t)},D.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},D.prototype.set=D.prototype.$basicSet,D.prototype.val=function(){return this.$currentValue},D.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=N},D.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},D.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}m.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},D.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},D.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);t.__$isObservable&&(t=t.set.bind(t)),n?p.isArray(n.list)?n.list.push(t):(n=[n,t],t=e=>{for(let t=0,r=n.length;t<r;t++)n[t](e)},t.list=n,this.$watchers.set(e,t)):(n=t,this.$watchers.set(e,t)),this.assocTrigger()},D.prototype.off=function(e,t){if(!this.$watchers)return;const n=this.$watchers.get(e);if(!n)return;if(!t||!Array.isArray(n.list))return this.$watchers?.delete(e),void this.assocTrigger();const r=n.indexOf(t);n?.splice(r,1),1===n.length?this.$watchers.set(e,n[0]):0===n.length&&this.$watchers?.delete(e),this.assocTrigger()},D.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=e=>{n(e)&&(this.unsubscribe(r),t(e))};this.subscribe(r)},D.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},D.prototype.check=function(e){return new o(this,e)},D.prototype.transform=D.prototype.check,D.prototype.pluck=D.prototype.check,D.prototype.is=D.prototype.check,D.prototype.select=D.prototype.check,D.prototype.get=function(e){const t=this.$currentValue[e];return p.isObservable(t)?t.val():t},D.prototype.when=function(e){return new b(this,e)},D.prototype.equals=function(e){return p.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},D.prototype.toBool=function(){return!!this.$currentValue},D.prototype.toggle=function(){this.set(!this.$currentValue)},D.prototype.reset=function(){if(!this.configs?.reset)return;const e=p.isObject(this.$initialValue)?v(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},D.prototype.toString=function(){return String(this.$currentValue)},D.prototype.valueOf=function(){return this.$currentValue},D.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new o(n,e);const r=x[e],s=x.locale;return k.computed(()=>r(n.val(),s.val(),t),[n,s])},D.prototype.persist=function(e,t={}){let n=$(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=S(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this};const T=k,F=k;function I(e,t){for(const n in t){const r=t[n];r.__$isObservable?(e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))):r.__$isObservableWhen?(e.classes.toggle(n,r.isActive()),r.subscribe(t=>e.classes.toggle(n,t))):r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}t=null}function _(e,t){for(const n in t){const r=t[n];r.__$isObservable?(e.style[n]=r.val(),r.subscribe(t=>e.style[n]=t)):e.style[n]=r}}function M(e,t,n){const r=n.__$isObservable,o=r?n.val():n;if(p.isBoolean(o)?e[t]=o:e[t]=o===e.value,r){if("checked"===t)return"boolean"==typeof o?e.addEventListener("input",()=>n.set(e[t])):e.addEventListener("input",()=>n.set(e.value)),void n.subscribe(n=>e[t]=n);n.subscribe(n=>e[t]=n===e.value)}}function P(e){this.$hydrate=e}k.useValueProperty=function(e="value"){Object.defineProperty(D.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},k.getById=function(e){const t=m.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},k.cleanup=function(e){e.cleanup()},k.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{m.cleanup()}),setInterval(()=>m.cleanObservables(r),n)},P.prototype.__$isTemplateBinding=!0,String.prototype.toNdElement=function(){return R.createStaticTextNode(null,this)},Element.prototype.toNdElement=function(){return this},Text.prototype.toNdElement=function(){return this},Comment.prototype.toNdElement=function(){return this},Document.prototype.toNdElement=function(){return this},DocumentFragment.prototype.toNdElement=function(){return this},D.prototype.toNdElement=function(){return R.createObservableNode(null,this)},o.prototype.toNdElement=D.prototype.toNdElement,i.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=R.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return R.getChild(this())},P.prototype.toNdElement=function(){return R.createHydratableNode(null,this)};const V=(e,t=1e3)=>new Promise(n=>{let r=!1;const o=t=>{t&&t.target!==e||r||(r=!0,e.removeEventListener("transitionend",o),e.removeEventListener("animationend",o),clearTimeout(s),n())};e.addEventListener("transitionend",o),e.addEventListener("animationend",o);const s=setTimeout(o,t),i=window.getComputedStyle(e),a="0s"!==i.transitionDuration,u="0s"!==i.animationDuration;a||u||o()});i.prototype.transitionOut=function(e){const t=e+"-exit";return this.beforeUnmount("transition-exit",async function(){this.$element.classes.add(t),await V(this.$element),this.$element.classes.remove(t)}),this},i.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to";return this.$element.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.$element.classes.remove(t),this.$element.classes.add(n),V(this.$element).then(()=>{this.$element.classes.remove(n)})})})}),this},i.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},i.prototype.animate=function(e){return this.$element.classes.add(e),V(this.$element).then(()=>{this.$element.classes.remove(e)}),this},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},D.prototype.handleNdAttribute=function(e,t){f.has(t)?M(e,t,this):function(e,t,n){const r="value"===t?t=>e.value=t:n=>e.setAttribute(t,n);if(n.subscribe(r),"value"===t)return e.value=n.val(),void e.addEventListener("input",()=>n.set(e.value));e.setAttribute(t,n.val())}(e,t,this)},P.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const L=new Map;let j=null;const R={createTextNode:()=>(j||(j=document.createTextNode("")),j.cloneNode()),createObservableNode(e,t){const n=R.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=R.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=R.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){const t=L.get(e);if(t)return t.cloneNode();const n=document.createElement(e);return L.set(e,n),n.cloneNode()}return d("Fragment")},bindTextNode(e,t){if(t?.__$isObservable)return t.subscribe(t=>e.nodeValue=t),void(e.nodeValue=t.val());e.nodeValue=t},processChildren(e,t){if(null===e)return;let n=this.getChild(e);n&&t.appendChild(n)},async safeRemove(e){await e.remove()},getChild(e){if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),p.isElement(e))return e}while(e.toNdElement);return R.createStaticTextNode(null,e)},processAttributes(e,t){t&&function(e,t){p.validateAttributes(t);for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){I(e,o);continue}if("style"===r){_(e,o);continue}}f.has(r)?M(e,r,o):e.setAttribute(r,o)}}}(e,t)}},q={configurable:!0,get(){return new i(this)}};Object.defineProperty(HTMLElement.prototype,"nd",q),Object.defineProperty(DocumentFragment.prototype,"nd",q),Object.defineProperty(i.prototype,"nd",{configurable:!0,get:function(){return this}}),["Click","DblClick","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Blur","Change","Focus","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","AfterPrint","BeforePrint","BeforeUnload","Error","HashChange","Load","Offline","Online","PageHide","PageShow","Resize","Scroll","Unload","Abort","CanPlay","CanPlayThrough","DurationChange","Emptied","Ended","LoadedData","LoadedMetadata","LoadStart","Pause","Play","Playing","Progress","RateChange","Seeked","Seeking","Stalled","Suspend","TimeUpdate","VolumeChange","Waiting","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),this}}),["Click","DblClick","MouseDown","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Change","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","BeforeUnload","HashChange","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["onStop"+e]=function(e=null){return B(this.$element,t,e),this},i.prototype["onPreventStop"+e]=function(e=null){return U(this.$element,t,e),this}}),["Click","DblClick","MouseDown","MouseUp","Wheel","KeyDown","KeyPress","Invalid","Reset","Submit","DragOver","Drop","BeforeUnload","TouchCancel","TouchEnd","TouchMove","TouchStart","Copy","Cut","Paste","ContextMenu"].forEach(e=>{const t=e.toLowerCase();i.prototype["onPrevent"+e]=function(e=null){return W(this.$element,t,e),this}}),i.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const W=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},B=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},U=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)}),this},H={getClasses(){return this.$element.className?.split(" ").filter(Boolean)},add(e){const t=this.getClasses();t.indexOf(e)>=0||(t.push(e),this.$element.className=t.join(" "))},remove(e){const t=this.getClasses(),n=t.indexOf(e);n<0||(t.splice(n,1),this.$element.className=t.join(" "))},toggle(e,t=void 0){const n=this.getClasses(),r=n.indexOf(e);if(r>=0){if(!0===t)return;n.splice(r,1)}else{if(!1===t)return;n.push(e)}this.$element.className=n.join(" ")},contains(e){return this.getClasses().indexOf(e)>=0}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...H}}});let z=e=>e;e.ArgTypes={},e.ArgTypes={string:()=>!0,number:()=>!0,boolean:()=>!0,observable:()=>!0,element:()=>!0,function:()=>!0,object:()=>!0,objectNotNull:()=>!0,children:()=>!0,attributes:()=>!0,optional:()=>!0,oneOf:()=>!0};const K=function(e,t=null){return Array.isArray(e)||"object"!=typeof e||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}};function J(e,t,n,r=null){let{props:o,children:s=null}=K(n,r),i=R.createElement(e),a=t&&"function"==typeof t?t(i):i;return R.processAttributes(a,o),R.processChildren(s,a),a}function Y(e,t=null){return J.bind(null,e,t)}const G=new WeakMap,Q=(e,t,n)=>{let r=null;if(t.attributes){r={};for(const e in t.attributes)r[e]=t.attributes[e].apply(null,n)}if(t.classes){r=r||{},r.class={};for(const e in t.classes)r.class[e]=t.classes[e].apply(null,n)}if(t.styles){r=r||{},r.style={};for(const e in t.styles)r.style[e]=t.styles[e].apply(null,n)}return r?(R.processAttributes(e,r),!0):null},X=(e,t,n)=>{if(!t.attach)return null;for(const r in t.attach)e.nd[r](function(...e){t.attach[r].apply(this,[...e,...n])})},Z=(e,t,n,r)=>{if(r.fn&&("string"==typeof r.fn?R.bindTextNode(t,n[0][r.fn]):r.fn(n,t,e)),r.children)for(let o=0,s=r.children.length;o<s;o++){const s=r.children[o],i=t.childNodes[s.index];Z(e,i,n,s)}};function ee(e){let t=null,n=!1;const r={fn:null,children:[]},o=(e,t,n)=>{const r=G.get(e);if(3===e.nodeType){if(r&&r.value){n.fn=r.value;const o=e.cloneNode();return"string"==typeof r.value?(R.bindTextNode(o,t[0][r.value]),o):(r.value(t,o),o)}return e.cloneNode(!0)}const s=e.cloneNode();r&&(Q(s,r,t),X(s,r,t),n.fn=(e,t)=>{Q(t,r,e),X(t,r,e)});const i=e.childNodes,a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],r={index:e,fn:null},u=o(n,t,r);(r.children||r.fn)&&a.push(r),s.appendChild(u)}return a.length&&(n.children=n.children||[],n.children=a),s},s=e=>{let n=t.cloneNode(!0);return Z(n,n,e,r),n};this.clone=i=>{if(t=e(this),!n)return this.clone=()=>t.cloneNode(!0),t.cloneNode(!0);const a=o(t,i,r);return this.clone=s,a};const i=(e,t)=>new P((r,o)=>{n=!0,function(e,t,n,r){G.has(n)||G.set(n,{});const o=G.get(n);"value"!==t?(o[t]=o[t]||{},o[t][r]=e):o.value=e}(e,t,r,o)});this.style=e=>i(e,"styles"),this.class=e=>i(e,"classes"),this.property=e=>this.value(e),this.value=e=>i("function"!=typeof e?e:(t,n)=>{R.bindTextNode(n,e(...t))},"value"),this.text=this.value,this.attr=e=>i(e,"attributes"),this.attach=e=>i(e,"attach")}function te(e){let t=null,n=null;this.render=r=>{if(t||(t=e(this)),!n)return t;for(const e in n){(0,n[e])(...r)}return t},this.createSection=(e,t)=>{n=n||{};const r=d("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}DocumentFragment.prototype.__IS_FRAGMENT=!0,Function.prototype.args=function(...e){return this},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new i(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){const t=(...n)=>{try{return this.apply(this,n)}catch(r){return e(r,{caller:t,args:n})}};return t},String.prototype.use=function(e){const t=this;return k.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return p.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return p.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!p.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return k.getById(n)}):this.valueOf()};const ne=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},re=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},oe=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{const o=t.get(r);if(o)return o;if(e.length>0)return(...n)=>{const o=e(...n,r);return t.set(r,o),o};const s=e(r);return t.set(r,s),s}})};function se(e){return e instanceof Date?e:new Date(e)}function ie(e,t){const n=se(e),r=se(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function ae(e){const t=se(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function ue(e,t){const n=p.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function le(e,t){const n=e.filter(p.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>p.isObservable(e)?e.val():e))}}function ce(e){return ue(e,(e,t)=>e===t)}function he(e){return ue(e,(e,t)=>e!==t)}function pe(e){return ue(e,(e,t)=>e>t)}function de(e){return ue(e,(e,t)=>e>=t)}function fe(e){return ue(e,(e,t)=>e<t)}function me(e){return ue(e,(e,t)=>e<=t)}function be(e,t=!0,n=""){return le([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function ye(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(p.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function ge(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(p.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const ve=pe,we=de,$e=fe,Se=me,Oe=ce,Ce=he,Ae=ye,Ee=ge;function xe(e,t=!1){return ue(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const De=xe;var Ne=Object.freeze({__proto__:null,all:Ae,and:ye,any:Ee,between:function(e,t){return le([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:De,createFilter:ue,createMultiSourceFilter:le,custom:function(e,...t){const n=t.filter(p.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>p.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)>se(t)),dateBefore:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)<se(t)),dateBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=se(e);return r>=se(t)&&r<=se(n)}),dateEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e,t)),dateTimeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)>se(t)),dateTimeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&se(e)<se(t)),dateTimeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=se(e);return r>=se(t)&&r<=se(n)}),dateTimeEquals:e=>ue(e,(e,t)=>!(!e||!t)&&se(e).getTime()===se(t).getTime()),endsWith:function(e,t=!1){return ue(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:Oe,equals:ce,getSecondsOfDay:ae,greaterThan:pe,greaterThanOrEqual:de,gt:ve,gte:we,inArray:function(e){return ue(e,(e,t)=>t.includes(e))},includes:xe,isEmpty:function(e=!0){return ue(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return ue(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:ie,lessThan:fe,lessThanOrEqual:me,lt:$e,lte:Se,match:be,neq:Ce,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:he,notIn:function(e){return ue(e,(e,t)=>!t.includes(e))},or:ge,startsWith:function(e,t=!1){return ue(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e)>ae(t)),timeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e)<ae(t)),timeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ae(e);return r>=ae(t)&&r<=ae(n)}),timeEquals:e=>ue(e,(e,t)=>{if(!e||!t)return!1;const n=se(e),r=se(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:se});const ke=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");D.call(this,e,t)};(ke.prototype=Object.create(D.prototype)).constructor=ke,ke.prototype.__$isObservableArray=!0,Object.defineProperty(ke.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{ke.prototype[e]=function(...t){const n=this.$currentValue[e].apply(this.$currentValue,t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{ke.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}}),ke.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},ke.prototype.at=function(e){return this.$currentValue[e]},ke.prototype.merge=function(e){this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})},ke.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},ke.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],s=n[t];return n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]}),!0},ke.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},ke.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},ke.prototype.isEmpty=function(){return 0===this.$currentValue.length},ke.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},ke.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=p.isObservable(o)?be(o,!1):o;if(e&&"object"==typeof e&&"callback"in e){if(r[t]=e.callback,e.dependencies){const t=Array.isArray(e.dependencies)?e.dependencies:[e.dependencies];n.push.apply(n,t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=k.array(),s=Object.entries(r),i=()=>{const e=t.val().filter(e=>{for(const[t,n]of s)if("_"===t){if(!n(e))return!1}else if(!n(e[t]))return!1;return!0});o.set(e)};return n.forEach(e=>e.subscribe(i)),i(),o},ke.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},ke.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},ke.prototype.deepSubscribe=function(e){const t=y(()=>e(this.val())),n=new WeakMap,r=e=>{n.has(e)||(e?.__$isObservableArray?n.set(e,e.deepSubscribe(t)):e?.__$isObservable&&(e.subscribe(t),n.set(e,()=>e.unsubscribe(t))))},o=e=>{const t=n.get(e);t&&(t(),n.delete(e))};return this.$currentValue.forEach(r),this.subscribe(t),this.subscribe((e,t,n)=>{switch(n?.action){case"push":case"unshift":case"merge":n.args.forEach(r);break;case"splice":{const[e,t,...s]=n.args;n.result?.forEach(o),s.forEach(r);break}case"remove":o(n.result);break;case"clear":this.$currentValue.forEach(o)}}),()=>{this.$currentValue.forEach(o)}},k.array=function(e=[],t=null){return new ke(e,t)},k.batch=function(e){const t=k(0),n=function(){if(p.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};const Te=function(e,t){D.call(this,e),this.$observables={},this.configs=t,this.$load(e);for(const t in e)Object.hasOwn(this,t)||Object.defineProperty(this,t,{get:()=>this.$observables[t],set:e=>this.$observables[t].set(e)})};Te.prototype=Object.create(D.prototype),Object.defineProperty(Te,"$value",{get(){return this.val()},set(e){this.set(e)}}),Te.prototype.__$isObservableObject=!0,Te.prototype.__isProxy__=!0,Te.prototype.$load=function(e){const t=this.configs;for(const n in e){const r=e[n];if(Array.isArray(r)){if(!1!==t?.deep){const e=r.map(e=>p.isJson(e)?k.json(e,t):p.isArray(e)?k.array(e,t):k(e,t));this.$observables[n]=k.array(e,t);continue}this.$observables[n]=k.array(r,t)}else p.isObservable(r)||p.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?k.object(r,t):k(r,t)}},Te.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(p.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>p.isObservable(e)?e.val():p.isProxy(e)?e.$value:e)),e[t]=r}else p.isProxy(n)?e[t]=n.$value:e[t]=n}return e},Te.prototype.$val=Te.prototype.val,Te.prototype.get=function(e){const t=this.$observables[e];return p.isObservable(t)?t.val():p.isProxy(t)?t.$value:t},Te.prototype.$get=Te.prototype.get,Te.prototype.set=function(e){const t=p.isProxy(e)?e.$value:e,n=this.configs;for(const r in t){const o=this.$observables[r],s=e[r],i=t[r];if(p.isObservable(o)){if(!p.isArray(i)){o.set(i);continue}const e=s.at(0);if(p.isObservable(e)||p.isProxy(e)){const t=i.map(t=>p.isProxy(e)?k.init(t,n):k(t,n));o.set(t);continue}o.set([...i]);continue}p.isProxy(o)?o.update(i):this[r]=i}},Te.prototype.$set=Te.prototype.set,Te.prototype.$updateWith=Te.prototype.set,Te.prototype.observables=function(){return Object.values(this.$observables)},Te.prototype.$observables=Te.prototype.observables,Te.prototype.keys=function(){return Object.keys(this.$observables)},Te.prototype.$keys=Te.prototype.keys,Te.prototype.clone=function(){return k.init(this.val(),this.configs)},Te.prototype.$clone=Te.prototype.clone,Te.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},Te.prototype.originalSubscribe=Te.prototype.subscribe,Te.prototype.subscribe=function(e){const t=this.observables(),n=y(()=>this.trigger());this.originalSubscribe(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];r.__$isObservableArray?r.deepSubscribe(n):r.subscribe(n)}},Te.prototype.configs=function(){return this.configs},Te.prototype.update=Te.prototype.set,k.init=function(e,t=null){return new Te(e,t)},k.arrayOfObject=function(e){return e.map(e=>k.object(e))},k.value=function(e){if(p.isObservable(e))return e.val();if(p.isProxy(e))return e.$value;if(p.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(k.value(r))}return t}return e},k.object=k.init,k.json=k.init,k.computed=function(e,t=[]){const n=new D(e()),o=y(()=>n.set(e()));if(p.isFunction(t)){if(!p.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{p.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const Fe=new Set(["clear","push","unshift","replace"]);const Ie=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!p.isObservable(e)&&!p.isObservableWhenResult(e))return n.warn("ShowIf","ShowIf : condition must be an Observable / "+r,e);const s=d("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=R.getChild(t),p.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},_e=function(e,t,n=!0){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=d("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=R.getChild(r),p.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),u=i(a);return u&&o.appendChild(u),e.subscribe(e=>{const t=i(e);o.remove(),t&&o.appendChild(t)}),o.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(e){n&&s.delete(e),delete t[e]}})},Me=function(e,t,n){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");return _e(e,{true:t,false:n})},Pe=Y("div"),Ve=Y("span"),Le=Y("label"),je=Y("p"),Re=je,qe=Y("strong"),We=Y("h1"),Be=Y("h2"),Ue=Y("h3"),He=Y("h4"),ze=Y("h5"),Ke=Y("h6"),Je=Y("br"),Ye=Y("a"),Ge=Y("pre"),Qe=Y("code"),Xe=Y("blockquote"),Ze=Y("hr"),et=Y("em"),tt=Y("small"),nt=Y("mark"),rt=Y("del"),ot=Y("ins"),st=Y("sub"),it=Y("sup"),at=Y("abbr"),ut=Y("cite"),lt=Y("q"),ct=Y("dl"),ht=Y("dt"),pt=Y("dd"),dt=Y("form",function(e){return e.submit=function(t){return"function"==typeof t?(e.onSubmit(e=>{e.preventDefault(),t(e)}),e):(this.setAttribute("action",t),e)},e.multipartFormData=function(){return this.setAttribute("enctype","multipart/form-data"),e},e.post=function(t){return this.setAttribute("method","post"),this.setAttribute("action",t),e},e.get=function(e){this.setAttribute("method","get"),this.setAttribute("action",e)},e}),ft=Y("input"),mt=Y("textarea"),bt=mt,yt=Y("select"),gt=Y("fieldset"),vt=Y("option"),wt=Y("legend"),$t=Y("datalist"),St=Y("output"),Ot=Y("progress"),Ct=Y("meter"),At=Y("button"),Et=Y("main"),xt=Y("section"),Dt=Y("article"),Nt=Y("aside"),kt=Y("nav"),Tt=Y("figure"),Ft=Y("figcaption"),It=Y("header"),_t=Y("footer"),Mt=Y("img"),Pt=function(e,t){return Mt({src:e,...t})},Vt=Y("details"),Lt=Y("summary"),jt=Y("dialog"),Rt=Y("menu"),qt=Y("ol"),Wt=Y("ul"),Bt=Y("li"),Ut=Bt,Ht=qt,zt=Wt,Kt=Y("audio"),Jt=Y("video"),Yt=Y("source"),Gt=Y("track"),Qt=Y("canvas"),Xt=Y("svg"),Zt=Y("time"),en=Y("data"),tn=Y("address"),nn=Y("kbd"),rn=Y("samp"),on=Y("var"),sn=Y("wbr"),an=Y("caption"),un=Y("table"),ln=Y("thead"),cn=Y("tfoot"),hn=Y("tbody"),pn=Y("tr"),dn=pn,fn=Y("th"),mn=fn,bn=fn,yn=Y("td"),gn=yn,vn=Y("");var wn=Object.freeze({__proto__:null,Abbr:at,Address:tn,Anchor:d,Article:Dt,Aside:Nt,AsyncImg:function(e,t,n,o){const s=p.isObservable(e)?e.val():e,i=Pt(t||s,n),a=new Image;return a.onload=()=>{p.isFunction(o)&&o(null,i),i.src=p.isObservable(e)?e.val():e},a.onerror=()=>{p.isFunction(o)&&o(new r("Image not found"))},p.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:Kt,BaseImage:Mt,Blockquote:Xe,Br:Je,Button:At,Canvas:Qt,Caption:an,Checkbox:e=>ft({type:"checkbox",...e}),Cite:ut,Code:Qe,ColorInput:e=>ft({type:"color",...e}),Data:en,Datalist:$t,DateInput:e=>ft({type:"date",...e}),DateTimeInput:e=>ft({type:"datetime-local",...e}),Dd:pt,Del:rt,Details:Vt,Dialog:jt,Div:Pe,Dl:ct,Dt:ht,Em:et,EmailInput:e=>ft({type:"email",...e}),FieldSet:gt,FigCaption:Ft,Figure:Tt,FileInput:e=>ft({type:"file",...e}),Footer:_t,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){const i=d("ForEach"),a=i.endElement();i.startElement();let u=new Map,l=null;const c=new Set,h=e=>{if(!s)for(const[t,n]of u.entries()){if(c.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),l&&l.delete(n.keyId)}},f=(e,s)=>{const i=((e,t,n)=>{if(p.isString(n)){const r=p.isObservable(e)?e.val():e,o=r?.[n];return p.isObservable(o)?o.val():o??t}return p.isFunction(n)?n(e,t):(p.isObservable(e)?e.val():e)??t})(e,s,o);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?k(s):null;let o=R.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(o),indexObserver:n})}catch(e){throw n.error("ForEach",`Error creating element for key ${i}`,e),e}return i},m=()=>{const t=a.parentNode;if(!t)return;const n=p.isObservable(e)?e.val():e;if(c.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=f(n[e],e);c.add(t)}else for(const e in n){const t=f(n[e],e);c.add(t)}if(0===c.size)return i.removeChildren(),h(),void l?.clear();h(t),l&&0!==l.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(c);Array.from(l);for(const n in t){const r=t[n],o=u.get(r);if(!o)continue;const s=o.child.deref();s&&e.appendChild(s)}i.replaceContent(e)})():(e=>{const t=document.createDocumentFragment();for(const e of c){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),l?.clear(),l=new Set([...c])};return m(),p.isObservable(e)&&e.subscribe(m),i},ForEachArray:function(e,t,n={}){const r=d("ForEach Array",n.isParentUniqueChild),o=r.endElement(),s=r.startElement();let i=new Map,a=0;const u=t.length>=2,l=e=>{r.removeChildren(),g(e),a=0},c=e=>i.get(e)?.child,h=(e,t=!0)=>{const n=i.get(e);if(n){if(t){const t=n.child;t?.remove(),i.delete(e)}n.indexObserver?.cleanup()}},f=e=>{const n=R.getChild(t(e,null));return i.set(e,{child:n,indexObserver:null}),n},m=(e,n)=>{const r=k(n),o=R.getChild(t(e,r));return i.set(e,{child:o,indexObserver:r}),o},b=(e,t)=>{const n=i.get(e);return n?(n.indexObserver?.set(t),n.child):f(e)};let y=f;const g=e=>{if(u){if(!n.shouldKeepItemsInCache)for(const[t,n]of i.entries())e&&e.includes(t)||h(t,!1)}else i.clear()},v=function(e,t){const n=i.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()},w={toFragment(e){const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(y(e[n],a)),a++;return t},add(e){r.appendElement(w.toFragment(e))},replace(e){l(e),w.add(e)},reOrder(e){let t=null;const n=document.createDocumentFragment();for(const r of e)t=c(r),t&&n.appendChild(t);t=null,r.appendElement(n,o)},removeOne(e,t){h(e,!0)},clear:l,merge(e){w.add(e)},push(e){let t=0;n.pushDelay&&(t=n.pushDelay(e)??0),w.add(e,t)},populate([e,t,n]){const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(y(t,r)),a++}r.appendChild(o),o.replaceChildren()},unshift(e){r.insertBefore(w.toFragment(e),s.nextSibling)},splice(e,t){const[n,s,...i]=e;let a=null;const u=document.createDocumentFragment();if(t.length>0){let e=t[0];if(1===t.length)v(e,u);else if(t.length>1){const e=c(t[0]);a=e?.previousSibling;for(let e=0;e<t.length;e++)v(t[e],u)}}else a=o;u.replaceChildren(),i&&i.length&&a&&r.insertBefore(w.toFragment(i),a.nextSibling)},reverse(e,t){w.reOrder(t)},sort(e,t){w.reOrder(t)},remove(e,t){w.removeOne(t)},pop(e,t){w.removeOne(t)},shift(e,t){w.removeOne(t)},swap(e,t){const n=o.parentNode;let r=c(t[0]),s=c(t[1]);if(!r||!s)return;const i=s.nextSibling;n.insertBefore(s,r),n.insertBefore(r,i),r=null,s=null}},$=(e,t,n)=>{if("clear"!==n?.action&&e.length){if(((e=null)=>{y=Fe.has(e)?u?m:f:i.size?b:u?m:f})(n?.action),n?.action)w[n.action]&&w[n.action](n.args,n.result);else{if(0===a)return void w.add(e);w.replace(e)}((e,t=0)=>{if(!u)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=i.get(e[r]);t&&(t.indexObserver?.set(n),n++)}})(e,0)}else{if(0===a)return;l()}};return e.val().length&&$(e.val(),0,{action:null}),p.isObservable(e)&&e.subscribe($),r},Form:dt,Fragment:vn,H1:We,H2:Be,H3:Ue,H4:He,H5:ze,H6:Ke,Header:It,HiddenInput:e=>ft({type:"hidden",...e}),HideIf:function(e,t,n){const r=k(!e.val());return e.subscribe(e=>r.set(!e)),Ie(r,t,n)},HideIfNot:function(e,t,n){return Ie(e,t,n)},Hr:Ze,Img:Pt,Input:ft,Ins:ot,Kbd:nn,Label:Le,LazyImg:function(e,t){return Pt(e,{...t,loading:"lazy"})},Legend:wt,Li:Ut,Link:Ye,ListItem:Bt,Main:Et,Mark:nt,Match:_e,Menu:Rt,Meter:Ct,MonthInput:e=>ft({type:"month",...e}),NativeDocumentFragment:d,Nav:kt,NumberInput:e=>ft({type:"number",...e}),Ol:Ht,Option:vt,OrderedList:qt,Output:St,P:je,Paragraph:Re,PasswordInput:e=>ft({type:"password",...e}),Pre:Ge,Progress:Ot,Quote:lt,Radio:e=>ft({type:"radio",...e}),RangeInput:e=>ft({type:"range",...e}),ReadonlyInput:e=>ft({readonly:!0,...e}),Samp:rn,SearchInput:e=>ft({type:"search",...e}),Section:xt,Select:yt,ShowIf:Ie,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!p.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return Ie(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!p.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return Ie(e.when(t),n)}throw new r("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>At(e,{type:"button",...t}),Small:tt,Source:Yt,Span:Ve,Strong:qe,Sub:st,SubmitButton:(e,t)=>At(e,{type:"submit",...t}),Summary:Lt,Sup:it,Svg:Xt,Switch:Me,TBody:hn,TBodyCell:gn,TFoot:cn,TFootCell:bn,THead:ln,THeadCell:mn,TRow:dn,Table:un,Td:yn,TelInput:e=>ft({type:"tel",...e}),TextArea:mt,TextInput:bt,Th:fn,Time:Zt,TimeInput:e=>ft({type:"time",...e}),Tr:pn,Track:Gt,Ul:zt,UnorderedList:Wt,UrlInput:e=>ft({type:"url",...e}),Var:on,Video:Jt,Wbr:sn,WeekInput:e=>ft({type:"week",...e}),When:function(e){if(!p.isObservable(e))throw new r("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,Me(e,t,n)),toNdElement:()=>Me(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=d("Portal "+n);return r.appendChild(R.getChild(e)),(t||document.body).appendChild(r),r}});const $n={};function Sn(e,t,n={}){e="/"+g(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},u=n.layout||null,l={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=$n[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},p=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=h(t);return n&&n.pattern?(l[n.name]=n.pattern,c.push(n.name),n.pattern):e});return r=new RegExp("^"+t+"$"),r};this.name=()=>o,this.component=()=>t,this.middlewares=()=>s,this.shouldRebuild=()=>i,this.path=()=>e,this.layout=()=>u,this.match=function(e){e="/"+g(e,"/");if(!p().exec(e))return!1;const t={};return p().exec(e).forEach((e,n)=>{if(n<1)return;const r=c[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=h(n);if(t.params&&t.params[r.name])return t.params[r.name];throw new Error(`Missing parameter '${r.name}'`)}),r="object"==typeof t.query?new URLSearchParams(t.query).toString():null;return(t.basePath?t.basePath:"")+(r?`${n}?${r}`:n)}}class On extends Error{constructor(e,t){super(e),this.context=t}}const Cn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(g(e.suffix,"/"))}),n.push(g(t,"/")),n.join("/")},An=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},En=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},xn=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Dn(){const e=[];let t=0;const n=n=>{const o=t+n;if(!e[o])return;t=o;const{route:s,params:i,query:a,path:u}=e[o];r(u)},r=e=>{window.location.replace(`${window.location.pathname}${window.location.search}#${e}`)},o=()=>window.location.hash.slice(1);this.push=function(n){const{route:s,params:i,query:a,path:u}=this.resolve(n);u!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:u}),t++,r(u))},this.replace=function(n){const{route:r,params:s,query:i,path:a}=this.resolve(n);a!==o()&&(e[t]={route:r,params:s,query:i,path:a})},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){window.addEventListener("hashchange",()=>{const{route:e,params:t,query:n,path:r}=this.resolve(o());this.handleRouteChange(e,t,n,r)});const{route:r,params:s,query:i,path:a}=this.resolve(n||o());e.push({route:r,params:s,query:i,path:a}),t=0,this.handleRouteChange(r,s,i,a)}}function Nn(){this.push=function(e){try{const{route:t,path:n,params:r,query:o}=this.resolve(e);if(window.history.state&&window.history.state.path===n)return;window.history.pushState({name:t.name(),params:r,path:n},t.name()||n,n),this.handleRouteChange(t,r,o,n)}catch(e){n.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:r,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:r},t.name()||r,r),this.handleRouteChange(t,o,{},r)}catch(e){n.error("HistoryRouter","Error in replaceState",e)}},this.forward=function(){window.history.forward()},this.back=function(){window.history.back()},this.init=function(e){window.addEventListener("popstate",e=>{try{if(!e.state||!e.state.path)return;const t=e.state.path,{route:n,params:r,query:o,path:s}=this.resolve(t);if(!n)return;this.handleRouteChange(n,r,o,s)}catch(e){n.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:r,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,r,o,s)}}function kn(){const e=[];let t=0;const n=n=>{const r=t+n;if(!e[r])return;t=r;const{route:o,params:s,query:i,path:a}=e[r];this.handleRouteChange(o,s,i,a)};this.push=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]&&e[t].path===i||(e.splice(t+1),e.push({route:r,params:o,query:s,path:i}),t++,this.handleRouteChange(r,o,s,i))},this.replace=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]={route:r,params:o,query:s,path:i},this.handleRouteChange(r,o,s,i)},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){const r=n||window.location.pathname+window.location.search,{route:o,params:s,query:i,path:a}=this.resolve(r);e.push({route:o,params:s,query:i,path:a}),t=0,this.handleRouteChange(o,s,i,a)}}function Tn(e,t){const n=new Map,r=new WeakMap,o=new WeakMap;let s=null,i=null;const a=(e,t)=>{const n=o.get(e);if(n)return n;let r=e;return p.isAnchor(e)||(r=d(t),r.appendChild(e)),o.set(e,r),r},u=()=>{p.isAnchor(i)&&i.remove()},l=()=>{t.nodeValue="",u(),s&&s.remove()},c=e=>{let t=e;return p.isNDElement(e)&&(t=e.node()),t},h=function(e,n,o){const h=n.layout();if(h)return void((e,n,o,i)=>{let h=c(n);const p=r.get(h);if(p){if(p===s){const e=a(h,i);return u(),void e.replaceContent(h)}return l(),s=p,a(h,i).replaceContent(h),void t.appendChild(s)}l();const d=a(h,i);s=e(d),r.set(h,s),t.appendChild(s)})(h,e,0,o);let p=c(e);l(),t.appendChild(p),i=e},f=function(e){if(!e.route)return;const{route:t,params:r,query:o,path:s}=e;if(n.has(s)){const e=n.get(s);return void h(e,t)}const i=t.component()({params:r,query:o});n.set(s,i),h(i,t,s)};return e.subscribe(f),f(e.currentState()),t}const Fn="default";function In(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Dn.apply(this,[]);else if("history"===e.mode)Nn.apply(this,[]);else{if("memory"!==e.mode)throw new On("Invalid router mode "+e.mode);kn.apply(this,[])}const a=function(e,t){for(const r of s)try{r(e),t&&t(e)}catch(e){n.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,n,s){const i=new Sn(Cn(o,e),n,{...s,middlewares:An(o,s?.middlewares||[]),name:s?.name?En(o,s.name):null,layout:s?.layout||xn(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!p.isFunction(n))throw new On("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},n={}){const o=r[e];if(!o)throw new On(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if(p.isJson(e)){const t=r[e.name];if(!t)throw new On(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[n,o]=e.split("?"),s="/"+g(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new On(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:a,params:i,query:u,path:e}},this.subscribe=function(e){if(!p.isFunction(e))throw new On("Listener must be a function");return s.push(e),()=>{s.splice(s.indexOf(e),1)}},this.handleRouteChange=function(e,t,n,r){i.route=e,i.params=t,i.query=n,i.path=r;const o=[...e.middlewares(),a];let s=0;const u={...i},l=e=>{if(s++,!(s>=o.length))return o[s](e||u,l)};return o[s](u,l)}}function _n(e,t){const{to:n,href:r,...o}=e;if(r){const e=In.get();return Ye({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Fn,a=In.get(i);if(!a)throw new On('Router not found "'+i+'" for link "'+s.name+'"');const u=a.generateUrl(s.name,s.params,s.query);return Ye({...o,href:u},t).nd.onPreventClick(()=>{a.push(u)})}In.routers={},In.create=function(e,t){if(!p.isFunction(t))throw n.error("Router","Callback must be a function"),new On("Callback must be a function");const r=new In(e);return In.routers[e.name||Fn]=r,t(r),r.init(e.entry),r.mount=function(e){if(p.isString(e)){const t=document.querySelector(e);if(!t)throw new On(`Container not found for selector: ${e}`);e=t}else if(!p.isElement(e))throw new On("Container must be a string or an Element");return Tn(r,e)},r},In.get=function(e){const t=In.routers[e||Fn];if(!t)throw new On(`Router not found for name: ${e}`);return t},In.push=function(e,t=null){return In.get(t).push(e)},In.replace=function(e,t=null){return In.get(t).replace(e)},In.forward=function(e=null){return In.get(e).forward()},In.back=function(e=null){return In.get(e).back()},_n.blank=function(e,t){return Ye({...e,target:"_blank"},t)};var Mn=Object.freeze({__proto__:null,Link:_n,RouteParamPatterns:$n,Router:In});var Pn=Object.freeze({__proto__:null,memoize:e=>oe(e),once:e=>re(e),singleton:e=>ne(e)}),Vn=Object.freeze({__proto__:null,Cache:Pn,NativeFetch:function(e){const t={request:[],response:[]};this.interceptors={response:e=>{t.response.push(e)},request:e=>{t.request.push(e)}},this.fetch=async function(n,r,o={},s={}){if(s.formData){const e=new FormData;for(const t in o)e.append(t,o[t]);o=e}r.startsWith("http")||(r=(e.endsWith("/")?e:e+"/")+r);let i={method:n,headers:{...s.headers||{}}};if(o)if(o instanceof FormData)i.body=o;else if("GET"!==n)i.headers["Content-Type"]="application/json",i.body=JSON.stringify(o);else{const e=new URLSearchParams(o).toString();e&&(r=r+(r.includes("?")?"&":"?")+e)}for(const e of t.request)i=await e(i,r)||i;let a=await fetch(r,i);for(const e of t.response)a=await e(a,r)||a;const u=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(u?.message||a.statusText);throw e.status=a.status,e.data=u,e}return u},this.post=function(e,t={},n={}){return this.fetch("POST",e,t,n)},this.put=function(e,t={},n={}){return this.fetch("PUT",e,t,n)},this.delete=function(e,t={},n={}){return this.fetch("DELETE",e,t,n)},this.get=function(e,t={},n={}){return this.fetch("GET",e,t,n)}},filters:Ne});return e.$=T,e.ElementCreator=R,e.HtmlElementWrapper=Y,e.NDElement=i,e.Observable=k,e.PluginsManager=null,e.SingletonView=te,e.Store=C,e.StoreFactory=O,e.TemplateCloner=ee,e.Validator=p,e.autoMemoize=oe,e.autoOnce=re,e.classPropertyAccumulator=function(e=[]){let t=p.isString(e)?e.split(" ").filter(Boolean):e;const n=p.isArray(t);return{add(e,r=!0){n?t.push(e):t[e]=r},value:()=>n?t.join(" "):{...t}}},e.createTextNode=function(e){return p.isObservable(e)?R.createObservableNode(null,e):R.createStaticTextNode(null,e)},e.cssPropertyAccumulator=function(e={}){let t=p.isString(e)?e.split(";").filter(Boolean):e;const n=p.isArray(t);return{add(e,r){n?t.push(e+" : "+r):t[e]=r},value:()=>n?t.join(";").concat(";"):{...t}}},e.elements=wn,e.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n,s=t.get(r);if(s)return s;const i=e(...o);return t.set(r,i),i}},e.normalizeComponentArgs=K,e.obs=F,e.once=ne,e.router=Mn,e.useCache=function(e){let t=null;const n=function(n){return t||(t=new ee(e)),t.clone(n)};return e.length<2?function(...e){return n(e)}:function(e,t,...r){return n([e,t,...r])}},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new te(e)),t.render(n)}},e.utils=Vn,e.withValidation=z,e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.105",
3
+ "version": "1.0.107",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -106,7 +106,7 @@ export function ForEachArray(data, callback, configs = {}) {
106
106
 
107
107
  let buildItem = createAndCache;
108
108
  const selectBuildStrategy = (action = null) => {
109
- if(CREATE_AND_CACHE_ACTIONS.includes(action)) {
109
+ if(CREATE_AND_CACHE_ACTIONS.has(action)) {
110
110
  buildItem = isIndexRequired ? createWithIndexAndCache : createAndCache;
111
111
  return;
112
112
  }
@@ -176,6 +176,7 @@ export function TemplateCloner($fn) {
176
176
  ElementCreator.bindTextNode(textNode, callbackOrProperty(...data));
177
177
  }, 'value');
178
178
  };
179
+ this.text = this.value;
179
180
  this.attr = (fn) => {
180
181
  return createBinding(fn, 'attributes');
181
182
  };